diff options
| author | bculkin2442 <bjculkin@mix.wvu.edu> | 2019-08-22 20:01:40 -0400 |
|---|---|---|
| committer | bculkin2442 <bjculkin@mix.wvu.edu> | 2019-08-22 20:01:40 -0400 |
| commit | 20bef6e26d948698398bd16aeab8c9e6b89110e4 (patch) | |
| tree | 8a21e17f78b330435f4ce2d4355d72b773230aa7 | |
| parent | 26fb28edd1ebb6390f8803fed3876d222cb8fdba (diff) | |
Format/import cleanup
185 files changed, 4889 insertions, 11794 deletions
diff --git a/src/main/java/com/pau101/util/BezierUtils.java b/src/main/java/com/pau101/util/BezierUtils.java index 27b82d5..cc57252 100755 --- a/src/main/java/com/pau101/util/BezierUtils.java +++ b/src/main/java/com/pau101/util/BezierUtils.java @@ -11,14 +11,13 @@ public final class BezierUtils { * Compute the value of all nth degree Bernstein polynomials. * * @param curveDegree - * : degree of curve + * : degree of curve * @param t - * : curve parameter on interval [0,1] + * : curve parameter on interval [0,1] * @param scalars - * : curveDegree + 1 Bernstein values. + * : curveDegree + 1 Bernstein values. */ - public static void allBernstein(int curveDegree, float t, - float scalars[]) { + public static void allBernstein(int curveDegree, float t, float scalars[]) { int j, k; float nt = 1 - t; float saved; @@ -38,16 +37,15 @@ public final class BezierUtils { * Compute point of nth degree Bezier curve. * * @param controlPoints - * : curveDegree + 1 control points + * : curveDegree + 1 control points * @param curveDegree - * : degree of curve + * : degree of curve * @param t - * : curve parameter on interval [0,1] + * : curve parameter on interval [0,1] * @param point - * : resulting point + * : resulting point */ - public static void pointOnBezierCurve(float controlPoints[][], - int curveDegree, float t, float point[]) { + public static void pointOnBezierCurve(float controlPoints[][], int curveDegree, float t, float point[]) { float scalars[] = new float[curveDegree + 1]; int k; allBernstein(curveDegree, t, scalars); @@ -60,51 +58,40 @@ public final class BezierUtils { } /** - * Compute an approximate length of a Bezier curve given the - * control points. + * Compute an approximate length of a Bezier curve given the control points. * * @param controlPoints - * : control points of a Bezier curve + * : control points of a Bezier curve * @return the approximate length */ public static float approximateLength(float controlPoints[][]) { float length = 0; for (int i = 0; i < controlPoints.length - 1; i++) { - float xDif = controlPoints[i + 1][0] - - controlPoints[i][0]; - float yDif = controlPoints[i + 1][1] - - controlPoints[i][1]; - float zDif = controlPoints[i + 1][2] - - controlPoints[i][2]; - length += Math.sqrt(xDif * xDif + yDif * yDif - + zDif * zDif); + float xDif = controlPoints[i + 1][0] - controlPoints[i][0]; + float yDif = controlPoints[i + 1][1] - controlPoints[i][1]; + float zDif = controlPoints[i + 1][2] - controlPoints[i][2]; + length += Math.sqrt(xDif * xDif + yDif * yDif + zDif * zDif); } return length; } - public static int tesselationSegementsForLength(float length, - float scale) { + public static int tesselationSegementsForLength(float length, float scale) { float noLessThan = 10 * scale; float segs = length * scale / 30F; - return (int) Math.ceil(Math.sqrt(segs * segs * 0.6 - + noLessThan * noLessThan)); + return (int) Math.ceil(Math.sqrt(segs * segs * 0.6 + noLessThan * noLessThan)); } public static float[][] curve(float controlPoints[][]) { return curve(controlPoints, 1); } - public static float[][] curve(float controlPoints[][], - float scale) { - int count = tesselationSegementsForLength( - approximateLength(controlPoints), scale); + public static float[][] curve(float controlPoints[][], float scale) { + int count = tesselationSegementsForLength(approximateLength(controlPoints), scale); float[][] points = new float[count][3]; for (int i = 0; i < count; i++) { float t = i / (float) (count - 1); float[] point = new float[3]; - pointOnBezierCurve(controlPoints, - controlPoints.length - 1, t, - point); + pointOnBezierCurve(controlPoints, controlPoints.length - 1, t, point); points[i] = point; } return points; diff --git a/src/main/java/com/pau101/util/CubicBezier.java b/src/main/java/com/pau101/util/CubicBezier.java index b681517..7071994 100755 --- a/src/main/java/com/pau101/util/CubicBezier.java +++ b/src/main/java/com/pau101/util/CubicBezier.java @@ -8,18 +8,10 @@ public class CubicBezier { public CubicBezier(float a1, float b1, float a2, float b2) { controlPoints = new float[4][]; - controlPoints[0] = new float[] { - 0, 0 - }; - controlPoints[1] = new float[] { - a1, b1 - }; - controlPoints[2] = new float[] { - a2, b2 - }; - controlPoints[3] = new float[] { - 1, 1 - }; + controlPoints[0] = new float[] { 0, 0 }; + controlPoints[1] = new float[] { a1, b1 }; + controlPoints[2] = new float[] { a2, b2 }; + controlPoints[3] = new float[] { 1, 1 }; } public float eval(float t) { diff --git a/src/main/java/darkknight/jewelrycraft/CreativeTabLiquids.java b/src/main/java/darkknight/jewelrycraft/CreativeTabLiquids.java index e272b51..d3f0739 100755 --- a/src/main/java/darkknight/jewelrycraft/CreativeTabLiquids.java +++ b/src/main/java/darkknight/jewelrycraft/CreativeTabLiquids.java @@ -15,7 +15,7 @@ public class CreativeTabLiquids extends CreativeTabs { * Instantiates a new creative tab liquids.
*
* @param name
- * the name
+ * the name
*/
public CreativeTabLiquids(String name) {
super(name);
@@ -36,12 +36,11 @@ public class CreativeTabLiquids extends CreativeTabs { /**
* @param list
- * List of items to display
+ * List of items to display
*/
@Override
public void displayAllReleventItems(List list) {
for (int i = 0; i < JewelrycraftUtil.objects.size(); i++)
- list.add(ItemList.bucket.getModifiedItemStack(
- JewelrycraftUtil.objects.get(i)));
+ list.add(ItemList.bucket.getModifiedItemStack(JewelrycraftUtil.objects.get(i)));
}
}
diff --git a/src/main/java/darkknight/jewelrycraft/JewelrycraftMod.java b/src/main/java/darkknight/jewelrycraft/JewelrycraftMod.java index 182cbb6..802724f 100755 --- a/src/main/java/darkknight/jewelrycraft/JewelrycraftMod.java +++ b/src/main/java/darkknight/jewelrycraft/JewelrycraftMod.java @@ -14,11 +14,7 @@ import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.SidedProxy;
-import cpw.mods.fml.common.event.FMLInitializationEvent;
-import cpw.mods.fml.common.event.FMLInterModComms;
-import cpw.mods.fml.common.event.FMLPostInitializationEvent;
-import cpw.mods.fml.common.event.FMLPreInitializationEvent;
-import cpw.mods.fml.common.event.FMLServerStartingEvent;
+import cpw.mods.fml.common.event.*;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper;
import darkknight.jewelrycraft.achievements.AchievementsList;
@@ -47,16 +43,14 @@ import net.minecraftforge.oredict.OreDictionary.OreRegisterEvent; @Mod(modid = Variables.MODID, name = Variables.MODNAME, version = Variables.VERSION, guiFactory = Variables.CONFIG_GUI, acceptedMinecraftVersions = "[1.7.10,1.8)")
public class JewelrycraftMod {
- private static final class CreativeTabJewleryCraft
- extends CreativeTabs {
+ private static final class CreativeTabJewleryCraft extends CreativeTabs {
private CreativeTabJewleryCraft(String lable) {
super(lable);
}
@Override
public Item getTabIconItem() {
- return Item.getItemFromBlock(
- BlockList.jewelCraftingTable);
+ return Item.getItemFromBlock(BlockList.jewelCraftingTable);
}
}
@@ -70,11 +64,8 @@ public class JewelrycraftMod { public static File dir;
- public static CreativeTabs jewelrycraft = new CreativeTabJewleryCraft(
- Variables.MODID);
- public static CreativeTabs liquids = new CreativeTabLiquids(
- "Liquids").setBackgroundImageName(
- "item_search.png");
+ public static CreativeTabs jewelrycraft = new CreativeTabJewleryCraft(Variables.MODID);
+ public static CreativeTabs liquids = new CreativeTabLiquids("Liquids").setBackgroundImageName("item_search.png");
public static SimpleNetworkWrapper netWrapper;
@@ -84,13 +75,12 @@ public class JewelrycraftMod { * Pre initialization of mod stuff.
*
* @param e
- * FMLPreInitializationEvent
+ * FMLPreInitializationEvent
* @throws IOException
- * Signals that an I/O exception has occurred.
+ * Signals that an I/O exception has occurred.
*/
@EventHandler
- public void preInit(FMLPreInitializationEvent e)
- throws IOException {
+ public void preInit(FMLPreInitializationEvent e) throws IOException {
dir = e.getModConfigurationDirectory();
logger = e.getModLog();
ConfigHandler.INSTANCE.loadConfig(e);
@@ -152,18 +142,15 @@ public class JewelrycraftMod { @EventHandler
public void imcCallback(FMLInterModComms.IMCEvent event) {
- for (final FMLInterModComms.IMCMessage imcMessage : event
- .getMessages()) {
- logger.info("The mod " + imcMessage.getSender()
- + " has sent the following message: "
+ for (final FMLInterModComms.IMCMessage imcMessage : event.getMessages()) {
+ logger.info("The mod " + imcMessage.getSender() + " has sent the following message: "
+ imcMessage.getStringValue());
}
}
@SubscribeEvent
public void oredictRegistered(OreRegisterEvent orev) {
- if (orev.Name.startsWith("ingot")
- || orev.Name.startsWith("alloy")) {
+ if (orev.Name.startsWith("ingot") || orev.Name.startsWith("alloy")) {
if (!JewelrycraftUtil.metal.contains(orev.Ore)) {
JewelrycraftUtil.metal.add(orev.Ore);
}
@@ -174,12 +161,10 @@ public class JewelrycraftMod { JewelrycraftUtil.metal.add(orev.Ore);
}
- ItemStack ingot = FurnaceRecipes.smelting()
- .getSmeltingResult(orev.Ore);
+ ItemStack ingot = FurnaceRecipes.smelting().getSmeltingResult(orev.Ore);
if (ingot != null) {
- JewelrycraftUtil.oreToIngot.put(orev.Ore,
- ingot);
+ JewelrycraftUtil.oreToIngot.put(orev.Ore, ingot);
}
}
}
diff --git a/src/main/java/darkknight/jewelrycraft/achievements/AchievementsList.java b/src/main/java/darkknight/jewelrycraft/achievements/AchievementsList.java index 6ef1f19..ac5d0b0 100755 --- a/src/main/java/darkknight/jewelrycraft/achievements/AchievementsList.java +++ b/src/main/java/darkknight/jewelrycraft/achievements/AchievementsList.java @@ -9,24 +9,18 @@ public class AchievementsList { public static AchievementPage jewelrycraft;
// Achievements
- public static final Achievement openGuide = new Achievement(
- "achievement.jewelrycraft.openGuide",
- "jewelrycraft.openGuide", 0, 0, ItemList.guide,
- (Achievement) null).initIndependentStat();
+ public static final Achievement openGuide = new Achievement("achievement.jewelrycraft.openGuide",
+ "jewelrycraft.openGuide", 0, 0, ItemList.guide, (Achievement) null).initIndependentStat();
// Challenges
- public static final Achievement pentagram = new Achievement(
- "achievement.jewelrycraft.pentagram",
- "jewelrycraft.pentagram", -3, -2, Items.ender_eye,
- (Achievement) null).initIndependentStat()
- .setSpecial();
+ public static final Achievement pentagram = new Achievement("achievement.jewelrycraft.pentagram",
+ "jewelrycraft.pentagram", -3, -2, Items.ender_eye, (Achievement) null).initIndependentStat().setSpecial();
public static void addAchievements() {
openGuide.registerStat();
pentagram.registerStat();
- jewelrycraft = new AchievementPage("Jewelrycraft 2",
- openGuide, pentagram);
+ jewelrycraft = new AchievementPage("Jewelrycraft 2", openGuide, pentagram);
AchievementPage.registerAchievementPage(jewelrycraft);
}
diff --git a/src/main/java/darkknight/jewelrycraft/api/Curse.java b/src/main/java/darkknight/jewelrycraft/api/Curse.java index dd220f1..6bf37ee 100755 --- a/src/main/java/darkknight/jewelrycraft/api/Curse.java +++ b/src/main/java/darkknight/jewelrycraft/api/Curse.java @@ -19,21 +19,21 @@ import net.minecraftforge.event.entity.player.PlayerSleepInBedEvent; import net.minecraftforge.event.world.BlockEvent;
public abstract class Curse {
- protected int textureID, ticksActive;
- protected String name, description, texturePackName;
+ protected int textureID, ticksActive;
+ protected String name, description, texturePackName;
- protected Random rand = new Random();
+ protected Random rand = new Random();
- private static ArrayList<Curse> curses = new ArrayList<>();
- public static ArrayList<Curse> availableCurses = new ArrayList<>();
+ private static ArrayList<Curse> curses = new ArrayList<>();
+ public static ArrayList<Curse> availableCurses = new ArrayList<>();
/**
* @param name
- * The name of the curse
+ * The name of the curse
* @param txtID
- * The texture ID of it
+ * The texture ID of it
* @param texturepack
- * The texturepack location
+ * The texturepack location
*/
protected Curse(String name, int txtID, String texturepack) {
this.name = name;
@@ -62,7 +62,7 @@ public abstract class Curse { /**
* @param desc
- * description of the curse
+ * description of the curse
* @return The class
*/
public Curse setDescription(String desc) {
@@ -88,9 +88,9 @@ public abstract class Curse { * This runs every tick
*
* @param world
- * The worldthe player is in
+ * The worldthe player is in
* @param player
- * The cursed player
+ * The cursed player
*/
public void action(World world, EntityPlayer player) {
ticksActive++;
@@ -108,14 +108,13 @@ public abstract class Curse { * This runs when the player dies
*
* @param world
- * The world the player is in
+ * The world the player is in
* @param player
- * The cursed player
+ * The cursed player
* @param event
- * The thing that killed the player
+ * The thing that killed the player
*/
- public void playerDeathAction(World world, EntityPlayer player,
- LivingDeathEvent event) {
+ public void playerDeathAction(World world, EntityPlayer player, LivingDeathEvent event) {
// Do nothing
}
@@ -123,30 +122,27 @@ public abstract class Curse { * This runs when the player is healed
*
* @param world
- * The world the player is in
+ * The world the player is in
* @param player
- * The cursed player
+ * The cursed player
* @param event
- * The event that the player is healing from
+ * The event that the player is healing from
*/
- public void playerHealAction(World world, EntityPlayer player,
- LivingHealEvent event) {
+ public void playerHealAction(World world, EntityPlayer player, LivingHealEvent event) {
// Do nothing
}
/**
- * This runs when an entity is killed (whether by a player or other
- * causes)
+ * This runs when an entity is killed (whether by a player or other causes)
*
* @param world
- * The world the player is in
+ * The world the player is in
* @param target
- * The entity that died
+ * The entity that died
* @param player
- * The cursed player
+ * The cursed player
*/
- public void entityDeathAction(World world, EntityLivingBase target,
- EntityPlayer player) {
+ public void entityDeathAction(World world, EntityLivingBase target, EntityPlayer player) {
// Do nothing
}
@@ -154,67 +150,63 @@ public abstract class Curse { * This runs when the player respawns
*
* @param world
- * The world the player is in
+ * The world the player is in
* @param player
- * The cursed player
+ * The cursed player
*/
public void respawnAction(World world, EntityPlayer player) {
// Do nothing
}
/**
- * This runs when a player gets attacked by anything but another
- * player
+ * This runs when a player gets attacked by anything but another player
*
* @param world
- * The world the player is in
+ * The world the player is in
* @param player
- * The cursed player
+ * The cursed player
* @param event
- * The event that attacked the player
+ * The event that attacked the player
* @param attacker
- * The entity that attacked the player
+ * The entity that attacked the player
*/
- public void attackedAction(World world, EntityPlayer player,
- LivingAttackEvent event, Entity attacker) {
+ public void attackedAction(World world, EntityPlayer player, LivingAttackEvent event, Entity attacker) {
// Do nothing
}
/**
- * This runs when an entity is attacked by a player (this includes
- * other players)
+ * This runs when an entity is attacked by a player (this includes other
+ * players)
*
* @param event
*
* @param world
- * The world the player is in
+ * The world the player is in
* @param player
- * The player that caused the damage
+ * The player that caused the damage
* @param target
- * The entity damaged
+ * The entity damaged
*/
- public void attackedByPlayerAction(LivingAttackEvent event,
- World world, EntityPlayer player, Entity target) {
+ public void attackedByPlayerAction(LivingAttackEvent event, World world, EntityPlayer player, Entity target) {
// Do nothing
}
/**
- * This runs when an entity is attacked by a player (this includes
- * other players). This can cancel the damaging event.
+ * This runs when an entity is attacked by a player (this includes other
+ * players). This can cancel the damaging event.
*
* @param event
*
* @param world
- * The world the player is in
+ * The world the player is in
* @param player
- * The player that caused the damage
+ * The player that caused the damage
* @param target
- * The entity damaged
+ * The entity damaged
* @return Whether or not to cancel the event
*/
- public boolean attackedByPlayerActionCancelable(
- LivingAttackEvent event, World world,
- EntityPlayer player, Entity target) {
+ public boolean attackedByPlayerActionCancelable(LivingAttackEvent event, World world, EntityPlayer player,
+ Entity target) {
return false;
}
@@ -222,60 +214,54 @@ public abstract class Curse { * This runs when an item is dropped by an entity
*
* @param player
- * The cursed player
+ * The cursed player
* @param target
- * The entity that drops the item
+ * The entity that drops the item
* @param drops
- * An array list containing the dropped items
+ * An array list containing the dropped items
*/
- public void entityDropItems(EntityPlayer player, Entity target,
- ArrayList<EntityItem> drops) {
+ public void entityDropItems(EntityPlayer player, Entity target, ArrayList<EntityItem> drops) {
// Do nothing
}
/**
- * This is for rendering special things on the player in 3rd person
- * (meaning you won't see this render); This will also render in
- * the inventory.
+ * This is for rendering special things on the player in 3rd person (meaning you
+ * won't see this render); This will also render in the inventory.
*
* @param player
- * The cursed player
+ * The cursed player
* @param event
- * The event used for this
+ * The event used for this
*/
@SideOnly(Side.CLIENT)
- public void playerRender(EntityPlayer player,
- RenderPlayerEvent.Specials.Post event) {
+ public void playerRender(EntityPlayer player, RenderPlayerEvent.Specials.Post event) {
// Do nothing
}
/**
- * This is for rendering special things on the player in 1st and
- * 3rd person, but not in the player inventory.
+ * This is for rendering special things on the player in 1st and 3rd person, but
+ * not in the player inventory.
*
* @param player
- * The cursed player
+ * The cursed player
* @param event
- * The event used for this
+ * The event used for this
*/
@SideOnly(Side.CLIENT)
- public void playerHandRender(EntityPlayer player,
- RenderHandEvent event) {
+ public void playerHandRender(EntityPlayer player, RenderHandEvent event) {
// Do nothing
}
/**
- * This runs when a block drops an item (such as breaking a block
- * and dropping itself, or breaking like a Diamond ore and dropping
- * diamonds)
+ * This runs when a block drops an item (such as breaking a block and dropping
+ * itself, or breaking like a Diamond ore and dropping diamonds)
*
* @param player
- * The cursed player
+ * The cursed player
* @param event
- * The BlockEvent that triggers this
+ * The BlockEvent that triggers this
*/
- public void onBlockItemsDrop(EntityPlayer player,
- BlockEvent.HarvestDropsEvent event) {
+ public void onBlockItemsDrop(EntityPlayer player, BlockEvent.HarvestDropsEvent event) {
// Do nothing
}
@@ -283,44 +269,41 @@ public abstract class Curse { * This runs when a block is destroyed
*
* @param player
- * The cursed player
+ * The cursed player
* @param event
- * The BlockEvent that runs this
+ * The BlockEvent that runs this
*/
- public void onBlockDestroyed(EntityPlayer player,
- BlockEvent.BreakEvent event) {
+ public void onBlockDestroyed(EntityPlayer player, BlockEvent.BreakEvent event) {
// Do nothing
}
/**
* This determines if the player can toss an item or not (with Q)
*
- * @return True if the player can no longer toss items; False if he
- * can. (by default false)
+ * @return True if the player can no longer toss items; False if he can. (by
+ * default false)
*/
public boolean itemToss() {
return false;
}
/**
- * This controls whether a curse can be activated or not (makes it
- * easy to do things like disable certain curses if in hardcore)
+ * This controls whether a curse can be activated or not (makes it easy to do
+ * things like disable certain curses if in hardcore)
*
* @param world
- * The world the player is in
- * @return True for curses to be used; False otherwise (by default
- * true)
+ * The world the player is in
+ * @return True for curses to be used; False otherwise (by default true)
*/
public boolean canCurseBeActivated(World world) {
return canCurseBeActivated();
}
/**
- * This controls whether a curse can be activated or not (makes it
- * easy to do things like disable certain curses if in hardcore)
+ * This controls whether a curse can be activated or not (makes it easy to do
+ * things like disable certain curses if in hardcore)
*
- * @return True for curses to be used; False otherwise (by default
- * true)
+ * @return True for curses to be used; False otherwise (by default true)
*/
public boolean canCurseBeActivated() {
return true;
@@ -336,26 +319,24 @@ public abstract class Curse { }
/**
- * This is the weight of the curse when it chooses it. The lower
- * the value, the less it gets chosen; the higher the value, the
- * higher the chance of it getting picked.
+ * This is the weight of the curse when it chooses it. The lower the value, the
+ * less it gets chosen; the higher the value, the higher the chance of it
+ * getting picked.
*
* @param world
- * The world the player is currently in
+ * The world the player is currently in
* @param player
- * The cursed player
+ * The cursed player
* @param random
- * A random class
+ * A random class
* @return The weight of the curse (by default 10)
*/
- public int weight(World world, EntityPlayer player,
- Random random) {
+ public int weight(World world, EntityPlayer player, Random random) {
return 10;
}
/*
- * This stat is used to determine the chance of certain actions
- * happening
+ * This stat is used to determine the chance of certain actions happening
*/
public int luck() {
return 0;
@@ -365,14 +346,13 @@ public abstract class Curse { * This event is called whenever the player attempts to sleep.
*
* @param worldObj
- * the world
+ * the world
* @param player
- * the cursed player
+ * the cursed player
* @param event
- * the sleeping event
+ * the sleeping event
*/
- public void playerSleepAction(World worldObj, EntityPlayer player,
- PlayerSleepInBedEvent event) {
+ public void playerSleepAction(World worldObj, EntityPlayer player, PlayerSleepInBedEvent event) {
}
}
diff --git a/src/main/java/darkknight/jewelrycraft/api/IJewelryItem.java b/src/main/java/darkknight/jewelrycraft/api/IJewelryItem.java index ad15c7a..878ceee 100755 --- a/src/main/java/darkknight/jewelrycraft/api/IJewelryItem.java +++ b/src/main/java/darkknight/jewelrycraft/api/IJewelryItem.java @@ -15,8 +15,8 @@ import net.minecraftforge.event.entity.player.PlayerEvent; */
public interface IJewelryItem {
/**
- * @return Returns the id of the type, 0 is for ring, 1 is for
- * bracelet, 2 is for necklace and 3 is for earrings
+ * @return Returns the id of the type, 0 is for ring, 1 is for bracelet, 2 is
+ * for necklace and 3 is for earrings
*/
public int type();
@@ -24,84 +24,76 @@ public interface IJewelryItem { * This is the action performed each player tick
*
* @param item
- * The item stack of the item (allows for fine item
- * search, like metadata and nbt)
+ * The item stack of the item (allows for fine item search, like
+ * metadata and nbt)
* @param player
- * The player wearing the jewelry
+ * The player wearing the jewelry
*/
public void onWearAction(ItemStack item, EntityPlayer player);
/**
- * This performs an action whenever a player gets attacked by an
- * entity besides another Player
+ * This performs an action whenever a player gets attacked by an entity besides
+ * another Player
*
* @param item
- * The item stack of the item (allows for fine item
- * search, like metadata and nbt)
+ * The item stack of the item (allows for fine item search, like
+ * metadata and nbt)
* @param player
- * The player that was attacked
+ * The player that was attacked
* @param source
- * Source of the damage
+ * Source of the damage
* @param amount
- * The amount of damage taken
+ * The amount of damage taken
*/
- public void onPlayerAttackedAction(ItemStack item,
- EntityPlayer player, DamageSource source,
- float amount);
+ public void onPlayerAttackedAction(ItemStack item, EntityPlayer player, DamageSource source, float amount);
/**
- * This does an action whenever an Entity gets attacked by a
- * player, this includes other Players
+ * This does an action whenever an Entity gets attacked by a player, this
+ * includes other Players
*
* @param item
- * The item stack of the item (allows for fine item
- * search, like metadata and nbt)
+ * The item stack of the item (allows for fine item search, like
+ * metadata and nbt)
* @param player
- * The attacking player
+ * The attacking player
* @param entity
- * The target entity
+ * The target entity
* @param amount
- * The amount of damage dealt
+ * The amount of damage dealt
*/
- public void onEntityAttackedByPlayer(ItemStack item,
- EntityPlayer player, EntityLivingBase entity,
- float amount);
+ public void onEntityAttackedByPlayer(ItemStack item, EntityPlayer player, EntityLivingBase entity, float amount);
/**
* This runs whenever a player dies
*
* @param item
- * The item stack of the item (allows for fine item
- * search, like metadata and nbt)
+ * The item stack of the item (allows for fine item search, like
+ * metadata and nbt)
* @param player
- * The player that died
+ * The player that died
* @param source
- * The damage source that caused the death
+ * The damage source that caused the death
*/
- public void onPlayerDeadAction(ItemStack item, EntityPlayer player,
- DamageSource source);
+ public void onPlayerDeadAction(ItemStack item, EntityPlayer player, DamageSource source);
/**
- * Runs whenever a player respawns (switches dimensions or actually
- * respawns)
+ * Runs whenever a player respawns (switches dimensions or actually respawns)
*
* @param item
- * The item stack of the item (allows for fine item
- * search, like metadata and nbt)
+ * The item stack of the item (allows for fine item search, like
+ * metadata and nbt)
* @param event
- * The clone event that runs whenever a player
- * respawns, either because he died or switched
- * dimensions
+ * The clone event that runs whenever a player respawns, either
+ * because he died or switched dimensions
*/
- public void onPlayerRespawnAction(ItemStack item,
- PlayerEvent.Clone event);
+ public void onPlayerRespawnAction(ItemStack item, PlayerEvent.Clone event);
/**
* This runs when the item is equipped
*
* @param item
- * The item stack of the item (allows for fine item
- * search, like metadata and nbt)
+ * The item stack of the item (allows for fine item search, like
+ * metadata and nbt)
*/
public void onJewelryEquipped(ItemStack item);
@@ -109,8 +101,8 @@ public interface IJewelryItem { * This runs when the item is unequipped
*
* @param item
- * The item stack of the item (allows for fine item
- * search, like metadata and nbt)
+ * The item stack of the item (allows for fine item search, like
+ * metadata and nbt)
*/
public void onJewelryUnequipped(ItemStack item);
}
diff --git a/src/main/java/darkknight/jewelrycraft/api/ModifierEffects.java b/src/main/java/darkknight/jewelrycraft/api/ModifierEffects.java index 389bafc..7b89b8c 100755 --- a/src/main/java/darkknight/jewelrycraft/api/ModifierEffects.java +++ b/src/main/java/darkknight/jewelrycraft/api/ModifierEffects.java @@ -11,13 +11,13 @@ import net.minecraft.util.DamageSource; import net.minecraftforge.event.entity.player.PlayerEvent;
public class ModifierEffects {
- protected ItemStack modifier;
- protected Random rand = new Random();
- protected static ArrayList<ModifierEffects> effects = new ArrayList<>();
+ protected ItemStack modifier;
+ protected Random rand = new Random();
+ protected static ArrayList<ModifierEffects> effects = new ArrayList<>();
/**
* @param modifier
- * The item to use as modifier
+ * The item to use as modifier
*/
public ModifierEffects(ItemStack modifier) {
this.modifier = modifier;
@@ -42,116 +42,97 @@ public class ModifierEffects { * This runs every tick
*
* @param item
- * The ItemStack representing the jewelry that runs
- * the effect
+ * The ItemStack representing the jewelry that runs the effect
* @param player
- * The player wearing the jewelry wearing a jewelry
- * with this modifier on it
+ * The player wearing the jewelry wearing a jewelry with this
+ * modifier on it
* @param jewelry
- * The actual jewelry item (used by me to determine
- * the type of jewelry so I don't have to call
- * item.getItem() blah blah blah)
+ * The actual jewelry item (used by me to determine the type of
+ * jewelry so I don't have to call item.getItem() blah blah blah)
*/
- public void action(ItemStack item, EntityPlayer player,
- Item jewelry) {
+ public void action(ItemStack item, EntityPlayer player, Item jewelry) {
// Do nothing
};
/**
- * This runs when an entity is attacked. This event can be
- * canceled.
+ * This runs when an entity is attacked. This event can be canceled.
*
* @param item
- * The ItemStack representing the jewelry that runs
- * the effect
+ * The ItemStack representing the jewelry that runs the effect
* @param player
- * The player wearing the jewelry wearing a jewelry
- * with this modifier on it
+ * The player wearing the jewelry wearing a jewelry with this
+ * modifier on it
* @param target
- * The attacked entity
+ * The attacked entity
* @param jewelry
- * The actual jewelry item (aka item.getItem(),
- * almost)
+ * The actual jewelry item (aka item.getItem(), almost)
* @param amount
- * The amount of damage the entity took
+ * The amount of damage the entity took
* @return The state of the event (true to cancel it, false to not)
*/
- public boolean onEntityAttackedCancellable(ItemStack item,
- EntityPlayer player, Entity target, Item jewelry,
+ public boolean onEntityAttackedCancellable(ItemStack item, EntityPlayer player, Entity target, Item jewelry,
float amount) {
return false;
}
/**
- * This runs when a player gets damaged. This event can be
- * canceled.
+ * This runs when a player gets damaged. This event can be canceled.
*
* @param item
- * The ItemStack representing the jewelry that runs
- * the effect
+ * The ItemStack representing the jewelry that runs the effect
* @param player
- * The attacked player wearing a jewelry with this
- * modifier on it
+ * The attacked player wearing a jewelry with this modifier on it
* @param source
- * The source of the damage
+ * The source of the damage
* @param jewelry
- * The actual jewelry item (aka item.getItem(),
- * almost)
+ * The actual jewelry item (aka item.getItem(), almost)
* @param amount
- * The amount of damage the player took
+ * The amount of damage the player took
* @return The state of the event (true to cancel it, false to not)
*/
- public boolean onPlayerAttackedCancellable(ItemStack item,
- EntityPlayer player, DamageSource source,
- Item jewelry, float amount) {
+ public boolean onPlayerAttackedCancellable(ItemStack item, EntityPlayer player, DamageSource source, Item jewelry,
+ float amount) {
return false;
}
/**
- * This is the same as onEntityAttackedCacellable, but this can not
- * be canceled. I recommend using this over
- * onEntityAttackedCacellable, as it is more reliable.
+ * This is the same as onEntityAttackedCacellable, but this can not be canceled.
+ * I recommend using this over onEntityAttackedCacellable, as it is more
+ * reliable.
*
* @param item
- * The ItemStack representing the jewelry that runs
- * the effect
+ * The ItemStack representing the jewelry that runs the effect
* @param player
- * The player wearing the jewelry wearing a jewelry
- * with this modifier on it
+ * The player wearing the jewelry wearing a jewelry with this
+ * modifier on it
* @param target
- * The attacked entity
+ * The attacked entity
* @param jewelry
- * The actual jewelry item (aka item.getItem(),
- * almost)
+ * The actual jewelry item (aka item.getItem(), almost)
* @param amount
- * The amount of damage the entity took
+ * The amount of damage the entity took
*/
- public void onEntityAttacked(ItemStack item, EntityPlayer player,
- Entity target, Item jewelry, float amount) {
+ public void onEntityAttacked(ItemStack item, EntityPlayer player, Entity target, Item jewelry, float amount) {
// Do nothing
}
/**
- * This is just like onPlayerAttackedCacellable, only that this can
- * not be canceled. I recommend using this over
- * onPlayerAttackedCacellable, as it is more reliable.
+ * This is just like onPlayerAttackedCacellable, only that this can not be
+ * canceled. I recommend using this over onPlayerAttackedCacellable, as it is
+ * more reliable.
*
* @param item
- * The ItemStack representing the jewelry that runs
- * the effect
+ * The ItemStack representing the jewelry that runs the effect
* @param player
- * The attacked player wearing a jewelry with this
- * modifier on it
+ * The attacked player wearing a jewelry with this modifier on it
* @param source
- * The source of the damage
+ * The source of the damage
* @param jewelry
- * The actual jewelry item (aka item.getItem(),
- * almost)
+ * The actual jewelry item (aka item.getItem(), almost)
* @param amount
- * The amount of damage the player took
+ * The amount of damage the player took
*/
- public void onPlayerAttacked(ItemStack item, EntityPlayer player,
- DamageSource source, Item jewelry, float amount) {
+ public void onPlayerAttacked(ItemStack item, EntityPlayer player, DamageSource source, Item jewelry, float amount) {
// Do nothing
}
@@ -159,19 +140,15 @@ public class ModifierEffects { * This runs when the player dies
*
* @param item
- * The ItemStack representing the jewelry that runs
- * the effect
+ * The ItemStack representing the jewelry that runs the effect
* @param player
- * The player that died wearing a jewelry with this
- * modifier on it
+ * The player that died wearing a jewelry with this modifier on it
* @param source
- * The source of the killing blow
+ * The source of the killing blow
* @param jewelry
- * The actual jewelry item (aka item.getItem(),
- * almost)
+ * The actual jewelry item (aka item.getItem(), almost)
*/
- public void onPlayerDead(ItemStack item, EntityPlayer player,
- DamageSource source, Item jewelry) {
+ public void onPlayerDead(ItemStack item, EntityPlayer player, DamageSource source, Item jewelry) {
// Do nothing
}
@@ -179,18 +156,14 @@ public class ModifierEffects { * This runs when the player respawns
*
* @param item
- * The ItemStack representing the jewelry that runs
- * the effect
+ * The ItemStack representing the jewelry that runs the effect
* @param event
- * The PlayerEvent that runs when the player
- * respawns (this is also called when a player moves
- * between dimensions)
+ * The PlayerEvent that runs when the player respawns (this is also
+ * called when a player moves between dimensions)
* @param jewelry
- * The actual jewelry item (aka item.getItem(),
- * almost)
+ * The actual jewelry item (aka item.getItem(), almost)
*/
- public void onPlayerRespawn(ItemStack item,
- PlayerEvent.Clone event, Item jewelry) {
+ public void onPlayerRespawn(ItemStack item, PlayerEvent.Clone event, Item jewelry) {
// Do nothing
}
@@ -198,11 +171,9 @@ public class ModifierEffects { * This runs when the item containing this modifier is equipped
*
* @param item
- * The ItemStack representing the jewelry that runs
- * the effect
+ * The ItemStack representing the jewelry that runs the effect
* @param jewelry
- * The actual jewelry item (aka item.getItem(),
- * almost)
+ * The actual jewelry item (aka item.getItem(), almost)
*/
public void onJewelryEquipped(ItemStack item, Item jewelry) {
// Do nothing
@@ -212,11 +183,9 @@ public class ModifierEffects { * This runs when the item containing this modifier is unquipped
*
* @param item
- * The ItemStack representing the jewelry that runs
- * the effect
+ * The ItemStack representing the jewelry that runs the effect
* @param jewelry
- * The actual jewelry item (aka item.getItem(),
- * almost)
+ * The actual jewelry item (aka item.getItem(), almost)
*/
public void onJewelryUnequipped(ItemStack item, Item jewelry) {
// Do nothing
diff --git a/src/main/java/darkknight/jewelrycraft/block/BlockCrystal.java b/src/main/java/darkknight/jewelrycraft/block/BlockCrystal.java index 98416c2..136d502 100755 --- a/src/main/java/darkknight/jewelrycraft/block/BlockCrystal.java +++ b/src/main/java/darkknight/jewelrycraft/block/BlockCrystal.java @@ -26,12 +26,8 @@ import net.minecraft.world.World; *
*/
public class BlockCrystal extends Block implements ITileEntityProvider {
- public static int[] colors = {
- 1973019, 11743532, 3887386, 5320730, 2437522,
- 8073150, 2651799, 11250603, 4408131, 14188952,
- 4312372, 14602026, 6719955, 12801229, 15435844,
- 15790320
- };
+ public static int[] colors = { 1973019, 11743532, 3887386, 5320730, 2437522, 8073150, 2651799, 11250603, 4408131,
+ 14188952, 4312372, 14602026, 6719955, 12801229, 15435844, 15790320 };
protected BlockCrystal() {
super(Material.glass);
@@ -75,8 +71,7 @@ public class BlockCrystal extends Block implements ITileEntityProvider { @Override
@SideOnly(Side.CLIENT)
- public int colorMultiplier(IBlockAccess world, int i, int j,
- int k) {
+ public int colorMultiplier(IBlockAccess world, int i, int j, int k) {
return colors[world.getBlockMetadata(i, j, k)];
}
@@ -86,32 +81,23 @@ public class BlockCrystal extends Block implements ITileEntityProvider { }
@Override
- public void breakBlock(World world, int x, int y, int z,
- Block block, int meta) {
+ public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
super.breakBlock(world, x, y, z, block, meta);
world.removeTileEntity(x, y, z);
}
@Override
- public boolean onBlockEventReceived(World world, int x, int y,
- int z, int eventNo, int arg) {
+ public boolean onBlockEventReceived(World world, int x, int y, int z, int eventNo, int arg) {
super.onBlockEventReceived(world, x, y, z, eventNo, arg);
TileEntity tileentity = world.getTileEntity(x, y, z);
- return tileentity != null
- ? tileentity.receiveClientEvent(eventNo,
- arg)
- : false;
+ return tileentity != null ? tileentity.receiveClientEvent(eventNo, arg) : false;
}
@Override
@SideOnly(Side.CLIENT)
- public void randomDisplayTick(World world, int x, int y, int z,
- Random rand) {
+ public void randomDisplayTick(World world, int x, int y, int z, Random rand) {
if (ConfigHandler.CRYSTAL_PARTICLES)
- world.spawnParticle("instantSpell",
- x + rand.nextFloat(),
- y + rand.nextFloat(),
- z + rand.nextFloat(), 0.0D, -1.0D,
- 0.0D);
+ world.spawnParticle("instantSpell", x + rand.nextFloat(), y + rand.nextFloat(), z + rand.nextFloat(), 0.0D,
+ -1.0D, 0.0D);
}
}
diff --git a/src/main/java/darkknight/jewelrycraft/block/BlockDisplayer.java b/src/main/java/darkknight/jewelrycraft/block/BlockDisplayer.java index d84cbf7..2547149 100755 --- a/src/main/java/darkknight/jewelrycraft/block/BlockDisplayer.java +++ b/src/main/java/darkknight/jewelrycraft/block/BlockDisplayer.java @@ -54,8 +54,7 @@ public class BlockDisplayer extends BlockContainer { * @return whether to render the specified side
*/
@Override
- public boolean shouldSideBeRendered(IBlockAccess iblockaccess,
- int i, int j, int k, int l) {
+ public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l) {
return false;
}
@@ -88,98 +87,57 @@ public class BlockDisplayer extends BlockContainer { * @return whether to activate the item on the block
*/
@Override
- public boolean onBlockActivated(World world, int i, int j, int k,
- EntityPlayer entityPlayer, int par6, float par7,
+ public boolean onBlockActivated(World world, int i, int j, int k, EntityPlayer entityPlayer, int par6, float par7,
float par8, float par9) {
- TileEntityDisplayer te = (TileEntityDisplayer) world
- .getTileEntity(i, j, k);
+ TileEntityDisplayer te = (TileEntityDisplayer) world.getTileEntity(i, j, k);
ItemStack item = entityPlayer.inventory.getCurrentItem();
if (te != null) {
- if (item != null && item != new ItemStack(
- Item.getItemById(0), 0, 0)
- && !world.isRemote) {
+ if (item != null && item != new ItemStack(Item.getItemById(0), 0, 0) && !world.isRemote) {
if (!te.hasObject) {
te.object = item.copy();
te.quantity += item.stackSize;
te.object.stackSize = 1;
te.hasObject = true;
if (!entityPlayer.capabilities.isCreativeMode)
- entityPlayer.inventory
- .decrStackSize(entityPlayer.inventory.currentItem,
- item.stackSize);
+ entityPlayer.inventory.decrStackSize(entityPlayer.inventory.currentItem, item.stackSize);
te.isDirty = true;
- } else if (te.object.getItem() == item
- .getItem()
- && te.object != null
- && te.object != new ItemStack(
- Item.getItemById(
- 0),
- 0, 0)
- && te.object.getItemDamage() == item
- .getItemDamage())
- if (te.object.hasTagCompound()
- && item.hasTagCompound()
- && te.object.getTagCompound()
- .equals(item.getTagCompound())) {
+ } else if (te.object.getItem() == item.getItem() && te.object != null
+ && te.object != new ItemStack(Item.getItemById(0), 0, 0)
+ && te.object.getItemDamage() == item.getItemDamage())
+ if (te.object.hasTagCompound() && item.hasTagCompound()
+ && te.object.getTagCompound().equals(item.getTagCompound())) {
te.quantity += item.stackSize;
if (!entityPlayer.capabilities.isCreativeMode)
- entityPlayer.inventory
- .decrStackSize(entityPlayer.inventory.currentItem,
- item.stackSize);
+ entityPlayer.inventory.decrStackSize(entityPlayer.inventory.currentItem, item.stackSize);
te.isDirty = true;
- } else if (!te.object
- .hasTagCompound()
- && !item.hasTagCompound()) {
+ } else if (!te.object.hasTagCompound() && !item.hasTagCompound()) {
te.quantity += item.stackSize;
if (!entityPlayer.capabilities.isCreativeMode)
- entityPlayer.inventory
- .decrStackSize(entityPlayer.inventory.currentItem,
- item.stackSize);
+ entityPlayer.inventory.decrStackSize(entityPlayer.inventory.currentItem, item.stackSize);
te.isDirty = true;
}
- } else if (item == null || item == new ItemStack(
- Item.getItemById(0), 0, 0))
+ } else if (item == null || item == new ItemStack(Item.getItemById(0), 0, 0))
if (!entityPlayer.capabilities.isCreativeMode)
- for (int inv = 0; inv < entityPlayer.inventory
- .getSizeInventory(); inv++) {
- item = entityPlayer.inventory
- .getStackInSlot(inv);
- if (item != null && te.object
- .getItem() == item
- .getItem()
- && te.object != null
- && te.object != new ItemStack(
- Item.getItemById(
- 0),
- 0,
- 0)
- && te.object.getItemDamage() == item
- .getItemDamage())
- if (te.object.hasTagCompound()
- && item.hasTagCompound()
- && te.object.getTagCompound()
- .equals(item.getTagCompound())) {
+ for (int inv = 0; inv < entityPlayer.inventory.getSizeInventory(); inv++) {
+ item = entityPlayer.inventory.getStackInSlot(inv);
+ if (item != null && te.object.getItem() == item.getItem() && te.object != null
+ && te.object != new ItemStack(Item.getItemById(0), 0, 0)
+ && te.object.getItemDamage() == item.getItemDamage())
+ if (te.object.hasTagCompound() && item.hasTagCompound()
+ && te.object.getTagCompound().equals(item.getTagCompound())) {
te.quantity += item.stackSize;
if (!entityPlayer.capabilities.isCreativeMode)
- entityPlayer.inventory
- .decrStackSize(inv,
- item.stackSize);
+ entityPlayer.inventory.decrStackSize(inv, item.stackSize);
te.isDirty = true;
te.markDirty();
- } else if (!te.object
- .hasTagCompound()
- && !item.hasTagCompound()) {
+ } else if (!te.object.hasTagCompound() && !item.hasTagCompound()) {
te.quantity += item.stackSize;
if (!entityPlayer.capabilities.isCreativeMode)
- entityPlayer.inventory
- .decrStackSize(inv,
- item.stackSize);
+ entityPlayer.inventory.decrStackSize(inv, item.stackSize);
te.isDirty = true;
}
}
- else if (entityPlayer.capabilities.isCreativeMode
- && te.hasObject
- && te.object.getItem() != null) {
+ else if (entityPlayer.capabilities.isCreativeMode && te.hasObject && te.object.getItem() != null) {
te.quantity += 64;
te.isDirty = true;
}
@@ -196,61 +154,38 @@ public class BlockDisplayer extends BlockContainer { * @param player
*/
@Override
- public void onBlockClicked(World world, int i, int j, int k,
- EntityPlayer player) {
- TileEntityDisplayer te = (TileEntityDisplayer) world
- .getTileEntity(i, j, k);
+ public void onBlockClicked(World world, int i, int j, int k, EntityPlayer player) {
+ TileEntityDisplayer te = (TileEntityDisplayer) world.getTileEntity(i, j, k);
if (te != null && !world.isRemote)
- if (te.hasObject && te.object != null
- && te.object != new ItemStack(
- Item.getItemById(
- 0),
- 0, 0)
- && player.inventory
- .addItemStackToInventory(
- te.object))
+ if (te.hasObject && te.object != null && te.object != new ItemStack(Item.getItemById(0), 0, 0)
+ && player.inventory.addItemStackToInventory(te.object))
if (!player.isSneaking()) {
- if (te.quantity > te.object
- .getMaxStackSize()) {
- te.object.stackSize = te.object
- .getMaxStackSize()
- - 1;
- player.inventory.addItemStackToInventory(
- te.object);
+ if (te.quantity > te.object.getMaxStackSize()) {
+ te.object.stackSize = te.object.getMaxStackSize() - 1;
+ player.inventory.addItemStackToInventory(te.object);
te.object.stackSize = 1;
- te.quantity -= te.object
- .getMaxStackSize();
+ te.quantity -= te.object.getMaxStackSize();
te.isDirty = true;
} else {
- te.object.stackSize = te.quantity
- - 1;
- player.inventory.addItemStackToInventory(
- te.object);
+ te.object.stackSize = te.quantity - 1;
+ player.inventory.addItemStackToInventory(te.object);
te.hasObject = false;
- te.object = new ItemStack(
- Item.getItemById(
- 0),
- 0, 0);
+ te.object = new ItemStack(Item.getItemById(0), 0, 0);
te.quantity = 0;
te.isDirty = true;
}
te.isDirty = true;
} else {
if (te.quantity >= 2) {
- player.inventory.addItemStackToInventory(
- te.object);
+ player.inventory.addItemStackToInventory(te.object);
te.object.stackSize = 1;
te.quantity--;
te.isDirty = true;
} else {
- player.inventory.addItemStackToInventory(
- te.object);
+ player.inventory.addItemStackToInventory(te.object);
te.object.stackSize = 1;
te.hasObject = false;
- te.object = new ItemStack(
- Item.getItemById(
- 0),
- 0, 0);
+ te.object = new ItemStack(Item.getItemById(0), 0, 0);
te.quantity = 0;
te.isDirty = true;
}
@@ -265,10 +200,8 @@ public class BlockDisplayer extends BlockContainer { * @param z
* @param stack
*/
- public void dropItem(World world, double x, double y, double z,
- ItemStack stack) {
- EntityItem entityitem = new EntityItem(world, x + 0.5D,
- y + 1.5D, z + 0.5D, stack);
+ public void dropItem(World world, double x, double y, double z, ItemStack stack) {
+ EntityItem entityitem = new EntityItem(world, x + 0.5D, y + 1.5D, z + 0.5D, stack);
entityitem.motionX = 0;
entityitem.motionZ = 0;
entityitem.motionY = 0.11000000298023224D;
@@ -284,14 +217,11 @@ public class BlockDisplayer extends BlockContainer { * @param par6
*/
@Override
- public void breakBlock(World world, int i, int j, int k,
- Block block, int par6) {
- TileEntityDisplayer te = (TileEntityDisplayer) world
- .getTileEntity(i, j, k);
+ public void breakBlock(World world, int i, int j, int k, Block block, int par6) {
+ TileEntityDisplayer te = (TileEntityDisplayer) world.getTileEntity(i, j, k);
if (te != null && te.hasObject) {
te.object.stackSize = te.quantity;
- dropItem(te.getWorldObj(), te.xCoord, te.yCoord,
- te.zCoord, te.object);
+ dropItem(te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord, te.object);
world.removeTileEntity(i, j, k);
}
super.breakBlock(world, i, j, k, block, par6);
@@ -306,13 +236,9 @@ public class BlockDisplayer extends BlockContainer { * @param par6ItemStack
*/
@Override
- public void onBlockPlacedBy(World world, int i, int j, int k,
- EntityLivingBase entityLiving,
+ public void onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase entityLiving,
ItemStack par6ItemStack) {
- int rotation = MathHelper
- .floor_double(entityLiving.rotationYaw
- * 4.0F / 360.0F + 0.5D)
- & 3;
+ int rotation = MathHelper.floor_double(entityLiving.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
world.setBlockMetadataWithNotify(i, j, k, rotation, 2);
}
diff --git a/src/main/java/darkknight/jewelrycraft/block/BlockHandPedestal.java b/src/main/java/darkknight/jewelrycraft/block/BlockHandPedestal.java index 2cfe437..2cd8788 100755 --- a/src/main/java/darkknight/jewelrycraft/block/BlockHandPedestal.java +++ b/src/main/java/darkknight/jewelrycraft/block/BlockHandPedestal.java @@ -51,8 +51,7 @@ public class BlockHandPedestal extends BlockContainer { * @return
*/
@Override
- public boolean shouldSideBeRendered(IBlockAccess iblockaccess,
- int i, int j, int k, int l) {
+ public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l) {
return false;
}
@@ -85,24 +84,18 @@ public class BlockHandPedestal extends BlockContainer { * @return
*/
@Override
- public boolean onBlockActivated(World world, int i, int j, int k,
- EntityPlayer entityPlayer, int par6, float par7,
+ public boolean onBlockActivated(World world, int i, int j, int k, EntityPlayer entityPlayer, int par6, float par7,
float par8, float par9) {
- TileEntityHandPedestal te = (TileEntityHandPedestal) world
- .getTileEntity(i, j, k);
+ TileEntityHandPedestal te = (TileEntityHandPedestal) world.getTileEntity(i, j, k);
ItemStack item = entityPlayer.inventory.getCurrentItem();
if (te != null) {
- if (!world.isRemote
- && te.getHeldItemStack() == null
- && item != null) {
+ if (!world.isRemote && te.getHeldItemStack() == null && item != null) {
te.setHeldItemStack(item.copy());
if (!entityPlayer.capabilities.isCreativeMode)
item.stackSize--;
te.markDirty();
} else if (entityPlayer.isSneaking())
- if (entityPlayer.inventory
- .addItemStackToInventory(te
- .getHeldItemStack())) {
+ if (entityPlayer.inventory.addItemStackToInventory(te.getHeldItemStack())) {
te.removeHeldItemStack();
}
te.markDirty();
@@ -117,10 +110,8 @@ public class BlockHandPedestal extends BlockContainer { * @param z
* @param stack
*/
- public void dropItem(World world, double x, double y, double z,
- ItemStack stack) {
- EntityItem entityitem = new EntityItem(world, x + 0.5,
- y + 1.5, z + 0.5, stack);
+ public void dropItem(World world, double x, double y, double z, ItemStack stack) {
+ EntityItem entityitem = new EntityItem(world, x + 0.5, y + 1.5, z + 0.5, stack);
entityitem.motionX = 0;
entityitem.motionZ = 0;
entityitem.motionY = 0.11000000298023224D;
@@ -136,13 +127,10 @@ public class BlockHandPedestal extends BlockContainer { * @param par6
*/
@Override
- public void breakBlock(World world, int i, int j, int k,
- Block block, int par6) {
- TileEntityHandPedestal te = (TileEntityHandPedestal) world
- .getTileEntity(i, j, k);
+ public void breakBlock(World world, int i, int j, int k, Block block, int par6) {
+ TileEntityHandPedestal te = (TileEntityHandPedestal) world.getTileEntity(i, j, k);
if (te != null && te.getHeldItemStack() != null) {
- dropItem(te.getWorldObj(), te.xCoord, te.yCoord,
- te.zCoord, te.getHeldItemStack());
+ dropItem(te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord, te.getHeldItemStack());
world.removeTileEntity(i, j, k);
}
super.breakBlock(world, i, j, k, block, par6);
@@ -157,12 +145,9 @@ public class BlockHandPedestal extends BlockContainer { * @param par6ItemStack
*/
@Override
- public void onBlockPlacedBy(World world, int i, int j, int k,
- EntityLivingBase entityLiving,
+ public void onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase entityLiving,
ItemStack par6ItemStack) {
- int rotation = MathHelper.floor_double(
- entityLiving.rotationYaw * 8 / 360 + 0.5)
- & 7;
+ int rotation = MathHelper.floor_double(entityLiving.rotationYaw * 8 / 360 + 0.5) & 7;
world.setBlockMetadataWithNotify(i, j, k, rotation, 2);
}
diff --git a/src/main/java/darkknight/jewelrycraft/block/BlockItemCrystal.java b/src/main/java/darkknight/jewelrycraft/block/BlockItemCrystal.java index 2b76784..2d2058c 100755 --- a/src/main/java/darkknight/jewelrycraft/block/BlockItemCrystal.java +++ b/src/main/java/darkknight/jewelrycraft/block/BlockItemCrystal.java @@ -19,17 +19,13 @@ public class BlockItemCrystal extends ItemBlock { @Override
public String getUnlocalizedName(ItemStack itemstack) {
- return getUnlocalizedName() + "."
- + itemstack.getItemDamage();
+ return getUnlocalizedName() + "." + itemstack.getItemDamage();
}
@Override
@SideOnly(Side.CLIENT)
public int getColorFromItemStack(ItemStack stack, int pass) {
- return stack.getItemDamage() < 16
- ? BlockCrystal.colors[stack
- .getItemDamage()]
- : 0;
+ return stack.getItemDamage() < 16 ? BlockCrystal.colors[stack.getItemDamage()] : 0;
}
}
\ No newline at end of file diff --git a/src/main/java/darkknight/jewelrycraft/block/BlockJewelersCraftingTable.java b/src/main/java/darkknight/jewelrycraft/block/BlockJewelersCraftingTable.java index 2bd78ac..4209a86 100755 --- a/src/main/java/darkknight/jewelrycraft/block/BlockJewelersCraftingTable.java +++ b/src/main/java/darkknight/jewelrycraft/block/BlockJewelersCraftingTable.java @@ -40,43 +40,32 @@ public class BlockJewelersCraftingTable extends BlockContainer { }
@Override
- public boolean onBlockActivated(World world, int i, int j, int k,
- EntityPlayer entityPlayer, int par6, float par7,
+ public boolean onBlockActivated(World world, int i, int j, int k, EntityPlayer entityPlayer, int par6, float par7,
float par8, float par9) {
- TileEntityJewelrsCraftingTable te = (TileEntityJewelrsCraftingTable) world
- .getTileEntity(i, j, k);
+ TileEntityJewelrsCraftingTable te = (TileEntityJewelrsCraftingTable) world.getTileEntity(i, j, k);
ItemStack item = entityPlayer.inventory.getCurrentItem();
if (te != null && !world.isRemote) {
if (te.hasEndItem && item != null)
- entityPlayer.addChatMessage(
- new ChatComponentText(
- StatCollector.translateToLocal(
- "chatmessage." + Variables.MODID
- + ".table.hasenditem")));
- if (!te.hasEndItem && !te.hasJewelry
- && item != null && JewelrycraftUtil
- .isJewelry(item)) {
+ entityPlayer.addChatMessage(new ChatComponentText(
+ StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".table.hasenditem")));
+ if (!te.hasEndItem && !te.hasJewelry && item != null && JewelrycraftUtil.isJewelry(item)) {
te.setJewelryItemStack(item);
if (!entityPlayer.capabilities.isCreativeMode)
--item.stackSize;
}
- if (!te.hasEndItem && !te.hasGem && item != null
- && JewelrycraftUtil.isGem(item)) {
+ if (!te.hasEndItem && !te.hasGem && item != null && JewelrycraftUtil.isGem(item)) {
te.setGemItemStack(item);
if (!entityPlayer.capabilities.isCreativeMode)
--item.stackSize;
}
- if (!te.hasEndItem && te.hasJewelry && te.hasGem
- && !te.crafting)
+ if (!te.hasEndItem && te.hasJewelry && te.hasGem && !te.crafting)
te.setCrafting();
}
return true;
}
- public void dropItem(World world, double x, double y, double z,
- ItemStack stack) {
- EntityItem entityitem = new EntityItem(world, x + 0.5D,
- y + 1D, z + 0.5D, stack);
+ public void dropItem(World world, double x, double y, double z, ItemStack stack) {
+ EntityItem entityitem = new EntityItem(world, x + 0.5D, y + 1D, z + 0.5D, stack);
entityitem.motionX = 0;
entityitem.motionZ = 0;
entityitem.motionY = 0.21000000298023224D;
@@ -84,43 +73,30 @@ public class BlockJewelersCraftingTable extends BlockContainer { }
@Override
- public void breakBlock(World world, int i, int j, int k,
- Block par5, int par6) {
- TileEntityJewelrsCraftingTable te = (TileEntityJewelrsCraftingTable) world
- .getTileEntity(i, j, k);
+ public void breakBlock(World world, int i, int j, int k, Block par5, int par6) {
+ TileEntityJewelrsCraftingTable te = (TileEntityJewelrsCraftingTable) world.getTileEntity(i, j, k);
if (te != null) {
if (te.hasJewelry)
- dropItem(world, te.xCoord, te.yCoord,
- te.zCoord,
- te.jewelry.copy());
+ dropItem(world, te.xCoord, te.yCoord, te.zCoord, te.jewelry.copy());
if (te.hasGem)
- dropItem(world, te.xCoord, te.yCoord,
- te.zCoord, te.gem.copy());
+ dropItem(world, te.xCoord, te.yCoord, te.zCoord, te.gem.copy());
if (te.hasEndItem)
- dropItem(te.getWorldObj(), te.xCoord,
- te.yCoord, te.zCoord,
- te.endItem.copy());
+ dropItem(te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord, te.endItem.copy());
world.removeTileEntity(i, j, k);
}
super.breakBlock(world, i, j, k, par5, par6);
}
@Override
- public void onBlockPlacedBy(World world, int i, int j, int k,
- EntityLivingBase entityLiving,
+ public void onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase entityLiving,
ItemStack par6ItemStack) {
- int rotation = MathHelper
- .floor_double(entityLiving.rotationYaw
- * 4.0F / 360.0F + 0.5D)
- & 3;
+ int rotation = MathHelper.floor_double(entityLiving.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
world.setBlockMetadataWithNotify(i, j, k, rotation, 2);
}
@Override
- public void onBlockClicked(World world, int i, int j, int k,
- EntityPlayer player) {
- TileEntityJewelrsCraftingTable te = (TileEntityJewelrsCraftingTable) world
- .getTileEntity(i, j, k);
+ public void onBlockClicked(World world, int i, int j, int k, EntityPlayer player) {
+ TileEntityJewelrsCraftingTable te = (TileEntityJewelrsCraftingTable) world.getTileEntity(i, j, k);
if (te != null && !world.isRemote)
if (player.isSneaking()) {
if (te.hasJewelry)
@@ -129,38 +105,21 @@ public class BlockJewelersCraftingTable extends BlockContainer { te.removeGem();
} else if (te.hasEndItem)
te.removeResult();
- else if (te.hasJewelry && te.hasGem
- && te.carving > 0
- && te.jewelry != null)
- player.addChatMessage(
- new ChatComponentText(
- StatCollector.translateToLocalFormatted(
- "chatmessage." + Variables.MODID
- + ".table.iscrafting",
- te.jewelry.getDisplayName())
- + " ("
- + (ConfigHandler.GEM_PLACEMENT_TIME
- - te.carving)
- * 100
- / ConfigHandler.GEM_PLACEMENT_TIME
- + "%)"));
+ else if (te.hasJewelry && te.hasGem && te.carving > 0 && te.jewelry != null)
+ player.addChatMessage(new ChatComponentText(StatCollector.translateToLocalFormatted(
+ "chatmessage." + Variables.MODID + ".table.iscrafting", te.jewelry.getDisplayName()) + " ("
+ + (ConfigHandler.GEM_PLACEMENT_TIME - te.carving) * 100 / ConfigHandler.GEM_PLACEMENT_TIME
+ + "%)"));
else if (!te.hasGem)
- player.addChatMessage(
- new ChatComponentText(
- StatCollector.translateToLocal(
- "chatmessage." + Variables.MODID
- + ".table.missinggem")));
+ player.addChatMessage(new ChatComponentText(
+ StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".table.missinggem")));
else if (!te.hasJewelry)
- player.addChatMessage(
- new ChatComponentText(
- StatCollector.translateToLocal(
- "chatmessage." + Variables.MODID
- + ".table.missingjewelry")));
+ player.addChatMessage(new ChatComponentText(
+ StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".table.missingjewelry")));
}
@Override
- public boolean shouldSideBeRendered(IBlockAccess iblockaccess,
- int i, int j, int k, int l) {
+ public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l) {
return false;
}
diff --git a/src/main/java/darkknight/jewelrycraft/block/BlockList.java b/src/main/java/darkknight/jewelrycraft/block/BlockList.java index 5fe71d5..f9ebf7c 100755 --- a/src/main/java/darkknight/jewelrycraft/block/BlockList.java +++ b/src/main/java/darkknight/jewelrycraft/block/BlockList.java @@ -3,17 +3,7 @@ package darkknight.jewelrycraft.block; import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.registry.GameRegistry;
import darkknight.jewelrycraft.JewelrycraftMod;
-import darkknight.jewelrycraft.tileentity.TileEntityBlockShadow;
-import darkknight.jewelrycraft.tileentity.TileEntityCrystal;
-import darkknight.jewelrycraft.tileentity.TileEntityDisplayer;
-import darkknight.jewelrycraft.tileentity.TileEntityHandPedestal;
-import darkknight.jewelrycraft.tileentity.TileEntityJewelrsCraftingTable;
-import darkknight.jewelrycraft.tileentity.TileEntityMidasTouch;
-import darkknight.jewelrycraft.tileentity.TileEntityMolder;
-import darkknight.jewelrycraft.tileentity.TileEntityMoltenMetal;
-import darkknight.jewelrycraft.tileentity.TileEntityShadowEye;
-import darkknight.jewelrycraft.tileentity.TileEntityShadowHand;
-import darkknight.jewelrycraft.tileentity.TileEntitySmelter;
+import darkknight.jewelrycraft.tileentity.*;
import darkknight.jewelrycraft.util.Variables;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
@@ -23,140 +13,74 @@ import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.oredict.OreDictionary;
public class BlockList {
- public static Block shadowOre, smelter, molder,
- displayer, jewelCraftingTable, shadowBlock,
- shadowEye, handPedestal, shadowHand,
- midasTouchBlock, crystal;
- public static BlockMoltenMetal moltenMetal;
- public static Fluid moltenMetalFluid;
+ public static Block shadowOre, smelter, molder, displayer, jewelCraftingTable, shadowBlock, shadowEye, handPedestal,
+ shadowHand, midasTouchBlock, crystal;
+ public static BlockMoltenMetal moltenMetal;
+ public static Fluid moltenMetalFluid;
public static void preInit(FMLPreInitializationEvent e) {
- shadowOre = new BlockJCOre().setHardness(3.0F)
- .setResistance(5.0F)
- .setStepSound(Block.soundTypePiston)
- .setBlockTextureName(Variables.MODID
- + ":oreShadow")
- .setBlockName(Variables.MODID
- + ".oreShadow")
+ shadowOre = new BlockJCOre().setHardness(3.0F).setResistance(5.0F).setStepSound(Block.soundTypePiston)
+ .setBlockTextureName(Variables.MODID + ":oreShadow").setBlockName(Variables.MODID + ".oreShadow")
.setCreativeTab(JewelrycraftMod.jewelrycraft);
- smelter = new BlockSmelter().setHardness(5.0F)
- .setResistance(6.0F)
- .setStepSound(Block.soundTypePiston)
- .setBlockName(Variables.MODID + ".smelter")
+ smelter = new BlockSmelter().setHardness(5.0F).setResistance(6.0F).setStepSound(Block.soundTypePiston)
+ .setBlockName(Variables.MODID + ".smelter").setCreativeTab(JewelrycraftMod.jewelrycraft);
+ molder = new BlockMolder(Material.rock).setHardness(5.0F).setResistance(6.0F)
+ .setStepSound(Block.soundTypePiston).setBlockName(Variables.MODID + ".molder")
.setCreativeTab(JewelrycraftMod.jewelrycraft);
- molder = new BlockMolder(Material.rock).setHardness(5.0F)
- .setResistance(6.0F)
- .setStepSound(Block.soundTypePiston)
- .setBlockName(Variables.MODID + ".molder")
+ displayer = new BlockDisplayer(Material.iron).setHardness(5.0F).setResistance(6.0F)
+ .setStepSound(Block.soundTypeMetal).setBlockName(Variables.MODID + ".displayer")
.setCreativeTab(JewelrycraftMod.jewelrycraft);
- displayer = new BlockDisplayer(Material.iron)
- .setHardness(5.0F).setResistance(6.0F)
- .setStepSound(Block.soundTypeMetal)
- .setBlockName(Variables.MODID
- + ".displayer")
+ jewelCraftingTable = new BlockJewelersCraftingTable(Material.rock).setHardness(3.0F).setResistance(5.0F)
+ .setStepSound(Block.soundTypePiston).setBlockName(Variables.MODID + ".jewelCraftingTable")
.setCreativeTab(JewelrycraftMod.jewelrycraft);
- jewelCraftingTable = new BlockJewelersCraftingTable(
- Material.rock).setHardness(3.0F)
- .setResistance(5.0F)
- .setStepSound(Block.soundTypePiston)
- .setBlockName(Variables.MODID
- + ".jewelCraftingTable")
- .setCreativeTab(JewelrycraftMod.jewelrycraft);
- shadowBlock = new BlockShadow().setHardness(5.0F)
- .setResistance(7.0F)
- .setStepSound(Block.soundTypeMetal)
- .setBlockTextureName(Variables.MODID
- + ":blockShadow")
- .setBlockName(Variables.MODID
- + ".blockShadow")
+ shadowBlock = new BlockShadow().setHardness(5.0F).setResistance(7.0F).setStepSound(Block.soundTypeMetal)
+ .setBlockTextureName(Variables.MODID + ":blockShadow").setBlockName(Variables.MODID + ".blockShadow")
.setCreativeTab(JewelrycraftMod.jewelrycraft);
- shadowEye = new BlockShadowEye().setHardness(5.0F)
- .setResistance(6.0F)
- .setStepSound(Block.soundTypePiston)
- .setBlockName(Variables.MODID
- + ".shadowEye")
+ shadowEye = new BlockShadowEye().setHardness(5.0F).setResistance(6.0F).setStepSound(Block.soundTypePiston)
+ .setBlockName(Variables.MODID + ".shadowEye").setCreativeTab(JewelrycraftMod.jewelrycraft);
+ handPedestal = new BlockHandPedestal(Material.rock).setHardness(5.0F).setResistance(6.0F)
+ .setStepSound(Block.soundTypePiston).setBlockName(Variables.MODID + ".handPedestal")
.setCreativeTab(JewelrycraftMod.jewelrycraft);
- handPedestal = new BlockHandPedestal(Material.rock)
- .setHardness(5.0F).setResistance(6.0F)
- .setStepSound(Block.soundTypePiston)
- .setBlockName(Variables.MODID
- + ".handPedestal")
- .setCreativeTab(JewelrycraftMod.jewelrycraft);
- shadowHand = new BlockShadowHand(Material.rock)
- .setStepSound(Block.soundTypePiston)
- .setBlockName(Variables.MODID
- + ".shadowHand")
- .setCreativeTab(JewelrycraftMod.jewelrycraft)
+ shadowHand = new BlockShadowHand(Material.rock).setStepSound(Block.soundTypePiston)
+ .setBlockName(Variables.MODID + ".shadowHand").setCreativeTab(JewelrycraftMod.jewelrycraft)
.setBlockUnbreakable();
- midasTouchBlock = new BlockMidasTouch(Material.iron)
- .setHardness(3.0F).setResistance(10.0F)
- .setStepSound(Block.soundTypeMetal)
- .setBlockName(Variables.MODID
- + ".midasTouchBlock");
- moltenMetalFluid = new Fluid("metal.molten")
- .setLuminosity(15).setDensity(3000)
- .setTemperature(2000).setViscosity(6000);
+ midasTouchBlock = new BlockMidasTouch(Material.iron).setHardness(3.0F).setResistance(10.0F)
+ .setStepSound(Block.soundTypeMetal).setBlockName(Variables.MODID + ".midasTouchBlock");
+ moltenMetalFluid = new Fluid("metal.molten").setLuminosity(15).setDensity(3000).setTemperature(2000)
+ .setViscosity(6000);
if (!FluidRegistry.registerFluid(moltenMetalFluid))
- moltenMetalFluid = FluidRegistry
- .getFluid("metal.molten");
- moltenMetal = new BlockMoltenMetal(moltenMetalFluid,
- Material.lava);
+ moltenMetalFluid = FluidRegistry.getFluid("metal.molten");
+ moltenMetal = new BlockMoltenMetal(moltenMetalFluid, Material.lava);
moltenMetalFluid.setBlock(moltenMetal);
- crystal = new BlockCrystal().setHardness(2.0F)
- .setResistance(5.0F)
- .setStepSound(Block.soundTypeGlass)
- .setBlockTextureName(Variables.MODID
- + ":blockCrystal")
- .setBlockName(Variables.MODID
- + ".blockCrystal")
+ crystal = new BlockCrystal().setHardness(2.0F).setResistance(5.0F).setStepSound(Block.soundTypeGlass)
+ .setBlockTextureName(Variables.MODID + ":blockCrystal").setBlockName(Variables.MODID + ".blockCrystal")
.setCreativeTab(JewelrycraftMod.jewelrycraft);
GameRegistry.registerBlock(shadowOre, "shadowOre");
GameRegistry.registerBlock(shadowBlock, "shadowBlock");
GameRegistry.registerBlock(smelter, "Smelter");
GameRegistry.registerBlock(molder, "Molder");
- GameRegistry.registerBlock(jewelCraftingTable,
- "jewelCraftingTable");
+ GameRegistry.registerBlock(jewelCraftingTable, "jewelCraftingTable");
GameRegistry.registerBlock(displayer, "Displayer");
GameRegistry.registerBlock(shadowEye, "Shadow Eye");
- GameRegistry.registerBlock(handPedestal,
- "Stone Bricks Pedestal");
+ GameRegistry.registerBlock(handPedestal, "Stone Bricks Pedestal");
GameRegistry.registerBlock(shadowHand, "Shadow Hand");
- GameRegistry.registerBlock(midasTouchBlock,
- "Midas Touch Block");
- GameRegistry.registerBlock(moltenMetal,
- "moltenMetalLiquid");
- GameRegistry.registerBlock(crystal, BlockItemCrystal.class,
- "crystalBlock");
+ GameRegistry.registerBlock(midasTouchBlock, "Midas Touch Block");
+ GameRegistry.registerBlock(moltenMetal, "moltenMetalLiquid");
+ GameRegistry.registerBlock(crystal, BlockItemCrystal.class, "crystalBlock");
- GameRegistry.registerTileEntity(TileEntitySmelter.class,
- Variables.MODID + ":smelter");
- GameRegistry.registerTileEntity(TileEntityMolder.class,
- Variables.MODID + ":molder");
- GameRegistry.registerTileEntity(
- TileEntityJewelrsCraftingTable.class,
- Variables.MODID + ":table");
- GameRegistry.registerTileEntity(TileEntityDisplayer.class,
- Variables.MODID + ":displayer");
- GameRegistry.registerTileEntity(
- TileEntityBlockShadow.class,
- Variables.MODID + ":blockShadow");
- GameRegistry.registerTileEntity(TileEntityShadowEye.class,
- Variables.MODID + ":shadowEye");
- GameRegistry.registerTileEntity(
- TileEntityHandPedestal.class,
- Variables.MODID + ":handPedestal");
- GameRegistry.registerTileEntity(TileEntityShadowHand.class,
- Variables.MODID + ":shadowHand");
- GameRegistry.registerTileEntity(TileEntityMidasTouch.class,
- Variables.MODID + ":midsaTouch");
- GameRegistry.registerTileEntity(TileEntityCrystal.class,
- Variables.MODID + ":crystalBlock");
- GameRegistry.registerTileEntity(
- TileEntityMoltenMetal.class,
- Variables.MODID + ":moltenMetalTE");
+ GameRegistry.registerTileEntity(TileEntitySmelter.class, Variables.MODID + ":smelter");
+ GameRegistry.registerTileEntity(TileEntityMolder.class, Variables.MODID + ":molder");
+ GameRegistry.registerTileEntity(TileEntityJewelrsCraftingTable.class, Variables.MODID + ":table");
+ GameRegistry.registerTileEntity(TileEntityDisplayer.class, Variables.MODID + ":displayer");
+ GameRegistry.registerTileEntity(TileEntityBlockShadow.class, Variables.MODID + ":blockShadow");
+ GameRegistry.registerTileEntity(TileEntityShadowEye.class, Variables.MODID + ":shadowEye");
+ GameRegistry.registerTileEntity(TileEntityHandPedestal.class, Variables.MODID + ":handPedestal");
+ GameRegistry.registerTileEntity(TileEntityShadowHand.class, Variables.MODID + ":shadowHand");
+ GameRegistry.registerTileEntity(TileEntityMidasTouch.class, Variables.MODID + ":midsaTouch");
+ GameRegistry.registerTileEntity(TileEntityCrystal.class, Variables.MODID + ":crystalBlock");
+ GameRegistry.registerTileEntity(TileEntityMoltenMetal.class, Variables.MODID + ":moltenMetalTE");
- OreDictionary.registerOre("oreShadow",
- new ItemStack(BlockList.shadowOre));
+ OreDictionary.registerOre("oreShadow", new ItemStack(BlockList.shadowOre));
}
}
diff --git a/src/main/java/darkknight/jewelrycraft/block/BlockMidasTouch.java b/src/main/java/darkknight/jewelrycraft/block/BlockMidasTouch.java index 8713796..522289e 100755 --- a/src/main/java/darkknight/jewelrycraft/block/BlockMidasTouch.java +++ b/src/main/java/darkknight/jewelrycraft/block/BlockMidasTouch.java @@ -30,8 +30,7 @@ public class BlockMidasTouch extends BlockContainer { }
@Override
- public boolean shouldSideBeRendered(IBlockAccess iblockaccess,
- int i, int j, int k, int l) {
+ public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l) {
return false;
}
@@ -56,27 +55,18 @@ public class BlockMidasTouch extends BlockContainer { }
@Override
- public void onBlockHarvested(World world, int i, int j, int k,
- int meta, EntityPlayer player) {
+ public void onBlockHarvested(World world, int i, int j, int k, int meta, EntityPlayer player) {
// Do nothing
}
@Override
- public void setBlockBoundsBasedOnState(IBlockAccess world, int x,
- int y, int z) {
+ public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) {
TileEntity tile = world.getTileEntity(x, y, z);
if (((TileEntityMidasTouch) tile).target != null)
- this.setBlockBounds(0.5f
- - ((TileEntityMidasTouch) tile).target.width
- / 2,
- 0F,
- 0.5f - ((TileEntityMidasTouch) tile).target.width
- / 2,
- 0.5f + ((TileEntityMidasTouch) tile).target.width
- / 2,
- ((TileEntityMidasTouch) tile).target.height,
- 0.5f + ((TileEntityMidasTouch) tile).target.width
- / 2);
+ this.setBlockBounds(0.5f - ((TileEntityMidasTouch) tile).target.width / 2, 0F,
+ 0.5f - ((TileEntityMidasTouch) tile).target.width / 2,
+ 0.5f + ((TileEntityMidasTouch) tile).target.width / 2, ((TileEntityMidasTouch) tile).target.height,
+ 0.5f + ((TileEntityMidasTouch) tile).target.width / 2);
}
@Override
diff --git a/src/main/java/darkknight/jewelrycraft/block/BlockMolder.java b/src/main/java/darkknight/jewelrycraft/block/BlockMolder.java index 4f763ad..7f2bec4 100755 --- a/src/main/java/darkknight/jewelrycraft/block/BlockMolder.java +++ b/src/main/java/darkknight/jewelrycraft/block/BlockMolder.java @@ -41,49 +41,34 @@ public class BlockMolder extends BlockContainer { }
@Override
- public boolean onBlockActivated(World world, int i, int j, int k,
- EntityPlayer entityPlayer, int par6, float par7,
+ public boolean onBlockActivated(World world, int i, int j, int k, EntityPlayer entityPlayer, int par6, float par7,
float par8, float par9) {
- TileEntityMolder te = (TileEntityMolder) world
- .getTileEntity(i, j, k);
+ TileEntityMolder te = (TileEntityMolder) world.getTileEntity(i, j, k);
ItemStack item = entityPlayer.inventory.getCurrentItem();
if (te != null && !world.isRemote) {
- if (item != null && !te.hasMold && item
- .getItem() == ItemList.molds) {
+ if (item != null && !te.hasMold && item.getItem() == ItemList.molds) {
te.mold = item.copy();
te.hasMold = true;
if (!entityPlayer.capabilities.isCreativeMode)
--item.stackSize;
- entityPlayer.addChatMessage(
- new ChatComponentText(
- StatCollector.translateToLocalFormatted(
- "chatmessage." + Variables.MODID
- + ".molder.addedmold",
- te.mold.getDisplayName())));
+ entityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocalFormatted(
+ "chatmessage." + Variables.MODID + ".molder.addedmold", te.mold.getDisplayName())));
te.isDirty = true;
}
- if (te.hasMold && entityPlayer.isSneaking()
- && !te.hasMoltenMetal) {
- dropItem(world, te.xCoord, te.yCoord,
- te.zCoord, te.mold.copy());
- te.mold = new ItemStack(
- Item.getItemById(0), 0, 0);
+ if (te.hasMold && entityPlayer.isSneaking() && !te.hasMoltenMetal) {
+ dropItem(world, te.xCoord, te.yCoord, te.zCoord, te.mold.copy());
+ te.mold = new ItemStack(Item.getItemById(0), 0, 0);
te.hasMold = false;
te.isDirty = true;
} else if (te.hasMoltenMetal)
- entityPlayer.addChatMessage(
- new ChatComponentText(
- StatCollector.translateToLocal(
- "chatmessage." + Variables.MODID
- + ".molder.hasmoltenmetal")));
+ entityPlayer.addChatMessage(new ChatComponentText(
+ StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".molder.hasmoltenmetal")));
}
return true;
}
- 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);
+ 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;
@@ -91,79 +76,51 @@ public class BlockMolder extends BlockContainer { }
@Override
- public void breakBlock(World world, int i, int j, int k,
- Block par5, int par6) {
- TileEntityMolder te = (TileEntityMolder) world
- .getTileEntity(i, j, k);
+ public void breakBlock(World world, int i, int j, int k, Block par5, int par6) {
+ TileEntityMolder te = (TileEntityMolder) world.getTileEntity(i, j, k);
if (te != null) {
if (te.hasJewelBase)
- dropItem(te.getWorldObj(), te.xCoord,
- te.yCoord, te.zCoord,
- te.jewelBase.copy());
+ dropItem(te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord, te.jewelBase.copy());
if (te.hasMold)
- dropItem(world, te.xCoord, te.yCoord,
- te.zCoord, te.mold.copy());
+ dropItem(world, te.xCoord, te.yCoord, te.zCoord, te.mold.copy());
world.removeTileEntity(i, j, k);
}
super.breakBlock(world, i, j, k, par5, par6);
}
@Override
- public void onBlockPlacedBy(World world, int i, int j, int k,
- EntityLivingBase entityLiving,
+ public void onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase entityLiving,
ItemStack par6ItemStack) {
- int rotation = MathHelper
- .floor_double(entityLiving.rotationYaw
- * 4.0F / 360.0F + 0.5D)
- & 3;
+ int rotation = MathHelper.floor_double(entityLiving.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
world.setBlockMetadataWithNotify(i, j, k, rotation, 2);
}
@Override
- public void onBlockClicked(World world, int i, int j, int k,
- EntityPlayer player) {
- TileEntityMolder me = (TileEntityMolder) world
- .getTileEntity(i, j, k);
+ public void onBlockClicked(World world, int i, int j, int k, EntityPlayer player) {
+ TileEntityMolder me = (TileEntityMolder) world.getTileEntity(i, j, k);
if (me != null && !world.isRemote) {
if (me.hasJewelBase) {
- dropItem(me.getWorldObj(), me.xCoord,
- me.yCoord, me.zCoord,
- me.jewelBase.copy());
- me.jewelBase = new ItemStack(
- Item.getItemById(0), 0, 0);
+ dropItem(me.getWorldObj(), me.xCoord, me.yCoord, me.zCoord, me.jewelBase.copy());
+ me.jewelBase = new ItemStack(Item.getItemById(0), 0, 0);
me.hasJewelBase = false;
} else if (me.hasMoltenMetal && me.cooling >= 0)
- player.addChatMessage(
- new ChatComponentText(
- StatCollector.translateToLocal(
- "chatmessage." + Variables.MODID
- + ".molder.metaliscooling")
- + " ("
- + (ConfigHandler.INGOT_COOLING_TIME
- - me.cooling)
- * 100
- / ConfigHandler.INGOT_COOLING_TIME
- + "%)"));
- else if (me.mold.getItem() == ItemList.molds
- && !me.hasMoltenMetal)
- player.addChatMessage(
- new ChatComponentText(
- StatCollector.translateToLocal(
- "chatmessage." + Variables.MODID
- + ".molder.moldisempty")));
+ player.addChatMessage(new ChatComponentText(
+ StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".molder.metaliscooling")
+ + " (" + (ConfigHandler.INGOT_COOLING_TIME - me.cooling) * 100
+ / ConfigHandler.INGOT_COOLING_TIME
+ + "%)"));
+ else if (me.mold.getItem() == ItemList.molds && !me.hasMoltenMetal)
+ player.addChatMessage(new ChatComponentText(
+ StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".molder.moldisempty")));
else if (me.mold.getItem() != ItemList.molds)
- player.addChatMessage(
- new ChatComponentText(
- StatCollector.translateToLocal(
- "chatmessage." + Variables.MODID
- + ".molder.moldismissing")));
+ player.addChatMessage(new ChatComponentText(
+ StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".molder.moldismissing")));
me.isDirty = true;
}
}
@Override
- public boolean shouldSideBeRendered(IBlockAccess iblockaccess,
- int i, int j, int k, int l) {
+ public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l) {
return false;
}
diff --git a/src/main/java/darkknight/jewelrycraft/block/BlockMoltenMetal.java b/src/main/java/darkknight/jewelrycraft/block/BlockMoltenMetal.java index 6d88443..35381c3 100755 --- a/src/main/java/darkknight/jewelrycraft/block/BlockMoltenMetal.java +++ b/src/main/java/darkknight/jewelrycraft/block/BlockMoltenMetal.java @@ -22,12 +22,11 @@ import net.minecraft.world.World; import net.minecraftforge.fluids.BlockFluidClassic;
import net.minecraftforge.fluids.Fluid;
-public class BlockMoltenMetal extends BlockFluidClassic
- implements ITileEntityProvider {
+public class BlockMoltenMetal extends BlockFluidClassic implements ITileEntityProvider {
@SideOnly(Side.CLIENT)
- protected IIcon stillIcon;
+ protected IIcon stillIcon;
@SideOnly(Side.CLIENT)
- protected IIcon flowingIcon;
+ protected IIcon flowingIcon;
public BlockMoltenMetal(Fluid fluid, Material material) {
super(fluid, material);
@@ -45,31 +44,26 @@ public class BlockMoltenMetal extends BlockFluidClassic @Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister register) {
- stillIcon = register.registerIcon(
- Variables.MODID + ":moltenMetalStill");
- flowingIcon = register.registerIcon(
- Variables.MODID + ":moltenMetalFlow");
+ stillIcon = register.registerIcon(Variables.MODID + ":moltenMetalStill");
+ flowingIcon = register.registerIcon(Variables.MODID + ":moltenMetalFlow");
}
@Override
- public boolean canDisplace(IBlockAccess world, int x, int y,
- int z) {
+ public boolean canDisplace(IBlockAccess world, int x, int y, int z) {
if (world.getBlock(x, y, z).getMaterial().isLiquid())
return false;
return super.canDisplace(world, x, y, z);
}
@Override
- public boolean displaceIfPossible(World world, int x, int y,
- int z) {
+ public boolean displaceIfPossible(World world, int x, int y, int z) {
if (world.getBlock(x, y, z).getMaterial().isLiquid())
return false;
return super.displaceIfPossible(world, x, y, z);
}
@Override
- protected boolean canFlowInto(IBlockAccess world, int x, int y,
- int z) {
+ protected boolean canFlowInto(IBlockAccess world, int x, int y, int z) {
if (world.getBlock(x, y, z).isAir(world, x, y, z))
return true;
Block block = world.getBlock(x, y, z);
@@ -78,8 +72,7 @@ public class BlockMoltenMetal extends BlockFluidClassic if (displacements.containsKey(block))
return displacements.get(block);
Material material = block.getMaterial();
- if (material.blocksMovement() || material == Material.water
- || material == Material.lava
+ if (material.blocksMovement() || material == Material.water || material == Material.lava
|| material == Material.portal)
return false;
int densty = getDensity(world, x, y, z);
@@ -93,8 +86,7 @@ public class BlockMoltenMetal extends BlockFluidClassic @Override
@SideOnly(Side.CLIENT)
- public int colorMultiplier(IBlockAccess world, int i, int j,
- int k) {
+ public int colorMultiplier(IBlockAccess world, int i, int j, int k) {
try {
return color(world, i, j, k, false, null);
} catch (IOException e) {
@@ -104,212 +96,55 @@ public class BlockMoltenMetal extends BlockFluidClassic }
@Override
- public void updateTick(World world, int x, int y, int z,
- Random rand) {
- if (getTileEntity(world, x, y, z) == null
- || (getTileEntity(world, x, y, z)
- .getMetal() == null))
+ public void updateTick(World world, int x, int y, int z, Random rand) {
+ if (getTileEntity(world, x, y, z) == null || (getTileEntity(world, x, y, z).getMetal() == null))
world.setBlockToAir(x, y, z);
else {
- int quantaRemaining = quantaPerBlock
- - world.getBlockMetadata(x, y, z);
+ int quantaRemaining = quantaPerBlock - world.getBlockMetadata(x, y, z);
int expQuanta = -101;
// check adjacent block levels if non-source
if (quantaRemaining < quantaPerBlock) {
int y2 = y - densityDir;
- if ((world.getBlock(x, y2, z) == this
- && getTileEntity(world, x,
- y2,
- z) != null
- && getTileEntity(world, x,
- y,
- z) != null
- && areMetalsEqual(world, x,
- y2, z, x,
- y, z))
- || (world.getBlock(x - 1,
- y2,
- z) == this
- && getTileEntity(
- world,
- x - 1,
- y2,
- z) != null
- && getTileEntity(
- world,
- x,
- y,
- z) != null
- && areMetalsEqual(
- world,
- x - 1,
- y2,
- z,
- x,
- y,
- z))
- || (world.getBlock(x + 1,
- y2,
- z) == this
- && getTileEntity(
- world,
- x + 1,
- y2,
- z) != null
- && getTileEntity(
- world,
- x,
- y,
- z) != null
- && areMetalsEqual(
- world,
- x + 1,
- y2,
- z,
- x,
- y,
- z))
- || (world.getBlock(x, y2, z
- - 1) == this
- && getTileEntity(
- world,
- x,
- y2,
- z - 1) != null
- && getTileEntity(
- world,
- x,
- y,
- z) != null
- && areMetalsEqual(
- world,
- x,
- y2,
- z - 1,
- x,
- y,
- z))
- || (world.getBlock(x, y2, z
- + 1) == this
- && getTileEntity(
- world,
- x,
- y2,
- z + 1) != null
- && getTileEntity(
- world,
- x,
- y,
- z) != null
- && areMetalsEqual(
- world,
- x,
- y2,
- z + 1,
- x,
- y,
- z)))
+ if ((world.getBlock(x, y2, z) == this && getTileEntity(world, x, y2, z) != null
+ && getTileEntity(world, x, y, z) != null && areMetalsEqual(world, x, y2, z, x, y, z))
+ || (world.getBlock(x - 1, y2, z) == this && getTileEntity(world, x - 1, y2, z) != null
+ && getTileEntity(world, x, y, z) != null
+ && areMetalsEqual(world, x - 1, y2, z, x, y, z))
+ || (world.getBlock(x + 1, y2, z) == this && getTileEntity(world, x + 1, y2, z) != null
+ && getTileEntity(world, x, y, z) != null
+ && areMetalsEqual(world, x + 1, y2, z, x, y, z))
+ || (world.getBlock(x, y2, z - 1) == this && getTileEntity(world, x, y2, z - 1) != null
+ && getTileEntity(world, x, y, z) != null
+ && areMetalsEqual(world, x, y2, z - 1, x, y, z))
+ || (world.getBlock(x, y2, z + 1) == this && getTileEntity(world, x, y2, z + 1) != null
+ && getTileEntity(world, x, y, z) != null
+ && areMetalsEqual(world, x, y2, z + 1, x, y, z)))
expQuanta = quantaPerBlock - 1;
else {
int maxQuanta = -100;
- if (getTileEntity(world, x, y,
- z) != null
- && getTileEntity(
- world,
- x - 1,
- y,
- z) != null
- && areMetalsEqual(
- world,
- x,
- y,
- z,
- x - 1,
- y,
- z))
- maxQuanta = getLargerQuanta(
- world,
- x - 1, y,
- z,
- maxQuanta);
- if (getTileEntity(world, x, y,
- z) != null
- && getTileEntity(
- world,
- x + 1,
- y,
- z) != null
- && areMetalsEqual(
- world,
- x,
- y,
- z,
- x + 1,
- y,
- z))
- maxQuanta = getLargerQuanta(
- world,
- x + 1, y,
- z,
- maxQuanta);
- if (getTileEntity(world, x, y,
- z) != null
- && getTileEntity(
- world,
- x,
- y,
- z - 1) != null
- && areMetalsEqual(
- world,
- x,
- y,
- z,
- x,
- y,
- z - 1))
- maxQuanta = getLargerQuanta(
- world, x,
- y, z - 1,
- maxQuanta);
- if (getTileEntity(world, x, y,
- z) != null
- && getTileEntity(
- world,
- x,
- y,
- z + 1) != null
- && areMetalsEqual(
- world,
- x,
- y,
- z,
- x,
- y,
- z + 1))
- maxQuanta = getLargerQuanta(
- world, x,
- y, z + 1,
- maxQuanta);
+ if (getTileEntity(world, x, y, z) != null && getTileEntity(world, x - 1, y, z) != null
+ && areMetalsEqual(world, x, y, z, x - 1, y, z))
+ maxQuanta = getLargerQuanta(world, x - 1, y, z, maxQuanta);
+ if (getTileEntity(world, x, y, z) != null && getTileEntity(world, x + 1, y, z) != null
+ && areMetalsEqual(world, x, y, z, x + 1, y, z))
+ maxQuanta = getLargerQuanta(world, x + 1, y, z, maxQuanta);
+ if (getTileEntity(world, x, y, z) != null && getTileEntity(world, x, y, z - 1) != null
+ && areMetalsEqual(world, x, y, z, x, y, z - 1))
+ maxQuanta = getLargerQuanta(world, x, y, z - 1, maxQuanta);
+ if (getTileEntity(world, x, y, z) != null && getTileEntity(world, x, y, z + 1) != null
+ && areMetalsEqual(world, x, y, z, x, y, z + 1))
+ maxQuanta = getLargerQuanta(world, x, y, z + 1, maxQuanta);
expQuanta = maxQuanta - 1;
}
// decay calculation
if (expQuanta != quantaRemaining) {
quantaRemaining = expQuanta;
if (expQuanta <= 0)
- world.setBlock(x, y, z,
- Blocks.air);
+ world.setBlock(x, y, z, Blocks.air);
else {
- world.setBlockMetadataWithNotify(
- x, y, z,
- quantaPerBlock - expQuanta,
- 3);
- world.scheduleBlockUpdate(
- x, y, z,
- this,
- tickRate);
- world.notifyBlocksOfNeighborChange(
- x, y, z,
- this);
+ world.setBlockMetadataWithNotify(x, y, z, quantaPerBlock - expQuanta, 3);
+ world.scheduleBlockUpdate(x, y, z, this, tickRate);
+ world.notifyBlocksOfNeighborChange(x, y, z, this);
}
}
}
@@ -317,126 +152,65 @@ public class BlockMoltenMetal extends BlockFluidClassic // send a
// server only update
else if (quantaRemaining >= quantaPerBlock)
- world.setBlockMetadataWithNotify(x, y, z,
- 0, 2);
+ world.setBlockMetadataWithNotify(x, y, z, 0, 2);
// Flow vertically if possible
if (canDisplace(world, x, y + densityDir, z)) {
- if (getTileEntity(world, x, y + densityDir,
- z) != null
- && getTileEntity(world, x,
- y,
- z) != null)
- BlockMoltenMetal.getTileEntity(
- world, x,
- y + densityDir, z)
- .setMetal(getTileEntity(
- world,
- x,
- y,
- z).getMetal());
- flowIntoBlock(world, x, y + densityDir, z,
- 1,
- getTileEntity(world, x, y,
- z).getMetal());
+ if (getTileEntity(world, x, y + densityDir, z) != null && getTileEntity(world, x, y, z) != null)
+ BlockMoltenMetal.getTileEntity(world, x, y + densityDir, z)
+ .setMetal(getTileEntity(world, x, y, z).getMetal());
+ flowIntoBlock(world, x, y + densityDir, z, 1, getTileEntity(world, x, y, z).getMetal());
return;
}
// Flow outward if possible
- int flowMeta = quantaPerBlock - quantaRemaining
- + 1;
+ int flowMeta = quantaPerBlock - quantaRemaining + 1;
if (flowMeta >= quantaPerBlock)
return;
- if (isSourceBlock(world, x, y, z)
- || !isFlowingVertically(world, x,
- y, z)) {
- if (world.getBlock(x, y - densityDir,
- z) == this
- && getTileEntity(world, x,
- y,
- z) != null
- && getTileEntity(world, x,
- y - densityDir,
- z) != null
- && areMetalsEqual(world, x,
- y, z, x,
- y - densityDir,
- z))
+ if (isSourceBlock(world, x, y, z) || !isFlowingVertically(world, x, y, z)) {
+ if (world.getBlock(x, y - densityDir, z) == this && getTileEntity(world, x, y, z) != null
+ && getTileEntity(world, x, y - densityDir, z) != null
+ && areMetalsEqual(world, x, y, z, x, y - densityDir, z))
flowMeta = 1;
- boolean flowTo[] = getOptimalFlowDirections(
- world, x, y, z);
+ boolean flowTo[] = getOptimalFlowDirections(world, x, y, z);
if (flowTo[0])
- flowIntoBlock(world, x - 1, y, z,
- flowMeta,
- getTileEntity(world,
- x,
- y,
- z).getMetal());
+ flowIntoBlock(world, x - 1, y, z, flowMeta, getTileEntity(world, x, y, z).getMetal());
if (flowTo[1])
- flowIntoBlock(world, x + 1, y, z,
- flowMeta,
- getTileEntity(world,
- x,
- y,
- z).getMetal());
+ flowIntoBlock(world, x + 1, y, z, flowMeta, getTileEntity(world, x, y, z).getMetal());
if (flowTo[2])
- flowIntoBlock(world, x, y, z - 1,
- flowMeta,
- getTileEntity(world,
- x,
- y,
- z).getMetal());
+ flowIntoBlock(world, x, y, z - 1, flowMeta, getTileEntity(world, x, y, z).getMetal());
if (flowTo[3])
- flowIntoBlock(world, x, y, z + 1,
- flowMeta,
- getTileEntity(world,
- x,
- y,
- z).getMetal());
+ flowIntoBlock(world, x, y, z + 1, flowMeta, getTileEntity(world, x, y, z).getMetal());
}
}
}
- public void flowIntoBlock(World world, int x, int y, int z,
- int meta, ItemStack metal) {
+ public void flowIntoBlock(World world, int x, int y, int z, int meta, ItemStack metal) {
if (meta < 0 || world.isRemote)
return;
if (displaceIfPossible(world, x, y, z)) {
world.setBlock(x, y, z, this, meta, 3);
if (getTileEntity(world, x, y, z) != null)
- getTileEntity(world, x, y, z)
- .setMetal(metal);
+ getTileEntity(world, x, y, z).setMetal(metal);
}
}
- public static TileEntityMoltenMetal getTileEntity(World world,
- int x, int y, int z) {
+ public static TileEntityMoltenMetal getTileEntity(World world, int x, int y, int z) {
TileEntity moltenLiquid = world.getTileEntity(x, y, z);
- if (moltenLiquid != null
- && moltenLiquid instanceof TileEntityMoltenMetal)
+ if (moltenLiquid != null && moltenLiquid instanceof TileEntityMoltenMetal)
return (TileEntityMoltenMetal) moltenLiquid;
return null;
}
- public static boolean areMetalsEqual(World world, int x1, int y1,
- int z1, int x2, int y2, int z2) {
- return ItemStack.areItemStacksEqual(
- getTileEntity(world, x1, y1, z1)
- .getMetal(),
- getTileEntity(world, x2, y2, z2)
- .getMetal());
+ public static boolean areMetalsEqual(World world, int x1, int y1, int z1, int x2, int y2, int z2) {
+ return ItemStack.areItemStacksEqual(getTileEntity(world, x1, y1, z1).getMetal(),
+ getTileEntity(world, x2, y2, z2).getMetal());
}
@SideOnly(Side.CLIENT)
- public static int color(IBlockAccess world, int i, int j, int k,
- boolean forcecolor, Item itemC)
+ public static int color(IBlockAccess world, int i, int j, int k, boolean forcecolor, Item itemC)
throws IOException {
TileEntity te = world.getTileEntity(i, j, k);
- if (te instanceof TileEntityMoltenMetal
- && ((TileEntityMoltenMetal) te)
- .getMetal() != null)
- return JewelrycraftUtil.getColor(
- ((TileEntityMoltenMetal) te)
- .getMetal()
- .copy());
+ if (te instanceof TileEntityMoltenMetal && ((TileEntityMoltenMetal) te).getMetal() != null)
+ return JewelrycraftUtil.getColor(((TileEntityMoltenMetal) te).getMetal().copy());
return 16777215;
}
diff --git a/src/main/java/darkknight/jewelrycraft/block/BlockShadow.java b/src/main/java/darkknight/jewelrycraft/block/BlockShadow.java index dff2a94..b817b80 100755 --- a/src/main/java/darkknight/jewelrycraft/block/BlockShadow.java +++ b/src/main/java/darkknight/jewelrycraft/block/BlockShadow.java @@ -44,8 +44,7 @@ public class BlockShadow extends BlockContainer { * @param beaconZ
* @return
*/
- public boolean isBeaconBase(World worldObj, int x, int y, int z,
- int beaconX, int beaconY, int beaconZ) {
+ public boolean isBeaconBase(World worldObj, int x, int y, int z, int beaconX, int beaconY, int beaconZ) {
return true;
}
@@ -73,8 +72,7 @@ public class BlockShadow extends BlockContainer { * @param side
* @return
*/
- public boolean isBlockSolidOnSide(World world, int x, int y, int z,
- ForgeDirection side) {
+ public boolean isBlockSolidOnSide(World world, int x, int y, int z, ForgeDirection side) {
return false;
}
@@ -103,8 +101,7 @@ public class BlockShadow extends BlockContainer { public void registerBlockIcons(IIconRegister par1IconRegister) {
iconArray = new IIcon[16];
for (int i = 0; i < iconArray.length; ++i)
- iconArray[i] = par1IconRegister.registerIcon(
- getTextureName() + (15 - i));
+ iconArray[i] = par1IconRegister.registerIcon(getTextureName() + (15 - i));
}
/**
@@ -115,12 +112,10 @@ public class BlockShadow extends BlockContainer { * @return
*/
@Override
- public AxisAlignedBB getCollisionBoundingBoxFromPool(World world,
- int x, int y, int z) {
+ public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
if (world.getBlockMetadata(x, y, z) == 15)
return null;
- return super.getCollisionBoundingBoxFromPool(world, x, y,
- z);
+ return super.getCollisionBoundingBoxFromPool(world, x, y, z);
}
/**
@@ -130,9 +125,7 @@ public class BlockShadow extends BlockContainer { * @param par4
*/
@Override
- public void setBlockBoundsBasedOnState(
- IBlockAccess par1IBlockAccess, int par2, int par3,
- int par4) {
+ public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) {
setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
}
@@ -145,18 +138,14 @@ public class BlockShadow extends BlockContainer { * @return
*/
@Override
- public boolean shouldSideBeRendered(IBlockAccess p_149646_1_,
- int p_149646_2_, int p_149646_3_, int p_149646_4_,
+ public boolean shouldSideBeRendered(IBlockAccess p_149646_1_, int p_149646_2_, int p_149646_3_, int p_149646_4_,
int p_149646_5_) {
- Block block = p_149646_1_.getBlock(p_149646_2_,
- p_149646_3_, p_149646_4_);
+ Block block = p_149646_1_.getBlock(p_149646_2_, p_149646_3_, p_149646_4_);
if (this == BlockList.shadowBlock)
if (block == this)
return false;
return block == this ? false
- : super.shouldSideBeRendered(p_149646_1_,
- p_149646_2_, p_149646_3_,
- p_149646_4_, p_149646_5_);
+ : super.shouldSideBeRendered(p_149646_1_, p_149646_2_, p_149646_3_, p_149646_4_, p_149646_5_);
}
/**
@@ -176,8 +165,7 @@ public class BlockShadow extends BlockContainer { * @return
*/
@Override
- public int getComparatorInputOverride(World world, int x, int y,
- int z, int meta) {
+ public int getComparatorInputOverride(World world, int x, int y, int z, int meta) {
return world.getBlockMetadata(x, y, z);
}
diff --git a/src/main/java/darkknight/jewelrycraft/block/BlockShadowEye.java b/src/main/java/darkknight/jewelrycraft/block/BlockShadowEye.java index 553ab05..1e306d2 100755 --- a/src/main/java/darkknight/jewelrycraft/block/BlockShadowEye.java +++ b/src/main/java/darkknight/jewelrycraft/block/BlockShadowEye.java @@ -48,8 +48,7 @@ public class BlockShadowEye extends BlockContainer { * @return
*/
@Override
- public boolean shouldSideBeRendered(IBlockAccess iblockaccess,
- int i, int j, int k, int l) {
+ public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l) {
return false;
}
@@ -82,11 +81,9 @@ public class BlockShadowEye extends BlockContainer { * @return
*/
@Override
- public boolean onBlockActivated(World world, int i, int j, int k,
- EntityPlayer entityPlayer, int par6, float par7,
+ public boolean onBlockActivated(World world, int i, int j, int k, EntityPlayer entityPlayer, int par6, float par7,
float par8, float par9) {
- TileEntityShadowEye tile = (TileEntityShadowEye) world
- .getTileEntity(i, j, k);
+ TileEntityShadowEye tile = (TileEntityShadowEye) world.getTileEntity(i, j, k);
if (!tile.active && tile.opening == 1) {
tile.active = true;
tile.target = entityPlayer;
@@ -103,8 +100,7 @@ public class BlockShadowEye extends BlockContainer { * @param player
*/
@Override
- public void onBlockClicked(World world, int i, int j, int k,
- EntityPlayer player) {
+ public void onBlockClicked(World world, int i, int j, int k, EntityPlayer player) {
// Do nothing
}
@@ -117,13 +113,9 @@ public class BlockShadowEye extends BlockContainer { * @param par6ItemStack
*/
@Override
- public void onBlockPlacedBy(World world, int i, int j, int k,
- EntityLivingBase entityLiving,
+ public void onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase entityLiving,
ItemStack par6ItemStack) {
- int rotation = MathHelper
- .floor_double(entityLiving.rotationYaw
- * 4.0F / 360.0F + 0.5D)
- & 3;
+ int rotation = MathHelper.floor_double(entityLiving.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
world.setBlockMetadataWithNotify(i, j, k, rotation, 2);
}
diff --git a/src/main/java/darkknight/jewelrycraft/block/BlockShadowHand.java b/src/main/java/darkknight/jewelrycraft/block/BlockShadowHand.java index 0d9ceb4..44bb2c6 100755 --- a/src/main/java/darkknight/jewelrycraft/block/BlockShadowHand.java +++ b/src/main/java/darkknight/jewelrycraft/block/BlockShadowHand.java @@ -49,8 +49,7 @@ public class BlockShadowHand extends BlockContainer { * @return
*/
@Override
- public boolean shouldSideBeRendered(IBlockAccess iblockaccess,
- int i, int j, int k, int l) {
+ public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l) {
return false;
}
@@ -77,10 +76,8 @@ public class BlockShadowHand extends BlockContainer { * @param z
* @param stack
*/
- public void dropItem(World world, double x, double y, double z,
- ItemStack stack) {
- EntityItem entityitem = new EntityItem(world, x + 0.5D,
- y + 1.5D, z + 0.5D, stack);
+ public void dropItem(World world, double x, double y, double z, ItemStack stack) {
+ EntityItem entityitem = new EntityItem(world, x + 0.5D, y + 1.5D, z + 0.5D, stack);
entityitem.motionX = 0;
entityitem.motionZ = 0;
entityitem.motionY = 0.11000000298023224D;
@@ -96,16 +93,11 @@ public class BlockShadowHand extends BlockContainer { * @param par6
*/
@Override
- public void breakBlock(World world, int i, int j, int k,
- Block block, int par6) {
- if (world.getTileEntity(i, j,
- k) instanceof TileEntityShadowHand) {
- TileEntityShadowHand te = (TileEntityShadowHand) world
- .getTileEntity(i, j, k);
+ public void breakBlock(World world, int i, int j, int k, Block block, int par6) {
+ if (world.getTileEntity(i, j, k) instanceof TileEntityShadowHand) {
+ TileEntityShadowHand te = (TileEntityShadowHand) world.getTileEntity(i, j, k);
if (te != null && te.getHeldItemStack() != null) {
- dropItem(te.getWorldObj(), te.xCoord,
- te.yCoord, te.zCoord,
- te.getHeldItemStack());
+ dropItem(te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord, te.getHeldItemStack());
world.removeTileEntity(i, j, k);
}
}
@@ -121,13 +113,9 @@ public class BlockShadowHand extends BlockContainer { * @param par6ItemStack
*/
@Override
- public void onBlockPlacedBy(World world, int i, int j, int k,
- EntityLivingBase entityLiving,
+ public void onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase entityLiving,
ItemStack par6ItemStack) {
- int rotation = MathHelper
- .floor_double(entityLiving.rotationYaw
- * 8.0F / 360.0F + 0.5D)
- & 7;
+ int rotation = MathHelper.floor_double(entityLiving.rotationYaw * 8.0F / 360.0F + 0.5D) & 7;
world.setBlockMetadataWithNotify(i, j, k, rotation, 2);
}
diff --git a/src/main/java/darkknight/jewelrycraft/block/BlockSmelter.java b/src/main/java/darkknight/jewelrycraft/block/BlockSmelter.java index 4da1037..5486908 100755 --- a/src/main/java/darkknight/jewelrycraft/block/BlockSmelter.java +++ b/src/main/java/darkknight/jewelrycraft/block/BlockSmelter.java @@ -45,10 +45,8 @@ public class BlockSmelter extends BlockContainer { return false;
}
- public void dropItem(World world, double x, double y, double z,
- ItemStack stack) {
- EntityItem entityitem = new EntityItem(world, x + 0.5D,
- y + 1.3D, z + 0.5D, stack);
+ public void dropItem(World world, double x, double y, double z, ItemStack stack) {
+ EntityItem entityitem = new EntityItem(world, x + 0.5D, y + 1.3D, z + 0.5D, stack);
entityitem.motionX = 0;
entityitem.motionZ = 0;
entityitem.motionY = 0.11000000298023224D;
@@ -57,29 +55,19 @@ public class BlockSmelter extends BlockContainer { }
@Override
- public void breakBlock(World world, int i, int j, int k,
- Block block, int meta) {
- TileEntitySmelter te = (TileEntitySmelter) world
- .getTileEntity(i, j, k);
+ public void breakBlock(World world, int i, int j, int k, Block block, int meta) {
+ TileEntitySmelter te = (TileEntitySmelter) world.getTileEntity(i, j, k);
if (te != null) {
if (te.hasMetal)
dropItem(world, i, j, k, te.metal.copy());
- if (te.hasMoltenMetal && te.moltenMetal != null
- && Item.getIdFromItem(
- te.moltenMetal.getItem()) > 0) {
+ if (te.hasMoltenMetal && te.moltenMetal != null && Item.getIdFromItem(te.moltenMetal.getItem()) > 0) {
int quant = (int) (te.quantity * 10);
- ItemStack metalBucket = new ItemStack(
- ItemList.bucket);
- JewelryNBT.addMetal(metalBucket,
- te.moltenMetal.copy());
+ ItemStack metalBucket = new ItemStack(ItemList.bucket);
+ JewelryNBT.addMetal(metalBucket, te.moltenMetal.copy());
if (quant == 9) {
- dropItem(world, i, j, k,
- new ItemStack(Blocks.cobblestone,
- 6));
- dropItem(world, i, j, k,
- new ItemStack(Items.lava_bucket));
- dropItem(world, i, j, k,
- metalBucket);
+ dropItem(world, i, j, k, new ItemStack(Blocks.cobblestone, 6));
+ dropItem(world, i, j, k, new ItemStack(Items.lava_bucket));
+ dropItem(world, i, j, k, metalBucket);
}
}
world.removeTileEntity(i, j, k);
@@ -87,146 +75,75 @@ public class BlockSmelter extends BlockContainer { }
@Override
- public boolean onBlockActivated(World world, int i, int j, int k,
- EntityPlayer entityPlayer, int par6, float par7,
+ public boolean onBlockActivated(World world, int i, int j, int k, EntityPlayer entityPlayer, int par6, float par7,
float par8, float par9) {
- TileEntitySmelter te = (TileEntitySmelter) world
- .getTileEntity(i, j, k);
+ TileEntitySmelter te = (TileEntitySmelter) world.getTileEntity(i, j, k);
ItemStack item = entityPlayer.inventory.getCurrentItem();
- if (te != null && te.hasMoltenMetal && te.quantity >= .9f
- && !te.pouring && item != null
+ if (te != null && te.hasMoltenMetal && te.quantity >= .9f && !te.pouring && item != null
&& item.getItem() == Items.bucket) {
te.quantity = 0f;
te.hasMoltenMetal = false;
- ItemStack metalBucket = new ItemStack(
- ItemList.bucket, 1);
+ ItemStack metalBucket = new ItemStack(ItemList.bucket, 1);
ItemStack ingot = te.moltenMetal.copy();
JewelryNBT.addMetal(metalBucket, ingot);
--item.stackSize;
- entityPlayer.inventory.addItemStackToInventory(
- metalBucket);
+ entityPlayer.inventory.addItemStackToInventory(metalBucket);
te.isDirty = true;
return true;
}
if (te != null && !world.isRemote) {
if (te.hasMetal && entityPlayer.isSneaking()) {
- dropItem(world, te.xCoord, te.yCoord,
- te.zCoord,
- te.metal.copy());
+ dropItem(world, te.xCoord, te.yCoord, te.zCoord, te.metal.copy());
te.hasMetal = false;
te.melting = -1;
te.isDirty = true;
}
- if (item != null && item.getItem() != null
- && !(item.getItem() instanceof ItemMoltenMetalBucket)) {
+ if (item != null && item.getItem() != null && !(item.getItem() instanceof ItemMoltenMetalBucket)) {
int index = -1;
- for (int a = 0; a < JewelrycraftUtil.jamcraftPlayers
- .size(); a++)
- if (entityPlayer.getUniqueID()
- .toString()
- .equals(JewelrycraftUtil.jamcraftPlayers
- .get(a)))
+ for (int a = 0; a < JewelrycraftUtil.jamcraftPlayers.size(); a++)
+ if (entityPlayer.getUniqueID().toString().equals(JewelrycraftUtil.jamcraftPlayers.get(a)))
index = a;
if (entityPlayer.capabilities.isCreativeMode)
index = 1;
- boolean canPlace = JewelrycraftUtil
- .isMetal(item)
- || JewelrycraftUtil.isOre(
- item)
- || index >= 0
- || JewelryNBT.ingot(
- item) != null;
- boolean isOre = false,
- oreCoincidesWithMetal = false,
- itemCoincidesWithMetal = false,
- itemCoincidesWithMoltenMetal = false,
- overflow = false;
+ boolean canPlace = JewelrycraftUtil.isMetal(item) || JewelrycraftUtil.isOre(item) || index >= 0
+ || JewelryNBT.ingot(item) != null;
+ boolean isOre = false, oreCoincidesWithMetal = false, itemCoincidesWithMetal = false,
+ itemCoincidesWithMoltenMetal = false, overflow = false;
isOre = JewelrycraftUtil.isOre(item);
- if (te.metal != null && te.metal
- .getItem() != null) {
+ if (te.metal != null && te.metal.getItem() != null) {
if (JewelryNBT.ingot(item) == null)
- itemCoincidesWithMetal = item
- .getItem()
- .equals(te.metal.getItem())
- && item.getItemDamage() == te.metal
- .getItemDamage();
+ itemCoincidesWithMetal = item.getItem().equals(te.metal.getItem())
+ && item.getItemDamage() == te.metal.getItemDamage();
else
- itemCoincidesWithMetal = item
- .getItem()
- .equals(te.metal.getItem())
- && item.getItemDamage() == te.metal
- .getItemDamage()
- && JewelryNBT.ingot(
- item)
- .getItem()
- .equals(JewelryNBT
- .ingot(te.metal)
- .getItem())
- && JewelryNBT.ingot(
- item)
- .getItemDamage() == JewelryNBT
- .ingot(te.metal)
- .getItemDamage();
+ itemCoincidesWithMetal = item.getItem().equals(te.metal.getItem())
+ && item.getItemDamage() == te.metal.getItemDamage()
+ && JewelryNBT.ingot(item).getItem().equals(JewelryNBT.ingot(te.metal).getItem())
+ && JewelryNBT.ingot(item).getItemDamage() == JewelryNBT.ingot(te.metal).getItemDamage();
}
- if (te.moltenMetal != null
- && te.moltenMetal
- .getItem() != null) {
+ if (te.moltenMetal != null && te.moltenMetal.getItem() != null) {
if (JewelryNBT.ingot(item) == null)
- itemCoincidesWithMoltenMetal = item
- .getItem()
- .equals(te.moltenMetal
- .getItem())
- && item.getItemDamage() == te.moltenMetal
- .getItemDamage();
+ itemCoincidesWithMoltenMetal = item.getItem().equals(te.moltenMetal.getItem())
+ && item.getItemDamage() == te.moltenMetal.getItemDamage();
else
- itemCoincidesWithMoltenMetal = JewelryNBT
- .ingot(item)
- .getItem()
- .equals(te.moltenMetal
- .getItem())
- && JewelryNBT.ingot(
- item)
- .getItemDamage() == te.moltenMetal
- .getItemDamage();
+ itemCoincidesWithMoltenMetal = JewelryNBT.ingot(item).getItem().equals(te.moltenMetal.getItem())
+ && JewelryNBT.ingot(item).getItemDamage() == te.moltenMetal.getItemDamage();
if (isOre)
- oreCoincidesWithMetal = te.moltenMetal
- .getItem()
- .equals(JewelrycraftUtil
- .getIngotFromOre(
- item)
- .getItem())
- && te.moltenMetal
- .getItemDamage() == JewelrycraftUtil
- .getIngotFromOre(
- item)
- .getItemDamage();
+ oreCoincidesWithMetal = te.moltenMetal.getItem()
+ .equals(JewelrycraftUtil.getIngotFromOre(item).getItem())
+ && te.moltenMetal.getItemDamage() == JewelrycraftUtil.getIngotFromOre(item)
+ .getItemDamage();
}
- overflow = isOre ? te.metal.stackSize
- * 0.2f + te.quantity < 0.8f
- : te.metal.stackSize * 0.1f
- + te.quantity < 0.9f;
- boolean isValid = te.hasMoltenMetal ? isOre
- ? oreCoincidesWithMetal
- : itemCoincidesWithMoltenMetal
+ overflow = isOre ? te.metal.stackSize * 0.2f + te.quantity < 0.8f
+ : te.metal.stackSize * 0.1f + te.quantity < 0.9f;
+ boolean isValid = te.hasMoltenMetal ? isOre ? oreCoincidesWithMetal : itemCoincidesWithMoltenMetal
: true;
- if (te.quantity < 0.9f && !te.pouring
- && canPlace && isValid) {
- boolean check = isOre
- ? oreCoincidesWithMetal
- && te.quantity < 0.8f
- : itemCoincidesWithMoltenMetal;
- boolean check2 = isOre
- ? oreCoincidesWithMetal
- : itemCoincidesWithMetal;
- if (!te.hasMetal && !te.hasMoltenMetal
- || !te.hasMetal && te.hasMoltenMetal
- && check) {
- entityPlayer.addChatMessage(
- new ChatComponentText(
- StatCollector.translateToLocalFormatted(
- "chatmessage." + Variables.MODID
- + ".smelter.nowsmeltingingot",
- item.getDisplayName())));
+ if (te.quantity < 0.9f && !te.pouring && canPlace && isValid) {
+ boolean check = isOre ? oreCoincidesWithMetal && te.quantity < 0.8f : itemCoincidesWithMoltenMetal;
+ boolean check2 = isOre ? oreCoincidesWithMetal : itemCoincidesWithMetal;
+ if (!te.hasMetal && !te.hasMoltenMetal || !te.hasMetal && te.hasMoltenMetal && check) {
+ entityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocalFormatted(
+ "chatmessage." + Variables.MODID + ".smelter.nowsmeltingingot",
+ item.getDisplayName())));
te.metal = item.copy();
te.metal.stackSize = 1;
te.hasMetal = true;
@@ -234,23 +151,11 @@ public class BlockSmelter extends BlockContainer { if (!entityPlayer.capabilities.isCreativeMode)
--item.stackSize;
te.isDirty = true;
- } else if (te.hasMetal
- && te.hasMoltenMetal
- && check2
- && overflow
- || te.hasMetal && !te.hasMoltenMetal
- && itemCoincidesWithMetal
- && overflow) {
+ } else if (te.hasMetal && te.hasMoltenMetal && check2 && overflow
+ || te.hasMetal && !te.hasMoltenMetal && itemCoincidesWithMetal && overflow) {
entityPlayer.addChatMessage(
- new ChatComponentText(
- StatCollector.translateToLocalFormatted(
- "Smelting extra "
- + (isOre ? "ores"
- : "ingots")
- + " ("
- + (te.metal.stackSize
- + 1)
- + ")")));
+ new ChatComponentText(StatCollector.translateToLocalFormatted("Smelting extra "
+ + (isOre ? "ores" : "ingots") + " (" + (te.metal.stackSize + 1) + ")")));
te.metal.stackSize++;
te.hasMetal = true;
te.melting += ConfigHandler.INGOT_MELTING_TIME;
@@ -259,43 +164,21 @@ public class BlockSmelter extends BlockContainer { te.isDirty = true;
}
te.isDirty = true;
- } else if ((te.hasMetal
- || te.hasMoltenMetal)
- && !itemCoincidesWithMoltenMetal
- && te.quantity < .9f)
- entityPlayer.addChatMessage(
- new ChatComponentText(
- StatCollector.translateToLocal(
- "chatmessage." + Variables.MODID
- + ".smelter.contentdoesnotmatch")));
- else if (!item.getUnlocalizedName()
- .toLowerCase()
- .contains("ingot")
- && item.getDisplayName()
- .toLowerCase()
- .contains("ingot")
- && te.quantity < .9f)
- entityPlayer.addChatMessage(
- new ChatComponentText(
- StatCollector.translateToLocal(
- "chatmessage." + Variables.MODID
- + ".smelter.itemrenamedtoingot")));
+ } else if ((te.hasMetal || te.hasMoltenMetal) && !itemCoincidesWithMoltenMetal && te.quantity < .9f)
+ entityPlayer.addChatMessage(new ChatComponentText(StatCollector
+ .translateToLocal("chatmessage." + Variables.MODID + ".smelter.contentdoesnotmatch")));
+ else if (!item.getUnlocalizedName().toLowerCase().contains("ingot")
+ && item.getDisplayName().toLowerCase().contains("ingot") && te.quantity < .9f)
+ entityPlayer.addChatMessage(new ChatComponentText(StatCollector
+ .translateToLocal("chatmessage." + Variables.MODID + ".smelter.itemrenamedtoingot")));
else if (te.quantity >= .9f)
- entityPlayer.addChatMessage(
- new ChatComponentText(
- StatCollector.translateToLocal(
- "chatmessage." + Variables.MODID
- + ".smelter.full")));
+ entityPlayer.addChatMessage(new ChatComponentText(
+ StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".smelter.full")));
else
- entityPlayer.addChatMessage(
- new ChatComponentText(
- StatCollector.translateToLocal(
- "chatmessage." + Variables.MODID
- + ".smelter.cannotsmelt")));
- } else if (item != null && item.getItem() != null
- && item.getItem() instanceof ItemMoltenMetalBucket
- && !te.hasMoltenMetal
- && !te.hasMetal) {
+ entityPlayer.addChatMessage(new ChatComponentText(
+ StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".smelter.cannotsmelt")));
+ } else if (item != null && item.getItem() != null && item.getItem() instanceof ItemMoltenMetalBucket
+ && !te.hasMoltenMetal && !te.hasMetal) {
te.hasMoltenMetal = true;
ItemStack ingot = JewelryNBT.ingot(item);
te.moltenMetal = ingot;
@@ -303,146 +186,84 @@ public class BlockSmelter extends BlockContainer { te.isDirty = true;
if (!entityPlayer.capabilities.isCreativeMode) {
--item.stackSize;
- dropItem(world, entityPlayer.posX,
- entityPlayer.posY,
- entityPlayer.posZ,
+ dropItem(world, entityPlayer.posX, entityPlayer.posY, entityPlayer.posZ,
new ItemStack(Items.bucket));
}
- } else if (item == null && te.hasMoltenMetal
- && te.moltenMetal
- .getItem() != null)
- entityPlayer.addChatMessage(
- new ChatComponentText(
- StatCollector.translateToLocalFormatted(
- "chatmessage." + Variables.MODID
- + ".smelter.hasmolteningot",
- te.moltenMetal.getDisplayName()
- .replace(" Ingot",
- ""))));
+ } else if (item == null && te.hasMoltenMetal && te.moltenMetal.getItem() != null)
+ entityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocalFormatted(
+ "chatmessage." + Variables.MODID + ".smelter.hasmolteningot",
+ te.moltenMetal.getDisplayName().replace(" Ingot", ""))));
world.setTileEntity(i, j, k, te);
}
return true;
}
@Override
- public void onBlockClicked(World world, int i, int j, int k,
- EntityPlayer player) {
- TileEntitySmelter te = (TileEntitySmelter) world
- .getTileEntity(i, j, k);
+ public void onBlockClicked(World world, int i, int j, int k, EntityPlayer player) {
+ TileEntitySmelter te = (TileEntitySmelter) world.getTileEntity(i, j, k);
TileEntityMolder me = null;
- if (world.getBlockMetadata(i, j, k) == 0
- && world.getTileEntity(i, j, k - 1) != null
- && world.getTileEntity(i, j, k
- - 1) instanceof TileEntityMolder)
- me = (TileEntityMolder) world.getTileEntity(i, j,
- k - 1);
- else if (world.getBlockMetadata(i, j, k) == 1
- && world.getTileEntity(i + 1, j, k) != null
- && world.getTileEntity(i + 1, j,
- k) instanceof TileEntityMolder)
- me = (TileEntityMolder) world.getTileEntity(i + 1,
- j, k);
- else if (world.getBlockMetadata(i, j, k) == 2
- && world.getTileEntity(i, j, k + 1) != null
- && world.getTileEntity(i, j, k
- + 1) instanceof TileEntityMolder)
- me = (TileEntityMolder) world.getTileEntity(i, j,
- k + 1);
- else if (world.getBlockMetadata(i, j, k) == 3
- && world.getTileEntity(i - 1, j, k) != null
- && world.getTileEntity(i - 1, j,
- k) instanceof TileEntityMolder)
- me = (TileEntityMolder) world.getTileEntity(i - 1,
- j, k);
+ if (world.getBlockMetadata(i, j, k) == 0 && world.getTileEntity(i, j, k - 1) != null
+ && world.getTileEntity(i, j, k - 1) instanceof TileEntityMolder)
+ me = (TileEntityMolder) world.getTileEntity(i, j, k - 1);
+ else if (world.getBlockMetadata(i, j, k) == 1 && world.getTileEntity(i + 1, j, k) != null
+ && world.getTileEntity(i + 1, j, k) instanceof TileEntityMolder)
+ me = (TileEntityMolder) world.getTileEntity(i + 1, j, k);
+ else if (world.getBlockMetadata(i, j, k) == 2 && world.getTileEntity(i, j, k + 1) != null
+ && world.getTileEntity(i, j, k + 1) instanceof TileEntityMolder)
+ me = (TileEntityMolder) world.getTileEntity(i, j, k + 1);
+ else if (world.getBlockMetadata(i, j, k) == 3 && world.getTileEntity(i - 1, j, k) != null
+ && world.getTileEntity(i - 1, j, k) instanceof TileEntityMolder)
+ me = (TileEntityMolder) world.getTileEntity(i - 1, j, k);
if (te != null && me != null && !world.isRemote)
- if (te.hasMoltenMetal
- && isConnectedToMolder(world, i, j,
- k)
- && me.hasMold && !me.hasMoltenMetal
+ if (te.hasMoltenMetal && isConnectedToMolder(world, i, j, k) && me.hasMold && !me.hasMoltenMetal
&& !me.hasJewelBase) {
te.pouring = true;
te.isDirty = true;
} else if (te.hasMetal && te.melting > 0)
- player.addChatMessage(
- new ChatComponentText(
- StatCollector.translateToLocalFormatted(
- "chatmessage." + Variables.MODID
- + ".smelter.metalismelting",
- te.metal.getDisplayName())
- + " ("
- + (ConfigHandler.INGOT_MELTING_TIME
- * te.metal.stackSize
- - te.melting)
- * 100
- / (ConfigHandler.INGOT_MELTING_TIME
- * te.metal.stackSize)
- + "%)"));
- else if (te.hasMoltenMetal
- && !isConnectedToMolder(world, i,
- j, k))
- player.addChatMessage(
- new ChatComponentText(
- StatCollector.translateToLocal(
- "chatmessage." + Variables.MODID
- + ".smelter.molderismissing")));
+ player.addChatMessage(new ChatComponentText(StatCollector.translateToLocalFormatted(
+ "chatmessage." + Variables.MODID + ".smelter.metalismelting", te.metal.getDisplayName()) + " ("
+ + (ConfigHandler.INGOT_MELTING_TIME * te.metal.stackSize - te.melting) * 100
+ / (ConfigHandler.INGOT_MELTING_TIME * te.metal.stackSize)
+ + "%)"));
+ else if (te.hasMoltenMetal && !isConnectedToMolder(world, i, j, k))
+ player.addChatMessage(new ChatComponentText(
+ StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".smelter.molderismissing")));
else if (!me.hasMold && te.hasMoltenMetal)
- player.addChatMessage(
- new ChatComponentText(
- StatCollector.translateToLocal(
- "chatmessage." + Variables.MODID
- + ".smelter.molderhasnomold")));
+ player.addChatMessage(new ChatComponentText(
+ StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".smelter.molderhasnomold")));
else if (me.hasMoltenMetal && te.hasMoltenMetal)
- player.addChatMessage(
- new ChatComponentText(
- StatCollector.translateToLocal(
- "chatmessage." + Variables.MODID
- + ".smelter.molderhasmoltenmetal")));
+ player.addChatMessage(new ChatComponentText(StatCollector
+ .translateToLocal("chatmessage." + Variables.MODID + ".smelter.molderhasmoltenmetal")));
else if (me.hasJewelBase && te.hasMoltenMetal)
- player.addChatMessage(
- new ChatComponentText(
- StatCollector.translateToLocal(
- "chatmessage." + Variables.MODID
- + ".smelter.modlerhasitem")));
+ player.addChatMessage(new ChatComponentText(
+ StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".smelter.modlerhasitem")));
else
- player.addChatMessage(
- new ChatComponentText(
- StatCollector.translateToLocal(
- "chatmessage." + Variables.MODID
- + ".smelter.empty")));
+ player.addChatMessage(new ChatComponentText(
+ StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".smelter.empty")));
}
- public boolean isConnectedToMolder(World world, int i, int j,
- int k) {
+ public boolean isConnectedToMolder(World world, int i, int j, int k) {
int blockMeta = world.getBlockMetadata(i, j, k);
- if (blockMeta == 0 && world.getBlock(i, j,
- k - 1) instanceof BlockMolder)
+ if (blockMeta == 0 && world.getBlock(i, j, k - 1) instanceof BlockMolder)
return true;
- else if (blockMeta == 1 && world.getBlock(i + 1, j,
- k) instanceof BlockMolder)
+ else if (blockMeta == 1 && world.getBlock(i + 1, j, k) instanceof BlockMolder)
return true;
- else if (blockMeta == 2 && world.getBlock(i, j,
- k + 1) instanceof BlockMolder)
+ else if (blockMeta == 2 && world.getBlock(i, j, k + 1) instanceof BlockMolder)
return true;
- else if (blockMeta == 3 && world.getBlock(i - 1, j,
- k) instanceof BlockMolder)
+ else if (blockMeta == 3 && world.getBlock(i - 1, j, k) instanceof BlockMolder)
return true;
return false;
}
@Override
- public void onBlockPlacedBy(World world, int i, int j, int k,
- EntityLivingBase entityLiving,
+ public void onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase entityLiving,
ItemStack par6ItemStack) {
- int rotation = MathHelper
- .floor_double(entityLiving.rotationYaw
- * 4.0F / 360.0F + 0.5D)
- & 3;
+ int rotation = MathHelper.floor_double(entityLiving.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
world.setBlockMetadataWithNotify(i, j, k, rotation, 2);
}
@Override
- public boolean shouldSideBeRendered(IBlockAccess iblockaccess,
- int i, int j, int k, int l) {
+ public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l) {
return false;
}
diff --git a/src/main/java/darkknight/jewelrycraft/block/render/BlockCrystalRenderer.java b/src/main/java/darkknight/jewelrycraft/block/render/BlockCrystalRenderer.java index f8344b6..e3bba43 100755 --- a/src/main/java/darkknight/jewelrycraft/block/render/BlockCrystalRenderer.java +++ b/src/main/java/darkknight/jewelrycraft/block/render/BlockCrystalRenderer.java @@ -26,19 +26,15 @@ import net.minecraft.world.IBlockAccess; @SideOnly(Side.CLIENT)
public class BlockCrystalRenderer implements ISimpleBlockRenderingHandler {
@Override
- public void renderInventoryBlock(Block block, int metadata,
- int modelID, RenderBlocks renderer) {
+ public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
Tessellator tessellator = Tessellator.instance;
GL11.glPushMatrix();
GL11.glDisable(GL11.GL_LIGHTING);
tessellator.startDrawingQuads();
if (metadata < 16)
- tessellator.setColorRGBA_I(
- BlockCrystal.colors[metadata],
- 100);
+ tessellator.setColorRGBA_I(BlockCrystal.colors[metadata], 100);
GL11.glTranslatef(-0.5f, -0.5f, -0.5f);
- this.renderWorldBlock(null, 0, 0, 0, block, modelID,
- renderer);
+ this.renderWorldBlock(null, 0, 0, 0, block, modelID, renderer);
tessellator.draw();
GL11.glTranslatef(0.5f, 0.5f, 0.5f);
GL11.glEnable(GL11.GL_LIGHTING);
@@ -46,8 +42,7 @@ public class BlockCrystalRenderer implements ISimpleBlockRenderingHandler { }
@Override
- public boolean renderWorldBlock(IBlockAccess world, int x, int y,
- int z, Block block, int modelId,
+ public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId,
RenderBlocks renderer) {
int crystals = 5;
Random rnd = new Random();
@@ -58,13 +53,8 @@ public class BlockCrystalRenderer implements ISimpleBlockRenderingHandler { double umax = icon.getMaxU();
double vmax = icon.getMaxV();
tessellator.addTranslation(x, y, z);
- if (world != null && world.getTileEntity(x, y, z) != null
- && ConfigHandler.CRYSTAL_GLOW)
- tessellator.setBrightness(
- ((TileEntityCrystal) world
- .getTileEntity(x,
- y,
- z)).shine);
+ if (world != null && world.getTileEntity(x, y, z) != null && ConfigHandler.CRYSTAL_GLOW)
+ tessellator.setBrightness(((TileEntityCrystal) world.getTileEntity(x, y, z)).shine);
else
tessellator.setBrightness(230);
// 37435, 76464
@@ -73,164 +63,88 @@ public class BlockCrystalRenderer implements ISimpleBlockRenderingHandler { else
rnd.setSeed(76464);
if (world != null && world.getBlockMetadata(x, y, z) < 16)
- tessellator.setColorRGBA_I(
- BlockCrystal.colors[world
- .getBlockMetadata(
- x,
- y,
- z)],
- 100);
- crystal(tessellator, umin, vmin, umax, vmax, 0.8D, 0.2D,
- 0D, 0D, 0D, 0.0D, 0.0D);
+ tessellator.setColorRGBA_I(BlockCrystal.colors[world.getBlockMetadata(x, y, z)], 100);
+ crystal(tessellator, umin, vmin, umax, vmax, 0.8D, 0.2D, 0D, 0D, 0D, 0.0D, 0.0D);
for (int i = 0; i < crystals; i++) {
double rotation = Math.PI * 2.0f / crystals * i;
- double xp1 = Math.sin(rotation)
- * ((0.15F + rnd.nextFloat()) / 2f);
- double zp1 = Math.cos(rotation)
- * ((0.15F + rnd.nextFloat()) / 2f);
+ double xp1 = Math.sin(rotation) * ((0.15F + rnd.nextFloat()) / 2f);
+ double zp1 = Math.cos(rotation) * ((0.15F + rnd.nextFloat()) / 2f);
double height = 0.2f + rnd.nextFloat();
double topHeight = 0.1f + rnd.nextFloat() / 2f;
- crystal(tessellator, umin, vmin, umax, vmax,
- height, topHeight, -xp1, 0D, zp1,
- xp1, zp1);
+ crystal(tessellator, umin, vmin, umax, vmax, height, topHeight, -xp1, 0D, zp1, xp1, zp1);
}
if (world != null) {
crystals = 4;
for (int i = 0; i < crystals; i++) {
- double rotation = Math.PI * 2F / crystals
- * i;
- double xp1 = Math.sin(rotation) * ((0.15F
- + rnd.nextFloat()) / 2f);
- double zp1 = Math.cos(rotation) * ((0.15F
- + rnd.nextFloat()) / 2f);
+ double rotation = Math.PI * 2F / crystals * i;
+ double xp1 = Math.sin(rotation) * ((0.15F + rnd.nextFloat()) / 2f);
+ double zp1 = Math.cos(rotation) * ((0.15F + rnd.nextFloat()) / 2f);
double height = 0.1f + rnd.nextFloat();
- double topHeight = 0.1f
- + rnd.nextFloat() / 2f;
- float xOff = (rnd.nextFloat() * 1.5f
- - 0.5f)
- * (rnd.nextFloat() / 2f);
- float zOff = (rnd.nextFloat() * 1.5f
- - 0.5f)
- * (rnd.nextFloat() / 2f);
- crystal(tessellator, umin, vmin, umax,
- vmax, height, topHeight,
- xOff, 0D, zOff, xp1, zp1);
+ double topHeight = 0.1f + rnd.nextFloat() / 2f;
+ float xOff = (rnd.nextFloat() * 1.5f - 0.5f) * (rnd.nextFloat() / 2f);
+ float zOff = (rnd.nextFloat() * 1.5f - 0.5f) * (rnd.nextFloat() / 2f);
+ crystal(tessellator, umin, vmin, umax, vmax, height, topHeight, xOff, 0D, zOff, xp1, zp1);
}
}
tessellator.addTranslation(-x, -y, -z);
return true;
}
- private static void crystal(Tessellator tessellator, double umin,
- double vmin, double umax, double vmax,
- double height, double topHeight, double posX,
- double posY, double posZ, double rotX,
- double rotZ) {
+ private static void crystal(Tessellator tessellator, double umin, double vmin, double umax, double vmax,
+ double height, double topHeight, double posX, double posY, double posZ, double rotX, double rotZ) {
// Negative X
- tessellator.addVertexWithUV(0.4 + rotX + posX, 0.0 + posY,
- 0.6 - rotZ + posZ, umin, vmin);
- tessellator.addVertexWithUV(0.4 - rotX + posX,
- height + posY, 0.6 + rotZ + posZ, umin,
- vmax);
- tessellator.addVertexWithUV(0.4 - rotX + posX,
- height + posY, 0.4 + rotZ + posZ, umax,
- vmax);
- tessellator.addVertexWithUV(0.4 + rotX + posX, 0.0 + posY,
- 0.4 - rotZ + posZ, umax, vmin);
+ tessellator.addVertexWithUV(0.4 + rotX + posX, 0.0 + posY, 0.6 - rotZ + posZ, umin, vmin);
+ tessellator.addVertexWithUV(0.4 - rotX + posX, height + posY, 0.6 + rotZ + posZ, umin, vmax);
+ tessellator.addVertexWithUV(0.4 - rotX + posX, height + posY, 0.4 + rotZ + posZ, umax, vmax);
+ tessellator.addVertexWithUV(0.4 + rotX + posX, 0.0 + posY, 0.4 - rotZ + posZ, umax, vmin);
// Positive X
- tessellator.addVertexWithUV(0.6 + rotX + posX, 0.0 + posY,
- 0.4 - rotZ + posZ, umin, vmin);
- tessellator.addVertexWithUV(0.6 - rotX + posX,
- height + posY, 0.4 + rotZ + posZ, umin,
- vmax);
- tessellator.addVertexWithUV(0.6 - rotX + posX,
- height + posY, 0.6 + rotZ + posZ, umax,
- vmax);
- tessellator.addVertexWithUV(0.6 + rotX + posX, 0.0 + posY,
- 0.6 - rotZ + posZ, umax, vmin);
+ tessellator.addVertexWithUV(0.6 + rotX + posX, 0.0 + posY, 0.4 - rotZ + posZ, umin, vmin);
+ tessellator.addVertexWithUV(0.6 - rotX + posX, height + posY, 0.4 + rotZ + posZ, umin, vmax);
+ tessellator.addVertexWithUV(0.6 - rotX + posX, height + posY, 0.6 + rotZ + posZ, umax, vmax);
+ tessellator.addVertexWithUV(0.6 + rotX + posX, 0.0 + posY, 0.6 - rotZ + posZ, umax, vmin);
// Negative Z
- tessellator.addVertexWithUV(0.4 + rotX + posX, 0.0 + posY,
- 0.4 - rotZ + posZ, umin, vmin);
- tessellator.addVertexWithUV(0.4 - rotX + posX,
- height + posY, 0.4 + rotZ + posZ, umin,
- vmax);
- tessellator.addVertexWithUV(0.6 - rotX + posX,
- height + posY, 0.4 + rotZ + posZ, umax,
- vmax);
- tessellator.addVertexWithUV(0.6 + rotX + posX, 0.0 + posY,
- 0.4 - rotZ + posZ, umax, vmin);
+ tessellator.addVertexWithUV(0.4 + rotX + posX, 0.0 + posY, 0.4 - rotZ + posZ, umin, vmin);
+ tessellator.addVertexWithUV(0.4 - rotX + posX, height + posY, 0.4 + rotZ + posZ, umin, vmax);
+ tessellator.addVertexWithUV(0.6 - rotX + posX, height + posY, 0.4 + rotZ + posZ, umax, vmax);
+ tessellator.addVertexWithUV(0.6 + rotX + posX, 0.0 + posY, 0.4 - rotZ + posZ, umax, vmin);
// Positive Z
- tessellator.addVertexWithUV(0.6 + rotX + posX, 0.0 + posY,
- 0.6 - rotZ + posZ, umin, vmin);
- tessellator.addVertexWithUV(0.6 - rotX + posX,
- height + posY, 0.6 + rotZ + posZ, umin,
+ tessellator.addVertexWithUV(0.6 + rotX + posX, 0.0 + posY, 0.6 - rotZ + posZ, umin, vmin);
+ tessellator.addVertexWithUV(0.6 - rotX + posX, height + posY, 0.6 + rotZ + posZ, umin, vmax);
+ tessellator.addVertexWithUV(0.4 - rotX + posX, height + posY, 0.6 + rotZ + posZ, umax, vmax);
+ tessellator.addVertexWithUV(0.4 + rotX + posX, 0.0 + posY, 0.6 - rotZ + posZ, umax, vmin);
+ // Top -X
+ tessellator.addVertexWithUV(0.4 - rotX + posX, height + posY, 0.6 + rotZ + posZ, umin, vmin);
+ tessellator.addVertexWithUV(0.5 - rotX - rotX + posX, height + topHeight + posY, 0.5 + rotZ + rotZ + posZ, umin,
vmax);
- tessellator.addVertexWithUV(0.4 - rotX + posX,
- height + posY, 0.6 + rotZ + posZ, umax,
+ tessellator.addVertexWithUV(0.5 - rotX - rotX + posX, height + topHeight + posY, 0.5 + rotZ + rotZ + posZ, umax,
vmax);
- tessellator.addVertexWithUV(0.4 + rotX + posX, 0.0 + posY,
- 0.6 - rotZ + posZ, umax, vmin);
- // Top -X
- tessellator.addVertexWithUV(0.4 - rotX + posX,
- height + posY, 0.6 + rotZ + posZ, umin,
- vmin);
- tessellator.addVertexWithUV(0.5 - rotX - rotX + posX,
- height + topHeight + posY,
- 0.5 + rotZ + rotZ + posZ, umin, vmax);
- tessellator.addVertexWithUV(0.5 - rotX - rotX + posX,
- height + topHeight + posY,
- 0.5 + rotZ + rotZ + posZ, umax, vmax);
- tessellator.addVertexWithUV(0.4 - rotX + posX,
- height + posY, 0.4 + rotZ + posZ, umax,
- vmin);
+ tessellator.addVertexWithUV(0.4 - rotX + posX, height + posY, 0.4 + rotZ + posZ, umax, vmin);
// Top +X
- tessellator.addVertexWithUV(0.6 - rotX + posX,
- height + posY, 0.4 + rotZ + posZ, umin,
- vmin);
- tessellator.addVertexWithUV(0.5 - rotX - rotX + posX,
- height + topHeight + posY,
- 0.5 + rotZ + rotZ + posZ, umin, vmax);
- tessellator.addVertexWithUV(0.5 - rotX - rotX + posX,
- height + topHeight + posY,
- 0.5 + rotZ + rotZ + posZ, umax, vmax);
- tessellator.addVertexWithUV(0.6 - rotX + posX,
- height + posY, 0.6 + rotZ + posZ, umax,
- vmin);
+ tessellator.addVertexWithUV(0.6 - rotX + posX, height + posY, 0.4 + rotZ + posZ, umin, vmin);
+ tessellator.addVertexWithUV(0.5 - rotX - rotX + posX, height + topHeight + posY, 0.5 + rotZ + rotZ + posZ, umin,
+ vmax);
+ tessellator.addVertexWithUV(0.5 - rotX - rotX + posX, height + topHeight + posY, 0.5 + rotZ + rotZ + posZ, umax,
+ vmax);
+ tessellator.addVertexWithUV(0.6 - rotX + posX, height + posY, 0.6 + rotZ + posZ, umax, vmin);
// Top +Z
- tessellator.addVertexWithUV(0.6 - rotX + posX,
- height + posY, 0.6 + rotZ + posZ, umin,
- vmin);
- tessellator.addVertexWithUV(0.5 - rotX - rotX + posX,
- height + topHeight + posY,
- 0.5 + rotZ + rotZ + posZ, umin, vmax);
- tessellator.addVertexWithUV(0.5 - rotX - rotX + posX,
- height + topHeight + posY,
- 0.5 + rotZ + rotZ + posZ, umax, vmax);
- tessellator.addVertexWithUV(0.4 - rotX + posX,
- height + posY, 0.6 + rotZ + posZ, umax,
- vmin);
+ tessellator.addVertexWithUV(0.6 - rotX + posX, height + posY, 0.6 + rotZ + posZ, umin, vmin);
+ tessellator.addVertexWithUV(0.5 - rotX - rotX + posX, height + topHeight + posY, 0.5 + rotZ + rotZ + posZ, umin,
+ vmax);
+ tessellator.addVertexWithUV(0.5 - rotX - rotX + posX, height + topHeight + posY, 0.5 + rotZ + rotZ + posZ, umax,
+ vmax);
+ tessellator.addVertexWithUV(0.4 - rotX + posX, height + posY, 0.6 + rotZ + posZ, umax, vmin);
// Top -Z
- tessellator.addVertexWithUV(0.4 - rotX + posX,
- height + posY, 0.4 + rotZ + posZ, umin,
- vmin);
- tessellator.addVertexWithUV(0.5 - rotX - rotX + posX,
- height + topHeight + posY,
- 0.5 + rotZ + rotZ + posZ, umin, vmax);
- tessellator.addVertexWithUV(0.5 - rotX - rotX + posX,
- height + topHeight + posY,
- 0.5 + rotZ + rotZ + posZ, umax, vmax);
- tessellator.addVertexWithUV(0.6 - rotX + posX,
- height + posY, 0.4 + rotZ + posZ, umax,
- vmin);
+ tessellator.addVertexWithUV(0.4 - rotX + posX, height + posY, 0.4 + rotZ + posZ, umin, vmin);
+ tessellator.addVertexWithUV(0.5 - rotX - rotX + posX, height + topHeight + posY, 0.5 + rotZ + rotZ + posZ, umin,
+ vmax);
+ tessellator.addVertexWithUV(0.5 - rotX - rotX + posX, height + topHeight + posY, 0.5 + rotZ + rotZ + posZ, umax,
+ vmax);
+ tessellator.addVertexWithUV(0.6 - rotX + posX, height + posY, 0.4 + rotZ + posZ, umax, vmin);
// Bottom
- tessellator.addVertexWithUV(0.4 + rotX + posX, 0.0 + posY,
- 0.6 - rotZ + posZ, umin, vmin);
- tessellator.addVertexWithUV(0.4 + rotX + posX, 0.0 + posY,
- 0.4 - rotZ + posZ, umin, vmax);
- tessellator.addVertexWithUV(0.6 + rotX + posX, 0.0 + posY,
- 0.4 - rotZ + posZ, umax, vmax);
- tessellator.addVertexWithUV(0.6 + rotX + posX, 0.0 + posY,
- 0.6 - rotZ + posZ, umax, vmin);
+ tessellator.addVertexWithUV(0.4 + rotX + posX, 0.0 + posY, 0.6 - rotZ + posZ, umin, vmin);
+ tessellator.addVertexWithUV(0.4 + rotX + posX, 0.0 + posY, 0.4 - rotZ + posZ, umin, vmax);
+ tessellator.addVertexWithUV(0.6 + rotX + posX, 0.0 + posY, 0.4 - rotZ + posZ, umax, vmax);
+ tessellator.addVertexWithUV(0.6 + rotX + posX, 0.0 + posY, 0.6 - rotZ + posZ, umax, vmin);
}
@Override
diff --git a/src/main/java/darkknight/jewelrycraft/client/AbstractTab.java b/src/main/java/darkknight/jewelrycraft/client/AbstractTab.java index 0db57c7..5070e7c 100755 --- a/src/main/java/darkknight/jewelrycraft/client/AbstractTab.java +++ b/src/main/java/darkknight/jewelrycraft/client/AbstractTab.java @@ -18,13 +18,11 @@ import net.minecraft.util.ResourceLocation; */
@SideOnly(Side.CLIENT)
public abstract class AbstractTab extends GuiButton {
- ResourceLocation texture = new ResourceLocation(
- Variables.MODID, "textures/gui/hearts.png");
- ItemStack renderStack;
- RenderItem itemRenderer = new RenderItem();
+ ResourceLocation texture = new ResourceLocation(Variables.MODID, "textures/gui/hearts.png");
+ ItemStack renderStack;
+ RenderItem itemRenderer = new RenderItem();
- public AbstractTab(int id, int posX, int posY,
- ItemStack renderStack) {
+ public AbstractTab(int id, int posX, int posY, ItemStack renderStack) {
super(id, posX, posY, 18, 18, "");
this.renderStack = renderStack;
}
@@ -36,9 +34,7 @@ public abstract class AbstractTab extends GuiButton { int xOffset = this.enabled ? 0 : 8;
mc.renderEngine.bindTexture(this.texture);
- this.drawTexturedModalRect(this.xPosition,
- yPosition, 144 + xOffset, 32, 18,
- 18);
+ this.drawTexturedModalRect(this.xPosition, yPosition, 144 + xOffset, 32, 18, 18);
GL11.glPushMatrix();
RenderHelper.enableGUIStandardItemLighting();
@@ -46,13 +42,9 @@ public abstract class AbstractTab extends GuiButton { this.itemRenderer.zLevel = 100.0F;
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
- this.itemRenderer.renderItemAndEffectIntoGUI(
- mc.fontRenderer, mc.renderEngine,
- renderStack, xPosition + 1,
+ this.itemRenderer.renderItemAndEffectIntoGUI(mc.fontRenderer, mc.renderEngine, renderStack, xPosition + 1,
yPosition + 1);
- this.itemRenderer.renderItemOverlayIntoGUI(
- mc.fontRenderer, mc.renderEngine,
- renderStack, xPosition + 1,
+ this.itemRenderer.renderItemOverlayIntoGUI(mc.fontRenderer, mc.renderEngine, renderStack, xPosition + 1,
yPosition + 1);
GL11.glDisable(GL11.GL_LIGHTING);
this.itemRenderer.zLevel = 0.0F;
@@ -64,11 +56,8 @@ public abstract class AbstractTab extends GuiButton { @Override
public boolean mousePressed(Minecraft mc, int mouseX, int mouseY) {
- boolean inWindow = this.enabled && this.visible
- && mouseX >= this.xPosition
- && mouseY >= this.yPosition
- && mouseX < this.xPosition + this.width
- && mouseY < this.yPosition + this.height;
+ boolean inWindow = this.enabled && this.visible && mouseX >= this.xPosition && mouseY >= this.yPosition
+ && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height;
if (inWindow)
this.onTabClicked();
return inWindow;
diff --git a/src/main/java/darkknight/jewelrycraft/client/JewelryInventory.java b/src/main/java/darkknight/jewelrycraft/client/JewelryInventory.java index 6571634..da28504 100755 --- a/src/main/java/darkknight/jewelrycraft/client/JewelryInventory.java +++ b/src/main/java/darkknight/jewelrycraft/client/JewelryInventory.java @@ -12,19 +12,17 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound;
public class JewelryInventory implements IInventory {
- public EntityPlayer player;
- public ItemStack[] inventory = new ItemStack[18];
+ public EntityPlayer player;
+ public ItemStack[] inventory = new ItemStack[18];
/**
* @param player
*/
public JewelryInventory(EntityPlayer player) {
this.player = player;
- NBTTagCompound nbt = PlayerUtils.getModPlayerPersistTag(
- player, Variables.MODID);
+ NBTTagCompound nbt = PlayerUtils.getModPlayerPersistTag(player, Variables.MODID);
for (int i = 0; i < 18; i++)
- inventory[i] = ItemStack.loadItemStackFromNBT(
- nbt.getCompoundTag("ext" + i));
+ inventory[i] = ItemStack.loadItemStackFromNBT(nbt.getCompoundTag("ext" + i));
}
/**
@@ -79,8 +77,7 @@ public class JewelryInventory implements IInventory { @Override
public void setInventorySlotContents(int slot, ItemStack stack) {
inventory[slot] = stack;
- if (stack != null
- && stack.stackSize > getInventoryStackLimit())
+ if (stack != null && stack.stackSize > getInventoryStackLimit())
stack.stackSize = getInventoryStackLimit();
markDirty();
}
@@ -114,13 +111,10 @@ public class JewelryInventory implements IInventory { */
@Override
public void markDirty() {
- NBTTagCompound nbt = PlayerUtils.getModPlayerPersistTag(
- player, Variables.MODID);
+ NBTTagCompound nbt = PlayerUtils.getModPlayerPersistTag(player, Variables.MODID);
for (int i = 0; i < 18; i++)
if (inventory[i] != null)
- nbt.setTag("ext" + i, inventory[i]
- .writeToNBT(nbt.getCompoundTag(
- "ext" + i)));
+ nbt.setTag("ext" + i, inventory[i].writeToNBT(nbt.getCompoundTag("ext" + i)));
else
nbt.removeTag("ext" + i);
}
@@ -157,17 +151,13 @@ public class JewelryInventory implements IInventory { */
@Override
public boolean isItemValidForSlot(int slot, ItemStack stack) {
- if (slot >= 0 && slot <= 9
- && stack.getItem() instanceof ItemRing)
+ if (slot >= 0 && slot <= 9 && stack.getItem() instanceof ItemRing)
return true;
- else if (slot >= 10 && slot <= 13
- && stack.getItem() instanceof ItemBracelet)
+ else if (slot >= 10 && slot <= 13 && stack.getItem() instanceof ItemBracelet)
return true;
- else if (slot >= 14 && slot <= 16
- && stack.getItem() instanceof ItemNecklace)
+ else if (slot >= 14 && slot <= 16 && stack.getItem() instanceof ItemNecklace)
return true;
- else if (slot == 17
- && stack.getItem() instanceof ItemEarrings)
+ else if (slot == 17 && stack.getItem() instanceof ItemEarrings)
return true;
return false;
}
diff --git a/src/main/java/darkknight/jewelrycraft/client/Page.java b/src/main/java/darkknight/jewelrycraft/client/Page.java index 4d67c81..b23345a 100755 --- a/src/main/java/darkknight/jewelrycraft/client/Page.java +++ b/src/main/java/darkknight/jewelrycraft/client/Page.java @@ -13,81 +13,44 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation;
public class Page {
- static ResourceLocation pageFlipped = new ResourceLocation(
- Variables.MODID, "textures/gui/guidePageFlip.png");
+ static ResourceLocation pageFlipped = new ResourceLocation(Variables.MODID, "textures/gui/guidePageFlip.png");
- public static void addCraftingRecipeTextPage(GuiGuide gui, int x,
- int y, boolean isSmall, String text, int mouseX,
+ public static void addCraftingRecipeTextPage(GuiGuide gui, int x, int y, boolean isSmall, String text, int mouseX,
int mouseY, boolean rotate, ItemStack... items) {
y += 5;
GL11.glEnable(GL11.GL_BLEND);
- GL11.glBlendFunc(GL11.GL_SRC_ALPHA,
- GL11.GL_ONE_MINUS_SRC_ALPHA);
- gui.getFont().drawString(EnumChatFormatting.DARK_BLUE
- + "\u00a7n" + items[0].getDisplayName(),
- x + Math.abs(70 - gui.getFont()
- .getStringWidth(items[0]
- .getDisplayName())
- / 2) - 10,
- y - 2, 0);
+ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
+ gui.getFont().drawString(EnumChatFormatting.DARK_BLUE + "\u00a7n" + items[0].getDisplayName(),
+ x + Math.abs(70 - gui.getFont().getStringWidth(items[0].getDisplayName()) / 2) - 10, y - 2, 0);
GL11.glColor4f(1, 1, 1, 1);
- Minecraft.getMinecraft().getTextureManager()
- .bindTexture(pageFlipped);
+ Minecraft.getMinecraft().getTextureManager().bindTexture(pageFlipped);
ArrayList<String> name = new ArrayList<>();
if (isSmall) {
- gui.drawTexturedModalRect(x, y + 10, 145, 54, 111,
- 46);
- gui.renderItem(items[0], x + 89, y + 22 + 10, 30f,
- rotate, 0, 0, 0);
+ gui.drawTexturedModalRect(x, y + 10, 145, 54, 111, 46);
+ gui.renderItem(items[0], x + 89, y + 22 + 10, 30f, rotate, 0, 0, 0);
for (int i = 1; i <= 4; i++)
if (items.length > i && items[i] != null) {
- int posX = x + 8 + (i - 1) % 2
- * 22;
- int posY = y + 26
- + (i - 1) / 2 * 22;
- gui.renderItem(items[i], posX,
- posY, 30f, rotate,
- 0, 0, 0);
- name.add(items[i]
- .getDisplayName());
- if (mouseX >= posX - 8
- && mouseX <= posX
- + 8
- && mouseY >= posY
- - 16
- && mouseY <= posY)
- gui.drawHoverString(name,
- posX - 20,
- posY - 14);
+ int posX = x + 8 + (i - 1) % 2 * 22;
+ int posY = y + 26 + (i - 1) / 2 * 22;
+ gui.renderItem(items[i], posX, posY, 30f, rotate, 0, 0, 0);
+ name.add(items[i].getDisplayName());
+ if (mouseX >= posX - 8 && mouseX <= posX + 8 && mouseY >= posY - 16 && mouseY <= posY)
+ gui.drawHoverString(name, posX - 20, posY - 14);
name.removeAll(name);
GL11.glDisable(GL11.GL_LIGHTING);
}
drawText(gui, text, x, y + 25);
} else {
- gui.drawTexturedModalRect(x, y + 12, 145, 0, 111,
- 54);
- gui.renderItem(items[0], x + 91, y + 28 + 10, 30f,
- rotate, 0, 0, 0);
+ gui.drawTexturedModalRect(x, y + 12, 145, 0, 111, 54);
+ gui.renderItem(items[0], x + 91, y + 28 + 10, 30f, rotate, 0, 0, 0);
for (int i = 1; i <= 9; i++)
if (items.length > i && items[i] != null) {
- int posX = x + 8 + (i - 1) % 3
- * 19;
- int posY = y + 22
- + (i - 1) / 3 * 17;
- gui.renderItem(items[i], posX,
- posY, 30f, rotate,
- 0, 0, 0);
- name.add(items[i]
- .getDisplayName());
- if (mouseX >= posX - 8
- && mouseX <= posX
- + 8
- && mouseY >= posY
- - 10
- && mouseY <= posY)
- gui.drawHoverString(name,
- posX - 20,
- posY - 12);
+ int posX = x + 8 + (i - 1) % 3 * 19;
+ int posY = y + 22 + (i - 1) / 3 * 17;
+ gui.renderItem(items[i], posX, posY, 30f, rotate, 0, 0, 0);
+ name.add(items[i].getDisplayName());
+ if (mouseX >= posX - 8 && mouseX <= posX + 8 && mouseY >= posY - 10 && mouseY <= posY)
+ gui.drawHoverString(name, posX - 20, posY - 12);
name.removeAll(name);
GL11.glDisable(GL11.GL_LIGHTING);
}
@@ -97,151 +60,103 @@ public class Page { GL11.glDisable(GL11.GL_BLEND);
}
- public static void addSmeltingRecipeTextPage(GuiGuide gui, int x,
- int y, String text, int mouseX, int mouseY,
+ public static void addSmeltingRecipeTextPage(GuiGuide gui, int x, int y, String text, int mouseX, int mouseY,
boolean rotate, ItemStack... items) {
ArrayList<String> name = new ArrayList<>();
- gui.getFont().drawString(EnumChatFormatting.DARK_BLUE
- + "\u00a7n" + items[1].getDisplayName(),
- x + 30 - items[0].getDisplayName().length()
- / 2,
- y + 2, 0);
+ gui.getFont().drawString(EnumChatFormatting.DARK_BLUE + "\u00a7n" + items[1].getDisplayName(),
+ x + 30 - items[0].getDisplayName().length() / 2, y + 2, 0);
GL11.glColor4f(1, 1, 1, 1);
- Minecraft.getMinecraft().getTextureManager()
- .bindTexture(pageFlipped);
+ Minecraft.getMinecraft().getTextureManager().bindTexture(pageFlipped);
GL11.glEnable(GL11.GL_BLEND);
- GL11.glBlendFunc(GL11.GL_SRC_ALPHA,
- GL11.GL_ONE_MINUS_SRC_ALPHA);
+ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
gui.drawTexturedModalRect(x, y + 10, 145, 100, 111, 52);
- gui.renderItem(items[0], x + 13, y + 20 + 10, 35f, rotate,
- 0, 0, 0);
+ gui.renderItem(items[0], x + 13, y + 20 + 10, 35f, rotate, 0, 0, 0);
name.add(items[0].getDisplayName());
- if (mouseX >= x && mouseX <= x + 20 && mouseY >= y + 20
- && mouseY <= y + 20 + 16)
+ if (mouseX >= x && mouseX <= x + 20 && mouseY >= y + 20 && mouseY <= y + 20 + 16)
gui.drawHoverString(name, x, y + 20);
name.removeAll(name);
GL11.glDisable(GL11.GL_LIGHTING);
- gui.renderItem(items[1], x + 77, y + 28 + 10, 35f, rotate,
- 0, 0, 0);
+ gui.renderItem(items[1], x + 77, y + 28 + 10, 35f, rotate, 0, 0, 0);
drawText(gui, text, x, y + 30);
GL11.glColor4f(1, 1, 1, 1);
GL11.glDisable(GL11.GL_BLEND);
}
- public static void addImageTextPage(GuiGuide gui, int x, int y,
- ItemStack item, String text, float size,
+ public static void addImageTextPage(GuiGuide gui, int x, int y, ItemStack item, String text, float size,
boolean rotate) {
y += 5;
GL11.glEnable(GL11.GL_BLEND);
- GL11.glBlendFunc(GL11.GL_SRC_ALPHA,
- GL11.GL_ONE_MINUS_SRC_ALPHA);
- gui.getFont().drawString(
- EnumChatFormatting.DARK_BLUE + "\u00a7n"
- + item.getDisplayName(),
- x + Math.abs(70 - gui.getFont()
- .getStringWidth(item
- .getDisplayName())
- / 2) - 10,
- y + (int) size / 5, 0);
+ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
+ gui.getFont().drawString(EnumChatFormatting.DARK_BLUE + "\u00a7n" + item.getDisplayName(),
+ x + Math.abs(70 - gui.getFont().getStringWidth(item.getDisplayName()) / 2) - 10, y + (int) size / 5, 0);
GL11.glColor4f(1, 1, 1, 1);
- gui.renderItem(item, x + 13, y + 18, size, rotate, 0, 0,
- 0);
+ gui.renderItem(item, x + 13, y + 18, size, rotate, 0, 0, 0);
drawText(gui, text, x - 2, y - (int) (250 / size));
GL11.glDisable(GL11.GL_BLEND);
}
- public static void addSlotItem(GuiGuide gui, int x, int y,
- int mouseX, int mouseY, ItemStack item, float xRot,
+ public static void addSlotItem(GuiGuide gui, int x, int y, int mouseX, int mouseY, ItemStack item, float xRot,
float yRot, float zRot) {
ArrayList<String> name = new ArrayList<>();
GL11.glColor4f(1, 1, 1, 1);
- Minecraft.getMinecraft().getTextureManager()
- .bindTexture(pageFlipped);
+ Minecraft.getMinecraft().getTextureManager().bindTexture(pageFlipped);
GL11.glEnable(GL11.GL_BLEND);
- GL11.glBlendFunc(GL11.GL_SRC_ALPHA,
- GL11.GL_ONE_MINUS_SRC_ALPHA);
+ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
gui.drawTexturedModalRect(x + 9, y + 19, 148, 153, 12, 12);
if (item.getItem() != null) {
name.add(item.getDisplayName());
- if (mouseX >= x + 10 && mouseX <= x + 20
- && mouseY >= y + 20
- && mouseY <= y + 30)
+ if (mouseX >= x + 10 && mouseX <= x + 20 && mouseY >= y + 20 && mouseY <= y + 30)
gui.drawHoverString(name, x, y + 10);
name.removeAll(name);
}
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glColor4f(1, 1, 1, 1);
if (item.getItem() != null)
- gui.renderItem(item, x + 15, y + 25, 40f, false,
- xRot, yRot, zRot);
+ gui.renderItem(item, x + 15, y + 25, 40f, false, xRot, yRot, zRot);
GL11.glDisable(GL11.GL_BLEND);
}
- public static void addImageTextPage(GuiGuide gui, int x, int y,
- ItemStack item, String text, float size, int txtX,
- int txtY, boolean showName, int imgX, int imgY,
- boolean rotate) {
+ public static void addImageTextPage(GuiGuide gui, int x, int y, ItemStack item, String text, float size, int txtX,
+ int txtY, boolean showName, int imgX, int imgY, boolean rotate) {
y += 5;
GL11.glEnable(GL11.GL_BLEND);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
- GL11.glBlendFunc(GL11.GL_SRC_ALPHA,
- GL11.GL_ONE_MINUS_SRC_ALPHA);
+ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
if (showName)
gui.getFont().drawString(
- EnumChatFormatting.DARK_BLUE
- + "\u00a7n"
- + item.getDisplayName()
- .substring(0, item
- .getDisplayName()
- .length() > 23 ? 23
- : item.getDisplayName()
- .length()),
- x + Math.abs(70 - gui.getFont()
- .getStringWidth(item
- .getDisplayName())
- / 2) - 10,
- y + 2, 0);
+ EnumChatFormatting.DARK_BLUE + "\u00a7n"
+ + item.getDisplayName().substring(0,
+ item.getDisplayName().length() > 23 ? 23 : item.getDisplayName().length()),
+ x + Math.abs(70 - gui.getFont().getStringWidth(item.getDisplayName()) / 2) - 10, y + 2, 0);
GL11.glColor4f(1, 1, 1, 1);
- gui.renderItem(item, x + 13 + imgX, y + 18 + imgY, size,
- rotate, 0, 0, 0);
+ gui.renderItem(item, x + 13 + imgX, y + 18 + imgY, size, rotate, 0, 0, 0);
drawText(gui, text, x + txtX, y + txtY);
GL11.glDisable(GL11.GL_BLEND);
}
- public static void addImageTextPage(GuiGuide gui, int x, int y,
- ItemStack item, String text, float size, int txtX,
- int txtY, String title, int imgX, int imgY,
- boolean rotate) {
+ public static void addImageTextPage(GuiGuide gui, int x, int y, ItemStack item, String text, float size, int txtX,
+ int txtY, String title, int imgX, int imgY, boolean rotate) {
y += 5;
GL11.glEnable(GL11.GL_BLEND);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
- GL11.glBlendFunc(GL11.GL_SRC_ALPHA,
- GL11.GL_ONE_MINUS_SRC_ALPHA);
- gui.getFont().drawString(EnumChatFormatting.DARK_BLUE
- + "\u00a7n"
- + title.substring(0, item.getDisplayName()
- .length() > 23 ? 23
- : title.length()),
- x + Math.abs(70 - gui.getFont()
- .getStringWidth(title) / 2)
- - 10,
- y + 2, 0);
+ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
+ gui.getFont().drawString(
+ EnumChatFormatting.DARK_BLUE + "\u00a7n"
+ + title.substring(0, item.getDisplayName().length() > 23 ? 23 : title.length()),
+ x + Math.abs(70 - gui.getFont().getStringWidth(title) / 2) - 10, y + 2, 0);
GL11.glColor4f(1, 1, 1, 1);
- gui.renderItem(item, x + 13 + imgX, y + 18 + imgY, size,
- rotate, 0, 0, 0);
+ gui.renderItem(item, x + 13 + imgX, y + 18 + imgY, size, rotate, 0, 0, 0);
drawText(gui, text, x + txtX, y + txtY);
GL11.glDisable(GL11.GL_BLEND);
}
- public static void addTextPage(GuiGuide gui, int x, int y,
- String text) {
+ public static void addTextPage(GuiGuide gui, int x, int y, String text) {
y -= 25;
drawText(gui, text, x, y);
GL11.glColor4f(1, 1, 1, 1);
}
- public static void drawText(GuiGuide gui, String text, int x,
- int y) {
+ public static void drawText(GuiGuide gui, String text, int x, int y) {
String[] s = text.split(" ");
String displayText = "";
float scale = 0.75F;
@@ -257,10 +172,7 @@ public class Page { for (int i = 0; i < textLines.size(); i++) {
GL11.glPushMatrix();
GL11.glScalef(scale, scale, 0f);
- gui.getFont().drawString(textLines.get(i),
- (int) (x / scale),
- (int) ((y + 32 + i * 9) / scale),
- 0);
+ gui.getFont().drawString(textLines.get(i), (int) (x / scale), (int) ((y + 32 + i * 9) / scale), 0);
GL11.glPopMatrix();
}
}
diff --git a/src/main/java/darkknight/jewelrycraft/client/TabCurses.java b/src/main/java/darkknight/jewelrycraft/client/TabCurses.java index 09ccb36..ca5a84a 100755 --- a/src/main/java/darkknight/jewelrycraft/client/TabCurses.java +++ b/src/main/java/darkknight/jewelrycraft/client/TabCurses.java @@ -12,8 +12,7 @@ public class TabCurses extends AbstractTab { @Override
public void onTabClicked() {
- JewelrycraftMod.netWrapper
- .sendToServer(new PacketKeyPressEvent(1));
+ JewelrycraftMod.netWrapper.sendToServer(new PacketKeyPressEvent(1));
}
@Override
diff --git a/src/main/java/darkknight/jewelrycraft/client/TabJewelry.java b/src/main/java/darkknight/jewelrycraft/client/TabJewelry.java index 44d2118..eb555eb 100755 --- a/src/main/java/darkknight/jewelrycraft/client/TabJewelry.java +++ b/src/main/java/darkknight/jewelrycraft/client/TabJewelry.java @@ -12,8 +12,7 @@ public class TabJewelry extends AbstractTab { @Override
public void onTabClicked() {
- JewelrycraftMod.netWrapper
- .sendToServer(new PacketKeyPressEvent(0));
+ JewelrycraftMod.netWrapper.sendToServer(new PacketKeyPressEvent(0));
}
@Override
diff --git a/src/main/java/darkknight/jewelrycraft/client/TabRegistry.java b/src/main/java/darkknight/jewelrycraft/client/TabRegistry.java index 9b30274..2179816 100755 --- a/src/main/java/darkknight/jewelrycraft/client/TabRegistry.java +++ b/src/main/java/darkknight/jewelrycraft/client/TabRegistry.java @@ -36,71 +36,52 @@ public class TabRegistry { int ySize = 166;
int guiLeft = (event.gui.width - xSize) / 2;
int guiTop = (event.gui.height - ySize) / 2;
- if (!mc.thePlayer.getActivePotionEffects()
- .isEmpty())
+ if (!mc.thePlayer.getActivePotionEffects().isEmpty())
if (Loader.isModLoaded("NotEnoughItems")) {
try {
// Check whether NEI is
// hidden and enabled
- Class<?> c = Class.forName(
- "codechicken.nei.NEIClientConfig");
- Object hidden = c
- .getMethod("isHidden")
- .invoke(null);
- Object enabled = c
- .getMethod("isEnabled")
- .invoke(null);
- if (hidden != null
- && hidden instanceof Boolean
- && enabled != null
+ Class<?> c = Class.forName("codechicken.nei.NEIClientConfig");
+ Object hidden = c.getMethod("isHidden").invoke(null);
+ Object enabled = c.getMethod("isEnabled").invoke(null);
+ if (hidden != null && hidden instanceof Boolean && enabled != null
&& enabled instanceof Boolean)
- if ((Boolean) hidden
- || !((Boolean) enabled))
+ if ((Boolean) hidden || !((Boolean) enabled))
guiLeft += 60;
} catch (Exception e) {
// Do nothing
}
} else
guiLeft += 60;
- updateTabValues(guiLeft, guiTop,
- InventoryTabVanilla.class);
+ updateTabValues(guiLeft, guiTop, InventoryTabVanilla.class);
addTabsToList(event.buttonList);
}
}
- private static Minecraft mc = FMLClientHandler.instance()
- .getClient();
+ private static Minecraft mc = FMLClientHandler.instance().getClient();
public static void openInventoryGui() {
- mc.thePlayer.sendQueue
- .addToSendQueue(new C0DPacketCloseWindow(
- mc.thePlayer.openContainer.windowId));
+ mc.thePlayer.sendQueue.addToSendQueue(new C0DPacketCloseWindow(mc.thePlayer.openContainer.windowId));
GuiInventory inventory = new GuiInventory(mc.thePlayer);
mc.displayGuiScreen(inventory);
}
- public static void updateTabValues(int cornerX, int cornerY,
- Class<?> selectedButton) {
+ public static void updateTabValues(int cornerX, int cornerY, Class<?> selectedButton) {
int count = 0;
for (int i = 0; i < tabList.size(); i++) {
AbstractTab t = tabList.get(i);
if (t.shouldAddToList()) {
- if (selectedButton
- .equals(TabCurses.class)) {
+ if (selectedButton.equals(TabCurses.class)) {
t.xPosition = cornerX + 195;
t.yPosition = cornerY + count * 20;
- } else if (selectedButton.equals(
- TabJewelry.class)) {
- t.xPosition = cornerX + 140
- + count * 20;
+ } else if (selectedButton.equals(TabJewelry.class)) {
+ t.xPosition = cornerX + 140 + count * 20;
t.yPosition = cornerY + 64;
} else {
- t.xPosition = cornerX + 131
- + count * 20;
+ t.xPosition = cornerX + 131 + count * 20;
t.yPosition = cornerY + 64;
}
- t.enabled = !t.getClass()
- .equals(selectedButton);
+ t.enabled = !t.getClass().equals(selectedButton);
if (t.enabled)
count++;
}
diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/GuiCurseInfo.java b/src/main/java/darkknight/jewelrycraft/client/gui/GuiCurseInfo.java index 0c833ec..da3d340 100755 --- a/src/main/java/darkknight/jewelrycraft/client/gui/GuiCurseInfo.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/GuiCurseInfo.java @@ -25,14 +25,13 @@ import net.minecraft.util.ResourceLocation; import net.minecraft.world.World;
public class GuiCurseInfo extends GuiContainer {
- World world;
- EntityPlayer player;
- ResourceLocation texture;
- int page = 0, maxPages = 1;
- String selectedCurse = "";
+ World world;
+ EntityPlayer player;
+ ResourceLocation texture;
+ int page = 0, maxPages = 1;
+ String selectedCurse = "";
- public GuiCurseInfo(Container container, World world,
- EntityPlayer player, ResourceLocation texture) {
+ public GuiCurseInfo(Container container, World world, EntityPlayer player, ResourceLocation texture) {
super(container);
this.world = world;
this.player = player;
@@ -47,73 +46,46 @@ public class GuiCurseInfo extends GuiContainer { }
@Override
- public void drawGuiContainerBackgroundLayer(float f, int mouseX,
- int mouseY) {
+ public void drawGuiContainerBackgroundLayer(float f, int mouseX, int mouseY) {
GL11.glColor3f(1, 1, 1);
- Minecraft.getMinecraft().getTextureManager()
- .bindTexture(texture);
+ Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
if (player != null) {
- NBTTagCompound playerInfo = PlayerUtils
- .getModPlayerPersistTag(player,
- Variables.MODID);
+ NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(player, Variables.MODID);
if (!player.capabilities.isCreativeMode)
- maxPages = playerInfo.getInteger(
- "activeCurses") / 5
- - (playerInfo.getInteger(
- "activeCurses")
- % 5 == 0 ? 1
- : 0);
+ maxPages = playerInfo.getInteger("activeCurses") / 5
+ - (playerInfo.getInteger("activeCurses") % 5 == 0 ? 1 : 0);
else
- maxPages = Curse.getCurseList().size() / 5
- - (Curse.getCurseList()
- .size()
- % 5 == 0 ? 1
- : 0);
+ maxPages = Curse.getCurseList().size() / 5 - (Curse.getCurseList().size() % 5 == 0 ? 1 : 0);
if (!player.capabilities.isCreativeMode)
survivalCurses(playerInfo);
else
creativeCurses(playerInfo);
if (playerInfo.hasKey("cursePoints"))
- this.drawString(fontRendererObj,
- "Curse points: " + playerInfo
- .getInteger("cursePoints")
- + " | Active curses: "
- + playerInfo.getInteger(
- "activeCurses"),
- guiLeft, guiTop - 10,
- 0xffffff);
+ this.drawString(fontRendererObj, "Curse points: " + playerInfo.getInteger("cursePoints")
+ + " | Active curses: " + playerInfo.getInteger("activeCurses"), guiLeft, guiTop - 10, 0xffffff);
}
- Minecraft.getMinecraft().getTextureManager()
- .bindTexture(texture);
- drawTexturedModalRect(guiLeft + 5, guiTop + ySize - 14, 0,
- ySize, 13, 11);
- drawTexturedModalRect(guiLeft + xSize - 38,
- guiTop + ySize - 14, 13, ySize, 13, 11);
- this.drawString(fontRendererObj,
- (page + 1) + "/" + (maxPages + 1),
- guiLeft + 90, guiTop + 153, 0xffffff);
- this.drawString(fontRendererObj,
- "Click on an active curse to see its description",
- guiLeft, guiTop + 170, 0xffffff);
+ Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
+ drawTexturedModalRect(guiLeft + 5, guiTop + ySize - 14, 0, ySize, 13, 11);
+ drawTexturedModalRect(guiLeft + xSize - 38, guiTop + ySize - 14, 13, ySize, 13, 11);
+ this.drawString(fontRendererObj, (page + 1) + "/" + (maxPages + 1), guiLeft + 90, guiTop + 153, 0xffffff);
+ this.drawString(fontRendererObj, "Click on an active curse to see its description", guiLeft, guiTop + 170,
+ 0xffffff);
if (player.capabilities.isCreativeMode) {
- drawText(this, "To enable or disable a curse simply hold the CTRL key and click on one.",
- guiLeft - 100, guiTop, 20,
- 0xff0000);
- drawText(this, "If you do not have any curse points you need to type the command '/jw addCursePoints [playerUsername] [no of curse points]'. If you don't do this any curse you activate won't have any effect.",
- guiLeft - 100, guiTop + 50, 20,
- 0xff0000);
+ drawText(this, "To enable or disable a curse simply hold the CTRL key and click on one.", guiLeft - 100,
+ guiTop, 20, 0xff0000);
+ drawText(this,
+ "If you do not have any curse points you need to type the command '/jw addCursePoints [playerUsername] [no of curse points]'. If you don't do this any curse you activate won't have any effect.",
+ guiLeft - 100, guiTop + 50, 20, 0xff0000);
}
}
- public static void drawText(GuiCurseInfo gui, String text, int x,
- int y, int characters, int color) {
+ public static void drawText(GuiCurseInfo gui, String text, int x, int y, int characters, int color) {
String[] s = text.split(" ");
String displayText = "";
ArrayList<String> textLines = new ArrayList<>();
for (String element : s)
- if ((displayText + element + " ")
- .length() <= characters)
+ if ((displayText + element + " ").length() <= characters)
displayText += element + " ";
else {
textLines.add(displayText.trim());
@@ -121,8 +93,7 @@ public class GuiCurseInfo extends GuiContainer { }
textLines.add(displayText.trim());
for (int i = 0; i < textLines.size(); i++)
- gui.drawString(gui.getFont(), textLines.get(i), x,
- y + i * 9, color);
+ gui.drawString(gui.getFont(), textLines.get(i), x, y + i * 9, color);
}
public FontRenderer getFont() {
@@ -134,130 +105,51 @@ public class GuiCurseInfo extends GuiContainer { int ind = 0;
if (!playerInfo.hasNoTags()) {
for (Curse curse : Curse.getCurseList()) {
- if (playerInfo.getInteger(
- curse.getName()) > 0) {
- if (ind >= page * 5 && ind < (page
- + 1) * 5) {
- if (ind == page * 5
- && selectedCurse == "")
- selectedCurse = curse
- .getName();
- mc.renderEngine.bindTexture(
- Variables.MISC_TEXTURE);
- drawTexturedModalRect(
- guiLeft + 43,
- guiTop + 8 + (size
- - 8)
- * (ind - page * 5),
- 0, 32, 112,
- 22);
- if (selectedCurse == curse
- .getName()) {
+ if (playerInfo.getInteger(curse.getName()) > 0) {
+ if (ind >= page * 5 && ind < (page + 1) * 5) {
+ if (ind == page * 5 && selectedCurse == "")
+ selectedCurse = curse.getName();
+ mc.renderEngine.bindTexture(Variables.MISC_TEXTURE);
+ drawTexturedModalRect(guiLeft + 43, guiTop + 8 + (size - 8) * (ind - page * 5), 0, 32, 112, 22);
+ if (selectedCurse == curse.getName()) {
GL11.glPushMatrix();
- GL11.glScalef(1.2f,
- 1.5f,
- 0f);
- drawTexturedModalRect(
- (int) (guiLeft / (1.2))
- + 126,
- (int) (guiTop / (1.5))
- + 7
- + (size - 16) * (ind
- - page * 5),
- 48,
- 16,
- 32,
- 16);
- drawTexturedModalRect(
- (int) (guiLeft / (1.2))
- + 5,
- (int) (guiTop / (1.5))
- + 7
- + (size - 16) * (ind
- - page * 5),
- 80,
- 16,
- 32,
- 16);
+ GL11.glScalef(1.2f, 1.5f, 0f);
+ drawTexturedModalRect((int) (guiLeft / (1.2)) + 126,
+ (int) (guiTop / (1.5)) + 7 + (size - 16) * (ind - page * 5), 48, 16, 32, 16);
+ drawTexturedModalRect((int) (guiLeft / (1.2)) + 5,
+ (int) (guiTop / (1.5)) + 7 + (size - 16) * (ind - page * 5), 80, 16, 32, 16);
GL11.glPopMatrix();
GL11.glPushMatrix();
- List<?> descr = fontRendererObj
- .listFormattedStringToWidth(
- curse.getDescription(),
- 238);
- GL11.glScalef(0.75F,
- 0.75F,
- 0F);
- for (int i = 0; i < descr
- .size(); i++)
- this.drawString(fontRendererObj,
- descr.get(i).toString(),
- (int) (guiLeft / 0.75F)
- + 12,
- (int) (guiTop / 0.75F)
- + 184
- + i * 12
- - (descr.size() > 1
- ? 6
- : 0),
- 0xffffff);
+ List<?> descr = fontRendererObj.listFormattedStringToWidth(curse.getDescription(), 238);
+ GL11.glScalef(0.75F, 0.75F, 0F);
+ for (int i = 0; i < descr.size(); i++)
+ this.drawString(fontRendererObj, descr.get(i).toString(), (int) (guiLeft / 0.75F) + 12,
+ (int) (guiTop / 0.75F) + 184 + i * 12 - (descr.size() > 1 ? 6 : 0), 0xffffff);
GL11.glPopMatrix();
}
- if (playerInfo.getInteger(
- curse.getName()) == 2) {
- mc.renderEngine.bindTexture(
- Variables.MISC_TEXTURE);
+ if (playerInfo.getInteger(curse.getName()) == 2) {
+ mc.renderEngine.bindTexture(Variables.MISC_TEXTURE);
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_BLEND);
- GL11.glBlendFunc(
- GL11.GL_SRC_ALPHA,
- GL11.GL_ONE_MINUS_SRC_ALPHA);
- GL11.glColor4f(1f,
- 1f,
- 1f,
- 0.5f);
- drawTexturedModalRect(
- guiLeft + 134,
- guiTop + 11 + (size
- - 8)
- * (ind - page * 5),
- 3 * 16,
- 0,
- 16,
- 16);
+ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
+ GL11.glColor4f(1f, 1f, 1f, 0.5f);
+ drawTexturedModalRect(guiLeft + 134, guiTop + 11 + (size - 8) * (ind - page * 5), 3 * 16, 0,
+ 16, 16);
GL11.glDisable(GL11.GL_BLEND);
GL11.glPopMatrix();
}
- mc.renderEngine.bindTexture(
- new ResourceLocation(
- Variables.MODID,
- "textures/gui/" + curse
- .getTexturePack()
- + ".png"));
+ mc.renderEngine.bindTexture(new ResourceLocation(Variables.MODID,
+ "textures/gui/" + curse.getTexturePack() + ".png"));
int tag = curse.getTextureID();
GL11.glPushMatrix();
- GL11.glColor4f(1.0F, 1.0F,
- 1.0F,
- 1.0F);
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glDisable(GL11.GL_LIGHTING);
- GL11.glScalef(0.5f, 0.5f,
- 0.0f);
- drawTexturedModalRect(
- guiLeft * 2 + 100,
- guiTop * 2 + 22 + (ind
- - page * 5)
- * 48,
- tag % 8 * 32,
- tag / 8 * 32,
- 32, 32);
+ GL11.glScalef(0.5f, 0.5f, 0.0f);
+ drawTexturedModalRect(guiLeft * 2 + 100, guiTop * 2 + 22 + (ind - page * 5) * 48, tag % 8 * 32,
+ tag / 8 * 32, 32, 32);
GL11.glPopMatrix();
- this.drawString(fontRendererObj,
- curse.getDisplayName(),
- guiLeft + 70,
- guiTop + 15 + (ind
- - page * 5)
- * (size - 8),
- 0xffffff);
+ this.drawString(fontRendererObj, curse.getDisplayName(), guiLeft + 70,
+ guiTop + 15 + (ind - page * 5) * (size - 8), 0xffffff);
}
ind++;
}
@@ -272,103 +164,50 @@ public class GuiCurseInfo extends GuiContainer { if (ind >= page * 5 && ind < (page + 1) * 5) {
if (ind == page * 5 && selectedCurse == "")
selectedCurse = curse.getName();
- if (playerInfo.getInteger(
- curse.getName()) <= 0) {
+ if (playerInfo.getInteger(curse.getName()) <= 0) {
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_BLEND);
- GL11.glBlendFunc(GL11.GL_SRC_ALPHA,
- GL11.GL_ONE_MINUS_SRC_ALPHA);
- if (!curse.canCurseBeActivated()
- || !ConfigHandler.CURSES_ENABLED)
- GL11.glColor4f(1f, 0f, 0f,
- 0.5f);
+ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
+ if (!curse.canCurseBeActivated() || !ConfigHandler.CURSES_ENABLED)
+ GL11.glColor4f(1f, 0f, 0f, 0.5f);
else
- GL11.glColor4f(1f, 1f, 1f,
- 0.5f);
+ GL11.glColor4f(1f, 1f, 1f, 0.5f);
}
- mc.renderEngine.bindTexture(
- Variables.MISC_TEXTURE);
- drawTexturedModalRect(guiLeft + 43, guiTop
- + 8
- + (size - 8) * (ind - page
- * 5),
- 0, 32, 112, 22);
+ mc.renderEngine.bindTexture(Variables.MISC_TEXTURE);
+ drawTexturedModalRect(guiLeft + 43, guiTop + 8 + (size - 8) * (ind - page * 5), 0, 32, 112, 22);
if (selectedCurse == curse.getName()) {
GL11.glPushMatrix();
GL11.glScalef(1.2f, 1.5f, 0f);
- drawTexturedModalRect(
- (int) (guiLeft / (1.2))
- + 126,
- (int) (guiTop / (1.5))
- + 7
- + (size - 16) * (ind
- - page * 5),
- 48, 16, 32, 16);
- drawTexturedModalRect(
- (int) (guiLeft / (1.2))
- + 5,
- (int) (guiTop / (1.5))
- + 7
- + (size - 16) * (ind
- - page * 5),
- 80, 16, 32, 16);
+ drawTexturedModalRect((int) (guiLeft / (1.2)) + 126,
+ (int) (guiTop / (1.5)) + 7 + (size - 16) * (ind - page * 5), 48, 16, 32, 16);
+ drawTexturedModalRect((int) (guiLeft / (1.2)) + 5,
+ (int) (guiTop / (1.5)) + 7 + (size - 16) * (ind - page * 5), 80, 16, 32, 16);
GL11.glPopMatrix();
GL11.glPushMatrix();
- List<?> descr = fontRendererObj
- .listFormattedStringToWidth(
- curse.getDescription(),
- 238);
+ List<?> descr = fontRendererObj.listFormattedStringToWidth(curse.getDescription(), 238);
GL11.glScalef(0.75F, 0.75F, 0F);
- for (int i = 0; i < descr
- .size(); i++)
- this.drawString(fontRendererObj,
- descr.get(i).toString(),
- (int) (guiLeft / 0.75F)
- + 12,
- (int) (guiTop / 0.75F)
- + 184
- + i * 12
- - (descr.size() > 1
- ? 6
- : 0),
- 0xffffff);
+ for (int i = 0; i < descr.size(); i++)
+ this.drawString(fontRendererObj, descr.get(i).toString(), (int) (guiLeft / 0.75F) + 12,
+ (int) (guiTop / 0.75F) + 184 + i * 12 - (descr.size() > 1 ? 6 : 0), 0xffffff);
GL11.glPopMatrix();
}
mc.renderEngine.bindTexture(
- new ResourceLocation(
- Variables.MODID,
- "textures/gui/" + curse
- .getTexturePack()
- + ".png"));
+ new ResourceLocation(Variables.MODID, "textures/gui/" + curse.getTexturePack() + ".png"));
int tag = curse.getTextureID();
GL11.glPushMatrix();
- if (playerInfo.getInteger(
- curse.getName()) <= 0)
- GL11.glColor4f(1.0F, 1.0F, 1.0F,
- 0.5F);
+ if (playerInfo.getInteger(curse.getName()) <= 0)
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.5F);
else
- GL11.glColor4f(1.0F, 1.0F, 1.0F,
- 1.0F);
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glScalef(0.5f, 0.5f, 0.0f);
- drawTexturedModalRect(guiLeft * 2 + 100,
- guiTop * 2 + 22 + (ind
- - page * 5)
- * 48,
- tag % 8 * 32, tag / 8 * 32,
- 32, 32);
+ drawTexturedModalRect(guiLeft * 2 + 100, guiTop * 2 + 22 + (ind - page * 5) * 48, tag % 8 * 32,
+ tag / 8 * 32, 32, 32);
GL11.glPopMatrix();
- this.drawString(fontRendererObj,
- curse.getDisplayName(),
- guiLeft + 70,
- guiTop + 15 + (ind
- - page * 5)
- * (size - 8),
- playerInfo.getInteger(curse
- .getName()) > 0 ? 0xffffffff
- : 0xaaffffff);
- if (playerInfo.getInteger(
- curse.getName()) <= 0) {
+ this.drawString(fontRendererObj, curse.getDisplayName(), guiLeft + 70,
+ guiTop + 15 + (ind - page * 5) * (size - 8),
+ playerInfo.getInteger(curse.getName()) > 0 ? 0xffffffff : 0xaaffffff);
+ if (playerInfo.getInteger(curse.getName()) <= 0) {
GL11.glDisable(GL11.GL_BLEND);
GL11.glPopMatrix();
}
@@ -378,8 +217,7 @@ public class GuiCurseInfo extends GuiContainer { }
@Override
- public void drawGuiContainerForegroundLayer(int mouseX,
- int mouseY) {
+ public void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
// Do nothing
}
@@ -396,8 +234,7 @@ public class GuiCurseInfo extends GuiContainer { int cornerX = guiLeft;
int cornerY = guiTop;
this.buttonList.clear();
- TabRegistry.updateTabValues(cornerX, cornerY,
- TabCurses.class);
+ TabRegistry.updateTabValues(cornerX, cornerY, TabCurses.class);
TabRegistry.addTabsToList(this.buttonList);
}
@@ -407,101 +244,47 @@ public class GuiCurseInfo extends GuiContainer { int ind = 0;
int size = 32;
if (player != null) {
- NBTTagCompound playerInfo = PlayerUtils
- .getModPlayerPersistTag(player,
- Variables.MODID);
+ NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(player, Variables.MODID);
for (Curse curse : Curse.getCurseList()) {
if (player.capabilities.isCreativeMode) {
- if (x > (guiLeft + 43)
- && y > (guiTop + 8
- + (size - 8) * (ind
- - page * 5))
- && x < (guiLeft + 43
- + 112)
- && y < (guiTop + 40
- + (size - 8) * (ind
- - page * 5))
- && ind >= page * 5
- && ind < (page + 1)
- * 5) {
- if (player.capabilities.isCreativeMode
- && isCtrlKeyDown()
- && playerInfo.getInteger(
- curse.getName()) > 0) {
- playerInfo.setInteger(
- curse.getName(),
- 0);
- playerInfo.setInteger(
- "activeCurses",
- playerInfo.getInteger(
- "activeCurses")
- - 1);
- Curse.availableCurses
- .add(curse);
- JewelrycraftMod.netWrapper
- .sendToServer(new PacketSendServerPlayerInfo(
- "remove",
- curse.getName(),
- playerInfo));
- JewelrycraftMod.netWrapper
- .sendToAll(new PacketSendServerPlayersInfo());
- } else if (player.capabilities.isCreativeMode
- && isCtrlKeyDown()
- && playerInfo.getInteger(
- curse.getName()) <= 0
- && curse.canCurseBeActivated()
+ if (x > (guiLeft + 43) && y > (guiTop + 8 + (size - 8) * (ind - page * 5))
+ && x < (guiLeft + 43 + 112) && y < (guiTop + 40 + (size - 8) * (ind - page * 5))
+ && ind >= page * 5 && ind < (page + 1) * 5) {
+ if (player.capabilities.isCreativeMode && isCtrlKeyDown()
+ && playerInfo.getInteger(curse.getName()) > 0) {
+ playerInfo.setInteger(curse.getName(), 0);
+ playerInfo.setInteger("activeCurses", playerInfo.getInteger("activeCurses") - 1);
+ Curse.availableCurses.add(curse);
+ JewelrycraftMod.netWrapper.sendToServer(
+ new PacketSendServerPlayerInfo("remove", curse.getName(), playerInfo));
+ JewelrycraftMod.netWrapper.sendToAll(new PacketSendServerPlayersInfo());
+ } else if (player.capabilities.isCreativeMode && isCtrlKeyDown()
+ && playerInfo.getInteger(curse.getName()) <= 0 && curse.canCurseBeActivated()
&& ConfigHandler.CURSES_ENABLED) {
- playerInfo.setInteger(
- curse.getName(),
- 1);
- playerInfo.setInteger(
- "activeCurses",
- playerInfo.getInteger(
- "activeCurses")
- + 1);
- Curse.availableCurses
- .remove(curse);
+ playerInfo.setInteger(curse.getName(), 1);
+ playerInfo.setInteger("activeCurses", playerInfo.getInteger("activeCurses") + 1);
+ Curse.availableCurses.remove(curse);
JewelrycraftMod.netWrapper
- .sendToServer(new PacketSendServerPlayerInfo(
- "add",
- curse.getName(),
- playerInfo));
- JewelrycraftMod.netWrapper
- .sendToAll(new PacketSendServerPlayersInfo());
+ .sendToServer(new PacketSendServerPlayerInfo("add", curse.getName(), playerInfo));
+ JewelrycraftMod.netWrapper.sendToAll(new PacketSendServerPlayersInfo());
} else
- selectedCurse = curse
- .getName();
+ selectedCurse = curse.getName();
}
ind++;
- } else if (playerInfo.getInteger(
- curse.getName()) > 0) {
- if (x > (guiLeft + 43)
- && y > (guiTop + 8
- + (size - 8) * (ind
- - page * 5))
- && x < (guiLeft + 43
- + 112)
- && y < (guiTop + 40
- + (size - 8) * (ind
- - page * 5))
- && ind >= page * 5
- && ind < (page + 1)
- * 5)
- selectedCurse = curse
- .getName();
+ } else if (playerInfo.getInteger(curse.getName()) > 0) {
+ if (x > (guiLeft + 43) && y > (guiTop + 8 + (size - 8) * (ind - page * 5))
+ && x < (guiLeft + 43 + 112) && y < (guiTop + 40 + (size - 8) * (ind - page * 5))
+ && ind >= page * 5 && ind < (page + 1) * 5)
+ selectedCurse = curse.getName();
ind++;
}
}
}
- if (page > 0 && x > guiLeft + 5 && x < guiLeft + 18
- && y > guiTop + ySize - 14
- && y < guiTop + ySize - 3) {
+ if (page > 0 && x > guiLeft + 5 && x < guiLeft + 18 && y > guiTop + ySize - 14 && y < guiTop + ySize - 3) {
page--;
selectedCurse = "";
}
- if (page < maxPages && x > guiLeft + xSize - 38
- && x < guiLeft + xSize - 25
- && y > guiTop + ySize - 14
+ if (page < maxPages && x > guiLeft + xSize - 38 && x < guiLeft + xSize - 25 && y > guiTop + ySize - 14
&& y < guiTop + ySize - 3) {
page++;
selectedCurse = "";
diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/GuiGuide.java b/src/main/java/darkknight/jewelrycraft/client/gui/GuiGuide.java index d322761..446f7bd 100755 --- a/src/main/java/darkknight/jewelrycraft/client/gui/GuiGuide.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/GuiGuide.java @@ -21,25 +21,18 @@ import net.minecraft.util.ResourceLocation; import net.minecraft.world.World;
public class GuiGuide extends GuiContainer {
- public int page, rot, del;
- public boolean prevHover, nextHover;
- World world;
- private final GuiTab[] tabs = new GuiTab[] {
- new GuiTabIntroduction(0), new GuiTabBlocks(1),
- new GuiTabItems(2), new GuiTabGemsAndIngots(3),
- new GuiTabCurses(4), new GuiTabModifiers(5),
- new GuiTabRitual(6)
- };
- private GuiTab activeTab;
- ResourceLocation pageTexture, flippedPageTexture;
+ public int page, rot, del;
+ public boolean prevHover, nextHover;
+ World world;
+ private final GuiTab[] tabs = new GuiTab[] { new GuiTabIntroduction(0), new GuiTabBlocks(1), new GuiTabItems(2),
+ new GuiTabGemsAndIngots(3), new GuiTabCurses(4), new GuiTabModifiers(5), new GuiTabRitual(6) };
+ private GuiTab activeTab;
+ ResourceLocation pageTexture, flippedPageTexture;
// GUIDE
- public static GuiTab prevActive = new GuiTabIntroduction(
- 0);
- public static int prevPage = 1;
+ public static GuiTab prevActive = new GuiTabIntroduction(0);
+ public static int prevPage = 1;
- public GuiGuide(Container container, World world,
- ResourceLocation pageTex,
- ResourceLocation flipPageTex) {
+ public GuiGuide(Container container, World world, ResourceLocation pageTex, ResourceLocation flipPageTex) {
super(container);
page = prevPage;
rot = 0;
@@ -52,8 +45,7 @@ public class GuiGuide extends GuiContainer { }
@Override
- protected void drawGuiContainerBackgroundLayer(float f, int i,
- int j) {
+ protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {
nextHover = false;
prevHover = false;
if (del == 0)
@@ -61,14 +53,10 @@ public class GuiGuide extends GuiContainer { del++;
if (del >= 2)
del = 0;
- Minecraft.getMinecraft().getTextureManager()
- .bindTexture(pageTexture);
- drawTexturedModalRect(guiLeft + 147 / 2 + 20, guiTop - 10,
- 0, 0, 145, 179);
- Minecraft.getMinecraft().getTextureManager()
- .bindTexture(flippedPageTexture);
- drawTexturedModalRect(guiLeft - 147 / 2 + 21, guiTop - 10,
- 0, 0, 145, 179);
+ Minecraft.getMinecraft().getTextureManager().bindTexture(pageTexture);
+ drawTexturedModalRect(guiLeft + 147 / 2 + 20, guiTop - 10, 0, 0, 145, 179);
+ Minecraft.getMinecraft().getTextureManager().bindTexture(flippedPageTexture);
+ drawTexturedModalRect(guiLeft - 147 / 2 + 21, guiTop - 10, 0, 0, 145, 179);
for (GuiRectangle tab : tabs) {
int srcX = 24;
int sizeX = 19;
@@ -79,44 +67,28 @@ public class GuiGuide extends GuiContainer { srcX += 19;
tab.draw(this, srcX, 180, sizeX, 18);
}
- if (i >= guiLeft + 195 + 20 && i <= guiLeft + 195 + 20 + 11
- && j >= guiTop + 127 + 20
- && j <= guiTop + 127 + 20 + 14
- && page + 2 <= activeTab.getMaxPages()) {
- drawTexturedModalRect(guiLeft + 195 + 20,
- guiTop + 127 + 20, 0, 180, 11, 14);
+ if (i >= guiLeft + 195 + 20 && i <= guiLeft + 195 + 20 + 11 && j >= guiTop + 127 + 20
+ && j <= guiTop + 127 + 20 + 14 && page + 2 <= activeTab.getMaxPages()) {
+ drawTexturedModalRect(guiLeft + 195 + 20, guiTop + 127 + 20, 0, 180, 11, 14);
nextHover = true;
}
- if (i >= guiLeft + 20 - 61 && i <= guiLeft - 61 + 20 + 11
- && j >= guiTop + 127 + 20
- && j <= guiTop + 127 + 20 + 14
- && page - 2 > 0) {
- drawTexturedModalRect(guiLeft - 61 + 20,
- guiTop + 127 + 20, 11, 180, 11,
- 14);
+ if (i >= guiLeft + 20 - 61 && i <= guiLeft - 61 + 20 + 11 && j >= guiTop + 127 + 20
+ && j <= guiTop + 127 + 20 + 14 && page - 2 > 0) {
+ drawTexturedModalRect(guiLeft - 61 + 20, guiTop + 127 + 20, 11, 180, 11, 14);
prevHover = true;
}
activeTab.drawBackground(this, i, j, page);
activeTab.drawBackground(this, i, j, page + 1);
ArrayList<String> text = new ArrayList<>();
text.add(page + "/" + activeTab.getMaxPages());
- drawHoveringText(text,
- guiLeft - 10 + 20 - text.get(0).length(),
- guiTop + 150 + 25, fontRendererObj);
+ drawHoveringText(text, guiLeft - 10 + 20 - text.get(0).length(), guiTop + 150 + 25, fontRendererObj);
if (page < activeTab.getMaxPages()) {
text.remove(0);
- text.add((page + 1) + "/"
- + activeTab.getMaxPages());
- drawHoveringText(text,
- guiLeft - 10 + 20 + 147 - text
- .get(0).length(),
- guiTop + 150 + 25,
- fontRendererObj);
+ text.add((page + 1) + "/" + activeTab.getMaxPages());
+ drawHoveringText(text, guiLeft - 10 + 20 + 147 - text.get(0).length(), guiTop + 150 + 25, fontRendererObj);
}
for (int tab = 0; tab < tabs.length; tab++)
- renderItem(tabs[tab].getIcon(), guiLeft - 52,
- guiTop + 26 + tab * 19,
- activeTab.getIcon());
+ renderItem(tabs[tab].getIcon(), guiLeft - 52, guiTop + 26 + tab * 19, activeTab.getIcon());
}
@Override
@@ -148,12 +120,10 @@ public class GuiGuide extends GuiContainer { }
}
- public void renderItem(ItemStack item, float x, float y,
- ItemStack activeIcon) {
+ public void renderItem(ItemStack item, float x, float y, ItemStack activeIcon) {
GL11.glPushMatrix();
GL11.glDisable(GL11.GL_LIGHTING);
- EntityItem entityitem = new EntityItem(world, 0.0D, 0.0D,
- 0.0D, item);
+ EntityItem entityitem = new EntityItem(world, 0.0D, 0.0D, 0.0D, item);
entityitem.hoverStart = 0.0F;
if (item.isItemEqual(new ItemStack(BlockList.smelter))) {
y -= 3;
@@ -166,40 +136,31 @@ public class GuiGuide extends GuiContainer { GL11.glRotatef(rot, 0, 1, 0);
if (item.isItemEqual(new ItemStack(BlockList.smelter)))
GL11.glScalef(1.5F, 1.5F, 1.5F);
- else if (item.isItemEqual(
- new ItemStack(BlockList.handPedestal))) {
+ else if (item.isItemEqual(new ItemStack(BlockList.handPedestal))) {
GL11.glScalef(1.2F, 1.2F, 1.2F);
GL11.glTranslatef(0F, -0.05F, 0F);
}
GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
- if (!(Block.getBlockFromItem(entityitem.getEntityItem()
- .getItem()) instanceof BlockAir))
+ if (!(Block.getBlockFromItem(entityitem.getEntityItem().getItem()) instanceof BlockAir))
RenderHelper.enableStandardItemLighting();
if (RenderManager.instance.options.fancyGraphics)
- RenderManager.instance.renderEntityWithPosYaw(
- entityitem, 0.0D, 0.0D, 0.0D, 0.0F,
- 0.0F);
+ RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
else {
GL11.glRotatef(180F, 0F, 1F, 0F);
RenderManager.instance.options.fancyGraphics = true;
- RenderManager.instance.renderEntityWithPosYaw(
- entityitem, 0.0D, 0.0D, 0.0D, 0.0F,
- 0.0F);
+ RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
RenderManager.instance.options.fancyGraphics = false;
}
- if (!(Block.getBlockFromItem(entityitem.getEntityItem()
- .getItem()) instanceof BlockAir))
+ if (!(Block.getBlockFromItem(entityitem.getEntityItem().getItem()) instanceof BlockAir))
RenderHelper.disableStandardItemLighting();
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glPopMatrix();
}
- public void renderItem(ItemStack item, float x, float y,
- float scale, boolean rotate, float xRot,
- float yRot, float zRot) {
+ public void renderItem(ItemStack item, float x, float y, float scale, boolean rotate, float xRot, float yRot,
+ float zRot) {
GL11.glPushMatrix();
- EntityItem entityitem = new EntityItem(world, 0.0D, 0.0D,
- 0.0D, item);
+ EntityItem entityitem = new EntityItem(world, 0.0D, 0.0D, 0.0D, item);
entityitem.hoverStart = 0.0F;
GL11.glTranslatef(x, y, 100);
GL11.glScalef(-scale, scale, scale);
@@ -212,27 +173,19 @@ public class GuiGuide extends GuiContainer { GL11.glRotatef(zRot, 0, 0, 1);
if (xRot >= 90F || zRot >= 90F)
GL11.glTranslatef(0F, -0.2F, 0F);
- if (Block.getBlockFromItem(entityitem
- .getEntityItem()
- .getItem()) instanceof BlockShadowEye)
+ if (Block.getBlockFromItem(entityitem.getEntityItem().getItem()) instanceof BlockShadowEye)
GL11.glTranslatef(0F, 0F, 0.025F);
}
- if (!(Block.getBlockFromItem(entityitem.getEntityItem()
- .getItem()) instanceof BlockAir))
+ if (!(Block.getBlockFromItem(entityitem.getEntityItem().getItem()) instanceof BlockAir))
RenderHelper.enableStandardItemLighting();
if (RenderManager.instance.options.fancyGraphics)
- RenderManager.instance.renderEntityWithPosYaw(
- entityitem, 0.0D, 0.0D, 0.0D, 0.0F,
- 0.0F);
+ RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
else {
RenderManager.instance.options.fancyGraphics = true;
- RenderManager.instance.renderEntityWithPosYaw(
- entityitem, 0.0D, 0.0D, 0.0D, 0.0F,
- 0.0F);
+ RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
RenderManager.instance.options.fancyGraphics = false;
}
- if (!(Block.getBlockFromItem(entityitem.getEntityItem()
- .getItem()) instanceof BlockAir))
+ if (!(Block.getBlockFromItem(entityitem.getEntityItem().getItem()) instanceof BlockAir))
RenderHelper.disableStandardItemLighting();
GL11.glPopMatrix();
}
diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/GuiHandler.java b/src/main/java/darkknight/jewelrycraft/client/gui/GuiHandler.java index be4a907..6e0f399 100755 --- a/src/main/java/darkknight/jewelrycraft/client/gui/GuiHandler.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/GuiHandler.java @@ -4,11 +4,7 @@ import cpw.mods.fml.common.network.IGuiHandler; import cpw.mods.fml.common.network.NetworkRegistry;
import darkknight.jewelrycraft.JewelrycraftMod;
import darkknight.jewelrycraft.client.JewelryInventory;
-import darkknight.jewelrycraft.client.gui.container.ContainerCurseInfo;
-import darkknight.jewelrycraft.client.gui.container.ContainerGuide;
-import darkknight.jewelrycraft.client.gui.container.ContainerJewelryModifier;
-import darkknight.jewelrycraft.client.gui.container.ContainerJewelryTab;
-import darkknight.jewelrycraft.client.gui.container.ContainerRingChest;
+import darkknight.jewelrycraft.client.gui.container.*;
import darkknight.jewelrycraft.util.Variables;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.InventoryBasic;
@@ -17,26 +13,18 @@ import net.minecraft.util.ResourceLocation; import net.minecraft.world.World;
public class GuiHandler implements IGuiHandler {
- ResourceLocation pageTexture = new ResourceLocation(
- Variables.MODID, "textures/gui/guidePage.png");
- ResourceLocation flippedPageTexture = new ResourceLocation(
- Variables.MODID, "textures/gui/guidePageFlip.png");
- ResourceLocation chestTexture = new ResourceLocation(
- Variables.MODID, "textures/gui/chest_ring.png");
- ResourceLocation jewelryInvTexture = new ResourceLocation(
- Variables.MODID, "textures/gui/jewelry_tab.png");
- ResourceLocation cursesInvTexture = new ResourceLocation(
- Variables.MODID, "textures/gui/curses_tab.png");
- ResourceLocation jewlryModTexture = new ResourceLocation(
- Variables.MODID,
- "textures/gui/jewelry_modifier.png");
+ ResourceLocation pageTexture = new ResourceLocation(Variables.MODID, "textures/gui/guidePage.png");
+ ResourceLocation flippedPageTexture = new ResourceLocation(Variables.MODID, "textures/gui/guidePageFlip.png");
+ ResourceLocation chestTexture = new ResourceLocation(Variables.MODID, "textures/gui/chest_ring.png");
+ ResourceLocation jewelryInvTexture = new ResourceLocation(Variables.MODID, "textures/gui/jewelry_tab.png");
+ ResourceLocation cursesInvTexture = new ResourceLocation(Variables.MODID, "textures/gui/curses_tab.png");
+ ResourceLocation jewlryModTexture = new ResourceLocation(Variables.MODID, "textures/gui/jewelry_modifier.png");
/**
*
*/
public GuiHandler() {
- NetworkRegistry.INSTANCE.registerGuiHandler(
- JewelrycraftMod.instance, this);
+ NetworkRegistry.INSTANCE.registerGuiHandler(JewelrycraftMod.instance, this);
}
/**
@@ -49,34 +37,20 @@ public class GuiHandler implements IGuiHandler { * @return
*/
@Override
- public Object getServerGuiElement(int ID, EntityPlayer player,
- World world, int x, int y, int z) {
+ public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
switch (ID) {
- case 0:
- return new ContainerRingChest(
- player.inventory,
- (TileEntityChest) world
- .getTileEntity(x,
- y,
- z));
- case 1:
- return new ContainerGuide();
- case 2:
- return new ContainerJewelryTab(player,
- player.inventory,
- new JewelryInventory(
- player));
- case 3:
- return new ContainerJewelryModifier(
- player.inventory,
- new InventoryBasic(
- "ItemModifier",
- false,
- 37));
- case 4:
- return new ContainerCurseInfo();
- default:
- return null;
+ case 0:
+ return new ContainerRingChest(player.inventory, (TileEntityChest) world.getTileEntity(x, y, z));
+ case 1:
+ return new ContainerGuide();
+ case 2:
+ return new ContainerJewelryTab(player, player.inventory, new JewelryInventory(player));
+ case 3:
+ return new ContainerJewelryModifier(player.inventory, new InventoryBasic("ItemModifier", false, 37));
+ case 4:
+ return new ContainerCurseInfo();
+ default:
+ return null;
}
}
@@ -90,49 +64,24 @@ public class GuiHandler implements IGuiHandler { * @return
*/
@Override
- public Object getClientGuiElement(int ID, EntityPlayer player,
- World world, int x, int y, int z) {
+ public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
switch (ID) {
- case 0:
- return new GuiRingChest(
- (ContainerRingChest) getServerGuiElement(
- ID, player,
- world, x,
- y, z),
- chestTexture);
- case 1:
- return new GuiGuide(
- (ContainerGuide) getServerGuiElement(
- ID, player,
- world, x,
- y, z),
- world, pageTexture,
- flippedPageTexture);
- case 2:
- return new GuiJewelry(
- new ContainerJewelryTab(
- player,
- player.inventory,
- new JewelryInventory(
- player)),
- jewelryInvTexture);
- case 3:
- return new GuiJewelryModifier(
- (ContainerJewelryModifier) getServerGuiElement(
- ID, player,
- world, x,
- y, z),
- jewlryModTexture);
- case 4:
- return new GuiCurseInfo(
- (ContainerCurseInfo) getServerGuiElement(
- ID, player,
- world, x,
- y, z),
- world, player,
- cursesInvTexture);
- default:
- return null;
+ case 0:
+ return new GuiRingChest((ContainerRingChest) getServerGuiElement(ID, player, world, x, y, z), chestTexture);
+ case 1:
+ return new GuiGuide((ContainerGuide) getServerGuiElement(ID, player, world, x, y, z), world, pageTexture,
+ flippedPageTexture);
+ case 2:
+ return new GuiJewelry(new ContainerJewelryTab(player, player.inventory, new JewelryInventory(player)),
+ jewelryInvTexture);
+ case 3:
+ return new GuiJewelryModifier((ContainerJewelryModifier) getServerGuiElement(ID, player, world, x, y, z),
+ jewlryModTexture);
+ case 4:
+ return new GuiCurseInfo((ContainerCurseInfo) getServerGuiElement(ID, player, world, x, y, z), world, player,
+ cursesInvTexture);
+ default:
+ return null;
}
}
}
diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/GuiJewelry.java b/src/main/java/darkknight/jewelrycraft/client/gui/GuiJewelry.java index 1498f75..9ca4f2e 100755 --- a/src/main/java/darkknight/jewelrycraft/client/gui/GuiJewelry.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/GuiJewelry.java @@ -18,8 +18,7 @@ public class GuiJewelry extends GuiContainer { * @param containerJewelryTab
* @param texture
*/
- public GuiJewelry(ContainerJewelryTab containerJewelryTab,
- ResourceLocation texture) {
+ public GuiJewelry(ContainerJewelryTab containerJewelryTab, ResourceLocation texture) {
super(containerJewelryTab);
xSize = 194;
ySize = 166;
@@ -32,17 +31,13 @@ public class GuiJewelry extends GuiContainer { * @param mouseY
*/
@Override
- public void drawGuiContainerBackgroundLayer(float f, int mouseX,
- int mouseY) {
+ public void drawGuiContainerBackgroundLayer(float f, int mouseX, int mouseY) {
GL11.glColor3f(1, 1, 1);
- Minecraft.getMinecraft().getTextureManager()
- .bindTexture(texture);
+ Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
GL11.glPushMatrix();
- GuiInventory.func_147046_a(guiLeft - 24, guiTop + 124, 60,
- (float) (guiLeft - 24) - mouseX,
- (float) (guiTop + 124 - 90) - mouseY,
- this.mc.thePlayer);
+ GuiInventory.func_147046_a(guiLeft - 24, guiTop + 124, 60, (float) (guiLeft - 24) - mouseX,
+ (float) (guiTop + 124 - 90) - mouseY, this.mc.thePlayer);
GL11.glPopMatrix();
}
@@ -51,8 +46,7 @@ public class GuiJewelry extends GuiContainer { * @param mouseY
*/
@Override
- public void drawGuiContainerForegroundLayer(int mouseX,
- int mouseY) {
+ public void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
// Do nothing
}
@@ -73,8 +67,7 @@ public class GuiJewelry extends GuiContainer { int cornerX = guiLeft;
int cornerY = guiTop;
this.buttonList.clear();
- TabRegistry.updateTabValues(cornerX, cornerY,
- TabJewelry.class);
+ TabRegistry.updateTabValues(cornerX, cornerY, TabJewelry.class);
TabRegistry.addTabsToList(this.buttonList);
}
}
diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/GuiJewelryModifier.java b/src/main/java/darkknight/jewelrycraft/client/gui/GuiJewelryModifier.java index 30f0b5b..44984a5 100755 --- a/src/main/java/darkknight/jewelrycraft/client/gui/GuiJewelryModifier.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/GuiJewelryModifier.java @@ -22,20 +22,15 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation;
public class GuiJewelryModifier extends GuiContainer {
- private ResourceLocation texture;
- private GuiTextField searchField,
- pages;
- private int page = 1,
- maxPages = 1, selectedX = 0, selectedY = 0,
- selectedPage = 0, enabled = 0;
- private ItemStack selectedItem;
- private ArrayList<ItemStack> selectedItems = new ArrayList<>();
- private List<Map<Integer, Map<Integer, Integer>>> selectedItemsPos = new ArrayList<>();
- ContainerJewelryModifier jMod;
+ private ResourceLocation texture;
+ private GuiTextField searchField, pages;
+ private int page = 1, maxPages = 1, selectedX = 0, selectedY = 0, selectedPage = 0, enabled = 0;
+ private ItemStack selectedItem;
+ private ArrayList<ItemStack> selectedItems = new ArrayList<>();
+ private List<Map<Integer, Map<Integer, Integer>>> selectedItemsPos = new ArrayList<>();
+ ContainerJewelryModifier jMod;
- public GuiJewelryModifier(
- ContainerJewelryModifier containerJewelryTab,
- ResourceLocation texture) {
+ public GuiJewelryModifier(ContainerJewelryModifier containerJewelryTab, ResourceLocation texture) {
super(containerJewelryTab);
xSize = 211;
ySize = 247;
@@ -45,29 +40,19 @@ public class GuiJewelryModifier extends GuiContainer { }
@Override
- public void drawGuiContainerBackgroundLayer(float f, int mouseX,
- int mouseY) {
+ public void drawGuiContainerBackgroundLayer(float f, int mouseX, int mouseY) {
GL11.glColor3f(1, 1, 1);
- Minecraft.getMinecraft().getTextureManager()
- .bindTexture(texture);
+ Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
- if (selectedX != 0 && selectedY != 0
- && page == selectedPage)
- drawTexturedModalRect(k + selectedX, l + selectedY,
- 211, 0, 18, 18);
+ if (selectedX != 0 && selectedY != 0 && page == selectedPage)
+ drawTexturedModalRect(k + selectedX, l + selectedY, 211, 0, 18, 18);
for (Map<Integer, Map<Integer, Integer>> items : selectedItemsPos) {
for (Object itemPage : items.keySet()) {
if (page == (Integer) itemPage)
- for (int x : items.get(itemPage)
- .keySet())
- drawTexturedModalRect(
- k + x,
- l + items.get(itemPage)
- .get(x),
- 211, 0, 18,
- 18);
+ for (int x : items.get(itemPage).keySet())
+ drawTexturedModalRect(k + x, l + items.get(itemPage).get(x), 211, 0, 18, 18);
}
}
this.searchField.drawTextBox();
@@ -75,37 +60,22 @@ public class GuiJewelryModifier extends GuiContainer { }
@Override
- public void drawGuiContainerForegroundLayer(int mouseX,
- int mouseY) {
+ public void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
int i = 0;
for (ItemStack item : JewelrycraftUtil.objects) {
- if (item != null && item.getItem() != null
- && (this.searchField
- .getText() == ""
- || item.getDisplayName()
- .toLowerCase()
- .contains(this.searchField
- .getText()
- .toLowerCase()))) {
+ if (item != null && item.getItem() != null && (this.searchField.getText() == ""
+ || item.getDisplayName().toLowerCase().contains(this.searchField.getText().toLowerCase()))) {
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glColor3f(1F, 1F, 1F);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
if (i >= (page - 1) * 48 && i < page * 48)
try {
- itemRender.renderItemAndEffectIntoGUI(
- this.fontRendererObj,
- this.mc.getTextureManager(),
- item,
- 88 + 20 * (i % 6),
- 7 + 17 * (i / 6) - 136
- * (page - 1));
+ itemRender.renderItemAndEffectIntoGUI(this.fontRendererObj, this.mc.getTextureManager(), item,
+ 88 + 20 * (i % 6), 7 + 17 * (i / 6) - 136 * (page - 1));
} catch (Exception e) {
- JewelrycraftMod.logger
- .info("Trying to display an item but gets this error: "
- + e.getMessage()
- + "\nThe item causing the issue is: "
- + item);
+ JewelrycraftMod.logger.info("Trying to display an item but gets this error: " + e.getMessage()
+ + "\nThe item causing the issue is: " + item);
}
GL11.glDisable(GL11.GL_LIGHTING);
i++;
@@ -118,14 +88,8 @@ public class GuiJewelryModifier extends GuiContainer { if (this.searchField.textboxKeyTyped(character, key)) {
int items = 0;
for (ItemStack item : JewelrycraftUtil.objects)
- if (item != null && searchField != null
- && searchField.getText() != ""
- && item.getItem() != null
- && item.getDisplayName()
- .toLowerCase()
- .contains(this.searchField
- .getText()
- .toLowerCase()))
+ if (item != null && searchField != null && searchField.getText() != "" && item.getItem() != null
+ && item.getDisplayName().toLowerCase().contains(this.searchField.getText().toLowerCase()))
items++;
maxPages = items / 48 + 1;
page = 1;
@@ -137,179 +101,96 @@ public class GuiJewelryModifier extends GuiContainer { @Override
protected void mouseClicked(int x, int y, int id) {
super.mouseClicked(x, y, id);
- if (x >= this.searchField.xPosition
- && x <= this.searchField.xPosition
- + this.searchField.width
- && y >= this.searchField.yPosition
- && y <= this.searchField.yPosition
- + this.searchField.height) {
+ if (x >= this.searchField.xPosition && x <= this.searchField.xPosition + this.searchField.width
+ && y >= this.searchField.yPosition && y <= this.searchField.yPosition + this.searchField.height) {
this.searchField.setText("");
this.searchField.setFocused(true);
- maxPages = JewelrycraftUtil.objects.size() / 48
- + 1;
+ maxPages = JewelrycraftUtil.objects.size() / 48 + 1;
} else
this.searchField.setFocused(false);
for (Object button : this.buttonList) {
- if (((GuiButton) button).id < 4
- && ((GuiButton) button)
- .mousePressed(mc,
- x,
- y)) {
+ if (((GuiButton) button).id < 4 && ((GuiButton) button).mousePressed(mc, x, y)) {
if (((GuiButton) button).id != 3) {
- this.selectedItems.removeAll(
- selectedItems);
- this.selectedItemsPos.removeAll(
- selectedItemsPos);
+ this.selectedItems.removeAll(selectedItems);
+ this.selectedItemsPos.removeAll(selectedItemsPos);
} else {
this.selectedX = 0;
this.selectedY = 0;
this.selectedItem = null;
}
- ((GuiButton) buttonList
- .get(0)).enabled = true;
- ((GuiButton) buttonList
- .get(1)).enabled = true;
- ((GuiButton) buttonList
- .get(2)).enabled = true;
- ((GuiButton) buttonList
- .get(3)).enabled = true;
+ ((GuiButton) buttonList.get(0)).enabled = true;
+ ((GuiButton) buttonList.get(1)).enabled = true;
+ ((GuiButton) buttonList.get(2)).enabled = true;
+ ((GuiButton) buttonList.get(3)).enabled = true;
((GuiButton) button).enabled = false;
enabled = ((GuiButton) button).id;
}
}
int i = 0;
for (ItemStack item : JewelrycraftUtil.objects) {
- if (item != null && item.getItem() != null
- && (this.searchField
- .getText() == ""
- || item.getDisplayName()
- .toLowerCase()
- .contains(this.searchField
- .getText()
- .toLowerCase()))) {
- if (i >= (page - 1) * 48 && i < page * 48
- && x >= this.guiLeft + 88
- + 20 * (i % 6)
- && x < this.guiLeft + 108
- + 20 * (i % 6)
- && y >= this.guiTop + 9
- + 17 * (i / 6)
- - 136 * (page - 1)
- && y < this.guiTop + 25
- + 17 * (i / 6)
- - 136 * (page - 1)) {
+ if (item != null && item.getItem() != null && (this.searchField.getText() == ""
+ || item.getDisplayName().toLowerCase().contains(this.searchField.getText().toLowerCase()))) {
+ if (i >= (page - 1) * 48 && i < page * 48 && x >= this.guiLeft + 88 + 20 * (i % 6)
+ && x < this.guiLeft + 108 + 20 * (i % 6)
+ && y >= this.guiTop + 9 + 17 * (i / 6) - 136 * (page - 1)
+ && y < this.guiTop + 25 + 17 * (i / 6) - 136 * (page - 1)) {
try {
- if (!((GuiButton) buttonList
- .get(0)).enabled
- || !((GuiButton) buttonList
- .get(1)).enabled
- || !((GuiButton) buttonList
- .get(2)).enabled) {
+ if (!((GuiButton) buttonList.get(0)).enabled || !((GuiButton) buttonList.get(1)).enabled
+ || !((GuiButton) buttonList.get(2)).enabled) {
this.selectedItem = item;
- this.selectedX = 87
- + 20 * (i % 6);
- this.selectedY = 6
- + 17 * (i / 6)
- - 136 * (page - 1);
+ this.selectedX = 87 + 20 * (i % 6);
+ this.selectedY = 6 + 17 * (i / 6) - 136 * (page - 1);
this.selectedPage = page;
- } else if (!((GuiButton) buttonList
- .get(3)).enabled) {
+ } else if (!((GuiButton) buttonList.get(3)).enabled) {
Map<Integer, Map<Integer, Integer>> itemPage = new HashMap<>();
Map<Integer, Integer> pos = new HashMap<>();
- pos.put(87 + 20 * (i
- % 6),
- 6 + 17 * (i / 6) - 136
- * (page - 1));
- itemPage.put(page,
- pos);
- if (!this.selectedItems
- .contains(item)) {
- this.selectedItems
- .add(item);
- this.selectedItemsPos
- .add(itemPage);
+ pos.put(87 + 20 * (i % 6), 6 + 17 * (i / 6) - 136 * (page - 1));
+ itemPage.put(page, pos);
+ if (!this.selectedItems.contains(item)) {
+ this.selectedItems.add(item);
+ this.selectedItemsPos.add(itemPage);
} else {
- this.selectedItems
- .remove(item);
- this.selectedItemsPos
- .remove(itemPage);
+ this.selectedItems.remove(item);
+ this.selectedItemsPos.remove(itemPage);
}
}
} catch (Exception e) {
- JewelrycraftMod.logger
- .info("Trying to display an item but gets this error: "
- + e.getMessage()
- + "\nThe item causing the issue is: "
- + item);
+ JewelrycraftMod.logger.info("Trying to display an item but gets this error: " + e.getMessage()
+ + "\nThe item causing the issue is: " + item);
}
}
i++;
}
}
- if (((GuiButton) buttonList.get(5)).mousePressed(mc, x, y)
- && page > 1)
+ if (((GuiButton) buttonList.get(5)).mousePressed(mc, x, y) && page > 1)
page--;
- if (((GuiButton) buttonList.get(6)).mousePressed(mc, x, y)
- && page < maxPages)
+ if (((GuiButton) buttonList.get(6)).mousePressed(mc, x, y) && page < maxPages)
page++;
if (jMod.modInv.getStackInSlot(36) != null) {
- ItemStack targetItem = jMod.modInv
- .getStackInSlot(36).copy();
- if (((GuiButton) buttonList.get(4))
- .mousePressed(mc, x, y)
- && !((GuiButton) buttonList
- .get(0)).enabled) {
- JewelryNBT.addIngotColor(targetItem,
- 16777215);
- JewelryNBT.addMetal(targetItem,
- new ItemStack(Item
- .getItemById(0),
- 0, 0));
+ ItemStack targetItem = jMod.modInv.getStackInSlot(36).copy();
+ if (((GuiButton) buttonList.get(4)).mousePressed(mc, x, y) && !((GuiButton) buttonList.get(0)).enabled) {
+ JewelryNBT.addIngotColor(targetItem, 16777215);
+ JewelryNBT.addMetal(targetItem, new ItemStack(Item.getItemById(0), 0, 0));
if (selectedItem != null)
- JewelryNBT.addMetal(targetItem,
- this.selectedItem);
- JewelrycraftMod.netWrapper.sendToServer(
- new PacketRequestSetSlot(
- targetItem));
+ JewelryNBT.addMetal(targetItem, this.selectedItem);
+ JewelrycraftMod.netWrapper.sendToServer(new PacketRequestSetSlot(targetItem));
}
- if (((GuiButton) buttonList.get(4))
- .mousePressed(mc, x, y)
- && !((GuiButton) buttonList
- .get(1)).enabled) {
- JewelryNBT.addGemColor(targetItem,
- 16777215);
- JewelryNBT.addGem(targetItem,
- new ItemStack(Item
- .getItemById(0),
- 0, 0));
+ if (((GuiButton) buttonList.get(4)).mousePressed(mc, x, y) && !((GuiButton) buttonList.get(1)).enabled) {
+ JewelryNBT.addGemColor(targetItem, 16777215);
+ JewelryNBT.addGem(targetItem, new ItemStack(Item.getItemById(0), 0, 0));
if (selectedItem != null)
- JewelryNBT.addGem(targetItem,
- this.selectedItem);
- JewelrycraftMod.netWrapper.sendToServer(
- new PacketRequestSetSlot(
- targetItem));
+ JewelryNBT.addGem(targetItem, this.selectedItem);
+ JewelrycraftMod.netWrapper.sendToServer(new PacketRequestSetSlot(targetItem));
}
- if (((GuiButton) buttonList.get(4))
- .mousePressed(mc, x, y)
- && !((GuiButton) buttonList
- .get(2)).enabled) {
+ if (((GuiButton) buttonList.get(4)).mousePressed(mc, x, y) && !((GuiButton) buttonList.get(2)).enabled) {
if (selectedItem != null)
- JewelryNBT.addItem(targetItem,
- selectedItem);
- JewelrycraftMod.netWrapper.sendToServer(
- new PacketRequestSetSlot(
- targetItem));
+ JewelryNBT.addItem(targetItem, selectedItem);
+ JewelrycraftMod.netWrapper.sendToServer(new PacketRequestSetSlot(targetItem));
}
- if (((GuiButton) buttonList.get(4))
- .mousePressed(mc, x, y)
- && !((GuiButton) buttonList
- .get(3)).enabled) {
+ if (((GuiButton) buttonList.get(4)).mousePressed(mc, x, y) && !((GuiButton) buttonList.get(3)).enabled) {
if (!selectedItems.isEmpty())
- JewelryNBT.addModifiers(targetItem,
- selectedItems);
- JewelrycraftMod.netWrapper.sendToServer(
- new PacketRequestSetSlot(
- targetItem));
+ JewelryNBT.addModifiers(targetItem, selectedItems);
+ JewelrycraftMod.netWrapper.sendToServer(new PacketRequestSetSlot(targetItem));
}
}
this.pages.setText(page + "/" + maxPages);
@@ -318,34 +199,25 @@ public class GuiJewelryModifier extends GuiContainer { @Override
public void initGui() {
super.initGui();
- this.searchField = new GuiTextField(this.fontRendererObj,
- this.guiLeft + 89, this.guiTop + 148, 115,
+ this.searchField = new GuiTextField(this.fontRendererObj, this.guiLeft + 89, this.guiTop + 148, 115,
this.fontRendererObj.FONT_HEIGHT + 3);
this.searchField.setMaxStringLength(15);
this.searchField.setTextColor(16777215);
this.searchField.setVisible(true);
this.searchField.setCanLoseFocus(true);
- this.pages = new GuiTextField(this.fontRendererObj,
- this.guiLeft + 20, this.guiTop + 146, 50,
+ this.pages = new GuiTextField(this.fontRendererObj, this.guiLeft + 20, this.guiTop + 146, 50,
this.fontRendererObj.FONT_HEIGHT + 3);
this.pages.setMaxStringLength(15);
this.pages.setTextColor(16777215);
this.pages.setVisible(true);
this.pages.setText(page + "/" + maxPages);
- this.buttonList.add(new GuiButton(0, this.guiLeft + 17,
- this.guiTop + 30, 52, 20, "Metal"));
- this.buttonList.add(new GuiButton(1, this.guiLeft + 17,
- this.guiTop + 52, 52, 20, "Gem"));
- this.buttonList.add(new GuiButton(2, this.guiLeft + 17,
- this.guiTop + 74, 52, 20, "Item"));
- this.buttonList.add(new GuiButton(3, this.guiLeft + 17,
- this.guiTop + 96, 52, 20, "Modifiers"));
- this.buttonList.add(new GuiButton(4, this.guiLeft + 17,
- this.guiTop + 118, 52, 20, "Add Items"));
- this.buttonList.add(new GuiButton(5, this.guiLeft + 5,
- this.guiTop + 142, 13, 20, "<<"));
- this.buttonList.add(new GuiButton(6, this.guiLeft + 73,
- this.guiTop + 142, 13, 20, ">>"));
+ this.buttonList.add(new GuiButton(0, this.guiLeft + 17, this.guiTop + 30, 52, 20, "Metal"));
+ this.buttonList.add(new GuiButton(1, this.guiLeft + 17, this.guiTop + 52, 52, 20, "Gem"));
+ this.buttonList.add(new GuiButton(2, this.guiLeft + 17, this.guiTop + 74, 52, 20, "Item"));
+ this.buttonList.add(new GuiButton(3, this.guiLeft + 17, this.guiTop + 96, 52, 20, "Modifiers"));
+ this.buttonList.add(new GuiButton(4, this.guiLeft + 17, this.guiTop + 118, 52, 20, "Add Items"));
+ this.buttonList.add(new GuiButton(5, this.guiLeft + 5, this.guiTop + 142, 13, 20, "<<"));
+ this.buttonList.add(new GuiButton(6, this.guiLeft + 73, this.guiTop + 142, 13, 20, ">>"));
((GuiButton) buttonList.get(enabled)).enabled = false;
}
@@ -355,34 +227,17 @@ public class GuiJewelryModifier extends GuiContainer { int i = 0;
List<String> list = new ArrayList<>();
for (ItemStack item : JewelrycraftUtil.objects) {
- if (item != null && item.getItem() != null
- && (this.searchField
- .getText() == ""
- || item.getDisplayName()
- .toLowerCase()
- .contains(this.searchField
- .getText()
- .toLowerCase()))) {
- if (i >= (page - 1) * 48 && i < page * 48
- && x >= this.guiLeft + 88
- + 20 * (i % 6)
- && x < this.guiLeft + 108
- + 20 * (i % 6)
- && y >= this.guiTop + 9
- + 17 * (i / 6)
- - 136 * (page - 1)
- && y < this.guiTop + 25
- + 17 * (i / 6)
- - 136 * (page - 1)) {
+ if (item != null && item.getItem() != null && (this.searchField.getText() == ""
+ || item.getDisplayName().toLowerCase().contains(this.searchField.getText().toLowerCase()))) {
+ if (i >= (page - 1) * 48 && i < page * 48 && x >= this.guiLeft + 88 + 20 * (i % 6)
+ && x < this.guiLeft + 108 + 20 * (i % 6)
+ && y >= this.guiTop + 9 + 17 * (i / 6) - 136 * (page - 1)
+ && y < this.guiTop + 25 + 17 * (i / 6) - 136 * (page - 1)) {
list.add(item.getDisplayName());
- if (item.getTooltip(mc.thePlayer,
- mc.gameSettings.advancedItemTooltips) != null)
- this.renderToolTip(item, x,
- y);
+ if (item.getTooltip(mc.thePlayer, mc.gameSettings.advancedItemTooltips) != null)
+ this.renderToolTip(item, x, y);
else
- this.drawHoveringText(list,
- x, y,
- this.fontRendererObj);
+ this.drawHoveringText(list, x, y, this.fontRendererObj);
}
i++;
}
diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/GuiRectangle.java b/src/main/java/darkknight/jewelrycraft/client/gui/GuiRectangle.java index d5e2451..8951a8d 100755 --- a/src/main/java/darkknight/jewelrycraft/client/gui/GuiRectangle.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/GuiRectangle.java @@ -5,10 +5,10 @@ import java.util.Arrays; import net.minecraft.item.ItemStack;
public class GuiRectangle {
- private int x;
- private int y;
- private int w;
- private int h;
+ private int x;
+ private int y;
+ private int w;
+ private int h;
/**
* @param x
@@ -32,8 +32,7 @@ public class GuiRectangle { public boolean inRect(GuiGuide gui, int mouseX, int mouseY) {
mouseX -= gui.getLeft();
mouseY -= gui.getTop();
- return x <= mouseX && mouseX <= x + w && y <= mouseY
- && mouseY <= y + h;
+ return x <= mouseX && mouseX <= x + w && y <= mouseY && mouseY <= y + h;
}
/**
@@ -56,8 +55,7 @@ public class GuiRectangle { * @param srcY
*/
public void draw(GuiGuide gui, int srcX, int srcY) {
- gui.drawTexturedModalRect(gui.getLeft() + x,
- gui.getTop() + y, srcX, srcY, w, h);
+ gui.drawTexturedModalRect(gui.getLeft() + x, gui.getTop() + y, srcX, srcY, w, h);
}
/**
@@ -67,11 +65,8 @@ public class GuiRectangle { * @param width
* @param height
*/
- public void draw(GuiGuide gui, int srcX, int srcY, int width,
- int height) {
- gui.drawTexturedModalRect(gui.getLeft() + x,
- gui.getTop() + y, srcX, srcY, width,
- height);
+ public void draw(GuiGuide gui, int srcX, int srcY, int width, int height) {
+ gui.drawTexturedModalRect(gui.getLeft() + x, gui.getTop() + y, srcX, srcY, width, height);
}
/**
@@ -80,12 +75,9 @@ public class GuiRectangle { * @param mouseY
* @param str
*/
- public void drawString(GuiGuide gui, int mouseX, int mouseY,
- String str) {
+ public void drawString(GuiGuide gui, int mouseX, int mouseY, String str) {
if (inRect(gui, mouseX, mouseY))
- gui.drawHoverString(Arrays.asList(str.split("\n")),
- mouseX - gui.getLeft(),
- mouseY - gui.getTop());
+ gui.drawHoverString(Arrays.asList(str.split("\n")), mouseX - gui.getLeft(), mouseY - gui.getTop());
}
/**
diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/GuiRingChest.java b/src/main/java/darkknight/jewelrycraft/client/gui/GuiRingChest.java index 8013440..e20f888 100755 --- a/src/main/java/darkknight/jewelrycraft/client/gui/GuiRingChest.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/GuiRingChest.java @@ -8,15 +8,14 @@ import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.util.ResourceLocation;
public class GuiRingChest extends GuiContainer {
- public ContainerRingChest container;
- ResourceLocation texture;
+ public ContainerRingChest container;
+ ResourceLocation texture;
/**
* @param container
* @param texture
*/
- public GuiRingChest(ContainerRingChest container,
- ResourceLocation texture) {
+ public GuiRingChest(ContainerRingChest container, ResourceLocation texture) {
super(container);
this.container = container;
xSize = 176;
@@ -30,11 +29,9 @@ public class GuiRingChest extends GuiContainer { * @param mouseY
*/
@Override
- public void drawGuiContainerBackgroundLayer(float f, int mouseX,
- int mouseY) {
+ public void drawGuiContainerBackgroundLayer(float f, int mouseX, int mouseY) {
GL11.glColor3f(1, 1, 1);
- Minecraft.getMinecraft().getTextureManager()
- .bindTexture(texture);
+ Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
}
@@ -43,8 +40,7 @@ public class GuiRingChest extends GuiContainer { * @param mouseY
*/
@Override
- public void drawGuiContainerForegroundLayer(int mouseX,
- int mouseY) {
+ public void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
fontRendererObj.drawString("Linked Chest", 8, 6, 0x404040);
fontRendererObj.drawString("Inventory", 8, 72, 0x404040);
}
diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/GuiTab.java b/src/main/java/darkknight/jewelrycraft/client/gui/GuiTab.java index 27ad51f..3e5fbc6 100755 --- a/src/main/java/darkknight/jewelrycraft/client/gui/GuiTab.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/GuiTab.java @@ -5,8 +5,8 @@ import cpw.mods.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) public abstract class GuiTab extends GuiRectangle { - protected int values; - protected int del; + protected int values; + protected int del; public GuiTab(int id) { super(-62, 10 + 19 * id, 19, 18); @@ -18,17 +18,14 @@ public abstract class GuiTab extends GuiRectangle { return ""; } - public abstract void drawBackground(GuiGuide gui, int x, int y, - int page); + public abstract void drawBackground(GuiGuide gui, int x, int y, int page); - public abstract void drawForeground(GuiGuide gui, int x, int y, - int page); + public abstract void drawForeground(GuiGuide gui, int x, int y, int page); public void mouseClick(GuiGuide gui, int x, int y, int button) { } - public void mouseMoveClick(GuiGuide gui, int x, int y, int button, - long timeSinceClicked) { + public void mouseMoveClick(GuiGuide gui, int x, int y, int button, long timeSinceClicked) { } public void mouseReleased(GuiGuide gui, int x, int y, int button) { diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabBlocks.java b/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabBlocks.java index 6c72a13..63fa5bf 100755 --- a/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabBlocks.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabBlocks.java @@ -20,8 +20,7 @@ public class GuiTabBlocks extends GuiTab { @Override
public String getName() {
- return StatCollector.translateToLocal("guide."
- + Variables.MODID + ".tab.blocks");
+ return StatCollector.translateToLocal("guide." + Variables.MODID + ".tab.blocks");
}
/**
@@ -43,198 +42,114 @@ public class GuiTabBlocks extends GuiTab { String text = "";
int xPos = page % 2 == 0 ? 107 : -35;
switch (page) {
- case 1:
- text = "This ore is extremely rare and can be found only between Y-level 5 and 8. It can only be mined using a diamond pickaxe.";
- Page.addImageTextPage(gui,
- gui.getLeft() + xPos,
- gui.getTop(),
- new ItemStack(BlockList.shadowOre),
- text, 180f, 0, -18, true,
- 42, 100, true);
- break;
- case 2:
- text = "Magicians believed this block held the ability to merge with the shadows. It becomes more transparent as it gets darker. If a comparator is attached to it, the output strength will be equal to the value of darkness it is in.";
- Page.addCraftingRecipeTextPage(gui,
- gui.getLeft() + xPos,
- gui.getTop(), false, text,
- x, y, true,
- new ItemStack(BlockList.shadowBlock),
- new ItemStack(ItemList.shadowIngot),
- new ItemStack(ItemList.shadowIngot),
- new ItemStack(ItemList.shadowIngot),
- new ItemStack(ItemList.shadowIngot),
- new ItemStack(ItemList.shadowIngot),
- new ItemStack(ItemList.shadowIngot),
- new ItemStack(ItemList.shadowIngot),
- new ItemStack(ItemList.shadowIngot),
- new ItemStack(ItemList.shadowIngot));
- break;
- case 3:
- text = "The smelter is one of the first blocks needed to get started with Jewelrycraft. Requiring just some cobble and a couple buckets. It is required in order to melt ingots or even ores which can be made into rings, necklaces, bracelets or earrings. To use the block all you need to do";
- Page.addCraftingRecipeTextPage(gui,
- gui.getLeft() + xPos,
- gui.getTop(), false, text,
- x, y, true,
- new ItemStack(BlockList.smelter),
- new ItemStack(Blocks.cobblestone),
- new ItemStack(Items.bucket),
- new ItemStack(Blocks.cobblestone),
- new ItemStack(Blocks.cobblestone),
- null,
- new ItemStack(Blocks.cobblestone),
- new ItemStack(Blocks.cobblestone),
- new ItemStack(Items.lava_bucket),
- new ItemStack(Blocks.cobblestone));
- break;
- case 4:
- text = "is right click on it with any ore or ingot. It can melt multiple ingots/ores at a time. Crouch (default: Shift) + Right Click will remove all items added. If right clicked when done smelting, it will say what the block contains.";
- Page.addTextPage(gui, gui.getLeft() + xPos,
- gui.getTop(), text);
- break;
- case 5:
- text = "The molder is a key piece in creating jewelry. You need to pour the molten metal out of the smelter somewhere. That somewhere is the molder. But before pouring the molten metal in it, you must first add a mold. You can do that by simply right clicking the block with the mold of your";
- Page.addCraftingRecipeTextPage(gui,
- gui.getLeft() + xPos,
- gui.getTop(), false, text,
- x, y, true,
- new ItemStack(BlockList.molder),
- new ItemStack(Blocks.cobblestone),
- null,
- new ItemStack(Blocks.cobblestone),
- new ItemStack(Blocks.cobblestone),
- new ItemStack(Blocks.cobblestone),
- new ItemStack(Blocks.cobblestone));
- break;
- case 6:
- text = "choice. If you want to get the mold out, simply crouch and Right Click it with an empty hand. Once you have a mold inside, left click on the smelter and wait for the metal to cool down. When it's done, left click on the molder to get the jewellery. Be aware that this block must be placed directly in front of the smelter, otherwise it won't work!";
- Page.addTextPage(gui, gui.getLeft() + xPos,
- gui.getTop(), text);
- break;
- case 7:
- text = "This table allows you to add a gem to a piece of jewelry. Right click the block while holding jewelry to add it in. Then do the same with a gem (you can find a list with all possible gems in this guide). Crouch + Right Click to retreive placed items. Left Click the block to see the";
- if (del == 0)
- values++;
- del++;
- if (del >= 300)
- del = 0;
- if (values >= 4)
- values = 0;
- Page.addCraftingRecipeTextPage(gui,
- gui.getLeft() + xPos,
- gui.getTop(), false, text,
- x, y, true,
- new ItemStack(BlockList.jewelCraftingTable),
- new ItemStack(Blocks.planks,
- 1, values),
- new ItemStack(Blocks.planks,
- 1, values),
- new ItemStack(Blocks.planks,
- 1, values),
- new ItemStack(Blocks.stone),
- null,
- new ItemStack(Blocks.stone),
- new ItemStack(Blocks.stone),
- null,
- new ItemStack(Blocks.stone));
- break;
- case 8:
- text = "progress the crafting has made. Once the crafting is done, Left Click the block to get the item. You are able to recraft a jewellery by readding the modified version to this block and adding a different gem to it. Once the crafting is done, the current gem will be replaced by the new one. There is also a 50% chance that you will get back the old gem.";
- Page.addTextPage(gui, gui.getLeft() + xPos,
- gui.getTop(), text);
- break;
- case 9:
- text = "The Storage Displayer, as the name suggests, can store a large amount (Up to: "
- + Integer.MAX_VALUE
- + ") of a single item/block placed in it. It will display all possible infromation about the object in it, such as the name, durability, enchantments etc. To store something in it";
- Page.addCraftingRecipeTextPage(gui,
- gui.getLeft() + xPos,
- gui.getTop(), false, text,
- x, y, true,
- new ItemStack(BlockList.displayer),
- null,
- new ItemStack(Items.iron_ingot),
- null,
- new ItemStack(Items.iron_ingot),
- new ItemStack(Items.iron_ingot),
- new ItemStack(Items.iron_ingot),
- new ItemStack(Blocks.emerald_block),
- new ItemStack(Blocks.emerald_block),
- new ItemStack(Blocks.emerald_block));
- break;
- case 10:
- text = "simply right click with that object on it and the whole amount of items or blocks you are holding will be immediately stored inside. If a displayer already contains an item and you have that in your inventory, you can simply hold right click on it with an empty hand to add all of your items of that type from your inventory. To retrieve a single item just left click the block. If you wish to get a whole stack, Crouch + Left Click on it. In creative mode you can simply hold Right";
- Page.addTextPage(gui, gui.getLeft() + xPos,
- gui.getTop(), text);
- break;
- case 11:
- text = "Click on a displayer containing an object and it will add 64 of it with every right click, without it being in your inventory.";
- Page.addTextPage(gui, gui.getLeft() + xPos,
- gui.getTop(), text);
- break;
- case 12:
- text = "This mysterious shaped block is used in the ritual. The acient ones claimed it had the power to travel through worlds. They would use these to offer sacrifices to 'The Dark One' in exchange for unimaginable powers.";
- Page.addCraftingRecipeTextPage(gui,
- gui.getLeft() + xPos,
- gui.getTop(), false, text,
- x, y, true,
- new ItemStack(BlockList.handPedestal),
- new ItemStack(Blocks.cobblestone_wall),
- new ItemStack(Blocks.cobblestone_wall),
- new ItemStack(Blocks.cobblestone_wall),
- null,
- new ItemStack(Blocks.stonebrick),
- null,
- new ItemStack(Blocks.stone_slab,
- 1, 5),
- new ItemStack(Blocks.stonebrick),
- new ItemStack(Blocks.stone_slab,
- 1, 5));
- break;
- case 13:
- text = "The Cursed Eye is an ancient artifact also known as 'The Dark One's Eye'. It is part of the sacrifice ritual the ancient ones talk about. Be careful though, for He sees everything. To see how to create the ritual look in the Ritual tab. One you created the ritual, simply place a";
- Page.addCraftingRecipeTextPage(gui,
- gui.getLeft() + xPos,
- gui.getTop(), false, text,
- x, y, true,
- new ItemStack(BlockList.shadowEye),
- new ItemStack(Blocks.stonebrick),
- new ItemStack(Blocks.stained_hardened_clay,
- 1, 15),
- new ItemStack(Blocks.stonebrick),
- new ItemStack(Blocks.stained_hardened_clay,
- 1, 15),
- new ItemStack(Items.ender_eye),
- new ItemStack(Blocks.stained_hardened_clay,
- 1, 15),
- new ItemStack(Blocks.stonebrick),
- new ItemStack(Blocks.stained_hardened_clay,
- 1, 15),
- new ItemStack(Blocks.stonebrick));
- break;
- case 14:
- text = "piece of jewelry in the middle pedestal and your modifiers of choice in the other ones (you don't need to put an item in every single pedestal). After you do that simply right click the eye to activate the ritual. Be careful not to leave the premise or you'll die! When the ritual is done, Shift+Right Click on the central hand pedestal to retrieve your newly modified item!";
- Page.addTextPage(gui, gui.getLeft() + xPos,
- gui.getTop(), text);
- break;
- case 15:
- if (del == 0)
- values++;
- del++;
- if (del >= 50)
- del = 0;
- if (values >= 15)
- values = 0;
- text = "Crystals don't do much as of yet. They spawn naturally in caves and come in all 16 colors.";
- Page.addImageTextPage(gui,
- gui.getLeft() + xPos,
- gui.getTop(),
- new ItemStack(BlockList.crystal,
- 1, values),
- text, 180f, 0, -18, true,
- 48, 120, true);
- break;
- default:
- ;
+ case 1:
+ text = "This ore is extremely rare and can be found only between Y-level 5 and 8. It can only be mined using a diamond pickaxe.";
+ Page.addImageTextPage(gui, gui.getLeft() + xPos, gui.getTop(), new ItemStack(BlockList.shadowOre), text,
+ 180f, 0, -18, true, 42, 100, true);
+ break;
+ case 2:
+ text = "Magicians believed this block held the ability to merge with the shadows. It becomes more transparent as it gets darker. If a comparator is attached to it, the output strength will be equal to the value of darkness it is in.";
+ Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, x, y, true,
+ new ItemStack(BlockList.shadowBlock), new ItemStack(ItemList.shadowIngot),
+ new ItemStack(ItemList.shadowIngot), new ItemStack(ItemList.shadowIngot),
+ new ItemStack(ItemList.shadowIngot), new ItemStack(ItemList.shadowIngot),
+ new ItemStack(ItemList.shadowIngot), new ItemStack(ItemList.shadowIngot),
+ new ItemStack(ItemList.shadowIngot), new ItemStack(ItemList.shadowIngot));
+ break;
+ case 3:
+ text = "The smelter is one of the first blocks needed to get started with Jewelrycraft. Requiring just some cobble and a couple buckets. It is required in order to melt ingots or even ores which can be made into rings, necklaces, bracelets or earrings. To use the block all you need to do";
+ Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, x, y, true,
+ new ItemStack(BlockList.smelter), new ItemStack(Blocks.cobblestone), new ItemStack(Items.bucket),
+ new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.cobblestone), null,
+ new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.cobblestone),
+ new ItemStack(Items.lava_bucket), new ItemStack(Blocks.cobblestone));
+ break;
+ case 4:
+ text = "is right click on it with any ore or ingot. It can melt multiple ingots/ores at a time. Crouch (default: Shift) + Right Click will remove all items added. If right clicked when done smelting, it will say what the block contains.";
+ Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text);
+ break;
+ case 5:
+ text = "The molder is a key piece in creating jewelry. You need to pour the molten metal out of the smelter somewhere. That somewhere is the molder. But before pouring the molten metal in it, you must first add a mold. You can do that by simply right clicking the block with the mold of your";
+ Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, x, y, true,
+ new ItemStack(BlockList.molder), new ItemStack(Blocks.cobblestone), null,
+ new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.cobblestone),
+ new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.cobblestone));
+ break;
+ case 6:
+ text = "choice. If you want to get the mold out, simply crouch and Right Click it with an empty hand. Once you have a mold inside, left click on the smelter and wait for the metal to cool down. When it's done, left click on the molder to get the jewellery. Be aware that this block must be placed directly in front of the smelter, otherwise it won't work!";
+ Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text);
+ break;
+ case 7:
+ text = "This table allows you to add a gem to a piece of jewelry. Right click the block while holding jewelry to add it in. Then do the same with a gem (you can find a list with all possible gems in this guide). Crouch + Right Click to retreive placed items. Left Click the block to see the";
+ if (del == 0)
+ values++;
+ del++;
+ if (del >= 300)
+ del = 0;
+ if (values >= 4)
+ values = 0;
+ Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, x, y, true,
+ new ItemStack(BlockList.jewelCraftingTable), new ItemStack(Blocks.planks, 1, values),
+ new ItemStack(Blocks.planks, 1, values), new ItemStack(Blocks.planks, 1, values),
+ new ItemStack(Blocks.stone), null, new ItemStack(Blocks.stone), new ItemStack(Blocks.stone), null,
+ new ItemStack(Blocks.stone));
+ break;
+ case 8:
+ text = "progress the crafting has made. Once the crafting is done, Left Click the block to get the item. You are able to recraft a jewellery by readding the modified version to this block and adding a different gem to it. Once the crafting is done, the current gem will be replaced by the new one. There is also a 50% chance that you will get back the old gem.";
+ Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text);
+ break;
+ case 9:
+ text = "The Storage Displayer, as the name suggests, can store a large amount (Up to: " + Integer.MAX_VALUE
+ + ") of a single item/block placed in it. It will display all possible infromation about the object in it, such as the name, durability, enchantments etc. To store something in it";
+ Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, x, y, true,
+ new ItemStack(BlockList.displayer), null, new ItemStack(Items.iron_ingot), null,
+ new ItemStack(Items.iron_ingot), new ItemStack(Items.iron_ingot), new ItemStack(Items.iron_ingot),
+ new ItemStack(Blocks.emerald_block), new ItemStack(Blocks.emerald_block),
+ new ItemStack(Blocks.emerald_block));
+ break;
+ case 10:
+ text = "simply right click with that object on it and the whole amount of items or blocks you are holding will be immediately stored inside. If a displayer already contains an item and you have that in your inventory, you can simply hold right click on it with an empty hand to add all of your items of that type from your inventory. To retrieve a single item just left click the block. If you wish to get a whole stack, Crouch + Left Click on it. In creative mode you can simply hold Right";
+ Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text);
+ break;
+ case 11:
+ text = "Click on a displayer containing an object and it will add 64 of it with every right click, without it being in your inventory.";
+ Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text);
+ break;
+ case 12:
+ text = "This mysterious shaped block is used in the ritual. The acient ones claimed it had the power to travel through worlds. They would use these to offer sacrifices to 'The Dark One' in exchange for unimaginable powers.";
+ Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, x, y, true,
+ new ItemStack(BlockList.handPedestal), new ItemStack(Blocks.cobblestone_wall),
+ new ItemStack(Blocks.cobblestone_wall), new ItemStack(Blocks.cobblestone_wall), null,
+ new ItemStack(Blocks.stonebrick), null, new ItemStack(Blocks.stone_slab, 1, 5),
+ new ItemStack(Blocks.stonebrick), new ItemStack(Blocks.stone_slab, 1, 5));
+ break;
+ case 13:
+ text = "The Cursed Eye is an ancient artifact also known as 'The Dark One's Eye'. It is part of the sacrifice ritual the ancient ones talk about. Be careful though, for He sees everything. To see how to create the ritual look in the Ritual tab. One you created the ritual, simply place a";
+ Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, x, y, true,
+ new ItemStack(BlockList.shadowEye), new ItemStack(Blocks.stonebrick),
+ new ItemStack(Blocks.stained_hardened_clay, 1, 15), new ItemStack(Blocks.stonebrick),
+ new ItemStack(Blocks.stained_hardened_clay, 1, 15), new ItemStack(Items.ender_eye),
+ new ItemStack(Blocks.stained_hardened_clay, 1, 15), new ItemStack(Blocks.stonebrick),
+ new ItemStack(Blocks.stained_hardened_clay, 1, 15), new ItemStack(Blocks.stonebrick));
+ break;
+ case 14:
+ text = "piece of jewelry in the middle pedestal and your modifiers of choice in the other ones (you don't need to put an item in every single pedestal). After you do that simply right click the eye to activate the ritual. Be careful not to leave the premise or you'll die! When the ritual is done, Shift+Right Click on the central hand pedestal to retrieve your newly modified item!";
+ Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text);
+ break;
+ case 15:
+ if (del == 0)
+ values++;
+ del++;
+ if (del >= 50)
+ del = 0;
+ if (values >= 15)
+ values = 0;
+ text = "Crystals don't do much as of yet. They spawn naturally in caves and come in all 16 colors.";
+ Page.addImageTextPage(gui, gui.getLeft() + xPos, gui.getTop(), new ItemStack(BlockList.crystal, 1, values),
+ text, 180f, 0, -18, true, 48, 120, true);
+ break;
+ default:
+ ;
}
}
diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabCurses.java b/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabCurses.java index cd18b64..f93d9de 100755 --- a/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabCurses.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabCurses.java @@ -14,8 +14,7 @@ public class GuiTabCurses extends GuiTab { @Override
public String getName() {
- return StatCollector.translateToLocal("guide."
- + Variables.MODID + ".tab.curses");
+ return StatCollector.translateToLocal("guide." + Variables.MODID + ".tab.curses");
}
@Override
@@ -28,151 +27,63 @@ public class GuiTabCurses extends GuiTab { String text = "";
int xPos = page % 2 == 0 ? 107 : -35;
switch (page) {
- case 1:
- text = "You are poisoned for as long as this curse is active.";
- Page.addImageTextPage(gui,
- gui.getLeft() + xPos,
- gui.getTop() - 5,
- new ItemStack(ItemList.testItem,
- 1, 0),
- text, 40f, 0, 0,
- Curse.getCurseList().get(
- page - 1)
- .getDisplayName(),
- 45, 10, false);
- break;
- case 2:
- text = "Whenever you attack an entity you are set on fire.";
- Page.addImageTextPage(gui,
- gui.getLeft() + xPos,
- gui.getTop() - 5,
- new ItemStack(ItemList.testItem,
- 1, 1),
- text, 40f, 0, 0,
- Curse.getCurseList().get(
- page - 1)
- .getDisplayName(),
- 45, 10, false);
- break;
- case 3:
- text = "You can no longer throw any item. I mean, you might need them later, right?";
- Page.addImageTextPage(gui,
- gui.getLeft() + xPos,
- gui.getTop() - 5,
- new ItemStack(ItemList.testItem,
- 1, 2),
- text, 40f, 0, 0,
- Curse.getCurseList().get(
- page - 1)
- .getDisplayName(),
- 45, 10, false);
- break;
- case 4:
- text = "You are blinded. Literally. I mean, what did you expect?";
- Page.addImageTextPage(gui,
- gui.getLeft() + xPos,
- gui.getTop() - 5,
- new ItemStack(ItemList.testItem,
- 1, 3),
- text, 40f, 0, 0,
- Curse.getCurseList().get(
- page - 1)
- .getDisplayName(),
- 45, 10, false);
- break;
- case 5:
- text = "There is a random chance that when you attack a passive mob you will lose a full heart, but gain a black heart.";
- Page.addImageTextPage(gui,
- gui.getLeft() + xPos,
- gui.getTop() - 5,
- new ItemStack(ItemList.testItem,
- 1, 4),
- text, 40f, 0, 0,
- Curse.getCurseList().get(
- page - 1)
- .getDisplayName(),
- 45, 10, false);
- break;
- case 6:
- text = "Whatever you touch turns into gold. Believe me, this is no good to you, you can't even harvest this gold. At lest the items you can't. But if you touched an entity with your bear hands while the curse is active and then no longer have it, you should be able to mine it with an iron pick or higher. THe golden statue will drop gold nuggets depending on the size of the entity.";
- Page.addImageTextPage(gui,
- gui.getLeft() + xPos,
- gui.getTop() - 5,
- new ItemStack(ItemList.testItem,
- 1, 5),
- text, 40f, 0, 0,
- Curse.getCurseList().get(
- page - 1)
- .getDisplayName(),
- 45, 10, false);
- break;
- case 7:
- text = "Entities have a higher chance of dropping more items and hearts when killed.";
- Page.addImageTextPage(gui,
- gui.getLeft() + xPos,
- gui.getTop() - 5,
- new ItemStack(ItemList.testItem,
- 1, 6),
- text, 40f, 0, 0,
- Curse.getCurseList().get(
- page - 1)
- .getDisplayName(),
- 45, 10, false);
- break;
- case 8:
- text = "There is a random chance that you'll steal 1 heart from an entity that is collided with you. If you are low on health, you will heal. If you are fully healed, an extra heart will be added to you. You can steal up to 2 hearts per entity (3 if you complete the challenge). When you steal a heart, that entity will have their max health reduced by 1. Challenges are found in the Achievements menu.";
- Page.addImageTextPage(gui,
- gui.getLeft() + xPos,
- gui.getTop() - 5,
- new ItemStack(ItemList.testItem,
- 1, 7),
- text, 40f, 0, 0,
- Curse.getCurseList().get(
- page - 1)
- .getDisplayName(),
- 45, 10, false);
- break;
- case 9:
- text = "When you attack an entity and are low on health, there is a 50% chance that you'll heal half a heart. Also you will catch on fire if you're exposed to sun.";
- Page.addImageTextPage(gui,
- gui.getLeft() + xPos,
- gui.getTop() - 5,
- new ItemStack(ItemList.testItem,
- 1, 8),
- text, 40f, 0, 0,
- Curse.getCurseList().get(
- page - 1)
- .getDisplayName(),
- 45, 10, false);
- break;
- case 10:
- text = "Any mob you kill or block you destroy(eg. Diamond Ore, Redstone Ore, stuff that drops items not the block itself) drops double the amount of items it normally would.";
- Page.addImageTextPage(gui,
- gui.getLeft() + xPos,
- gui.getTop() - 5,
- new ItemStack(ItemList.testItem,
- 1, 9),
- text, 40f, 0, 0,
- Curse.getCurseList().get(
- page - 1)
- .getDisplayName(),
- 45, 10, false);
- break;
- case 11:
- text = "All the damage you do pierces through armor or any other type of defense, but creatures no longer drop XP.";
- Page.addImageTextPage(gui,
- gui.getLeft() + xPos,
- gui.getTop() - 5,
- new ItemStack(ItemList.testItem,
- 1, 10),
- text, 40f, 0, 0,
- Curse.getCurseList().get(
- page - 1)
- .getDisplayName(),
- 45, 10, false);
- break;
- default:
- ;
+ case 1:
+ text = "You are poisoned for as long as this curse is active.";
+ Page.addImageTextPage(gui, gui.getLeft() + xPos, gui.getTop() - 5, new ItemStack(ItemList.testItem, 1, 0),
+ text, 40f, 0, 0, Curse.getCurseList().get(page - 1).getDisplayName(), 45, 10, false);
+ break;
+ case 2:
+ text = "Whenever you attack an entity you are set on fire.";
+ Page.addImageTextPage(gui, gui.getLeft() + xPos, gui.getTop() - 5, new ItemStack(ItemList.testItem, 1, 1),
+ text, 40f, 0, 0, Curse.getCurseList().get(page - 1).getDisplayName(), 45, 10, false);
+ break;
+ case 3:
+ text = "You can no longer throw any item. I mean, you might need them later, right?";
+ Page.addImageTextPage(gui, gui.getLeft() + xPos, gui.getTop() - 5, new ItemStack(ItemList.testItem, 1, 2),
+ text, 40f, 0, 0, Curse.getCurseList().get(page - 1).getDisplayName(), 45, 10, false);
+ break;
+ case 4:
+ text = "You are blinded. Literally. I mean, what did you expect?";
+ Page.addImageTextPage(gui, gui.getLeft() + xPos, gui.getTop() - 5, new ItemStack(ItemList.testItem, 1, 3),
+ text, 40f, 0, 0, Curse.getCurseList().get(page - 1).getDisplayName(), 45, 10, false);
+ break;
+ case 5:
+ text = "There is a random chance that when you attack a passive mob you will lose a full heart, but gain a black heart.";
+ Page.addImageTextPage(gui, gui.getLeft() + xPos, gui.getTop() - 5, new ItemStack(ItemList.testItem, 1, 4),
+ text, 40f, 0, 0, Curse.getCurseList().get(page - 1).getDisplayName(), 45, 10, false);
+ break;
+ case 6:
+ text = "Whatever you touch turns into gold. Believe me, this is no good to you, you can't even harvest this gold. At lest the items you can't. But if you touched an entity with your bear hands while the curse is active and then no longer have it, you should be able to mine it with an iron pick or higher. THe golden statue will drop gold nuggets depending on the size of the entity.";
+ Page.addImageTextPage(gui, gui.getLeft() + xPos, gui.getTop() - 5, new ItemStack(ItemList.testItem, 1, 5),
+ text, 40f, 0, 0, Curse.getCurseList().get(page - 1).getDisplayName(), 45, 10, false);
+ break;
+ case 7:
+ text = "Entities have a higher chance of dropping more items and hearts when killed.";
+ Page.addImageTextPage(gui, gui.getLeft() + xPos, gui.getTop() - 5, new ItemStack(ItemList.testItem, 1, 6),
+ text, 40f, 0, 0, Curse.getCurseList().get(page - 1).getDisplayName(), 45, 10, false);
+ break;
+ case 8:
+ text = "There is a random chance that you'll steal 1 heart from an entity that is collided with you. If you are low on health, you will heal. If you are fully healed, an extra heart will be added to you. You can steal up to 2 hearts per entity (3 if you complete the challenge). When you steal a heart, that entity will have their max health reduced by 1. Challenges are found in the Achievements menu.";
+ Page.addImageTextPage(gui, gui.getLeft() + xPos, gui.getTop() - 5, new ItemStack(ItemList.testItem, 1, 7),
+ text, 40f, 0, 0, Curse.getCurseList().get(page - 1).getDisplayName(), 45, 10, false);
+ break;
+ case 9:
+ text = "When you attack an entity and are low on health, there is a 50% chance that you'll heal half a heart. Also you will catch on fire if you're exposed to sun.";
+ Page.addImageTextPage(gui, gui.getLeft() + xPos, gui.getTop() - 5, new ItemStack(ItemList.testItem, 1, 8),
+ text, 40f, 0, 0, Curse.getCurseList().get(page - 1).getDisplayName(), 45, 10, false);
+ break;
+ case 10:
+ text = "Any mob you kill or block you destroy(eg. Diamond Ore, Redstone Ore, stuff that drops items not the block itself) drops double the amount of items it normally would.";
+ Page.addImageTextPage(gui, gui.getLeft() + xPos, gui.getTop() - 5, new ItemStack(ItemList.testItem, 1, 9),
+ text, 40f, 0, 0, Curse.getCurseList().get(page - 1).getDisplayName(), 45, 10, false);
+ break;
+ case 11:
+ text = "All the damage you do pierces through armor or any other type of defense, but creatures no longer drop XP.";
+ Page.addImageTextPage(gui, gui.getLeft() + xPos, gui.getTop() - 5, new ItemStack(ItemList.testItem, 1, 10),
+ text, 40f, 0, 0, Curse.getCurseList().get(page - 1).getDisplayName(), 45, 10, false);
+ break;
+ default:
+ ;
}
}
diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabGemsAndIngots.java b/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabGemsAndIngots.java index f161cdd..f7adc74 100755 --- a/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabGemsAndIngots.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabGemsAndIngots.java @@ -20,8 +20,7 @@ public class GuiTabGemsAndIngots extends GuiTab { @Override
public String getName() {
- return StatCollector.translateToLocal(
- "guide." + Variables.MODID + ".tab.misc");
+ return StatCollector.translateToLocal("guide." + Variables.MODID + ".tab.misc");
}
/**
@@ -46,106 +45,46 @@ public class GuiTabGemsAndIngots extends GuiTab { if (i < JewelrycraftUtil.gem.size()) {
GL11.glPushMatrix();
if (i == (page - 1) * 12)
- gui.getFont().drawString(
- EnumChatFormatting.DARK_BLUE
- + "\u00a7n"
- + "Gems",
- gui.getLeft() + xPos
- + 40,
- gui.getTop(), 0);
+ gui.getFont().drawString(EnumChatFormatting.DARK_BLUE + "\u00a7n" + "Gems",
+ gui.getLeft() + xPos + 40, gui.getTop(), 0);
GL11.glScalef(scale, scale, 0f);
- gui.getFont().drawString(String.format(
- "%-1.26s",
- JewelrycraftUtil.gem.get(i)
- .getDisplayName()),
- (int) ((gui.getLeft()
- + xPos
- + 12)
- / scale),
- (int) ((gui.getTop() + 12
- + 12 * (i - 12 * (page
- - 1)))
- / scale),
- 0);
+ gui.getFont().drawString(String.format("%-1.26s", JewelrycraftUtil.gem.get(i).getDisplayName()),
+ (int) ((gui.getLeft() + xPos + 12) / scale),
+ (int) ((gui.getTop() + 12 + 12 * (i - 12 * (page - 1))) / scale), 0);
GL11.glPopMatrix();
- gui.renderItem(JewelrycraftUtil.gem.get(i),
- gui.getLeft() + xPos + 5,
- gui.getTop() + 18 + 12 * (i
- - 12 * (page - 1)),
- 24f, true, 0, 0, 0);
+ gui.renderItem(JewelrycraftUtil.gem.get(i), gui.getLeft() + xPos + 5,
+ gui.getTop() + 18 + 12 * (i - 12 * (page - 1)), 24f, true, 0, 0, 0);
}
page -= JewelrycraftUtil.gem.size() / 13 + 1;
for (int i = (page - 1) * 12; i < page * 12; i++)
- if (i < JewelrycraftUtil.metal.size()
- && page > 0) {
+ if (i < JewelrycraftUtil.metal.size() && page > 0) {
GL11.glPushMatrix();
if (i == (page - 1) * 12)
- gui.getFont().drawString(
- EnumChatFormatting.DARK_BLUE
- + "\u00a7n"
- + "Ingots",
- gui.getLeft() + xPos
- + 40,
- gui.getTop(), 0);
+ gui.getFont().drawString(EnumChatFormatting.DARK_BLUE + "\u00a7n" + "Ingots",
+ gui.getLeft() + xPos + 40, gui.getTop(), 0);
GL11.glScalef(scale, scale, 0f);
- gui.getFont().drawString(String.format(
- "%-1.18s",
- JewelrycraftUtil.metal
- .get(i)
- .copy()
- .getDisplayName()),
- (int) ((gui.getLeft()
- + xPos
- + 12)
- / scale),
- (int) ((gui.getTop() + 12
- + 12 * (i - 12 * (page
- - 1)))
- / scale),
- 0);
+ gui.getFont().drawString(
+ String.format("%-1.18s", JewelrycraftUtil.metal.get(i).copy().getDisplayName()),
+ (int) ((gui.getLeft() + xPos + 12) / scale),
+ (int) ((gui.getTop() + 12 + 12 * (i - 12 * (page - 1))) / scale), 0);
GL11.glPopMatrix();
- gui.renderItem(JewelrycraftUtil.metal
- .get(i),
- gui.getLeft() + xPos + 5,
- gui.getTop() + 18 + 12 * (i
- - 12 * (page - 1)),
- 24f, true, 0, 0, 0);
+ gui.renderItem(JewelrycraftUtil.metal.get(i), gui.getLeft() + xPos + 5,
+ gui.getTop() + 18 + 12 * (i - 12 * (page - 1)), 24f, true, 0, 0, 0);
}
page -= JewelrycraftUtil.metal.size() / 13 + 1;
for (int i = (page - 1) * 12; i < page * 12; i++)
if (i < JewelrycraftUtil.ores.size() && page > 0) {
GL11.glPushMatrix();
if (i == (page - 1) * 12)
- gui.getFont().drawString(
- EnumChatFormatting.DARK_BLUE
- + "\u00a7n"
- + "Ores",
- gui.getLeft() + xPos
- + 40,
- gui.getTop(), 0);
+ gui.getFont().drawString(EnumChatFormatting.DARK_BLUE + "\u00a7n" + "Ores",
+ gui.getLeft() + xPos + 40, gui.getTop(), 0);
GL11.glScalef(scale, scale, 0f);
- gui.getFont().drawString(String.format(
- "%-1.18s",
- JewelrycraftUtil.ores
- .get(i)
- .copy()
- .getDisplayName()),
- (int) ((gui.getLeft()
- + xPos
- + 12)
- / scale),
- (int) ((gui.getTop() + 12
- + 12 * (i - 12 * (page
- - 1)))
- / scale),
- 0);
+ gui.getFont().drawString(String.format("%-1.18s", JewelrycraftUtil.ores.get(i).copy().getDisplayName()),
+ (int) ((gui.getLeft() + xPos + 12) / scale),
+ (int) ((gui.getTop() + 12 + 12 * (i - 12 * (page - 1))) / scale), 0);
GL11.glPopMatrix();
- gui.renderItem(JewelrycraftUtil.ores
- .get(i),
- gui.getLeft() + xPos + 5,
- gui.getTop() + 18 + 12 * (i
- - 12 * (page - 1)),
- 24f, true, 0, 0, 0);
+ gui.renderItem(JewelrycraftUtil.ores.get(i), gui.getLeft() + xPos + 5,
+ gui.getTop() + 18 + 12 * (i - 12 * (page - 1)), 24f, true, 0, 0, 0);
}
}
@@ -154,8 +93,7 @@ public class GuiTabGemsAndIngots extends GuiTab { */
@Override
public int getMaxPages() {
- return (JewelrycraftUtil.gem.size() / 13)
- + (JewelrycraftUtil.metal.size() / 13)
+ return (JewelrycraftUtil.gem.size() / 13) + (JewelrycraftUtil.metal.size() / 13)
+ (JewelrycraftUtil.ores.size() / 13) + 3;
}
diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabIntroduction.java b/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabIntroduction.java index fe22374..c05cf30 100755 --- a/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabIntroduction.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabIntroduction.java @@ -18,8 +18,7 @@ public class GuiTabIntroduction extends GuiTab { @Override
public String getName() {
- return StatCollector.translateToLocal("guide."
- + Variables.MODID + ".tab.introduction");
+ return StatCollector.translateToLocal("guide." + Variables.MODID + ".tab.introduction");
}
@Override
@@ -27,22 +26,14 @@ public class GuiTabIntroduction extends GuiTab { String text = "";
int xPos = page % 2 == 0 ? 107 : -35;
switch (page) {
- case 1:
- text = StatCollector.translateToLocal(
- "guide." + Variables.MODID
- + ".tab.introduction."
- + page);
- Page.addTextPage(gui, gui.getLeft() + xPos,
- gui.getTop(), text);
- break;
- case 2:
- text = StatCollector.translateToLocal(
- "guide." + Variables.MODID
- + ".tab.introduction."
- + page);
- Page.addTextPage(gui, gui.getLeft() + xPos,
- gui.getTop(), text);
- break;
+ case 1:
+ text = StatCollector.translateToLocal("guide." + Variables.MODID + ".tab.introduction." + page);
+ Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text);
+ break;
+ case 2:
+ text = StatCollector.translateToLocal("guide." + Variables.MODID + ".tab.introduction." + page);
+ Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text);
+ break;
}
}
diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabItems.java b/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabItems.java index 5b9bf55..af07477 100755 --- a/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabItems.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabItems.java @@ -26,8 +26,7 @@ public class GuiTabItems extends GuiTab { @Override
public String getName() {
- return StatCollector.translateToLocal(
- "guide." + Variables.MODID + ".tab.items");
+ return StatCollector.translateToLocal("guide." + Variables.MODID + ".tab.items");
}
/**
@@ -49,218 +48,119 @@ public class GuiTabItems extends GuiTab { String text = "";
int xPos = page % 2 == 0 ? 107 : -35;
switch (page) {
- case 1:
- text = "Shadow ingots are obtained by smelting shadow ore. They are used in a few recipes and an important key for making some jewelry work.";
- Page.addSmeltingRecipeTextPage(gui,
- gui.getLeft() + xPos,
- gui.getTop(), text, x, y,
- true,
- new ItemStack(BlockList.shadowOre),
- new ItemStack(ItemList.shadowIngot));
- break;
- case 2:
- text = "These gloves give you the chance to steal the trades those pesky Testificates have to offer. To use these simply open their gui at least once, then Crouch and right click on the them to hopefully steal the trades. If you traded with him before, then you have a chance of getting the traded";
- Page.addCraftingRecipeTextPage(gui,
- gui.getLeft() + xPos,
- gui.getTop(), false, text,
- x, y, true,
- new ItemStack(ItemList.thiefGloves),
- new ItemStack(ItemList.shadowIngot),
- null,
- new ItemStack(ItemList.shadowIngot),
- new ItemStack(Blocks.wool,
- 1, 15),
- new ItemStack(ItemList.shadowIngot),
- new ItemStack(Blocks.wool,
- 1, 15),
- new ItemStack(Blocks.wool,
- 1, 15),
- new ItemStack(ItemList.shadowIngot),
- new ItemStack(Blocks.wool,
- 1, 15));
- break;
- case 3:
- text = "emeralds back as well. This has a maximum of 10 uses before it breaks.";
- Page.addTextPage(gui, gui.getLeft() + xPos,
- gui.getTop(), text);
- break;
- case 4:
- text = "In order to get the ingot back from the smelter you need a mold for it. However, this mold can't be used. It is too soft. It needs to be hardened in order for it to be used.";
- Page.addCraftingRecipeTextPage(gui,
- gui.getLeft() + xPos,
- gui.getTop(), true, text,
- x, y, true,
- new ItemStack(ItemList.clayMolds,
- 1, 0),
- new ItemStack(Items.clay_ball),
- new ItemStack(Items.clay_ball));
- break;
- case 5:
- text = "To create a ring you need a mold for it. However, this one is too soft to be used. It needs to be hardened in order for it to be used.";
- Page.addCraftingRecipeTextPage(gui,
- gui.getLeft() + xPos,
- gui.getTop(), false, text,
- x, y, true,
- new ItemStack(ItemList.clayMolds,
- 1, 1),
- null,
- new ItemStack(Items.clay_ball),
- null,
- new ItemStack(Items.clay_ball),
- null,
- new ItemStack(Items.clay_ball),
- null,
- new ItemStack(Items.clay_ball),
- null);
- break;
- case 6:
- text = "To create a necklace you need a mold for it. However, this one can't be used. It is too soft. It needs to be hardened in order for it to be used.";
- Page.addCraftingRecipeTextPage(gui,
- gui.getLeft() + xPos,
- gui.getTop(), false, text,
- x, y, true,
- new ItemStack(ItemList.clayMolds,
- 1, 2),
- new ItemStack(Items.clay_ball),
- null,
- new ItemStack(Items.clay_ball),
- new ItemStack(Items.clay_ball),
- null,
- new ItemStack(Items.clay_ball),
- null,
- new ItemStack(Items.clay_ball),
- null);
- break;
- case 7:
- text = "To create a bracelet you need a mold for it. However, this one can't be used. It is too soft. It needs to be hardened in order for it to be used.";
- Page.addCraftingRecipeTextPage(gui,
- gui.getLeft() + xPos,
- gui.getTop(), false, text,
- x, y, true,
- new ItemStack(ItemList.clayMolds,
- 1, 3),
- new ItemStack(Items.clay_ball),
- new ItemStack(Items.clay_ball),
- new ItemStack(Items.clay_ball),
- new ItemStack(Items.clay_ball),
- null,
- new ItemStack(Items.clay_ball),
- new ItemStack(Items.clay_ball),
- new ItemStack(Items.clay_ball),
- new ItemStack(Items.clay_ball));
- break;
- case 8:
- text = "To create earrings you need a mold for them. However, this one can't be used. It is too soft. It needs to be hardened in order for it to be used.";
- Page.addCraftingRecipeTextPage(gui,
- gui.getLeft() + xPos,
- gui.getTop(), false, text,
- x, y, true,
- new ItemStack(ItemList.clayMolds,
- 1, 4),
- null, null, null,
- new ItemStack(Items.clay_ball),
- null,
- new ItemStack(Items.clay_ball),
- null, null, null);
- break;
- case 9:
- if (del == 0)
- values++;
- del++;
- if (del >= 300)
- del = 0;
- if (values > 4)
- values = 0;
- text = "By smelting a clay mold you get a harder version which can be used to create jewelry. Simply right click with this on a molder to attach it and you're ready to go.";
- Page.addSmeltingRecipeTextPage(gui,
- gui.getLeft() + xPos,
- gui.getTop(), text, x, y,
- true,
- new ItemStack(ItemList.clayMolds,
- 1, values),
- new ItemStack(ItemList.molds,
- 1,
- values));
- break;
- case 10:
- if (del == 0)
- values++;
- del++;
- if (del >= 300)
- del = 0;
- if (values > 4)
- values = 0;
- text = "It's this exact guide. I don't even know why you're reading this. I added this recipe in case you lose the original. Even if this is more helpful than NEI, I do suggest installing it so you can see all the recipes. Since you are reading this, how about making a youtube video spotlighting this mod. I'd really";
- Page.addCraftingRecipeTextPage(gui,
- gui.getLeft() + xPos,
- gui.getTop(), true, text,
- x, y, true,
- new ItemStack(ItemList.guide),
- new ItemStack(ItemList.molds,
- 1, values),
- new ItemStack(Items.book));
- break;
- case 11:
- String link = "HERE";
- if (x >= gui.getLeft() - 7
- && x <= gui.getLeft() + 10
- && y >= gui.getTop() + 20
- && y <= gui.getTop() + 34)
- link = EnumChatFormatting.DARK_BLUE
- + "HERE"
- + EnumChatFormatting.BLACK;
- text = "appreciate it. After that you can share it in the main thread "
- + link + ".";
- Page.addTextPage(gui, gui.getLeft() + xPos,
- gui.getTop(), text);
- break;
- case 12:
- ItemStack item = new ItemStack(
- ItemList.bucket);
- if (del == 0)
- values++;
- del++;
- if (del >= 50)
- del = 0;
- if (values > JewelrycraftUtil.metal.size()
- - 1)
- values = 0;
- JewelryNBT.addMetal(item,
- JewelrycraftUtil.metal.get(
- values)
- .copy());
- text = "These buckets contain molten metal. To obtain one simply Right Click a full Smelter to get a bucket. You can pour the metal, other than that it has no use. You can place the molten metal back in a Smelter by Right Clicking one with it.";
- Page.addImageTextPage(gui,
- gui.getLeft() + xPos,
- gui.getTop() - 5, item,
- text, 40f, 0, 0, true, 45,
- 10, false);
- break;
- case 13:
- text = "This item is a creative only item! Right click it while in creative mode to open a GUI. Place a piece of jewelery inside the slot, select what you want to add, then click on 'Add Items'. If you selected Modifiers, you can select multiple items at once. The 'Item' button is to add an Item to a Golden Object, which can not be obtained normally. This tool can be really useful, especially for those";
- Page.addImageTextPage(gui,
- gui.getLeft() + xPos,
- gui.getTop() - 5,
- new ItemStack(ItemList.jewelryModifier),
- text, 40f, 0, 0, true, 45,
- 10, false);
- break;
- case 14:
- text = "who want to test the mod and can't wait for the normal processes to finish (Smelter, Jeweler's Table, Ritual).";
- Page.addTextPage(gui, gui.getLeft() + xPos,
- gui.getTop(), text);
- break;
- case 15:
- text = "This item is a creative only item! If you right click in the air while holding this item you'll increment the number of the structure to spawn. Crouch and right click to go backwards. To spawn a structure simply right click on a block with this.";
- Page.addImageTextPage(gui,
- gui.getLeft() + xPos,
- gui.getTop() - 5,
- new ItemStack(ItemList.structureGen),
- text, 40f, 0, 0, true, 45,
- 10, false);
- break;
- default:
- ;
+ case 1:
+ text = "Shadow ingots are obtained by smelting shadow ore. They are used in a few recipes and an important key for making some jewelry work.";
+ Page.addSmeltingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text, x, y, true,
+ new ItemStack(BlockList.shadowOre), new ItemStack(ItemList.shadowIngot));
+ break;
+ case 2:
+ text = "These gloves give you the chance to steal the trades those pesky Testificates have to offer. To use these simply open their gui at least once, then Crouch and right click on the them to hopefully steal the trades. If you traded with him before, then you have a chance of getting the traded";
+ Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, x, y, true,
+ new ItemStack(ItemList.thiefGloves), new ItemStack(ItemList.shadowIngot), null,
+ new ItemStack(ItemList.shadowIngot), new ItemStack(Blocks.wool, 1, 15),
+ new ItemStack(ItemList.shadowIngot), new ItemStack(Blocks.wool, 1, 15),
+ new ItemStack(Blocks.wool, 1, 15), new ItemStack(ItemList.shadowIngot),
+ new ItemStack(Blocks.wool, 1, 15));
+ break;
+ case 3:
+ text = "emeralds back as well. This has a maximum of 10 uses before it breaks.";
+ Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text);
+ break;
+ case 4:
+ text = "In order to get the ingot back from the smelter you need a mold for it. However, this mold can't be used. It is too soft. It needs to be hardened in order for it to be used.";
+ Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), true, text, x, y, true,
+ new ItemStack(ItemList.clayMolds, 1, 0), new ItemStack(Items.clay_ball),
+ new ItemStack(Items.clay_ball));
+ break;
+ case 5:
+ text = "To create a ring you need a mold for it. However, this one is too soft to be used. It needs to be hardened in order for it to be used.";
+ Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, x, y, true,
+ new ItemStack(ItemList.clayMolds, 1, 1), null, new ItemStack(Items.clay_ball), null,
+ new ItemStack(Items.clay_ball), null, new ItemStack(Items.clay_ball), null,
+ new ItemStack(Items.clay_ball), null);
+ break;
+ case 6:
+ text = "To create a necklace you need a mold for it. However, this one can't be used. It is too soft. It needs to be hardened in order for it to be used.";
+ Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, x, y, true,
+ new ItemStack(ItemList.clayMolds, 1, 2), new ItemStack(Items.clay_ball), null,
+ new ItemStack(Items.clay_ball), new ItemStack(Items.clay_ball), null,
+ new ItemStack(Items.clay_ball), null, new ItemStack(Items.clay_ball), null);
+ break;
+ case 7:
+ text = "To create a bracelet you need a mold for it. However, this one can't be used. It is too soft. It needs to be hardened in order for it to be used.";
+ Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, x, y, true,
+ new ItemStack(ItemList.clayMolds, 1, 3), new ItemStack(Items.clay_ball),
+ new ItemStack(Items.clay_ball), new ItemStack(Items.clay_ball), new ItemStack(Items.clay_ball),
+ null, new ItemStack(Items.clay_ball), new ItemStack(Items.clay_ball),
+ new ItemStack(Items.clay_ball), new ItemStack(Items.clay_ball));
+ break;
+ case 8:
+ text = "To create earrings you need a mold for them. However, this one can't be used. It is too soft. It needs to be hardened in order for it to be used.";
+ Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, x, y, true,
+ new ItemStack(ItemList.clayMolds, 1, 4), null, null, null, new ItemStack(Items.clay_ball), null,
+ new ItemStack(Items.clay_ball), null, null, null);
+ break;
+ case 9:
+ if (del == 0)
+ values++;
+ del++;
+ if (del >= 300)
+ del = 0;
+ if (values > 4)
+ values = 0;
+ text = "By smelting a clay mold you get a harder version which can be used to create jewelry. Simply right click with this on a molder to attach it and you're ready to go.";
+ Page.addSmeltingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text, x, y, true,
+ new ItemStack(ItemList.clayMolds, 1, values), new ItemStack(ItemList.molds, 1, values));
+ break;
+ case 10:
+ if (del == 0)
+ values++;
+ del++;
+ if (del >= 300)
+ del = 0;
+ if (values > 4)
+ values = 0;
+ text = "It's this exact guide. I don't even know why you're reading this. I added this recipe in case you lose the original. Even if this is more helpful than NEI, I do suggest installing it so you can see all the recipes. Since you are reading this, how about making a youtube video spotlighting this mod. I'd really";
+ Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), true, text, x, y, true,
+ new ItemStack(ItemList.guide), new ItemStack(ItemList.molds, 1, values), new ItemStack(Items.book));
+ break;
+ case 11:
+ String link = "HERE";
+ if (x >= gui.getLeft() - 7 && x <= gui.getLeft() + 10 && y >= gui.getTop() + 20 && y <= gui.getTop() + 34)
+ link = EnumChatFormatting.DARK_BLUE + "HERE" + EnumChatFormatting.BLACK;
+ text = "appreciate it. After that you can share it in the main thread " + link + ".";
+ Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text);
+ break;
+ case 12:
+ ItemStack item = new ItemStack(ItemList.bucket);
+ if (del == 0)
+ values++;
+ del++;
+ if (del >= 50)
+ del = 0;
+ if (values > JewelrycraftUtil.metal.size() - 1)
+ values = 0;
+ JewelryNBT.addMetal(item, JewelrycraftUtil.metal.get(values).copy());
+ text = "These buckets contain molten metal. To obtain one simply Right Click a full Smelter to get a bucket. You can pour the metal, other than that it has no use. You can place the molten metal back in a Smelter by Right Clicking one with it.";
+ Page.addImageTextPage(gui, gui.getLeft() + xPos, gui.getTop() - 5, item, text, 40f, 0, 0, true, 45, 10,
+ false);
+ break;
+ case 13:
+ text = "This item is a creative only item! Right click it while in creative mode to open a GUI. Place a piece of jewelery inside the slot, select what you want to add, then click on 'Add Items'. If you selected Modifiers, you can select multiple items at once. The 'Item' button is to add an Item to a Golden Object, which can not be obtained normally. This tool can be really useful, especially for those";
+ Page.addImageTextPage(gui, gui.getLeft() + xPos, gui.getTop() - 5, new ItemStack(ItemList.jewelryModifier),
+ text, 40f, 0, 0, true, 45, 10, false);
+ break;
+ case 14:
+ text = "who want to test the mod and can't wait for the normal processes to finish (Smelter, Jeweler's Table, Ritual).";
+ Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text);
+ break;
+ case 15:
+ text = "This item is a creative only item! If you right click in the air while holding this item you'll increment the number of the structure to spawn. Crouch and right click to go backwards. To spawn a structure simply right click on a block with this.";
+ Page.addImageTextPage(gui, gui.getLeft() + xPos, gui.getTop() - 5, new ItemStack(ItemList.structureGen),
+ text, 40f, 0, 0, true, 45, 10, false);
+ break;
+ default:
+ ;
}
}
@@ -280,14 +180,11 @@ public class GuiTabItems extends GuiTab { */
@Override
public void mouseClick(GuiGuide gui, int x, int y, int button) {
- if (gui.page == 11 && x >= gui.getLeft() - 7
- && x <= gui.getLeft() + 10
- && y >= gui.getTop() + 20
+ if (gui.page == 11 && x >= gui.getLeft() - 7 && x <= gui.getLeft() + 10 && y >= gui.getTop() + 20
&& y <= gui.getTop() + 34)
try {
- Desktop.getDesktop().browse(new URL(
- "http://minecraft.curseforge.com/mc-mods/229927-jewelrycraft-2")
- .toURI());
+ Desktop.getDesktop()
+ .browse(new URL("http://minecraft.curseforge.com/mc-mods/229927-jewelrycraft-2").toURI());
} catch (Exception e) {
}
}
diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabModifiers.java b/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabModifiers.java index cf22586..e7e6e00 100755 --- a/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabModifiers.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabModifiers.java @@ -16,8 +16,7 @@ public class GuiTabModifiers extends GuiTab { @Override
public String getName() {
- return StatCollector.translateToLocal("guide."
- + Variables.MODID + ".tab.modifiers");
+ return StatCollector.translateToLocal("guide." + Variables.MODID + ".tab.modifiers");
}
/**
@@ -39,51 +38,35 @@ public class GuiTabModifiers extends GuiTab { String text = "";
int xPos = page % 2 == 0 ? 107 : -35;
switch (page) {
- case 1:
- text = "Although you can add anything as a modifier, only some objects have an effect. In this tab you can find all modifiers that have a use and what they do, in the form of a story/riddle/poem. However, different jewellery have different effects for the same modifier.";
- Page.addTextPage(gui, gui.getLeft() + xPos,
- gui.getTop(), text);
- break;
- case 2:
- text = "The ancient ones talked about a rising fire in your heart. Fret do not, for flames do not burn, but water might sting a turn. Watch your step, do not be cocky, for its protection is a bit sloppy.";
- Page.addImageTextPage(gui,
- gui.getLeft() + xPos,
- gui.getTop() - 10,
- new ItemStack(Items.blaze_powder),
- text, 40f, true);
- break;
- case 3:
- text = "Light and swift as a feather can be good all together. Enemies miss and get confused, this power can be abused. Against an arrow you can't compare, so move around, don't just stare. Fire is your enemy and weakness is the penalty.";
- Page.addImageTextPage(gui,
- gui.getLeft() + xPos,
- gui.getTop() - 10,
- new ItemStack(Items.feather),
- text, 40f, true);
- break;
- case 4:
- text = "Endermen may tolerate you, end portals are near too, you may find ore that is true. But be careful, for the power may make you dizzy, blind you if you're a sissy, worsen your vision if you're unaware and shift positions everywhere.";
- Page.addImageTextPage(gui,
- gui.getLeft() + xPos,
- gui.getTop() - 10,
- new ItemStack(Items.ender_eye),
- text, 40f, true);
- break;
- case 5:
- text = "Through the power of a pearl arrows don't know where to go. In confusion they can explode, making you a helpless toad. But if an enemy hits, they get damaged like a blitz. You may be weaker, water is bad, but you get saved if health is weak like a lilly pad.";
- Page.addImageTextPage(gui,
- gui.getLeft() + xPos,
- gui.getTop() - 10,
- new ItemStack(Items.ender_pearl),
- text, 40f, true);
- break;
- case 6:
- text = "Toughest stone made on Earth, falling damage is absurd. Deal more damage, more protection, anvils and arrows need inspection. But after long and hard abuse, the stone is starting to get loose. You are weak and heavy, sink like a ship, arrows need only one hit, deal less damage overall, don't abuse its power now.";
- Page.addImageTextPage(gui,
- gui.getLeft() + xPos,
- gui.getTop() - 10,
- new ItemStack(Blocks.obsidian),
- text, 40f, true);
- break;
+ case 1:
+ text = "Although you can add anything as a modifier, only some objects have an effect. In this tab you can find all modifiers that have a use and what they do, in the form of a story/riddle/poem. However, different jewellery have different effects for the same modifier.";
+ Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text);
+ break;
+ case 2:
+ text = "The ancient ones talked about a rising fire in your heart. Fret do not, for flames do not burn, but water might sting a turn. Watch your step, do not be cocky, for its protection is a bit sloppy.";
+ Page.addImageTextPage(gui, gui.getLeft() + xPos, gui.getTop() - 10, new ItemStack(Items.blaze_powder), text,
+ 40f, true);
+ break;
+ case 3:
+ text = "Light and swift as a feather can be good all together. Enemies miss and get confused, this power can be abused. Against an arrow you can't compare, so move around, don't just stare. Fire is your enemy and weakness is the penalty.";
+ Page.addImageTextPage(gui, gui.getLeft() + xPos, gui.getTop() - 10, new ItemStack(Items.feather), text, 40f,
+ true);
+ break;
+ case 4:
+ text = "Endermen may tolerate you, end portals are near too, you may find ore that is true. But be careful, for the power may make you dizzy, blind you if you're a sissy, worsen your vision if you're unaware and shift positions everywhere.";
+ Page.addImageTextPage(gui, gui.getLeft() + xPos, gui.getTop() - 10, new ItemStack(Items.ender_eye), text,
+ 40f, true);
+ break;
+ case 5:
+ text = "Through the power of a pearl arrows don't know where to go. In confusion they can explode, making you a helpless toad. But if an enemy hits, they get damaged like a blitz. You may be weaker, water is bad, but you get saved if health is weak like a lilly pad.";
+ Page.addImageTextPage(gui, gui.getLeft() + xPos, gui.getTop() - 10, new ItemStack(Items.ender_pearl), text,
+ 40f, true);
+ break;
+ case 6:
+ text = "Toughest stone made on Earth, falling damage is absurd. Deal more damage, more protection, anvils and arrows need inspection. But after long and hard abuse, the stone is starting to get loose. You are weak and heavy, sink like a ship, arrows need only one hit, deal less damage overall, don't abuse its power now.";
+ Page.addImageTextPage(gui, gui.getLeft() + xPos, gui.getTop() - 10, new ItemStack(Blocks.obsidian), text,
+ 40f, true);
+ break;
}
}
diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabOresToIngots.java b/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabOresToIngots.java index 36a8a1e..fea21b9 100755 --- a/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabOresToIngots.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabOresToIngots.java @@ -18,8 +18,7 @@ public class GuiTabOresToIngots extends GuiTab { @Override
public String getName() {
- return StatCollector.translateToLocal("guide."
- + Variables.MODID + ".tab.oretoingot");
+ return StatCollector.translateToLocal("guide." + Variables.MODID + ".tab.oretoingot");
}
/**
@@ -40,39 +39,19 @@ public class GuiTabOresToIngots extends GuiTab { public void drawBackground(GuiGuide gui, int x, int y, int page) {
int xPos = page % 2 == 0 ? 107 : -35;
GL11.glEnable(GL11.GL_BLEND);
- GL11.glBlendFunc(GL11.GL_SRC_ALPHA,
- GL11.GL_ONE_MINUS_SRC_ALPHA);
+ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
int i = 0;
- for (ItemStack ore : JewelrycraftUtil.oreToIngot
- .keySet()) {
+ for (ItemStack ore : JewelrycraftUtil.oreToIngot.keySet()) {
if (i >= (page - 1) * 5 && i < page * 5) {
- gui.renderItem(ore,
- gui.getLeft() + xPos + 10,
- gui.getTop() + 12 + 32 * (i
- - 5 * (page - 1)),
- 30f, true, 0, 0, 0);
- gui.renderItem(JewelrycraftUtil.oreToIngot
- .get(ore),
- gui.getLeft() + xPos + 10,
- gui.getTop() + 28 + 32 * (i
- - 5 * (page - 1)),
- 30f, true, 0, 0, 0);
- gui.getFont().drawString(String.format(
- "%-1.18s",
- ore.getDisplayName()),
- gui.getLeft() + xPos + 20,
- gui.getTop() + 2 + 32 * (i
- - 5 * (page - 1)),
- 0);
- gui.getFont().drawString(String.format(
- "%-1.18s",
- JewelrycraftUtil.oreToIngot
- .get(ore)
- .getDisplayName()),
- gui.getLeft() + xPos + 20,
- gui.getTop() + 18 + 32 * (i
- - 5 * (page - 1)),
- 0);
+ gui.renderItem(ore, gui.getLeft() + xPos + 10, gui.getTop() + 12 + 32 * (i - 5 * (page - 1)), 30f, true,
+ 0, 0, 0);
+ gui.renderItem(JewelrycraftUtil.oreToIngot.get(ore), gui.getLeft() + xPos + 10,
+ gui.getTop() + 28 + 32 * (i - 5 * (page - 1)), 30f, true, 0, 0, 0);
+ gui.getFont().drawString(String.format("%-1.18s", ore.getDisplayName()), gui.getLeft() + xPos + 20,
+ gui.getTop() + 2 + 32 * (i - 5 * (page - 1)), 0);
+ gui.getFont().drawString(
+ String.format("%-1.18s", JewelrycraftUtil.oreToIngot.get(ore).getDisplayName()),
+ gui.getLeft() + xPos + 20, gui.getTop() + 18 + 32 * (i - 5 * (page - 1)), 0);
GL11.glDisable(GL11.GL_LIGHTING);
}
i++;
diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabRitual.java b/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabRitual.java index 863aa09..0e2b768 100755 --- a/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabRitual.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabRitual.java @@ -15,8 +15,7 @@ public class GuiTabRitual extends GuiTab { @Override
public String getName() {
- return StatCollector.translateToLocal("guide."
- + Variables.MODID + ".tab.ritual");
+ return StatCollector.translateToLocal("guide." + Variables.MODID + ".tab.ritual");
}
@Override
@@ -28,392 +27,139 @@ public class GuiTabRitual extends GuiTab { public void drawBackground(GuiGuide gui, int x, int y, int page) {
int xPos = page % 2 == 0 ? 107 : -35;
switch (page) {
- case 1:
- Page.drawText(gui,
- EnumChatFormatting.DARK_BLUE
- + "\u00a7n"
- + "Layer 1",
- gui.getLeft() + xPos + 35,
- gui.getTop() - 30);
- for (int i = -1; i < 10; i++)
- for (int j = 0; j < 11; j++)
- Page.addSlotItem(gui, gui
- .getLeft()
- + xPos
- + 11 * i,
- gui.getTop() + 11
- * j,
- x, y,
- new ItemStack(Blocks.air),
- 0, 0, 0);
- Page.addSlotItem(gui,
- gui.getLeft() + xPos
- + 11 * 8,
- gui.getTop() + 11 * 1, x,
- y,
- new ItemStack(Blocks.stonebrick),
- 0, 0, 0);
- Page.addSlotItem(gui,
- gui.getLeft() + xPos
- + 11 * 0,
- gui.getTop() + 11 * 1, x,
- y,
- new ItemStack(Blocks.stonebrick),
- 0, 0, 0);
- Page.addSlotItem(gui,
- gui.getLeft() + xPos
- + 11 * 8,
- gui.getTop() + 11 * 9, x,
- y,
- new ItemStack(Blocks.stonebrick),
- 0, 0, 0);
- Page.addSlotItem(gui,
- gui.getLeft() + xPos
- + 11 * 0,
- gui.getTop() + 11 * 9, x,
- y,
- new ItemStack(Blocks.stonebrick),
- 0, 0, 0);
-
- // Top
- Page.addSlotItem(gui,
- gui.getLeft() + xPos
- + 11 * 2,
- gui.getTop() + 11 * 1, x,
- y,
- new ItemStack(BlockList.handPedestal),
- 0, 45, 0);
- Page.addSlotItem(gui,
- gui.getLeft() + xPos
- + 11 * 4,
- gui.getTop() + 11 * 0, x,
- y,
- new ItemStack(BlockList.handPedestal),
- 0, 0, 0);
- Page.addSlotItem(gui,
- gui.getLeft() + xPos
- + 11 * 6,
- gui.getTop() + 11 * 1, x,
- y,
- new ItemStack(BlockList.handPedestal),
- 0, -45, 0);
-
- // Left
- Page.addSlotItem(gui,
- gui.getLeft() + xPos
- + 11 * 0,
- gui.getTop() + 11 * 3, x,
- y,
- new ItemStack(BlockList.handPedestal),
- 0, 45, 0);
- Page.addSlotItem(gui,
- gui.getLeft() + xPos
- + 11 * -1,
- gui.getTop() + 11 * 5, x,
- y,
- new ItemStack(BlockList.handPedestal),
- 0, 90, 0);
- Page.addSlotItem(gui,
- gui.getLeft() + xPos
- + 11 * 0,
- gui.getTop() + 11 * 7, x,
- y,
- new ItemStack(BlockList.handPedestal),
- 0, 135, 0);
-
- // Bottom
- Page.addSlotItem(gui,
- gui.getLeft() + xPos
- + 11 * 2,
- gui.getTop() + 11 * 9, x,
- y,
- new ItemStack(BlockList.handPedestal),
- 0, 135, 0);
- Page.addSlotItem(gui,
- gui.getLeft() + xPos
- + 11 * 4,
- gui.getTop() + 11 * 10, x,
- y,
- new ItemStack(BlockList.handPedestal),
- 0, 180, 0);
- Page.addSlotItem(gui,
- gui.getLeft() + xPos
- + 11 * 6,
- gui.getTop() + 11 * 9, x,
- y,
- new ItemStack(BlockList.handPedestal),
- 0, 225, 0);
-
- // Right
- Page.addSlotItem(gui,
- gui.getLeft() + xPos
- + 11 * 8,
- gui.getTop() + 11 * 3, x,
- y,
- new ItemStack(BlockList.handPedestal),
- 0, -35, 0);
- Page.addSlotItem(gui,
- gui.getLeft() + xPos
- + 11 * 9,
- gui.getTop() + 11 * 5, x,
- y,
- new ItemStack(BlockList.handPedestal),
- 0, 270, 0);
- Page.addSlotItem(gui,
- gui.getLeft() + xPos
- + 11 * 8,
- gui.getTop() + 11 * 7, x,
- y,
- new ItemStack(BlockList.handPedestal),
- 0, 225, 0);
-
- Page.addSlotItem(gui,
- gui.getLeft() + xPos
- + 11 * 2,
- gui.getTop() + 11 * 5, x,
- y,
- new ItemStack(Blocks.stonebrick),
- 0, 0, 0);
- Page.addSlotItem(gui,
- gui.getLeft() + xPos
- + 11 * 4,
- gui.getTop() + 11 * 5, x,
- y,
- new ItemStack(BlockList.handPedestal),
- 0, 0, 0);
- Page.addSlotItem(gui,
- gui.getLeft() + xPos
- + 11 * 6,
- gui.getTop() + 11 * 5, x,
- y,
- new ItemStack(Blocks.stonebrick),
- 0, 0, 0);
- break;
-
- case 2:
- Page.drawText(gui,
- EnumChatFormatting.DARK_BLUE
- + "\u00a7n"
- + "Layer 2",
- gui.getLeft() + xPos + 35,
- gui.getTop() - 30);
- for (int i = -1; i < 10; i++)
- for (int j = 0; j < 11; j++)
- Page.addSlotItem(gui, gui
- .getLeft()
- + xPos
- + 11 * i,
- gui.getTop() + 11
- * j,
- x, y,
- new ItemStack(Blocks.air),
- 0, 0, 0);
- Page.addSlotItem(gui,
- gui.getLeft() + xPos
- + 11 * 8,
- gui.getTop() + 11 * 1, x,
- y,
- new ItemStack(Blocks.stonebrick),
- 0, 0, 0);
- Page.addSlotItem(gui,
- gui.getLeft() + xPos
- + 11 * 0,
- gui.getTop() + 11 * 1, x,
- y,
- new ItemStack(Blocks.stonebrick),
- 0, 0, 0);
- Page.addSlotItem(gui,
- gui.getLeft() + xPos
- + 11 * 8,
- gui.getTop() + 11 * 9, x,
- y,
- new ItemStack(Blocks.stonebrick),
- 0, 0, 0);
- Page.addSlotItem(gui,
- gui.getLeft() + xPos
- + 11 * 0,
- gui.getTop() + 11 * 9, x,
- y,
- new ItemStack(Blocks.stonebrick),
- 0, 0, 0);
-
- Page.addSlotItem(gui,
- gui.getLeft() + xPos
- + 11 * 2,
- gui.getTop() + 11 * 5, x,
- y,
- new ItemStack(Blocks.stonebrick),
- 0, 0, 0);
- Page.addSlotItem(gui,
- gui.getLeft() + xPos
- + 11 * 6,
- gui.getTop() + 11 * 5, x,
- y,
- new ItemStack(Blocks.stonebrick),
- 0, 0, 0);
- break;
-
- case 3:
- Page.drawText(gui,
- EnumChatFormatting.DARK_BLUE
- + "\u00a7n"
- + "Layer 3",
- gui.getLeft() + xPos + 35,
- gui.getTop() - 30);
- for (int i = -1; i < 10; i++)
- for (int j = 0; j < 11; j++)
- Page.addSlotItem(gui, gui
- .getLeft()
- + xPos
- + 11 * i,
- gui.getTop() + 11
- * j,
- x, y,
- new ItemStack(Blocks.air),
- 0, 0, 0);
- Page.addSlotItem(gui,
- gui.getLeft() + xPos
- + 11 * 8,
- gui.getTop() + 11 * 1, x,
- y,
- new ItemStack(BlockList.shadowBlock),
- 0, 0, 0);
- Page.addSlotItem(gui,
- gui.getLeft() + xPos
- + 11 * 0,
- gui.getTop() + 11 * 1, x,
- y,
- new ItemStack(BlockList.shadowBlock),
- 0, 0, 0);
- Page.addSlotItem(gui,
- gui.getLeft() + xPos
- + 11 * 8,
- gui.getTop() + 11 * 9, x,
- y,
- new ItemStack(BlockList.shadowBlock),
- 0, 0, 0);
- Page.addSlotItem(gui,
- gui.getLeft() + xPos
- + 11 * 0,
- gui.getTop() + 11 * 9, x,
- y,
- new ItemStack(BlockList.shadowBlock),
- 0, 0, 0);
-
- Page.addSlotItem(gui,
- gui.getLeft() + xPos
- + 11 * 2,
- gui.getTop() + 11 * 5, x,
- y,
- new ItemStack(Blocks.stonebrick),
- 0, 0, 0);
- Page.addSlotItem(gui,
- gui.getLeft() + xPos
- + 11 * 6,
- gui.getTop() + 11 * 5, x,
- y,
- new ItemStack(Blocks.stonebrick),
- 0, 0, 0);
- break;
-
- case 4:
- Page.drawText(gui,
- EnumChatFormatting.DARK_BLUE
- + "\u00a7n"
- + "Layer 4",
- gui.getLeft() + xPos + 35,
- gui.getTop() - 30);
- for (int i = -1; i < 10; i++)
- for (int j = 0; j < 11; j++)
- Page.addSlotItem(gui, gui
- .getLeft()
- + xPos
- + 11 * i,
- gui.getTop() + 11
- * j,
- x, y,
- new ItemStack(Blocks.air),
- 0, 0, 0);
- Page.addSlotItem(gui,
- gui.getLeft() + xPos
- + 11 * 2,
- gui.getTop() + 11 * 5, x,
- y,
- new ItemStack(Blocks.stone_brick_stairs),
- 0, 90, 0);
- Page.addSlotItem(gui,
- gui.getLeft() + xPos
- + 11 * 3,
- gui.getTop() + 11 * 5, x,
- y,
- new ItemStack(Blocks.stone_brick_stairs),
- 0, -90, 180);
- Page.addSlotItem(gui,
- gui.getLeft() + xPos
- + 11 * 4,
- gui.getTop() + 11 * 5, x,
- y,
- new ItemStack(BlockList.shadowEye),
- 0, 90, 0);
- Page.addSlotItem(gui,
- gui.getLeft() + xPos
- + 11 * 5,
- gui.getTop() + 11 * 5, x,
- y,
- new ItemStack(Blocks.stone_brick_stairs),
- 0, 90, 180);
- Page.addSlotItem(gui,
- gui.getLeft() + xPos
- + 11 * 6,
- gui.getTop() + 11 * 5, x,
- y,
- new ItemStack(Blocks.stone_brick_stairs),
- 0, -90, 0);
- break;
-
- case 5:
- Page.drawText(gui,
- EnumChatFormatting.DARK_BLUE
- + "\u00a7n"
- + "Layer 5",
- gui.getLeft() + xPos + 35,
- gui.getTop() - 30);
- for (int i = -1; i < 10; i++)
- for (int j = 0; j < 11; j++)
- Page.addSlotItem(gui, gui
- .getLeft()
- + xPos
- + 11 * i,
- gui.getTop() + 11
- * j,
- x, y,
- new ItemStack(Blocks.air),
- 0, 0, 0);
- Page.addSlotItem(gui,
- gui.getLeft() + xPos
- + 11 * 3,
- gui.getTop() + 11 * 5, x,
- y,
- new ItemStack(Blocks.stone_slab,
- 1, 5),
- 0, 0, 0);
- Page.addSlotItem(gui,
- gui.getLeft() + xPos
- + 11 * 4,
- gui.getTop() + 11 * 5, x,
- y,
- new ItemStack(Blocks.stone_slab,
- 1, 5),
- 0, 0, 0);
- Page.addSlotItem(gui,
- gui.getLeft() + xPos
- + 11 * 5,
- gui.getTop() + 11 * 5, x,
- y,
- new ItemStack(Blocks.stone_slab,
- 1, 5),
- 0, 0, 0);
- break;
+ case 1:
+ Page.drawText(gui, EnumChatFormatting.DARK_BLUE + "\u00a7n" + "Layer 1", gui.getLeft() + xPos + 35,
+ gui.getTop() - 30);
+ for (int i = -1; i < 10; i++)
+ for (int j = 0; j < 11; j++)
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * i, gui.getTop() + 11 * j, x, y,
+ new ItemStack(Blocks.air), 0, 0, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 8, gui.getTop() + 11 * 1, x, y,
+ new ItemStack(Blocks.stonebrick), 0, 0, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 0, gui.getTop() + 11 * 1, x, y,
+ new ItemStack(Blocks.stonebrick), 0, 0, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 8, gui.getTop() + 11 * 9, x, y,
+ new ItemStack(Blocks.stonebrick), 0, 0, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 0, gui.getTop() + 11 * 9, x, y,
+ new ItemStack(Blocks.stonebrick), 0, 0, 0);
+
+ // Top
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 2, gui.getTop() + 11 * 1, x, y,
+ new ItemStack(BlockList.handPedestal), 0, 45, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 4, gui.getTop() + 11 * 0, x, y,
+ new ItemStack(BlockList.handPedestal), 0, 0, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 6, gui.getTop() + 11 * 1, x, y,
+ new ItemStack(BlockList.handPedestal), 0, -45, 0);
+
+ // Left
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 0, gui.getTop() + 11 * 3, x, y,
+ new ItemStack(BlockList.handPedestal), 0, 45, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * -1, gui.getTop() + 11 * 5, x, y,
+ new ItemStack(BlockList.handPedestal), 0, 90, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 0, gui.getTop() + 11 * 7, x, y,
+ new ItemStack(BlockList.handPedestal), 0, 135, 0);
+
+ // Bottom
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 2, gui.getTop() + 11 * 9, x, y,
+ new ItemStack(BlockList.handPedestal), 0, 135, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 4, gui.getTop() + 11 * 10, x, y,
+ new ItemStack(BlockList.handPedestal), 0, 180, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 6, gui.getTop() + 11 * 9, x, y,
+ new ItemStack(BlockList.handPedestal), 0, 225, 0);
+
+ // Right
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 8, gui.getTop() + 11 * 3, x, y,
+ new ItemStack(BlockList.handPedestal), 0, -35, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 9, gui.getTop() + 11 * 5, x, y,
+ new ItemStack(BlockList.handPedestal), 0, 270, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 8, gui.getTop() + 11 * 7, x, y,
+ new ItemStack(BlockList.handPedestal), 0, 225, 0);
+
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 2, gui.getTop() + 11 * 5, x, y,
+ new ItemStack(Blocks.stonebrick), 0, 0, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 4, gui.getTop() + 11 * 5, x, y,
+ new ItemStack(BlockList.handPedestal), 0, 0, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 6, gui.getTop() + 11 * 5, x, y,
+ new ItemStack(Blocks.stonebrick), 0, 0, 0);
+ break;
+
+ case 2:
+ Page.drawText(gui, EnumChatFormatting.DARK_BLUE + "\u00a7n" + "Layer 2", gui.getLeft() + xPos + 35,
+ gui.getTop() - 30);
+ for (int i = -1; i < 10; i++)
+ for (int j = 0; j < 11; j++)
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * i, gui.getTop() + 11 * j, x, y,
+ new ItemStack(Blocks.air), 0, 0, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 8, gui.getTop() + 11 * 1, x, y,
+ new ItemStack(Blocks.stonebrick), 0, 0, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 0, gui.getTop() + 11 * 1, x, y,
+ new ItemStack(Blocks.stonebrick), 0, 0, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 8, gui.getTop() + 11 * 9, x, y,
+ new ItemStack(Blocks.stonebrick), 0, 0, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 0, gui.getTop() + 11 * 9, x, y,
+ new ItemStack(Blocks.stonebrick), 0, 0, 0);
+
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 2, gui.getTop() + 11 * 5, x, y,
+ new ItemStack(Blocks.stonebrick), 0, 0, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 6, gui.getTop() + 11 * 5, x, y,
+ new ItemStack(Blocks.stonebrick), 0, 0, 0);
+ break;
+
+ case 3:
+ Page.drawText(gui, EnumChatFormatting.DARK_BLUE + "\u00a7n" + "Layer 3", gui.getLeft() + xPos + 35,
+ gui.getTop() - 30);
+ for (int i = -1; i < 10; i++)
+ for (int j = 0; j < 11; j++)
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * i, gui.getTop() + 11 * j, x, y,
+ new ItemStack(Blocks.air), 0, 0, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 8, gui.getTop() + 11 * 1, x, y,
+ new ItemStack(BlockList.shadowBlock), 0, 0, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 0, gui.getTop() + 11 * 1, x, y,
+ new ItemStack(BlockList.shadowBlock), 0, 0, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 8, gui.getTop() + 11 * 9, x, y,
+ new ItemStack(BlockList.shadowBlock), 0, 0, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 0, gui.getTop() + 11 * 9, x, y,
+ new ItemStack(BlockList.shadowBlock), 0, 0, 0);
+
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 2, gui.getTop() + 11 * 5, x, y,
+ new ItemStack(Blocks.stonebrick), 0, 0, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 6, gui.getTop() + 11 * 5, x, y,
+ new ItemStack(Blocks.stonebrick), 0, 0, 0);
+ break;
+
+ case 4:
+ Page.drawText(gui, EnumChatFormatting.DARK_BLUE + "\u00a7n" + "Layer 4", gui.getLeft() + xPos + 35,
+ gui.getTop() - 30);
+ for (int i = -1; i < 10; i++)
+ for (int j = 0; j < 11; j++)
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * i, gui.getTop() + 11 * j, x, y,
+ new ItemStack(Blocks.air), 0, 0, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 2, gui.getTop() + 11 * 5, x, y,
+ new ItemStack(Blocks.stone_brick_stairs), 0, 90, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 3, gui.getTop() + 11 * 5, x, y,
+ new ItemStack(Blocks.stone_brick_stairs), 0, -90, 180);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 4, gui.getTop() + 11 * 5, x, y,
+ new ItemStack(BlockList.shadowEye), 0, 90, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 5, gui.getTop() + 11 * 5, x, y,
+ new ItemStack(Blocks.stone_brick_stairs), 0, 90, 180);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 6, gui.getTop() + 11 * 5, x, y,
+ new ItemStack(Blocks.stone_brick_stairs), 0, -90, 0);
+ break;
+
+ case 5:
+ Page.drawText(gui, EnumChatFormatting.DARK_BLUE + "\u00a7n" + "Layer 5", gui.getLeft() + xPos + 35,
+ gui.getTop() - 30);
+ for (int i = -1; i < 10; i++)
+ for (int j = 0; j < 11; j++)
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * i, gui.getTop() + 11 * j, x, y,
+ new ItemStack(Blocks.air), 0, 0, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 3, gui.getTop() + 11 * 5, x, y,
+ new ItemStack(Blocks.stone_slab, 1, 5), 0, 0, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 4, gui.getTop() + 11 * 5, x, y,
+ new ItemStack(Blocks.stone_slab, 1, 5), 0, 0, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 5, gui.getTop() + 11 * 5, x, y,
+ new ItemStack(Blocks.stone_slab, 1, 5), 0, 0, 0);
+ break;
}
}
diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerJewelryModifier.java b/src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerJewelryModifier.java index 975dbd2..5405290 100755 --- a/src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerJewelryModifier.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerJewelryModifier.java @@ -10,18 +10,14 @@ import net.minecraft.item.ItemStack; public class ContainerJewelryModifier extends Container {
public IInventory modInv;
- public ContainerJewelryModifier(InventoryPlayer inv,
- IInventory mod) {
+ public ContainerJewelryModifier(InventoryPlayer inv, IInventory mod) {
int x, y;
modInv = mod;
for (x = 0; x < 9; x++)
- addSlotToContainer(new Slot(inv, x, 26 + 18 * x,
- 225));
+ addSlotToContainer(new Slot(inv, x, 26 + 18 * x, 225));
for (y = 0; y < 3; y++)
for (x = 0; x < 9; x++)
- addSlotToContainer(new Slot(inv,
- x + 9 + y * 9, 26 + 18 * x,
- 167 + y * 18));
+ addSlotToContainer(new Slot(inv, x + 9 + y * 9, 26 + 18 * x, 167 + y * 18));
addSlotToContainer(new Slot(mod, 36, 37, 9));
}
@@ -31,20 +27,16 @@ public class ContainerJewelryModifier extends Container { }
@Override
- public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer,
- int par2) {
+ public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) {
ItemStack itemstack = null;
Slot slot = (Slot) inventorySlots.get(par2);
if (slot != null && slot.getHasStack()) {
ItemStack itemstack1 = slot.getStack();
itemstack = itemstack1.copy();
if (par2 < 27) {
- if (!mergeItemStack(itemstack1, 27,
- inventorySlots.size(),
- true))
+ if (!mergeItemStack(itemstack1, 27, inventorySlots.size(), true))
return null;
- } else if (!mergeItemStack(itemstack1, 0, 27,
- false))
+ } else if (!mergeItemStack(itemstack1, 0, 27, false))
return null;
if (itemstack1.stackSize == 0)
slot.putStack((ItemStack) null);
diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerJewelryTab.java b/src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerJewelryTab.java index d3fbab1..6a118dc 100755 --- a/src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerJewelryTab.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerJewelryTab.java @@ -6,11 +6,7 @@ import darkknight.jewelrycraft.client.gui.container.slots.SlotBracelet; import darkknight.jewelrycraft.client.gui.container.slots.SlotEarrings;
import darkknight.jewelrycraft.client.gui.container.slots.SlotNecklace;
import darkknight.jewelrycraft.client.gui.container.slots.SlotRing;
-import darkknight.jewelrycraft.item.ItemBaseJewelry;
-import darkknight.jewelrycraft.item.ItemBracelet;
-import darkknight.jewelrycraft.item.ItemEarrings;
-import darkknight.jewelrycraft.item.ItemNecklace;
-import darkknight.jewelrycraft.item.ItemRing;
+import darkknight.jewelrycraft.item.*;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
@@ -18,33 +14,26 @@ import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack;
public class ContainerJewelryTab extends Container {
- public ContainerJewelryTab(EntityPlayer player, IInventory inv,
- IInventory extra) {
+ public ContainerJewelryTab(EntityPlayer player, IInventory inv, IInventory extra) {
int x, y;
// Rings
for (x = 0; x <= 9; x++)
- addSlotToContainer(new SlotRing(extra, x,
- 8 + x * 18, 7));
+ addSlotToContainer(new SlotRing(extra, x, 8 + x * 18, 7));
// Bracelets
for (x = 10; x <= 13; x++)
- addSlotToContainer(new SlotBracelet(extra, x,
- 8 + (x - 10) * 18, 26));
+ addSlotToContainer(new SlotBracelet(extra, x, 8 + (x - 10) * 18, 26));
// Necklaces
for (x = 14; x <= 16; x++)
- addSlotToContainer(new SlotNecklace(extra, x,
- 8 + (x - 14) * 18, 45));
+ addSlotToContainer(new SlotNecklace(extra, x, 8 + (x - 14) * 18, 45));
// Earrings
addSlotToContainer(new SlotEarrings(extra, 17, 8, 64));
// Hotbar
for (x = 0; x < 9; ++x)
- addSlotToContainer(new Slot(inv, x, 17 + x * 18,
- 142));
+ addSlotToContainer(new Slot(inv, x, 17 + x * 18, 142));
// Inventory
for (x = 0; x < 3; ++x)
for (y = 0; y < 9; ++y)
- addSlotToContainer(new Slot(inv,
- 9 + y + x * 9, 17 + y * 18,
- 84 + x * 18));
+ addSlotToContainer(new Slot(inv, 9 + y + x * 9, 17 + y * 18, 84 + x * 18));
}
@Override
@@ -53,56 +42,29 @@ public class ContainerJewelryTab extends Container { }
@Override
- public ItemStack slotClick(int slotID, int j, int k,
- EntityPlayer player) {
- if (slotID >= 0 && slotID <= 17
- && !player.worldObj.isRemote) {
+ public ItemStack slotClick(int slotID, int j, int k, EntityPlayer player) {
+ if (slotID >= 0 && slotID <= 17 && !player.worldObj.isRemote) {
try {
- if (player.inventory.getItemStack() == null
- && inventoryItemStacks.get(
- slotID) != null
- && ((ItemStack) inventoryItemStacks
- .get(slotID)).getItem() instanceof ItemBaseJewelry)
- ((ItemBaseJewelry) ((ItemStack) inventoryItemStacks
- .get(slotID)).getItem())
- .onJewelryUnequipped(
- (ItemStack) inventoryItemStacks
- .get(slotID));
- else if (player.inventory
- .getItemStack() != null
- && player.inventory
- .getItemStack()
- .getItem() instanceof ItemBaseJewelry
- && inventoryItemStacks.get(
- slotID) == null)
- ((ItemBaseJewelry) player.inventory
- .getItemStack()
- .getItem()).onJewelryEquipped(
- player.inventory.getItemStack());
- if (player.inventory.getItemStack() == null
- && inventoryItemStacks.get(
- slotID) != null
- && ((ItemStack) inventoryItemStacks
- .get(slotID)).getItem() instanceof IJewelryItem)
- ((IJewelryItem) ((ItemStack) inventoryItemStacks
- .get(slotID)).getItem())
- .onJewelryUnequipped(
- (ItemStack) inventoryItemStacks
- .get(slotID));
- else if (player.inventory
- .getItemStack() != null
- && player.inventory
- .getItemStack()
- .getItem() instanceof IJewelryItem
- && inventoryItemStacks.get(
- slotID) == null)
- ((IJewelryItem) player.inventory
- .getItemStack()
- .getItem()).onJewelryEquipped(
- player.inventory.getItemStack());
+ if (player.inventory.getItemStack() == null && inventoryItemStacks.get(slotID) != null
+ && ((ItemStack) inventoryItemStacks.get(slotID)).getItem() instanceof ItemBaseJewelry)
+ ((ItemBaseJewelry) ((ItemStack) inventoryItemStacks.get(slotID)).getItem())
+ .onJewelryUnequipped((ItemStack) inventoryItemStacks.get(slotID));
+ else if (player.inventory.getItemStack() != null
+ && player.inventory.getItemStack().getItem() instanceof ItemBaseJewelry
+ && inventoryItemStacks.get(slotID) == null)
+ ((ItemBaseJewelry) player.inventory.getItemStack().getItem())
+ .onJewelryEquipped(player.inventory.getItemStack());
+ if (player.inventory.getItemStack() == null && inventoryItemStacks.get(slotID) != null
+ && ((ItemStack) inventoryItemStacks.get(slotID)).getItem() instanceof IJewelryItem)
+ ((IJewelryItem) ((ItemStack) inventoryItemStacks.get(slotID)).getItem())
+ .onJewelryUnequipped((ItemStack) inventoryItemStacks.get(slotID));
+ else if (player.inventory.getItemStack() != null
+ && player.inventory.getItemStack().getItem() instanceof IJewelryItem
+ && inventoryItemStacks.get(slotID) == null)
+ ((IJewelryItem) player.inventory.getItemStack().getItem())
+ .onJewelryEquipped(player.inventory.getItemStack());
} catch (Exception e) {
- JewelrycraftMod.logger.error(
- "An error has occured while equipping an item.");
+ JewelrycraftMod.logger.error("An error has occured while equipping an item.");
e.printStackTrace();
}
}
@@ -110,67 +72,39 @@ public class ContainerJewelryTab extends Container { }
@Override
- public ItemStack transferStackInSlot(EntityPlayer player,
- int slotID) {
+ public ItemStack transferStackInSlot(EntityPlayer player, int slotID) {
ItemStack itemstack = null;
Slot slot = (Slot) inventorySlots.get(slotID);
if (slot != null && slot.getHasStack()) {
ItemStack itemstack1 = slot.getStack();
itemstack = itemstack1.copy();
if (slotID >= 18) {
- if (itemstack.getItem() instanceof ItemRing
- || (itemstack.getItem() instanceof IJewelryItem
- && ((IJewelryItem) itemstack
- .getItem()).type() == 0)) {
- if (!mergeItemStack(itemstack, 0,
- 10, false)
- && !slot.getHasStack())
+ if (itemstack.getItem() instanceof ItemRing || (itemstack.getItem() instanceof IJewelryItem
+ && ((IJewelryItem) itemstack.getItem()).type() == 0)) {
+ if (!mergeItemStack(itemstack, 0, 10, false) && !slot.getHasStack())
return null;
- } else if (itemstack
- .getItem() instanceof ItemBracelet
- || (itemstack.getItem() instanceof IJewelryItem
- && ((IJewelryItem) itemstack
- .getItem()).type() == 1)) {
- if (!mergeItemStack(itemstack, 10,
- 14, false)
- && !slot.getHasStack())
+ } else if (itemstack.getItem() instanceof ItemBracelet || (itemstack.getItem() instanceof IJewelryItem
+ && ((IJewelryItem) itemstack.getItem()).type() == 1)) {
+ if (!mergeItemStack(itemstack, 10, 14, false) && !slot.getHasStack())
return null;
- } else if (itemstack
- .getItem() instanceof ItemNecklace
- || (itemstack.getItem() instanceof IJewelryItem
- && ((IJewelryItem) itemstack
- .getItem()).type() == 2)) {
- if (!mergeItemStack(itemstack, 14,
- 17, false)
- && !slot.getHasStack())
+ } else if (itemstack.getItem() instanceof ItemNecklace || (itemstack.getItem() instanceof IJewelryItem
+ && ((IJewelryItem) itemstack.getItem()).type() == 2)) {
+ if (!mergeItemStack(itemstack, 14, 17, false) && !slot.getHasStack())
return null;
- } else if (itemstack
- .getItem() instanceof ItemEarrings
- || (itemstack.getItem() instanceof IJewelryItem
- && ((IJewelryItem) itemstack
- .getItem()).type() == 3)) {
- if (!mergeItemStack(itemstack, 17,
- 18, false)
- && !slot.getHasStack())
+ } else if (itemstack.getItem() instanceof ItemEarrings || (itemstack.getItem() instanceof IJewelryItem
+ && ((IJewelryItem) itemstack.getItem()).type() == 3)) {
+ if (!mergeItemStack(itemstack, 17, 18, false) && !slot.getHasStack())
return null;
} else {
if (slotID < 27) {
- if (!mergeItemStack(
- itemstack,
- 27,
- 36 + 18,
- false))
+ if (!mergeItemStack(itemstack, 27, 36 + 18, false))
return null;
} else {
- if (!mergeItemStack(
- itemstack,
- 18, 27,
- false))
+ if (!mergeItemStack(itemstack, 18, 27, false))
return null;
}
}
- } else if (!mergeItemStack(itemstack, 18,
- inventorySlots.size(), false))
+ } else if (!mergeItemStack(itemstack, 18, inventorySlots.size(), false))
return null;
if (itemstack.stackSize == 0)
slot.putStack(null);
diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerRingChest.java b/src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerRingChest.java index 825b737..3901f9c 100755 --- a/src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerRingChest.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerRingChest.java @@ -15,25 +15,18 @@ public class ContainerRingChest extends Container { * @param inv * @param chest */ - public ContainerRingChest(InventoryPlayer inv, - TileEntityChest chest) { + public ContainerRingChest(InventoryPlayer inv, TileEntityChest chest) { theChest = chest; int x, y; for (x = 0; x < 9; x++) - addSlotToContainer(new SlotRingChest(inv, x, - 8 + 18 * x, 142, - x == inv.currentItem)); + addSlotToContainer(new SlotRingChest(inv, x, 8 + 18 * x, 142, x == inv.currentItem)); for (y = 0; y < 3; y++) for (x = 0; x < 9; x++) - addSlotToContainer(new Slot(inv, - x + 9 + y * 9, 8 + 18 * x, - 84 + y * 18)); + addSlotToContainer(new Slot(inv, x + 9 + y * 9, 8 + 18 * x, 84 + y * 18)); for (y = 0; y < 3; y++) for (x = 0; x < 9; x++) - addSlotToContainer(new SlotRingChest(chest, - 26 - (x + y * 9), - 8 + 18 * (8 - x), - 17 + (2 - y) * 18, false)); + addSlotToContainer( + new SlotRingChest(chest, 26 - (x + y * 9), 8 + 18 * (8 - x), 17 + (2 - y) * 18, false)); } /** @@ -51,20 +44,16 @@ public class ContainerRingChest extends Container { * @return */ @Override - public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, - int par2) { + public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) { ItemStack itemstack = null; Slot slot = (Slot) inventorySlots.get(par2); if (slot != null && slot.getHasStack()) { ItemStack itemstack1 = slot.getStack(); itemstack = itemstack1.copy(); if (par2 < 27) { - if (!mergeItemStack(itemstack1, 27, - inventorySlots.size(), - true)) + if (!mergeItemStack(itemstack1, 27, inventorySlots.size(), true)) return null; - } else if (!mergeItemStack(itemstack1, 0, 27, - false)) + } else if (!mergeItemStack(itemstack1, 0, 27, false)) return null; if (itemstack1.stackSize == 0) slot.putStack((ItemStack) null); diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotBracelet.java b/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotBracelet.java index ab09015..c647c0a 100755 --- a/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotBracelet.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotBracelet.java @@ -25,10 +25,8 @@ public class SlotBracelet extends Slot { */
@Override
public boolean isItemValid(ItemStack stack) {
- return stack.getItem() instanceof ItemBracelet || (stack
- .getItem() instanceof IJewelryItem
- && ((IJewelryItem) stack.getItem())
- .type() == 1);
+ return stack.getItem() instanceof ItemBracelet
+ || (stack.getItem() instanceof IJewelryItem && ((IJewelryItem) stack.getItem()).type() == 1);
}
/**
diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotEarrings.java b/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotEarrings.java index 1527e29..e1f221a 100755 --- a/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotEarrings.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotEarrings.java @@ -25,10 +25,8 @@ public class SlotEarrings extends Slot { */
@Override
public boolean isItemValid(ItemStack stack) {
- return stack.getItem() instanceof ItemEarrings || (stack
- .getItem() instanceof IJewelryItem
- && ((IJewelryItem) stack.getItem())
- .type() == 3);
+ return stack.getItem() instanceof ItemEarrings
+ || (stack.getItem() instanceof IJewelryItem && ((IJewelryItem) stack.getItem()).type() == 3);
}
/**
diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotNecklace.java b/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotNecklace.java index ba39329..c7d0c4a 100755 --- a/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotNecklace.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotNecklace.java @@ -25,10 +25,8 @@ public class SlotNecklace extends Slot { */
@Override
public boolean isItemValid(ItemStack stack) {
- return stack.getItem() instanceof ItemNecklace || (stack
- .getItem() instanceof IJewelryItem
- && ((IJewelryItem) stack.getItem())
- .type() == 2);
+ return stack.getItem() instanceof ItemNecklace
+ || (stack.getItem() instanceof IJewelryItem && ((IJewelryItem) stack.getItem()).type() == 2);
}
/**
diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotRing.java b/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotRing.java index 41381b1..548b100 100755 --- a/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotRing.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotRing.java @@ -25,10 +25,8 @@ public class SlotRing extends Slot { */
@Override
public boolean isItemValid(ItemStack stack) {
- return stack.getItem() instanceof ItemRing || (stack
- .getItem() instanceof IJewelryItem
- && ((IJewelryItem) stack.getItem())
- .type() == 0);
+ return stack.getItem() instanceof ItemRing
+ || (stack.getItem() instanceof IJewelryItem && ((IJewelryItem) stack.getItem()).type() == 0);
}
/**
diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotRingChest.java b/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotRingChest.java index 72c149d..d69eff8 100755 --- a/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotRingChest.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotRingChest.java @@ -15,8 +15,7 @@ public class SlotRingChest extends Slot { * @param y * @param locked */ - public SlotRingChest(IInventory tile, int slotID, int x, int y, - boolean locked) { + public SlotRingChest(IInventory tile, int slotID, int x, int y, boolean locked) { super(tile, slotID, x, y); this.locked = locked; } diff --git a/src/main/java/darkknight/jewelrycraft/commands/JewelrycraftCommands.java b/src/main/java/darkknight/jewelrycraft/commands/JewelrycraftCommands.java index 6407dd4..14797b8 100755 --- a/src/main/java/darkknight/jewelrycraft/commands/JewelrycraftCommands.java +++ b/src/main/java/darkknight/jewelrycraft/commands/JewelrycraftCommands.java @@ -44,56 +44,37 @@ public class JewelrycraftCommands extends CommandBase { }
@Override
- public void processCommand(ICommandSender commandSender,
- String[] astring) {
+ public void processCommand(ICommandSender commandSender, String[] astring) {
if (astring.length == 0 || astring[0].equals("help"))
- throw new WrongUsageException(
- getCommandUsage(commandSender));
+ throw new WrongUsageException(getCommandUsage(commandSender));
if (astring[0].equals("getCursePoints")) {
- EntityPlayerMP entityplayermp = getPlayer(
- commandSender, astring[1]);
+ EntityPlayerMP entityplayermp = getPlayer(commandSender, astring[1]);
commandSender.addChatMessage(
- new ChatComponentTranslation(
- Integer.toString(
- JewelrycraftUtil.getCursePoints(
- entityplayermp))));
+ new ChatComponentTranslation(Integer.toString(JewelrycraftUtil.getCursePoints(entityplayermp))));
} else if (astring[0].equals("addCursePoints")) {
- int points = CommandBase.parseIntWithMin(
- commandSender, astring[2], 0);
- EntityPlayerMP entityplayermp = getPlayer(
- commandSender, astring[1]);
- JewelrycraftUtil.addCursePoints(entityplayermp,
- points);
+ int points = CommandBase.parseIntWithMin(commandSender, astring[2], 0);
+ EntityPlayerMP entityplayermp = getPlayer(commandSender, astring[1]);
+ JewelrycraftUtil.addCursePoints(entityplayermp, points);
} else if (astring[0].equals("setCursePoints")) {
- int points = CommandBase.parseIntWithMin(
- commandSender, astring[2], 0);
- EntityPlayerMP entityplayermp = getPlayer(
- commandSender, astring[1]);
- JewelrycraftUtil.addCursePoints(entityplayermp,
- points - JewelrycraftUtil
- .getCursePoints(entityplayermp));
+ int points = CommandBase.parseIntWithMin(commandSender, astring[2], 0);
+ EntityPlayerMP entityplayermp = getPlayer(commandSender, astring[1]);
+ JewelrycraftUtil.addCursePoints(entityplayermp, points - JewelrycraftUtil.getCursePoints(entityplayermp));
}
}
@Override
- public List addTabCompletionOptions(ICommandSender icommandsender,
- String[] astring) {
+ public List addTabCompletionOptions(ICommandSender icommandsender, String[] astring) {
final List<String> MATCHES = new LinkedList<String>();
- final String ARG_LC = astring[astring.length - 1]
- .toLowerCase();
+ final String ARG_LC = astring[astring.length - 1].toLowerCase();
if (astring.length == 1) {
- if ("addCursePoints".toLowerCase()
- .startsWith(ARG_LC))
+ if ("addCursePoints".toLowerCase().startsWith(ARG_LC))
MATCHES.add("addCursePoints");
- if ("getCursePoints".toLowerCase()
- .startsWith(ARG_LC))
+ if ("getCursePoints".toLowerCase().startsWith(ARG_LC))
MATCHES.add("getCursePoints");
- if ("setCursePoints".toLowerCase()
- .startsWith(ARG_LC))
+ if ("setCursePoints".toLowerCase().startsWith(ARG_LC))
MATCHES.add("setCursePoints");
} else if (astring.length == 2) {
- for (String un : MinecraftServer.getServer()
- .getAllUsernames())
+ for (String un : MinecraftServer.getServer().getAllUsernames())
if (un.toLowerCase().startsWith(ARG_LC))
MATCHES.add(un);
}
diff --git a/src/main/java/darkknight/jewelrycraft/config/ConfigGui.java b/src/main/java/darkknight/jewelrycraft/config/ConfigGui.java index 8ef6c47..047a146 100755 --- a/src/main/java/darkknight/jewelrycraft/config/ConfigGui.java +++ b/src/main/java/darkknight/jewelrycraft/config/ConfigGui.java @@ -11,20 +11,14 @@ import net.minecraftforge.common.config.ConfigElement; public class ConfigGui extends GuiConfig {
public ConfigGui(GuiScreen parent) {
- super(parent, getElements(), Variables.MODID,
- Variables.MODID, false, false,
- Variables.MODNAME + " Config");
+ super(parent, getElements(), Variables.MODID, Variables.MODID, false, false, Variables.MODNAME + " Config");
}
- @SuppressWarnings({
- "rawtypes"
- })
+ @SuppressWarnings({ "rawtypes" })
private static List<IConfigElement> getElements() {
- List<IConfigElement> list = new ArrayList<IConfigElement>(
- ConfigHandler.categories.length);
+ List<IConfigElement> list = new ArrayList<IConfigElement>(ConfigHandler.categories.length);
for (String category : ConfigHandler.categories)
- list.add(new ConfigElement(ConfigHandler.config
- .getCategory(category)));
+ list.add(new ConfigElement(ConfigHandler.config.getCategory(category)));
return list;
}
}
\ No newline at end of file diff --git a/src/main/java/darkknight/jewelrycraft/config/ConfigGuiFactory.java b/src/main/java/darkknight/jewelrycraft/config/ConfigGuiFactory.java index 1ff4a6f..2c272a1 100755 --- a/src/main/java/darkknight/jewelrycraft/config/ConfigGuiFactory.java +++ b/src/main/java/darkknight/jewelrycraft/config/ConfigGuiFactory.java @@ -22,8 +22,7 @@ public class ConfigGuiFactory implements IModGuiFactory { }
@Override
- public RuntimeOptionGuiHandler getHandlerFor(
- RuntimeOptionCategoryElement element) {
+ public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement element) {
return null;
}
}
\ No newline at end of file diff --git a/src/main/java/darkknight/jewelrycraft/config/ConfigHandler.java b/src/main/java/darkknight/jewelrycraft/config/ConfigHandler.java index ac524e6..16cee81 100755 --- a/src/main/java/darkknight/jewelrycraft/config/ConfigHandler.java +++ b/src/main/java/darkknight/jewelrycraft/config/ConfigHandler.java @@ -7,251 +7,172 @@ import darkknight.jewelrycraft.util.Variables; import net.minecraftforge.common.config.Configuration;
public class ConfigHandler {
- public static Configuration config;
- public static final ConfigHandler INSTANCE = new ConfigHandler();
- public static final String[] categories = {
- "Timers", "Village Generation", "Misc",
- "World Generation", "Curses"
- };
-
- public static int INGOT_COOLING_TIME;
- public static int INGOT_MELTING_TIME;
- public static int GEM_PLACEMENT_TIME;
- public static int RITUAL_TIME;
- public static int HEART_DESPAWN_TIME;
-
- public static boolean GENERATE_VILLAGE_NETHERSTAR;
- public static boolean CAN_FURNACE_GENERATE_INGOTS;
- public static int MAX_VILLAGE_JEWELERS;
- public static int JEWELER_WEIGHT;
- public static int INGOT_CHEST_MIN;
- public static int INGOT_CHEST_MAX;
- public static int INGOT_CHEST_MAX_STACK;
- public static int GEM_CHEST_MIN;
- public static int GEM_CHEST_MAX;
- public static int FURNACE_MIN_INGOT_STACK;
- public static int FURNACE_MAX_INGOT_STACK;
-
- public static int MAX_BLACK_HEARTS_PICKUP;
- public static int MAX_BLUE_HEARTS_PICKUP;
- public static boolean CAN_BLUE_HEARTS_SPAWN;
- public static boolean CAN_BLACK_HEARTS_SPAWN;
- public static boolean CAN_HOLY_HEARTS_SPAWN;
- public static boolean CAN_RED_HEARTS_SPAWN;
-
- public static boolean CRYSTAL_GLOW;
- public static boolean CRYSTAL_PARTICLES;
- public static boolean HEARTS_DESPAWN;
- public static boolean JEWELRY_INFO;
-
- public static boolean CURSES_ENABLED = true;
- public static boolean CURSE_ROTTEN_HEART = true;
- public static boolean CURSE_FLAMING_SOUL = true;
- public static boolean CURSE_GREED = true;
- public static boolean CURSE_BLIND = true;
- public static boolean CURSE_INFAMY = true;
- public static boolean CURSE_MIDAS_TOUCH = true;
- public static boolean CURSE_RABBIT_PAW = true;
- public static boolean CURSE_PENTAGRAM = true;
- public static boolean CURSE_VAMPIRE_HUNGER = true;
- public static boolean CURSE_HUMBLE_BUNDLE = true;
- public static boolean CURSE_DEATHS_TOUCH = true;
- public static boolean CURSE_DOUBLE_DOWN = true;
- public static boolean CURSE_INCREDIBLE_DEVOTION = true;
- public static float DEVOTION_FACTOR = 10.0f;
- public static boolean CURSE_MONEY_EQUALS_POWER = true;
- public static boolean CURSE_SCION_OF_HELL = true;
-
- public static boolean ENABLE_WORLD_GEN = true;
- public static boolean ORE_GEN = true;
- public static boolean CRYSTAL_GEN = true;
- public static boolean STRUCTURES[] = {
- true, true, true, true, true, true
- };
- public static int STRUCTURES_SPAWN_CHANCE[] = {
- 6, 5, 7, 10, 6, 10
- };
+ public static Configuration config;
+ public static final ConfigHandler INSTANCE = new ConfigHandler();
+ public static final String[] categories = { "Timers", "Village Generation", "Misc", "World Generation", "Curses" };
+
+ public static int INGOT_COOLING_TIME;
+ public static int INGOT_MELTING_TIME;
+ public static int GEM_PLACEMENT_TIME;
+ public static int RITUAL_TIME;
+ public static int HEART_DESPAWN_TIME;
+
+ public static boolean GENERATE_VILLAGE_NETHERSTAR;
+ public static boolean CAN_FURNACE_GENERATE_INGOTS;
+ public static int MAX_VILLAGE_JEWELERS;
+ public static int JEWELER_WEIGHT;
+ public static int INGOT_CHEST_MIN;
+ public static int INGOT_CHEST_MAX;
+ public static int INGOT_CHEST_MAX_STACK;
+ public static int GEM_CHEST_MIN;
+ public static int GEM_CHEST_MAX;
+ public static int FURNACE_MIN_INGOT_STACK;
+ public static int FURNACE_MAX_INGOT_STACK;
+
+ public static int MAX_BLACK_HEARTS_PICKUP;
+ public static int MAX_BLUE_HEARTS_PICKUP;
+ public static boolean CAN_BLUE_HEARTS_SPAWN;
+ public static boolean CAN_BLACK_HEARTS_SPAWN;
+ public static boolean CAN_HOLY_HEARTS_SPAWN;
+ public static boolean CAN_RED_HEARTS_SPAWN;
+
+ public static boolean CRYSTAL_GLOW;
+ public static boolean CRYSTAL_PARTICLES;
+ public static boolean HEARTS_DESPAWN;
+ public static boolean JEWELRY_INFO;
+
+ public static boolean CURSES_ENABLED = true;
+ public static boolean CURSE_ROTTEN_HEART = true;
+ public static boolean CURSE_FLAMING_SOUL = true;
+ public static boolean CURSE_GREED = true;
+ public static boolean CURSE_BLIND = true;
+ public static boolean CURSE_INFAMY = true;
+ public static boolean CURSE_MIDAS_TOUCH = true;
+ public static boolean CURSE_RABBIT_PAW = true;
+ public static boolean CURSE_PENTAGRAM = true;
+ public static boolean CURSE_VAMPIRE_HUNGER = true;
+ public static boolean CURSE_HUMBLE_BUNDLE = true;
+ public static boolean CURSE_DEATHS_TOUCH = true;
+ public static boolean CURSE_DOUBLE_DOWN = true;
+ public static boolean CURSE_INCREDIBLE_DEVOTION = true;
+ public static float DEVOTION_FACTOR = 10.0f;
+ public static boolean CURSE_MONEY_EQUALS_POWER = true;
+ public static boolean CURSE_SCION_OF_HELL = true;
+
+ public static boolean ENABLE_WORLD_GEN = true;
+ public static boolean ORE_GEN = true;
+ public static boolean CRYSTAL_GEN = true;
+ public static boolean STRUCTURES[] = { true, true, true, true, true, true };
+ public static int STRUCTURES_SPAWN_CHANCE[] = { 6, 5, 7, 10, 6, 10 };
public void loadConfig(FMLPreInitializationEvent event) {
- config = new Configuration(
- event.getSuggestedConfigurationFile(),
- true);
+ config = new Configuration(event.getSuggestedConfigurationFile(), true);
config.load();
syncConfigs();
}
private void syncConfigs() {
- INGOT_COOLING_TIME = config.getInt(
- "Molder Ingot Cooling Time", categories[0],
- 100, 5, Integer.MAX_VALUE,
+ INGOT_COOLING_TIME = config.getInt("Molder Ingot Cooling Time", categories[0], 100, 5, Integer.MAX_VALUE,
"This sets the number of ticks you need to wait before the mold is cooled.");
- INGOT_MELTING_TIME = config.getInt("Ingot Melting Time",
- categories[0], 1500, 5, Integer.MAX_VALUE,
+ INGOT_MELTING_TIME = config.getInt("Ingot Melting Time", categories[0], 1500, 5, Integer.MAX_VALUE,
"This sets the number of ticks you need to wait before an ingot is completely smelted.");
- GEM_PLACEMENT_TIME = config.getInt("Jewelry Crafting Time",
- categories[0], 200, 5, Integer.MAX_VALUE,
+ GEM_PLACEMENT_TIME = config.getInt("Jewelry Crafting Time", categories[0], 200, 5, Integer.MAX_VALUE,
"This sets the number of ticks it takes for a jewel to be modified.");
- RITUAL_TIME = config.getInt("Ritual Time", categories[0],
- 500, 5, Integer.MAX_VALUE,
+ RITUAL_TIME = config.getInt("Ritual Time", categories[0], 500, 5, Integer.MAX_VALUE,
"This sets the number of ticks it takes for the ritual to end.");
- HEART_DESPAWN_TIME = config.getInt("Hearts Despawn Time",
- categories[0], 900, 20, Integer.MAX_VALUE,
+ HEART_DESPAWN_TIME = config.getInt("Hearts Despawn Time", categories[0], 900, 20, Integer.MAX_VALUE,
"This sets the number of ticks it takes for hearts to despawn, 20=1 second");
- GENERATE_VILLAGE_NETHERSTAR = config.getBoolean(
- "Netherstar Generation", categories[1],
- false,
+ GENERATE_VILLAGE_NETHERSTAR = config.getBoolean("Netherstar Generation", categories[1], false,
"If set to true Nether Stars will be able to generate in Jewelers chests.");
- CAN_FURNACE_GENERATE_INGOTS = config.getBoolean(
- "Furnace Ingots Generation", categories[1],
- true,
+ CAN_FURNACE_GENERATE_INGOTS = config.getBoolean("Furnace Ingots Generation", categories[1], true,
"If set to true jewelers will generate ingots in furnaces.");
- MAX_VILLAGE_JEWELERS = config.getInt("Maximum Jewelers",
- categories[1], 1, 0, Integer.MAX_VALUE,
+ MAX_VILLAGE_JEWELERS = config.getInt("Maximum Jewelers", categories[1], 1, 0, Integer.MAX_VALUE,
"Sets how many jewelers can be in a village.");
- JEWELER_WEIGHT = config.getInt("Jewelers Weight",
- categories[1], 30, 0, Integer.MAX_VALUE,
+ JEWELER_WEIGHT = config.getInt("Jewelers Weight", categories[1], 30, 0, Integer.MAX_VALUE,
"Chance of getting a jeweler in a village. The higher the value, the higher the chance.");
- INGOT_CHEST_MIN = config.getInt("Ingot Chest Min",
- categories[1], 1, 0, Integer.MAX_VALUE,
+ INGOT_CHEST_MIN = config.getInt("Ingot Chest Min", categories[1], 1, 0, Integer.MAX_VALUE,
"Minimum number of ingots that can be found in a chest from the Jeweler. (It's the chest from the back part)");
- INGOT_CHEST_MAX = config.getInt("Ingot Chest Max",
- categories[1], 4, 0, Integer.MAX_VALUE,
+ INGOT_CHEST_MAX = config.getInt("Ingot Chest Max", categories[1], 4, 0, Integer.MAX_VALUE,
"Maximum number of ingots that can be found in a chest from the Jeweler. (It's the chest from the back part)");
- INGOT_CHEST_MAX_STACK = config.getInt(
- "Ingot Chest Max Stack", categories[1], 2,
- 0, Integer.MAX_VALUE,
+ INGOT_CHEST_MAX_STACK = config.getInt("Ingot Chest Max Stack", categories[1], 2, 0, Integer.MAX_VALUE,
"Maximum number of the stack the ingots can be. For example: if set to 2 and ingots have a chance of generating, you have a chance of getting a stack of max 2 ingots in a chest.");
- GEM_CHEST_MIN = config.getInt("Jewelers Chest Min",
- categories[1], 2, 0, Integer.MAX_VALUE,
+ GEM_CHEST_MIN = config.getInt("Jewelers Chest Min", categories[1], 2, 0, Integer.MAX_VALUE,
"Determines the minimum nuber of jewels/modifiers that can be generated in the front chests of a Jeweler.");
- GEM_CHEST_MAX = config.getInt("Jewelers Chest Max",
- categories[1], 5, 0, Integer.MAX_VALUE,
+ GEM_CHEST_MAX = config.getInt("Jewelers Chest Max", categories[1], 5, 0, Integer.MAX_VALUE,
"Determines the maximum nuber of jewels/modifiers that can be generated in the front chests of a Jeweler.");
- FURNACE_MIN_INGOT_STACK = config.getInt(
- "Ingot Furnace Min", categories[1], 2, 0,
- Integer.MAX_VALUE,
+ FURNACE_MIN_INGOT_STACK = config.getInt("Ingot Furnace Min", categories[1], 2, 0, Integer.MAX_VALUE,
"Determines the minimum number of ingots that can generate in a furnace.");
- FURNACE_MAX_INGOT_STACK = config.getInt(
- "Ingot Furnace Max", categories[1], 5, 0,
- Integer.MAX_VALUE,
+ FURNACE_MAX_INGOT_STACK = config.getInt("Ingot Furnace Max", categories[1], 5, 0, Integer.MAX_VALUE,
"Determines the maximum number of ingots that can generate in a furnace.");
- CRYSTAL_GLOW = config.getBoolean("Crystal Glow",
- categories[2], false,
+ CRYSTAL_GLOW = config.getBoolean("Crystal Glow", categories[2], false,
"If true, then crystal will slowly glow (can cause lag)");
- CRYSTAL_PARTICLES = config.getBoolean("Crystal Particles",
- categories[2], true,
+ CRYSTAL_PARTICLES = config.getBoolean("Crystal Particles", categories[2], true,
"If false, then crystal will no longer spawn particles");
- HEARTS_DESPAWN = config.getBoolean("Hearts Despawn",
- categories[2], true,
+ HEARTS_DESPAWN = config.getBoolean("Hearts Despawn", categories[2], true,
"If false, then Hearts and Half-hearts will no longer despawn");
- JEWELRY_INFO = config.getBoolean("Jewelry Info",
- categories[2], true,
+ JEWELRY_INFO = config.getBoolean("Jewelry Info", categories[2], true,
"If false, then extra info won't be show when hovering over a jewelery.");
- MAX_BLACK_HEARTS_PICKUP = config.getInt(
- "Max Black Hearts Pickup", categories[2],
- Integer.MAX_VALUE, 0, Integer.MAX_VALUE,
- "Determines how many black hearts can a player pick up.");
- MAX_BLUE_HEARTS_PICKUP = config.getInt(
- "Max Blue Hearts Pickup", categories[2],
- Integer.MAX_VALUE, 0, Integer.MAX_VALUE,
- "Determines how many blue hearts can a player pick up.");
- CAN_BLUE_HEARTS_SPAWN = config.getBoolean(
- "Can Blue Hearts Spawn", categories[2],
- true,
+ MAX_BLACK_HEARTS_PICKUP = config.getInt("Max Black Hearts Pickup", categories[2], Integer.MAX_VALUE, 0,
+ Integer.MAX_VALUE, "Determines how many black hearts can a player pick up.");
+ MAX_BLUE_HEARTS_PICKUP = config.getInt("Max Blue Hearts Pickup", categories[2], Integer.MAX_VALUE, 0,
+ Integer.MAX_VALUE, "Determines how many blue hearts can a player pick up.");
+ CAN_BLUE_HEARTS_SPAWN = config.getBoolean("Can Blue Hearts Spawn", categories[2], true,
"Determines if blue hearts can spawn.");
- CAN_BLACK_HEARTS_SPAWN = config.getBoolean(
- "Can Black Hearts Spawn", categories[2],
- true,
+ CAN_BLACK_HEARTS_SPAWN = config.getBoolean("Can Black Hearts Spawn", categories[2], true,
"Determines if black hearts can spawn.");
- CAN_HOLY_HEARTS_SPAWN = config.getBoolean(
- "Can Holy Hearts Spawn", categories[2],
- true,
+ CAN_HOLY_HEARTS_SPAWN = config.getBoolean("Can Holy Hearts Spawn", categories[2], true,
"Determines if holy hearts can spawn.");
- CAN_RED_HEARTS_SPAWN = config.getBoolean(
- "Can Red Hearts Spawn", categories[2],
- true,
+ CAN_RED_HEARTS_SPAWN = config.getBoolean("Can Red Hearts Spawn", categories[2], true,
"Determines if red hearts can spawn.");
- ENABLE_WORLD_GEN = config.getBoolean("World Generation",
- categories[3], true,
+ ENABLE_WORLD_GEN = config.getBoolean("World Generation", categories[3], true,
"If false, nothing will generate (this includes ore)");
- ORE_GEN = config.getBoolean("Ore Generation",
- categories[3], true,
- "If false, ores won't generate");
- CRYSTAL_GEN = config.getBoolean("Crystal Generation",
- categories[3], true,
- "If false, crystals won't generate");
+ ORE_GEN = config.getBoolean("Ore Generation", categories[3], true, "If false, ores won't generate");
+ CRYSTAL_GEN = config.getBoolean("Crystal Generation", categories[3], true, "If false, crystals won't generate");
for (int i = 0; i < STRUCTURES.length; i++)
- STRUCTURES[i] = config.getBoolean(
- "Structure " + (i + 1)
- + " Generation",
- categories[3], true,
- "If false, structure no." + (i + 1)
- + " won't generate");
+ STRUCTURES[i] = config.getBoolean("Structure " + (i + 1) + " Generation", categories[3], true,
+ "If false, structure no." + (i + 1) + " won't generate");
for (int i = 0; i < STRUCTURES.length; i++)
- STRUCTURES_SPAWN_CHANCE[i] = config.getInt(
- "Structure " + (i + 1)
- + " Spawn Chance",
- categories[3],
- STRUCTURES_SPAWN_CHANCE[i], 1,
- Integer.MAX_VALUE,
- "Determines the chance for structure no."
- + (i + 1)
- + " to generate. Lower = higher chance and vice versa.");
+ STRUCTURES_SPAWN_CHANCE[i] = config.getInt("Structure " + (i + 1) + " Spawn Chance", categories[3],
+ STRUCTURES_SPAWN_CHANCE[i], 1, Integer.MAX_VALUE, "Determines the chance for structure no."
+ + (i + 1) + " to generate. Lower = higher chance and vice versa.");
- CURSES_ENABLED = config.getBoolean("Curses", categories[4],
- true,
+ CURSES_ENABLED = config.getBoolean("Curses", categories[4], true,
"If set to false curses will be deactivated.");
- CURSE_ROTTEN_HEART = config.getBoolean("Rotten Heart",
- categories[4], true,
+ CURSE_ROTTEN_HEART = config.getBoolean("Rotten Heart", categories[4], true,
"If set to false this curse will be deactivated.");
- CURSE_FLAMING_SOUL = config.getBoolean("Flaming Soul",
- categories[4], true,
+ CURSE_FLAMING_SOUL = config.getBoolean("Flaming Soul", categories[4], true,
"If set to false this curse will be deactivated.");
- CURSE_GREED = config.getBoolean("Greed", categories[4],
- true,
+ CURSE_GREED = config.getBoolean("Greed", categories[4], true,
"If set to false this curse will be deactivated.");
- CURSE_BLIND = config.getBoolean("Blind", categories[4],
- true,
+ CURSE_BLIND = config.getBoolean("Blind", categories[4], true,
"If set to false this curse will be deactivated.");
- CURSE_INFAMY = config.getBoolean("Infamy", categories[4],
- true,
+ CURSE_INFAMY = config.getBoolean("Infamy", categories[4], true,
"If set to false this curse will be deactivated.");
- CURSE_MIDAS_TOUCH = config.getBoolean("Midas Touch",
- categories[4], true,
+ CURSE_MIDAS_TOUCH = config.getBoolean("Midas Touch", categories[4], true,
"If set to false this curse will be deactivated.");
- CURSE_RABBIT_PAW = config.getBoolean("Rabbit's Paw",
- categories[4], true,
+ CURSE_RABBIT_PAW = config.getBoolean("Rabbit's Paw", categories[4], true,
"If set to false this curse will be deactivated.");
- CURSE_PENTAGRAM = config.getBoolean("Pentagram",
- categories[4], true,
+ CURSE_PENTAGRAM = config.getBoolean("Pentagram", categories[4], true,
"If set to false this curse will be deactivated.");
- CURSE_VAMPIRE_HUNGER = config.getBoolean("Vampire Hunger",
- categories[4], true,
+ CURSE_VAMPIRE_HUNGER = config.getBoolean("Vampire Hunger", categories[4], true,
"If set to false this curse will be deactivated.");
- CURSE_HUMBLE_BUNDLE = config.getBoolean("Humble Bundle",
- categories[4], true,
+ CURSE_HUMBLE_BUNDLE = config.getBoolean("Humble Bundle", categories[4], true,
"If set to false this curse will be deactivated.");
- CURSE_DEATHS_TOUCH = config.getBoolean("Death's Touch",
- categories[4], true,
+ CURSE_DEATHS_TOUCH = config.getBoolean("Death's Touch", categories[4], true,
"If set to false this curse will be deactivated.");
- CURSE_DOUBLE_DOWN = config.getBoolean("Double Down",
- categories[4], true,
+ CURSE_DOUBLE_DOWN = config.getBoolean("Double Down", categories[4], true,
"If set to false this curse will be deactivated.");
- CURSE_INCREDIBLE_DEVOTION = config.getBoolean(
- "Incredible Devotion", categories[4], true,
+ CURSE_INCREDIBLE_DEVOTION = config.getBoolean("Incredible Devotion", categories[4], true,
"If set to false this curse will be deactivated.");
- DEVOTION_FACTOR = config.getFloat("Devotion Factor",
- categories[4], 10.0f, 0.0f,
- Float.MAX_VALUE, "How devoted are mobs?");
- CURSE_MONEY_EQUALS_POWER = config.getBoolean(
- "Money = Power", categories[4], true,
+ DEVOTION_FACTOR = config.getFloat("Devotion Factor", categories[4], 10.0f, 0.0f, Float.MAX_VALUE,
+ "How devoted are mobs?");
+ CURSE_MONEY_EQUALS_POWER = config.getBoolean("Money = Power", categories[4], true,
"If set to false this curse will be deactivated.");
- CURSE_SCION_OF_HELL = config.getBoolean("Scion of Hell",
- categories[4], true,
+ CURSE_SCION_OF_HELL = config.getBoolean("Scion of Hell", categories[4], true,
"If set to false this curse will be deactivated.");
if (config.hasChanged())
@@ -259,8 +180,7 @@ public class ConfigHandler { }
@SubscribeEvent
- public void onConfigChanged(
- ConfigChangedEvent.OnConfigChangedEvent event) {
+ public void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent event) {
if (event.modID.equals(Variables.MODID))
syncConfigs();
}
diff --git a/src/main/java/darkknight/jewelrycraft/curses/CurseBlind.java b/src/main/java/darkknight/jewelrycraft/curses/CurseBlind.java index adaf528..04a9ce0 100755 --- a/src/main/java/darkknight/jewelrycraft/curses/CurseBlind.java +++ b/src/main/java/darkknight/jewelrycraft/curses/CurseBlind.java @@ -18,17 +18,14 @@ public class CurseBlind extends Curse { @Override
public void action(World world, EntityPlayer player) {
- if (!player.isPotionActive(Potion.blindness) || player
- .getActivePotionEffect(Potion.blindness)
- .getDuration() < 30)
- player.addPotionEffect(new PotionEffect(
- Potion.blindness.id, 60));
+ if (!player.isPotionActive(Potion.blindness)
+ || player.getActivePotionEffect(Potion.blindness).getDuration() < 30)
+ player.addPotionEffect(new PotionEffect(Potion.blindness.id, 60));
}
@Override
public String getDescription() {
- return StatCollector.translateToLocal("curse."
- + Variables.MODID + ".blind.description");
+ return StatCollector.translateToLocal("curse." + Variables.MODID + ".blind.description");
}
@Override
@@ -46,14 +43,12 @@ public class CurseBlind extends Curse { }
@Override
- public int weight(World world, EntityPlayer player,
- Random random) {
+ public int weight(World world, EntityPlayer player, Random random) {
return 7;
}
@Override
public String getDisplayName() {
- return StatCollector.translateToLocal(
- "curse." + Variables.MODID + ".blind");
+ return StatCollector.translateToLocal("curse." + Variables.MODID + ".blind");
}
}
diff --git a/src/main/java/darkknight/jewelrycraft/curses/CurseDeathsTouch.java b/src/main/java/darkknight/jewelrycraft/curses/CurseDeathsTouch.java index 6281db1..2541759 100755 --- a/src/main/java/darkknight/jewelrycraft/curses/CurseDeathsTouch.java +++ b/src/main/java/darkknight/jewelrycraft/curses/CurseDeathsTouch.java @@ -16,12 +16,10 @@ public class CurseDeathsTouch extends Curse { }
@Override
- public boolean attackedByPlayerActionCancelable(
- LivingAttackEvent event, World world,
- EntityPlayer player, Entity target) {
+ public boolean attackedByPlayerActionCancelable(LivingAttackEvent event, World world, EntityPlayer player,
+ Entity target) {
if (!world.isRemote) {
- target.attackEntityFrom(DamageSource.wither,
- event.ammount);
+ target.attackEntityFrom(DamageSource.wither, event.ammount);
}
return true;
@@ -29,15 +27,12 @@ public class CurseDeathsTouch extends Curse { @Override
public String getDescription() {
- return StatCollector.translateToLocal("curse."
- + Variables.MODID
- + ".deathsTouch.description");
+ return StatCollector.translateToLocal("curse." + Variables.MODID + ".deathsTouch.description");
}
@Override
public String getDisplayName() {
- return StatCollector.translateToLocal("curse."
- + Variables.MODID + ".deathsTouch");
+ return StatCollector.translateToLocal("curse." + Variables.MODID + ".deathsTouch");
}
@Override
diff --git a/src/main/java/darkknight/jewelrycraft/curses/CurseDoubleDown.java b/src/main/java/darkknight/jewelrycraft/curses/CurseDoubleDown.java index 202d8bf..b39f1c9 100755 --- a/src/main/java/darkknight/jewelrycraft/curses/CurseDoubleDown.java +++ b/src/main/java/darkknight/jewelrycraft/curses/CurseDoubleDown.java @@ -16,25 +16,21 @@ public class CurseDoubleDown extends Curse { } @Override - public void attackedAction(World world, EntityPlayer player, - LivingAttackEvent event, Entity attacker) { + public void attackedAction(World world, EntityPlayer player, LivingAttackEvent event, Entity attacker) { if (event.source.damageType.equals("doubleDown")) { return; // Don't stack double down } - player.attackEntityFrom(DamageSourceList.doubleDown, - event.ammount); + player.attackEntityFrom(DamageSourceList.doubleDown, event.ammount); } @Override - public void attackedByPlayerAction(LivingAttackEvent event, - World world, EntityPlayer player, Entity target) { + public void attackedByPlayerAction(LivingAttackEvent event, World world, EntityPlayer player, Entity target) { if (event.source.damageType.equals("doubleDown")) { return; // Don't stack double down } - target.attackEntityFrom(DamageSourceList.doubleDown, - event.ammount); + target.attackEntityFrom(DamageSourceList.doubleDown, event.ammount); } @Override @@ -44,15 +40,12 @@ public class CurseDoubleDown extends Curse { @Override public String getDescription() { - return StatCollector.translateToLocal("curse." - + Variables.MODID - + ".doubledown.description"); + return StatCollector.translateToLocal("curse." + Variables.MODID + ".doubledown.description"); } @Override public String getDisplayName() { - return StatCollector.translateToLocal("curse." - + Variables.MODID + ".doubledown"); + return StatCollector.translateToLocal("curse." + Variables.MODID + ".doubledown"); } @Override diff --git a/src/main/java/darkknight/jewelrycraft/curses/CurseFlamingSoul.java b/src/main/java/darkknight/jewelrycraft/curses/CurseFlamingSoul.java index 9811eb8..f06bfa6 100755 --- a/src/main/java/darkknight/jewelrycraft/curses/CurseFlamingSoul.java +++ b/src/main/java/darkknight/jewelrycraft/curses/CurseFlamingSoul.java @@ -13,16 +13,13 @@ public class CurseFlamingSoul extends Curse { super(name, txtID, pack);
}
- public void attackedByPlayerAction(World world,
- EntityPlayer player, Entity target) {
+ public void attackedByPlayerAction(World world, EntityPlayer player, Entity target) {
player.setFire(5);
}
@Override
public String getDescription() {
- return StatCollector.translateToLocal("curse."
- + Variables.MODID
- + ".flamingsoul.description");
+ return StatCollector.translateToLocal("curse." + Variables.MODID + ".flamingsoul.description");
}
@Override
@@ -32,7 +29,6 @@ public class CurseFlamingSoul extends Curse { @Override
public String getDisplayName() {
- return StatCollector.translateToLocal("curse."
- + Variables.MODID + ".flamingsoul");
+ return StatCollector.translateToLocal("curse." + Variables.MODID + ".flamingsoul");
}
}
diff --git a/src/main/java/darkknight/jewelrycraft/curses/CurseGreed.java b/src/main/java/darkknight/jewelrycraft/curses/CurseGreed.java index 4ea7ba3..48ff321 100755 --- a/src/main/java/darkknight/jewelrycraft/curses/CurseGreed.java +++ b/src/main/java/darkknight/jewelrycraft/curses/CurseGreed.java @@ -24,8 +24,7 @@ public class CurseGreed extends Curse { @Override
public String getDescription() {
- return StatCollector.translateToLocal("curse."
- + Variables.MODID + ".greed.description");
+ return StatCollector.translateToLocal("curse." + Variables.MODID + ".greed.description");
}
@Override
@@ -35,7 +34,6 @@ public class CurseGreed extends Curse { @Override
public String getDisplayName() {
- return StatCollector.translateToLocal(
- "curse." + Variables.MODID + ".greed");
+ return StatCollector.translateToLocal("curse." + Variables.MODID + ".greed");
}
}
diff --git a/src/main/java/darkknight/jewelrycraft/curses/CurseHumbleBundle.java b/src/main/java/darkknight/jewelrycraft/curses/CurseHumbleBundle.java index 76487a6..41219f2 100755 --- a/src/main/java/darkknight/jewelrycraft/curses/CurseHumbleBundle.java +++ b/src/main/java/darkknight/jewelrycraft/curses/CurseHumbleBundle.java @@ -22,14 +22,12 @@ import net.minecraftforge.event.world.BlockEvent; *
*/
public class CurseHumbleBundle extends Curse {
- protected CurseHumbleBundle(String name, int txtID,
- String texturepack) {
+ protected CurseHumbleBundle(String name, int txtID, String texturepack) {
super(name, txtID, texturepack);
}
@Override
- public void entityDropItems(EntityPlayer player, Entity target,
- ArrayList<EntityItem> drops) {
+ public void entityDropItems(EntityPlayer player, Entity target, ArrayList<EntityItem> drops) {
for (EntityItem item : drops) {
ItemStack drop = item.getEntityItem().copy();
target.entityDropItem(drop, 0.5F);
@@ -37,22 +35,17 @@ public class CurseHumbleBundle extends Curse { }
@Override
- public void onBlockItemsDrop(EntityPlayer player,
- BlockEvent.HarvestDropsEvent event) {
+ public void onBlockItemsDrop(EntityPlayer player, BlockEvent.HarvestDropsEvent event) {
for (ItemStack item : event.drops) {
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);
+ 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;
@@ -61,15 +54,12 @@ public class CurseHumbleBundle extends Curse { @Override
public String getDescription() {
- return StatCollector.translateToLocal("curse."
- + Variables.MODID
- + ".humblebundle.description");
+ return StatCollector.translateToLocal("curse." + Variables.MODID + ".humblebundle.description");
}
@Override
public String getDisplayName() {
- return StatCollector.translateToLocal("curse."
- + Variables.MODID + ".humblebundle");
+ return StatCollector.translateToLocal("curse." + Variables.MODID + ".humblebundle");
}
@Override
diff --git a/src/main/java/darkknight/jewelrycraft/curses/CurseIncredibleDevotion.java b/src/main/java/darkknight/jewelrycraft/curses/CurseIncredibleDevotion.java index da88c50..3f16ccf 100755 --- a/src/main/java/darkknight/jewelrycraft/curses/CurseIncredibleDevotion.java +++ b/src/main/java/darkknight/jewelrycraft/curses/CurseIncredibleDevotion.java @@ -9,33 +9,25 @@ import net.minecraft.util.StatCollector; import net.minecraft.world.World; public class CurseIncredibleDevotion extends Curse { - protected CurseIncredibleDevotion(String name, int txtID, - String texturepack) { + protected CurseIncredibleDevotion(String name, int txtID, String texturepack) { super(name, txtID, texturepack); } @Override - public void entityDeathAction(World world, EntityLivingBase target, - EntityPlayer player) { + public void entityDeathAction(World world, EntityLivingBase target, EntityPlayer player) { if (rand.nextInt(10) == 0) { - world.createExplosion(target, target.posX, - target.posY, target.posZ, - target.getMaxHealth() / (10.0f * (1 - / ConfigHandler.DEVOTION_FACTOR)), - true); + world.createExplosion(target, target.posX, target.posY, target.posZ, + target.getMaxHealth() / (10.0f * (1 / ConfigHandler.DEVOTION_FACTOR)), true); } } @Override public String getDisplayName() { - return StatCollector.translateToLocal("curse." - + Variables.MODID + ".incredibledevotion"); + return StatCollector.translateToLocal("curse." + Variables.MODID + ".incredibledevotion"); } @Override public String getDescription() { - return StatCollector.translateToLocal("curse." - + Variables.MODID - + ".incredibledevotion.description"); + return StatCollector.translateToLocal("curse." + Variables.MODID + ".incredibledevotion.description"); } } diff --git a/src/main/java/darkknight/jewelrycraft/curses/CurseInfamy.java b/src/main/java/darkknight/jewelrycraft/curses/CurseInfamy.java index 720ea6f..a24c92c 100755 --- a/src/main/java/darkknight/jewelrycraft/curses/CurseInfamy.java +++ b/src/main/java/darkknight/jewelrycraft/curses/CurseInfamy.java @@ -32,64 +32,40 @@ public class CurseInfamy extends Curse { }
@Override
- public void attackedByPlayerAction(LivingAttackEvent event,
- World world, EntityPlayer player, Entity target) {
- if (rand.nextInt(5) == 0 && !world.isRemote
- && !(target instanceof EntityMob)
- && target instanceof EntityLiving
- && !(target instanceof EntityHeart)
- && !(target instanceof EntityHalfHeart)
+ public void attackedByPlayerAction(LivingAttackEvent event, World world, EntityPlayer player, Entity target) {
+ if (rand.nextInt(5) == 0 && !world.isRemote && !(target instanceof EntityMob) && target instanceof EntityLiving
+ && !(target instanceof EntityHeart) && !(target instanceof EntityHalfHeart)
&& target.canAttackWithItem()) {
- NBTTagCompound playerInfo = PlayerUtils
- .getModPlayerPersistTag(player,
- Variables.MODID);
+ NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(player, Variables.MODID);
- playerInfo.setFloat("BlackHeart",
- playerInfo.getFloat("BlackHeart")
- + 1.0F);
+ playerInfo.setFloat("BlackHeart", playerInfo.getFloat("BlackHeart") + 1.0F);
if (player.getMaxHealth() >= 3F) {
- player.getEntityAttribute(
- SharedMonsterAttributes.maxHealth)
- .setBaseValue(player
- .getMaxHealth()
- - 1.0F);
-
- player.setHealth(
- player.getHealth() - 1.0F);
+ player.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(player.getMaxHealth() - 1.0F);
+
+ player.setHealth(player.getHealth() - 1.0F);
}
JewelrycraftUtil.addCursePoints(player, 10);
- JewelrycraftMod.netWrapper.sendToAll(
- new PacketSendServerPlayersInfo());
+ JewelrycraftMod.netWrapper.sendToAll(new PacketSendServerPlayersInfo());
- JewelrycraftMod.netWrapper.sendTo(
- new PacketSendClientPlayerInfo(
- playerInfo),
- (EntityPlayerMP) player);
+ JewelrycraftMod.netWrapper.sendTo(new PacketSendClientPlayerInfo(playerInfo), (EntityPlayerMP) player);
}
}
@Override
- public void playerRender(EntityPlayer player,
- RenderPlayerEvent.Specials.Post event) {
+ public void playerRender(EntityPlayer player, RenderPlayerEvent.Specials.Post event) {
MaskRender mask = new MaskRender();
float yaw = player.prevRotationYawHead
- + (player.rotationYawHead
- - player.prevRotationYawHead)
- * event.partialRenderTick;
+ + (player.rotationYawHead - player.prevRotationYawHead) * event.partialRenderTick;
float yawOffset = player.prevRenderYawOffset
- + (player.renderYawOffset
- - player.prevRenderYawOffset)
- * event.partialRenderTick;
+ + (player.renderYawOffset - player.prevRenderYawOffset) * event.partialRenderTick;
float pitch = player.prevRotationPitch
- + (player.rotationPitch
- - player.prevRotationPitch)
- * event.partialRenderTick;
+ + (player.rotationPitch - player.prevRotationPitch) * event.partialRenderTick;
GL11.glPushMatrix();
GL11.glColor4f(1, 1, 1, 1);
GL11.glRotatef(yawOffset, 0, -1, 0);
@@ -105,14 +81,12 @@ public class CurseInfamy extends Curse { @Override
public String getDescription() {
- return StatCollector.translateToLocal("curse."
- + Variables.MODID + ".infamy.description");
+ return StatCollector.translateToLocal("curse." + Variables.MODID + ".infamy.description");
}
@Override
public String getDisplayName() {
- return StatCollector.translateToLocal(
- "curse." + Variables.MODID + ".infamy");
+ return StatCollector.translateToLocal("curse." + Variables.MODID + ".infamy");
}
@Override
diff --git a/src/main/java/darkknight/jewelrycraft/curses/CurseList.java b/src/main/java/darkknight/jewelrycraft/curses/CurseList.java index 2c11364..249528a 100755 --- a/src/main/java/darkknight/jewelrycraft/curses/CurseList.java +++ b/src/main/java/darkknight/jewelrycraft/curses/CurseList.java @@ -5,93 +5,61 @@ import darkknight.jewelrycraft.api.Curse; import darkknight.jewelrycraft.util.Variables;
public class CurseList {
- private static final String CURSE_TEXPACK = Variables.MODID
- + "_curses_0";
-
- public static Curse rotten;
- public static Curse flaming;
- public static Curse blind;
- public static Curse greed;
- public static Curse incredibleDevotion;
-
- public static Curse infamy;
- public static Curse midasTouch;
- public static Curse rabbitsPaw;
- public static Curse pentagram;
- public static Curse vampireHunger;
- public static Curse humbleBundle;
- public static Curse deathsTouch;
- public static Curse scionOfHell;
- public static Curse moneyEqualsPower;
- public static Curse doubleDown;
- public static Curse sacredOath;
+ private static final String CURSE_TEXPACK = Variables.MODID + "_curses_0";
+
+ public static Curse rotten;
+ public static Curse flaming;
+ public static Curse blind;
+ public static Curse greed;
+ public static Curse incredibleDevotion;
+
+ public static Curse infamy;
+ public static Curse midasTouch;
+ public static Curse rabbitsPaw;
+ public static Curse pentagram;
+ public static Curse vampireHunger;
+ public static Curse humbleBundle;
+ public static Curse deathsTouch;
+ public static Curse scionOfHell;
+ public static Curse moneyEqualsPower;
+ public static Curse doubleDown;
+ public static Curse sacredOath;
// Not yet implemented
// None at the moment :)
public static void preInit(FMLPreInitializationEvent e) {
- rotten = new CurseRottenHeart(
- Variables.MODNAME + ":" + "Rotten Heart",
- 0, CURSE_TEXPACK);
+ rotten = new CurseRottenHeart(Variables.MODNAME + ":" + "Rotten Heart", 0, CURSE_TEXPACK);
- flaming = new CurseFlamingSoul(
- Variables.MODNAME + ":" + "Flaming Soul",
- 1, CURSE_TEXPACK);
+ flaming = new CurseFlamingSoul(Variables.MODNAME + ":" + "Flaming Soul", 1, CURSE_TEXPACK);
- greed = new CurseGreed(Variables.MODNAME + ":" + "Greed",
- 2, CURSE_TEXPACK);
+ greed = new CurseGreed(Variables.MODNAME + ":" + "Greed", 2, CURSE_TEXPACK);
- blind = new CurseBlind(Variables.MODNAME + ":" + "Blind",
- 3, CURSE_TEXPACK);
+ blind = new CurseBlind(Variables.MODNAME + ":" + "Blind", 3, CURSE_TEXPACK);
- infamy = new CurseInfamy(
- Variables.MODNAME + ":" + "Infamy", 4,
- CURSE_TEXPACK);
+ infamy = new CurseInfamy(Variables.MODNAME + ":" + "Infamy", 4, CURSE_TEXPACK);
- midasTouch = new CurseMidasTouch(
- Variables.MODNAME + ":" + "Midas Touch", 5,
- CURSE_TEXPACK);
+ midasTouch = new CurseMidasTouch(Variables.MODNAME + ":" + "Midas Touch", 5, CURSE_TEXPACK);
- rabbitsPaw = new CurseRabbitsPaw(
- Variables.MODNAME + ":" + "Rabbit's Paw",
- 6, CURSE_TEXPACK);
+ rabbitsPaw = new CurseRabbitsPaw(Variables.MODNAME + ":" + "Rabbit's Paw", 6, CURSE_TEXPACK);
- pentagram = new CursePentagram(
- Variables.MODNAME + ":" + "Pentagram", 7,
- CURSE_TEXPACK);
+ pentagram = new CursePentagram(Variables.MODNAME + ":" + "Pentagram", 7, CURSE_TEXPACK);
- vampireHunger = new CurseVampireHunger(
- Variables.MODNAME + ":" + "Vampire Hunger",
- 8, CURSE_TEXPACK);
+ vampireHunger = new CurseVampireHunger(Variables.MODNAME + ":" + "Vampire Hunger", 8, CURSE_TEXPACK);
- humbleBundle = new CurseHumbleBundle(
- Variables.MODNAME + ":" + "Humble Bundle",
- 9, CURSE_TEXPACK);
+ humbleBundle = new CurseHumbleBundle(Variables.MODNAME + ":" + "Humble Bundle", 9, CURSE_TEXPACK);
- deathsTouch = new CurseDeathsTouch(
- Variables.MODNAME + ":" + "Deaths Touch",
- 10, CURSE_TEXPACK);
+ deathsTouch = new CurseDeathsTouch(Variables.MODNAME + ":" + "Deaths Touch", 10, CURSE_TEXPACK);
- scionOfHell = new CurseScionOfHell(
- Variables.MODNAME + ":" + "Scion of Hell",
- 11, CURSE_TEXPACK);
+ scionOfHell = new CurseScionOfHell(Variables.MODNAME + ":" + "Scion of Hell", 11, CURSE_TEXPACK);
- moneyEqualsPower = new CurseMoneyEqualsPower(
- Variables.MODNAME + ":"
- + "Money Equals Power",
- 12, CURSE_TEXPACK);
+ moneyEqualsPower = new CurseMoneyEqualsPower(Variables.MODNAME + ":" + "Money Equals Power", 12, CURSE_TEXPACK);
- doubleDown = new CurseDoubleDown(
- Variables.MODNAME + ":" + "Double Down",
- 19, CURSE_TEXPACK);
+ doubleDown = new CurseDoubleDown(Variables.MODNAME + ":" + "Double Down", 19, CURSE_TEXPACK);
- incredibleDevotion = new CurseIncredibleDevotion(
- Variables.MODNAME + ":"
- + "Incredible Devotion",
- 20, CURSE_TEXPACK);
+ incredibleDevotion = new CurseIncredibleDevotion(Variables.MODNAME + ":" + "Incredible Devotion", 20,
+ CURSE_TEXPACK);
- sacredOath = new CurseSacredOath(
- Variables.MODNAME + ":" + "Sacred Oath",
- 21, CURSE_TEXPACK);
+ sacredOath = new CurseSacredOath(Variables.MODNAME + ":" + "Sacred Oath", 21, CURSE_TEXPACK);
}
}
diff --git a/src/main/java/darkknight/jewelrycraft/curses/CurseMidasTouch.java b/src/main/java/darkknight/jewelrycraft/curses/CurseMidasTouch.java index d576803..875f5c1 100755 --- a/src/main/java/darkknight/jewelrycraft/curses/CurseMidasTouch.java +++ b/src/main/java/darkknight/jewelrycraft/curses/CurseMidasTouch.java @@ -20,14 +20,7 @@ import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
-import net.minecraft.item.Item;
-import net.minecraft.item.ItemArmor;
-import net.minecraft.item.ItemAxe;
-import net.minecraft.item.ItemHoe;
-import net.minecraft.item.ItemPickaxe;
-import net.minecraft.item.ItemSpade;
-import net.minecraft.item.ItemStack;
-import net.minecraft.item.ItemSword;
+import net.minecraft.item.*;
import net.minecraft.util.MathHelper;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
@@ -39,32 +32,17 @@ public class CurseMidasTouch extends Curse { }
@Override
- public void attackedByPlayerAction(LivingAttackEvent event,
- World world, EntityPlayer player, Entity target) {
- if (!world.isRemote && target instanceof EntityLivingBase
- && !(target instanceof EntityHeart)
- && !(target instanceof EntityHalfHeart)
- && player.inventory
- .getCurrentItem() == null) {
- world.setBlock(MathHelper
- .floor_double(target.posX),
- MathHelper.floor_double(
- target.posY),
- MathHelper.floor_double(
- target.posZ),
- BlockList.midasTouchBlock, 0, 2);
+ public void attackedByPlayerAction(LivingAttackEvent event, World world, EntityPlayer player, Entity target) {
+ if (!world.isRemote && target instanceof EntityLivingBase && !(target instanceof EntityHeart)
+ && !(target instanceof EntityHalfHeart) && player.inventory.getCurrentItem() == null) {
+ world.setBlock(MathHelper.floor_double(target.posX), MathHelper.floor_double(target.posY),
+ MathHelper.floor_double(target.posZ), BlockList.midasTouchBlock, 0, 2);
TileEntityMidasTouch midasTouchVictim = new TileEntityMidasTouch();
midasTouchVictim.setEntity(target);
- world.setTileEntity(
- MathHelper.floor_double(
- target.posX),
- MathHelper.floor_double(
- target.posY),
- MathHelper.floor_double(
- target.posZ),
- midasTouchVictim);
+ world.setTileEntity(MathHelper.floor_double(target.posX), MathHelper.floor_double(target.posY),
+ MathHelper.floor_double(target.posZ), midasTouchVictim);
target.setDead();
}
@@ -74,15 +52,11 @@ public class CurseMidasTouch extends Curse { public void action(World world, EntityPlayer player) {
ItemStack curItem = player.inventory.getCurrentItem();
- if (curItem != null
- && curItem.getItem() != ItemList.goldObj
- && !isGoldenObject(curItem.getItem())) {
+ if (curItem != null && curItem.getItem() != ItemList.goldObj && !isGoldenObject(curItem.getItem())) {
int index = player.inventory.currentItem;
ItemStack item = curItem;
- ItemStack result = new ItemStack(ItemList.goldObj,
- item.stackSize,
- item.getItemDamage());
+ ItemStack result = new ItemStack(ItemList.goldObj, item.stackSize, item.getItemDamage());
JewelryNBT.addItem(result, item);
@@ -90,135 +64,67 @@ public class CurseMidasTouch extends Curse { result = changeItem(curItem);
}
- player.inventory.setInventorySlotContents(index,
- result);
+ player.inventory.setInventorySlotContents(index, result);
}
}
public ItemStack changeItem(ItemStack currItem) {
if (currItem.getItem() instanceof ItemSword) {
- return new ItemStack(Items.golden_sword,
- currItem.stackSize,
- currItem.getItemDamage());
+ return new ItemStack(Items.golden_sword, currItem.stackSize, currItem.getItemDamage());
} else if (currItem.getItem() instanceof ItemSpade) {
- return new ItemStack(Items.golden_shovel,
- currItem.stackSize,
- currItem.getItemDamage());
+ return new ItemStack(Items.golden_shovel, currItem.stackSize, currItem.getItemDamage());
} else if (currItem.getItem() instanceof ItemPickaxe) {
- return new ItemStack(Items.golden_pickaxe,
- currItem.stackSize,
- currItem.getItemDamage());
+ return new ItemStack(Items.golden_pickaxe, currItem.stackSize, currItem.getItemDamage());
} else if (currItem.getItem() instanceof ItemAxe) {
- return new ItemStack(Items.golden_axe,
- currItem.stackSize,
- currItem.getItemDamage());
+ return new ItemStack(Items.golden_axe, currItem.stackSize, currItem.getItemDamage());
} else if (currItem.getItem() instanceof ItemHoe) {
- return new ItemStack(Items.golden_hoe,
- currItem.stackSize,
- currItem.getItemDamage());
- } else if (currItem.getItem() instanceof ItemArmor
- && ((ItemArmor) currItem
- .getItem()).armorType == 0) {
- return new ItemStack(Items.golden_helmet,
- currItem.stackSize,
- currItem.getItemDamage());
- } else if (currItem.getItem() instanceof ItemArmor
- && ((ItemArmor) currItem
- .getItem()).armorType == 1) {
- return new ItemStack(Items.golden_chestplate,
- currItem.stackSize,
- currItem.getItemDamage());
- } else if (currItem.getItem() instanceof ItemArmor
- && ((ItemArmor) currItem
- .getItem()).armorType == 2) {
- return new ItemStack(Items.golden_leggings,
- currItem.stackSize,
- currItem.getItemDamage());
- } else if (currItem.getItem() instanceof ItemArmor
- && ((ItemArmor) currItem
- .getItem()).armorType == 3) {
- return new ItemStack(Items.golden_boots,
- currItem.stackSize,
- currItem.getItemDamage());
- } else if (currItem.getItem().getUnlocalizedName()
- .toLowerCase().contains("horsearmor")) {
- return new ItemStack(Items.golden_horse_armor,
- currItem.stackSize, 0);
- } else if (currItem.getItem().getUnlocalizedName()
- .toLowerCase().contains("nugget")
- || currItem.getItem()
- .getItemStackDisplayName(
- currItem)
- .toLowerCase()
- .contains(" nugget")
- || currItem.getItem()
- .getItemStackDisplayName(
- currItem)
- .toLowerCase()
- .contains("nugget ")) {
- return new ItemStack(Items.gold_nugget,
- currItem.stackSize, 0);
- } else if (currItem.getItem().getUnlocalizedName()
- .toLowerCase().contains("ingot")
- || currItem.getItem()
- .getItemStackDisplayName(
- currItem)
- .toLowerCase()
- .contains(" ingot")
- || currItem.getItem()
- .getItemStackDisplayName(
- currItem)
- .toLowerCase()
- .contains("ingot ")) {
- return new ItemStack(Items.gold_ingot,
- currItem.stackSize, 0);
- } else if (Block.getBlockFromItem(currItem
- .getItem()) instanceof BlockPressurePlate
- || Block.getBlockFromItem(currItem
- .getItem()) instanceof BlockPressurePlateWeighted) {
- return new ItemStack(
- Blocks.light_weighted_pressure_plate,
- currItem.stackSize, 0);
- } else if (Block.getBlockFromItem(currItem
- .getItem()) instanceof BlockCompressed) {
- return new ItemStack(Blocks.gold_block,
- currItem.stackSize, 0);
+ return new ItemStack(Items.golden_hoe, currItem.stackSize, currItem.getItemDamage());
+ } else if (currItem.getItem() instanceof ItemArmor && ((ItemArmor) currItem.getItem()).armorType == 0) {
+ return new ItemStack(Items.golden_helmet, currItem.stackSize, currItem.getItemDamage());
+ } else if (currItem.getItem() instanceof ItemArmor && ((ItemArmor) currItem.getItem()).armorType == 1) {
+ return new ItemStack(Items.golden_chestplate, currItem.stackSize, currItem.getItemDamage());
+ } else if (currItem.getItem() instanceof ItemArmor && ((ItemArmor) currItem.getItem()).armorType == 2) {
+ return new ItemStack(Items.golden_leggings, currItem.stackSize, currItem.getItemDamage());
+ } else if (currItem.getItem() instanceof ItemArmor && ((ItemArmor) currItem.getItem()).armorType == 3) {
+ return new ItemStack(Items.golden_boots, currItem.stackSize, currItem.getItemDamage());
+ } else if (currItem.getItem().getUnlocalizedName().toLowerCase().contains("horsearmor")) {
+ return new ItemStack(Items.golden_horse_armor, currItem.stackSize, 0);
+ } else if (currItem.getItem().getUnlocalizedName().toLowerCase().contains("nugget")
+ || currItem.getItem().getItemStackDisplayName(currItem).toLowerCase().contains(" nugget")
+ || currItem.getItem().getItemStackDisplayName(currItem).toLowerCase().contains("nugget ")) {
+ return new ItemStack(Items.gold_nugget, currItem.stackSize, 0);
+ } else if (currItem.getItem().getUnlocalizedName().toLowerCase().contains("ingot")
+ || currItem.getItem().getItemStackDisplayName(currItem).toLowerCase().contains(" ingot")
+ || currItem.getItem().getItemStackDisplayName(currItem).toLowerCase().contains("ingot ")) {
+ return new ItemStack(Items.gold_ingot, currItem.stackSize, 0);
+ } else if (Block.getBlockFromItem(currItem.getItem()) instanceof BlockPressurePlate
+ || Block.getBlockFromItem(currItem.getItem()) instanceof BlockPressurePlateWeighted) {
+ return new ItemStack(Blocks.light_weighted_pressure_plate, currItem.stackSize, 0);
+ } else if (Block.getBlockFromItem(currItem.getItem()) instanceof BlockCompressed) {
+ return new ItemStack(Blocks.gold_block, currItem.stackSize, 0);
}
return null;
}
public boolean isGoldenObject(Item item) {
- return item.equals(Items.gold_ingot)
- || item.equals(Items.gold_nugget)
- || item.equals(Items.golden_helmet)
- || item.equals(Items.golden_chestplate)
- || item.equals(Items.golden_leggings)
- || item.equals(Items.golden_boots)
- || item.equals(Items.golden_sword)
- || item.equals(Items.golden_shovel)
- || item.equals(Items.golden_pickaxe)
- || item.equals(Items.golden_axe)
- || item.equals(Items.golden_apple)
- || item.equals(Items.golden_hoe)
- || item.equals(Items.golden_horse_armor)
- || Block.getBlockFromItem(item)
- .equals(Blocks.gold_block)
- || Block.getBlockFromItem(item).equals(
- Blocks.light_weighted_pressure_plate);
+ return item.equals(Items.gold_ingot) || item.equals(Items.gold_nugget) || item.equals(Items.golden_helmet)
+ || item.equals(Items.golden_chestplate) || item.equals(Items.golden_leggings)
+ || item.equals(Items.golden_boots) || item.equals(Items.golden_sword)
+ || item.equals(Items.golden_shovel) || item.equals(Items.golden_pickaxe)
+ || item.equals(Items.golden_axe) || item.equals(Items.golden_apple) || item.equals(Items.golden_hoe)
+ || item.equals(Items.golden_horse_armor) || Block.getBlockFromItem(item).equals(Blocks.gold_block)
+ || Block.getBlockFromItem(item).equals(Blocks.light_weighted_pressure_plate);
}
@Override
public String getDescription() {
- return StatCollector.translateToLocal("curse."
- + Variables.MODID
- + ".midastouch.description");
+ return StatCollector.translateToLocal("curse." + Variables.MODID + ".midastouch.description");
}
@Override
public String getDisplayName() {
- return StatCollector.translateToLocal("curse."
- + Variables.MODID + ".midastouch");
+ return StatCollector.translateToLocal("curse." + Variables.MODID + ".midastouch");
}
@Override
@@ -236,8 +142,7 @@ public class CurseMidasTouch extends Curse { }
@Override
- public int weight(World world, EntityPlayer player,
- Random random) {
+ public int weight(World world, EntityPlayer player, Random random) {
return 2;
}
}
diff --git a/src/main/java/darkknight/jewelrycraft/curses/CurseMoneyEqualsPower.java b/src/main/java/darkknight/jewelrycraft/curses/CurseMoneyEqualsPower.java index 741a857..c93bbe9 100755 --- a/src/main/java/darkknight/jewelrycraft/curses/CurseMoneyEqualsPower.java +++ b/src/main/java/darkknight/jewelrycraft/curses/CurseMoneyEqualsPower.java @@ -15,20 +15,17 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; public class CurseMoneyEqualsPower extends Curse { - public CurseMoneyEqualsPower(String name, int txtID, - String texturepack) { + public CurseMoneyEqualsPower(String name, int txtID, String texturepack) { super(name, txtID, texturepack); } @Override - public void entityDropItems(EntityPlayer player, Entity target, - ArrayList<EntityItem> drops) { + public void entityDropItems(EntityPlayer player, Entity target, ArrayList<EntityItem> drops) { int dropsTaken = 0; for (EntityItem item : drops) { if (rand.nextBoolean()) { - int stackSize = item - .getEntityItem().stackSize; + int stackSize = item.getEntityItem().stackSize; int takenItems = rand.nextInt(stackSize); item.getEntityItem().stackSize -= takenItems; @@ -42,48 +39,27 @@ public class CurseMoneyEqualsPower extends Curse { if (dropsTaken > 0) { if (dropsTaken > 3) { - player.addPotionEffect(new PotionEffect( - Potion.digSpeed.id, - dropsTaken * 30, 1)); - player.addPotionEffect(new PotionEffect( - Potion.moveSpeed.id, - dropsTaken * 30, 1)); - - player.addChatComponentMessage( - new ChatComponentText( - StatCollector.translateToLocal( - EnumChatFormatting.RED - + "curse.jewlrycraft2.moneyEqualsPower.bless1"))); + player.addPotionEffect(new PotionEffect(Potion.digSpeed.id, dropsTaken * 30, 1)); + player.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, dropsTaken * 30, 1)); + + player.addChatComponentMessage(new ChatComponentText(StatCollector + .translateToLocal(EnumChatFormatting.RED + "curse.jewlrycraft2.moneyEqualsPower.bless1"))); } if (dropsTaken > 6) { - player.addPotionEffect(new PotionEffect( - Potion.resistance.id, - dropsTaken * 20, 1)); - player.addPotionEffect(new PotionEffect( - Potion.damageBoost.id, - dropsTaken * 20, 1)); - - player.addChatComponentMessage( - new ChatComponentText( - StatCollector.translateToLocal( - EnumChatFormatting.RED - + "curse.jewlrycraft2.moneyEqualsPower.bless2"))); + player.addPotionEffect(new PotionEffect(Potion.resistance.id, dropsTaken * 20, 1)); + player.addPotionEffect(new PotionEffect(Potion.damageBoost.id, dropsTaken * 20, 1)); + + player.addChatComponentMessage(new ChatComponentText(StatCollector + .translateToLocal(EnumChatFormatting.RED + "curse.jewlrycraft2.moneyEqualsPower.bless2"))); } if (dropsTaken > 9) { - player.addPotionEffect(new PotionEffect( - Potion.regeneration.id, - dropsTaken * 10, 1)); - player.addPotionEffect(new PotionEffect( - Potion.heal.id, - dropsTaken * 10, 1)); - - player.addChatComponentMessage( - new ChatComponentText( - StatCollector.translateToLocal( - EnumChatFormatting.RED - + "curse.jewlrycraft2.moneyEqualsPower.bless3"))); + player.addPotionEffect(new PotionEffect(Potion.regeneration.id, dropsTaken * 10, 1)); + player.addPotionEffect(new PotionEffect(Potion.heal.id, dropsTaken * 10, 1)); + + player.addChatComponentMessage(new ChatComponentText(StatCollector + .translateToLocal(EnumChatFormatting.RED + "curse.jewlrycraft2.moneyEqualsPower.bless3"))); } } } @@ -95,14 +71,11 @@ public class CurseMoneyEqualsPower extends Curse { @Override public String getDescription() { - return StatCollector.translateToLocal("curse." - + Variables.MODID - + ".moneyEqualsPower.description"); + return StatCollector.translateToLocal("curse." + Variables.MODID + ".moneyEqualsPower.description"); } @Override public String getDisplayName() { - return StatCollector.translateToLocal("curse." - + Variables.MODID + ".moneyEqualsPower"); + return StatCollector.translateToLocal("curse." + Variables.MODID + ".moneyEqualsPower"); } } diff --git a/src/main/java/darkknight/jewelrycraft/curses/CursePentagram.java b/src/main/java/darkknight/jewelrycraft/curses/CursePentagram.java index bf40d55..659cca8 100755 --- a/src/main/java/darkknight/jewelrycraft/curses/CursePentagram.java +++ b/src/main/java/darkknight/jewelrycraft/curses/CursePentagram.java @@ -17,11 +17,7 @@ import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.util.AxisAlignedBB;
-import net.minecraft.util.ChatComponentText;
-import net.minecraft.util.EnumChatFormatting;
-import net.minecraft.util.ResourceLocation;
-import net.minecraft.util.StatCollector;
+import net.minecraft.util.*;
import net.minecraft.world.World;
import net.minecraftforge.client.event.RenderHandEvent;
import net.minecraftforge.client.event.RenderPlayerEvent;
@@ -37,92 +33,48 @@ public class CursePentagram extends Curse { public void action(World world, EntityPlayer player) {
super.action(world, player);
if (!world.isRemote) {
- NBTTagCompound playerInfo = PlayerUtils
- .getModPlayerPersistTag(player,
- Variables.MODID);
+ NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(player, Variables.MODID);
- for (Object entity : world
- .getEntitiesWithinAABBExcludingEntity(
- player,
- AxisAlignedBB.getBoundingBox(
- player.boundingBox.minX
- - 0.5F,
- player.boundingBox.minY,
- player.boundingBox.minZ
- - 0.5F,
- player.boundingBox.maxX
- + 0.5F,
- player.boundingBox.maxY,
- player.boundingBox.maxZ
- + 0.5F))) {
+ for (Object entity : world.getEntitiesWithinAABBExcludingEntity(player,
+ AxisAlignedBB.getBoundingBox(player.boundingBox.minX - 0.5F, player.boundingBox.minY,
+ player.boundingBox.minZ - 0.5F, player.boundingBox.maxX + 0.5F, player.boundingBox.maxY,
+ player.boundingBox.maxZ + 0.5F))) {
if (entity instanceof EntityLivingBase) {
- NBTTagCompound target = ((EntityLivingBase) entity)
- .getEntityData();
+ NBTTagCompound target = ((EntityLivingBase) entity).getEntityData();
- int maxHealthStolen = JewelrycraftUtil
- .isAchievementUnlocked(
- player,
- AchievementsList.pentagram)
- ? 3
- : 2;
+ int maxHealthStolen = JewelrycraftUtil.isAchievementUnlocked(player, AchievementsList.pentagram) ? 3
+ : 2;
- boolean canStealHealth = target
- .getInteger("stolenHealth") < maxHealthStolen;
+ boolean canStealHealth = target.getInteger("stolenHealth") < maxHealthStolen;
- if (canStealHealth && rand.nextInt(
- 40) == 0) {
- ((EntityLivingBase) entity)
- .getEntityAttribute(
- SharedMonsterAttributes.maxHealth)
- .setBaseValue(((EntityLivingBase) entity)
- .getMaxHealth()
- - 2f);
+ if (canStealHealth && rand.nextInt(40) == 0) {
+ ((EntityLivingBase) entity).getEntityAttribute(SharedMonsterAttributes.maxHealth)
+ .setBaseValue(((EntityLivingBase) entity).getMaxHealth() - 2f);
- target.setInteger(
- "stolenHealth",
- target.hasKey("stolenHealth")
- ? target.getInteger(
- "stolenHealth")
- + 1
- : 1);
+ target.setInteger("stolenHealth",
+ target.hasKey("stolenHealth") ? target.getInteger("stolenHealth") + 1 : 1);
- playerInfo.setInteger(
- "heartsStolen",
- playerInfo.hasKey(
- "heartsStolen") ? playerInfo.getInteger("heartsStolen") + 1 : 1);
+ playerInfo.setInteger("heartsStolen",
+ playerInfo.hasKey("heartsStolen") ? playerInfo.getInteger("heartsStolen") + 1 : 1);
if (player.shouldHeal()) {
player.heal(2F);
} else {
- player.getEntityAttribute(
- SharedMonsterAttributes.maxHealth)
- .setBaseValue(player
- .getMaxHealth()
- + 2f);
+ player.getEntityAttribute(SharedMonsterAttributes.maxHealth)
+ .setBaseValue(player.getMaxHealth() + 2f);
}
}
}
}
- if (!playerInfo.getBoolean(
- AchievementsList.pentagram.statId)) {
- if (ticksActive > 24000 && playerInfo
- .getInteger("heartsStolen") <= 0)
- player.addStat(AchievementsList.pentagram,
- 1);
+ if (!playerInfo.getBoolean(AchievementsList.pentagram.statId)) {
+ if (ticksActive > 24000 && playerInfo.getInteger("heartsStolen") <= 0)
+ player.addStat(AchievementsList.pentagram, 1);
else {
- player.addChatComponentMessage(
- new ChatComponentText(
- EnumChatFormatting.RED
- + StatCollector.translateToLocal(
- "challenge.failed")
- + " "
- + EnumChatFormatting.GOLD
- + StatCollector.translateToLocal(
- AchievementsList.pentagram.statId)));
- playerInfo.setBoolean(
- AchievementsList.pentagram.statId,
- true);
+ player.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.RED
+ + StatCollector.translateToLocal("challenge.failed") + " " + EnumChatFormatting.GOLD
+ + StatCollector.translateToLocal(AchievementsList.pentagram.statId)));
+ playerInfo.setBoolean(AchievementsList.pentagram.statId, true);
}
}
}
@@ -130,24 +82,17 @@ public class CursePentagram extends Curse { @SuppressWarnings("cast")
@Override
- public void playerRender(EntityPlayer player,
- RenderPlayerEvent.Specials.Post event) {
- ResourceLocation PENTAGRAM_TEXTURE = new ResourceLocation(
- Variables.MODID,
- "textures/gui/" + getTexturePack()
- + ".png");
+ public void playerRender(EntityPlayer player, RenderPlayerEvent.Specials.Post event) {
+ ResourceLocation PENTAGRAM_TEXTURE = new ResourceLocation(Variables.MODID,
+ "textures/gui/" + getTexturePack() + ".png");
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_SRC_COLOR);
Tessellator tessellator = Tessellator.instance;
- TextureManager texturemanager = Minecraft.getMinecraft()
- .getTextureManager();
+ TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager();
texturemanager.bindTexture(PENTAGRAM_TEXTURE);
GL11.glRotatef(rot, 0F, 1F, 0F);
- GL11.glTranslatef(-0.8F,
- (player.isSneaking() ? 0.1625F : 0F)
- + 1.5F,
- -0.8F);
+ GL11.glTranslatef(-0.8F, (player.isSneaking() ? 0.1625F : 0F) + 1.5F, -0.8F);
GL11.glRotatef(90F, 1F, 0F, 0F);
GL11.glScalef(0.05F, 0.05F, 0.05F);
rot += 3F;
@@ -162,21 +107,13 @@ public class CursePentagram extends Curse { int width = 32;
int height = 32;
tessellator.startDrawingQuads();
- tessellator.addVertexWithUV((double) (x + 0),
- (double) (y + height), (double) 0,
- (double) ((float) (u + 0) * f),
+ tessellator.addVertexWithUV((double) (x + 0), (double) (y + height), (double) 0, (double) ((float) (u + 0) * f),
(double) ((float) (v + height) * f1));
- tessellator.addVertexWithUV((double) (x + width),
- (double) (y + height), (double) 0,
- (double) ((float) (u + width) * f),
- (double) ((float) (v + height) * f1));
- tessellator.addVertexWithUV((double) (x + width),
- (double) (y + 0), (double) 0,
- (double) ((float) (u + width) * f),
- (double) ((float) (v + 0) * f1));
- tessellator.addVertexWithUV((double) (x + 0),
- (double) (y + 0), (double) 0,
- (double) ((float) (u + 0) * f),
+ tessellator.addVertexWithUV((double) (x + width), (double) (y + height), (double) 0,
+ (double) ((float) (u + width) * f), (double) ((float) (v + height) * f1));
+ tessellator.addVertexWithUV((double) (x + width), (double) (y + 0), (double) 0,
+ (double) ((float) (u + width) * f), (double) ((float) (v + 0) * f1));
+ tessellator.addVertexWithUV((double) (x + 0), (double) (y + 0), (double) 0, (double) ((float) (u + 0) * f),
(double) ((float) (v + 0) * f1));
tessellator.draw();
GL11.glDisable(GL11.GL_BLEND);
@@ -186,26 +123,18 @@ public class CursePentagram extends Curse { @SuppressWarnings("cast")
@Override
@SideOnly(Side.CLIENT)
- public void playerHandRender(EntityPlayer player,
- RenderHandEvent event) {
+ public void playerHandRender(EntityPlayer player, RenderHandEvent event) {
if (Minecraft.getMinecraft().gameSettings.thirdPersonView == 0) {
- ResourceLocation PENTAGRAM_TEXTURE = new ResourceLocation(
- Variables.MODID,
- "textures/gui/" + getTexturePack()
- + ".png");
+ ResourceLocation PENTAGRAM_TEXTURE = new ResourceLocation(Variables.MODID,
+ "textures/gui/" + getTexturePack() + ".png");
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_SRC_COLOR);
Tessellator tessellator = Tessellator.instance;
- TextureManager texturemanager = Minecraft
- .getMinecraft()
- .getTextureManager();
+ TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager();
texturemanager.bindTexture(PENTAGRAM_TEXTURE);
GL11.glRotatef(rot, 0F, 1F, 0F);
- GL11.glTranslatef(-0.8F,
- (player.isSneaking() ? 0.1625F
- : 0F) - 1.6F,
- -0.8F);
+ GL11.glTranslatef(-0.8F, (player.isSneaking() ? 0.1625F : 0F) - 1.6F, -0.8F);
GL11.glRotatef(90F, 1F, 0F, 0F);
GL11.glScalef(0.05F, 0.05F, 0.05F);
rot += 3F;
@@ -220,23 +149,13 @@ public class CursePentagram extends Curse { int width = 32;
int height = 32;
tessellator.startDrawingQuads();
- tessellator.addVertexWithUV((double) (x + 0),
- (double) (y + height), (double) 0,
- (double) ((float) (u + 0) * f),
- (double) ((float) (v + height)
- * f1));
- tessellator.addVertexWithUV((double) (x + width),
- (double) (y + height), (double) 0,
- (double) ((float) (u + width) * f),
- (double) ((float) (v + height)
- * f1));
- tessellator.addVertexWithUV((double) (x + width),
- (double) (y + 0), (double) 0,
- (double) ((float) (u + width) * f),
- (double) ((float) (v + 0) * f1));
- tessellator.addVertexWithUV((double) (x + 0),
- (double) (y + 0), (double) 0,
- (double) ((float) (u + 0) * f),
+ tessellator.addVertexWithUV((double) (x + 0), (double) (y + height), (double) 0,
+ (double) ((float) (u + 0) * f), (double) ((float) (v + height) * f1));
+ tessellator.addVertexWithUV((double) (x + width), (double) (y + height), (double) 0,
+ (double) ((float) (u + width) * f), (double) ((float) (v + height) * f1));
+ tessellator.addVertexWithUV((double) (x + width), (double) (y + 0), (double) 0,
+ (double) ((float) (u + width) * f), (double) ((float) (v + 0) * f1));
+ tessellator.addVertexWithUV((double) (x + 0), (double) (y + 0), (double) 0, (double) ((float) (u + 0) * f),
(double) ((float) (v + 0) * f1));
tessellator.draw();
GL11.glDisable(GL11.GL_BLEND);
@@ -246,15 +165,12 @@ public class CursePentagram extends Curse { @Override
public String getDescription() {
- return StatCollector.translateToLocal("curse."
- + Variables.MODID
- + ".pentagram.description");
+ return StatCollector.translateToLocal("curse." + Variables.MODID + ".pentagram.description");
}
@Override
public String getDisplayName() {
- return StatCollector.translateToLocal(
- "curse." + Variables.MODID + ".pentagram");
+ return StatCollector.translateToLocal("curse." + Variables.MODID + ".pentagram");
}
@Override
diff --git a/src/main/java/darkknight/jewelrycraft/curses/CurseRabbitsPaw.java b/src/main/java/darkknight/jewelrycraft/curses/CurseRabbitsPaw.java index da61cd7..5517361 100755 --- a/src/main/java/darkknight/jewelrycraft/curses/CurseRabbitsPaw.java +++ b/src/main/java/darkknight/jewelrycraft/curses/CurseRabbitsPaw.java @@ -23,8 +23,7 @@ public class CurseRabbitsPaw extends Curse { }
@Override
- public void entityDropItems(EntityPlayer player, Entity target,
- ArrayList<EntityItem> drops) {
+ public void entityDropItems(EntityPlayer player, Entity target, ArrayList<EntityItem> drops) {
for (EntityItem item : drops) {
ItemStack drop = item.getEntityItem().copy();
@@ -36,13 +35,10 @@ public class CurseRabbitsPaw extends Curse { }
@Override
- public void entityDeathAction(World world, EntityLivingBase target,
- EntityPlayer player) {
+ public void entityDeathAction(World world, EntityLivingBase target, EntityPlayer player) {
if (rand.nextInt(3) == 0)
- world.spawnEntityInWorld(new EntityXPOrb(world,
- target.posX, target.posY,
- target.posZ,
- 1 + rand.nextInt(40)));
+ world.spawnEntityInWorld(
+ new EntityXPOrb(world, target.posX, target.posY, target.posZ, 1 + rand.nextInt(40)));
}
@Override
@@ -52,15 +48,12 @@ public class CurseRabbitsPaw extends Curse { @Override
public String getDescription() {
- return StatCollector.translateToLocal("curse."
- + Variables.MODID
- + ".rabbitspaw.description");
+ return StatCollector.translateToLocal("curse." + Variables.MODID + ".rabbitspaw.description");
}
@Override
public String getDisplayName() {
- return StatCollector.translateToLocal("curse."
- + Variables.MODID + ".rabbitspaw");
+ return StatCollector.translateToLocal("curse." + Variables.MODID + ".rabbitspaw");
}
@Override
diff --git a/src/main/java/darkknight/jewelrycraft/curses/CurseRottenHeart.java b/src/main/java/darkknight/jewelrycraft/curses/CurseRottenHeart.java index 78d10bc..c2e3fdf 100755 --- a/src/main/java/darkknight/jewelrycraft/curses/CurseRottenHeart.java +++ b/src/main/java/darkknight/jewelrycraft/curses/CurseRottenHeart.java @@ -16,24 +16,18 @@ public class CurseRottenHeart extends Curse { @Override
public void action(World world, EntityPlayer player) {
- if (!player.isPotionActive(Potion.poison) || player
- .getActivePotionEffect(Potion.poison)
- .getDuration() < 30)
- player.addPotionEffect(new PotionEffect(
- Potion.poison.id, 80));
+ if (!player.isPotionActive(Potion.poison) || player.getActivePotionEffect(Potion.poison).getDuration() < 30)
+ player.addPotionEffect(new PotionEffect(Potion.poison.id, 80));
}
@Override
public String getDescription() {
- return StatCollector.translateToLocal("curse."
- + Variables.MODID
- + ".rottenheart.description");
+ return StatCollector.translateToLocal("curse." + Variables.MODID + ".rottenheart.description");
}
@Override
public String getDisplayName() {
- return StatCollector.translateToLocal("curse."
- + Variables.MODID + ".rottenheart");
+ return StatCollector.translateToLocal("curse." + Variables.MODID + ".rottenheart");
}
@Override
diff --git a/src/main/java/darkknight/jewelrycraft/curses/CurseSacredOath.java b/src/main/java/darkknight/jewelrycraft/curses/CurseSacredOath.java index 2465b89..ce8ad60 100644 --- a/src/main/java/darkknight/jewelrycraft/curses/CurseSacredOath.java +++ b/src/main/java/darkknight/jewelrycraft/curses/CurseSacredOath.java @@ -5,22 +5,18 @@ import darkknight.jewelrycraft.util.Variables; import net.minecraft.util.StatCollector; public class CurseSacredOath extends Curse { - public CurseSacredOath(String name, int txtID, - String texturepack) { + public CurseSacredOath(String name, int txtID, String texturepack) { super(name, txtID, texturepack); } @Override public String getDescription() { - return StatCollector.translateToLocal("curse." - + Variables.MODID - + ".sacredoath.description"); + return StatCollector.translateToLocal("curse." + Variables.MODID + ".sacredoath.description"); } @Override public String getDisplayName() { - return StatCollector.translateToLocal("curse." - + Variables.MODID + ".sacredoath"); + return StatCollector.translateToLocal("curse." + Variables.MODID + ".sacredoath"); } // TODO implement sacred oath to do something diff --git a/src/main/java/darkknight/jewelrycraft/curses/CurseScionOfHell.java b/src/main/java/darkknight/jewelrycraft/curses/CurseScionOfHell.java index 2264017..1c5b63e 100755 --- a/src/main/java/darkknight/jewelrycraft/curses/CurseScionOfHell.java +++ b/src/main/java/darkknight/jewelrycraft/curses/CurseScionOfHell.java @@ -10,22 +10,17 @@ import net.minecraft.world.World; import net.minecraftforge.event.entity.living.LivingHealEvent; public class CurseScionOfHell extends Curse { - public CurseScionOfHell(String name, int txtID, - String texturepack) { + public CurseScionOfHell(String name, int txtID, String texturepack) { super(name, txtID, texturepack); } @Override - public void entityDeathAction(World world, EntityLivingBase target, - EntityPlayer player) { - player.setHealth(Math.max(player.getMaxHealth(), - player.getHealth() + target.getMaxHealth() - / 5.0f)); + public void entityDeathAction(World world, EntityLivingBase target, EntityPlayer player) { + player.setHealth(Math.max(player.getMaxHealth(), player.getHealth() + target.getMaxHealth() / 5.0f)); } @Override - public void playerHealAction(World world, EntityPlayer player, - LivingHealEvent event) { + public void playerHealAction(World world, EntityPlayer player, LivingHealEvent event) { event.amount = 0; } @@ -36,14 +31,11 @@ public class CurseScionOfHell extends Curse { @Override public String getDescription() { - return StatCollector.translateToLocal("curse." - + Variables.MODID - + ".scionofhell.description"); + return StatCollector.translateToLocal("curse." + Variables.MODID + ".scionofhell.description"); } @Override public String getDisplayName() { - return StatCollector.translateToLocal("curse." - + Variables.MODID + ".scionofhell"); + return StatCollector.translateToLocal("curse." + Variables.MODID + ".scionofhell"); } } diff --git a/src/main/java/darkknight/jewelrycraft/curses/CurseVampireHunger.java b/src/main/java/darkknight/jewelrycraft/curses/CurseVampireHunger.java index 9b8c1f3..7d53f2a 100755 --- a/src/main/java/darkknight/jewelrycraft/curses/CurseVampireHunger.java +++ b/src/main/java/darkknight/jewelrycraft/curses/CurseVampireHunger.java @@ -17,41 +17,31 @@ import net.minecraft.world.World; *
*/
public class CurseVampireHunger extends Curse {
- protected CurseVampireHunger(String name, int txtID,
- String texturepack) {
+ protected CurseVampireHunger(String name, int txtID, String texturepack) {
super(name, txtID, texturepack);
}
- public void attackedByPlayerAction(World world,
- EntityPlayer player, Entity target) {
+ public void attackedByPlayerAction(World world, EntityPlayer player, Entity target) {
if (player.shouldHeal() && rand.nextBoolean())
player.heal(1F);
}
@Override
public void action(World world, EntityPlayer player) {
- if (!player.capabilities.isCreativeMode
- && world.isDaytime() && !world.isRaining()
- && world.canBlockSeeTheSky(MathHelper
- .floor_double(player.posX),
- MathHelper.floor_double(
- player.posY + 1F),
- MathHelper.floor_double(
- player.posZ)))
+ if (!player.capabilities.isCreativeMode && world.isDaytime() && !world.isRaining()
+ && world.canBlockSeeTheSky(MathHelper.floor_double(player.posX),
+ MathHelper.floor_double(player.posY + 1F), MathHelper.floor_double(player.posZ)))
player.setFire(8);
}
@Override
public String getDescription() {
- return StatCollector.translateToLocal("curse."
- + Variables.MODID
- + ".vampirehunger.description");
+ return StatCollector.translateToLocal("curse." + Variables.MODID + ".vampirehunger.description");
}
@Override
public String getDisplayName() {
- return StatCollector.translateToLocal("curse."
- + Variables.MODID + ".vampirehunger");
+ return StatCollector.translateToLocal("curse." + Variables.MODID + ".vampirehunger");
}
@Override
diff --git a/src/main/java/darkknight/jewelrycraft/damage/DamageSourceList.java b/src/main/java/darkknight/jewelrycraft/damage/DamageSourceList.java index e156755..dd86778 100755 --- a/src/main/java/darkknight/jewelrycraft/damage/DamageSourceList.java +++ b/src/main/java/darkknight/jewelrycraft/damage/DamageSourceList.java @@ -7,23 +7,17 @@ import net.minecraft.util.DamageSource; * @author Sorin
*/
public class DamageSourceList {
- public static DamageSource shadows, weak, blackHeart,
- doubleDown;
- private static boolean isInitialized = false;
+ public static DamageSource shadows, weak, blackHeart, doubleDown;
+ private static boolean isInitialized = false;
/**
* @param e
*/
public static void postInit(FMLPostInitializationEvent e) {
if (!isInitialized) {
- shadows = new DamageSource("shadows")
- .setDamageBypassesArmor()
- .setDamageIsAbsolute();
- blackHeart = new DamageSource("blackHeart")
- .setDamageBypassesArmor()
- .setDamageIsAbsolute();
- weak = new DamageSource("weak")
- .setDamageBypassesArmor();
+ shadows = new DamageSource("shadows").setDamageBypassesArmor().setDamageIsAbsolute();
+ blackHeart = new DamageSource("blackHeart").setDamageBypassesArmor().setDamageIsAbsolute();
+ weak = new DamageSource("weak").setDamageBypassesArmor();
doubleDown = new DamageSource("doubleDown");
isInitialized = true;
}
diff --git a/src/main/java/darkknight/jewelrycraft/effects/EffectBlazePowder.java b/src/main/java/darkknight/jewelrycraft/effects/EffectBlazePowder.java index ebfa48c..f65d135 100755 --- a/src/main/java/darkknight/jewelrycraft/effects/EffectBlazePowder.java +++ b/src/main/java/darkknight/jewelrycraft/effects/EffectBlazePowder.java @@ -21,32 +21,22 @@ public class EffectBlazePowder extends ModifierEffects { }
@Override
- public void action(ItemStack item, EntityPlayer player,
- Item jewelry) {
+ public void action(ItemStack item, EntityPlayer player, Item jewelry) {
if (jewelry instanceof ItemNecklace) {
// Positive for necklace
- if (player.isBurning() && rand.nextInt(JewelryNBT
- .numberOfModifiers(item)) == 0)
+ if (player.isBurning() && rand.nextInt(JewelryNBT.numberOfModifiers(item)) == 0)
player.extinguish();
// Negative for necklace
if (player.isInWater())
- player.attackEntityFrom(DamageSource.drown,
- 1f + (JewelryNBT.numberOfModifiers(
- item) - 1)
- * 0.1F);
+ player.attackEntityFrom(DamageSource.drown, 1f + (JewelryNBT.numberOfModifiers(item) - 1) * 0.1F);
}
// Negative for bracelet
- if (jewelry instanceof ItemBracelet
- && player.isInWater()) {
- double slowAmount = 0.6D + (JewelryNBT
- .numberOfModifiers(item) - 1)
- * 0.05D;
+ if (jewelry instanceof ItemBracelet && player.isInWater()) {
+ double slowAmount = 0.6D + (JewelryNBT.numberOfModifiers(item) - 1) * 0.05D;
player.motionX *= slowAmount;
player.motionY *= slowAmount;
player.motionZ *= slowAmount;
- player.motionY -= (0.02D + (JewelryNBT
- .numberOfModifiers(item) - 1)
- * 0.005D);
+ player.motionY -= (0.02D + (JewelryNBT.numberOfModifiers(item) - 1) * 0.005D);
if (player.isCollidedHorizontally)
player.motionY = 0.30000001192092896D;
}
@@ -55,67 +45,41 @@ public class EffectBlazePowder extends ModifierEffects { if (player.getAir() >= 300)
player.setAir(player.getAir() / 2);
else
- player.setAir(player.getAir() - JewelryNBT
- .numberOfModifiers(item));
+ player.setAir(player.getAir() - JewelryNBT.numberOfModifiers(item));
}
}
@Override
- public boolean onEntityAttackedCancellable(ItemStack item,
- EntityPlayer player, Entity target, Item jewelry,
+ public boolean onEntityAttackedCancellable(ItemStack item, EntityPlayer player, Entity target, Item jewelry,
float amount) {
// Balanced for ring
- if (jewelry instanceof ItemRing && !player.isInWater()
- && rand.nextInt(JewelryNBT
- .numberOfModifiers(
- item)) == 0)
+ if (jewelry instanceof ItemRing && !player.isInWater() && rand.nextInt(JewelryNBT.numberOfModifiers(item)) == 0)
target.setFire(2);
return false;
}
@Override
- public boolean onPlayerAttackedCancellable(ItemStack item,
- EntityPlayer player, DamageSource source,
- Item jewelry, float amount) {
- if (jewelry instanceof ItemEarrings && rand.nextInt(4) == 0
- && source == DamageSource.lava
- || source == DamageSource.inFire
- || source == DamageSource.onFire) {
+ public boolean onPlayerAttackedCancellable(ItemStack item, EntityPlayer player, DamageSource source, Item jewelry,
+ float amount) {
+ if (jewelry instanceof ItemEarrings && rand.nextInt(4) == 0 && source == DamageSource.lava
+ || source == DamageSource.inFire || source == DamageSource.onFire) {
// Positive for earrings
- int stackSize = JewelryNBT.modifierSize(item,
- modifier);
+ int stackSize = JewelryNBT.modifierSize(item, modifier);
- player.heal(stackSize * 0.05F - (JewelryNBT
- .numberOfModifiers(item) - 1)
- * 0.01F);
+ player.heal(stackSize * 0.05F - (JewelryNBT.numberOfModifiers(item) - 1) * 0.01F);
return true;
}
// Positive for bracelet
if (jewelry instanceof ItemBracelet)
- if (source == DamageSource.inFire
- || source == DamageSource.onFire
+ if (source == DamageSource.inFire || source == DamageSource.onFire
|| source == DamageSource.lava
- && player.worldObj
- .isMaterialInBB(AxisAlignedBB
- .getBoundingBox(player.boundingBox.minX,
- player.boundingBox.minY,
- player.boundingBox.minZ,
- player.boundingBox.maxX,
- player.boundingBox.maxY
- - 0.7,
- player.boundingBox.maxZ),
- Material.lava)
- && !player.worldObj
- .isMaterialInBB(AxisAlignedBB
- .getBoundingBox(player.boundingBox.minX,
- player.boundingBox.minY
- + 0.9,
- player.boundingBox.minZ,
- player.boundingBox.maxX,
- player.boundingBox.maxY,
- player.boundingBox.maxZ),
- Material.lava)) {
+ && player.worldObj.isMaterialInBB(AxisAlignedBB.getBoundingBox(player.boundingBox.minX,
+ player.boundingBox.minY, player.boundingBox.minZ, player.boundingBox.maxX,
+ player.boundingBox.maxY - 0.7, player.boundingBox.maxZ), Material.lava)
+ && !player.worldObj.isMaterialInBB(AxisAlignedBB.getBoundingBox(player.boundingBox.minX,
+ player.boundingBox.minY + 0.9, player.boundingBox.minZ, player.boundingBox.maxX,
+ player.boundingBox.maxY, player.boundingBox.maxZ), Material.lava)) {
return true;
}
diff --git a/src/main/java/darkknight/jewelrycraft/effects/EffectEnderEye.java b/src/main/java/darkknight/jewelrycraft/effects/EffectEnderEye.java index 4f24e8f..1f0c325 100755 --- a/src/main/java/darkknight/jewelrycraft/effects/EffectEnderEye.java +++ b/src/main/java/darkknight/jewelrycraft/effects/EffectEnderEye.java @@ -19,11 +19,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
-import net.minecraft.util.ChatComponentText;
-import net.minecraft.util.DamageSource;
-import net.minecraft.util.EnumChatFormatting;
-import net.minecraft.util.StatCollector;
-import net.minecraft.util.Vec3;
+import net.minecraft.util.*;
import net.minecraft.world.ChunkPosition;
import net.minecraft.world.biome.BiomeGenBase;
@@ -40,8 +36,7 @@ public class EffectEnderEye extends ModifierEffects { if (Minecraft.getMinecraft().gameSettings.renderDistanceChunks <= 2) {
viewDistance = 10;
} else {
- viewDistance = Minecraft
- .getMinecraft().gameSettings.renderDistanceChunks;
+ viewDistance = Minecraft.getMinecraft().gameSettings.renderDistanceChunks;
}
setViewDistance(item, viewDistance);
@@ -51,185 +46,93 @@ public class EffectEnderEye extends ModifierEffects { @Override
public void onJewelryUnequipped(ItemStack item, Item jewelry) {
if (jewelry instanceof ItemRing)
- Minecraft.getMinecraft().gameSettings
- .setOptionFloatValue(
- Options.RENDER_DISTANCE,
- getViewDistance(item));
+ Minecraft.getMinecraft().gameSettings.setOptionFloatValue(Options.RENDER_DISTANCE, getViewDistance(item));
}
@SuppressWarnings("cast")
@Override
- public void action(ItemStack item, EntityPlayer player,
- Item jewelry) {
- if (jewelry instanceof ItemEarrings
- && !player.worldObj.isRemote) {
- for (Object e : player.worldObj
- .getEntitiesWithinAABB(
- EntityEnderman.class,
- player.boundingBox
- .expand(100D, 0D,
- 100D))) {
+ public void action(ItemStack item, EntityPlayer player, Item jewelry) {
+ if (jewelry instanceof ItemEarrings && !player.worldObj.isRemote) {
+ for (Object e : player.worldObj.getEntitiesWithinAABB(EntityEnderman.class,
+ player.boundingBox.expand(100D, 0D, 100D))) {
EntityEnderman enderman = (EntityEnderman) e;
- ReflectionHelper.setPrivateValue(
- EntityEnderman.class,
- enderman, -1, "stareTimer",
- "field_70826_g");
+ ReflectionHelper.setPrivateValue(EntityEnderman.class, enderman, -1, "stareTimer", "field_70826_g");
- Vec3 vec3 = player.getLook(1.0F)
- .normalize();
- Vec3 vec31 = Vec3.createVectorHelper(
- enderman.posX - player.posX,
- enderman.boundingBox.minY
- + (double) (enderman.height
- / 2.0F)
- - (player.posY + (double) player
- .getEyeHeight()),
+ Vec3 vec3 = player.getLook(1.0F).normalize();
+ Vec3 vec31 = Vec3.createVectorHelper(enderman.posX - player.posX, enderman.boundingBox.minY
+ + (double) (enderman.height / 2.0F) - (player.posY + (double) player.getEyeHeight()),
enderman.posZ - player.posZ);
double d0 = vec31.lengthVector();
vec31 = vec31.normalize();
double d1 = vec3.dotProduct(vec31);
- if (d1 > 1.0D - 0.025D / d0
- && player.canEntityBeSeen(
- enderman)) {
+ if (d1 > 1.0D - 0.025D / d0 && player.canEntityBeSeen(enderman)) {
// Positive earrings
- if (rand.nextInt(JewelryNBT
- .numberOfModifiers(
- item)) == 0)
+ if (rand.nextInt(JewelryNBT.numberOfModifiers(item)) == 0)
enderman.setTarget(null);
// Negative earrings
- if (!player.isPotionActive(
- Potion.confusion)
- || player.getActivePotionEffect(
- Potion.confusion)
- .getDuration() <= 80)
+ if (!player.isPotionActive(Potion.confusion)
+ || player.getActivePotionEffect(Potion.confusion).getDuration() <= 80)
player.addPotionEffect(
- new PotionEffect(
- Potion.confusion.id,
- 300,
- 2 + JewelryNBT.numberOfModifiers(
- item)
- / 4));
+ new PotionEffect(Potion.confusion.id, 300, 2 + JewelryNBT.numberOfModifiers(item) / 4));
}
}
}
// Positive necklace
- if (jewelry instanceof ItemNecklace
- && !player.worldObj.isRemote) {
- ChunkPosition chunkposition = player.worldObj
- .findClosestStructure("Stronghold",
- (int) player.posX,
- (int) player.posY,
- (int) player.posZ);
+ if (jewelry instanceof ItemNecklace && !player.worldObj.isRemote) {
+ ChunkPosition chunkposition = player.worldObj.findClosestStructure("Stronghold", (int) player.posX,
+ (int) player.posY, (int) player.posZ);
if (chunkposition != null) {
Minecraft.getMinecraft().thePlayer.motionX += 0.01D
- * Math.signum((double) chunkposition.chunkPosX
- - player.posX)
- * (rand.nextInt(JewelryNBT
- .numberOfModifiers(
- item)) == 0 ? 1
- : -1);
+ * Math.signum((double) chunkposition.chunkPosX - player.posX)
+ * (rand.nextInt(JewelryNBT.numberOfModifiers(item)) == 0 ? 1 : -1);
Minecraft.getMinecraft().thePlayer.motionZ += 0.01D
- * Math.signum((double) chunkposition.chunkPosZ
- - player.posZ)
- * (rand.nextInt(JewelryNBT
- .numberOfModifiers(
- item)) == 0 ? 1
- : -1);
+ * Math.signum((double) chunkposition.chunkPosZ - player.posZ)
+ * (rand.nextInt(JewelryNBT.numberOfModifiers(item)) == 0 ? 1 : -1);
}
}
// Positive bracelet
- if (jewelry instanceof ItemBracelet
- && !player.worldObj.isRemote
- && player.worldObj.getBiomeGenForCoords(
- (int) player.posX,
- (int) player.posZ) == BiomeGenBase.sky
- && (!player.isPotionActive(
- Potion.moveSpeed)
- || player.getActivePotionEffect(
- Potion.moveSpeed)
- .getDuration() < 30))
- player.addPotionEffect(new PotionEffect(
- Potion.moveSpeed.id,
- 150 - JewelryNBT.numberOfModifiers(
- item) * 10,
- 2 - JewelryNBT.numberOfModifiers(
- item) / 5));
+ if (jewelry instanceof ItemBracelet && !player.worldObj.isRemote
+ && player.worldObj.getBiomeGenForCoords((int) player.posX, (int) player.posZ) == BiomeGenBase.sky
+ && (!player.isPotionActive(Potion.moveSpeed)
+ || player.getActivePotionEffect(Potion.moveSpeed).getDuration() < 30))
+ player.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 150 - JewelryNBT.numberOfModifiers(item) * 10,
+ 2 - JewelryNBT.numberOfModifiers(item) / 5));
// Negative bracelet
- if (jewelry instanceof ItemBracelet
- && !player.worldObj.isRemote
- && rand.nextInt(520 - JewelryNBT
- .numberOfModifiers(item)
- * 20) == 15)
- player.setPositionAndUpdate(player.posX + rand
- .nextInt(30)
- * (rand.nextBoolean() ? -1 : 1),
- player.posY,
- player.posZ + rand.nextInt(30)
- * (rand.nextBoolean()
- ? -1
- : 1));
+ if (jewelry instanceof ItemBracelet && !player.worldObj.isRemote
+ && rand.nextInt(520 - JewelryNBT.numberOfModifiers(item) * 20) == 15)
+ player.setPositionAndUpdate(player.posX + rand.nextInt(30) * (rand.nextBoolean() ? -1 : 1), player.posY,
+ player.posZ + rand.nextInt(30) * (rand.nextBoolean() ? -1 : 1));
// Negative ring
- if (jewelry instanceof ItemRing && Minecraft
- .getMinecraft().gameSettings.renderDistanceChunks != 2.2F
- - JewelryNBT.numberOfModifiers(
- item)
- * 0.1F)
- Minecraft.getMinecraft().gameSettings
- .setOptionFloatValue(
- Options.RENDER_DISTANCE,
- 2.2F - JewelryNBT
- .numberOfModifiers(
- item)
- * 0.1F);
+ if (jewelry instanceof ItemRing && Minecraft.getMinecraft().gameSettings.renderDistanceChunks != 2.2F
+ - JewelryNBT.numberOfModifiers(item) * 0.1F)
+ Minecraft.getMinecraft().gameSettings.setOptionFloatValue(Options.RENDER_DISTANCE,
+ 2.2F - JewelryNBT.numberOfModifiers(item) * 0.1F);
// Positive ring
- if (jewelry instanceof ItemRing && rand.nextInt(
- 180 + JewelryNBT.numberOfModifiers(item)
- * 20) == 12) {
- for (int i = (int) player.posX
- - 2; i <= (int) player.posX
- + 2; i++)
- for (int j = (int) player.posY
- - 2; j <= (int) player.posY
- + 2; j++)
- for (int k = (int) player.posZ
- - 2; k <= (int) player.posZ
- + 2; k++)
- if (player.worldObj
- .getBlock(i, j, k) instanceof BlockOre)
- player.addChatComponentMessage(
- new ChatComponentText(
- EnumChatFormatting.GRAY
- + StatCollector.translateToLocal(
- "chatmessage." + Variables.MODID
- + ".effect.endereye.1")
- + " "
- + player.worldObj
- .getBlock(i, j, k)
- .getLocalizedName()
- + " "
- + StatCollector.translateToLocal(
- "chatmessage." + Variables.MODID
- + ".effect.endereye.2")));
+ if (jewelry instanceof ItemRing && rand.nextInt(180 + JewelryNBT.numberOfModifiers(item) * 20) == 12) {
+ for (int i = (int) player.posX - 2; i <= (int) player.posX + 2; i++)
+ for (int j = (int) player.posY - 2; j <= (int) player.posY + 2; j++)
+ for (int k = (int) player.posZ - 2; k <= (int) player.posZ + 2; k++)
+ if (player.worldObj.getBlock(i, j, k) instanceof BlockOre)
+ player.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.GRAY
+ + StatCollector
+ .translateToLocal("chatmessage." + Variables.MODID + ".effect.endereye.1")
+ + " " + player.worldObj.getBlock(i, j, k).getLocalizedName() + " "
+ + StatCollector.translateToLocal(
+ "chatmessage." + Variables.MODID + ".effect.endereye.2")));
}
}
@Override
- public void onPlayerAttacked(ItemStack item, EntityPlayer player,
- DamageSource source, Item jewelry, float amount) {
+ public void onPlayerAttacked(ItemStack item, EntityPlayer player, DamageSource source, Item jewelry, float amount) {
// Negative necklace
- if (jewelry instanceof ItemNecklace
- && !player.worldObj.isRemote)
- player.addPotionEffect(new PotionEffect(
- Potion.blindness.id,
- 100 + JewelryNBT.numberOfModifiers(
- item) * 30,
- 1));
+ if (jewelry instanceof ItemNecklace && !player.worldObj.isRemote)
+ player.addPotionEffect(
+ new PotionEffect(Potion.blindness.id, 100 + JewelryNBT.numberOfModifiers(item) * 30, 1));
}
- public static void setViewDistance(ItemStack item,
- int viewDistance) {
+ public static void setViewDistance(ItemStack item, int viewDistance) {
NBTTagCompound itemStackData;
if (item.hasTagCompound())
itemStackData = item.getTagCompound();
diff --git a/src/main/java/darkknight/jewelrycraft/effects/EffectEnderPearl.java b/src/main/java/darkknight/jewelrycraft/effects/EffectEnderPearl.java index 562d83e..7722484 100755 --- a/src/main/java/darkknight/jewelrycraft/effects/EffectEnderPearl.java +++ b/src/main/java/darkknight/jewelrycraft/effects/EffectEnderPearl.java @@ -27,119 +27,70 @@ public class EffectEnderPearl extends ModifierEffects { }
@Override
- public void action(ItemStack item, EntityPlayer player,
- Item jewelry) {
+ public void action(ItemStack item, EntityPlayer player, Item jewelry) {
if (jewelry instanceof ItemEarrings) {
- AxisAlignedBB axisalignedbb = player.boundingBox
- .expand(2.0D, 2.0D, 2.0D);
- List<?> list = player.worldObj
- .getEntitiesWithinAABB(
- EntityArrow.class,
- axisalignedbb);
- if (!player.worldObj.isRemote && list != null
- && !list.isEmpty()) {
+ AxisAlignedBB axisalignedbb = player.boundingBox.expand(2.0D, 2.0D, 2.0D);
+ List<?> list = player.worldObj.getEntitiesWithinAABB(EntityArrow.class, axisalignedbb);
+ if (!player.worldObj.isRemote && list != null && !list.isEmpty()) {
Iterator<?> iterator = list.iterator();
while (iterator.hasNext()) {
- EntityArrow arrow = (EntityArrow) iterator
- .next();
- if (arrow.shootingEntity == null
- || !(arrow.shootingEntity
- .equals(player)))
+ EntityArrow arrow = (EntityArrow) iterator.next();
+ if (arrow.shootingEntity == null || !(arrow.shootingEntity.equals(player)))
// Negative earrings
- if (rand.nextInt(
- 30) == 0) {
- arrow.worldObj.createExplosion(
- new EntityTNTPrimed(
- arrow.worldObj),
- arrow.posX,
- arrow.posY,
- arrow.posZ,
- 2F,
- true);
+ if (rand.nextInt(30) == 0) {
+ arrow.worldObj.createExplosion(new EntityTNTPrimed(arrow.worldObj), arrow.posX, arrow.posY,
+ arrow.posZ, 2F, true);
arrow.setDead();
}
// Positive earrings
else
- arrow.setPosition(
- arrow.posX + rand
- .nextInt(16)
- - rand.nextInt(16),
- arrow.posY + rand
- .nextInt(16),
- arrow.posZ + rand
- .nextInt(16)
- - rand.nextInt(16));
+ arrow.setPosition(arrow.posX + rand.nextInt(16) - rand.nextInt(16),
+ arrow.posY + rand.nextInt(16), arrow.posZ + rand.nextInt(16) - rand.nextInt(16));
}
}
}
// Negative Necklace
if (jewelry instanceof ItemNecklace)
- player.addPotionEffect(new PotionEffect(
- Potion.resistance.id, 60, -10,
- true));
+ player.addPotionEffect(new PotionEffect(Potion.resistance.id, 60, -10, true));
// Negative bracelet
if (jewelry instanceof ItemBracelet && player.isInWater())
- player.setPositionAndUpdate(
- player.posX + rand.nextInt(16)
- - rand.nextInt(16),
- player.posY + rand.nextInt(4),
- player.posZ + rand.nextInt(16)
- - rand.nextInt(16));
+ player.setPositionAndUpdate(player.posX + rand.nextInt(16) - rand.nextInt(16),
+ player.posY + rand.nextInt(4), player.posZ + rand.nextInt(16) - rand.nextInt(16));
}
@Override
- public void onPlayerAttacked(ItemStack item, EntityPlayer player,
- DamageSource source, Item jewelry, float amount) {
+ public void onPlayerAttacked(ItemStack item, EntityPlayer player, DamageSource source, Item jewelry, float amount) {
// Positive Necklace
- if (jewelry instanceof ItemNecklace
- && source.getEntity() != null)
- source.getEntity().attackEntityFrom(source,
- amount);
+ if (jewelry instanceof ItemNecklace && source.getEntity() != null)
+ source.getEntity().attackEntityFrom(source, amount);
// Positive bracelet
- if (jewelry instanceof ItemBracelet
- && !player.worldObj.isRemote) {
+ if (jewelry instanceof ItemBracelet && !player.worldObj.isRemote) {
int id = player.worldObj.provider.dimensionId;
if (player.getHealth() <= 6F)
if (player.getBedLocation(id) != null)
- player.setPositionAndUpdate(player
- .getBedLocation(id).posX,
- player.getBedLocation(
- id).posY,
- player.getBedLocation(
- id).posZ);
+ player.setPositionAndUpdate(player.getBedLocation(id).posX, player.getBedLocation(id).posY,
+ player.getBedLocation(id).posZ);
else
- player.setPositionAndUpdate(
- player.worldObj.getSpawnPoint().posX,
- player.worldObj.getSpawnPoint().posY,
- player.worldObj.getSpawnPoint().posZ);
+ player.setPositionAndUpdate(player.worldObj.getSpawnPoint().posX,
+ player.worldObj.getSpawnPoint().posY, player.worldObj.getSpawnPoint().posZ);
}
}
@Override
- public void onEntityAttacked(ItemStack item, EntityPlayer player,
- Entity target, Item jewelry, float amount) {
+ public void onEntityAttacked(ItemStack item, EntityPlayer player, Entity target, Item jewelry, float amount) {
if (jewelry instanceof ItemRing) {
// Negative ring
if (target instanceof EntityEnderman)
- player.addPotionEffect(new PotionEffect(
- Potion.weakness.id, 400, 2,
- true));
+ player.addPotionEffect(new PotionEffect(Potion.weakness.id, 400, 2, true));
// Positive ring
else
- target.setPosition(target.posX
- + rand.nextInt(16)
- - rand.nextInt(16),
- target.posY + rand.nextInt(
- 4),
- target.posZ + rand.nextInt(
- 16)
- - rand.nextInt(16));
+ target.setPosition(target.posX + rand.nextInt(16) - rand.nextInt(16), target.posY + rand.nextInt(4),
+ target.posZ + rand.nextInt(16) - rand.nextInt(16));
}
}
@Override
- public boolean onEntityAttackedCancellable(ItemStack item,
- EntityPlayer player, Entity target, Item jewelry,
+ public boolean onEntityAttackedCancellable(ItemStack item, EntityPlayer player, Entity target, Item jewelry,
float amount) {
return false;
}
diff --git a/src/main/java/darkknight/jewelrycraft/effects/EffectFeather.java b/src/main/java/darkknight/jewelrycraft/effects/EffectFeather.java index 5235b7d..42df76f 100755 --- a/src/main/java/darkknight/jewelrycraft/effects/EffectFeather.java +++ b/src/main/java/darkknight/jewelrycraft/effects/EffectFeather.java @@ -22,11 +22,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
-import net.minecraft.util.AxisAlignedBB;
-import net.minecraft.util.ChatComponentText;
-import net.minecraft.util.DamageSource;
-import net.minecraft.util.EnumChatFormatting;
-import net.minecraft.util.StatCollector;
+import net.minecraft.util.*;
public class EffectFeather extends ModifierEffects {
public EffectFeather() {
@@ -34,29 +30,17 @@ public class EffectFeather extends ModifierEffects { }
@Override
- public void action(ItemStack item, EntityPlayer player,
- Item jewelry) {
+ public void action(ItemStack item, EntityPlayer player, Item jewelry) {
// Positive earrings
if (jewelry instanceof ItemEarrings) {
- AxisAlignedBB axisalignedbb = player.boundingBox
- .expand(1.0D, 1.0D, 1.0D);
- List<?> list = player.worldObj
- .getEntitiesWithinAABB(
- EntityArrow.class,
- axisalignedbb);
- if (!player.worldObj.isRemote && list != null
- && !list.isEmpty()) {
+ AxisAlignedBB axisalignedbb = player.boundingBox.expand(1.0D, 1.0D, 1.0D);
+ List<?> list = player.worldObj.getEntitiesWithinAABB(EntityArrow.class, axisalignedbb);
+ if (!player.worldObj.isRemote && list != null && !list.isEmpty()) {
Iterator<?> iterator = list.iterator();
while (iterator.hasNext()) {
- EntityArrow arrow = (EntityArrow) iterator
- .next();
- if ((arrow.shootingEntity == null
- || !(arrow.shootingEntity
- .equals(player))
- || arrow.canBePickedUp == 0)
- && rand.nextInt(2
- + JewelryNBT.numberOfModifiers(
- item)) == 0)
+ EntityArrow arrow = (EntityArrow) iterator.next();
+ if ((arrow.shootingEntity == null || !(arrow.shootingEntity.equals(player))
+ || arrow.canBePickedUp == 0) && rand.nextInt(2 + JewelryNBT.numberOfModifiers(item)) == 0)
arrow.setDead();
}
}
@@ -64,59 +48,31 @@ public class EffectFeather extends ModifierEffects { if (jewelry instanceof ItemBracelet) {
// Positive bracelet
if (player.motionY < 0)
- player.motionY *= (0.6D + (JewelryNBT
- .numberOfModifiers(item)
- - 1) * 0.03D);
- if (rand.nextInt(JewelryNBT
- .numberOfModifiers(item)) == 0)
+ player.motionY *= (0.6D + (JewelryNBT.numberOfModifiers(item) - 1) * 0.03D);
+ if (rand.nextInt(JewelryNBT.numberOfModifiers(item)) == 0)
player.fallDistance = 0F;
// Negative bracelet
if (!player.isPotionActive(Potion.moveSlowdown)
- || player.getActivePotionEffect(
- Potion.moveSlowdown)
- .getDuration() < 30)
- player.addPotionEffect(new PotionEffect(
- Potion.moveSlowdown.id,
- 80 + JewelryNBT.numberOfModifiers(
- item) * 10,
- 1 + JewelryNBT.numberOfModifiers(
- item)
- / 4));
+ || player.getActivePotionEffect(Potion.moveSlowdown).getDuration() < 30)
+ player.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id,
+ 80 + JewelryNBT.numberOfModifiers(item) * 10, 1 + JewelryNBT.numberOfModifiers(item) / 4));
}
}
@Override
- public boolean onEntityAttackedCancellable(ItemStack item,
- EntityPlayer player, Entity target, Item jewelry,
+ public boolean onEntityAttackedCancellable(ItemStack item, EntityPlayer player, Entity target, Item jewelry,
float amount) {
NBTTagCompound enemyData = target.getEntityData();
- if (jewelry instanceof ItemRing
- && !player.worldObj.isRemote) {
+ if (jewelry instanceof ItemRing && !player.worldObj.isRemote) {
if (enemyData.getInteger("reAttacked") == 0) {
// Negative ring
- enemyData.setInteger("reAttacked",
- enemyData.getInteger(
- "reAttacked")
- + 1);
- target.attackEntityFrom(DamageSource
- .causePlayerDamage(player),
- amount / (2F + (JewelryNBT
- .numberOfModifiers(
- item)
- - 1)
- * 0.3F));
+ enemyData.setInteger("reAttacked", enemyData.getInteger("reAttacked") + 1);
+ target.attackEntityFrom(DamageSource.causePlayerDamage(player),
+ amount / (2F + (JewelryNBT.numberOfModifiers(item) - 1) * 0.3F));
// Positive ring
- if (rand.nextInt(2) == 0
- && target instanceof EntityLivingBase)
- ((EntityLivingBase) target)
- .addPotionEffect(
- new PotionEffect(
- PotionList.stun.id,
- (51 - JewelryNBT.numberOfModifiers(
- item))
- * 2,
- 0,
- false));
+ if (rand.nextInt(2) == 0 && target instanceof EntityLivingBase)
+ ((EntityLivingBase) target).addPotionEffect(new PotionEffect(PotionList.stun.id,
+ (51 - JewelryNBT.numberOfModifiers(item)) * 2, 0, false));
return true;
}
enemyData.setInteger("reAttacked", 0);
@@ -125,43 +81,26 @@ public class EffectFeather extends ModifierEffects { }
@Override
- public boolean onPlayerAttackedCancellable(ItemStack item,
- EntityPlayer player, DamageSource source,
- Item jewelry, float amount) {
+ public boolean onPlayerAttackedCancellable(ItemStack item, EntityPlayer player, DamageSource source, Item jewelry,
+ float amount) {
// Positive necklace
- if (jewelry instanceof ItemNecklace && rand.nextInt(3
- + JewelryNBT.numberOfModifiers(item)) == 0
- && source != DamageSourceList.weak
- && source != DamageSource.inFire
- && source != DamageSource.onFire
+ if (jewelry instanceof ItemNecklace && rand.nextInt(3 + JewelryNBT.numberOfModifiers(item)) == 0
+ && source != DamageSourceList.weak && source != DamageSource.inFire && source != DamageSource.onFire
&& source != DamageSource.lava) {
- player.addChatComponentMessage(
- new ChatComponentText(
- EnumChatFormatting.GRAY
- + StatCollector.translateToLocal(
- "chatmessage." + Variables.MODID
- + ".effect.feather")));
+ player.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.GRAY
+ + StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".effect.feather")));
return true;
}
// Negative necklace
if (jewelry instanceof ItemNecklace
- && (source == DamageSource.inFire
- || source == DamageSource.onFire
- || source == DamageSource.lava)
+ && (source == DamageSource.inFire || source == DamageSource.onFire || source == DamageSource.lava)
&& source != DamageSourceList.weak)
player.attackEntityFrom(DamageSourceList.weak,
- amount * (3F + (JewelryNBT
- .numberOfModifiers(
- item)
- - 1) * 0.1F));
+ amount * (3F + (JewelryNBT.numberOfModifiers(item) - 1) * 0.1F));
// Negative earrings
- if (jewelry instanceof ItemEarrings
- && source.damageType.equals("arrow"))
+ if (jewelry instanceof ItemEarrings && source.damageType.equals("arrow"))
player.attackEntityFrom(DamageSourceList.weak,
- amount * (2F + (JewelryNBT
- .numberOfModifiers(
- item)
- - 1) * 0.1F));
+ amount * (2F + (JewelryNBT.numberOfModifiers(item) - 1) * 0.1F));
return false;
}
}
diff --git a/src/main/java/darkknight/jewelrycraft/effects/EffectObsidian.java b/src/main/java/darkknight/jewelrycraft/effects/EffectObsidian.java index 3b79390..95f52b5 100755 --- a/src/main/java/darkknight/jewelrycraft/effects/EffectObsidian.java +++ b/src/main/java/darkknight/jewelrycraft/effects/EffectObsidian.java @@ -25,68 +25,39 @@ public class EffectObsidian extends ModifierEffects { }
@Override
- public void action(ItemStack item, EntityPlayer player,
- Item jewelry) {
- NBTTagCompound playerInfo = PlayerUtils
- .getModPlayerPersistTag(player,
- Variables.MODID);
+ public void action(ItemStack item, EntityPlayer player, Item jewelry) {
+ NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(player, Variables.MODID);
if (jewelry instanceof ItemNecklace) {
// Positive necklace
- player.addPotionEffect(new PotionEffect(
- Potion.resistance.id, 60, 2,
- true));
+ player.addPotionEffect(new PotionEffect(Potion.resistance.id, 60, 2, true));
// Negative necklace
- if (player.isInWater()
- && !player.capabilities.isCreativeMode) {
- double slowAmount = 0.2D + (JewelryNBT
- .numberOfModifiers(item)
- - 1) * 0.05D;
+ if (player.isInWater() && !player.capabilities.isCreativeMode) {
+ double slowAmount = 0.2D + (JewelryNBT.numberOfModifiers(item) - 1) * 0.05D;
player.motionX *= slowAmount;
player.motionY *= slowAmount;
player.motionZ *= slowAmount;
player.motionY = -0.5D;
if (rand.nextInt(50) == 0)
- player.attackEntityFrom(
- DamageSourceList.weak,
- 2F);
+ player.attackEntityFrom(DamageSourceList.weak, 2F);
}
}
// Negative bracelet
- if (jewelry instanceof ItemBracelet
- && playerInfo.hasKey("falls")
- && playerInfo.getInteger("falls") >= 300)
- player.addPotionEffect(new PotionEffect(
- Potion.moveSlowdown.id, 60, 1,
- true));
+ if (jewelry instanceof ItemBracelet && playerInfo.hasKey("falls") && playerInfo.getInteger("falls") >= 300)
+ player.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 60, 1, true));
// Negative ring
- if (jewelry instanceof ItemRing
- && playerInfo.hasKey("strikes")
- && playerInfo.getInteger(
- "strikes") >= 200) {
- player.addPotionEffect(new PotionEffect(
- Potion.weakness.id, 60, 0, true));
- player.addPotionEffect(new PotionEffect(
- Potion.digSlowdown.id, 60, 1,
- true));
+ if (jewelry instanceof ItemRing && playerInfo.hasKey("strikes") && playerInfo.getInteger("strikes") >= 200) {
+ player.addPotionEffect(new PotionEffect(Potion.weakness.id, 60, 0, true));
+ player.addPotionEffect(new PotionEffect(Potion.digSlowdown.id, 60, 1, true));
}
}
@Override
- public boolean onPlayerAttackedCancellable(ItemStack item,
- EntityPlayer player, DamageSource source,
- Item jewelry, float amount) {
- NBTTagCompound playerInfo = PlayerUtils
- .getModPlayerPersistTag(player,
- Variables.MODID);
- if (jewelry instanceof ItemEarrings
- && (source == DamageSource.anvil
- || source.damageType
- .equals("arrow"))) {
+ public boolean onPlayerAttackedCancellable(ItemStack item, EntityPlayer player, DamageSource source, Item jewelry,
+ float amount) {
+ NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(player, Variables.MODID);
+ if (jewelry instanceof ItemEarrings && (source == DamageSource.anvil || source.damageType.equals("arrow"))) {
if (playerInfo.hasKey("protected")) {
- playerInfo.setInteger("protected",
- playerInfo.getInteger(
- "protected")
- + 1);
+ playerInfo.setInteger("protected", playerInfo.getInteger("protected") + 1);
} else {
playerInfo.setInteger("protected", 1);
}
@@ -94,16 +65,11 @@ public class EffectObsidian extends ModifierEffects { if (playerInfo.getInteger("protected") < 2000) {
return true;
}
- player.attackEntityFrom(DamageSourceList.weak,
- player.getHealth() * 3F);
+ player.attackEntityFrom(DamageSourceList.weak, player.getHealth() * 3F);
}
- if (jewelry instanceof ItemBracelet
- && source == DamageSource.fall) {
+ if (jewelry instanceof ItemBracelet && source == DamageSource.fall) {
if (playerInfo.hasKey("falls")) {
- playerInfo.setInteger("falls",
- playerInfo.getInteger(
- "falls")
- + 1);
+ playerInfo.setInteger("falls", playerInfo.getInteger("falls") + 1);
} else {
playerInfo.setInteger("falls", 1);
}
@@ -115,45 +81,28 @@ public class EffectObsidian extends ModifierEffects { }
@Override
- public void onPlayerDead(ItemStack item, EntityPlayer player,
- DamageSource source, Item jewelry) {
- NBTTagCompound playerInfo = PlayerUtils
- .getModPlayerPersistTag(player,
- Variables.MODID);
+ public void onPlayerDead(ItemStack item, EntityPlayer player, DamageSource source, Item jewelry) {
+ NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(player, Variables.MODID);
playerInfo.setInteger("falls", 0);
playerInfo.setInteger("strikes", 0);
playerInfo.setInteger("protected", 0);
}
@Override
- public boolean onEntityAttackedCancellable(ItemStack item,
- EntityPlayer player, Entity target, Item jewelry,
+ public boolean onEntityAttackedCancellable(ItemStack item, EntityPlayer player, Entity target, Item jewelry,
float amount) {
- NBTTagCompound playerInfo = PlayerUtils
- .getModPlayerPersistTag(player,
- Variables.MODID);
+ NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(player, Variables.MODID);
NBTTagCompound enemyData = target.getEntityData();
// Positive ring
- if (jewelry instanceof ItemRing
- && playerInfo.getInteger("strikes") < 2000
- && !player.worldObj.isRemote) {
+ if (jewelry instanceof ItemRing && playerInfo.getInteger("strikes") < 2000 && !player.worldObj.isRemote) {
if (enemyData.getInteger("reAttacked") == 0) {
if (playerInfo.hasKey("strikes"))
- playerInfo.setInteger("strikes",
- playerInfo.getInteger(
- "strikes")
- + 1);
+ playerInfo.setInteger("strikes", playerInfo.getInteger("strikes") + 1);
else
- playerInfo.setInteger("strikes",
- 1);
+ playerInfo.setInteger("strikes", 1);
// Negative ring
- enemyData.setInteger("reAttacked",
- enemyData.getInteger(
- "reAttacked")
- + 1);
- target.attackEntityFrom(DamageSource
- .causePlayerDamage(player),
- amount * 1.5F);
+ enemyData.setInteger("reAttacked", enemyData.getInteger("reAttacked") + 1);
+ target.attackEntityFrom(DamageSource.causePlayerDamage(player), amount * 1.5F);
return true;
}
if (enemyData.getInteger("reAttacked") == 1)
diff --git a/src/main/java/darkknight/jewelrycraft/effects/EffectsList.java b/src/main/java/darkknight/jewelrycraft/effects/EffectsList.java index ee5f64c..06498f4 100755 --- a/src/main/java/darkknight/jewelrycraft/effects/EffectsList.java +++ b/src/main/java/darkknight/jewelrycraft/effects/EffectsList.java @@ -4,8 +4,7 @@ import cpw.mods.fml.common.event.FMLPostInitializationEvent; import darkknight.jewelrycraft.api.ModifierEffects;
public class EffectsList {
- public static ModifierEffects blazePowder, enderEye, feather,
- enderPearl, obsidian;
+ public static ModifierEffects blazePowder, enderEye, feather, enderPearl, obsidian;
public static void postInit(FMLPostInitializationEvent e) {
blazePowder = new EffectBlazePowder();
diff --git a/src/main/java/darkknight/jewelrycraft/entities/EntityHeart.java b/src/main/java/darkknight/jewelrycraft/entities/EntityHeart.java index 2590e55..044a841 100755 --- a/src/main/java/darkknight/jewelrycraft/entities/EntityHeart.java +++ b/src/main/java/darkknight/jewelrycraft/entities/EntityHeart.java @@ -35,8 +35,7 @@ public class EntityHeart extends EntityLiving { @Override
protected void applyEntityAttributes() {
super.applyEntityAttributes();
- this.getEntityAttribute(SharedMonsterAttributes.maxHealth)
- .setBaseValue(getQuantity());
+ this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(getQuantity());
}
@Override
@@ -49,20 +48,16 @@ public class EntityHeart extends EntityLiving { @Override
public void onLivingUpdate() {
super.onLivingUpdate();
- if (ConfigHandler.HEARTS_DESPAWN
- && this.entityAge > ConfigHandler.HEART_DESPAWN_TIME)
+ if (ConfigHandler.HEARTS_DESPAWN && this.entityAge > ConfigHandler.HEART_DESPAWN_TIME)
this.setDead();
}
@Override
protected void collideWithEntity(Entity entity) {
super.collideWithEntity(entity);
- if (!this.worldObj.isRemote
- && entity instanceof EntityHeart
- && getType().equals(((EntityHeart) entity)
- .getType())) {
- setQuantity(getQuantity() + ((EntityHeart) entity)
- .getQuantity());
+ if (!this.worldObj.isRemote && entity instanceof EntityHeart
+ && getType().equals(((EntityHeart) entity).getType())) {
+ setQuantity(getQuantity() + ((EntityHeart) entity).getQuantity());
entity.setDead();
}
}
@@ -70,69 +65,38 @@ public class EntityHeart extends EntityLiving { @Override
public void onCollideWithPlayer(EntityPlayer player) {
if (!this.worldObj.isRemote) {
- NBTTagCompound playerInfo = PlayerUtils
- .getModPlayerPersistTag(player,
- Variables.MODID);
+ NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(player, Variables.MODID);
if (playerInfo != null) {
- if (getType().equals("Red") && player
- .getHealth() < player
- .getMaxHealth()) {
- float healAmount = player
- .getMaxHealth()
- - player.getHealth();
+ if (getType().equals("Red") && player.getHealth() < player.getMaxHealth()) {
+ float healAmount = player.getMaxHealth() - player.getHealth();
if (getQuantity() > healAmount) {
player.heal(healAmount);
- this.setQuantity(
- getQuantity() - healAmount);
+ this.setQuantity(getQuantity() - healAmount);
} else {
player.heal(getQuantity());
this.setDead();
}
- } else if (getType().equals("White")
- && playerInfo.getFloat(
- "WhiteHeart") > 0.1F) {
- playerInfo.setFloat(getType()
- + "Heart", 0F);
+ } else if (getType().equals("White") && playerInfo.getFloat("WhiteHeart") > 0.1F) {
+ playerInfo.setFloat(getType() + "Heart", 0F);
if (player.getMaxHealth() < 40F) {
- player.getEntityAttribute(
- SharedMonsterAttributes.maxHealth)
- .setBaseValue(player
- .getMaxHealth()
- + 2f);
- player.setHealth(player
- .getHealth()
- + 2f);
+ player.getEntityAttribute(SharedMonsterAttributes.maxHealth)
+ .setBaseValue(player.getMaxHealth() + 2f);
+ player.setHealth(player.getHealth() + 2f);
}
- JewelrycraftMod.netWrapper.sendTo(
- new PacketSendClientPlayerInfo(
- playerInfo),
+ JewelrycraftMod.netWrapper.sendTo(new PacketSendClientPlayerInfo(playerInfo),
(EntityPlayerMP) player);
this.setDead();
- } else if (!getType().equals("Red")
- && ((getType().equals(
- "Black")
- && playerInfo.getFloat(
- "BlackHeart") <= ConfigHandler.MAX_BLACK_HEARTS_PICKUP)
- || (getType().equals(
- "Blue")
- && playerInfo.getFloat(
- "BlueHeart") <= ConfigHandler.MAX_BLUE_HEARTS_PICKUP)
- || getType().equals(
- "White"))) {
- if (playerInfo.hasKey(getType()
- + "Heart"))
- playerInfo.setFloat(
- getType() + "Heart",
- playerInfo.getFloat(
- getType() + "Heart")
- + getQuantity());
+ } else if (!getType().equals("Red") && ((getType().equals("Black")
+ && playerInfo.getFloat("BlackHeart") <= ConfigHandler.MAX_BLACK_HEARTS_PICKUP)
+ || (getType().equals("Blue")
+ && playerInfo.getFloat("BlueHeart") <= ConfigHandler.MAX_BLUE_HEARTS_PICKUP)
+ || getType().equals("White"))) {
+ if (playerInfo.hasKey(getType() + "Heart"))
+ playerInfo.setFloat(getType() + "Heart",
+ playerInfo.getFloat(getType() + "Heart") + getQuantity());
else
- playerInfo.setFloat(
- getType() + "Heart",
- getQuantity());
- JewelrycraftMod.netWrapper.sendTo(
- new PacketSendClientPlayerInfo(
- playerInfo),
+ playerInfo.setFloat(getType() + "Heart", getQuantity());
+ JewelrycraftMod.netWrapper.sendTo(new PacketSendClientPlayerInfo(playerInfo),
(EntityPlayerMP) player);
this.setDead();
}
@@ -143,14 +107,9 @@ public class EntityHeart extends EntityLiving { @Override
public void onDeath(DamageSource source) {
super.onDeath(source);
- if (source.getEntity() != null && source
- .getEntity() instanceof EntityPlayer)
- ((EntityPlayer) source.getEntity()).addChatMessage(
- new ChatComponentText(StatCollector
- .translateToLocal(
- "chatmessage." + Variables.MODID
- + ".heartKilled."
- + this.getType())));
+ if (source.getEntity() != null && source.getEntity() instanceof EntityPlayer)
+ ((EntityPlayer) source.getEntity()).addChatMessage(new ChatComponentText(StatCollector
+ .translateToLocal("chatmessage." + Variables.MODID + ".heartKilled." + this.getType())));
}
@Override
@@ -174,8 +133,7 @@ public class EntityHeart extends EntityLiving { }
/**
- * (abstract) Protected helper method to read subclass entity data
- * from NBT.
+ * (abstract) Protected helper method to read subclass entity data from NBT.
*/
@Override
public void readEntityFromNBT(NBTTagCompound nbt) {
diff --git a/src/main/java/darkknight/jewelrycraft/entities/EntityList.java b/src/main/java/darkknight/jewelrycraft/entities/EntityList.java index 6df9ada..cb5608d 100755 --- a/src/main/java/darkknight/jewelrycraft/entities/EntityList.java +++ b/src/main/java/darkknight/jewelrycraft/entities/EntityList.java @@ -9,38 +9,25 @@ import net.minecraft.entity.EntityLiving; public class EntityList {
public static void preInit(FMLPreInitializationEvent e) {
- registerEntity(1, EntityHeart.class, "Heart", 0x000000,
- 0xFF0000); // Red
- ItemSpawnEgg.registerSpawnEgg(EntityHeart.class, "Heart",
- 2, 0x000000, 0xFFFFFF); // White
- ItemSpawnEgg.registerSpawnEgg(EntityHeart.class, "Heart",
- 3, 0x000000, 0x006BBD); // Blue
- ItemSpawnEgg.registerSpawnEgg(EntityHeart.class, "Heart",
- 4, 0x000000, 0x404040); // Black
+ registerEntity(1, EntityHeart.class, "Heart", 0x000000, 0xFF0000); // Red
+ ItemSpawnEgg.registerSpawnEgg(EntityHeart.class, "Heart", 2, 0x000000, 0xFFFFFF); // White
+ ItemSpawnEgg.registerSpawnEgg(EntityHeart.class, "Heart", 3, 0x000000, 0x006BBD); // Blue
+ ItemSpawnEgg.registerSpawnEgg(EntityHeart.class, "Heart", 4, 0x000000, 0x404040); // Black
- registerEntity(5, EntityHalfHeart.class, "HalfHeart",
- 0x000000, 0xFF0000); // Red
- ItemSpawnEgg.registerSpawnEgg(EntityHalfHeart.class,
- "HalfHeart", 6, 0x000000, 0xFFFFFF); // White
- ItemSpawnEgg.registerSpawnEgg(EntityHalfHeart.class,
- "HalfHeart", 7, 0x000000, 0x006BBD); // Blue
- ItemSpawnEgg.registerSpawnEgg(EntityHalfHeart.class,
- "HalfHeart", 8, 0x000000, 0x404040); // Black
+ registerEntity(5, EntityHalfHeart.class, "HalfHeart", 0x000000, 0xFF0000); // Red
+ ItemSpawnEgg.registerSpawnEgg(EntityHalfHeart.class, "HalfHeart", 6, 0x000000, 0xFFFFFF); // White
+ ItemSpawnEgg.registerSpawnEgg(EntityHalfHeart.class, "HalfHeart", 7, 0x000000, 0x006BBD); // Blue
+ ItemSpawnEgg.registerSpawnEgg(EntityHalfHeart.class, "HalfHeart", 8, 0x000000, 0x404040); // Black
}
- private static final void registerEntity(int id,
- Class<? extends Entity> entityClass, String name) {
- EntityRegistry.registerModEntity(entityClass, name, id,
- JewelrycraftMod.instance, 256, 1, true);
+ private static final void registerEntity(int id, Class<? extends Entity> entityClass, String name) {
+ EntityRegistry.registerModEntity(entityClass, name, id, JewelrycraftMod.instance, 256, 1, true);
}
- private static final void registerEntity(int id,
- Class<? extends EntityLiving> entityClass,
- String name, int eggBackgroundColor,
- int eggForegroundColor) {
+ private static final void registerEntity(int id, Class<? extends EntityLiving> entityClass, String name,
+ int eggBackgroundColor, int eggForegroundColor) {
registerEntity(id, entityClass, name);
- ItemSpawnEgg.registerSpawnEgg(entityClass, name, id,
- eggBackgroundColor, eggForegroundColor);
+ ItemSpawnEgg.registerSpawnEgg(entityClass, name, id, eggBackgroundColor, eggForegroundColor);
}
}
diff --git a/src/main/java/darkknight/jewelrycraft/entities/renders/HeartRender.java b/src/main/java/darkknight/jewelrycraft/entities/renders/HeartRender.java index b5419a4..4e181c1 100755 --- a/src/main/java/darkknight/jewelrycraft/entities/renders/HeartRender.java +++ b/src/main/java/darkknight/jewelrycraft/entities/renders/HeartRender.java @@ -16,61 +16,46 @@ import net.minecraft.util.ResourceLocation; * @author Sorin
*/
public class HeartRender extends RenderLiving {
- protected ResourceLocation texture;
- Random rnd = new Random();
+ protected ResourceLocation texture;
+ Random rnd = new Random();
public HeartRender(ModelBase modelBase, float shadowSize) {
super(modelBase, shadowSize);
}
@Override
- protected void renderModel(EntityLivingBase entity, float x,
- float y, float z, float rot1, float rot2,
- float rot3) {
+ protected void renderModel(EntityLivingBase entity, float x, float y, float z, float rot1, float rot2, float rot3) {
super.renderModel(entity, x, y, z, rot1, rot2, rot3);
rnd.setSeed(1542372345);
if (((EntityHeart) entity).getQuantity() > 2f) {
- for (int i = 0; i < ((EntityHeart) entity)
- .getQuantity() / 10f; i++) {
- float posX = rnd.nextFloat() * 0.2f
- * (rnd.nextBoolean() ? 1
- : -1);
- float posY = rnd.nextFloat() * 0.2f
- * (rnd.nextBoolean() ? 1
- : -1);
- float rotY = rnd.nextFloat() * 35f
- * (rnd.nextBoolean() ? 1
- : -1);
- float rotZ = rnd.nextFloat() * 35f
- * (rnd.nextBoolean() ? 1
- : -1);
+ for (int i = 0; i < ((EntityHeart) entity).getQuantity() / 10f; i++) {
+ float posX = rnd.nextFloat() * 0.2f * (rnd.nextBoolean() ? 1 : -1);
+ float posY = rnd.nextFloat() * 0.2f * (rnd.nextBoolean() ? 1 : -1);
+ float rotY = rnd.nextFloat() * 35f * (rnd.nextBoolean() ? 1 : -1);
+ float rotZ = rnd.nextFloat() * 35f * (rnd.nextBoolean() ? 1 : -1);
GL11.glTranslatef(-0.15F, 0.0F, 0.0F);
GL11.glTranslatef(posX, posY, 0F);
GL11.glRotatef(rotY, 0F, 1F, 0F);
GL11.glRotatef(rotZ, 0F, 0F, 1F);
GL11.glPushMatrix();
- this.mainModel.render(entity, x, y, z,
- rot1, rot2, rot3);
+ this.mainModel.render(entity, x, y, z, rot1, rot2, rot3);
GL11.glPopMatrix();
}
}
}
@Override
- protected void preRenderCallback(EntityLivingBase entity,
- float f) {
+ protected void preRenderCallback(EntityLivingBase entity, float f) {
preRenderCallbackHeart((EntityHeart) entity, f);
}
- protected void preRenderCallbackHeart(EntityHeart entity,
- float f) {
+ protected void preRenderCallbackHeart(EntityHeart entity, float f) {
GL11.glScalef(0.4F, 0.4F, 0.4F);
GL11.glRotatef(55F, 1F, 0F, 0F);
String type = entity.getType();
if (type == "" || type == null)
type = "Red";
- texture = new ResourceLocation(Variables.MODID,
- "textures/entities/" + type + "Heart.png");
+ texture = new ResourceLocation(Variables.MODID, "textures/entities/" + type + "Heart.png");
}
@Override
diff --git a/src/main/java/darkknight/jewelrycraft/entities/renders/RenderHelper.java b/src/main/java/darkknight/jewelrycraft/entities/renders/RenderHelper.java index cf2278a..444950b 100755 --- a/src/main/java/darkknight/jewelrycraft/entities/renders/RenderHelper.java +++ b/src/main/java/darkknight/jewelrycraft/entities/renders/RenderHelper.java @@ -16,9 +16,7 @@ public class RenderHelper { }
public static void translateToHeadLevel(EntityPlayer player) {
- GL11.glTranslated(0, (player != Minecraft
- .getMinecraft().thePlayer ? 1.62F : 0F)
- - player.getDefaultEyeHeight()
+ GL11.glTranslated(0, (player != Minecraft.getMinecraft().thePlayer ? 1.62F : 0F) - player.getDefaultEyeHeight()
+ (player.isSneaking() ? 0.0625 : 0), 0);
}
}
\ No newline at end of file diff --git a/src/main/java/darkknight/jewelrycraft/events/BlockEventHandler.java b/src/main/java/darkknight/jewelrycraft/events/BlockEventHandler.java index 964ebd2..210f9e5 100755 --- a/src/main/java/darkknight/jewelrycraft/events/BlockEventHandler.java +++ b/src/main/java/darkknight/jewelrycraft/events/BlockEventHandler.java @@ -24,40 +24,18 @@ public class BlockEventHandler { @SubscribeEvent
public void onBlockDestroyed(BlockEvent.BreakEvent event) {
if (event.getPlayer() != null) {
- ItemStack item = event.getPlayer().inventory
- .getCurrentItem();
- if (event.block instanceof BlockMidasTouch
- && item != null
- && item.getItem().getHarvestLevel(
- item,
- "pickaxe") >= event.block
- .getHarvestLevel(
- event.blockMetadata)) {
- TileEntityMidasTouch te = (TileEntityMidasTouch) event.world
- .getTileEntity(event.x,
- event.y,
- event.z);
+ ItemStack item = event.getPlayer().inventory.getCurrentItem();
+ if (event.block instanceof BlockMidasTouch && item != null && item.getItem().getHarvestLevel(item,
+ "pickaxe") >= event.block.getHarvestLevel(event.blockMetadata)) {
+ TileEntityMidasTouch te = (TileEntityMidasTouch) event.world.getTileEntity(event.x, event.y, event.z);
if (te.target != null)
- dropItem(te.getWorldObj(),
- te.xCoord,
- te.yCoord,
- te.zCoord,
- new ItemStack(Items.gold_nugget,
- (int) (te.target.width
- * te.target.height
- * 100),
- 0));
+ dropItem(te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord,
+ new ItemStack(Items.gold_nugget, (int) (te.target.width * te.target.height * 100), 0));
}
- NBTTagCompound playerInfo = PlayerUtils
- .getModPlayerPersistTag(
- event.getPlayer(),
- Variables.MODID);
+ NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(event.getPlayer(), Variables.MODID);
for (Curse curse : Curse.getCurseList())
- if (playerInfo.getInteger(
- curse.getName()) > 0)
- curse.onBlockDestroyed(
- event.getPlayer(),
- event);
+ if (playerInfo.getInteger(curse.getName()) > 0)
+ curse.onBlockDestroyed(event.getPlayer(), event);
}
}
@@ -65,21 +43,15 @@ public class BlockEventHandler { public void onBlockItemsDrop(BlockEvent.HarvestDropsEvent event) {
EntityPlayer player = event.harvester;
if (player != null) {
- NBTTagCompound playerInfo = PlayerUtils
- .getModPlayerPersistTag(player,
- Variables.MODID);
+ NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(player, Variables.MODID);
for (Curse curse : Curse.getCurseList())
- if (playerInfo.getInteger(
- curse.getName()) > 0)
- curse.onBlockItemsDrop(player,
- event);
+ if (playerInfo.getInteger(curse.getName()) > 0)
+ curse.onBlockItemsDrop(player, event);
}
}
- 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);
+ 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;
diff --git a/src/main/java/darkknight/jewelrycraft/events/BucketHandler.java b/src/main/java/darkknight/jewelrycraft/events/BucketHandler.java index 13948af..d00b8f5 100755 --- a/src/main/java/darkknight/jewelrycraft/events/BucketHandler.java +++ b/src/main/java/darkknight/jewelrycraft/events/BucketHandler.java @@ -23,44 +23,31 @@ import net.minecraft.world.World; import net.minecraftforge.event.entity.player.FillBucketEvent;
public class BucketHandler {
- public static BucketHandler INSTANCE = new BucketHandler();
- public Map<Block, Item> buckets = new HashMap<Block, Item>();
+ public static BucketHandler INSTANCE = new BucketHandler();
+ public Map<Block, Item> buckets = new HashMap<Block, Item>();
private BucketHandler() {
}
@SubscribeEvent
public void onBucketFill(FillBucketEvent event) {
- ItemStack result = fillCustomBucket(event.world,
- event.target);
+ ItemStack result = fillCustomBucket(event.world, event.target);
if (result == null)
return;
event.result = result;
event.setResult(Result.ALLOW);
}
- private ItemStack fillCustomBucket(World world,
- MovingObjectPosition pos) {
- Block block = world.getBlock(pos.blockX, pos.blockY,
- pos.blockZ);
+ private ItemStack fillCustomBucket(World world, MovingObjectPosition pos) {
+ Block block = world.getBlock(pos.blockX, pos.blockY, pos.blockZ);
Item bucket = buckets.get(block);
- if (bucket != null
- && world.getBlock(pos.blockX, pos.blockY,
- pos.blockZ) != Blocks.air
- && world.getBlock(pos.blockX, pos.blockY,
- pos.blockZ) instanceof BlockMoltenMetal) {
+ if (bucket != null && world.getBlock(pos.blockX, pos.blockY, pos.blockZ) != Blocks.air
+ && world.getBlock(pos.blockX, pos.blockY, pos.blockZ) instanceof BlockMoltenMetal) {
ItemStack item = new ItemStack(bucket);
- if (BlockMoltenMetal.getTileEntity(world,
- pos.blockX, pos.blockY,
- pos.blockZ) != null)
- JewelryNBT.addMetal(item, BlockMoltenMetal
- .getTileEntity(world,
- pos.blockX,
- pos.blockY,
- pos.blockZ)
- .getMetal());
- world.setBlockToAir(pos.blockX, pos.blockY,
- pos.blockZ);
+ if (BlockMoltenMetal.getTileEntity(world, pos.blockX, pos.blockY, pos.blockZ) != null)
+ JewelryNBT.addMetal(item,
+ BlockMoltenMetal.getTileEntity(world, pos.blockX, pos.blockY, pos.blockZ).getMetal());
+ world.setBlockToAir(pos.blockX, pos.blockY, pos.blockZ);
return item;
} else
return null;
diff --git a/src/main/java/darkknight/jewelrycraft/events/EntityEventHandler.java b/src/main/java/darkknight/jewelrycraft/events/EntityEventHandler.java index e9809d0..355d041 100755 --- a/src/main/java/darkknight/jewelrycraft/events/EntityEventHandler.java +++ b/src/main/java/darkknight/jewelrycraft/events/EntityEventHandler.java @@ -21,11 +21,7 @@ import darkknight.jewelrycraft.network.PacketSendServerPlayersInfo; import darkknight.jewelrycraft.potions.PotionBase;
import darkknight.jewelrycraft.potions.PotionList;
import darkknight.jewelrycraft.random.WeightedRandomCurse;
-import darkknight.jewelrycraft.util.BlockUtils;
-import darkknight.jewelrycraft.util.EntitySelector;
-import darkknight.jewelrycraft.util.JewelrycraftUtil;
-import darkknight.jewelrycraft.util.PlayerUtils;
-import darkknight.jewelrycraft.util.Variables;
+import darkknight.jewelrycraft.util.*;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
@@ -35,11 +31,7 @@ import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.server.MinecraftServer;
-import net.minecraft.util.AxisAlignedBB;
-import net.minecraft.util.ChatComponentText;
-import net.minecraft.util.MathHelper;
-import net.minecraft.util.StatCollector;
-import net.minecraft.util.WeightedRandom;
+import net.minecraft.util.*;
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
import net.minecraftforge.event.entity.item.ItemTossEvent;
import net.minecraftforge.event.entity.living.LivingAttackEvent;
@@ -61,73 +53,47 @@ public class EntityEventHandler { @SubscribeEvent
public void onEntityJoinWorld(EntityJoinWorldEvent event) {
- if (event.entity instanceof EntityPlayer
- && !(event.entity instanceof EntityPlayerMP)) {
- JewelrycraftMod.netWrapper.sendToServer(
- new PacketRequestPlayerInfo());
+ if (event.entity instanceof EntityPlayer && !(event.entity instanceof EntityPlayerMP)) {
+ JewelrycraftMod.netWrapper.sendToServer(new PacketRequestPlayerInfo());
}
final Entity entity = event.entity;
- if (!event.world.isRemote
- && entity instanceof EntityPlayer) {
+ if (!event.world.isRemote && entity instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) entity;
- NBTTagCompound persistTag = PlayerUtils
- .getModPlayerPersistTag(player,
- Variables.MODID);
+ NBTTagCompound persistTag = PlayerUtils.getModPlayerPersistTag(player, Variables.MODID);
- boolean shouldGiveManual = ItemList.guide != null
- && !persistTag.getBoolean(
- "givenGuide");
+ boolean shouldGiveManual = ItemList.guide != null && !persistTag.getBoolean("givenGuide");
if (shouldGiveManual) {
- ItemStack manual = new ItemStack(
- ItemList.guide);
-
- if (!player.inventory
- .addItemStackToInventory(
- manual)) {
- BlockUtils.dropItemStackInWorld(
- player.worldObj,
- player.posX,
- player.posY,
- player.posZ,
- manual);
+ ItemStack manual = new ItemStack(ItemList.guide);
+
+ if (!player.inventory.addItemStackToInventory(manual)) {
+ BlockUtils.dropItemStackInWorld(player.worldObj, player.posX, player.posY, player.posZ, manual);
}
persistTag.setBoolean("givenGuide", true);
}
- boolean render = persistTag
- .getBoolean("fancyRender");
+ boolean render = persistTag.getBoolean("fancyRender");
JewelrycraftMod.fancyRender = render;
if (ConfigHandler.CURSES_ENABLED) {
for (Curse curse : Curse.getCurseList()) {
- if (curse.canCurseBeActivated(
- event.world)
- && !persistTag.hasKey(
- curse.getName())) {
- persistTag.setInteger(curse
- .getName(),
- 0);
+ if (curse.canCurseBeActivated(event.world) && !persistTag.hasKey(curse.getName())) {
+ persistTag.setInteger(curse.getName(), 0);
}
}
}
for (Curse curse : Curse.getCurseList()) {
- if (!curse.canCurseBeActivated(
- event.world)) {
- Curse.availableCurses
- .remove(curse);
- persistTag.setInteger(
- curse.getName(),
- 0);
+ if (!curse.canCurseBeActivated(event.world)) {
+ Curse.availableCurses.remove(curse);
+ persistTag.setInteger(curse.getName(), 0);
totalUnavailableCurses++;
- } else if (!Curse.availableCurses
- .contains(curse))
+ } else if (!Curse.availableCurses.contains(curse))
Curse.availableCurses.add(curse);
}
@@ -169,38 +135,24 @@ public class EntityEventHandler { if (entity instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) entity;
- NBTTagCompound playerInfo = PlayerUtils
- .getModPlayerPersistTag(player,
- Variables.MODID);
+ NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(player, Variables.MODID);
- playerInfo.setBoolean("fancyRender",
- JewelrycraftMod.fancyRender);
+ playerInfo.setBoolean("fancyRender", JewelrycraftMod.fancyRender);
if (updateTime > 0) {
updateTime--;
}
for (int i = 0; i < 18; i++) {
- if (getJewelryItems(playerInfo,
- i) != null) {
- if (getJewelryItems(playerInfo, i)
- .getItem() instanceof ItemBaseJewelry) {
- ((ItemBaseJewelry) getJewelryItems(
- playerInfo,
- i).getItem()).action(
- getJewelryItems(playerInfo,
- i),
- player);
+ if (getJewelryItems(playerInfo, i) != null) {
+ if (getJewelryItems(playerInfo, i).getItem() instanceof ItemBaseJewelry) {
+ ((ItemBaseJewelry) getJewelryItems(playerInfo, i).getItem())
+ .action(getJewelryItems(playerInfo, i), player);
}
- if (getJewelryItems(playerInfo, i)
- .getItem() instanceof IJewelryItem) {
- ((IJewelryItem) getJewelryItems(
- playerInfo,
- i).getItem()).onWearAction(
- getJewelryItems(playerInfo,
- i),
- player);
+ if (getJewelryItems(playerInfo, i).getItem() instanceof IJewelryItem) {
+ ((IJewelryItem) getJewelryItems(playerInfo, i).getItem())
+ .onWearAction(getJewelryItems(playerInfo, i), player);
}
}
}
@@ -210,20 +162,14 @@ public class EntityEventHandler { updateCurses(playerInfo, player);
if (updateTime == 0) {
- JewelrycraftMod.netWrapper
- .sendToAll(new PacketSendServerPlayersInfo());
+ JewelrycraftMod.netWrapper.sendToAll(new PacketSendServerPlayersInfo());
updateTime = 200;
}
if (ConfigHandler.CURSES_ENABLED) {
- for (Curse curse : Curse
- .getCurseList()) {
- if (curse.canCurseBeActivated(
- player.worldObj)
- && playerInfo.getInteger(
- curse.getName()) > 0) {
- curse.action(player.worldObj,
- player);
+ for (Curse curse : Curse.getCurseList()) {
+ if (curse.canCurseBeActivated(player.worldObj) && playerInfo.getInteger(curse.getName()) > 0) {
+ curse.action(player.worldObj, player);
}
}
}
@@ -231,87 +177,55 @@ public class EntityEventHandler { }
}
- public void updateCurses(NBTTagCompound playerInfo,
- EntityPlayer player) {
- if (playerInfo.hasKey("playerCursePointsChanged")
- && playerInfo.getBoolean(
- "playerCursePointsChanged")) {
+ public void updateCurses(NBTTagCompound playerInfo, EntityPlayer player) {
+ if (playerInfo.hasKey("playerCursePointsChanged") && playerInfo.getBoolean("playerCursePointsChanged")) {
int points = playerInfo.getInteger("cursePoints");
- int maxCurses = playerInfo
- .getInteger("cursePoints")
- / Variables.CURSE_POINTS_PER_LEVEL
- + 1;
-
- if (points > 0 && playerInfo.getInteger(
- "activeCurses") < maxCurses) {
- while (playerInfo.getInteger(
- "activeCurses") < maxCurses
- && Curse.availableCurses
- .size() > 0
- && playerInfo.getInteger(
- "activeCurses") < Curse
- .getCurseList()
- .size()) {
+ int maxCurses = playerInfo.getInteger("cursePoints") / Variables.CURSE_POINTS_PER_LEVEL + 1;
+
+ if (points > 0 && playerInfo.getInteger("activeCurses") < maxCurses) {
+ while (playerInfo.getInteger("activeCurses") < maxCurses && Curse.availableCurses.size() > 0
+ && playerInfo.getInteger("activeCurses") < Curse.getCurseList().size()) {
addCurse(player, playerInfo);
}
}
- if (!playerInfo.hasKey("curseTime")
- || !playerInfo.hasKey(
- "reselectCurses")
- || playerInfo.getBoolean(
- "reselectCurses")) {
+ if (!playerInfo.hasKey("curseTime") || !playerInfo.hasKey("reselectCurses")
+ || playerInfo.getBoolean("reselectCurses")) {
playerInfo.setInteger("curseTime", 23000);
- playerInfo.setBoolean("reselectCurses",
- false);
+ playerInfo.setBoolean("reselectCurses", false);
}
- JewelrycraftMod.netWrapper.sendTo(
- new PacketSendClientPlayerInfo(
- playerInfo),
- (EntityPlayerMP) player);
+ JewelrycraftMod.netWrapper.sendTo(new PacketSendClientPlayerInfo(playerInfo), (EntityPlayerMP) player);
if (addedCurses) {
- JewelrycraftMod.netWrapper.sendToAll(
- new PacketSendServerPlayersInfo());
- player.addChatMessage(
- new ChatComponentText(
- StatCollector.translateToLocal(
- "curse." + Variables.MODID
- + ".activated")));
+ JewelrycraftMod.netWrapper.sendToAll(new PacketSendServerPlayersInfo());
+ player.addChatMessage(new ChatComponentText(
+ StatCollector.translateToLocal("curse." + Variables.MODID + ".activated")));
addedCurses = false;
}
}
if (playerInfo.getBoolean("playerCursePointsChanged")) {
- playerInfo.setBoolean("playerCursePointsChanged",
- false);
+ playerInfo.setBoolean("playerCursePointsChanged", false);
}
luck = calculateLuck(player);
}
public void timeUntilYouCanResetCurses(NBTTagCompound playerInfo) {
- if (playerInfo.hasKey("reselectCurses") && !playerInfo
- .getBoolean("reselectCurses")) {
- playerInfo.setInteger("curseTime",
- playerInfo.getInteger("curseTime")
- - 10000);
+ if (playerInfo.hasKey("reselectCurses") && !playerInfo.getBoolean("reselectCurses")) {
+ playerInfo.setInteger("curseTime", playerInfo.getInteger("curseTime") - 10000);
if (playerInfo.getInteger("curseTime") <= 0)
- playerInfo.setBoolean("reselectCurses",
- true);
+ playerInfo.setBoolean("reselectCurses", true);
}
}
- public ItemStack getJewelryItems(NBTTagCompound playerInfo,
- int i) {
+ public ItemStack getJewelryItems(NBTTagCompound playerInfo, int i) {
if (playerInfo.hasKey("ext" + i)) {
- NBTTagCompound nbt = (NBTTagCompound) playerInfo
- .getTag("ext" + i);
+ NBTTagCompound nbt = (NBTTagCompound) playerInfo.getTag("ext" + i);
- ItemStack item = ItemStack
- .loadItemStackFromNBT(nbt);
+ ItemStack item = ItemStack.loadItemStackFromNBT(nbt);
if (item != null) {
return item;
@@ -323,23 +237,13 @@ public class EntityEventHandler { @SubscribeEvent
public void onEntityLivingDropItems(LivingDropsEvent event) {
- if (event.source.getEntity() != null && event.source
- .getEntity() instanceof EntityPlayer) {
- EntityPlayer player = (EntityPlayer) event.source
- .getEntity();
- NBTTagCompound playerInfo = PlayerUtils
- .getModPlayerPersistTag(player,
- Variables.MODID);
+ if (event.source.getEntity() != null && event.source.getEntity() instanceof EntityPlayer) {
+ EntityPlayer player = (EntityPlayer) event.source.getEntity();
+ NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(player, Variables.MODID);
if (ConfigHandler.CURSES_ENABLED)
for (Curse curse : Curse.getCurseList())
- if (curse.canCurseBeActivated(
- player.worldObj)
- && playerInfo.getInteger(
- curse.getName()) > 0)
- curse.entityDropItems(
- player,
- event.entityLiving,
- event.drops);
+ if (curse.canCurseBeActivated(player.worldObj) && playerInfo.getInteger(curse.getName()) > 0)
+ curse.entityDropItems(player, event.entityLiving, event.drops);
}
}
@@ -347,248 +251,127 @@ public class EntityEventHandler { public void onEntityAttacked(LivingAttackEvent event) {
EntityLivingBase entity = event.entityLiving;
- if (event.source.getEntity() != null && event.source
- .getEntity() instanceof EntityLivingBase
- && ((EntityLivingBase) event.source
- .getEntity()).isPotionActive(
- PotionList.stun))
+ if (event.source.getEntity() != null && event.source.getEntity() instanceof EntityLivingBase
+ && ((EntityLivingBase) event.source.getEntity()).isPotionActive(PotionList.stun))
event.setCanceled(true);
if (entity instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) entity;
- NBTTagCompound playerInfo = PlayerUtils
- .getModPlayerPersistTag(player,
- Variables.MODID);
+ NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(player, Variables.MODID);
- if (!(event.source
- .getEntity() instanceof EntityPlayer)
- && !player.capabilities.isCreativeMode) {
+ if (!(event.source.getEntity() instanceof EntityPlayer) && !player.capabilities.isCreativeMode) {
if (!player.worldObj.isRemote)
for (int i = 0; i < 18; i++)
- if (getJewelryItems(
- playerInfo,
- i) != null) {
- if (getJewelryItems(
- playerInfo,
- i).getItem() instanceof ItemBaseJewelry) {
- ((ItemBaseJewelry) getJewelryItems(
- playerInfo,
- i).getItem()).onPlayerAttacked(
- getJewelryItems(playerInfo,
- i),
- player,
- event.source,
- event.ammount);
-
- if (((ItemBaseJewelry) getJewelryItems(
- playerInfo,
- i).getItem()).onPlayerAttackedCacellable(
- getJewelryItems(playerInfo,
- i),
- player,
- event.source,
- event.ammount)) {
- event.setCanceled(
- true);
+ if (getJewelryItems(playerInfo, i) != null) {
+ if (getJewelryItems(playerInfo, i).getItem() instanceof ItemBaseJewelry) {
+ ((ItemBaseJewelry) getJewelryItems(playerInfo, i).getItem()).onPlayerAttacked(
+ getJewelryItems(playerInfo, i), player, event.source, event.ammount);
+
+ if (((ItemBaseJewelry) getJewelryItems(playerInfo, i).getItem())
+ .onPlayerAttackedCacellable(getJewelryItems(playerInfo, i), player,
+ event.source, event.ammount)) {
+ event.setCanceled(true);
}
}
- if (getJewelryItems(
- playerInfo,
- i).getItem() instanceof IJewelryItem) {
- ((IJewelryItem) getJewelryItems(
- playerInfo,
- i).getItem()).onPlayerAttackedAction(
- getJewelryItems(playerInfo,
- i),
- player,
- event.source,
- event.ammount);
+ if (getJewelryItems(playerInfo, i).getItem() instanceof IJewelryItem) {
+ ((IJewelryItem) getJewelryItems(playerInfo, i).getItem()).onPlayerAttackedAction(
+ getJewelryItems(playerInfo, i), player, event.source, event.ammount);
}
}
if (ConfigHandler.CURSES_ENABLED) {
- for (Curse curse : Curse
- .getCurseList()) {
- if (curse.canCurseBeActivated(
- player.worldObj)
- && playerInfo.getInteger(
- curse.getName()) > 0) {
- curse.attackedAction(
- player.worldObj,
- player,
- event,
- event.source.getEntity());
+ for (Curse curse : Curse.getCurseList()) {
+ if (curse.canCurseBeActivated(player.worldObj) && playerInfo.getInteger(curse.getName()) > 0) {
+ curse.attackedAction(player.worldObj, player, event, event.source.getEntity());
}
}
}
}
removeHearts(event, player, playerInfo);
- JewelrycraftMod.netWrapper.sendToAll(
- new PacketSendServerPlayersInfo());
- JewelrycraftMod.netWrapper.sendTo(
- new PacketSendClientPlayerInfo(
- playerInfo),
- (EntityPlayerMP) player);
+ JewelrycraftMod.netWrapper.sendToAll(new PacketSendServerPlayersInfo());
+ JewelrycraftMod.netWrapper.sendTo(new PacketSendClientPlayerInfo(playerInfo), (EntityPlayerMP) player);
}
if (event.source.getEntity() instanceof EntityPlayer) {
- EntityPlayer player = (EntityPlayer) event.source
- .getEntity();
- NBTTagCompound playerInfo = PlayerUtils
- .getModPlayerPersistTag(player,
- Variables.MODID);
+ 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()).onEntityAttacked(
- getJewelryItems(playerInfo,
- i),
- player,
- entity,
- event.ammount);
- if (((ItemBaseJewelry) getJewelryItems(
- playerInfo,
- i).getItem()).onEntityAttackedCacellable(
- getJewelryItems(playerInfo,
- i),
- player,
- entity,
- event.ammount))
- event.setCanceled(
- true);
+ if (getJewelryItems(playerInfo, i) != null) {
+ if (getJewelryItems(playerInfo, i).getItem() instanceof ItemBaseJewelry) {
+ ((ItemBaseJewelry) getJewelryItems(playerInfo, i).getItem())
+ .onEntityAttacked(getJewelryItems(playerInfo, i), player, entity, event.ammount);
+ if (((ItemBaseJewelry) getJewelryItems(playerInfo, i).getItem()).onEntityAttackedCacellable(
+ getJewelryItems(playerInfo, i), player, entity, event.ammount))
+ event.setCanceled(true);
}
- if (getJewelryItems(playerInfo, i)
- .getItem() instanceof IJewelryItem)
- ((IJewelryItem) getJewelryItems(
- playerInfo,
- i).getItem()).onEntityAttackedByPlayer(
- getJewelryItems(playerInfo,
- i),
- player,
- entity,
- event.ammount);
+ if (getJewelryItems(playerInfo, i).getItem() instanceof IJewelryItem)
+ ((IJewelryItem) getJewelryItems(playerInfo, i).getItem()).onEntityAttackedByPlayer(
+ getJewelryItems(playerInfo, i), player, entity, event.ammount);
}
if (ConfigHandler.CURSES_ENABLED)
for (Curse curse : Curse.getCurseList())
- if (curse.canCurseBeActivated(
- player.worldObj)
- && playerInfo.getInteger(
- curse.getName()) > 0) {
- curse.attackedByPlayerAction(
- event,
- entity.worldObj,
- player,
- entity);
- if (curse.attackedByPlayerActionCancelable(
- event,
- player.worldObj,
- player,
- entity))
- event.setCanceled(
- true);
+ if (curse.canCurseBeActivated(player.worldObj) && playerInfo.getInteger(curse.getName()) > 0) {
+ curse.attackedByPlayerAction(event, entity.worldObj, player, entity);
+ if (curse.attackedByPlayerActionCancelable(event, player.worldObj, player, entity))
+ event.setCanceled(true);
}
- if (entity instanceof EntityHeart
- && entity.getAge() < 30)
+ if (entity instanceof EntityHeart && entity.getAge() < 30)
event.setCanceled(true);
if (event.source.getEntity() instanceof EntityPlayerMP) {
- JewelrycraftMod.netWrapper.sendToAll(
- new PacketSendServerPlayersInfo());
- JewelrycraftMod.netWrapper.sendTo(
- new PacketSendClientPlayerInfo(
- playerInfo),
- (EntityPlayerMP) player);
+ JewelrycraftMod.netWrapper.sendToAll(new PacketSendServerPlayersInfo());
+ JewelrycraftMod.netWrapper.sendTo(new PacketSendClientPlayerInfo(playerInfo), (EntityPlayerMP) player);
}
}
}
- public void removeHearts(LivingAttackEvent event,
- EntityPlayer player, NBTTagCompound playerInfo) {
- if (!player.worldObj.isRemote
- && !player.capabilities.isCreativeMode
- && (float) player.hurtResistantTime <= (float) player.maxHurtResistantTime
- / 2.0F) {
+ public void removeHearts(LivingAttackEvent event, EntityPlayer player, NBTTagCompound playerInfo) {
+ if (!player.worldObj.isRemote && !player.capabilities.isCreativeMode
+ && (float) player.hurtResistantTime <= (float) player.maxHurtResistantTime / 2.0F) {
if (playerInfo.getFloat("WhiteHeart") > 0) {
playerInfo.setFloat("WhiteHeart", 0f);
}
if (playerInfo.getFloat("BlueHeart") > 0) {
- float damage = playerInfo
- .getFloat("BlueHeart")
- - event.ammount;
+ float damage = playerInfo.getFloat("BlueHeart") - event.ammount;
if (damage >= 0) {
- playerInfo.setFloat("BlueHeart",
- damage);
+ playerInfo.setFloat("BlueHeart", damage);
} else {
- playerInfo.setFloat("BlueHeart",
- 0f);
+ playerInfo.setFloat("BlueHeart", 0f);
}
if (damage < 0) {
System.out.println(damage);
- player.attackEntityFrom(
- event.source,
- Math.abs(damage));
+ player.attackEntityFrom(event.source, Math.abs(damage));
}
player.hurtResistantTime = player.maxHurtResistantTime;
player.hurtTime = player.maxHurtTime = 10;
- player.worldObj.playSoundAtEntity(player,
- "game.player.hurt", 1.0F,
- (EntityEventHandler.rand
- .nextFloat()
- - EntityEventHandler.rand
- .nextFloat())
- * 0.2F
- + 1.0F);
+ player.worldObj.playSoundAtEntity(player, "game.player.hurt", 1.0F,
+ (EntityEventHandler.rand.nextFloat() - EntityEventHandler.rand.nextFloat()) * 0.2F + 1.0F);
event.setCanceled(true);
} else if (playerInfo.getFloat("BlackHeart") > 0) {
- AxisAlignedBB axisalignedbb = player.boundingBox
- .expand(6.0D, 6.0D, 6.0D);
- List<?> enemies = player.worldObj
- .getEntitiesWithinAABBExcludingEntity(
- player,
- axisalignedbb,
- EntitySelector.selectMonsters);
- if (enemies != null && !enemies.isEmpty()
- && event.source != DamageSourceList.blackHeart) {
- Iterator<?> iterator = enemies
- .iterator();
+ AxisAlignedBB axisalignedbb = player.boundingBox.expand(6.0D, 6.0D, 6.0D);
+ List<?> enemies = player.worldObj.getEntitiesWithinAABBExcludingEntity(player, axisalignedbb,
+ EntitySelector.selectMonsters);
+ if (enemies != null && !enemies.isEmpty() && event.source != DamageSourceList.blackHeart) {
+ Iterator<?> iterator = enemies.iterator();
while (iterator.hasNext()) {
- Entity enemy = (Entity) iterator
- .next();
- enemy.attackEntityFrom(
- DamageSourceList.blackHeart,
- 6f);
+ Entity enemy = (Entity) iterator.next();
+ enemy.attackEntityFrom(DamageSourceList.blackHeart, 6f);
}
}
- float damage = playerInfo
- .getFloat("BlackHeart")
- - event.ammount;
+ float damage = playerInfo.getFloat("BlackHeart") - event.ammount;
if (damage >= 0)
- playerInfo.setFloat("BlackHeart",
- damage);
+ playerInfo.setFloat("BlackHeart", damage);
else
- playerInfo.setFloat("BlackHeart",
- 0f);
+ playerInfo.setFloat("BlackHeart", 0f);
if (damage < 0)
- player.attackEntityFrom(
- event.source,
- Math.abs(damage));
+ player.attackEntityFrom(event.source, Math.abs(damage));
player.hurtResistantTime = player.maxHurtResistantTime;
player.hurtTime = player.maxHurtTime = 10;
- player.worldObj.playSoundAtEntity(player,
- "game.player.hurt", 1.0F,
- (EntityEventHandler.rand
- .nextFloat()
- - EntityEventHandler.rand
- .nextFloat())
- * 0.2F
- + 1.0F);
+ player.worldObj.playSoundAtEntity(player, "game.player.hurt", 1.0F,
+ (EntityEventHandler.rand.nextFloat() - EntityEventHandler.rand.nextFloat()) * 0.2F + 1.0F);
event.setCanceled(true);
}
}
@@ -598,37 +381,18 @@ public class EntityEventHandler { public void onPlayerRespawn(PlayerEvent.Clone event) {
EntityPlayer player = event.entityPlayer;
if (!player.worldObj.isRemote) {
- NBTTagCompound playerInfo = PlayerUtils
- .getModPlayerPersistTag(player,
- Variables.MODID);
+ NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(player, Variables.MODID);
if (playerInfo.hasKey("cursePoints")) {
- int points = playerInfo
- .getInteger("cursePoints");
- int maxCurses = playerInfo
- .getInteger("cursePoints")
- / Variables.CURSE_POINTS_PER_LEVEL
- + 1;
- if (points > 0 && playerInfo.getInteger(
- "activeCurses") < maxCurses)
- while (playerInfo.getInteger(
- "activeCurses") < maxCurses
- && Curse.availableCurses
- .size() > 0
- && playerInfo.getInteger(
- "activeCurses") < Curse
- .getCurseList()
- .size())
+ int points = playerInfo.getInteger("cursePoints");
+ int maxCurses = playerInfo.getInteger("cursePoints") / Variables.CURSE_POINTS_PER_LEVEL + 1;
+ if (points > 0 && playerInfo.getInteger("activeCurses") < maxCurses)
+ while (playerInfo.getInteger("activeCurses") < maxCurses && Curse.availableCurses.size() > 0
+ && playerInfo.getInteger("activeCurses") < Curse.getCurseList().size())
addCurse(player, playerInfo);
- if (!playerInfo.hasKey("curseTime")
- || !playerInfo.hasKey(
- "reselectCurses")
- || playerInfo.getBoolean(
- "reselectCurses")) {
- playerInfo.setInteger("curseTime",
- 23000);
- playerInfo.setBoolean(
- "reselectCurses",
- false);
+ if (!playerInfo.hasKey("curseTime") || !playerInfo.hasKey("reselectCurses")
+ || playerInfo.getBoolean("reselectCurses")) {
+ playerInfo.setInteger("curseTime", 23000);
+ playerInfo.setBoolean("reselectCurses", false);
}
}
playerInfo.setFloat("BlueHeart", 0f);
@@ -636,110 +400,57 @@ public class EntityEventHandler { playerInfo.setFloat("WhiteHeart", 0f);
if (ConfigHandler.CURSES_ENABLED)
for (Curse curse : Curse.getCurseList())
- if (curse.canCurseBeActivated(
- player.worldObj)
- && playerInfo.getInteger(
- curse.getName()) > 0)
- curse.respawnAction(
- player.worldObj,
- player);
+ if (curse.canCurseBeActivated(player.worldObj) && playerInfo.getInteger(curse.getName()) > 0)
+ curse.respawnAction(player.worldObj, player);
for (int i = 0; i < 18; i++)
- if (getJewelryItems(playerInfo,
- i) != null) {
- if (getJewelryItems(playerInfo, i)
- .getItem() instanceof ItemBaseJewelry)
- ((ItemBaseJewelry) getJewelryItems(
- playerInfo,
- i).getItem()).onPlayerRespawn(
- getJewelryItems(playerInfo,
- i),
- event);
- if (getJewelryItems(playerInfo, i)
- .getItem() instanceof IJewelryItem)
- ((IJewelryItem) getJewelryItems(
- playerInfo,
- i).getItem()).onPlayerRespawnAction(
- getJewelryItems(playerInfo,
- i),
- event);
+ if (getJewelryItems(playerInfo, i) != null) {
+ if (getJewelryItems(playerInfo, i).getItem() instanceof ItemBaseJewelry)
+ ((ItemBaseJewelry) getJewelryItems(playerInfo, i).getItem())
+ .onPlayerRespawn(getJewelryItems(playerInfo, i), event);
+ if (getJewelryItems(playerInfo, i).getItem() instanceof IJewelryItem)
+ ((IJewelryItem) getJewelryItems(playerInfo, i).getItem())
+ .onPlayerRespawnAction(getJewelryItems(playerInfo, i), event);
}
- JewelrycraftMod.netWrapper.sendTo(
- new PacketSendClientPlayerInfo(
- playerInfo),
- (EntityPlayerMP) player);
+ JewelrycraftMod.netWrapper.sendTo(new PacketSendClientPlayerInfo(playerInfo), (EntityPlayerMP) player);
if (addedCurses) {
- JewelrycraftMod.netWrapper.sendToAll(
- new PacketSendServerPlayersInfo());
+ JewelrycraftMod.netWrapper.sendToAll(new PacketSendServerPlayersInfo());
addedCurses = false;
}
}
}
- public void addCurse(EntityPlayer player,
- NBTTagCompound playerInfo) {
- if (ConfigHandler.CURSES_ENABLED
- && Curse.availableCurses.size() > 0) {
- Curse cur = ((WeightedRandomCurse) WeightedRandom
- .getRandomItem(rand,
- JewelrycraftUtil.getCurses(
- player.worldObj,
- player,
- rand))).getCurse(
- rand);
+ public void addCurse(EntityPlayer player, NBTTagCompound playerInfo) {
+ if (ConfigHandler.CURSES_ENABLED && Curse.availableCurses.size() > 0) {
+ Curse cur = ((WeightedRandomCurse) WeightedRandom.getRandomItem(rand,
+ JewelrycraftUtil.getCurses(player.worldObj, player, rand))).getCurse(rand);
playerInfo.setInteger(cur.getName(), 1);
Curse.availableCurses.remove(cur);
addedCurses = true;
if (playerInfo.getInteger("activeCurses") == 0)
playerInfo.setInteger("activeCurses", 1);
else
- playerInfo.setInteger("activeCurses",
- playerInfo.getInteger(
- "activeCurses")
- + 1);
- JewelrycraftMod.netWrapper.sendToAll(
- new PacketSendServerPlayersInfo());
- JewelrycraftMod.netWrapper.sendTo(
- new PacketSendClientPlayerInfo(
- playerInfo),
- (EntityPlayerMP) player);
+ playerInfo.setInteger("activeCurses", playerInfo.getInteger("activeCurses") + 1);
+ JewelrycraftMod.netWrapper.sendToAll(new PacketSendServerPlayersInfo());
+ JewelrycraftMod.netWrapper.sendTo(new PacketSendClientPlayerInfo(playerInfo), (EntityPlayerMP) player);
}
}
@SubscribeEvent
public void itemToss(ItemTossEvent event) {
- NBTTagCompound playerInfo = PlayerUtils
- .getModPlayerPersistTag(event.player,
- Variables.MODID);
+ NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(event.player, Variables.MODID);
if (ConfigHandler.CURSES_ENABLED)
for (Curse curse : Curse.getCurseList())
- if (event.player != null && curse
- .canCurseBeActivated(
- event.player.worldObj)
- && playerInfo.getInteger(
- curse.getName()) > 0
- && curse.itemToss()) {
- EntityItem entityitem = new EntityItem(
- event.player.worldObj,
- event.player.posX
- + 0.5D,
- event.player.posY
- + 0.5D,
- event.player.posZ
- + 0.5D,
- event.entityItem.getEntityItem());
+ if (event.player != null && curse.canCurseBeActivated(event.player.worldObj)
+ && playerInfo.getInteger(curse.getName()) > 0 && curse.itemToss()) {
+ EntityItem entityitem = new EntityItem(event.player.worldObj, event.player.posX + 0.5D,
+ event.player.posY + 0.5D, event.player.posZ + 0.5D, event.entityItem.getEntityItem());
if (entityitem != null) {
entityitem.motionX = 0;
entityitem.motionZ = 0;
entityitem.motionY = 0.11000000298023224D;
- event.player.worldObj
- .spawnEntityInWorld(
- entityitem);
- MinecraftServer.getServer()
- .getConfigurationManager()
- .sendChatMsg(new ChatComponentText(
- "<" + event.player
- .getDisplayName()
- + "> I shouldn't drop this. I might need it later."));
+ event.player.worldObj.spawnEntityInWorld(entityitem);
+ MinecraftServer.getServer().getConfigurationManager().sendChatMsg(new ChatComponentText("<"
+ + event.player.getDisplayName() + "> I shouldn't drop this. I might need it later."));
event.setCanceled(true);
}
}
@@ -747,23 +458,16 @@ public class EntityEventHandler { @SubscribeEvent
public void playerFileSave(PlayerEvent.SaveToFile event) {
- if (event.entity instanceof EntityPlayer
- && !(event.entity instanceof EntityPlayerMP))
- JewelrycraftMod.netWrapper.sendToServer(
- new PacketRequestPlayerInfo());
+ if (event.entity instanceof EntityPlayer && !(event.entity instanceof EntityPlayerMP))
+ JewelrycraftMod.netWrapper.sendToServer(new PacketRequestPlayerInfo());
}
public int calculateLuck(EntityPlayer player) {
int luck = 0;
- NBTTagCompound playerInfo = PlayerUtils
- .getModPlayerPersistTag(player,
- Variables.MODID);
+ NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(player, Variables.MODID);
if (ConfigHandler.CURSES_ENABLED)
for (Curse curse : Curse.getCurseList())
- if (curse.canCurseBeActivated(
- player.worldObj)
- && playerInfo.getInteger(
- curse.getName()) > 0)
+ if (curse.canCurseBeActivated(player.worldObj) && playerInfo.getInteger(curse.getName()) > 0)
luck += curse.luck();
return luck;
}
@@ -771,38 +475,21 @@ public class EntityEventHandler { public static void spawnHearts(Entity entity, int chance) {
EntityLiving live = (EntityLiving) entity;
String type = types.get(rand.nextInt(types.size()));
- if (rand.nextInt(chance) == 0 && live
- .getCreatureAttribute() != JewelrycraftUtil.HEARTS) {
+ if (rand.nextInt(chance) == 0 && live.getCreatureAttribute() != JewelrycraftUtil.HEARTS) {
if (type == "White") {
- EntityHeart h = new EntityHalfHeart(
- live.worldObj);
+ EntityHeart h = new EntityHalfHeart(live.worldObj);
h.setType(type);
- h.setLocationAndAngles(live.posX,
- live.posY, live.posZ,
- MathHelper.wrapAngleTo180_float(
- rand.nextFloat() * 360.0F),
- 0.0F);
+ h.setLocationAndAngles(live.posX, live.posY, live.posZ,
+ MathHelper.wrapAngleTo180_float(rand.nextFloat() * 360.0F), 0.0F);
live.worldObj.spawnEntityInWorld(h);
} else {
- for (int i = 1; i <= 1 + rand.nextInt(1
- + (int) (live.getMaxHealth()
- / 2)); i++) {
- EntityHeart[] hearts = {
- new EntityHeart(live.worldObj),
- new EntityHalfHeart(
- entity.worldObj)
- };
- EntityHeart h = hearts[rand
- .nextInt(2)];
+ for (int i = 1; i <= 1 + rand.nextInt(1 + (int) (live.getMaxHealth() / 2)); i++) {
+ EntityHeart[] hearts = { new EntityHeart(live.worldObj), new EntityHalfHeart(entity.worldObj) };
+ EntityHeart h = hearts[rand.nextInt(2)];
h.setType(type);
- h.setLocationAndAngles(live.posX,
- live.posY,
- live.posZ,
- MathHelper.wrapAngleTo180_float(
- rand.nextFloat() * 360.0F),
- 0.0F);
- live.worldObj.spawnEntityInWorld(
- h);
+ h.setLocationAndAngles(live.posX, live.posY, live.posZ,
+ MathHelper.wrapAngleTo180_float(rand.nextFloat() * 360.0F), 0.0F);
+ live.worldObj.spawnEntityInWorld(h);
}
}
}
@@ -811,129 +498,69 @@ public class EntityEventHandler { @SubscribeEvent
public void onEntityDead(LivingDeathEvent event) {
final Entity entity = event.entity;
- if (!entity.worldObj.isRemote
- && !(entity instanceof EntityPlayer)
- && entity instanceof EntityLiving
- && event.source.getEntity() != null
- && event.source.getEntity() instanceof EntityPlayer) {
+ if (!entity.worldObj.isRemote && !(entity instanceof EntityPlayer) && entity instanceof EntityLiving
+ && event.source.getEntity() != null && event.source.getEntity() instanceof EntityPlayer) {
System.out.println(luck);
spawnHearts(entity, Math.max(2, 20 - luck));
- EntityPlayer player = (EntityPlayer) event.source
- .getEntity();
- NBTTagCompound playerInfo = PlayerUtils
- .getModPlayerPersistTag(player,
- Variables.MODID);
+ EntityPlayer player = (EntityPlayer) event.source.getEntity();
+ NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(player, Variables.MODID);
if (ConfigHandler.CURSES_ENABLED)
for (Curse curse : Curse.getCurseList())
- if (curse.canCurseBeActivated(
- player.worldObj)
- && playerInfo.getInteger(
- curse.getName()) > 0)
- curse.entityDeathAction(
- player.worldObj,
- event.entityLiving,
- player);
+ if (curse.canCurseBeActivated(player.worldObj) && playerInfo.getInteger(curse.getName()) > 0)
+ curse.entityDeathAction(player.worldObj, event.entityLiving, player);
}
if (entity instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) entity;
- NBTTagCompound playerInfo = PlayerUtils
- .getModPlayerPersistTag(player,
- Variables.MODID);
+ NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(player, Variables.MODID);
playerInfo.setFloat("BlueHeart", 0f);
playerInfo.setFloat("BlackHeart", 0f);
playerInfo.setFloat("WhiteHeart", 0f);
- if (playerInfo.hasKey("reselectCurses")
- && playerInfo.getBoolean(
- "reselectCurses")) {
+ if (playerInfo.hasKey("reselectCurses") && playerInfo.getBoolean("reselectCurses")) {
playerInfo.setInteger("activeCurses", 0);
if (ConfigHandler.CURSES_ENABLED)
- for (Curse l : Curse
- .getCurseList()) {
- if (l.canCurseBeActivated(
- player.worldObj)
- && playerInfo.getInteger(
- l.getName()) == 1) {
- playerInfo.setInteger(
- l.getName(),
- 0);
- l.setTicksActive(
- 0);
- if (!Curse.availableCurses
- .contains(l))
- Curse.availableCurses
- .add(l);
- } else if (l.canCurseBeActivated(
- player.worldObj)
- && playerInfo.getInteger(
- l.getName()) >= 2)
- playerInfo.setInteger(
- l.getName(),
- 1);
+ for (Curse l : Curse.getCurseList()) {
+ if (l.canCurseBeActivated(player.worldObj) && playerInfo.getInteger(l.getName()) == 1) {
+ playerInfo.setInteger(l.getName(), 0);
+ l.setTicksActive(0);
+ if (!Curse.availableCurses.contains(l))
+ Curse.availableCurses.add(l);
+ } else if (l.canCurseBeActivated(player.worldObj) && playerInfo.getInteger(l.getName()) >= 2)
+ playerInfo.setInteger(l.getName(), 1);
}
if (entity.worldObj.isRemote)
- JewelrycraftMod.netWrapper
- .sendToServer(new PacketRequestPlayerInfo());
+ JewelrycraftMod.netWrapper.sendToServer(new PacketRequestPlayerInfo());
}
if (ConfigHandler.CURSES_ENABLED) {
for (Curse curse : Curse.getCurseList())
- if (curse.canCurseBeActivated(
- player.worldObj)
- && playerInfo.getInteger(
- curse.getName()) > 0)
- curse.playerDeathAction(
- player.worldObj,
- player,
- event);
+ if (curse.canCurseBeActivated(player.worldObj) && playerInfo.getInteger(curse.getName()) > 0)
+ curse.playerDeathAction(player.worldObj, player, event);
}
for (int i = 0; i < 18; i++)
- if (getJewelryItems(playerInfo,
- i) != null) {
- if (getJewelryItems(playerInfo, i)
- .getItem() instanceof ItemBaseJewelry)
- ((ItemBaseJewelry) getJewelryItems(
- playerInfo,
- i).getItem()).onPlayerDead(
- getJewelryItems(playerInfo,
- i),
- player,
- event.source);
- if (getJewelryItems(playerInfo, i)
- .getItem() instanceof IJewelryItem)
- ((IJewelryItem) getJewelryItems(
- playerInfo,
- i).getItem()).onPlayerDeadAction(
- getJewelryItems(playerInfo,
- i),
- player,
- event.source);
+ if (getJewelryItems(playerInfo, i) != null) {
+ if (getJewelryItems(playerInfo, i).getItem() instanceof ItemBaseJewelry)
+ ((ItemBaseJewelry) getJewelryItems(playerInfo, i).getItem())
+ .onPlayerDead(getJewelryItems(playerInfo, i), player, event.source);
+ if (getJewelryItems(playerInfo, i).getItem() instanceof IJewelryItem)
+ ((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());
+ if (event.entity instanceof EntityPlayer && !(event.entity instanceof EntityPlayerMP))
+ JewelrycraftMod.netWrapper.sendToServer(new PacketRequestPlayerInfo());
}
@SubscribeEvent
public void onEntityHeal(LivingHealEvent event) {
if (event.entity instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) event.entity;
- NBTTagCompound playerInfo = PlayerUtils
- .getModPlayerPersistTag(player,
- Variables.MODID);
+ NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(player, Variables.MODID);
if (ConfigHandler.CURSES_ENABLED) {
for (Curse curse : Curse.getCurseList())
- if (curse.canCurseBeActivated(
- player.worldObj)
- && playerInfo.getInteger(
- curse.getName()) > 0)
- curse.playerHealAction(
- player.worldObj,
- player,
- event);
+ if (curse.canCurseBeActivated(player.worldObj) && playerInfo.getInteger(curse.getName()) > 0)
+ curse.playerHealAction(player.worldObj, player, event);
}
}
}
@@ -942,20 +569,12 @@ public class EntityEventHandler { public void onPlayerSleep(PlayerSleepInBedEvent event) {
if (event.entity instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) event.entity;
- NBTTagCompound playerInfo = PlayerUtils
- .getModPlayerPersistTag(player,
- Variables.MODID);
+ NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(player, Variables.MODID);
if (ConfigHandler.CURSES_ENABLED) {
for (Curse curse : Curse.getCurseList())
- if (curse.canCurseBeActivated(
- player.worldObj)
- && playerInfo.getInteger(
- curse.getName()) > 0)
- curse.playerSleepAction(
- player.worldObj,
- player,
- event);
+ if (curse.canCurseBeActivated(player.worldObj) && playerInfo.getInteger(curse.getName()) > 0)
+ curse.playerSleepAction(player.worldObj, player, event);
}
}
}
diff --git a/src/main/java/darkknight/jewelrycraft/events/EventList.java b/src/main/java/darkknight/jewelrycraft/events/EventList.java index 17f6d0e..ed764f3 100755 --- a/src/main/java/darkknight/jewelrycraft/events/EventList.java +++ b/src/main/java/darkknight/jewelrycraft/events/EventList.java @@ -21,15 +21,12 @@ import net.minecraftforge.common.MinecraftForge; public class EventList {
public static void preInit(FMLPreInitializationEvent e) {
- MinecraftForge.EVENT_BUS
- .register(new EntityEventHandler());
+ MinecraftForge.EVENT_BUS.register(new EntityEventHandler());
MinecraftForge.EVENT_BUS.register(new BlockEventHandler());
MinecraftForge.EVENT_BUS.register(BucketHandler.INSTANCE);
- FMLCommonHandler.instance().bus()
- .register(new EventCommonHandler());
- BucketHandler.INSTANCE.buckets.put(BlockList.moltenMetal,
- ItemList.bucket);
+ FMLCommonHandler.instance().bus().register(new EventCommonHandler());
+ BucketHandler.INSTANCE.buckets.put(BlockList.moltenMetal, ItemList.bucket);
JewelrycraftMod.proxy.preInit();
}
@@ -37,8 +34,7 @@ public class EventList { GameRegistry.registerWorldGenerator(new Generation(), 0);
JewelrycraftMod.proxy.init();
new GuiHandler();
- FMLCommonHandler.instance().bus()
- .register(ConfigHandler.INSTANCE);
+ FMLCommonHandler.instance().bus().register(ConfigHandler.INSTANCE);
}
public static void postInit(FMLPostInitializationEvent e) {
diff --git a/src/main/java/darkknight/jewelrycraft/events/KeyBindings.java b/src/main/java/darkknight/jewelrycraft/events/KeyBindings.java index d196a05..ac22df3 100755 --- a/src/main/java/darkknight/jewelrycraft/events/KeyBindings.java +++ b/src/main/java/darkknight/jewelrycraft/events/KeyBindings.java @@ -11,14 +11,9 @@ import darkknight.jewelrycraft.util.Variables; import net.minecraft.client.settings.KeyBinding;
public class KeyBindings {
- public static KeyBinding render = new KeyBinding(
- "Pretty Render", Keyboard.KEY_Z,
- Variables.MODNAME);
- public static KeyBinding inventory = new KeyBinding(
- "Jewelry Inventory", Keyboard.KEY_J,
- Variables.MODNAME);
- public static KeyBinding curses = new KeyBinding(
- "Curses Tab", Keyboard.KEY_C, Variables.MODNAME);
+ public static KeyBinding render = new KeyBinding("Pretty Render", Keyboard.KEY_Z, Variables.MODNAME);
+ public static KeyBinding inventory = new KeyBinding("Jewelry Inventory", Keyboard.KEY_J, Variables.MODNAME);
+ public static KeyBinding curses = new KeyBinding("Curses Tab", Keyboard.KEY_C, Variables.MODNAME);
/**
*
@@ -37,10 +32,8 @@ public class KeyBindings { if (render.isPressed())
JewelrycraftMod.fancyRender = !JewelrycraftMod.fancyRender;
if (inventory.isPressed())
- JewelrycraftMod.netWrapper.sendToServer(
- new PacketKeyPressEvent(0));
+ JewelrycraftMod.netWrapper.sendToServer(new PacketKeyPressEvent(0));
if (curses.isPressed())
- JewelrycraftMod.netWrapper.sendToServer(
- new PacketKeyPressEvent(1));
+ JewelrycraftMod.netWrapper.sendToServer(new PacketKeyPressEvent(1));
}
}
\ No newline at end of file diff --git a/src/main/java/darkknight/jewelrycraft/events/PlayerRenderHandler.java b/src/main/java/darkknight/jewelrycraft/events/PlayerRenderHandler.java index 40be3e5..3e5e80d 100755 --- a/src/main/java/darkknight/jewelrycraft/events/PlayerRenderHandler.java +++ b/src/main/java/darkknight/jewelrycraft/events/PlayerRenderHandler.java @@ -23,12 +23,12 @@ import net.minecraftforge.client.event.RenderHandEvent; import net.minecraftforge.client.event.RenderPlayerEvent;
public class PlayerRenderHandler {
- EarringsRender earrings = new EarringsRender();
- BraceletRender bracelet = new BraceletRender();
- NecklaceRender necklace = new NecklaceRender();
- RingRender ring = new RingRender();
- public static NBTTagCompound playersInfo = new NBTTagCompound();
- float size = 0.055F;
+ EarringsRender earrings = new EarringsRender();
+ BraceletRender bracelet = new BraceletRender();
+ NecklaceRender necklace = new NecklaceRender();
+ RingRender ring = new RingRender();
+ public static NBTTagCompound playersInfo = new NBTTagCompound();
+ float size = 0.055F;
@SubscribeEvent
public void renderScreen(RenderPlayerEvent.Specials.Post event) {
@@ -37,716 +37,271 @@ public class PlayerRenderHandler { ModelRenderer leftArm = event.renderer.modelBipedMain.bipedLeftArm;
ModelRenderer head = event.renderer.modelBipedMain.bipedHead;
ModelRenderer body = event.renderer.modelBipedMain.bipedBody;
- Iterator<EntityPlayer> players = event.entityPlayer.worldObj.playerEntities
- .iterator();
+ Iterator<EntityPlayer> players = event.entityPlayer.worldObj.playerEntities.iterator();
float rotAngleX = 0F, rotAngleY = 0F, rotAngleZ = 0F;
if (playersInfo != null) {
while (players.hasNext()) {
- int[] gemColor = {
- -1, -1, -1, -1
- };
- int[] ingotColor = {
- -1, -1, -1, -1
- };
+ int[] gemColor = { -1, -1, -1, -1 };
+ int[] ingotColor = { -1, -1, -1, -1 };
int gem = -1;
int ingot = -1;
EntityPlayer player = players.next();
- NBTTagCompound playerInfo = (NBTTagCompound) playersInfo
- .getTag(player.getDisplayName());
+ NBTTagCompound playerInfo = (NBTTagCompound) playersInfo.getTag(player.getDisplayName());
if (ConfigHandler.CURSES_ENABLED)
- for (Curse curse : Curse
- .getCurseList())
- if (curse != null && curse
- .canCurseBeActivated(
- player.worldObj)
- && playerInfo != null
- && curse.getName() != null
- && playerInfo.getInteger(
- curse.getName()) > 0
- && event.entityPlayer != null
- && player != null
- && event.entityPlayer
- .getDisplayName()
- .equals(player.getDisplayName())
- && playerInfo.getInteger(
- "cursePoints") > 0)
- curse.playerRender(
- player,
- event);
+ for (Curse curse : Curse.getCurseList())
+ if (curse != null && curse.canCurseBeActivated(player.worldObj) && playerInfo != null
+ && curse.getName() != null && playerInfo.getInteger(curse.getName()) > 0
+ && event.entityPlayer != null && player != null
+ && event.entityPlayer.getDisplayName().equals(player.getDisplayName())
+ && playerInfo.getInteger("cursePoints") > 0)
+ curse.playerRender(player, event);
int no = 0;
ModelRenderer arm = rightArm;
for (int i = 0; i <= 9; i++)
- if (playerInfo != null
- && event.entityPlayer != null
- && player != null
- && playerInfo.hasKey(
- "ext" + i)
- && event.entityPlayer
- .getDisplayName()
- .equals(player.getDisplayName())) {
+ if (playerInfo != null && event.entityPlayer != null && player != null
+ && playerInfo.hasKey("ext" + i)
+ && event.entityPlayer.getDisplayName().equals(player.getDisplayName())) {
gem = -1;
ingot = -1;
if (i > 4)
arm = leftArm;
float s = 0.055F;
- NBTTagCompound nbt = (NBTTagCompound) playerInfo
- .getTag("ext" + i);
- ItemStack item = ItemStack
- .loadItemStackFromNBT(
- nbt);
+ NBTTagCompound nbt = (NBTTagCompound) playerInfo.getTag("ext" + i);
+ ItemStack item = ItemStack.loadItemStackFromNBT(nbt);
if (Loader.isModLoaded(
"alpaca") /*
- * &&
- * fiskfille
- * .
- * alpaca
- * .
- * AlpacaAPI.
- * isAlpacaClient
- * (
- * event.
- * entityPlayer)
- */)
+ * && fiskfille . alpaca . AlpacaAPI. isAlpacaClient ( event. entityPlayer)
+ */)
arm = body;
GL11.glPushMatrix();
- if (arm.rotateAngleX == 0.0F
- && arm.rotateAngleY == 0.0F
- && arm.rotateAngleZ == 0.0F) {
- if ((arm.rotationPointX
- + rotAngleX) != 0.0F
- || (arm.rotationPointY
- + rotAngleY) != 0.0F
- || (arm.rotationPointZ
- + rotAngleZ) != 0.0F)
- GL11.glTranslatef(
- (arm.rotationPointX
- + rotAngleX)
- * s,
- (arm.rotationPointY
- + rotAngleY)
- * s,
- (arm.rotationPointZ
- + rotAngleZ)
- * s);
+ if (arm.rotateAngleX == 0.0F && arm.rotateAngleY == 0.0F && arm.rotateAngleZ == 0.0F) {
+ if ((arm.rotationPointX + rotAngleX) != 0.0F || (arm.rotationPointY + rotAngleY) != 0.0F
+ || (arm.rotationPointZ + rotAngleZ) != 0.0F)
+ GL11.glTranslatef((arm.rotationPointX + rotAngleX) * s,
+ (arm.rotationPointY + rotAngleY) * s, (arm.rotationPointZ + rotAngleZ) * s);
} else if (!Loader
.isModLoaded("alpaca") /*
- * ||
- * (Loader
- * .
- * isModLoaded(
- * "alpaca")
- * &&
- * !fiskfille
- * .
- * alpaca
- * .
- * AlpacaAPI.
- * isAlpacaClient
- * (
- * event.
- * entityPlayer
- * )
- * )
- */) {
- GL11.glTranslatef(
- (arm.rotationPointX
- + rotAngleX)
- * s,
- (arm.rotationPointY
- + rotAngleY)
- * s,
- (arm.rotationPointZ
- + rotAngleZ)
- * s);
+ * || (Loader . isModLoaded( "alpaca") && !fiskfille . alpaca .
+ * AlpacaAPI. isAlpacaClient ( event. entityPlayer ) )
+ */) {
+ GL11.glTranslatef((arm.rotationPointX + rotAngleX) * s,
+ (arm.rotationPointY + rotAngleY) * s, (arm.rotationPointZ + rotAngleZ) * s);
if (arm.rotateAngleZ != 0.0F)
- GL11.glRotatef(arm.rotateAngleZ
- * (180F / (float) Math.PI),
- 0.0F,
- 0.0F,
- 1.0F);
+ GL11.glRotatef(arm.rotateAngleZ * (180F / (float) Math.PI), 0.0F, 0.0F, 1.0F);
if (arm.rotateAngleY != 0.0F)
- GL11.glRotatef(arm.rotateAngleY
- * (180F / (float) Math.PI),
- 0.0F,
- 1.0F,
- 0.0F);
+ GL11.glRotatef(arm.rotateAngleY * (180F / (float) Math.PI), 0.0F, 1.0F, 0.0F);
if (arm.rotateAngleX != 0.0F)
- GL11.glRotatef(arm.rotateAngleX
- * (180F / (float) Math.PI),
- 1.0F,
- 0.0F,
- 0.0F);
+ GL11.glRotatef(arm.rotateAngleX * (180F / (float) Math.PI), 1.0F, 0.0F, 0.0F);
}
- if (JewelryNBT.ingot(
- item) != null)
- ingot = JewelrycraftUtil
- .getColor(JewelryNBT
- .ingot(item));
- if (JewelryNBT.gem(
- item) != null)
- gem = JewelrycraftUtil
- .getColor(JewelryNBT
- .gem(item));
+ if (JewelryNBT.ingot(item) != null)
+ ingot = JewelrycraftUtil.getColor(JewelryNBT.ingot(item));
+ if (JewelryNBT.gem(item) != null)
+ gem = JewelrycraftUtil.getColor(JewelryNBT.gem(item));
float scale = 0.1f;
if (Loader.isModLoaded(
"alpaca") /*
- * &&
- * fiskfille
- * .
- * alpaca
- * .
- * AlpacaAPI.
- * isAlpacaClient
- * (
- * event.
- * entityPlayer)
- */) {
+ * && fiskfille . alpaca . AlpacaAPI. isAlpacaClient ( event. entityPlayer)
+ */) {
if (i <= 4) {
- GL11.glTranslatef(
- 0.35F,
- -4.35F,
- -2.8F + 0.15F * i);
- GL11.glRotatef(90f,
- 0F,
- 1F,
- 0F);
+ GL11.glTranslatef(0.35F, -4.35F, -2.8F + 0.15F * i);
+ GL11.glRotatef(90f, 0F, 1F, 0F);
} else {
- GL11.glTranslatef(
- -0.35F,
- -4.35F,
- 1.48F + 0.15F * i);
- GL11.glRotatef(-90f,
- 0F,
- 1F,
- 0F);
+ GL11.glTranslatef(-0.35F, -4.35F, 1.48F + 0.15F * i);
+ GL11.glRotatef(-90f, 0F, 1F, 0F);
}
scale = 0.3F;
} else {
if (i <= 4)
- GL11.glTranslatef(
- 0.64F + 0.05F * i,
- -1.15F,
- 0.07F);
+ GL11.glTranslatef(0.64F + 0.05F * i, -1.15F, 0.07F);
else
- GL11.glTranslatef(
- 0.59F + 0.05F * i,
- -1.15F,
- 0.07F);
+ GL11.glTranslatef(0.59F + 0.05F * i, -1.15F, 0.07F);
}
- GL11.glScalef(scale, scale
- + scale / 2,
- scale);
- ring.doRender(event.entityPlayer,
- 0F, 0F,
- (float) ingot,
- (float) gem,
- 0F);
+ GL11.glScalef(scale, scale + scale / 2, scale);
+ ring.doRender(event.entityPlayer, 0F, 0F, (float) ingot, (float) gem, 0F);
GL11.glPopMatrix();
// no++;
}
for (int i = 10; i <= 13; i++)
- if (playerInfo != null
- && event.entityPlayer != null
- && player != null
- && playerInfo.hasKey(
- "ext" + i)
- && event.entityPlayer
- .getDisplayName()
- .equals(player.getDisplayName())) {
- NBTTagCompound nbt = (NBTTagCompound) playerInfo
- .getTag("ext" + i);
- ItemStack item = ItemStack
- .loadItemStackFromNBT(
- nbt);
- if (JewelryNBT.ingot(
- item) != null)
- ingotColor[i - 10] = JewelrycraftUtil
- .getColor(JewelryNBT
- .ingot(item));
- if (JewelryNBT.gem(
- item) != null)
- gemColor[i - 10] = JewelrycraftUtil
- .getColor(JewelryNBT
- .gem(item));
+ if (playerInfo != null && event.entityPlayer != null && player != null
+ && playerInfo.hasKey("ext" + i)
+ && event.entityPlayer.getDisplayName().equals(player.getDisplayName())) {
+ NBTTagCompound nbt = (NBTTagCompound) playerInfo.getTag("ext" + i);
+ ItemStack item = ItemStack.loadItemStackFromNBT(nbt);
+ if (JewelryNBT.ingot(item) != null)
+ ingotColor[i - 10] = JewelrycraftUtil.getColor(JewelryNBT.ingot(item));
+ if (JewelryNBT.gem(item) != null)
+ gemColor[i - 10] = JewelrycraftUtil.getColor(JewelryNBT.gem(item));
}
- if (playerInfo != null
- && event.entityPlayer != null
- && player != null
- && (playerInfo.hasKey(
- "ext10")
- || playerInfo.hasKey(
- "ext11"))
- && event.entityPlayer
- .getDisplayName()
- .equals(player.getDisplayName())) {
+ if (playerInfo != null && event.entityPlayer != null && player != null
+ && (playerInfo.hasKey("ext10") || playerInfo.hasKey("ext11"))
+ && event.entityPlayer.getDisplayName().equals(player.getDisplayName())) {
GL11.glPushMatrix();
GL11.glColor4f(1, 1, 1, 1);
if (Loader.isModLoaded(
"alpaca") /*
- * &&
- * fiskfille
- * .
- * alpaca
- * .
- * AlpacaAPI.
- * isAlpacaClient
- * (
- * event.
- * entityPlayer)
- */) {
+ * && fiskfille . alpaca . AlpacaAPI. isAlpacaClient ( event. entityPlayer)
+ */) {
rightArm = body;
- GL11.glTranslatef(0.0F,
- 0.05F,
- 0.0F);
- GL11.glRotatef(-30F, 0.0F,
- 1.0F,
- 0.0F);
+ GL11.glTranslatef(0.0F, 0.05F, 0.0F);
+ GL11.glRotatef(-30F, 0.0F, 1.0F, 0.0F);
}
- if (rightArm.rotateAngleX == 0.0F
- && rightArm.rotateAngleY == 0.0F
+ if (rightArm.rotateAngleX == 0.0F && rightArm.rotateAngleY == 0.0F
&& rightArm.rotateAngleZ == 0.0F) {
- if ((rightArm.rotationPointX
- + rotAngleX) != 0.0F
- || (rightArm.rotationPointY
- + rotAngleY) != 0.0F
- || (rightArm.rotationPointZ
- + rotAngleZ) != 0.0F)
- GL11.glTranslatef(
- (rightArm.rotationPointX
- + rotAngleX)
- * size,
- (rightArm.rotationPointY
- + rotAngleY)
- * size,
- (rightArm.rotationPointZ
- + rotAngleZ)
- * size);
- } else if (!Loader.isModLoaded(
- "alpaca") /*
- * ||
- * (Loader
- * .
- * isModLoaded
- * (
- * "alpaca")
- * &&
- * fiskfille
- * .
- * alpaca
- * .
- * AlpacaAPI.
- * isAlpacaClient
- * (
- * event.
- * entityPlayer
- * )
- * )
- */) {
- GL11.glTranslatef(
- (rightArm.rotationPointX
- + rotAngleX)
- * size,
- (rightArm.rotationPointY
- + rotAngleY)
- * size,
- (rightArm.rotationPointZ
- + rotAngleZ)
- * size);
+ if ((rightArm.rotationPointX + rotAngleX) != 0.0F
+ || (rightArm.rotationPointY + rotAngleY) != 0.0F
+ || (rightArm.rotationPointZ + rotAngleZ) != 0.0F)
+ GL11.glTranslatef((rightArm.rotationPointX + rotAngleX) * size,
+ (rightArm.rotationPointY + rotAngleY) * size,
+ (rightArm.rotationPointZ + rotAngleZ) * size);
+ } else if (!Loader
+ .isModLoaded("alpaca") /*
+ * || (Loader . isModLoaded ( "alpaca") && fiskfille . alpaca .
+ * AlpacaAPI. isAlpacaClient ( event. entityPlayer ) )
+ */) {
+ GL11.glTranslatef((rightArm.rotationPointX + rotAngleX) * size,
+ (rightArm.rotationPointY + rotAngleY) * size,
+ (rightArm.rotationPointZ + rotAngleZ) * size);
if (rightArm.rotateAngleZ != 0.0F)
- GL11.glRotatef(rightArm.rotateAngleZ
- * (180F / (float) Math.PI),
- 0.0F,
- 0.0F,
- 1.0F);
+ GL11.glRotatef(rightArm.rotateAngleZ * (180F / (float) Math.PI), 0.0F, 0.0F, 1.0F);
if (rightArm.rotateAngleY != 0.0F)
- GL11.glRotatef(rightArm.rotateAngleY
- * (180F / (float) Math.PI),
- 0.0F,
- 1.0F,
- 0.0F);
+ GL11.glRotatef(rightArm.rotateAngleY * (180F / (float) Math.PI), 0.0F, 1.0F, 0.0F);
if (rightArm.rotateAngleX != 0.0F)
- GL11.glRotatef(rightArm.rotateAngleX
- * (180F / (float) Math.PI),
- 1.0F,
- 0.0F,
- 0.0F);
+ GL11.glRotatef(rightArm.rotateAngleX * (180F / (float) Math.PI), 1.0F, 0.0F, 0.0F);
}
GL11.glScalef(0.05f, 0.03f, 0.05f);
- bracelet.doRender(
- event.entityPlayer,
- (float) ingotColor[0],
- (float) gemColor[0],
- (float) ingotColor[1],
- (float) gemColor[1],
- 0.0F);
+ bracelet.doRender(event.entityPlayer, (float) ingotColor[0], (float) gemColor[0],
+ (float) ingotColor[1], (float) gemColor[1], 0.0F);
GL11.glPopMatrix();
}
- if (playerInfo != null
- && event.entityPlayer != null
- && player != null
- && (playerInfo.hasKey(
- "ext12")
- || playerInfo.hasKey(
- "ext13"))
- && event.entityPlayer
- .getDisplayName()
- .equals(player.getDisplayName())) {
+ if (playerInfo != null && event.entityPlayer != null && player != null
+ && (playerInfo.hasKey("ext12") || playerInfo.hasKey("ext13"))
+ && event.entityPlayer.getDisplayName().equals(player.getDisplayName())) {
GL11.glPushMatrix();
GL11.glColor4f(1, 1, 1, 1);
if (Loader.isModLoaded(
"alpaca") /*
- * &&
- * fiskfille
- * .
- * alpaca
- * .
- * AlpacaAPI.
- * isAlpacaClient
- * (
- * event.
- * entityPlayer)
- */) {
+ * && fiskfille . alpaca . AlpacaAPI. isAlpacaClient ( event. entityPlayer)
+ */) {
leftArm = body;
- GL11.glTranslatef(-0.1F,
- 0.0F,
- 0.1F);
- GL11.glRotatef(-140F, 0.0F,
- 1.0F,
- 0.0F);
+ GL11.glTranslatef(-0.1F, 0.0F, 0.1F);
+ GL11.glRotatef(-140F, 0.0F, 1.0F, 0.0F);
}
- if (leftArm.rotateAngleX == 0.0F
- && leftArm.rotateAngleY == 0.0F
- && leftArm.rotateAngleZ == 0.0F) {
- if ((leftArm.rotationPointX
- + rotAngleX) != 0.0F
- || (leftArm.rotationPointY
- + rotAngleY) != 0.0F
- || (leftArm.rotationPointZ
- + rotAngleZ) != 0.0F)
- GL11.glTranslatef(
- (leftArm.rotationPointX
- + rotAngleX)
- * size,
- (leftArm.rotationPointY
- + rotAngleY)
- * size,
- (leftArm.rotationPointZ
- + rotAngleZ)
- * size);
- } else if (!Loader.isModLoaded(
- "alpaca") /*
- * ||
- * (Loader
- * .
- * isModLoaded
- * (
- * "alpaca")
- * &&
- * !fiskfille
- * .
- * alpaca
- * .
- * AlpacaAPI.
- * isAlpacaClient
- * (
- * event.
- * entityPlayer
- * )
- * )
- */) {
- GL11.glTranslatef(
- (leftArm.rotationPointX
- + rotAngleX)
- * size
- + 0.2F,
- (leftArm.rotationPointY
- + rotAngleY)
- * size,
- (leftArm.rotationPointZ
- + rotAngleZ)
- * size);
+ if (leftArm.rotateAngleX == 0.0F && leftArm.rotateAngleY == 0.0F && leftArm.rotateAngleZ == 0.0F) {
+ if ((leftArm.rotationPointX + rotAngleX) != 0.0F || (leftArm.rotationPointY + rotAngleY) != 0.0F
+ || (leftArm.rotationPointZ + rotAngleZ) != 0.0F)
+ GL11.glTranslatef((leftArm.rotationPointX + rotAngleX) * size,
+ (leftArm.rotationPointY + rotAngleY) * size,
+ (leftArm.rotationPointZ + rotAngleZ) * size);
+ } else if (!Loader
+ .isModLoaded("alpaca") /*
+ * || (Loader . isModLoaded ( "alpaca") && !fiskfille . alpaca .
+ * AlpacaAPI. isAlpacaClient ( event. entityPlayer ) )
+ */) {
+ GL11.glTranslatef((leftArm.rotationPointX + rotAngleX) * size + 0.2F,
+ (leftArm.rotationPointY + rotAngleY) * size,
+ (leftArm.rotationPointZ + rotAngleZ) * size);
if (leftArm.rotateAngleZ != 0.0F)
- GL11.glRotatef(leftArm.rotateAngleZ
- * (180F / (float) Math.PI),
- 0.0F,
- 0.0F,
- 1.0F);
+ GL11.glRotatef(leftArm.rotateAngleZ * (180F / (float) Math.PI), 0.0F, 0.0F, 1.0F);
if (leftArm.rotateAngleY != 0.0F)
- GL11.glRotatef(leftArm.rotateAngleY
- * (180F / (float) Math.PI),
- 0.0F,
- 1.0F,
- 0.0F);
+ GL11.glRotatef(leftArm.rotateAngleY * (180F / (float) Math.PI), 0.0F, 1.0F, 0.0F);
if (leftArm.rotateAngleX != 0.0F)
- GL11.glRotatef(leftArm.rotateAngleX
- * (180F / (float) Math.PI),
- 1.0F,
- 0.0F,
- 0.0F);
+ GL11.glRotatef(leftArm.rotateAngleX * (180F / (float) Math.PI), 1.0F, 0.0F, 0.0F);
}
GL11.glScalef(0.05f, 0.03f, 0.05f);
- bracelet.doRender(
- event.entityPlayer,
- (float) ingotColor[2],
- (float) gemColor[2],
- (float) ingotColor[3],
- (float) gemColor[3],
- 0F);
+ bracelet.doRender(event.entityPlayer, (float) ingotColor[2], (float) gemColor[2],
+ (float) ingotColor[3], (float) gemColor[3], 0F);
GL11.glPopMatrix();
}
no = 0;
for (int i = 14; i <= 16; i++)
- if (playerInfo != null
- && event.entityPlayer != null
- && player != null
- && playerInfo.hasKey(
- "ext" + i)
- && event.entityPlayer
- .getDisplayName()
- .equals(player.getDisplayName())) {
+ if (playerInfo != null && event.entityPlayer != null && player != null
+ && playerInfo.hasKey("ext" + i)
+ && event.entityPlayer.getDisplayName().equals(player.getDisplayName())) {
gem = -1;
ingot = -1;
- NBTTagCompound nbt = (NBTTagCompound) playerInfo
- .getTag("ext" + i);
- ItemStack item = ItemStack
- .loadItemStackFromNBT(
- nbt);
+ NBTTagCompound nbt = (NBTTagCompound) playerInfo.getTag("ext" + i);
+ ItemStack item = ItemStack.loadItemStackFromNBT(nbt);
GL11.glPushMatrix();
- if (body.rotateAngleX == 0.0F
- && body.rotateAngleY == 0.0F
- && body.rotateAngleZ == 0.0F) {
- if (body.rotationPointX != 0.0F
- || body.rotationPointY != 0.0F
+ if (body.rotateAngleX == 0.0F && body.rotateAngleY == 0.0F && body.rotateAngleZ == 0.0F) {
+ if (body.rotationPointX != 0.0F || body.rotationPointY != 0.0F
|| body.rotationPointZ != 0.0F)
- GL11.glTranslatef(
- body.rotationPointX
- * size,
- body.rotationPointY
- * size,
- body.rotationPointZ
- * size);
+ GL11.glTranslatef(body.rotationPointX * size, body.rotationPointY * size,
+ body.rotationPointZ * size);
} else if (!Loader
.isModLoaded("alpaca") /*
- * ||
- * (Loader
- * .
- * isModLoaded(
- * "alpaca")
- * &&
- * !fiskfille
- * .
- * alpaca
- * .
- * AlpacaAPI.
- * isAlpacaClient
- * (
- * event.
- * entityPlayer
- * )
- * )
- */) {
- GL11.glTranslatef(
- body.rotationPointX
- * size,
- body.rotationPointY
- * size,
- body.rotationPointZ
- * size);
+ * || (Loader . isModLoaded( "alpaca") && !fiskfille . alpaca .
+ * AlpacaAPI. isAlpacaClient ( event. entityPlayer ) )
+ */) {
+ GL11.glTranslatef(body.rotationPointX * size, body.rotationPointY * size,
+ body.rotationPointZ * size);
if (body.rotateAngleZ != 0.0F)
- GL11.glRotatef(body.rotateAngleZ
- * (180F / (float) Math.PI),
- 0.0F,
- 0.0F,
- 1.0F);
+ GL11.glRotatef(body.rotateAngleZ * (180F / (float) Math.PI), 0.0F, 0.0F, 1.0F);
if (body.rotateAngleY != 0.0F)
- GL11.glRotatef(body.rotateAngleY
- * (180F / (float) Math.PI),
- 0.0F,
- 1.0F,
- 0.0F);
+ GL11.glRotatef(body.rotateAngleY * (180F / (float) Math.PI), 0.0F, 1.0F, 0.0F);
if (body.rotateAngleX != 0.0F)
- GL11.glRotatef(body.rotateAngleX
- * (180F / (float) Math.PI),
- 1.0F,
- 0.0F,
- 0.0F);
+ GL11.glRotatef(body.rotateAngleX * (180F / (float) Math.PI), 1.0F, 0.0F, 0.0F);
}
if (Loader.isModLoaded(
"alpaca") /*
- * &&
- * fiskfille
- * .
- * alpaca
- * .
- * AlpacaAPI.
- * isAlpacaClient
- * (
- * event.
- * entityPlayer)
- */)
- GL11.glTranslatef(
- 0.0F,
- 0.55F,
- -0.28F);
- GL11.glScalef(0.0625f,
- 0.0625f,
- 0.0625f);
- if (JewelryNBT.ingot(
- item) != null)
- ingot = JewelrycraftUtil
- .getColor(JewelryNBT
- .ingot(item));
- if (JewelryNBT.gem(
- item) != null)
- gem = JewelrycraftUtil
- .getColor(JewelryNBT
- .gem(item));
+ * && fiskfille . alpaca . AlpacaAPI. isAlpacaClient ( event. entityPlayer)
+ */)
+ GL11.glTranslatef(0.0F, 0.55F, -0.28F);
+ GL11.glScalef(0.0625f, 0.0625f, 0.0625f);
+ if (JewelryNBT.ingot(item) != null)
+ ingot = JewelrycraftUtil.getColor(JewelryNBT.ingot(item));
+ if (JewelryNBT.gem(item) != null)
+ gem = JewelrycraftUtil.getColor(JewelryNBT.gem(item));
if (no > 0) {
- GL11.glRotatef(no == 1
- ? 25f
- : -25f,
- 0F,
- 0f,
- 1f);
- GL11.glRotatef(no == 1
- ? -5f
- : -10f,
- 1F,
- 0f,
- 0f);
+ GL11.glRotatef(no == 1 ? 25f : -25f, 0F, 0f, 1f);
+ GL11.glRotatef(no == 1 ? -5f : -10f, 1F, 0f, 0f);
}
- necklace.doRender(
- event.entityPlayer,
- 0F, 0F,
- (float) ingot,
- (float) gem,
- 0F);
+ necklace.doRender(event.entityPlayer, 0F, 0F, (float) ingot, (float) gem, 0F);
GL11.glPopMatrix();
no++;
}
- if (playerInfo != null
- && event.entityPlayer != null
- && player != null
- && playerInfo.hasKey(
- "ext17")
- && event.entityPlayer
- .getDisplayName()
- .equals(player.getDisplayName())) {
+ if (playerInfo != null && event.entityPlayer != null && player != null && playerInfo.hasKey("ext17")
+ && event.entityPlayer.getDisplayName().equals(player.getDisplayName())) {
gem = -1;
ingot = -1;
- NBTTagCompound nbt = (NBTTagCompound) playerInfo
- .getTag("ext17");
- ItemStack item = ItemStack
- .loadItemStackFromNBT(
- nbt);
+ NBTTagCompound nbt = (NBTTagCompound) playerInfo.getTag("ext17");
+ ItemStack item = ItemStack.loadItemStackFromNBT(nbt);
GL11.glPushMatrix();
float s = 0.0625F;
if (Loader.isModLoaded(
"alpaca") /*
- * &&
- * fiskfille
- * .
- * alpaca
- * .
- * AlpacaAPI.
- * isAlpacaClient
- * (
- * event.
- * entityPlayer)
- */)
+ * && fiskfille . alpaca . AlpacaAPI. isAlpacaClient ( event. entityPlayer)
+ */)
head = body;
- if (head.rotateAngleX == 0.0F
- && head.rotateAngleY == 0.0F
- && head.rotateAngleZ == 0.0F) {
- if (head.rotationPointX != 0.0F
- || head.rotationPointY != 0.0F
- || head.rotationPointZ != 0.0F)
- GL11.glTranslatef(
- head.rotationPointX
- * size,
- head.rotationPointY
- * size,
- head.rotationPointZ
- * size);
- } else if (!Loader.isModLoaded(
- "alpaca") /*
- * ||
- * (Loader
- * .
- * isModLoaded
- * (
- * "alpaca")
- * &&
- * !fiskfille
- * .
- * alpaca
- * .
- * AlpacaAPI.
- * isAlpacaClient
- * (
- * event.
- * entityPlayer
- * )
- * )
- */) {
- GL11.glTranslatef(
- head.rotationPointX
- * size,
- head.rotationPointY
- * size,
- head.rotationPointZ
- * size);
+ if (head.rotateAngleX == 0.0F && head.rotateAngleY == 0.0F && head.rotateAngleZ == 0.0F) {
+ if (head.rotationPointX != 0.0F || head.rotationPointY != 0.0F || head.rotationPointZ != 0.0F)
+ GL11.glTranslatef(head.rotationPointX * size, head.rotationPointY * size,
+ head.rotationPointZ * size);
+ } else if (!Loader
+ .isModLoaded("alpaca") /*
+ * || (Loader . isModLoaded ( "alpaca") && !fiskfille . alpaca .
+ * AlpacaAPI. isAlpacaClient ( event. entityPlayer ) )
+ */) {
+ GL11.glTranslatef(head.rotationPointX * size, head.rotationPointY * size,
+ head.rotationPointZ * size);
if (head.rotateAngleZ != 0.0F)
- GL11.glRotatef(head.rotateAngleZ
- * (180F / (float) Math.PI),
- 0.0F,
- 0.0F,
- 1.0F);
+ GL11.glRotatef(head.rotateAngleZ * (180F / (float) Math.PI), 0.0F, 0.0F, 1.0F);
if (head.rotateAngleY != 0.0F)
- GL11.glRotatef(head.rotateAngleY
- * (180F / (float) Math.PI),
- 0.0F,
- 1.0F,
- 0.0F);
+ GL11.glRotatef(head.rotateAngleY * (180F / (float) Math.PI), 0.0F, 1.0F, 0.0F);
if (head.rotateAngleX != 0.0F)
- GL11.glRotatef(head.rotateAngleX
- * (180F / (float) Math.PI),
- 1.0F,
- 0.0F,
- 0.0F);
+ GL11.glRotatef(head.rotateAngleX * (180F / (float) Math.PI), 1.0F, 0.0F, 0.0F);
}
if (Loader.isModLoaded(
"alpaca") /*
- * &&
- * fiskfille
- * .
- * alpaca
- * .
- * AlpacaAPI.
- * isAlpacaClient
- * (
- * event.
- * entityPlayer)
- */)
- GL11.glTranslatef(0.0F,
- 0.7F,
- -0.2F);
+ * && fiskfille . alpaca . AlpacaAPI. isAlpacaClient ( event. entityPlayer)
+ */)
+ GL11.glTranslatef(0.0F, 0.7F, -0.2F);
GL11.glScalef(s, s, s);
- GL11.glTranslatef(0.0F, 1.0F,
- -2.0F);
+ GL11.glTranslatef(0.0F, 1.0F, -2.0F);
if (JewelryNBT.ingot(item) != null)
- ingot = JewelrycraftUtil
- .getColor(JewelryNBT
- .ingot(item));
+ ingot = JewelrycraftUtil.getColor(JewelryNBT.ingot(item));
if (JewelryNBT.gem(item) != null)
- gem = JewelrycraftUtil
- .getColor(JewelryNBT
- .gem(item));
- earrings.doRender(
- event.entityPlayer,
- 0F, 0F,
- (float) ingot,
- (float) gem, 0F);
+ gem = JewelrycraftUtil.getColor(JewelryNBT.gem(item));
+ earrings.doRender(event.entityPlayer, 0F, 0F, (float) ingot, (float) gem, 0F);
GL11.glPopMatrix();
}
}
@@ -759,29 +314,15 @@ public class PlayerRenderHandler { @SubscribeEvent
public void renderHand(RenderHandEvent event) {
if (playersInfo != null) {
- EntityPlayer player = Minecraft
- .getMinecraft().thePlayer;
+ EntityPlayer player = Minecraft.getMinecraft().thePlayer;
if (player != null) {
- NBTTagCompound playerInfo = (NBTTagCompound) playersInfo
- .getTag(player.getDisplayName());
+ NBTTagCompound playerInfo = (NBTTagCompound) playersInfo.getTag(player.getDisplayName());
if (ConfigHandler.CURSES_ENABLED)
- for (Curse curse : Curse
- .getCurseList())
- if (curse.canCurseBeActivated(
- player.worldObj)
- && curse != null
- && playerInfo != null
- && playerInfo.hasKey(
- curse.getName())
- && playerInfo.getInteger(
- curse.getName()) > 0
- && playerInfo.hasKey(
- "cursePoints")
- && playerInfo.getInteger(
- "cursePoints") > 0)
- curse.playerHandRender(
- player,
- event);
+ for (Curse curse : Curse.getCurseList())
+ if (curse.canCurseBeActivated(player.worldObj) && curse != null && playerInfo != null
+ && playerInfo.hasKey(curse.getName()) && playerInfo.getInteger(curse.getName()) > 0
+ && playerInfo.hasKey("cursePoints") && playerInfo.getInteger("cursePoints") > 0)
+ curse.playerHandRender(player, event);
}
}
}
diff --git a/src/main/java/darkknight/jewelrycraft/events/ScreenHandler.java b/src/main/java/darkknight/jewelrycraft/events/ScreenHandler.java index 9df771d..a46f45b 100755 --- a/src/main/java/darkknight/jewelrycraft/events/ScreenHandler.java +++ b/src/main/java/darkknight/jewelrycraft/events/ScreenHandler.java @@ -13,9 +13,9 @@ import net.minecraftforge.client.event.RenderGameOverlayEvent; import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType;
public class ScreenHandler extends Gui {
- private Minecraft mc;
- public static NBTTagCompound tagCache = null;
- public static int cooldown;
+ private Minecraft mc;
+ public static NBTTagCompound tagCache = null;
+ public static int cooldown;
public ScreenHandler(Minecraft mc) {
super();
@@ -24,92 +24,52 @@ public class ScreenHandler extends Gui { @SubscribeEvent
public void renderScreen(RenderGameOverlayEvent event) {
- if (event.isCancelable() || event.type != ElementType.ALL
- || tagCache == null)
+ if (event.isCancelable() || event.type != ElementType.ALL || tagCache == null)
return;
int count = 0;
int size = 32;
- ScaledResolution resolution = new ScaledResolution(mc,
- mc.displayWidth, mc.displayHeight);
+ ScaledResolution resolution = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
GL11.glPushMatrix();
GL11.glColor4f(1f, 1f, 1f, 1.0f);
mc.renderEngine.bindTexture(Variables.MISC_TEXTURE);
count = 0;
size = 16;
if (tagCache.getFloat("BlueHeart") > 0) {
- drawTexturedModalRect(
- resolution.getScaledWidth() / 2
- + 90 + 35 * count,
- resolution.getScaledHeight() - 40,
+ drawTexturedModalRect(resolution.getScaledWidth() / 2 + 90 + 35 * count, resolution.getScaledHeight() - 40,
0 * size, 0 * size, size, size);
- mc.fontRenderer.drawStringWithShadow("x"
- + (MathHelper.ceiling_float_int(
- tagCache.getFloat(
- "BlueHeart"))
- / 2.0F),
- resolution.getScaledWidth() / 2
- + 105 + 35 * count,
- resolution.getScaledHeight() - 36,
- 16777215);
+ mc.fontRenderer.drawStringWithShadow(
+ "x" + (MathHelper.ceiling_float_int(tagCache.getFloat("BlueHeart")) / 2.0F),
+ resolution.getScaledWidth() / 2 + 105 + 35 * count, resolution.getScaledHeight() - 36, 16777215);
}
count++;
mc.renderEngine.bindTexture(Variables.MISC_TEXTURE);
if (tagCache.getFloat("BlackHeart") > 0) {
- drawTexturedModalRect(resolution.getScaledWidth()
- / 2
- + 90
+ drawTexturedModalRect(resolution.getScaledWidth() / 2 + 90
+ (mc.fontRenderer.getStringWidth(
- String.valueOf((MathHelper
- .ceiling_float_int(
- tagCache.getFloat(
- "BlueHeart"))
- / 2.0F)))
- - 14)
- + 35 * count,
- resolution.getScaledHeight() - 40,
- 1 * size, 0 * size, size, size);
- mc.fontRenderer.drawStringWithShadow("x"
- + (MathHelper.ceiling_float_int(
- tagCache.getFloat(
- "BlackHeart"))
- / 2.0F),
- resolution.getScaledWidth() / 2
- + 105
- + (mc.fontRenderer
- .getStringWidth(String
- .valueOf((MathHelper
- .ceiling_float_int(
- tagCache.getFloat(
- "BlueHeart"))
- / 2.0F)))
+ String.valueOf((MathHelper.ceiling_float_int(tagCache.getFloat("BlueHeart")) / 2.0F))) - 14)
+ + 35 * count, resolution.getScaledHeight() - 40, 1 * size, 0 * size, size, size);
+ mc.fontRenderer.drawStringWithShadow(
+ "x" + (MathHelper.ceiling_float_int(tagCache.getFloat("BlackHeart")) / 2.0F),
+ resolution.getScaledWidth() / 2 + 105
+ + (mc.fontRenderer.getStringWidth(String
+ .valueOf((MathHelper.ceiling_float_int(tagCache.getFloat("BlueHeart")) / 2.0F)))
- 14)
+ 35 * count,
- resolution.getScaledHeight() - 36,
- 16777215);
+ resolution.getScaledHeight() - 36, 16777215);
}
count++;
mc.renderEngine.bindTexture(Variables.MISC_TEXTURE);
if (tagCache.getFloat("WhiteHeart") > 0)
- drawTexturedModalRect(resolution.getScaledWidth()
- / 2
- + 90
- + (mc.fontRenderer.getStringWidth(
- String.valueOf((MathHelper
- .ceiling_float_int(
- tagCache.getFloat(
- "BlueHeart"))
- / 2.0F)))
- - 14)
- + (mc.fontRenderer.getStringWidth(
- String.valueOf((MathHelper
- .ceiling_float_int(
- tagCache.getFloat(
- "BlackHeart"))
- / 2.0F)))
- - 14)
- + 35 * count,
- resolution.getScaledHeight() - 40,
- 2 * size, 1 * size, size, size);
+ drawTexturedModalRect(
+ resolution.getScaledWidth() / 2 + 90
+ + (mc.fontRenderer.getStringWidth(String
+ .valueOf((MathHelper.ceiling_float_int(tagCache.getFloat("BlueHeart")) / 2.0F)))
+ - 14)
+ + (mc.fontRenderer.getStringWidth(String
+ .valueOf((MathHelper.ceiling_float_int(tagCache.getFloat("BlackHeart")) / 2.0F)))
+ - 14)
+ + 35 * count,
+ resolution.getScaledHeight() - 40, 2 * size, 1 * size, size, size);
GL11.glPopMatrix();
}
}
\ No newline at end of file diff --git a/src/main/java/darkknight/jewelrycraft/events/TextureEvent.java b/src/main/java/darkknight/jewelrycraft/events/TextureEvent.java index 0fed13f..a08579f 100755 --- a/src/main/java/darkknight/jewelrycraft/events/TextureEvent.java +++ b/src/main/java/darkknight/jewelrycraft/events/TextureEvent.java @@ -11,9 +11,6 @@ public class TextureEvent { @SideOnly(Side.CLIENT) public void textureFix(TextureStitchEvent.Post e) { if (e.map.getTextureType() == 0) - BlockList.moltenMetalFluid - .setIcons(BlockList.moltenMetal - .getBlockTextureFromSide( - 0)); + BlockList.moltenMetalFluid.setIcons(BlockList.moltenMetal.getBlockTextureFromSide(0)); } }
\ 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 2c2311c..da0315f 100755 --- a/src/main/java/darkknight/jewelrycraft/item/ItemBaseJewelry.java +++ b/src/main/java/darkknight/jewelrycraft/item/ItemBaseJewelry.java @@ -36,16 +36,13 @@ public abstract class ItemBaseJewelry extends Item { @SideOnly(Side.CLIENT)
public int getColorFromItemStack(ItemStack stack, int pass) {
if (pass == 0 && JewelryNBT.ingot(stack) != null) {
- return JewelrycraftUtil
- .getColor(JewelryNBT.ingot(stack));
+ return JewelrycraftUtil.getColor(JewelryNBT.ingot(stack));
}
if (pass == 1 && JewelryNBT.gem(stack) != null) {
- return JewelrycraftUtil
- .getColor(JewelryNBT.gem(stack));
+ return JewelrycraftUtil.getColor(JewelryNBT.gem(stack));
} else if (JewelryNBT.ingot(stack) != null) {
- return JewelrycraftUtil
- .getColor(JewelryNBT.ingot(stack));
+ return JewelrycraftUtil.getColor(JewelryNBT.ingot(stack));
}
return 16777215;
@@ -57,24 +54,14 @@ public abstract class ItemBaseJewelry extends Item { */
@Override
public String getItemStackDisplayName(ItemStack stack) {
- if (JewelryNBT.ingot(stack) != null && Item.getIdFromItem(
- JewelryNBT.ingot(stack).getItem()) > 0)
- return JewelryNBT.ingot(stack).getDisplayName()
- .replace("Ingot", " ").trim()
- + " "
- + ("" + StatCollector
- .translateToLocal(
- getUnlocalizedNameInefficiently(
- stack)
- + ".name")).trim();
- return ("" + StatCollector.translateToLocal(
- getUnlocalizedNameInefficiently(stack)
- + ".name")).trim();
+ if (JewelryNBT.ingot(stack) != null && Item.getIdFromItem(JewelryNBT.ingot(stack).getItem()) > 0)
+ return JewelryNBT.ingot(stack).getDisplayName().replace("Ingot", " ").trim() + " "
+ + ("" + StatCollector.translateToLocal(getUnlocalizedNameInefficiently(stack) + ".name")).trim();
+ return ("" + StatCollector.translateToLocal(getUnlocalizedNameInefficiently(stack) + ".name")).trim();
}
/**
- * allows items to add custom lines of information to the mouseover
- * description.
+ * allows items to add custom lines of information to the mouseover description.
*
* @param stack
* @param player
@@ -82,49 +69,28 @@ public abstract class ItemBaseJewelry extends Item { * @param par4
*/
@Override
- public void addInformation(ItemStack stack, EntityPlayer player,
- List list, boolean par4) {
+ public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) {
if (stack.hasTagCompound() && ConfigHandler.JEWELRY_INFO) {
ItemStack ingot = JewelryNBT.ingot(stack);
- if (ingot != null && Item.getIdFromItem(JewelryNBT
- .ingot(stack).getItem()) > 0) {
- list.add(StatCollector.translateToLocal(
- "info." + Variables.MODID
- + ".metal")
- + ": "
- + EnumChatFormatting.YELLOW
- + ingot.getDisplayName()
- .replace(StatCollector
- .translateToLocal(
- "info." + Variables.MODID
- + ".ingot"),
- " "));
+ if (ingot != null && Item.getIdFromItem(JewelryNBT.ingot(stack).getItem()) > 0) {
+ list.add(StatCollector.translateToLocal("info." + Variables.MODID + ".metal") + ": "
+ + EnumChatFormatting.YELLOW + ingot.getDisplayName()
+ .replace(StatCollector.translateToLocal("info." + Variables.MODID + ".ingot"), " "));
}
ItemStack gem = JewelryNBT.gem(stack);
if (gem != null) {
- list.add(StatCollector.translateToLocal(
- "info." + Variables.MODID
- + ".gem")
- + ": "
- + EnumChatFormatting.BLUE
- + gem.getDisplayName());
+ list.add(StatCollector.translateToLocal("info." + Variables.MODID + ".gem") + ": "
+ + EnumChatFormatting.BLUE + gem.getDisplayName());
}
- ArrayList<ItemStack> modifier = JewelryNBT
- .modifier(stack);
+ ArrayList<ItemStack> modifier = JewelryNBT.modifier(stack);
if (!modifier.isEmpty())
- list.add(StatCollector.translateToLocal(
- "info." + Variables.MODID
- + ".modifiers")
- + ": ");
+ list.add(StatCollector.translateToLocal("info." + Variables.MODID + ".modifiers") + ": ");
for (int i = 0; i < modifier.size(); i++)
- list.add(EnumChatFormatting.DARK_PURPLE
- + modifier.get(i)
- .getDisplayName()
- + " x"
+ list.add(EnumChatFormatting.DARK_PURPLE + modifier.get(i).getDisplayName() + " x"
+ modifier.get(i).stackSize);
}
}
@@ -135,8 +101,7 @@ public abstract class ItemBaseJewelry extends Item { */
public void action(ItemStack item, EntityPlayer player) {
for (ModifierEffects mod : ModifierEffects.getEffects())
- if (JewelryNBT.doesModifierExist(item,
- mod.getModifier()))
+ if (JewelryNBT.doesModifierExist(item, mod.getModifier()))
mod.action(item, player, this);
}
@@ -146,15 +111,10 @@ public abstract class ItemBaseJewelry extends Item { * @param source
* @return
*/
- public boolean onPlayerAttackedCacellable(ItemStack item,
- EntityPlayer player, DamageSource source,
- float amount) {
+ public boolean onPlayerAttackedCacellable(ItemStack item, EntityPlayer player, DamageSource source, float amount) {
for (ModifierEffects mod : ModifierEffects.getEffects())
- if (JewelryNBT.doesModifierExist(item,
- mod.getModifier()))
- return mod.onPlayerAttackedCancellable(
- item, player, source, this,
- amount);
+ if (JewelryNBT.doesModifierExist(item, mod.getModifier()))
+ return mod.onPlayerAttackedCancellable(item, player, source, this, amount);
return false;
}
@@ -164,14 +124,10 @@ public abstract class ItemBaseJewelry extends Item { * @param target
* @return
*/
- public boolean onEntityAttackedCacellable(ItemStack item,
- EntityPlayer player, Entity target, float amount) {
+ public boolean onEntityAttackedCacellable(ItemStack item, EntityPlayer player, Entity target, float amount) {
for (ModifierEffects mod : ModifierEffects.getEffects())
- if (JewelryNBT.doesModifierExist(item,
- mod.getModifier()))
- return mod.onEntityAttackedCancellable(
- item, player, target, this,
- amount);
+ if (JewelryNBT.doesModifierExist(item, mod.getModifier()))
+ return mod.onEntityAttackedCancellable(item, player, target, this, amount);
return false;
}
@@ -181,13 +137,10 @@ public abstract class ItemBaseJewelry extends Item { * @param source
* @return
*/
- public void onPlayerAttacked(ItemStack item, EntityPlayer player,
- DamageSource source, float amount) {
+ public void onPlayerAttacked(ItemStack item, EntityPlayer player, DamageSource source, float amount) {
for (ModifierEffects mod : ModifierEffects.getEffects())
- if (JewelryNBT.doesModifierExist(item,
- mod.getModifier()))
- mod.onPlayerAttacked(item, player, source,
- this, amount);
+ if (JewelryNBT.doesModifierExist(item, mod.getModifier()))
+ mod.onPlayerAttacked(item, player, source, this, amount);
}
/**
@@ -196,43 +149,33 @@ public abstract class ItemBaseJewelry extends Item { * @param target
* @return
*/
- public void onEntityAttacked(ItemStack item, EntityPlayer player,
- Entity target, float amount) {
+ public void onEntityAttacked(ItemStack item, EntityPlayer player, Entity target, float amount) {
for (ModifierEffects mod : ModifierEffects.getEffects())
- if (JewelryNBT.doesModifierExist(item,
- mod.getModifier()))
- mod.onEntityAttacked(item, player, target,
- this, amount);
+ if (JewelryNBT.doesModifierExist(item, mod.getModifier()))
+ mod.onEntityAttacked(item, player, target, this, amount);
}
- public void onPlayerDead(ItemStack item, EntityPlayer player,
- DamageSource source) {
+ public void onPlayerDead(ItemStack item, EntityPlayer player, DamageSource source) {
for (ModifierEffects mod : ModifierEffects.getEffects())
- if (JewelryNBT.doesModifierExist(item,
- mod.getModifier()))
- mod.onPlayerDead(item, player, source,
- this);
+ if (JewelryNBT.doesModifierExist(item, mod.getModifier()))
+ mod.onPlayerDead(item, player, source, this);
}
- public void onPlayerRespawn(ItemStack item,
- PlayerEvent.Clone event) {
+ public void onPlayerRespawn(ItemStack item, PlayerEvent.Clone event) {
for (ModifierEffects mod : ModifierEffects.getEffects())
- if (JewelryNBT.doesModifierExist(item,
- mod.getModifier()))
+ if (JewelryNBT.doesModifierExist(item, mod.getModifier()))
mod.onPlayerRespawn(item, event, this);
}
public void onJewelryEquipped(ItemStack item) {
for (ModifierEffects mod : ModifierEffects.getEffects())
- if (JewelryNBT.doesModifierExist(item,
- mod.getModifier()))
+ if (JewelryNBT.doesModifierExist(item, mod.getModifier()))
mod.onJewelryEquipped(item, this);
}
public void onJewelryUnequipped(ItemStack item) {
for (ModifierEffects mod : ModifierEffects.getEffects())
- if (JewelryNBT.doesModifierExist(item,
- mod.getModifier()))
+ if (JewelryNBT.doesModifierExist(item, mod.getModifier()))
mod.onJewelryUnequipped(item, this);
}
}
diff --git a/src/main/java/darkknight/jewelrycraft/item/ItemBracelet.java b/src/main/java/darkknight/jewelrycraft/item/ItemBracelet.java index 2de324a..fe01d89 100755 --- a/src/main/java/darkknight/jewelrycraft/item/ItemBracelet.java +++ b/src/main/java/darkknight/jewelrycraft/item/ItemBracelet.java @@ -20,10 +20,8 @@ public class ItemBracelet extends ItemBaseJewelry { */
@Override
public void registerIcons(IIconRegister iconRegister) {
- itemIcon = iconRegister.registerIcon(
- Variables.MODID + ":bracelet");
- gem = iconRegister.registerIcon(
- Variables.MODID + ":jewelBracelet");
+ itemIcon = iconRegister.registerIcon(Variables.MODID + ":bracelet");
+ gem = iconRegister.registerIcon(Variables.MODID + ":jewelBracelet");
}
/**
diff --git a/src/main/java/darkknight/jewelrycraft/item/ItemClayMolds.java b/src/main/java/darkknight/jewelrycraft/item/ItemClayMolds.java index 10929bd..32da38e 100755 --- a/src/main/java/darkknight/jewelrycraft/item/ItemClayMolds.java +++ b/src/main/java/darkknight/jewelrycraft/item/ItemClayMolds.java @@ -14,12 +14,10 @@ import net.minecraft.util.MathHelper; public class ItemClayMolds extends Item {
/** List of molds color names */
- public static final String[] moldsItemNames = new String[] {
- "clayIngot", "clayRing", "clayNecklace",
- "clayBracelet", "clayEarrings"
- };
+ public static final String[] moldsItemNames = new String[] { "clayIngot", "clayRing", "clayNecklace",
+ "clayBracelet", "clayEarrings" };
@SideOnly(Side.CLIENT)
- private IIcon[] moldsIcons;
+ private IIcon[] moldsIcons;
/**
*
@@ -41,25 +39,21 @@ public class ItemClayMolds extends Item { * Gets an icon index based on an item's damage value
*/
public IIcon getIconFromDamage(int par1) {
- int j = MathHelper.clamp_int(par1, 0,
- moldsItemNames.length - 1);
+ int j = MathHelper.clamp_int(par1, 0, moldsItemNames.length - 1);
return moldsIcons[j];
}
/**
- * Returns the unlocalized name of this item. This version accepts
- * an ItemStack so different stacks can have different names based
- * on their damage or NBT.
+ * Returns the unlocalized name of this item. This version accepts an ItemStack
+ * so different stacks can have different names based on their damage or NBT.
*
* @param par1ItemStack
* @return
*/
@Override
public String getUnlocalizedName(ItemStack par1ItemStack) {
- int i = MathHelper.clamp_int(par1ItemStack.getItemDamage(),
- 0, moldsItemNames.length - 1);
- return super.getUnlocalizedName() + "."
- + moldsItemNames[i];
+ int i = MathHelper.clamp_int(par1ItemStack.getItemDamage(), 0, moldsItemNames.length - 1);
+ return super.getUnlocalizedName() + "." + moldsItemNames[i];
}
/**
@@ -70,11 +64,10 @@ public class ItemClayMolds extends Item { @Override
@SideOnly(Side.CLIENT)
/**
- * returns a list of items with the same ID, but different meta
- * (eg: molds returns 16 items)
+ * returns a list of items with the same ID, but different meta (eg: molds
+ * returns 16 items)
*/
- public void getSubItems(Item par1, CreativeTabs par2CreativeTabs,
- List par3List) {
+ public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List par3List) {
for (int j = 0; j < moldsItemNames.length; ++j)
par3List.add(new ItemStack(par1, 1, j));
}
@@ -87,9 +80,6 @@ public class ItemClayMolds extends Item { public void registerIcons(IIconRegister par1IconRegister) {
moldsIcons = new IIcon[moldsItemNames.length];
for (int i = 0; i < moldsItemNames.length; ++i)
- moldsIcons[i] = par1IconRegister
- .registerIcon(Variables.MODID + ":"
- + moldsItemNames[i]
- + getIconString());
+ moldsIcons[i] = par1IconRegister.registerIcon(Variables.MODID + ":" + moldsItemNames[i] + getIconString());
}
}
diff --git a/src/main/java/darkknight/jewelrycraft/item/ItemEarrings.java b/src/main/java/darkknight/jewelrycraft/item/ItemEarrings.java index c9e84f4..e8f4052 100755 --- a/src/main/java/darkknight/jewelrycraft/item/ItemEarrings.java +++ b/src/main/java/darkknight/jewelrycraft/item/ItemEarrings.java @@ -20,10 +20,8 @@ public class ItemEarrings extends ItemBaseJewelry { */
@Override
public void registerIcons(IIconRegister iconRegister) {
- itemIcon = iconRegister.registerIcon(
- Variables.MODID + ":earrings");
- gem = iconRegister.registerIcon(
- Variables.MODID + ":jewelEarrings");
+ itemIcon = iconRegister.registerIcon(Variables.MODID + ":earrings");
+ gem = iconRegister.registerIcon(Variables.MODID + ":jewelEarrings");
}
/**
diff --git a/src/main/java/darkknight/jewelrycraft/item/ItemGoldObj.java b/src/main/java/darkknight/jewelrycraft/item/ItemGoldObj.java index 331fd65..3c055c6 100755 --- a/src/main/java/darkknight/jewelrycraft/item/ItemGoldObj.java +++ b/src/main/java/darkknight/jewelrycraft/item/ItemGoldObj.java @@ -56,38 +56,23 @@ public class ItemGoldObj extends Item { @Override
public String getItemStackDisplayName(ItemStack stack) {
- if (stack != null && stack.hasTagCompound()
- && stack.getTagCompound().hasKey("target")
- && Item.getItemById(Integer.valueOf(stack
- .getTagCompound()
- .getTag("target")
- .toString().split(",")[0]
- .substring(4)
- .replace("s", ""))) != null
+ if (stack != null && stack.hasTagCompound() && stack.getTagCompound().hasKey("target")
+ && Item.getItemById(Integer.valueOf(stack.getTagCompound().getTag("target").toString().split(",")[0]
+ .substring(4).replace("s", ""))) != null
&& JewelryNBT.item(stack) != null)
- return StatCollector.translateToLocal("info."
- + Variables.MODID + ".golden")
- + " " + JewelryNBT.item(stack)
- .getDisplayName();
- return StatCollector.translateToLocal("item."
- + Variables.MODID + ".goldObject.name");
+ return StatCollector.translateToLocal("info." + Variables.MODID + ".golden") + " "
+ + JewelryNBT.item(stack).getDisplayName();
+ return StatCollector.translateToLocal("item." + Variables.MODID + ".goldObject.name");
}
@Override
- public void addInformation(ItemStack stack, EntityPlayer player,
- List list, boolean displayInfo) {
+ public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean displayInfo) {
if (ConfigHandler.JEWELRY_INFO)
- if (stack != null && JewelryNBT.item(stack) != null
- && JewelryNBT.item(stack)
- .getItem() instanceof ItemFood)
+ if (stack != null && JewelryNBT.item(stack) != null && JewelryNBT.item(stack).getItem() instanceof ItemFood)
list.add(EnumChatFormatting.DARK_PURPLE
- + StatCollector.translateToLocal(
- "item." + Variables.MODID
- + ".goldObject.info.food"));
+ + StatCollector.translateToLocal("item." + Variables.MODID + ".goldObject.info.food"));
else
list.add(EnumChatFormatting.DARK_PURPLE
- + StatCollector.translateToLocal(
- "item." + Variables.MODID
- + ".goldObject.info.standard"));
+ + StatCollector.translateToLocal("item." + Variables.MODID + ".goldObject.info.standard"));
}
}
diff --git a/src/main/java/darkknight/jewelrycraft/item/ItemGuide.java b/src/main/java/darkknight/jewelrycraft/item/ItemGuide.java index 83f8531..04cb5c1 100755 --- a/src/main/java/darkknight/jewelrycraft/item/ItemGuide.java +++ b/src/main/java/darkknight/jewelrycraft/item/ItemGuide.java @@ -13,11 +13,9 @@ public class ItemGuide extends Item { }
@Override
- public ItemStack onItemRightClick(ItemStack stack, World world,
- EntityPlayer player) {
+ public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
if (world.isRemote)
- player.openGui(JewelrycraftMod.instance, 1,
- player.worldObj, 0, 0, 0);
+ player.openGui(JewelrycraftMod.instance, 1, player.worldObj, 0, 0, 0);
player.addStat(AchievementsList.openGuide, 1);
return stack;
}
diff --git a/src/main/java/darkknight/jewelrycraft/item/ItemJewelryModifier.java b/src/main/java/darkknight/jewelrycraft/item/ItemJewelryModifier.java index 481126f..78adc6c 100755 --- a/src/main/java/darkknight/jewelrycraft/item/ItemJewelryModifier.java +++ b/src/main/java/darkknight/jewelrycraft/item/ItemJewelryModifier.java @@ -15,17 +15,14 @@ public class ItemJewelryModifier extends Item { }
@Override
- public ItemStack onItemRightClick(ItemStack stack, World world,
- EntityPlayer player) {
+ public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
if (!world.isRemote && player.capabilities.isCreativeMode)
- player.openGui(JewelrycraftMod.instance, 3, world,
- 0, 0, 0);
+ player.openGui(JewelrycraftMod.instance, 3, world, 0, 0, 0);
return stack;
}
@Override
- public void addInformation(ItemStack stack, EntityPlayer player,
- List list, boolean par4) {
+ public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) {
list.add(EnumChatFormatting.GRAY + "Creative Only");
}
}
\ No newline at end of file diff --git a/src/main/java/darkknight/jewelrycraft/item/ItemList.java b/src/main/java/darkknight/jewelrycraft/item/ItemList.java index 63bc7a4..869c944 100755 --- a/src/main/java/darkknight/jewelrycraft/item/ItemList.java +++ b/src/main/java/darkknight/jewelrycraft/item/ItemList.java @@ -9,103 +9,55 @@ import net.minecraft.item.ItemStack; import net.minecraftforge.oredict.OreDictionary;
public class ItemList {
- public static Item thiefGloves;
- public static Item shadowIngot;
- public static Item molds;
- public static Item clayMolds;
- public static ItemRing ring;
- public static ItemNecklace necklace;
- public static ItemBracelet bracelet;
- public static ItemEarrings earrings;
- public static Item guide;
- public static Item jewelryModifier;
- public static ItemMoltenMetalBucket bucket;
- public static ItemMoltenMetal metal;
- public static Item goldObj;
- public static Item structureGen;
- public static Item spawnEgg;
- public static Item testItem;
+ public static Item thiefGloves;
+ public static Item shadowIngot;
+ public static Item molds;
+ public static Item clayMolds;
+ public static ItemRing ring;
+ public static ItemNecklace necklace;
+ public static ItemBracelet bracelet;
+ public static ItemEarrings earrings;
+ public static Item guide;
+ public static Item jewelryModifier;
+ public static ItemMoltenMetalBucket bucket;
+ public static ItemMoltenMetal metal;
+ public static Item goldObj;
+ public static Item structureGen;
+ public static Item spawnEgg;
+ public static Item testItem;
/**
* @param e
*/
public static void preInit(FMLPreInitializationEvent e) {
- thiefGloves = new ItemThiefGloves()
- .setUnlocalizedName(Variables.MODID
- + ".thiefGloves")
- .setTextureName(Variables.MODID
- + ":thiefGloves")
+ thiefGloves = new ItemThiefGloves().setUnlocalizedName(Variables.MODID + ".thiefGloves")
+ .setTextureName(Variables.MODID + ":thiefGloves").setCreativeTab(JewelrycraftMod.jewelrycraft);
+ shadowIngot = new Item().setUnlocalizedName(Variables.MODID + ".ingotShadow")
+ .setTextureName(Variables.MODID + ":ingotShadow").setCreativeTab(JewelrycraftMod.jewelrycraft);
+ molds = new ItemMolds().setUnlocalizedName(Variables.MODID + ".mold").setTextureName("Mold")
.setCreativeTab(JewelrycraftMod.jewelrycraft);
- shadowIngot = new Item()
- .setUnlocalizedName(Variables.MODID
- + ".ingotShadow")
- .setTextureName(Variables.MODID
- + ":ingotShadow")
+ clayMolds = new ItemClayMolds().setUnlocalizedName(Variables.MODID + ".mold").setTextureName("Mold")
.setCreativeTab(JewelrycraftMod.jewelrycraft);
- molds = new ItemMolds()
- .setUnlocalizedName(
- Variables.MODID + ".mold")
- .setTextureName("Mold")
- .setCreativeTab(JewelrycraftMod.jewelrycraft);
- clayMolds = new ItemClayMolds()
- .setUnlocalizedName(
- Variables.MODID + ".mold")
- .setTextureName("Mold")
- .setCreativeTab(JewelrycraftMod.jewelrycraft);
- ring = (ItemRing) new ItemRing()
- .setUnlocalizedName(
- Variables.MODID + ".ring")
- .setTextureName(Variables.MODID + ":ring")
- .setCreativeTab(JewelrycraftMod.jewelrycraft);
- necklace = (ItemNecklace) new ItemNecklace()
- .setUnlocalizedName(Variables.MODID
- + ".necklace")
- .setTextureName(Variables.MODID
- + ":necklace")
- .setCreativeTab(JewelrycraftMod.jewelrycraft);
- bracelet = (ItemBracelet) new ItemBracelet()
- .setUnlocalizedName(Variables.MODID
- + ".bracelet")
- .setTextureName(Variables.MODID
- + ":bracelet")
- .setCreativeTab(JewelrycraftMod.jewelrycraft);
- earrings = (ItemEarrings) new ItemEarrings()
- .setUnlocalizedName(Variables.MODID
- + ".earrings")
- .setTextureName(Variables.MODID
- + ":earrings")
- .setCreativeTab(JewelrycraftMod.jewelrycraft);
- guide = new ItemGuide()
- .setUnlocalizedName(
- Variables.MODID + ".guide")
- .setTextureName(Variables.MODID + ":guide")
- .setCreativeTab(JewelrycraftMod.jewelrycraft);
- bucket = (ItemMoltenMetalBucket) new ItemMoltenMetalBucket()
- .setUnlocalizedName(Variables.MODID
- + ".bucket");
- metal = (ItemMoltenMetal) new ItemMoltenMetal()
- .setUnlocalizedName(Variables.MODID
- + ".bucket");
- jewelryModifier = new ItemJewelryModifier()
- .setUnlocalizedName(Variables.MODID
- + ".jewelryModifier")
- .setTextureName(Variables.MODID
- + ":jewelryModifier")
- .setCreativeTab(JewelrycraftMod.jewelrycraft);
- goldObj = new ItemGoldObj().setUnlocalizedName(
- Variables.MODID + ".goldObject");
- structureGen = new ItemStructureGen()
- .setUnlocalizedName(Variables.MODID
- + ".structureGen")
- .setTextureName(Variables.MODID
- + ":structureGen")
- .setCreativeTab(JewelrycraftMod.jewelrycraft);
- spawnEgg = new ItemSpawnEgg()
- .setUnlocalizedName(Variables.MODID
- + ".monsterPlacer")
+ ring = (ItemRing) new ItemRing().setUnlocalizedName(Variables.MODID + ".ring")
+ .setTextureName(Variables.MODID + ":ring").setCreativeTab(JewelrycraftMod.jewelrycraft);
+ necklace = (ItemNecklace) new ItemNecklace().setUnlocalizedName(Variables.MODID + ".necklace")
+ .setTextureName(Variables.MODID + ":necklace").setCreativeTab(JewelrycraftMod.jewelrycraft);
+ bracelet = (ItemBracelet) new ItemBracelet().setUnlocalizedName(Variables.MODID + ".bracelet")
+ .setTextureName(Variables.MODID + ":bracelet").setCreativeTab(JewelrycraftMod.jewelrycraft);
+ earrings = (ItemEarrings) new ItemEarrings().setUnlocalizedName(Variables.MODID + ".earrings")
+ .setTextureName(Variables.MODID + ":earrings").setCreativeTab(JewelrycraftMod.jewelrycraft);
+ guide = new ItemGuide().setUnlocalizedName(Variables.MODID + ".guide")
+ .setTextureName(Variables.MODID + ":guide").setCreativeTab(JewelrycraftMod.jewelrycraft);
+ bucket = (ItemMoltenMetalBucket) new ItemMoltenMetalBucket().setUnlocalizedName(Variables.MODID + ".bucket");
+ metal = (ItemMoltenMetal) new ItemMoltenMetal().setUnlocalizedName(Variables.MODID + ".bucket");
+ jewelryModifier = new ItemJewelryModifier().setUnlocalizedName(Variables.MODID + ".jewelryModifier")
+ .setTextureName(Variables.MODID + ":jewelryModifier").setCreativeTab(JewelrycraftMod.jewelrycraft);
+ goldObj = new ItemGoldObj().setUnlocalizedName(Variables.MODID + ".goldObject");
+ structureGen = new ItemStructureGen().setUnlocalizedName(Variables.MODID + ".structureGen")
+ .setTextureName(Variables.MODID + ":structureGen").setCreativeTab(JewelrycraftMod.jewelrycraft);
+ spawnEgg = new ItemSpawnEgg().setUnlocalizedName(Variables.MODID + ".monsterPlacer")
.setTextureName("spawn_egg");
- testItem = new ItemTest().setUnlocalizedName(
- Variables.MODID + ".test");
+ testItem = new ItemTest().setUnlocalizedName(Variables.MODID + ".test");
GameRegistry.registerItem(thiefGloves, "thiefGloves");
GameRegistry.registerItem(shadowIngot, "shadowIngot");
@@ -118,14 +70,12 @@ public class ItemList { GameRegistry.registerItem(guide, "guide");
GameRegistry.registerItem(bucket, "moltenMetalBucket");
GameRegistry.registerItem(metal, "moltenMetal");
- GameRegistry.registerItem(jewelryModifier,
- "jewelryModifier");
+ GameRegistry.registerItem(jewelryModifier, "jewelryModifier");
GameRegistry.registerItem(goldObj, "goldObject");
GameRegistry.registerItem(structureGen, "structureGen");
GameRegistry.registerItem(spawnEgg, "spawnEgg");
GameRegistry.registerItem(testItem, "testItem");
- OreDictionary.registerOre("ingotShadow",
- new ItemStack(ItemList.shadowIngot));
+ OreDictionary.registerOre("ingotShadow", new ItemStack(ItemList.shadowIngot));
}
}
diff --git a/src/main/java/darkknight/jewelrycraft/item/ItemMolds.java b/src/main/java/darkknight/jewelrycraft/item/ItemMolds.java index b2acd18..41b5b5a 100755 --- a/src/main/java/darkknight/jewelrycraft/item/ItemMolds.java +++ b/src/main/java/darkknight/jewelrycraft/item/ItemMolds.java @@ -14,11 +14,9 @@ import net.minecraft.util.MathHelper; public class ItemMolds extends Item {
/** List of molds color names */
- public static final String[] moldsItemNames = new String[] {
- "ingot", "ring", "necklace", "bracelet", "earrings"
- };
+ public static final String[] moldsItemNames = new String[] { "ingot", "ring", "necklace", "bracelet", "earrings" };
@SideOnly(Side.CLIENT)
- private IIcon[] moldsIcons;
+ private IIcon[] moldsIcons;
/**
*
@@ -40,25 +38,21 @@ public class ItemMolds extends Item { * Gets an icon index based on an item's damage value
*/
public IIcon getIconFromDamage(int par1) {
- int j = MathHelper.clamp_int(par1, 0,
- moldsItemNames.length - 1);
+ int j = MathHelper.clamp_int(par1, 0, moldsItemNames.length - 1);
return moldsIcons[j];
}
/**
- * Returns the unlocalized name of this item. This version accepts
- * an ItemStack so different stacks can have different names based
- * on their damage or NBT.
+ * Returns the unlocalized name of this item. This version accepts an ItemStack
+ * so different stacks can have different names based on their damage or NBT.
*
* @param par1ItemStack
* @return
*/
@Override
public String getUnlocalizedName(ItemStack par1ItemStack) {
- int i = MathHelper.clamp_int(par1ItemStack.getItemDamage(),
- 0, moldsItemNames.length - 1);
- return super.getUnlocalizedName() + "."
- + moldsItemNames[i];
+ int i = MathHelper.clamp_int(par1ItemStack.getItemDamage(), 0, moldsItemNames.length - 1);
+ return super.getUnlocalizedName() + "." + moldsItemNames[i];
}
/**
@@ -69,11 +63,10 @@ public class ItemMolds extends Item { @Override
@SideOnly(Side.CLIENT)
/**
- * returns a list of items with the same ID, but different meta
- * (eg: molds returns 16 items)
+ * returns a list of items with the same ID, but different meta (eg: molds
+ * returns 16 items)
*/
- public void getSubItems(Item par1, CreativeTabs par2CreativeTabs,
- List par3List) {
+ public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List par3List) {
for (int j = 0; j < moldsItemNames.length; ++j)
par3List.add(new ItemStack(par1, 1, j));
}
@@ -86,9 +79,6 @@ public class ItemMolds extends Item { public void registerIcons(IIconRegister par1IconRegister) {
moldsIcons = new IIcon[moldsItemNames.length];
for (int i = 0; i < moldsItemNames.length; ++i)
- moldsIcons[i] = par1IconRegister
- .registerIcon(Variables.MODID + ":"
- + moldsItemNames[i]
- + getIconString());
+ moldsIcons[i] = par1IconRegister.registerIcon(Variables.MODID + ":" + moldsItemNames[i] + getIconString());
}
}
diff --git a/src/main/java/darkknight/jewelrycraft/item/ItemMoltenMetal.java b/src/main/java/darkknight/jewelrycraft/item/ItemMoltenMetal.java index 9b5b8a3..2961a79 100755 --- a/src/main/java/darkknight/jewelrycraft/item/ItemMoltenMetal.java +++ b/src/main/java/darkknight/jewelrycraft/item/ItemMoltenMetal.java @@ -23,8 +23,7 @@ public class ItemMoltenMetal extends Item { */
@Override
public void registerIcons(IIconRegister iconRegister) {
- itemIcon = iconRegister.registerIcon(
- Variables.MODID + ":moltenMetalStill");
+ itemIcon = iconRegister.registerIcon(Variables.MODID + ":moltenMetalStill");
}
/**
@@ -36,8 +35,7 @@ public class ItemMoltenMetal extends Item { @SideOnly(Side.CLIENT)
public int getColorFromItemStack(ItemStack stack, int pass) {
if (JewelryNBT.ingot(stack) != null)
- return JewelrycraftUtil
- .getColor(JewelryNBT.ingot(stack));
+ return JewelrycraftUtil.getColor(JewelryNBT.ingot(stack));
else
return 0xFFFFFF;
}
diff --git a/src/main/java/darkknight/jewelrycraft/item/ItemMoltenMetalBucket.java b/src/main/java/darkknight/jewelrycraft/item/ItemMoltenMetalBucket.java index 72f1228..f9b915b 100755 --- a/src/main/java/darkknight/jewelrycraft/item/ItemMoltenMetalBucket.java +++ b/src/main/java/darkknight/jewelrycraft/item/ItemMoltenMetalBucket.java @@ -31,17 +31,14 @@ public class ItemMoltenMetalBucket extends Item { }
@Override
- public ItemStack onItemRightClick(ItemStack stack, World par2World,
- EntityPlayer par3EntityPlayer) {
+ public ItemStack onItemRightClick(ItemStack stack, World par2World, EntityPlayer par3EntityPlayer) {
boolean flag = BlockList.moltenMetal == Blocks.air;
- MovingObjectPosition movingobjectposition = getMovingObjectPositionFromPlayer(
- par2World, par3EntityPlayer, flag);
+ MovingObjectPosition movingobjectposition = getMovingObjectPositionFromPlayer(par2World, par3EntityPlayer,
+ flag);
if (movingobjectposition == null)
return stack;
else {
- FillBucketEvent event = new FillBucketEvent(
- par3EntityPlayer, stack, par2World,
- movingobjectposition);
+ FillBucketEvent event = new FillBucketEvent(par3EntityPlayer, stack, par2World, movingobjectposition);
if (MinecraftForge.EVENT_BUS.post(event))
return stack;
if (event.getResult() == Event.Result.ALLOW) {
@@ -49,41 +46,26 @@ public class ItemMoltenMetalBucket extends Item { return stack;
if (--stack.stackSize <= 0)
return event.result;
- if (!par3EntityPlayer.inventory
- .addItemStackToInventory(
- event.result))
- par3EntityPlayer.dropPlayerItemWithRandomChoice(
- event.result,
- false);
+ if (!par3EntityPlayer.inventory.addItemStackToInventory(event.result))
+ par3EntityPlayer.dropPlayerItemWithRandomChoice(event.result, false);
return stack;
}
if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
int i = movingobjectposition.blockX;
int j = movingobjectposition.blockY;
int k = movingobjectposition.blockZ;
- if (!par2World.canMineBlock(
- par3EntityPlayer, i, j, k))
+ if (!par2World.canMineBlock(par3EntityPlayer, i, j, k))
return stack;
if (flag) {
- if (!par3EntityPlayer
- .canPlayerEdit(i,
- j,
- k,
- movingobjectposition.sideHit,
- stack))
+ if (!par3EntityPlayer.canPlayerEdit(i, j, k, movingobjectposition.sideHit, stack))
return stack;
- par2World.getBlock(i, j, k)
- .getMaterial();
- par2World.getBlockMetadata(i, j,
- k);
+ par2World.getBlock(i, j, k).getMaterial();
+ par2World.getBlockMetadata(i, j, k);
par2World.setBlockToAir(i, j, k);
- return func_150910_a(stack,
- par3EntityPlayer,
- ItemList.bucket);
+ return func_150910_a(stack, par3EntityPlayer, ItemList.bucket);
} else {
if (BlockList.moltenMetal == Blocks.air)
- return new ItemStack(
- Items.bucket);
+ return new ItemStack(Items.bucket);
if (movingobjectposition.sideHit == 0)
--j;
else if (movingobjectposition.sideHit == 1)
@@ -96,66 +78,44 @@ public class ItemMoltenMetalBucket extends Item { --i;
else if (movingobjectposition.sideHit == 5)
++i;
- if (!par3EntityPlayer
- .canPlayerEdit(i,
- j,
- k,
- movingobjectposition.sideHit,
- stack))
+ if (!par3EntityPlayer.canPlayerEdit(i, j, k, movingobjectposition.sideHit, stack))
return stack;
- if (tryPlaceContainedLiquid(
- par2World, i, j, k,
- stack)
+ if (tryPlaceContainedLiquid(par2World, i, j, k, stack)
&& !par3EntityPlayer.capabilities.isCreativeMode)
- return new ItemStack(
- Items.bucket);
+ return new ItemStack(Items.bucket);
}
}
return stack;
}
}
- private ItemStack func_150910_a(ItemStack p_150910_1_,
- EntityPlayer p_150910_2_, Item p_150910_3_) {
+ private ItemStack func_150910_a(ItemStack p_150910_1_, EntityPlayer p_150910_2_, Item p_150910_3_) {
if (p_150910_2_.capabilities.isCreativeMode)
return p_150910_1_;
else if (--p_150910_1_.stackSize <= 0)
return new ItemStack(p_150910_3_);
else {
- if (!p_150910_2_.inventory.addItemStackToInventory(
- new ItemStack(p_150910_3_)))
- p_150910_2_.dropPlayerItemWithRandomChoice(
- new ItemStack(p_150910_3_,
- 1, 0),
- false);
+ if (!p_150910_2_.inventory.addItemStackToInventory(new ItemStack(p_150910_3_)))
+ p_150910_2_.dropPlayerItemWithRandomChoice(new ItemStack(p_150910_3_, 1, 0), false);
return p_150910_1_;
}
}
- public static boolean tryPlaceContainedLiquid(World world, int x,
- int y, int z, ItemStack stack) {
+ public static boolean tryPlaceContainedLiquid(World world, int x, int y, int z, ItemStack stack) {
if (BlockList.moltenMetal == Blocks.air)
return false;
else {
- Material material = world.getBlock(x, y, z)
- .getMaterial();
+ Material material = world.getBlock(x, y, z).getMaterial();
boolean flag = !material.isSolid();
if (!world.isAirBlock(x, y, z) && !flag)
return false;
- else if (stack != null && JewelryNBT
- .ingot(stack) != null) {
- if (!world.isRemote && flag
- && !material.isLiquid())
+ else if (stack != null && JewelryNBT.ingot(stack) != null) {
+ if (!world.isRemote && flag && !material.isLiquid())
world.func_147480_a(x, y, z, true);
- world.setBlock(x, y, z,
- BlockList.moltenMetal, 0,
- 3);
- TileEntity moltenLiquid = world
- .getTileEntity(x, y, z);
+ world.setBlock(x, y, z, BlockList.moltenMetal, 0, 3);
+ TileEntity moltenLiquid = world.getTileEntity(x, y, z);
if (moltenLiquid instanceof TileEntityMoltenMetal)
- ((TileEntityMoltenMetal) moltenLiquid)
- .setMetal(JewelryNBT
- .ingot(stack));
+ ((TileEntityMoltenMetal) moltenLiquid).setMetal(JewelryNBT.ingot(stack));
return true;
} else
return false;
@@ -165,16 +125,14 @@ public class ItemMoltenMetalBucket extends Item { @Override
public void registerIcons(IIconRegister iconRegister) {
itemIcon = iconRegister.registerIcon("bucket_empty");
- liquid = iconRegister.registerIcon(
- Variables.MODID + ":bucketOverlay");
+ liquid = iconRegister.registerIcon(Variables.MODID + ":bucketOverlay");
}
@Override
@SideOnly(Side.CLIENT)
public int getColorFromItemStack(ItemStack stack, int pass) {
if (pass == 1 && JewelryNBT.ingot(stack) != null)
- return JewelrycraftUtil
- .getColor(JewelryNBT.ingot(stack));
+ return JewelrycraftUtil.getColor(JewelryNBT.ingot(stack));
return 16777215;
}
@@ -204,29 +162,15 @@ public class ItemMoltenMetalBucket extends Item { if (JewelryNBT.ingot(stack) != null) {
ItemStack ingot = JewelryNBT.ingot(stack);
if (ingot != null) {
- return StatCollector
- .translateToLocal(
- getUnlocalizedNameInefficiently(
- stack)
- + ".name")
- .trim()
- + " "
- + ingot.getDisplayName()
- .replace("Ingot",
- " ")
- .trim();
+ return StatCollector.translateToLocal(getUnlocalizedNameInefficiently(stack) + ".name").trim() + " "
+ + ingot.getDisplayName().replace("Ingot", " ").trim();
} else
- return StatCollector
- .translateToLocal(
- "bucket.unknown");
+ return StatCollector.translateToLocal("bucket.unknown");
}
} catch (Exception e) {
System.out.println("Error: " + e);
}
- return ("" + StatCollector.translateToLocal(
- getUnlocalizedNameInefficiently(stack)
- + ".name")).trim()
- + " " + StatCollector.translateToLocal(
- "info.jewelrycraft2.metal");
+ return ("" + StatCollector.translateToLocal(getUnlocalizedNameInefficiently(stack) + ".name")).trim() + " "
+ + StatCollector.translateToLocal("info.jewelrycraft2.metal");
}
}
diff --git a/src/main/java/darkknight/jewelrycraft/item/ItemNecklace.java b/src/main/java/darkknight/jewelrycraft/item/ItemNecklace.java index 3a71d0b..8f67ab6 100755 --- a/src/main/java/darkknight/jewelrycraft/item/ItemNecklace.java +++ b/src/main/java/darkknight/jewelrycraft/item/ItemNecklace.java @@ -20,10 +20,8 @@ public class ItemNecklace extends ItemBaseJewelry { */
@Override
public void registerIcons(IIconRegister iconRegister) {
- itemIcon = iconRegister.registerIcon(
- Variables.MODID + ":necklace");
- gem = iconRegister.registerIcon(
- Variables.MODID + ":jewelNecklace");
+ itemIcon = iconRegister.registerIcon(Variables.MODID + ":necklace");
+ gem = iconRegister.registerIcon(Variables.MODID + ":jewelNecklace");
}
/**
diff --git a/src/main/java/darkknight/jewelrycraft/item/ItemRing.java b/src/main/java/darkknight/jewelrycraft/item/ItemRing.java index 4df83d0..87ca8d8 100755 --- a/src/main/java/darkknight/jewelrycraft/item/ItemRing.java +++ b/src/main/java/darkknight/jewelrycraft/item/ItemRing.java @@ -20,10 +20,8 @@ public class ItemRing extends ItemBaseJewelry { */
@Override
public void registerIcons(IIconRegister iconRegister) {
- itemIcon = iconRegister
- .registerIcon(Variables.MODID + ":ring");
- gem = iconRegister.registerIcon(
- Variables.MODID + ":jewelRing");
+ itemIcon = iconRegister.registerIcon(Variables.MODID + ":ring");
+ gem = iconRegister.registerIcon(Variables.MODID + ":jewelRing");
}
/**
diff --git a/src/main/java/darkknight/jewelrycraft/item/ItemSpawnEgg.java b/src/main/java/darkknight/jewelrycraft/item/ItemSpawnEgg.java index bb57f9a..265e692 100755 --- a/src/main/java/darkknight/jewelrycraft/item/ItemSpawnEgg.java +++ b/src/main/java/darkknight/jewelrycraft/item/ItemSpawnEgg.java @@ -30,14 +30,9 @@ import net.minecraft.world.World; public class ItemSpawnEgg extends ItemMonsterPlacer {
private static final Map<Short, EggData> eggTypes = new LinkedHashMap<Short, EggData>();
- public static void registerSpawnEgg(
- Class<? extends EntityLiving> entity,
- String entityName, int id, int eggBackgroundColor,
- int eggForegroundColor) {
- eggTypes.put((short) id,
- new EggData(id, entityName, entity,
- eggBackgroundColor,
- eggForegroundColor));
+ public static void registerSpawnEgg(Class<? extends EntityLiving> entity, String entityName, int id,
+ int eggBackgroundColor, int eggForegroundColor) {
+ eggTypes.put((short) id, new EggData(id, entityName, entity, eggBackgroundColor, eggForegroundColor));
}
private static EggData getEggData(ItemStack is) {
@@ -51,23 +46,19 @@ public class ItemSpawnEgg extends ItemMonsterPlacer { @Override
public String getItemStackDisplayName(ItemStack is) {
- String s = StatCollector.translateToLocal(
- getUnlocalizedName() + ".name").trim();
+ String s = StatCollector.translateToLocal(getUnlocalizedName() + ".name").trim();
String mob = "";
EggData egg = getEggData(is);
if (egg != null)
- mob = StatCollector.translateToLocal("entity."
- + Variables.MODID + "."
- + egg.entityName + ".name");
+ mob = StatCollector.translateToLocal("entity." + Variables.MODID + "." + egg.entityName + ".name");
return String.format(s, mob);
}
@Override
- public boolean onItemUse(ItemStack is, EntityPlayer player,
- World world, int x, int y, int z, int side,
- float hitX, float hitY, float hitZ) {
+ public boolean onItemUse(ItemStack is, EntityPlayer player, World world, int x, int y, int z, int side, float hitX,
+ float hitY, float hitZ) {
if (world.isRemote)
return true;
@@ -78,11 +69,7 @@ public class ItemSpawnEgg extends ItemMonsterPlacer { EggData egg = getEggData(is);
if (egg != null) {
- egg.spawnMob(world, x + 0.5D, y + (side == 1
- && block != null
- && block.getRenderType() == 11
- ? 0.5D
- : 0D),
+ egg.spawnMob(world, x + 0.5D, y + (side == 1 && block != null && block.getRenderType() == 11 ? 0.5D : 0D),
z + 0.5D, is);
if (!player.capabilities.isCreativeMode)
@@ -93,24 +80,19 @@ public class ItemSpawnEgg extends ItemMonsterPlacer { }
@Override
- public ItemStack onItemRightClick(ItemStack is, World world,
- EntityPlayer player) {
+ public ItemStack onItemRightClick(ItemStack is, World world, EntityPlayer player) {
if (world.isRemote)
return is;
- MovingObjectPosition mop = getMovingObjectPositionFromPlayer(
- world, player, true);
+ MovingObjectPosition mop = getMovingObjectPositionFromPlayer(world, player, true);
if (mop != null && mop.typeOfHit == MovingObjectType.BLOCK) {
int x = mop.blockX, y = mop.blockY, z = mop.blockZ;
- if (!world.canMineBlock(player, x, y, z)
- || !player.canPlayerEdit(x, y, z,
- mop.sideHit, is))
+ if (!world.canMineBlock(player, x, y, z) || !player.canPlayerEdit(x, y, z, mop.sideHit, is))
return is;
- if (world.getBlock(x, y, z)
- .getMaterial() == Material.water) {
+ if (world.getBlock(x, y, z).getMaterial() == Material.water) {
EggData egg = getEggData(is);
if (egg != null) {
egg.spawnMob(world, x, y, z, is);
@@ -124,8 +106,7 @@ public class ItemSpawnEgg extends ItemMonsterPlacer { return is;
}
- public static EntityLiving getEntity(World world, double x,
- double y, double z, ItemStack is) {
+ public static EntityLiving getEntity(World world, double x, double y, double z, ItemStack is) {
EggData egg = getEggData(is);
return egg.spawnMob(world, x, y, z, is);
}
@@ -134,10 +115,7 @@ public class ItemSpawnEgg extends ItemMonsterPlacer { @SideOnly(Side.CLIENT)
public int getColorFromItemStack(ItemStack is, int pass) {
EggData egg = getEggData(is);
- return egg != null
- ? pass == 0 ? egg.primaryColor
- : egg.secondaryColor
- : 16777215;
+ return egg != null ? pass == 0 ? egg.primaryColor : egg.secondaryColor : 16777215;
}
@Override
@@ -148,28 +126,20 @@ public class ItemSpawnEgg extends ItemMonsterPlacer { }
static class EggData {
- private final short id;
- String entityName;
- private final Class<? extends EntityLiving> entityClass;
- int primaryColor;
- int secondaryColor;
-
- EggData(int id, String entityName,
- Class<? extends EntityLiving> entityClass,
- int[] rgbPrimaryColor,
+ private final short id;
+ String entityName;
+ private final Class<? extends EntityLiving> entityClass;
+ int primaryColor;
+ int secondaryColor;
+
+ EggData(int id, String entityName, Class<? extends EntityLiving> entityClass, int[] rgbPrimaryColor,
int[] rgbSecondaryColor) {
- this(id, entityName, entityClass,
- rgbPrimaryColor[0] << 16
- | rgbPrimaryColor[1] << 8
- | rgbPrimaryColor[2],
- rgbSecondaryColor[0] << 16
- | rgbSecondaryColor[1] << 8
- | rgbSecondaryColor[2]);
+ this(id, entityName, entityClass, rgbPrimaryColor[0] << 16 | rgbPrimaryColor[1] << 8 | rgbPrimaryColor[2],
+ rgbSecondaryColor[0] << 16 | rgbSecondaryColor[1] << 8 | rgbSecondaryColor[2]);
}
- EggData(int id, String entityName,
- Class<? extends EntityLiving> entityClass,
- int primaryColor, int secondaryColor) {
+ EggData(int id, String entityName, Class<? extends EntityLiving> entityClass, int primaryColor,
+ int secondaryColor) {
this.id = (short) id;
this.entityName = entityName;
this.entityClass = entityClass;
@@ -177,13 +147,11 @@ public class ItemSpawnEgg extends ItemMonsterPlacer { this.secondaryColor = secondaryColor;
}
- public EntityLiving spawnMob(World world, double x,
- double y, double z, ItemStack is) {
+ public EntityLiving spawnMob(World world, double x, double y, double z, ItemStack is) {
EntityLiving e = null;
try {
- e = entityClass.getConstructor(World.class)
- .newInstance(world);
+ e = entityClass.getConstructor(World.class).newInstance(world);
} catch (Exception ex) {
ex.printStackTrace();
return null;
@@ -208,11 +176,7 @@ public class ItemSpawnEgg extends ItemMonsterPlacer { else
((EntityHeart) e).setType("Red");
}
- e.setLocationAndAngles(x, y, z, MathHelper
- .wrapAngleTo180_float(world.rand
- .nextFloat()
- * 360F),
- 0F);
+ e.setLocationAndAngles(x, y, z, MathHelper.wrapAngleTo180_float(world.rand.nextFloat() * 360F), 0F);
e.rotationYawHead = e.rotationYaw;
e.renderYawOffset = e.rotationYaw;
e.onSpawnWithEgg((IEntityLivingData) null);
diff --git a/src/main/java/darkknight/jewelrycraft/item/ItemStructureGen.java b/src/main/java/darkknight/jewelrycraft/item/ItemStructureGen.java index a929430..e06b3f4 100755 --- a/src/main/java/darkknight/jewelrycraft/item/ItemStructureGen.java +++ b/src/main/java/darkknight/jewelrycraft/item/ItemStructureGen.java @@ -18,13 +18,10 @@ public class ItemStructureGen extends Item { }
@Override
- public ItemStack onItemRightClick(ItemStack stack, World world,
- EntityPlayer player) {
- if (!world.isRemote
- && player.capabilities.isCreativeMode) {
+ public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
+ if (!world.isRemote && player.capabilities.isCreativeMode) {
if (!player.isSneaking()) {
- if (no < JewelrycraftUtil.structures.size()
- - 1)
+ if (no < JewelrycraftUtil.structures.size() - 1)
no++;
else
no = 0;
@@ -32,29 +29,24 @@ public class ItemStructureGen extends Item { if (no > 0)
no--;
else
- no = JewelrycraftUtil.structures
- .size() - 1;
+ no = JewelrycraftUtil.structures.size() - 1;
}
- player.addChatMessage(new ChatComponentText(
- "Structure no. " + (no + 1)));
+ player.addChatMessage(new ChatComponentText("Structure no. " + (no + 1)));
}
return stack;
}
@Override
- public boolean onItemUse(ItemStack stack, EntityPlayer player,
- World world, int x, int y, int z, int par1,
+ public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int par1,
float par2, float par3, float par4) {
if (player.capabilities.isCreativeMode)
- JewelrycraftUtil.structures.get(no).generate(world,
- world.getBiomeGenForCoords(x, z),
- itemRand, x, y + 1, z);
+ JewelrycraftUtil.structures.get(no).generate(world, world.getBiomeGenForCoords(x, z), itemRand, x, y + 1,
+ z);
return true;
}
@Override
- public void addInformation(ItemStack stack, EntityPlayer player,
- List list, boolean par4) {
+ public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) {
list.add(EnumChatFormatting.GRAY + "Creative Only");
}
}
\ No newline at end of file diff --git a/src/main/java/darkknight/jewelrycraft/item/ItemTest.java b/src/main/java/darkknight/jewelrycraft/item/ItemTest.java index 312c38c..69d0554 100755 --- a/src/main/java/darkknight/jewelrycraft/item/ItemTest.java +++ b/src/main/java/darkknight/jewelrycraft/item/ItemTest.java @@ -21,8 +21,8 @@ import net.minecraft.world.World; public class ItemTest extends Item {
@SideOnly(Side.CLIENT)
- private IIcon[] icons;
- private NBTTagCompound nbt = new NBTTagCompound();
+ private IIcon[] icons;
+ private NBTTagCompound nbt = new NBTTagCompound();
public ItemTest() {
super();
@@ -32,14 +32,12 @@ public class ItemTest extends Item { @Override
@SideOnly(Side.CLIENT)
public IIcon getIconFromDamage(int damage) {
- int j = MathHelper.clamp_int(damage, 0,
- Curse.getCurseList().size() - 1);
+ int j = MathHelper.clamp_int(damage, 0, Curse.getCurseList().size() - 1);
return icons[j];
}
@Override
- public void getSubItems(Item par1, CreativeTabs par2CreativeTabs,
- List par3List) {
+ public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List par3List) {
for (int j = 0; j < Curse.getCurseList().size(); ++j)
par3List.add(new ItemStack(par1, 1, j));
}
@@ -48,16 +46,12 @@ public class ItemTest extends Item { public void registerIcons(IIconRegister par1IconRegister) {
icons = new IIcon[Curse.getCurseList().size()];
for (int i = 0; i < Curse.getCurseList().size(); ++i)
- icons[i] = par1IconRegister
- .registerIcon(Variables.MODID + ":"
- + "testItem_" + i);
+ icons[i] = par1IconRegister.registerIcon(Variables.MODID + ":" + "testItem_" + i);
}
@Override
- public ItemStack onItemRightClick(ItemStack stack, World world,
- EntityPlayer player) {
- MovingObjectPosition mop = getMovingObjectPositionFromPlayer(
- world, player, true);
+ public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
+ MovingObjectPosition mop = getMovingObjectPositionFromPlayer(world, player, true);
if (mop != null && mop.typeOfHit == MovingObjectType.BLOCK) {
int x = mop.blockX, y = mop.blockY, z = mop.blockZ;
TileEntity tile = world.getTileEntity(x, y, z);
@@ -67,8 +61,7 @@ public class ItemTest extends Item { else {
NBTTagCompound block = new NBTTagCompound();
tile.writeToNBT(block);
- nbt.setString("id", block
- .getString("id"));
+ nbt.setString("id", block.getString("id"));
nbt.setInteger("x", tile.xCoord);
nbt.setInteger("y", tile.yCoord);
nbt.setInteger("z", tile.zCoord);
diff --git a/src/main/java/darkknight/jewelrycraft/item/ItemThiefGloves.java b/src/main/java/darkknight/jewelrycraft/item/ItemThiefGloves.java index 76d056d..abaefdf 100755 --- a/src/main/java/darkknight/jewelrycraft/item/ItemThiefGloves.java +++ b/src/main/java/darkknight/jewelrycraft/item/ItemThiefGloves.java @@ -43,37 +43,20 @@ public class ItemThiefGloves extends Item { * @return
*/
@Override
- public boolean itemInteractionForEntity(ItemStack stack,
- EntityPlayer player, EntityLivingBase entity) {
- String villagerString = StatCollector.translateToLocal(
- "info." + Variables.MODID + ".villager");
+ public boolean itemInteractionForEntity(ItemStack stack, EntityPlayer player, EntityLivingBase entity) {
+ String villagerString = StatCollector.translateToLocal("info." + Variables.MODID + ".villager");
if (entity instanceof EntityVillager) {
EntityVillager villager = (EntityVillager) entity;
- int wealth = (Integer) ReflectionHelper
- .getPrivateValue(
- EntityVillager.class,
- villager, "wealth",
- "field_70956_bz");
- MerchantRecipeList buyingList = (MerchantRecipeList) ReflectionHelper
- .getPrivateValue(
- EntityVillager.class,
- villager,
- "buyingList",
- "field_70963_i");
+ int wealth = (Integer) ReflectionHelper.getPrivateValue(EntityVillager.class, villager, "wealth",
+ "field_70956_bz");
+ MerchantRecipeList buyingList = (MerchantRecipeList) ReflectionHelper.getPrivateValue(EntityVillager.class,
+ villager, "buyingList", "field_70963_i");
int chance = 1;
- boolean areOtherVillagersAround = false,
- canTheySeeYou = false;
- AxisAlignedBB axisalignedbb = villager.boundingBox
- .expand(2.0D, 0.0D, 2.0D);
- List<?> entities = villager.worldObj
- .getEntitiesWithinAABBExcludingEntity(
- villager,
- axisalignedbb);
+ boolean areOtherVillagersAround = false, canTheySeeYou = false;
+ AxisAlignedBB axisalignedbb = villager.boundingBox.expand(2.0D, 0.0D, 2.0D);
+ List<?> entities = villager.worldObj.getEntitiesWithinAABBExcludingEntity(villager, axisalignedbb);
for (Object s : entities)
- if (s instanceof EntityVillager
- && ((EntityVillager) s)
- .canEntityBeSeen(
- player)) {
+ if (s instanceof EntityVillager && ((EntityVillager) s).canEntityBeSeen(player)) {
chance += 1;
canTheySeeYou = true;
areOtherVillagersAround = true;
@@ -87,179 +70,83 @@ public class ItemThiefGloves extends Item { int steal = rand.nextInt(chance);
if (steal == 0) {
villager.dropItem(Items.emerald, wealth);
- ReflectionHelper.setPrivateValue(
- EntityVillager.class,
- villager, 0, "wealth",
- "field_70956_bz");
+ ReflectionHelper.setPrivateValue(EntityVillager.class, villager, 0, "wealth", "field_70956_bz");
}
if (buyingList != null) {
- Iterator<?> iterator = buyingList
- .iterator();
+ Iterator<?> iterator = buyingList.iterator();
if (steal == 0) {
while (iterator.hasNext()) {
- MerchantRecipe recipe = (MerchantRecipe) iterator
- .next();
- int toolUses = (Integer) ReflectionHelper
- .getPrivateValue(
- MerchantRecipe.class,
- recipe,
- "toolUses",
- "field_77400_d");
+ MerchantRecipe recipe = (MerchantRecipe) iterator.next();
+ int toolUses = (Integer) ReflectionHelper.getPrivateValue(MerchantRecipe.class, recipe,
+ "toolUses", "field_77400_d");
int quantity;
- if (recipe.getItemToSell()
- .isStackable())
- quantity = recipe
- .getItemToSell().stackSize
- * (7 - toolUses);
+ if (recipe.getItemToSell().isStackable())
+ quantity = recipe.getItemToSell().stackSize * (7 - toolUses);
else
- quantity = recipe
- .getItemToSell().stackSize;
- ItemStack s = new ItemStack(
- recipe.getItemToSell()
- .getItem(),
- quantity,
- recipe.getItemToSell()
- .getItemDamage());
- s.setTagCompound(recipe
- .getItemToSell()
- .getTagCompound());
- if (player.inventory
- .addItemStackToInventory(
- s))
+ quantity = recipe.getItemToSell().stackSize;
+ ItemStack s = new ItemStack(recipe.getItemToSell().getItem(), quantity,
+ recipe.getItemToSell().getItemDamage());
+ s.setTagCompound(recipe.getItemToSell().getTagCompound());
+ if (player.inventory.addItemStackToInventory(s))
;
else
- villager.entityDropItem(
- s,
- 0);
+ villager.entityDropItem(s, 0);
if (!player.capabilities.isCreativeMode)
- JewelrycraftUtil.addCursePoints(
- player,
- 5);
+ JewelrycraftUtil.addCursePoints(player, 5);
player.addChatMessage(
- new ChatComponentText(
- villagerString + " #"
- + villager.getProfession()
- + ": "
- + StatCollector.translateToLocal(
- "chatmessage." + Variables.MODID
- + ".villager.confusion")
- + " "
- + s.getDisplayName()
- + "!"));
- stack.damageItem(1,
- player);
+ new ChatComponentText(villagerString + " #" + villager.getProfession() + ": "
+ + StatCollector.translateToLocal(
+ "chatmessage." + Variables.MODID + ".villager.confusion")
+ + " " + s.getDisplayName() + "!"));
+ stack.damageItem(1, player);
}
buyingList.clear();
- ReflectionHelper.setPrivateValue(
- EntityVillager.class,
- villager, 300,
- "timeUntilReset",
+ ReflectionHelper.setPrivateValue(EntityVillager.class, villager, 300, "timeUntilReset",
"field_70961_j");
- ReflectionHelper.setPrivateValue(
- EntityVillager.class,
- villager, true,
- "needsInitilization",
+ ReflectionHelper.setPrivateValue(EntityVillager.class, villager, true, "needsInitilization",
"field_70959_by");
- player.addChatMessage(
- new ChatComponentText(
- StatCollector.translateToLocal(
- "chatmessage." + Variables.MODID
- + ".whisper")
- + ": "));
- player.addChatMessage(
- new ChatComponentText(
- EnumChatFormatting.DARK_PURPLE
- + StatCollector.translateToLocal(
- "chatmessage." + Variables.MODID
- + ".stealSuccess1")));
- player.addChatMessage(
- new ChatComponentText(
- EnumChatFormatting.DARK_PURPLE
- + StatCollector.translateToLocal(
- "chatmessage." + Variables.MODID
- + ".stealSuccess2")));
- player.addChatMessage(
- new ChatComponentText(
- EnumChatFormatting.DARK_PURPLE
- + StatCollector.translateToLocal(
- "chatmessage." + Variables.MODID
- + ".stealSuccess3")));
+ player.addChatMessage(new ChatComponentText(
+ StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".whisper") + ": "));
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.DARK_PURPLE
+ + StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".stealSuccess1")));
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.DARK_PURPLE
+ + StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".stealSuccess2")));
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.DARK_PURPLE
+ + StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".stealSuccess3")));
} else {
stack.damageItem(1, player);
if (!player.capabilities.isCreativeMode)
- JewelrycraftUtil.addCursePoints(
- player,
- 25);
- if (player.isPotionActive(
- Potion.invisibility)) {
- player.addChatMessage(
- new ChatComponentText(
- villagerString + " #"
- + villager.getProfession()
- + " "
- + StatCollector.translateToLocal(
- "chatmessage." + Variables.MODID
- + ".steal.fail")));
+ JewelrycraftUtil.addCursePoints(player, 25);
+ if (player.isPotionActive(Potion.invisibility)) {
+ player.addChatMessage(new ChatComponentText(villagerString + " #" + villager.getProfession()
+ + " "
+ + StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".steal.fail")));
} else {
if (areOtherVillagersAround) {
if (!canTheySeeYou) {
- player.addChatMessage(
- new ChatComponentText(
- StatCollector.translateToLocal(
- "chatmessage." + Variables.MODID
- + ".steal.caught1")
- + " "
- + villagerString
- + " #"
- + villager.getProfession()
- + "."));
- player.addChatMessage(
- new ChatComponentText(
- villagerString + " #"
- + villager.getProfession()
- + " "
- + StatCollector.translateToLocal(
- "chatmessage." + Variables.MODID
- + ".steal2")));
+ player.addChatMessage(new ChatComponentText(StatCollector
+ .translateToLocal("chatmessage." + Variables.MODID + ".steal.caught1") + " "
+ + villagerString + " #" + villager.getProfession() + "."));
+ player.addChatMessage(new ChatComponentText(
+ villagerString + " #" + villager.getProfession() + " " + StatCollector
+ .translateToLocal("chatmessage." + Variables.MODID + ".steal2")));
return true;
} else {
- player.addChatMessage(
- new ChatComponentText(
- StatCollector.translateToLocal(
- "chatmessage." + Variables.MODID
- + ".steal.caught2")
- + " "
- + villagerString
- + " #"
- + villager.getProfession()
- + "."));
- player.addChatMessage(
- new ChatComponentText(
- villagerString + " #"
- + villager.getProfession()
- + " "
- + StatCollector.translateToLocal(
- "chatmessage." + Variables.MODID
- + ".steal2")));
+ player.addChatMessage(new ChatComponentText(StatCollector
+ .translateToLocal("chatmessage." + Variables.MODID + ".steal.caught2") + " "
+ + villagerString + " #" + villager.getProfession() + "."));
+ player.addChatMessage(new ChatComponentText(
+ villagerString + " #" + villager.getProfession() + " " + StatCollector
+ .translateToLocal("chatmessage." + Variables.MODID + ".steal2")));
return true;
}
} else {
- player.addChatMessage(
- new ChatComponentText(
- villagerString + " #"
- + villager.getProfession()
- + " "
- + StatCollector.translateToLocal(
- "chatmessage." + Variables.MODID
- + ".steal1")));
- player.addChatMessage(
- new ChatComponentText(
- villagerString + " #"
- + villager.getProfession()
- + " "
- + StatCollector.translateToLocal(
- "chatmessage." + Variables.MODID
- + ".steal2")));
+ player.addChatMessage(new ChatComponentText(villagerString + " #" + villager.getProfession()
+ + " "
+ + StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".steal1")));
+ player.addChatMessage(new ChatComponentText(villagerString + " #" + villager.getProfession()
+ + " "
+ + StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".steal2")));
return true;
}
}
@@ -267,8 +154,7 @@ public class ItemThiefGloves extends Item { }
return true;
} else
- return super.itemInteractionForEntity(stack,
- player, entity);
+ return super.itemInteractionForEntity(stack, player, entity);
}
/**
@@ -278,24 +164,16 @@ public class ItemThiefGloves extends Item { * @param par4
*/
@Override
- public void addInformation(ItemStack stack, EntityPlayer player,
- List list, boolean par4) {
+ public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) {
if (!shouldAddAdditionalInfo())
- list.add(EnumChatFormatting.GRAY
- + additionalInfoInstructions());
+ list.add(EnumChatFormatting.GRAY + additionalInfoInstructions());
else {
- list.add(EnumChatFormatting.GRAY + StatCollector
- .translateToLocal("item."
- + Variables.MODID
- + ".thievingGloves.info.1"));
- list.add(EnumChatFormatting.GRAY + StatCollector
- .translateToLocal("item."
- + Variables.MODID
- + ".thievingGloves.info.2"));
- list.add(EnumChatFormatting.GRAY + StatCollector
- .translateToLocal("item."
- + Variables.MODID
- + ".thievingGloves.info.3"));
+ list.add(EnumChatFormatting.GRAY
+ + StatCollector.translateToLocal("item." + Variables.MODID + ".thievingGloves.info.1"));
+ list.add(EnumChatFormatting.GRAY
+ + StatCollector.translateToLocal("item." + Variables.MODID + ".thievingGloves.info.2"));
+ list.add(EnumChatFormatting.GRAY
+ + StatCollector.translateToLocal("item." + Variables.MODID + ".thievingGloves.info.3"));
}
}
@@ -303,8 +181,7 @@ public class ItemThiefGloves extends Item { * @return
*/
public static boolean shouldAddAdditionalInfo() {
- if (FMLCommonHandler.instance()
- .getEffectiveSide() == Side.CLIENT)
+ if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT)
if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
return true;
return false;
@@ -314,9 +191,7 @@ public class ItemThiefGloves extends Item { * @return
*/
public static String additionalInfoInstructions() {
- String message = StatCollector.translateToLocal("item."
- + Variables.MODID
- + ".thievingGloves.info.extra");
+ String message = StatCollector.translateToLocal("item." + Variables.MODID + ".thievingGloves.info.extra");
return message;
}
}
diff --git a/src/main/java/darkknight/jewelrycraft/item/render/BraceletRender.java b/src/main/java/darkknight/jewelrycraft/item/render/BraceletRender.java index 2f1ba9e..65ab7e1 100755 --- a/src/main/java/darkknight/jewelrycraft/item/render/BraceletRender.java +++ b/src/main/java/darkknight/jewelrycraft/item/render/BraceletRender.java @@ -12,37 +12,28 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation;
public class BraceletRender extends TileEntitySpecialRenderer {
- public ModelBracelet bracelet = new ModelBracelet();
- ResourceLocation texture = new ResourceLocation(
- Variables.MODID, "textures/entities/Bracelet.png");
+ public ModelBracelet bracelet = new ModelBracelet();
+ ResourceLocation texture = new ResourceLocation(Variables.MODID, "textures/entities/Bracelet.png");
@Override
- public void renderTileEntityAt(TileEntity te, double x, double y,
- double z, float scale) {
+ public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale) {
}
- public void doRender(Entity entity, double x, double y, double z,
- float f, float g) {
+ public void doRender(Entity entity, double x, double y, double z, float f, float g) {
GL11.glPushMatrix();
Minecraft.getMinecraft().renderEngine.bindTexture(texture);
if ((float) z != -1)
- bracelet.render(entity, 0F, 0F, 0F, (float) z, f,
- 1.0F);
- if (Loader.isModLoaded(
- "alpaca") /*
- * && fiskfille.alpaca.
- * AlpacaAPI.
- * isAlpacaClient((
- * EntityPlayer)entity)
- */) {
+ bracelet.render(entity, 0F, 0F, 0F, (float) z, f, 1.0F);
+ if (Loader.isModLoaded("alpaca") /*
+ * && fiskfille.alpaca. AlpacaAPI. isAlpacaClient(( EntityPlayer)entity)
+ */) {
GL11.glTranslatef(1F, 0F, -9F);
GL11.glRotatef(25F, 1F, 0F, 0F);
GL11.glRotatef(-25F, 0F, 1F, 0F);
} else
GL11.glTranslatef(0F, 3F, 0F);
if ((float) x != -1)
- bracelet.render(entity, 0F, 0F, 0F, (float) x,
- (float) y, 1.0F);
+ bracelet.render(entity, 0F, 0F, 0F, (float) x, (float) y, 1.0F);
GL11.glPopMatrix();
}
}
\ No newline at end of file diff --git a/src/main/java/darkknight/jewelrycraft/item/render/EarringsRender.java b/src/main/java/darkknight/jewelrycraft/item/render/EarringsRender.java index c82f2e2..3ebc858 100755 --- a/src/main/java/darkknight/jewelrycraft/item/render/EarringsRender.java +++ b/src/main/java/darkknight/jewelrycraft/item/render/EarringsRender.java @@ -11,17 +11,14 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation;
public class EarringsRender extends TileEntitySpecialRenderer {
- ModelEarrings earrings = new ModelEarrings();
- ResourceLocation texture = new ResourceLocation(
- Variables.MODID, "textures/entities/Earrings.png");
+ ModelEarrings earrings = new ModelEarrings();
+ ResourceLocation texture = new ResourceLocation(Variables.MODID, "textures/entities/Earrings.png");
@Override
- public void renderTileEntityAt(TileEntity te, double x, double y,
- double z, float scale) {
+ public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale) {
}
- public void doRender(Entity entity, double x, double y, double z,
- float f, float g) {
+ public void doRender(Entity entity, double x, double y, double z, float f, float g) {
GL11.glPushMatrix();
Minecraft.getMinecraft().renderEngine.bindTexture(texture);
earrings.render(entity, 0F, 0F, 0F, (float) z, f, 1.0F);
diff --git a/src/main/java/darkknight/jewelrycraft/item/render/ItemRender.java b/src/main/java/darkknight/jewelrycraft/item/render/ItemRender.java index 50f3472..d29f397 100755 --- a/src/main/java/darkknight/jewelrycraft/item/render/ItemRender.java +++ b/src/main/java/darkknight/jewelrycraft/item/render/ItemRender.java @@ -31,23 +31,21 @@ import net.minecraftforge.client.IItemRenderer; import net.minecraftforge.client.MinecraftForgeClient;
public class ItemRender implements IItemRenderer {
- TileEntitySpecialRenderer render;
- public TileEntity entity;
- ModelBase model;
- private RenderBlocks renderBlocksIr = new RenderBlocks();
- private Minecraft mc = Minecraft
- .getMinecraft();
- private static final ResourceLocation RES_ITEM_GLINT = new ResourceLocation(
+ TileEntitySpecialRenderer render;
+ public TileEntity entity;
+ ModelBase model;
+ private RenderBlocks renderBlocksIr = new RenderBlocks();
+ private Minecraft mc = Minecraft.getMinecraft();
+ private static final ResourceLocation RES_ITEM_GLINT = new ResourceLocation(
"textures/misc/enchanted_item_glint.png");
- private float tran = 0F;
+ private float tran = 0F;
/**
* @param render
* @param entity
* @param model
*/
- public ItemRender(TileEntitySpecialRenderer render,
- TileEntity entity, ModelBase model) {
+ public ItemRender(TileEntitySpecialRenderer render, TileEntity entity, ModelBase model) {
this.entity = entity;
this.render = render;
this.model = model;
@@ -62,8 +60,7 @@ public class ItemRender implements IItemRenderer { * @return
*/
@Override
- public boolean handleRenderType(ItemStack item,
- ItemRenderType type) {
+ public boolean handleRenderType(ItemStack item, ItemRenderType type) {
return true;
}
@@ -74,8 +71,7 @@ public class ItemRender implements IItemRenderer { * @return
*/
@Override
- public boolean shouldUseRenderHelper(ItemRenderType type,
- ItemStack item, ItemRendererHelper helper) {
+ public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
return true;
}
@@ -85,91 +81,55 @@ public class ItemRender implements IItemRenderer { * @param data
*/
@Override
- public void renderItem(ItemRenderType type, ItemStack item,
- Object... data) {
+ public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
if (item != null) {
- if (render != null && entity != null
- && JewelryNBT.item(item) == null) {
+ if (render != null && entity != null && JewelryNBT.item(item) == null) {
if (type == IItemRenderer.ItemRenderType.ENTITY) {
GL11.glRotatef(180f, 0f, 1f, 0f);
- GL11.glTranslatef(-0.5f, -0.5f,
- -0.4f);
+ GL11.glTranslatef(-0.5f, -0.5f, -0.4f);
}
- render.renderTileEntityAt(entity, 0.0D,
- 0.0D, 0.0D, 0.0F);
+ render.renderTileEntityAt(entity, 0.0D, 0.0D, 0.0D, 0.0F);
} else if (JewelryNBT.item(item) != null) {
GL11.glPushMatrix();
GL11.glColor3f(1F, 1F, 0F);
- if (Item.getItemById(Integer.valueOf(item
- .getTagCompound()
- .getTag("target")
- .toString().split(",")[0]
- .substring(4)
- .replace("s", ""))) != null)
- renderItem(Minecraft
- .getMinecraft().thePlayer,
- JewelryNBT.item(item),
- 0, type);
+ if (Item.getItemById(Integer.valueOf(item.getTagCompound().getTag("target").toString().split(",")[0]
+ .substring(4).replace("s", ""))) != null)
+ renderItem(Minecraft.getMinecraft().thePlayer, JewelryNBT.item(item), 0, type);
else
- renderItem(Minecraft
- .getMinecraft().thePlayer,
- new ItemStack(Blocks.end_portal),
- 0, type);
+ renderItem(Minecraft.getMinecraft().thePlayer, new ItemStack(Blocks.end_portal), 0, type);
GL11.glPopMatrix();
} else {
GL11.glPushMatrix();
GL11.glColor3f(1F, 1F, 0F);
- renderItem(Minecraft
- .getMinecraft().thePlayer,
- new ItemStack(Blocks.end_portal),
- 0, type);
+ renderItem(Minecraft.getMinecraft().thePlayer, new ItemStack(Blocks.end_portal), 0, type);
GL11.glPopMatrix();
}
}
}
- public void renderItem(EntityLivingBase entity,
- ItemStack itemStack, int meta,
- ItemRenderType type) {
+ public void renderItem(EntityLivingBase entity, ItemStack itemStack, int meta, ItemRenderType type) {
GL11.glPushMatrix();
- TextureManager texturemanager = this.mc
- .getTextureManager();
+ TextureManager texturemanager = this.mc.getTextureManager();
if (itemStack != null) {
Item item = itemStack.getItem();
Block block = Block.getBlockFromItem(item);
- IItemRenderer customRenderer = MinecraftForgeClient
- .getItemRenderer(itemStack, type);
+ IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(itemStack, type);
if (customRenderer != null) {
- texturemanager.bindTexture(texturemanager
- .getResourceLocation(
- itemStack.getItemSpriteNumber()));
+ texturemanager.bindTexture(texturemanager.getResourceLocation(itemStack.getItemSpriteNumber()));
if (type.equals(ItemRenderType.EQUIPPED))
- GL11.glTranslatef(0.7F, 0.55F,
- 0.55F);
- ForgeHooksClient.renderEquippedItem(type,
- customRenderer,
- renderBlocksIr, entity,
- itemStack);
- } else if (itemStack.getItemSpriteNumber() == 0
- && item instanceof ItemBlock
- && RenderBlocks.renderItemIn3d(
- block.getRenderType())) {
- texturemanager.bindTexture(texturemanager
- .getResourceLocation(0));
+ GL11.glTranslatef(0.7F, 0.55F, 0.55F);
+ ForgeHooksClient.renderEquippedItem(type, customRenderer, renderBlocksIr, entity, itemStack);
+ } else if (itemStack.getItemSpriteNumber() == 0 && item instanceof ItemBlock
+ && RenderBlocks.renderItemIn3d(block.getRenderType())) {
+ texturemanager.bindTexture(texturemanager.getResourceLocation(0));
if (type.equals(ItemRenderType.EQUIPPED))
- GL11.glTranslatef(0.5F, 0.5F,
- 0.5F);
- if (itemStack != null && block != null
- && block.getRenderBlockPass() != 0) {
+ GL11.glTranslatef(0.5F, 0.5F, 0.5F);
+ if (itemStack != null && block != null && block.getRenderBlockPass() != 0) {
GL11.glDepthMask(false);
- renderBlockAsItem(block, itemStack
- .getItemDamage(),
- 1.0F);
+ renderBlockAsItem(block, itemStack.getItemDamage(), 1.0F);
GL11.glDepthMask(true);
} else {
- renderBlockAsItem(block, itemStack
- .getItemDamage(),
- 1.0F);
+ renderBlockAsItem(block, itemStack.getItemDamage(), 1.0F);
}
} else {
IIcon iicon = itemStack.getIconIndex();
@@ -177,11 +137,8 @@ public class ItemRender implements IItemRenderer { GL11.glPopMatrix();
return;
}
- texturemanager.bindTexture(texturemanager
- .getResourceLocation(
- itemStack.getItemSpriteNumber()));
- TextureUtil.func_152777_a(false, false,
- 1.0F);
+ texturemanager.bindTexture(texturemanager.getResourceLocation(itemStack.getItemSpriteNumber()));
+ TextureUtil.func_152777_a(false, false, 1.0F);
Tessellator tessellator = Tessellator.instance;
float f = iicon.getMinU();
float f1 = iicon.getMaxU();
@@ -191,63 +148,37 @@ public class ItemRender implements IItemRenderer { float f6 = 1.6F;
GL11.glScalef(f6, f6, f6);
if (type.equals(ItemRenderType.ENTITY)) {
- GL11.glTranslatef(0.0F, 0.0265F,
- 0.0F);
- GL11.glRotatef(-30F, 0.0F, 0.0F,
- 1.0F);
- GL11.glRotatef(45F, 0.0F, 1.0F,
- 0.0F);
- GL11.glScalef(0.625F, 0.625F,
- 0.625F);
+ GL11.glTranslatef(0.0F, 0.0265F, 0.0F);
+ GL11.glRotatef(-30F, 0.0F, 0.0F, 1.0F);
+ GL11.glRotatef(45F, 0.0F, 1.0F, 0.0F);
+ GL11.glScalef(0.625F, 0.625F, 0.625F);
}
- if (!type.equals(
- ItemRenderType.EQUIPPED_FIRST_PERSON)) {
+ if (!type.equals(ItemRenderType.EQUIPPED_FIRST_PERSON)) {
GL11.glRotatef(45f, 0f, 1f, 0f);
GL11.glRotatef(180f, 0f, 1f, 0f);
GL11.glRotatef(30f, 1f, 0f, 0f);
if (type.equals(ItemRenderType.EQUIPPED)) {
- GL11.glRotatef(35f, 1f, 0f,
- 0f);
- GL11.glTranslatef(0F,
- -0.15F,
- -0.6F);
+ GL11.glRotatef(35f, 1f, 0f, 0f);
+ GL11.glTranslatef(0F, -0.15F, -0.6F);
}
- GL11.glTranslatef(-0.5F, -0.5F,
- 0.0F);
- } else if (type.equals(
- ItemRenderType.EQUIPPED_FIRST_PERSON)) {
- GL11.glTranslatef(-0.35F, 0.4F,
- 0.93F);
+ GL11.glTranslatef(-0.5F, -0.5F, 0.0F);
+ } else if (type.equals(ItemRenderType.EQUIPPED_FIRST_PERSON)) {
+ GL11.glTranslatef(-0.35F, 0.4F, 0.93F);
GL11.glRotatef(45f, 0f, 1f, 0f);
GL11.glRotatef(-25f, 0f, 0f, 1f);
}
- if (itemStack.getItem()
- .requiresMultipleRenderPasses()) {
- for (int x = 0; x < itemStack
- .getItem()
- .getRenderPasses(
- itemStack.getItemDamage()); x++) {
- iicon = itemStack.getItem()
- .getIcon(itemStack,
- x);
+ if (itemStack.getItem().requiresMultipleRenderPasses()) {
+ for (int x = 0; x < itemStack.getItem().getRenderPasses(itemStack.getItemDamage()); x++) {
+ iicon = itemStack.getItem().getIcon(itemStack, x);
f = iicon.getMinU();
f1 = iicon.getMaxU();
f2 = iicon.getMinV();
f3 = iicon.getMaxV();
- ItemRenderer.renderItemIn2D(
- tessellator,
- f1, f2, f,
- f3,
- iicon.getIconWidth(),
- iicon.getIconHeight(),
- 0.0625F);
+ ItemRenderer.renderItemIn2D(tessellator, f1, f2, f, f3, iicon.getIconWidth(),
+ iicon.getIconHeight(), 0.0625F);
}
} else {
- ItemRenderer.renderItemIn2D(
- tessellator, f1,
- f2, f, f3,
- iicon.getIconWidth(),
- iicon.getIconHeight(),
+ ItemRenderer.renderItemIn2D(tessellator, f1, f2, f, f3, iicon.getIconWidth(), iicon.getIconHeight(),
0.0625F);
}
GL11.glDepthFunc(GL11.GL_EQUAL);
@@ -255,33 +186,25 @@ public class ItemRender implements IItemRenderer { GL11.glPushMatrix();
float f8 = 0.325F;
GL11.glScalef(f8, f8, f8);
- float f9 = (float) (Minecraft
- .getSystemTime() % 30000L)
- / 30000.0F * 8.0F;
+ float f9 = (float) (Minecraft.getSystemTime() % 30000L) / 30000.0F * 8.0F;
GL11.glTranslatef(-f9, 0.0F, 0.0F);
GL11.glRotatef(30.0F, 0.0F, 0.0F, 1.0F);
- ItemRenderer.renderItemIn2D(tessellator,
- 0.0F, 0.0F, 1.0F, 1.0F,
- 256, 256, 0.0625F);
+ ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F);
GL11.glPopMatrix();
GL11.glMatrixMode(GL11.GL_MODELVIEW);
GL11.glDisable(GL11.GL_BLEND);
GL11.glDepthFunc(GL11.GL_LEQUAL);
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
- texturemanager.bindTexture(texturemanager
- .getResourceLocation(
- itemStack.getItemSpriteNumber()));
+ texturemanager.bindTexture(texturemanager.getResourceLocation(itemStack.getItemSpriteNumber()));
TextureUtil.func_147945_b();
}
}
GL11.glPopMatrix();
}
- public void renderBlockAsItem(Block block, int damage,
- float luminacy) {
+ public void renderBlockAsItem(Block block, int damage, float luminacy) {
Tessellator tessellator = Tessellator.instance;
- if (block == Blocks.dispenser || block == Blocks.dropper
- || block == Blocks.furnace)
+ if (block == Blocks.dispenser || block == Blocks.dropper || block == Blocks.furnace)
damage = 3;
int j;
float f1;
@@ -299,155 +222,89 @@ public class ItemRender implements IItemRenderer { f1 = 0.0625F;
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, -1.0F, 0.0F);
- renderBlocksIr.renderFaceYNeg(block, 0.0D,
- 0.0D, 0.0D,
- renderBlocksIr.getBlockIconFromSide(
- block, 0));
+ renderBlocksIr.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, renderBlocksIr.getBlockIconFromSide(block, 0));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 1.0F, 0.0F);
- renderBlocksIr.renderFaceYPos(block, 0.0D,
- 0.0D, 0.0D,
- renderBlocksIr.getBlockIconFromSide(
- block, 1));
+ renderBlocksIr.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, renderBlocksIr.getBlockIconFromSide(block, 1));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 0.0F, -1.0F);
tessellator.addTranslation(0.0F, 0.0F, f1);
- renderBlocksIr.renderFaceZNeg(block, 0.0D,
- 0.0D, 0.0D,
- renderBlocksIr.getBlockIconFromSide(
- block, 2));
- tessellator.addTranslation(0.0F, 0.0F,
- -f1);
+ renderBlocksIr.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, renderBlocksIr.getBlockIconFromSide(block, 2));
+ tessellator.addTranslation(0.0F, 0.0F, -f1);
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 0.0F, 1.0F);
- tessellator.addTranslation(0.0F, 0.0F,
- -f1);
- renderBlocksIr.renderFaceZPos(block, 0.0D,
- 0.0D, 0.0D,
- renderBlocksIr.getBlockIconFromSide(
- block, 3));
+ tessellator.addTranslation(0.0F, 0.0F, -f1);
+ renderBlocksIr.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, renderBlocksIr.getBlockIconFromSide(block, 3));
tessellator.addTranslation(0.0F, 0.0F, f1);
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(-1.0F, 0.0F, 0.0F);
tessellator.addTranslation(f1, 0.0F, 0.0F);
- renderBlocksIr.renderFaceXNeg(block, 0.0D,
- 0.0D, 0.0D,
- renderBlocksIr.getBlockIconFromSide(
- block, 4));
- tessellator.addTranslation(-f1, 0.0F,
- 0.0F);
+ renderBlocksIr.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, renderBlocksIr.getBlockIconFromSide(block, 4));
+ tessellator.addTranslation(-f1, 0.0F, 0.0F);
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(1.0F, 0.0F, 0.0F);
- tessellator.addTranslation(-f1, 0.0F,
- 0.0F);
- renderBlocksIr.renderFaceXPos(block, 0.0D,
- 0.0D, 0.0D,
- renderBlocksIr.getBlockIconFromSide(
- block, 5));
+ tessellator.addTranslation(-f1, 0.0F, 0.0F);
+ renderBlocksIr.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, renderBlocksIr.getBlockIconFromSide(block, 5));
tessellator.addTranslation(f1, 0.0F, 0.0F);
tessellator.draw();
GL11.glTranslatef(0.0625F, 0.0F, 0.0625F);
- GL11.glScalef(0.9375F - 0.0625F, 1F,
- 0.9375F - 0.0625F);
+ GL11.glScalef(0.9375F - 0.0625F, 1F, 0.9375F - 0.0625F);
shinyBlock(tessellator, false);
} else if (j == 22) {
// Chest
GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
- TileEntityRendererChestHelper.instance
- .renderChest(block, damage,
- luminacy);
+ TileEntityRendererChestHelper.instance.renderChest(block, damage, luminacy);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glTranslatef(0.0625F, 0.0F, 0.0625F);
- GL11.glScalef(0.9375F - 0.0625F, 0.875F,
- 0.9375F - 0.0625F);
+ GL11.glScalef(0.9375F - 0.0625F, 0.875F, 0.9375F - 0.0625F);
shinyBlock(tessellator, false);
} else if (j == 10) {
// Stairs
for (k = 0; k < 2; ++k) {
if (k == 0) {
- renderBlocksIr.setRenderBounds(
- 0.0D, 0.0D,
- 0.0D, 1.0D,
- 1.0D,
- 0.5D);
+ renderBlocksIr.setRenderBounds(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 0.5D);
}
if (k == 1) {
- renderBlocksIr.setRenderBounds(
- 0.0D, 0.0D,
- 0.5D, 1.0D,
- 0.5D,
- 1.0D);
+ renderBlocksIr.setRenderBounds(0.0D, 0.0D, 0.5D, 1.0D, 0.5D, 1.0D);
}
- GL11.glTranslatef(-0.5F, -0.5F,
- -0.5F);
+ GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
tessellator.startDrawingQuads();
- tessellator.setNormal(0.0F, -1.0F,
- 0.0F);
- renderBlocksIr.renderFaceYNeg(
- block, 0.0D, 0.0D,
- 0.0D,
- renderBlocksIr.getBlockIconFromSide(
- block,
- 0));
+ tessellator.setNormal(0.0F, -1.0F, 0.0F);
+ renderBlocksIr.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSide(block, 0));
tessellator.draw();
tessellator.startDrawingQuads();
- tessellator.setNormal(0.0F, 1.0F,
- 0.0F);
- renderBlocksIr.renderFaceYPos(
- block, 0.0D, 0.0D,
- 0.0D,
- renderBlocksIr.getBlockIconFromSide(
- block,
- 1));
+ tessellator.setNormal(0.0F, 1.0F, 0.0F);
+ renderBlocksIr.renderFaceYPos(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSide(block, 1));
tessellator.draw();
tessellator.startDrawingQuads();
- tessellator.setNormal(0.0F, 0.0F,
- -1.0F);
- renderBlocksIr.renderFaceZNeg(
- block, 0.0D, 0.0D,
- 0.0D,
- renderBlocksIr.getBlockIconFromSide(
- block,
- 2));
+ tessellator.setNormal(0.0F, 0.0F, -1.0F);
+ renderBlocksIr.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSide(block, 2));
tessellator.draw();
tessellator.startDrawingQuads();
- tessellator.setNormal(0.0F, 0.0F,
- 1.0F);
- renderBlocksIr.renderFaceZPos(
- block, 0.0D, 0.0D,
- 0.0D,
- renderBlocksIr.getBlockIconFromSide(
- block,
- 3));
+ tessellator.setNormal(0.0F, 0.0F, 1.0F);
+ renderBlocksIr.renderFaceZPos(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSide(block, 3));
tessellator.draw();
tessellator.startDrawingQuads();
- tessellator.setNormal(-1.0F, 0.0F,
- 0.0F);
- renderBlocksIr.renderFaceXNeg(
- block, 0.0D, 0.0D,
- 0.0D,
- renderBlocksIr.getBlockIconFromSide(
- block,
- 4));
+ tessellator.setNormal(-1.0F, 0.0F, 0.0F);
+ renderBlocksIr.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSide(block, 4));
tessellator.draw();
tessellator.startDrawingQuads();
- tessellator.setNormal(1.0F, 0.0F,
- 0.0F);
- renderBlocksIr.renderFaceXPos(
- block, 0.0D, 0.0D,
- 0.0D,
- renderBlocksIr.getBlockIconFromSide(
- block,
- 5));
+ tessellator.setNormal(1.0F, 0.0F, 0.0F);
+ renderBlocksIr.renderFaceXPos(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSide(block, 5));
tessellator.draw();
- GL11.glTranslatef(0.5F, 0.5F,
- 0.5F);
+ GL11.glTranslatef(0.5F, 0.5F, 0.5F);
}
} else if (j == 27) {
// Dragon Egg
@@ -486,502 +343,243 @@ public class ItemRender implements IItemRenderer { b0 = 3;
}
float f5 = (float) b0 / 16.0F;
- float f6 = 1.0F - (float) k
- / 16.0F;
- float f7 = 1.0F - (float) (k + b1)
- / 16.0F;
+ float f6 = 1.0F - (float) k / 16.0F;
+ float f7 = 1.0F - (float) (k + b1) / 16.0F;
k += b1;
- renderBlocksIr.setRenderBounds(
- (double) (0.5F - f5),
- (double) f7,
- (double) (0.5F - f5),
- (double) (0.5F + f5),
- (double) f6,
- (double) (0.5F + f5));
- tessellator.setNormal(0.0F, -1.0F,
- 0.0F);
- renderBlocksIr.renderFaceYNeg(
- block, 0.0D, 0.0D,
- 0.0D,
- renderBlocksIr.getBlockIconFromSide(
- block,
- 0));
- tessellator.setNormal(0.0F, 1.0F,
- 0.0F);
- renderBlocksIr.renderFaceYPos(
- block, 0.0D, 0.0D,
- 0.0D,
- renderBlocksIr.getBlockIconFromSide(
- block,
- 1));
- tessellator.setNormal(0.0F, 0.0F,
- -1.0F);
- renderBlocksIr.renderFaceZNeg(
- block, 0.0D, 0.0D,
- 0.0D,
- renderBlocksIr.getBlockIconFromSide(
- block,
- 2));
- tessellator.setNormal(0.0F, 0.0F,
- 1.0F);
- renderBlocksIr.renderFaceZPos(
- block, 0.0D, 0.0D,
- 0.0D,
- renderBlocksIr.getBlockIconFromSide(
- block,
- 3));
- tessellator.setNormal(-1.0F, 0.0F,
- 0.0F);
- renderBlocksIr.renderFaceXNeg(
- block, 0.0D, 0.0D,
- 0.0D,
- renderBlocksIr.getBlockIconFromSide(
- block,
- 4));
- tessellator.setNormal(1.0F, 0.0F,
- 0.0F);
- renderBlocksIr.renderFaceXPos(
- block, 0.0D, 0.0D,
- 0.0D,
- renderBlocksIr.getBlockIconFromSide(
- block,
- 5));
+ renderBlocksIr.setRenderBounds((double) (0.5F - f5), (double) f7, (double) (0.5F - f5),
+ (double) (0.5F + f5), (double) f6, (double) (0.5F + f5));
+ tessellator.setNormal(0.0F, -1.0F, 0.0F);
+ renderBlocksIr.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSide(block, 0));
+ tessellator.setNormal(0.0F, 1.0F, 0.0F);
+ renderBlocksIr.renderFaceYPos(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSide(block, 1));
+ tessellator.setNormal(0.0F, 0.0F, -1.0F);
+ renderBlocksIr.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSide(block, 2));
+ tessellator.setNormal(0.0F, 0.0F, 1.0F);
+ renderBlocksIr.renderFaceZPos(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSide(block, 3));
+ tessellator.setNormal(-1.0F, 0.0F, 0.0F);
+ renderBlocksIr.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSide(block, 4));
+ tessellator.setNormal(1.0F, 0.0F, 0.0F);
+ renderBlocksIr.renderFaceXPos(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSide(block, 5));
}
tessellator.draw();
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
- renderBlocksIr.setRenderBounds(0.0D, 0.0D,
- 0.0D, 1.0D, 1.0D, 1.0D);
+ renderBlocksIr.setRenderBounds(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D);
} else if (j == 11) {
// Fence
for (k = 0; k < 4; ++k) {
f2 = 0.125F;
if (k == 0) {
- renderBlocksIr.setRenderBounds(
- (double) (0.5F - f2),
- 0.0D, 0.0D,
- (double) (0.5F + f2),
- 1.0D,
+ renderBlocksIr.setRenderBounds((double) (0.5F - f2), 0.0D, 0.0D, (double) (0.5F + f2), 1.0D,
(double) (f2 * 2.0F));
}
if (k == 1) {
- renderBlocksIr.setRenderBounds(
- (double) (0.5F - f2),
- 0.0D,
- (double) (1.0F - f2
- * 2.0F),
- (double) (0.5F + f2),
- 1.0D,
- 1.0D);
+ renderBlocksIr.setRenderBounds((double) (0.5F - f2), 0.0D, (double) (1.0F - f2 * 2.0F),
+ (double) (0.5F + f2), 1.0D, 1.0D);
}
f2 = 0.0625F;
if (k == 2) {
- renderBlocksIr.setRenderBounds(
- (double) (0.5F - f2),
- (double) (1.0F - f2
- * 3.0F),
- (double) (-f2 * 2.0F),
- (double) (0.5F + f2),
- (double) (1.0F - f2),
- (double) (1.0F + f2
- * 2.0F));
+ renderBlocksIr.setRenderBounds((double) (0.5F - f2), (double) (1.0F - f2 * 3.0F),
+ (double) (-f2 * 2.0F), (double) (0.5F + f2), (double) (1.0F - f2),
+ (double) (1.0F + f2 * 2.0F));
}
if (k == 3) {
- renderBlocksIr.setRenderBounds(
- (double) (0.5F - f2),
- (double) (0.5F - f2
- * 3.0F),
- (double) (-f2 * 2.0F),
- (double) (0.5F + f2),
- (double) (0.5F - f2),
- (double) (1.0F + f2
- * 2.0F));
+ renderBlocksIr.setRenderBounds((double) (0.5F - f2), (double) (0.5F - f2 * 3.0F),
+ (double) (-f2 * 2.0F), (double) (0.5F + f2), (double) (0.5F - f2),
+ (double) (1.0F + f2 * 2.0F));
}
- GL11.glTranslatef(-0.5F, -0.5F,
- -0.5F);
+ GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
tessellator.startDrawingQuads();
- tessellator.setNormal(0.0F, -1.0F,
- 0.0F);
- renderBlocksIr.renderFaceYNeg(
- block, 0.0D, 0.0D,
- 0.0D,
- renderBlocksIr.getBlockIconFromSide(
- block,
- 0));
+ tessellator.setNormal(0.0F, -1.0F, 0.0F);
+ renderBlocksIr.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSide(block, 0));
tessellator.draw();
tessellator.startDrawingQuads();
- tessellator.setNormal(0.0F, 1.0F,
- 0.0F);
- renderBlocksIr.renderFaceYPos(
- block, 0.0D, 0.0D,
- 0.0D,
- renderBlocksIr.getBlockIconFromSide(
- block,
- 1));
+ tessellator.setNormal(0.0F, 1.0F, 0.0F);
+ renderBlocksIr.renderFaceYPos(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSide(block, 1));
tessellator.draw();
tessellator.startDrawingQuads();
- tessellator.setNormal(0.0F, 0.0F,
- -1.0F);
- renderBlocksIr.renderFaceZNeg(
- block, 0.0D, 0.0D,
- 0.0D,
- renderBlocksIr.getBlockIconFromSide(
- block,
- 2));
+ tessellator.setNormal(0.0F, 0.0F, -1.0F);
+ renderBlocksIr.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSide(block, 2));
tessellator.draw();
tessellator.startDrawingQuads();
- tessellator.setNormal(0.0F, 0.0F,
- 1.0F);
- renderBlocksIr.renderFaceZPos(
- block, 0.0D, 0.0D,
- 0.0D,
- renderBlocksIr.getBlockIconFromSide(
- block,
- 3));
+ tessellator.setNormal(0.0F, 0.0F, 1.0F);
+ renderBlocksIr.renderFaceZPos(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSide(block, 3));
tessellator.draw();
tessellator.startDrawingQuads();
- tessellator.setNormal(-1.0F, 0.0F,
- 0.0F);
- renderBlocksIr.renderFaceXNeg(
- block, 0.0D, 0.0D,
- 0.0D,
- renderBlocksIr.getBlockIconFromSide(
- block,
- 4));
+ tessellator.setNormal(-1.0F, 0.0F, 0.0F);
+ renderBlocksIr.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSide(block, 4));
tessellator.draw();
tessellator.startDrawingQuads();
- tessellator.setNormal(1.0F, 0.0F,
- 0.0F);
- renderBlocksIr.renderFaceXPos(
- block, 0.0D, 0.0D,
- 0.0D,
- renderBlocksIr.getBlockIconFromSide(
- block,
- 5));
+ tessellator.setNormal(1.0F, 0.0F, 0.0F);
+ renderBlocksIr.renderFaceXPos(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSide(block, 5));
tessellator.draw();
- GL11.glTranslatef(0.5F, 0.5F,
- 0.5F);
+ GL11.glTranslatef(0.5F, 0.5F, 0.5F);
}
- renderBlocksIr.setRenderBounds(0.0D, 0.0D,
- 0.0D, 1.0D, 1.0D, 1.0D);
+ renderBlocksIr.setRenderBounds(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D);
} else if (j == 21) {
// Fence Gate
for (k = 0; k < 3; ++k) {
f2 = 0.0625F;
if (k == 0) {
- renderBlocksIr.setRenderBounds(
- (double) (0.5F - f2),
- 0.30000001192092896D,
- 0.0D,
- (double) (0.5F + f2),
- 1.0D,
- (double) (f2 * 2.0F));
+ renderBlocksIr.setRenderBounds((double) (0.5F - f2), 0.30000001192092896D, 0.0D,
+ (double) (0.5F + f2), 1.0D, (double) (f2 * 2.0F));
}
if (k == 1) {
- renderBlocksIr.setRenderBounds(
- (double) (0.5F - f2),
- 0.30000001192092896D,
- (double) (1.0F - f2
- * 2.0F),
- (double) (0.5F + f2),
- 1.0D,
- 1.0D);
+ renderBlocksIr.setRenderBounds((double) (0.5F - f2), 0.30000001192092896D,
+ (double) (1.0F - f2 * 2.0F), (double) (0.5F + f2), 1.0D, 1.0D);
}
f2 = 0.0625F;
if (k == 2) {
- renderBlocksIr.setRenderBounds(
- (double) (0.5F - f2),
- 0.5D, 0.0D,
- (double) (0.5F + f2),
- (double) (1.0F - f2),
- 1.0D);
+ renderBlocksIr.setRenderBounds((double) (0.5F - f2), 0.5D, 0.0D, (double) (0.5F + f2),
+ (double) (1.0F - f2), 1.0D);
}
- GL11.glTranslatef(-0.5F, -0.5F,
- -0.5F);
+ GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
tessellator.startDrawingQuads();
- tessellator.setNormal(0.0F, -1.0F,
- 0.0F);
- renderBlocksIr.renderFaceYNeg(
- block, 0.0D, 0.0D,
- 0.0D,
- renderBlocksIr.getBlockIconFromSide(
- block,
- 0));
+ tessellator.setNormal(0.0F, -1.0F, 0.0F);
+ renderBlocksIr.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSide(block, 0));
tessellator.draw();
tessellator.startDrawingQuads();
- tessellator.setNormal(0.0F, 1.0F,
- 0.0F);
- renderBlocksIr.renderFaceYPos(
- block, 0.0D, 0.0D,
- 0.0D,
- renderBlocksIr.getBlockIconFromSide(
- block,
- 1));
+ tessellator.setNormal(0.0F, 1.0F, 0.0F);
+ renderBlocksIr.renderFaceYPos(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSide(block, 1));
tessellator.draw();
tessellator.startDrawingQuads();
- tessellator.setNormal(0.0F, 0.0F,
- -1.0F);
- renderBlocksIr.renderFaceZNeg(
- block, 0.0D, 0.0D,
- 0.0D,
- renderBlocksIr.getBlockIconFromSide(
- block,
- 2));
+ tessellator.setNormal(0.0F, 0.0F, -1.0F);
+ renderBlocksIr.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSide(block, 2));
tessellator.draw();
tessellator.startDrawingQuads();
- tessellator.setNormal(0.0F, 0.0F,
- 1.0F);
- renderBlocksIr.renderFaceZPos(
- block, 0.0D, 0.0D,
- 0.0D,
- renderBlocksIr.getBlockIconFromSide(
- block,
- 3));
+ tessellator.setNormal(0.0F, 0.0F, 1.0F);
+ renderBlocksIr.renderFaceZPos(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSide(block, 3));
tessellator.draw();
tessellator.startDrawingQuads();
- tessellator.setNormal(-1.0F, 0.0F,
- 0.0F);
- renderBlocksIr.renderFaceXNeg(
- block, 0.0D, 0.0D,
- 0.0D,
- renderBlocksIr.getBlockIconFromSide(
- block,
- 4));
+ tessellator.setNormal(-1.0F, 0.0F, 0.0F);
+ renderBlocksIr.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSide(block, 4));
tessellator.draw();
tessellator.startDrawingQuads();
- tessellator.setNormal(1.0F, 0.0F,
- 0.0F);
- renderBlocksIr.renderFaceXPos(
- block, 0.0D, 0.0D,
- 0.0D,
- renderBlocksIr.getBlockIconFromSide(
- block,
- 5));
+ tessellator.setNormal(1.0F, 0.0F, 0.0F);
+ renderBlocksIr.renderFaceXPos(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSide(block, 5));
tessellator.draw();
- GL11.glTranslatef(0.5F, 0.5F,
- 0.5F);
+ GL11.glTranslatef(0.5F, 0.5F, 0.5F);
}
} else if (j == 32) {
// Wall
for (k = 0; k < 2; ++k) {
if (k == 0) {
- renderBlocksIr.setRenderBounds(
- 0.0D, 0.0D,
- 0.3125D,
- 1.0D,
- 0.8125D,
- 0.6875D);
+ renderBlocksIr.setRenderBounds(0.0D, 0.0D, 0.3125D, 1.0D, 0.8125D, 0.6875D);
}
if (k == 1) {
- renderBlocksIr.setRenderBounds(
- 0.25D,
- 0.0D,
- 0.25D,
- 0.75D,
- 1.0D,
- 0.75D);
+ renderBlocksIr.setRenderBounds(0.25D, 0.0D, 0.25D, 0.75D, 1.0D, 0.75D);
}
- GL11.glTranslatef(-0.5F, -0.5F,
- -0.5F);
+ GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
tessellator.startDrawingQuads();
- tessellator.setNormal(0.0F, -1.0F,
- 0.0F);
- renderBlocksIr.renderFaceYNeg(
- block, 0.0D, 0.0D,
- 0.0D,
- renderBlocksIr.getBlockIconFromSideAndMetadata(
- block,
- 0,
- damage));
+ tessellator.setNormal(0.0F, -1.0F, 0.0F);
+ renderBlocksIr.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSideAndMetadata(block, 0, damage));
tessellator.draw();
tessellator.startDrawingQuads();
- tessellator.setNormal(0.0F, 1.0F,
- 0.0F);
- renderBlocksIr.renderFaceYPos(
- block, 0.0D, 0.0D,
- 0.0D,
- renderBlocksIr.getBlockIconFromSideAndMetadata(
- block,
- 1,
- damage));
+ tessellator.setNormal(0.0F, 1.0F, 0.0F);
+ renderBlocksIr.renderFaceYPos(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSideAndMetadata(block, 1, damage));
tessellator.draw();
tessellator.startDrawingQuads();
- tessellator.setNormal(0.0F, 0.0F,
- -1.0F);
- renderBlocksIr.renderFaceZNeg(
- block, 0.0D, 0.0D,
- 0.0D,
- renderBlocksIr.getBlockIconFromSideAndMetadata(
- block,
- 2,
- damage));
+ tessellator.setNormal(0.0F, 0.0F, -1.0F);
+ renderBlocksIr.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSideAndMetadata(block, 2, damage));
tessellator.draw();
tessellator.startDrawingQuads();
- tessellator.setNormal(0.0F, 0.0F,
- 1.0F);
- renderBlocksIr.renderFaceZPos(
- block, 0.0D, 0.0D,
- 0.0D,
- renderBlocksIr.getBlockIconFromSideAndMetadata(
- block,
- 3,
- damage));
+ tessellator.setNormal(0.0F, 0.0F, 1.0F);
+ renderBlocksIr.renderFaceZPos(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSideAndMetadata(block, 3, damage));
tessellator.draw();
tessellator.startDrawingQuads();
- tessellator.setNormal(-1.0F, 0.0F,
- 0.0F);
- renderBlocksIr.renderFaceXNeg(
- block, 0.0D, 0.0D,
- 0.0D,
- renderBlocksIr.getBlockIconFromSideAndMetadata(
- block,
- 4,
- damage));
+ tessellator.setNormal(-1.0F, 0.0F, 0.0F);
+ renderBlocksIr.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSideAndMetadata(block, 4, damage));
tessellator.draw();
tessellator.startDrawingQuads();
- tessellator.setNormal(1.0F, 0.0F,
- 0.0F);
- renderBlocksIr.renderFaceXPos(
- block, 0.0D, 0.0D,
- 0.0D,
- renderBlocksIr.getBlockIconFromSideAndMetadata(
- block,
- 5,
- damage));
+ tessellator.setNormal(1.0F, 0.0F, 0.0F);
+ renderBlocksIr.renderFaceXPos(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSideAndMetadata(block, 5, damage));
tessellator.draw();
- GL11.glTranslatef(0.5F, 0.5F,
- 0.5F);
+ GL11.glTranslatef(0.5F, 0.5F, 0.5F);
}
- renderBlocksIr.setRenderBounds(0.0D, 0.0D,
- 0.0D, 1.0D, 1.0D, 1.0D);
+ renderBlocksIr.setRenderBounds(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D);
} else if (j == 35) {
// Anvil
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
- renderBlocksIr.renderBlockAnvilOrient(
- (BlockAnvil) block, 0, 0,
- 0, damage << 2, true);
+ renderBlocksIr.renderBlockAnvilOrient((BlockAnvil) block, 0, 0, 0, damage << 2, true);
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
} else if (j == 34) {
// Beacon
for (k = 0; k < 3; ++k) {
if (k == 0) {
- renderBlocksIr.setRenderBounds(
- 0.125D,
- 0.0D,
- 0.125D,
- 0.875D,
- 0.1875D,
- 0.875D);
- renderBlocksIr.setOverrideBlockTexture(
- renderBlocksIr.getBlockIcon(
- Blocks.obsidian));
+ renderBlocksIr.setRenderBounds(0.125D, 0.0D, 0.125D, 0.875D, 0.1875D, 0.875D);
+ renderBlocksIr.setOverrideBlockTexture(renderBlocksIr.getBlockIcon(Blocks.obsidian));
} else if (k == 1) {
- renderBlocksIr.setRenderBounds(
- 0.1875D,
- 0.1875D,
- 0.1875D,
- 0.8125D,
- 0.875D,
- 0.8125D);
- renderBlocksIr.setOverrideBlockTexture(
- renderBlocksIr.getBlockIcon(
- Blocks.beacon));
+ renderBlocksIr.setRenderBounds(0.1875D, 0.1875D, 0.1875D, 0.8125D, 0.875D, 0.8125D);
+ renderBlocksIr.setOverrideBlockTexture(renderBlocksIr.getBlockIcon(Blocks.beacon));
} else if (k == 2) {
- renderBlocksIr.setRenderBounds(
- 0.0D, 0.0D,
- 0.0D, 1.0D,
- 1.0D,
- 1.0D);
- renderBlocksIr.setOverrideBlockTexture(
- renderBlocksIr.getBlockIcon(
- Blocks.glass));
+ renderBlocksIr.setRenderBounds(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D);
+ renderBlocksIr.setOverrideBlockTexture(renderBlocksIr.getBlockIcon(Blocks.glass));
}
- GL11.glTranslatef(-0.5F, -0.5F,
- -0.5F);
+ GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
tessellator.startDrawingQuads();
- tessellator.setNormal(0.0F, -1.0F,
- 0.0F);
- renderBlocksIr.renderFaceYNeg(
- block, 0.0D, 0.0D,
- 0.0D,
- renderBlocksIr.getBlockIconFromSideAndMetadata(
- block,
- 0,
- damage));
+ tessellator.setNormal(0.0F, -1.0F, 0.0F);
+ renderBlocksIr.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSideAndMetadata(block, 0, damage));
tessellator.draw();
tessellator.startDrawingQuads();
- tessellator.setNormal(0.0F, 1.0F,
- 0.0F);
- renderBlocksIr.renderFaceYPos(
- block, 0.0D, 0.0D,
- 0.0D,
- renderBlocksIr.getBlockIconFromSideAndMetadata(
- block,
- 1,
- damage));
+ tessellator.setNormal(0.0F, 1.0F, 0.0F);
+ renderBlocksIr.renderFaceYPos(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSideAndMetadata(block, 1, damage));
tessellator.draw();
tessellator.startDrawingQuads();
- tessellator.setNormal(0.0F, 0.0F,
- -1.0F);
- renderBlocksIr.renderFaceZNeg(
- block, 0.0D, 0.0D,
- 0.0D,
- renderBlocksIr.getBlockIconFromSideAndMetadata(
- block,
- 2,
- damage));
+ tessellator.setNormal(0.0F, 0.0F, -1.0F);
+ renderBlocksIr.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSideAndMetadata(block, 2, damage));
tessellator.draw();
tessellator.startDrawingQuads();
- tessellator.setNormal(0.0F, 0.0F,
- 1.0F);
- renderBlocksIr.renderFaceZPos(
- block, 0.0D, 0.0D,
- 0.0D,
- renderBlocksIr.getBlockIconFromSideAndMetadata(
- block,
- 3,
- damage));
+ tessellator.setNormal(0.0F, 0.0F, 1.0F);
+ renderBlocksIr.renderFaceZPos(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSideAndMetadata(block, 3, damage));
tessellator.draw();
tessellator.startDrawingQuads();
- tessellator.setNormal(-1.0F, 0.0F,
- 0.0F);
- renderBlocksIr.renderFaceXNeg(
- block, 0.0D, 0.0D,
- 0.0D,
- renderBlocksIr.getBlockIconFromSideAndMetadata(
- block,
- 4,
- damage));
+ tessellator.setNormal(-1.0F, 0.0F, 0.0F);
+ renderBlocksIr.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSideAndMetadata(block, 4, damage));
tessellator.draw();
tessellator.startDrawingQuads();
- tessellator.setNormal(1.0F, 0.0F,
- 0.0F);
- renderBlocksIr.renderFaceXPos(
- block, 0.0D, 0.0D,
- 0.0D,
- renderBlocksIr.getBlockIconFromSideAndMetadata(
- block,
- 5,
- damage));
+ tessellator.setNormal(1.0F, 0.0F, 0.0F);
+ renderBlocksIr.renderFaceXPos(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSideAndMetadata(block, 5, damage));
tessellator.draw();
- GL11.glTranslatef(0.5F, 0.5F,
- 0.5F);
+ GL11.glTranslatef(0.5F, 0.5F, 0.5F);
}
- renderBlocksIr.setRenderBounds(0.0D, 0.0D,
- 0.0D, 1.0D, 1.0D, 1.0D);
+ renderBlocksIr.setRenderBounds(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D);
renderBlocksIr.clearOverrideBlockTexture();
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
shinyBlock(tessellator, false);
} else {
try {
- FMLRenderAccessLibrary
- .renderInventoryBlock(
- renderBlocksIr,
- block,
- damage,
- j);
+ FMLRenderAccessLibrary.renderInventoryBlock(renderBlocksIr, block, damage, j);
} catch (Exception e) {
- JewelrycraftMod.logger.error(
- "Something went wrong with rendering the item");
+ JewelrycraftMod.logger.error("Something went wrong with rendering the item");
e.printStackTrace();
}
}
@@ -995,67 +593,48 @@ public class ItemRender implements IItemRenderer { GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, -1.0F, 0.0F);
- renderBlocksIr.renderFaceYNeg(block, 0.0D, 0.0D,
- 0.0D,
- renderBlocksIr.getBlockIconFromSideAndMetadata(
- block, 0, damage));
+ renderBlocksIr.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSideAndMetadata(block, 0, damage));
tessellator.draw();
GL11.glColor4f(1F, 1F, 0F, 1.0F);
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 1.0F, 0.0F);
- renderBlocksIr.renderFaceYPos(block, 0.0D, 0.0D,
- 0.0D,
- renderBlocksIr.getBlockIconFromSideAndMetadata(
- block, 1, damage));
+ renderBlocksIr.renderFaceYPos(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSideAndMetadata(block, 1, damage));
tessellator.draw();
GL11.glColor4f(1F, 1F, 0F, 1.0F);
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 0.0F, -1.0F);
- renderBlocksIr.renderFaceZNeg(block, 0.0D, 0.0D,
- 0.0D,
- renderBlocksIr.getBlockIconFromSideAndMetadata(
- block, 2, damage));
+ renderBlocksIr.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSideAndMetadata(block, 2, damage));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 0.0F, 1.0F);
- renderBlocksIr.renderFaceZPos(block, 0.0D, 0.0D,
- 0.0D,
- renderBlocksIr.getBlockIconFromSideAndMetadata(
- block, 3, damage));
+ renderBlocksIr.renderFaceZPos(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSideAndMetadata(block, 3, damage));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(-1.0F, 0.0F, 0.0F);
- renderBlocksIr.renderFaceXNeg(block, 0.0D, 0.0D,
- 0.0D,
- renderBlocksIr.getBlockIconFromSideAndMetadata(
- block, 4, damage));
+ renderBlocksIr.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSideAndMetadata(block, 4, damage));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(1.0F, 0.0F, 0.0F);
- renderBlocksIr.renderFaceXPos(block, 0.0D, 0.0D,
- 0.0D,
- renderBlocksIr.getBlockIconFromSideAndMetadata(
- block, 5, damage));
+ renderBlocksIr.renderFaceXPos(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSideAndMetadata(block, 5, damage));
tessellator.draw();
- GL11.glTranslatef(
- (float) block.getBlockBoundsMinX(),
- (float) block.getBlockBoundsMinY(),
+ GL11.glTranslatef((float) block.getBlockBoundsMinX(), (float) block.getBlockBoundsMinY(),
(float) block.getBlockBoundsMinZ());
- GL11.glScalef((float) block.getBlockBoundsMaxX()
- - (float) block.getBlockBoundsMinX(),
- (float) block.getBlockBoundsMaxY()
- - (float) block.getBlockBoundsMinY(),
- (float) block.getBlockBoundsMaxZ()
- - (float) block.getBlockBoundsMinZ());
+ GL11.glScalef((float) block.getBlockBoundsMaxX() - (float) block.getBlockBoundsMinX(),
+ (float) block.getBlockBoundsMaxY() - (float) block.getBlockBoundsMinY(),
+ (float) block.getBlockBoundsMaxZ() - (float) block.getBlockBoundsMinZ());
shinyBlock(tessellator, false);
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
}
}
- public void renderShine(Tessellator tessellator,
- boolean autoAnimate) {
- TextureManager texturemanager = this.mc
- .getTextureManager();
+ public void renderShine(Tessellator tessellator, boolean autoAnimate) {
+ TextureManager texturemanager = this.mc.getTextureManager();
texturemanager.bindTexture(RES_ITEM_GLINT);
GL11.glEnable(GL11.GL_BLEND);
OpenGlHelper.glBlendFunc(768, 1, 1, 0);
@@ -1073,13 +652,11 @@ public class ItemRender implements IItemRenderer { }
GL11.glRotatef(-30.0F, 0.0F, 0.0F, 1.0F);
GL11.glColor3f(1F, 1F, 0F);
- ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F,
- 1.0F, 256, 256, 0.001F);
+ ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.001F);
GL11.glPopMatrix();
}
- public void shinyBlock(Tessellator tessellator,
- boolean autoAnimate) {
+ public void shinyBlock(Tessellator tessellator, boolean autoAnimate) {
GL11.glPushMatrix();
GL11.glTranslatef(0F, 0.0F, -0.001F);
renderShine(tessellator, autoAnimate);
diff --git a/src/main/java/darkknight/jewelrycraft/item/render/MaskRender.java b/src/main/java/darkknight/jewelrycraft/item/render/MaskRender.java index dd671e2..6197ab0 100755 --- a/src/main/java/darkknight/jewelrycraft/item/render/MaskRender.java +++ b/src/main/java/darkknight/jewelrycraft/item/render/MaskRender.java @@ -11,17 +11,14 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation;
public class MaskRender extends TileEntitySpecialRenderer {
- ModelMask mask = new ModelMask();
- ResourceLocation texture = new ResourceLocation(
- Variables.MODID, "textures/entities/Mask.png");
+ ModelMask mask = new ModelMask();
+ ResourceLocation texture = new ResourceLocation(Variables.MODID, "textures/entities/Mask.png");
@Override
- public void renderTileEntityAt(TileEntity te, double x, double y,
- double z, float scale) {
+ public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale) {
}
- public void doRender(Entity entity, double x, double y, double z,
- float f, float g) {
+ public void doRender(Entity entity, double x, double y, double z, float f, float g) {
GL11.glPushMatrix();
Minecraft.getMinecraft().renderEngine.bindTexture(texture);
GL11.glTranslatef(0.1615F, 0F, 0.03F);
diff --git a/src/main/java/darkknight/jewelrycraft/item/render/NecklaceRender.java b/src/main/java/darkknight/jewelrycraft/item/render/NecklaceRender.java index c021e7a..d10f7f7 100755 --- a/src/main/java/darkknight/jewelrycraft/item/render/NecklaceRender.java +++ b/src/main/java/darkknight/jewelrycraft/item/render/NecklaceRender.java @@ -11,22 +11,18 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation;
public class NecklaceRender extends TileEntitySpecialRenderer {
- public ModelNeckalce neckalce = new ModelNeckalce();
- ResourceLocation texture = new ResourceLocation(
- Variables.MODID, "textures/entities/Necklace.png");
+ public ModelNeckalce neckalce = new ModelNeckalce();
+ ResourceLocation texture = new ResourceLocation(Variables.MODID, "textures/entities/Necklace.png");
@Override
- public void renderTileEntityAt(TileEntity te, double x, double y,
- double z, float scale) {
+ public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale) {
}
- public void doRender(Entity entity, double x, double y, double z,
- float f, float g) {
+ public void doRender(Entity entity, double x, double y, double z, float f, float g) {
GL11.glPushMatrix();
Minecraft.getMinecraft().renderEngine.bindTexture(texture);
if ((float) z != -1)
- neckalce.render(entity, 0F, 0F, 0F, (float) z, f,
- 1.0F);
+ neckalce.render(entity, 0F, 0F, 0F, (float) z, f, 1.0F);
GL11.glPopMatrix();
}
}
\ No newline at end of file diff --git a/src/main/java/darkknight/jewelrycraft/item/render/RingRender.java b/src/main/java/darkknight/jewelrycraft/item/render/RingRender.java index 1cde268..1a289ee 100755 --- a/src/main/java/darkknight/jewelrycraft/item/render/RingRender.java +++ b/src/main/java/darkknight/jewelrycraft/item/render/RingRender.java @@ -11,22 +11,18 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation;
public class RingRender extends TileEntitySpecialRenderer {
- public ModelRing ring = new ModelRing();
- ResourceLocation texture = new ResourceLocation(
- Variables.MODID, "textures/entities/Ring.png");
+ public ModelRing ring = new ModelRing();
+ ResourceLocation texture = new ResourceLocation(Variables.MODID, "textures/entities/Ring.png");
@Override
- public void renderTileEntityAt(TileEntity te, double x, double y,
- double z, float scale) {
+ public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale) {
}
- public void doRender(Entity entity, double x, double y, double z,
- float f, float g) {
+ public void doRender(Entity entity, double x, double y, double z, float f, float g) {
GL11.glPushMatrix();
Minecraft.getMinecraft().renderEngine.bindTexture(texture);
if ((float) z != -1)
- ring.render(entity, 0F, 0F, 0F, (float) z, f,
- 1.0F);
+ ring.render(entity, 0F, 0F, 0F, (float) z, f, 1.0F);
GL11.glPopMatrix();
}
}
\ No newline at end of file diff --git a/src/main/java/darkknight/jewelrycraft/model/ItemStackModelRenderer.java b/src/main/java/darkknight/jewelrycraft/model/ItemStackModelRenderer.java index fe5a183..8bdb629 100755 --- a/src/main/java/darkknight/jewelrycraft/model/ItemStackModelRenderer.java +++ b/src/main/java/darkknight/jewelrycraft/model/ItemStackModelRenderer.java @@ -16,23 +16,20 @@ import net.minecraft.util.ResourceLocation; * @author Paul Fulham (pau101)
*/
public class ItemStackModelRenderer extends ModelRenderer {
- private RenderItem renderItem;
- private TextureManager textureManager;
- private ResourceLocation resetResourceLocation;
- private EntityItem entityItem;
- private Minecraft mc;
+ private RenderItem renderItem;
+ private TextureManager textureManager;
+ private ResourceLocation resetResourceLocation;
+ private EntityItem entityItem;
+ private Minecraft mc;
/**
* @param modelBase
* @param resetResourceLocation
*/
- public ItemStackModelRenderer(ModelBase modelBase,
- ResourceLocation resetResourceLocation) {
+ public ItemStackModelRenderer(ModelBase modelBase, ResourceLocation resetResourceLocation) {
super(modelBase);
- renderItem = (RenderItem) RenderManager.instance.entityRenderMap
- .get(EntityItem.class);
- textureManager = (mc = Minecraft.getMinecraft())
- .getTextureManager();
+ renderItem = (RenderItem) RenderManager.instance.entityRenderMap.get(EntityItem.class);
+ textureManager = (mc = Minecraft.getMinecraft()).getTextureManager();
this.resetResourceLocation = resetResourceLocation;
}
@@ -43,8 +40,7 @@ public class ItemStackModelRenderer extends ModelRenderer { if (itemStack == null || itemStack.getItem() == null)
entityItem = null;
else {
- entityItem = new EntityItem(null, 0, 0, 0,
- itemStack);
+ entityItem = new EntityItem(null, 0, 0, 0, itemStack);
entityItem.hoverStart = 0;
}
}
@@ -59,18 +55,10 @@ public class ItemStackModelRenderer extends ModelRenderer { textureManager = mc.getTextureManager();
GL11.glPushMatrix();
GL11.glTranslatef(offsetX, offsetY, offsetZ);
- GL11.glTranslatef(rotationPointX * scale,
- rotationPointY * scale,
- rotationPointZ * scale);
- GL11.glRotatef(rotateAngleZ
- * (180 / (float) Math.PI), 0, 0,
- 1);
- GL11.glRotatef(rotateAngleY
- * (180 / (float) Math.PI), 0, 1,
- 0);
- GL11.glRotatef(rotateAngleX
- * (180 / (float) Math.PI), 1, 0,
- 0);
+ GL11.glTranslatef(rotationPointX * scale, rotationPointY * scale, rotationPointZ * scale);
+ GL11.glRotatef(rotateAngleZ * (180 / (float) Math.PI), 0, 0, 1);
+ GL11.glRotatef(rotateAngleY * (180 / (float) Math.PI), 0, 1, 0);
+ GL11.glRotatef(rotateAngleX * (180 / (float) Math.PI), 1, 0, 0);
boolean fancyGraphics = mc.gameSettings.fancyGraphics;
mc.gameSettings.fancyGraphics = true;
renderItem.doRender(entityItem, 0, 0, 0, 0, 0);
diff --git a/src/main/java/darkknight/jewelrycraft/model/ModelBracelet.java b/src/main/java/darkknight/jewelrycraft/model/ModelBracelet.java index f63e4bf..f900a4d 100755 --- a/src/main/java/darkknight/jewelrycraft/model/ModelBracelet.java +++ b/src/main/java/darkknight/jewelrycraft/model/ModelBracelet.java @@ -10,19 +10,19 @@ import net.minecraft.entity.Entity; * ModelBiped - Either Mojang or a mod author Created using Tabula 4.1.1 */ public class ModelBracelet extends ModelBase { - public ModelRenderer metal1; - public ModelRenderer metal2; - public ModelRenderer metal3; - public ModelRenderer metal4; - public ModelRenderer gem1; - public ModelRenderer gem2; - public ModelRenderer gem3; - public ModelRenderer gem4; - public ModelRenderer gem5; - public ModelRenderer gem6; - public ModelRenderer gem7; - public ModelRenderer gem8; - public ModelRenderer gem9; + public ModelRenderer metal1; + public ModelRenderer metal2; + public ModelRenderer metal3; + public ModelRenderer metal4; + public ModelRenderer gem1; + public ModelRenderer gem2; + public ModelRenderer gem3; + public ModelRenderer gem4; + public ModelRenderer gem5; + public ModelRenderer gem6; + public ModelRenderer gem7; + public ModelRenderer gem8; + public ModelRenderer gem9; public ModelBracelet() { this.textureWidth = 16; @@ -33,8 +33,7 @@ public class ModelBracelet extends ModelBase { this.gem4 = new ModelRenderer(this, 0, 0); this.gem4.setRotationPoint(-3.0F, 12.8F, -3.5F); this.gem4.addBox(0.0F, 0.0F, 0.0F, 1, 1, 1, 0.0F); - this.setRotateAngle(gem4, 0.0F, 0.008901179185171082F, - 0.0F); + this.setRotateAngle(gem4, 0.0F, 0.008901179185171082F, 0.0F); this.gem3 = new ModelRenderer(this, 0, 0); this.gem3.setRotationPoint(-4.8F, 12.2F, -3.5F); this.gem3.addBox(0.0F, 0.0F, 0.0F, 1, 1, 1, 0.0F); @@ -71,17 +70,14 @@ public class ModelBracelet extends ModelBase { } @Override - public void render(Entity entity, float f, float f1, float f2, - float f3, float f4, float f5) { + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { // GL11.glDisable(GL11.GL_LIGHTING); if ((int) f3 != -1) { int ingotColor = (int) f3; int red = (ingotColor >> 16) & 0xff; int green = (ingotColor >> 8) & 0xff; int blue = ingotColor & 0xff; - GL11.glColor3f((float) red / 255, - (float) green / 255, - (float) blue / 255); + GL11.glColor3f((float) red / 255, (float) green / 255, (float) blue / 255); this.metal1.render(f5); this.metal2.render(f5); this.metal3.render(f5); @@ -92,153 +88,96 @@ public class ModelBracelet extends ModelBase { int red = gemColor >> 16 & 0xff; int green = gemColor >> 8 & 0xff; int blue = gemColor & 0xff; - GL11.glColor3f((float) red / 255, - (float) green / 255, - (float) blue / 255); + GL11.glColor3f((float) red / 255, (float) green / 255, (float) blue / 255); GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_COLOR, - GL11.GL_ONE_MINUS_DST_COLOR); + GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE_MINUS_DST_COLOR); GL11.glPushMatrix(); - GL11.glTranslatef(this.gem4.offsetX, - this.gem4.offsetY, - this.gem4.offsetZ); - GL11.glTranslatef(this.gem4.rotationPointX * f5, - this.gem4.rotationPointY * f5, + GL11.glTranslatef(this.gem4.offsetX, this.gem4.offsetY, this.gem4.offsetZ); + GL11.glTranslatef(this.gem4.rotationPointX * f5, this.gem4.rotationPointY * f5, this.gem4.rotationPointZ * f5); GL11.glScaled(0.5D, 0.5D, 0.5D); - GL11.glTranslatef(-this.gem4.offsetX, - -this.gem4.offsetY, - -this.gem4.offsetZ); - GL11.glTranslatef(-this.gem4.rotationPointX * f5, - -this.gem4.rotationPointY * f5, + GL11.glTranslatef(-this.gem4.offsetX, -this.gem4.offsetY, -this.gem4.offsetZ); + GL11.glTranslatef(-this.gem4.rotationPointX * f5, -this.gem4.rotationPointY * f5, -this.gem4.rotationPointZ * f5); this.gem4.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); - GL11.glTranslatef(this.gem3.offsetX, - this.gem3.offsetY, - this.gem3.offsetZ); - GL11.glTranslatef(this.gem3.rotationPointX * f5, - this.gem3.rotationPointY * f5, + GL11.glTranslatef(this.gem3.offsetX, this.gem3.offsetY, this.gem3.offsetZ); + GL11.glTranslatef(this.gem3.rotationPointX * f5, this.gem3.rotationPointY * f5, this.gem3.rotationPointZ * f5); GL11.glScaled(0.5D, 0.5D, 0.5D); - GL11.glTranslatef(-this.gem3.offsetX, - -this.gem3.offsetY, - -this.gem3.offsetZ); - GL11.glTranslatef(-this.gem3.rotationPointX * f5, - -this.gem3.rotationPointY * f5, + GL11.glTranslatef(-this.gem3.offsetX, -this.gem3.offsetY, -this.gem3.offsetZ); + GL11.glTranslatef(-this.gem3.rotationPointX * f5, -this.gem3.rotationPointY * f5, -this.gem3.rotationPointZ * f5); this.gem3.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); - GL11.glTranslatef(this.gem2.offsetX, - this.gem2.offsetY, - this.gem2.offsetZ); - GL11.glTranslatef(this.gem2.rotationPointX * f5, - this.gem2.rotationPointY * f5, + GL11.glTranslatef(this.gem2.offsetX, this.gem2.offsetY, this.gem2.offsetZ); + GL11.glTranslatef(this.gem2.rotationPointX * f5, this.gem2.rotationPointY * f5, this.gem2.rotationPointZ * f5); GL11.glScaled(0.5D, 0.5D, 0.5D); - GL11.glTranslatef(-this.gem2.offsetX, - -this.gem2.offsetY, - -this.gem2.offsetZ); - GL11.glTranslatef(-this.gem2.rotationPointX * f5, - -this.gem2.rotationPointY * f5, + GL11.glTranslatef(-this.gem2.offsetX, -this.gem2.offsetY, -this.gem2.offsetZ); + GL11.glTranslatef(-this.gem2.rotationPointX * f5, -this.gem2.rotationPointY * f5, -this.gem2.rotationPointZ * f5); this.gem2.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); - GL11.glTranslatef(this.gem1.offsetX, - this.gem1.offsetY, - this.gem1.offsetZ); - GL11.glTranslatef(this.gem1.rotationPointX * f5, - this.gem1.rotationPointY * f5, + GL11.glTranslatef(this.gem1.offsetX, this.gem1.offsetY, this.gem1.offsetZ); + GL11.glTranslatef(this.gem1.rotationPointX * f5, this.gem1.rotationPointY * f5, this.gem1.rotationPointZ * f5); GL11.glScaled(0.5D, 0.5D, 0.5D); - GL11.glTranslatef(-this.gem1.offsetX, - -this.gem1.offsetY, - -this.gem1.offsetZ); - GL11.glTranslatef(-this.gem1.rotationPointX * f5, - -this.gem1.rotationPointY * f5, + GL11.glTranslatef(-this.gem1.offsetX, -this.gem1.offsetY, -this.gem1.offsetZ); + GL11.glTranslatef(-this.gem1.rotationPointX * f5, -this.gem1.rotationPointY * f5, -this.gem1.rotationPointZ * f5); this.gem1.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); - GL11.glTranslatef(this.gem6.offsetX, - this.gem6.offsetY, - this.gem6.offsetZ); - GL11.glTranslatef(this.gem6.rotationPointX * f5, - this.gem6.rotationPointY * f5, + GL11.glTranslatef(this.gem6.offsetX, this.gem6.offsetY, this.gem6.offsetZ); + GL11.glTranslatef(this.gem6.rotationPointX * f5, this.gem6.rotationPointY * f5, this.gem6.rotationPointZ * f5); GL11.glScaled(0.5D, 0.5D, 0.5D); - GL11.glTranslatef(-this.gem6.offsetX, - -this.gem6.offsetY, - -this.gem6.offsetZ); - GL11.glTranslatef(-this.gem6.rotationPointX * f5, - -this.gem6.rotationPointY * f5, + GL11.glTranslatef(-this.gem6.offsetX, -this.gem6.offsetY, -this.gem6.offsetZ); + GL11.glTranslatef(-this.gem6.rotationPointX * f5, -this.gem6.rotationPointY * f5, -this.gem6.rotationPointZ * f5); this.gem6.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); - GL11.glTranslatef(this.gem7.offsetX, - this.gem7.offsetY, - this.gem7.offsetZ); - GL11.glTranslatef(this.gem7.rotationPointX * f5, - this.gem7.rotationPointY * f5, + GL11.glTranslatef(this.gem7.offsetX, this.gem7.offsetY, this.gem7.offsetZ); + GL11.glTranslatef(this.gem7.rotationPointX * f5, this.gem7.rotationPointY * f5, this.gem7.rotationPointZ * f5); GL11.glScaled(0.5D, 0.5D, 0.5D); - GL11.glTranslatef(-this.gem7.offsetX, - -this.gem7.offsetY, - -this.gem7.offsetZ); - GL11.glTranslatef(-this.gem7.rotationPointX * f5, - -this.gem7.rotationPointY * f5, + GL11.glTranslatef(-this.gem7.offsetX, -this.gem7.offsetY, -this.gem7.offsetZ); + GL11.glTranslatef(-this.gem7.rotationPointX * f5, -this.gem7.rotationPointY * f5, -this.gem7.rotationPointZ * f5); this.gem7.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); - GL11.glTranslatef(this.gem8.offsetX, - this.gem8.offsetY, - this.gem8.offsetZ); - GL11.glTranslatef(this.gem8.rotationPointX * f5, - this.gem8.rotationPointY * f5, + GL11.glTranslatef(this.gem8.offsetX, this.gem8.offsetY, this.gem8.offsetZ); + GL11.glTranslatef(this.gem8.rotationPointX * f5, this.gem8.rotationPointY * f5, this.gem8.rotationPointZ * f5); GL11.glScaled(0.5D, 0.5D, 0.5D); - GL11.glTranslatef(-this.gem8.offsetX, - -this.gem8.offsetY, - -this.gem8.offsetZ); - GL11.glTranslatef(-this.gem8.rotationPointX * f5, - -this.gem8.rotationPointY * f5, + GL11.glTranslatef(-this.gem8.offsetX, -this.gem8.offsetY, -this.gem8.offsetZ); + GL11.glTranslatef(-this.gem8.rotationPointX * f5, -this.gem8.rotationPointY * f5, -this.gem8.rotationPointZ * f5); this.gem8.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); - GL11.glTranslatef(this.gem5.offsetX, - this.gem5.offsetY, - this.gem5.offsetZ); - GL11.glTranslatef(this.gem5.rotationPointX * f5, - this.gem5.rotationPointY * f5, + GL11.glTranslatef(this.gem5.offsetX, this.gem5.offsetY, this.gem5.offsetZ); + GL11.glTranslatef(this.gem5.rotationPointX * f5, this.gem5.rotationPointY * f5, this.gem5.rotationPointZ * f5); GL11.glScaled(0.5D, 0.5D, 0.5D); - GL11.glTranslatef(-this.gem5.offsetX, - -this.gem5.offsetY, - -this.gem5.offsetZ); - GL11.glTranslatef(-this.gem5.rotationPointX * f5, - -this.gem5.rotationPointY * f5, + GL11.glTranslatef(-this.gem5.offsetX, -this.gem5.offsetY, -this.gem5.offsetZ); + GL11.glTranslatef(-this.gem5.rotationPointX * f5, -this.gem5.rotationPointY * f5, -this.gem5.rotationPointZ * f5); this.gem5.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); - GL11.glTranslatef(this.gem9.offsetX, - this.gem9.offsetY, - this.gem9.offsetZ); - GL11.glTranslatef(this.gem9.rotationPointX * f5, - this.gem9.rotationPointY * f5, + GL11.glTranslatef(this.gem9.offsetX, this.gem9.offsetY, this.gem9.offsetZ); + GL11.glTranslatef(this.gem9.rotationPointX * f5, this.gem9.rotationPointY * f5, this.gem9.rotationPointZ * f5); GL11.glScaled(0.5D, 0.5D, 0.5D); - GL11.glTranslatef(-this.gem9.offsetX, - -this.gem9.offsetY, - -this.gem9.offsetZ); - GL11.glTranslatef(-this.gem9.rotationPointX * f5, - -this.gem9.rotationPointY * f5, + GL11.glTranslatef(-this.gem9.offsetX, -this.gem9.offsetY, -this.gem9.offsetZ); + GL11.glTranslatef(-this.gem9.rotationPointX * f5, -this.gem9.rotationPointY * f5, -this.gem9.rotationPointZ * f5); this.gem9.render(f5); GL11.glPopMatrix(); @@ -248,11 +187,9 @@ public class ModelBracelet extends ModelBase { } /** - * This is a helper function from Tabula to set the rotation of - * model parts + * This is a helper function from Tabula to set the rotation of model parts */ - public void setRotateAngle(ModelRenderer modelRenderer, float x, - float y, float z) { + public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) { modelRenderer.rotateAngleX = x; modelRenderer.rotateAngleY = y; modelRenderer.rotateAngleZ = z; diff --git a/src/main/java/darkknight/jewelrycraft/model/ModelDisplayer.java b/src/main/java/darkknight/jewelrycraft/model/ModelDisplayer.java index 4668ab8..5198585 100755 --- a/src/main/java/darkknight/jewelrycraft/model/ModelDisplayer.java +++ b/src/main/java/darkknight/jewelrycraft/model/ModelDisplayer.java @@ -8,31 +8,31 @@ import net.minecraft.entity.Entity; public class ModelDisplayer extends ModelBase { // fields - ModelRenderer Base; - ModelRenderer Ring11; - ModelRenderer Ring12; - ModelRenderer Ring13; - ModelRenderer Ring14; - ModelRenderer Ring31; - ModelRenderer Ring21; - ModelRenderer Ring32; - ModelRenderer Ring22; - ModelRenderer Ring33; - ModelRenderer Ring23; - ModelRenderer Ring34; - ModelRenderer Ring24; - ModelRenderer Ring25; - ModelRenderer Ring26; - ModelRenderer Ring27; - ModelRenderer Ring28; - ModelRenderer Ring35; - ModelRenderer Ring36; - ModelRenderer Ring37; - ModelRenderer Ring38; - ModelRenderer Ring39; - ModelRenderer Ring310; - ModelRenderer Ring311; - ModelRenderer Ring312; + ModelRenderer Base; + ModelRenderer Ring11; + ModelRenderer Ring12; + ModelRenderer Ring13; + ModelRenderer Ring14; + ModelRenderer Ring31; + ModelRenderer Ring21; + ModelRenderer Ring32; + ModelRenderer Ring22; + ModelRenderer Ring33; + ModelRenderer Ring23; + ModelRenderer Ring34; + ModelRenderer Ring24; + ModelRenderer Ring25; + ModelRenderer Ring26; + ModelRenderer Ring27; + ModelRenderer Ring28; + ModelRenderer Ring35; + ModelRenderer Ring36; + ModelRenderer Ring37; + ModelRenderer Ring38; + ModelRenderer Ring39; + ModelRenderer Ring310; + ModelRenderer Ring311; + ModelRenderer Ring312; /** * @@ -202,8 +202,7 @@ public class ModelDisplayer extends ModelBase { * @param f5 */ @Override - public void render(Entity entity, float f, float f1, float f2, - float f3, float f4, float f5) { + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { GL11.glPushMatrix(); Base.render(f5); GL11.glTranslatef(0.0F, 0F - f, 0.0F); @@ -242,8 +241,7 @@ public class ModelDisplayer extends ModelBase { * @param y * @param z */ - private void setRotation(ModelRenderer model, float x, float y, - float z) { + private void setRotation(ModelRenderer model, float x, float y, float z) { model.rotateAngleX = x; model.rotateAngleY = y; model.rotateAngleZ = z; @@ -257,8 +255,7 @@ public class ModelDisplayer extends ModelBase { * @param f4 * @param f5 */ - public void setRotationAngles(float f, float f1, float f2, - float f3, float f4, float f5) { + public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5) { super.setRotationAngles(f, f1, f2, f3, f4, f5, null); } } diff --git a/src/main/java/darkknight/jewelrycraft/model/ModelEarrings.java b/src/main/java/darkknight/jewelrycraft/model/ModelEarrings.java index ed378e9..426a465 100755 --- a/src/main/java/darkknight/jewelrycraft/model/ModelEarrings.java +++ b/src/main/java/darkknight/jewelrycraft/model/ModelEarrings.java @@ -8,14 +8,14 @@ import net.minecraft.entity.Entity; public class ModelEarrings extends ModelBase { // fields - ModelRenderer MetalPart00; - ModelRenderer MetalPart10; - ModelRenderer MetalPart20; - ModelRenderer Gem0; - ModelRenderer Gem1; - ModelRenderer MetalPart01; - ModelRenderer MetalPart11; - ModelRenderer MetalPart21; + ModelRenderer MetalPart00; + ModelRenderer MetalPart10; + ModelRenderer MetalPart20; + ModelRenderer Gem0; + ModelRenderer Gem1; + ModelRenderer MetalPart01; + ModelRenderer MetalPart11; + ModelRenderer MetalPart21; public ModelEarrings() { textureWidth = 32; @@ -71,8 +71,7 @@ public class ModelEarrings extends ModelBase { } @Override - public void render(Entity entity, float f, float f1, float f2, - float f3, float f4, float f5) { + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { super.render(entity, f, f1, f2, f3, f4, f5); setRotationAngles(f, f1, f2, f3, f4, f5); GL11.glPushMatrix(); @@ -82,9 +81,7 @@ public class ModelEarrings extends ModelBase { int red = ingotColor >> 16 & 0xff; int green = ingotColor >> 8 & 0xff; int blue = ingotColor & 0xff; - GL11.glColor3f((float) red / 255, - (float) green / 255, - (float) blue / 255); + GL11.glColor3f((float) red / 255, (float) green / 255, (float) blue / 255); MetalPart00.render(f5); MetalPart10.render(f5); MetalPart20.render(f5); @@ -94,15 +91,12 @@ public class ModelEarrings extends ModelBase { } if ((int) f4 != -1) { GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_COLOR, - GL11.GL_ONE_MINUS_DST_COLOR); + GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE_MINUS_DST_COLOR); int gemColor = (int) f4; int red = gemColor >> 16 & 0xff; int green = gemColor >> 8 & 0xff; int blue = gemColor & 0xff; - GL11.glColor3f((float) red / 255, - (float) green / 255, - (float) blue / 255); + GL11.glColor3f((float) red / 255, (float) green / 255, (float) blue / 255); Gem0.render(f5); Gem1.render(f5); GL11.glDisable(GL11.GL_BLEND); @@ -111,15 +105,13 @@ public class ModelEarrings extends ModelBase { GL11.glPopMatrix(); } - private void setRotation(ModelRenderer model, float x, float y, - float z) { + private void setRotation(ModelRenderer model, float x, float y, float z) { model.rotateAngleX = x; model.rotateAngleY = y; model.rotateAngleZ = z; } - public void setRotationAngles(float f, float f1, float f2, - float f3, float f4, float f5) { + public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5) { super.setRotationAngles(f, f1, f2, f3, f4, f5, null); } } diff --git a/src/main/java/darkknight/jewelrycraft/model/ModelHalfHeart.java b/src/main/java/darkknight/jewelrycraft/model/ModelHalfHeart.java index 016bf02..ec564b7 100755 --- a/src/main/java/darkknight/jewelrycraft/model/ModelHalfHeart.java +++ b/src/main/java/darkknight/jewelrycraft/model/ModelHalfHeart.java @@ -11,12 +11,9 @@ import net.minecraft.entity.Entity; public class ModelHalfHeart extends ModelBase { // fields - ModelRenderer s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, - s13, s14, s15, s16, s17, s18, s19, s20, s21, s22; - ModelRenderer f1, f3, f4, f5, f6, f7, f8, f9, f13, f14, f16, f17, - f19, f20, f21, f22, f23, f24, f25, f26; - ModelRenderer b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, - b13, b14, b15, b16, b19, b20, b21, b23, b24, b25, + ModelRenderer s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14, s15, s16, s17, s18, s19, s20, s21, s22; + ModelRenderer f1, f3, f4, f5, f6, f7, f8, f9, f13, f14, f16, f17, f19, f20, f21, f22, f23, f24, f25, f26; + ModelRenderer b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15, b16, b19, b20, b21, b23, b24, b25, b26; public ModelHalfHeart() { @@ -415,13 +412,10 @@ public class ModelHalfHeart extends ModelBase { } @Override - public void render(Entity entity, float angle1, float angle2, - float angle3, float angle4, float angle5, + public void render(Entity entity, float angle1, float angle2, float angle3, float angle4, float angle5, float angle6) { - super.render(entity, angle1, angle2, angle3, angle4, - angle5, angle6); - setRotationAngles(angle1, angle2, angle3, angle4, angle5, - angle6); + super.render(entity, angle1, angle2, angle3, angle4, angle5, angle6); + setRotationAngles(angle1, angle2, angle3, angle4, angle5, angle6); s1.render(angle6); s2.render(angle6); s3.render(angle6); @@ -489,15 +483,13 @@ public class ModelHalfHeart extends ModelBase { b14.render(angle6); } - private void setRotation(ModelRenderer model, float x, float y, - float z) { + private void setRotation(ModelRenderer model, float x, float y, float z) { model.rotateAngleX = x; model.rotateAngleY = y; model.rotateAngleZ = z; } - public void setRotationAngles(float f, float f1, float f2, - float f3, float f4, float f5) { + public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5) { super.setRotationAngles(f, f1, f2, f3, f4, f5, null); } } diff --git a/src/main/java/darkknight/jewelrycraft/model/ModelHandPedestal.java b/src/main/java/darkknight/jewelrycraft/model/ModelHandPedestal.java index fc02886..09ba2e5 100755 --- a/src/main/java/darkknight/jewelrycraft/model/ModelHandPedestal.java +++ b/src/main/java/darkknight/jewelrycraft/model/ModelHandPedestal.java @@ -15,14 +15,14 @@ import net.minecraft.util.ResourceLocation; * @author Paul Fulham (pau101) */ public class ModelHandPedestal extends ModelBase { - protected ModelRenderer plinth; - protected ModelRenderer base; - protected ModelRenderer shaft; - private ModelRenderer palm; - private ModelRenderer[] fingers; - private ModelRenderer thumb; - private ItemStackModelRenderer heldItemStack; - private CubicBezier easeInOut; + protected ModelRenderer plinth; + protected ModelRenderer base; + protected ModelRenderer shaft; + private ModelRenderer palm; + private ModelRenderer[] fingers; + private ModelRenderer thumb; + private ItemStackModelRenderer heldItemStack; + private CubicBezier easeInOut; /** * @param resetResourceLocation @@ -40,12 +40,9 @@ public class ModelHandPedestal extends ModelBase { * */ protected void initPedestalRenderers() { - plinth = createModelRenderer(0, 0).addBox(-6, 4, -6, 12, 4, - 12); - base = createModelRenderer(0, 0).addBox(-4, 0, -4, 8, 4, - 8); - shaft = createModelRenderer(0, 0).addBox(-3, -4, -3, 6, 4, - 6); + plinth = createModelRenderer(0, 0).addBox(-6, 4, -6, 12, 4, 12); + base = createModelRenderer(0, 0).addBox(-4, 0, -4, 8, 4, 8); + shaft = createModelRenderer(0, 0).addBox(-3, -4, -3, 6, 4, 6); } /** @@ -60,10 +57,8 @@ public class ModelHandPedestal extends ModelBase { * @param textureOffsetY * @return */ - protected final ModelRenderer createModelRenderer( - int textureOffsetX, int textureOffsetY) { - ModelRenderer modelRenderer = new ModelRenderer(this, - textureOffsetX, textureOffsetY); + protected final ModelRenderer createModelRenderer(int textureOffsetX, int textureOffsetY) { + ModelRenderer modelRenderer = new ModelRenderer(this, textureOffsetX, textureOffsetY); modelRenderer.setTextureSize(textureWidth, textureHeight); return modelRenderer; } @@ -72,30 +67,22 @@ public class ModelHandPedestal extends ModelBase { * @return */ private ModelRenderer createPhalanges() { - return createModelRenderer(0, 0) - .addBox(-1, -1.5F, 0, 2, 3, 5) - .addBox(-1, -5.5F, 2, 2, 4, 3); + return createModelRenderer(0, 0).addBox(-1, -1.5F, 0, 2, 3, 5).addBox(-1, -5.5F, 2, 2, 4, 3); } /** * @param resetResourceLocation */ - private void initHandModelRenderers( - ResourceLocation resetResourceLocation) { - palm = createModelRenderer(0, 0).addBox(-4, -8, -4, 8, 4, - 8); + private void initHandModelRenderers(ResourceLocation resetResourceLocation) { + palm = createModelRenderer(0, 0).addBox(-4, -8, -4, 8, 4, 8); shaft.addChild(palm); int fingerCount = 4; fingers = new ModelRenderer[fingerCount]; for (int i = 0; i < fingerCount; i++) { ModelRenderer phalanges = createPhalanges(); - float theta = (i / (float) fingerCount - 0.5F - + 1F / fingerCount / 2) - * ((float) Math.PI * 0.6F); + float theta = (i / (float) fingerCount - 0.5F + 1F / fingerCount / 2) * ((float) Math.PI * 0.6F); phalanges.rotateAngleY = theta; - phalanges.setRotationPoint( - MathHelper.sin(theta) * 5, -5.75F, - MathHelper.cos(theta) * 5 - 1); + phalanges.setRotationPoint(MathHelper.sin(theta) * 5, -5.75F, MathHelper.cos(theta) * 5 - 1); fingers[i] = phalanges; palm.addChild(phalanges); } @@ -104,8 +91,7 @@ public class ModelHandPedestal extends ModelBase { thumb.rotationPointY = -5.75F; thumb.rotationPointZ = -3; palm.addChild(thumb); - heldItemStack = new ItemStackModelRenderer(this, - resetResourceLocation); + heldItemStack = new ItemStackModelRenderer(this, resetResourceLocation); heldItemStack.rotateAngleZ = (float) Math.PI; heldItemStack.rotateAngleX = (float) (Math.PI / 2); heldItemStack.setRotationPoint(0, -8.5F, -3.5F); @@ -117,25 +103,18 @@ public class ModelHandPedestal extends ModelBase { * @param partialRenderTicks * @param scale */ - public void render(TileEntityHandPedestal pedestal, - float partialRenderTicks, float scale) { + public void render(TileEntityHandPedestal pedestal, float partialRenderTicks, float scale) { handleHeldItemStack(pedestal.getHeldItemStack()); float gripScale = pedestal.getGripScale(); - float grip = easeInOut - .eval(pedestal.getGrip(partialRenderTicks)) - * gripScale; - float rotateAngleX = (float) (grip * 75 * Math.PI / 180 - + (1 - grip) * 10 * Math.PI / 180); + float grip = easeInOut.eval(pedestal.getGrip(partialRenderTicks)) * gripScale; + float rotateAngleX = (float) (grip * 75 * Math.PI / 180 + (1 - grip) * 10 * Math.PI / 180); float rotateAngleZ = (float) (grip * 20 * Math.PI / 180); for (int i = 0; i < fingers.length; i++) { ModelRenderer phalanges = fingers[i]; phalanges.rotateAngleX = rotateAngleX; - phalanges.rotateAngleZ = rotateAngleZ - * (2F / (fingers.length - 1) * i - - 1); + phalanges.rotateAngleZ = rotateAngleZ * (2F / (fingers.length - 1) * i - 1); } - thumb.rotateAngleX = (float) (grip * 60 * Math.PI / 180 - + (1 - grip) * 10 * Math.PI / 180); + thumb.rotateAngleX = (float) (grip * 60 * Math.PI / 180 + (1 - grip) * 10 * Math.PI / 180); thumb.rotateAngleZ = rotateAngleZ; plinth.render(scale); } @@ -151,8 +130,7 @@ public class ModelHandPedestal extends ModelBase { heldItemStack.rotateAngleX = 0; heldItemStack.rotationPointZ = 0; } else { - heldItemStack.rotateAngleX = (float) (Math.PI - / 2); + heldItemStack.rotateAngleX = (float) (Math.PI / 2); heldItemStack.rotationPointZ = -3.5F; } } diff --git a/src/main/java/darkknight/jewelrycraft/model/ModelHeart.java b/src/main/java/darkknight/jewelrycraft/model/ModelHeart.java index 474dc69..d24e83a 100755 --- a/src/main/java/darkknight/jewelrycraft/model/ModelHeart.java +++ b/src/main/java/darkknight/jewelrycraft/model/ModelHeart.java @@ -11,13 +11,10 @@ import net.minecraft.entity.Entity; public class ModelHeart extends ModelBase { // fields - ModelRenderer s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, - s13, s14, s15, s16, s17, s18, s19, s20, s21, s22; - ModelRenderer f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, - f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, + ModelRenderer s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14, s15, s16, s17, s18, s19, s20, s21, s22; + ModelRenderer f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26; - ModelRenderer b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, - b13, b14, b15, b16, b17, b18, b19, b20, b21, b22, + ModelRenderer b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15, b16, b17, b18, b19, b20, b21, b22, b23, b24, b25, b26; public ModelHeart() { @@ -470,13 +467,10 @@ public class ModelHeart extends ModelBase { } @Override - public void render(Entity entity, float angle1, float angle2, - float angle3, float angle4, float angle5, + public void render(Entity entity, float angle1, float angle2, float angle3, float angle4, float angle5, float angle6) { - super.render(entity, angle1, angle2, angle3, angle4, - angle5, angle6); - setRotationAngles(angle1, angle2, angle3, angle4, angle5, - angle6); + super.render(entity, angle1, angle2, angle3, angle4, angle5, angle6); + setRotationAngles(angle1, angle2, angle3, angle4, angle5, angle6); s1.render(angle6); s2.render(angle6); s3.render(angle6); @@ -553,15 +547,13 @@ public class ModelHeart extends ModelBase { b26.render(angle6); } - private void setRotation(ModelRenderer model, float x, float y, - float z) { + private void setRotation(ModelRenderer model, float x, float y, float z) { model.rotateAngleX = x; model.rotateAngleY = y; model.rotateAngleZ = z; } - public void setRotationAngles(float f, float f1, float f2, - float f3, float f4, float f5) { + public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5) { super.setRotationAngles(f, f1, f2, f3, f4, f5, null); } } diff --git a/src/main/java/darkknight/jewelrycraft/model/ModelJewlersCraftingBench.java b/src/main/java/darkknight/jewelrycraft/model/ModelJewlersCraftingBench.java index 1ecfeb5..84d60ec 100755 --- a/src/main/java/darkknight/jewelrycraft/model/ModelJewlersCraftingBench.java +++ b/src/main/java/darkknight/jewelrycraft/model/ModelJewlersCraftingBench.java @@ -6,19 +6,19 @@ import net.minecraft.entity.Entity; public class ModelJewlersCraftingBench extends ModelBase { // fields - ModelRenderer Leg1; - ModelRenderer Leg2; - ModelRenderer Leg3; - ModelRenderer Leg4; - ModelRenderer Top; - ModelRenderer Support1; - ModelRenderer Support2; - ModelRenderer Support3; - ModelRenderer Support4; - ModelRenderer Support5; - ModelRenderer Support6; - ModelRenderer Support7; - ModelRenderer Support8; + ModelRenderer Leg1; + ModelRenderer Leg2; + ModelRenderer Leg3; + ModelRenderer Leg4; + ModelRenderer Top; + ModelRenderer Support1; + ModelRenderer Support2; + ModelRenderer Support3; + ModelRenderer Support4; + ModelRenderer Support5; + ModelRenderer Support6; + ModelRenderer Support7; + ModelRenderer Support8; /** * @@ -116,8 +116,7 @@ public class ModelJewlersCraftingBench extends ModelBase { * @param f5 */ @Override - public void render(Entity entity, float f, float f1, float f2, - float f3, float f4, float f5) { + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { super.render(entity, f, f1, f2, f3, f4, f5); setRotationAngles(f, f1, f2, f3, f4, f5); Leg1.render(f5); @@ -141,8 +140,7 @@ public class ModelJewlersCraftingBench extends ModelBase { * @param y * @param z */ - private void setRotation(ModelRenderer model, float x, float y, - float z) { + private void setRotation(ModelRenderer model, float x, float y, float z) { model.rotateAngleX = x; model.rotateAngleY = y; model.rotateAngleZ = z; @@ -156,8 +154,7 @@ public class ModelJewlersCraftingBench extends ModelBase { * @param f4 * @param f5 */ - public void setRotationAngles(float f, float f1, float f2, - float f3, float f4, float f5) { + public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5) { super.setRotationAngles(f, f1, f2, f3, f4, f5, null); } } diff --git a/src/main/java/darkknight/jewelrycraft/model/ModelMask.java b/src/main/java/darkknight/jewelrycraft/model/ModelMask.java index d1934ab..f3313c2 100755 --- a/src/main/java/darkknight/jewelrycraft/model/ModelMask.java +++ b/src/main/java/darkknight/jewelrycraft/model/ModelMask.java @@ -8,15 +8,15 @@ import net.minecraft.entity.Entity; * ModelMask - OnyxDarkKnight Created using Tabula 4.1.1 */ public class ModelMask extends ModelBase { - public ModelRenderer shape1; - public ModelRenderer shape2; - public ModelRenderer shape3; - public ModelRenderer shape4; - public ModelRenderer shape5; - public ModelRenderer shape6; - public ModelRenderer shape7; - public ModelRenderer shape8; - public ModelRenderer shape9; + public ModelRenderer shape1; + public ModelRenderer shape2; + public ModelRenderer shape3; + public ModelRenderer shape4; + public ModelRenderer shape5; + public ModelRenderer shape6; + public ModelRenderer shape7; + public ModelRenderer shape8; + public ModelRenderer shape9; public ModelMask() { this.textureWidth = 64; @@ -51,8 +51,7 @@ public class ModelMask extends ModelBase { } @Override - public void render(Entity entity, float f, float f1, float f2, - float f3, float f4, float f5) { + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { this.shape6.render(f5); this.shape7.render(f5); this.shape4.render(f5); @@ -65,11 +64,9 @@ public class ModelMask extends ModelBase { } /** - * This is a helper function from Tabula to set the rotation of - * model parts + * This is a helper function from Tabula to set the rotation of model parts */ - public void setRotateAngle(ModelRenderer modelRenderer, float x, - float y, float z) { + public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) { modelRenderer.rotateAngleX = x; modelRenderer.rotateAngleY = y; modelRenderer.rotateAngleZ = z; diff --git a/src/main/java/darkknight/jewelrycraft/model/ModelMolder.java b/src/main/java/darkknight/jewelrycraft/model/ModelMolder.java index 36989af..119d2c4 100755 --- a/src/main/java/darkknight/jewelrycraft/model/ModelMolder.java +++ b/src/main/java/darkknight/jewelrycraft/model/ModelMolder.java @@ -6,11 +6,11 @@ import net.minecraft.entity.Entity; public class ModelMolder extends ModelBase { // fields - ModelRenderer Base; - ModelRenderer Side; - ModelRenderer Side1; - ModelRenderer Side2; - ModelRenderer Side3; + ModelRenderer Base; + ModelRenderer Side; + ModelRenderer Side1; + ModelRenderer Side2; + ModelRenderer Side3; /** * @@ -60,8 +60,7 @@ public class ModelMolder extends ModelBase { * @param f5 */ @Override - public void render(Entity entity, float f, float f1, float f2, - float f3, float f4, float f5) { + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { super.render(entity, f, f1, f2, f3, f4, f5); setRotationAngles(f, f1, f2, f3, f4, f5); Base.render(f5); @@ -77,8 +76,7 @@ public class ModelMolder extends ModelBase { * @param y * @param z */ - private void setRotation(ModelRenderer model, float x, float y, - float z) { + private void setRotation(ModelRenderer model, float x, float y, float z) { model.rotateAngleX = x; model.rotateAngleY = y; model.rotateAngleZ = z; @@ -92,8 +90,7 @@ public class ModelMolder extends ModelBase { * @param f4 * @param f5 */ - public void setRotationAngles(float f, float f1, float f2, - float f3, float f4, float f5) { + public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5) { super.setRotationAngles(f, f1, f2, f3, f4, f5, null); } } diff --git a/src/main/java/darkknight/jewelrycraft/model/ModelNeckalce.java b/src/main/java/darkknight/jewelrycraft/model/ModelNeckalce.java index 537a8c2..d1da191 100755 --- a/src/main/java/darkknight/jewelrycraft/model/ModelNeckalce.java +++ b/src/main/java/darkknight/jewelrycraft/model/ModelNeckalce.java @@ -10,16 +10,16 @@ import net.minecraft.entity.Entity; * ModelNeckalce - OnyxDarkKnight Created using Tabula 4.1.1 */ public class ModelNeckalce extends ModelBase { - public ModelRenderer neck1; - public ModelRenderer neck2; - public ModelRenderer neck3; - public ModelRenderer neck4; - public ModelRenderer neck5; - public ModelRenderer neck6; - public ModelRenderer neck7; - public ModelRenderer neck8; - public ModelRenderer neck9; - public ModelRenderer gem; + public ModelRenderer neck1; + public ModelRenderer neck2; + public ModelRenderer neck3; + public ModelRenderer neck4; + public ModelRenderer neck5; + public ModelRenderer neck6; + public ModelRenderer neck7; + public ModelRenderer neck8; + public ModelRenderer neck9; + public ModelRenderer gem; public ModelNeckalce() { this.textureWidth = 32; @@ -57,158 +57,101 @@ public class ModelNeckalce extends ModelBase { } @Override - public void render(Entity entity, float f, float f1, float f2, - float f3, float f4, float f5) { + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { // GL11.glDisable(GL11.GL_LIGHTING); if ((int) f3 != -1) { int ingotColor = (int) f3; int red = (ingotColor >> 16) & 0xff; int green = (ingotColor >> 8) & 0xff; int blue = ingotColor & 0xff; - GL11.glColor3f((float) red / 255, - (float) green / 255, - (float) blue / 255); + GL11.glColor3f((float) red / 255, (float) green / 255, (float) blue / 255); GL11.glPushMatrix(); - GL11.glTranslatef(this.neck1.offsetX, - this.neck1.offsetY, - this.neck1.offsetZ); - GL11.glTranslatef(this.neck1.rotationPointX * f5, - this.neck1.rotationPointY * f5, + GL11.glTranslatef(this.neck1.offsetX, this.neck1.offsetY, this.neck1.offsetZ); + GL11.glTranslatef(this.neck1.rotationPointX * f5, this.neck1.rotationPointY * f5, this.neck1.rotationPointZ * f5); GL11.glScaled(0.5D, 0.5D, 0.5D); - GL11.glTranslatef(-this.neck1.offsetX, - -this.neck1.offsetY, - -this.neck1.offsetZ); - GL11.glTranslatef(-this.neck1.rotationPointX * f5, - -this.neck1.rotationPointY * f5, + GL11.glTranslatef(-this.neck1.offsetX, -this.neck1.offsetY, -this.neck1.offsetZ); + GL11.glTranslatef(-this.neck1.rotationPointX * f5, -this.neck1.rotationPointY * f5, -this.neck1.rotationPointZ * f5); this.neck1.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); - GL11.glTranslatef(this.neck7.offsetX, - this.neck7.offsetY, - this.neck7.offsetZ); - GL11.glTranslatef(this.neck7.rotationPointX * f5, - this.neck7.rotationPointY * f5, + GL11.glTranslatef(this.neck7.offsetX, this.neck7.offsetY, this.neck7.offsetZ); + GL11.glTranslatef(this.neck7.rotationPointX * f5, this.neck7.rotationPointY * f5, this.neck7.rotationPointZ * f5); GL11.glScaled(0.3D, 0.5D, 0.5D); - GL11.glTranslatef(-this.neck7.offsetX, - -this.neck7.offsetY, - -this.neck7.offsetZ); - GL11.glTranslatef(-this.neck7.rotationPointX * f5, - -this.neck7.rotationPointY * f5, + GL11.glTranslatef(-this.neck7.offsetX, -this.neck7.offsetY, -this.neck7.offsetZ); + GL11.glTranslatef(-this.neck7.rotationPointX * f5, -this.neck7.rotationPointY * f5, -this.neck7.rotationPointZ * f5); this.neck7.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); - GL11.glTranslatef(this.neck8.offsetX, - this.neck8.offsetY, - this.neck8.offsetZ); - GL11.glTranslatef(this.neck8.rotationPointX * f5, - this.neck8.rotationPointY * f5, + GL11.glTranslatef(this.neck8.offsetX, this.neck8.offsetY, this.neck8.offsetZ); + GL11.glTranslatef(this.neck8.rotationPointX * f5, this.neck8.rotationPointY * f5, this.neck8.rotationPointZ * f5); GL11.glScaled(0.3D, 0.5D, 0.5D); - GL11.glTranslatef(-this.neck8.offsetX, - -this.neck8.offsetY, - -this.neck8.offsetZ); - GL11.glTranslatef(-this.neck8.rotationPointX * f5, - -this.neck8.rotationPointY * f5, + GL11.glTranslatef(-this.neck8.offsetX, -this.neck8.offsetY, -this.neck8.offsetZ); + GL11.glTranslatef(-this.neck8.rotationPointX * f5, -this.neck8.rotationPointY * f5, -this.neck8.rotationPointZ * f5); this.neck8.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); - GL11.glTranslatef(this.neck3.offsetX, - this.neck3.offsetY, - this.neck3.offsetZ); - GL11.glTranslatef(this.neck3.rotationPointX * f5, - this.neck3.rotationPointY * f5, + GL11.glTranslatef(this.neck3.offsetX, this.neck3.offsetY, this.neck3.offsetZ); + GL11.glTranslatef(this.neck3.rotationPointX * f5, this.neck3.rotationPointY * f5, this.neck3.rotationPointZ * f5); GL11.glScaled(0.5D, 0.5D, 0.5D); - GL11.glTranslatef(-this.neck3.offsetX, - -this.neck3.offsetY, - -this.neck3.offsetZ); - GL11.glTranslatef(-this.neck3.rotationPointX * f5, - -this.neck3.rotationPointY * f5, + GL11.glTranslatef(-this.neck3.offsetX, -this.neck3.offsetY, -this.neck3.offsetZ); + GL11.glTranslatef(-this.neck3.rotationPointX * f5, -this.neck3.rotationPointY * f5, -this.neck3.rotationPointZ * f5); this.neck3.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); - GL11.glTranslatef(this.neck6.offsetX, - this.neck6.offsetY, - this.neck6.offsetZ); - GL11.glTranslatef(this.neck6.rotationPointX * f5, - this.neck6.rotationPointY * f5, + GL11.glTranslatef(this.neck6.offsetX, this.neck6.offsetY, this.neck6.offsetZ); + GL11.glTranslatef(this.neck6.rotationPointX * f5, this.neck6.rotationPointY * f5, this.neck6.rotationPointZ * f5); GL11.glScaled(0.5D, 0.5D, 0.5D); - GL11.glTranslatef(-this.neck6.offsetX, - -this.neck6.offsetY, - -this.neck6.offsetZ); - GL11.glTranslatef(-this.neck6.rotationPointX * f5, - -this.neck6.rotationPointY * f5, + GL11.glTranslatef(-this.neck6.offsetX, -this.neck6.offsetY, -this.neck6.offsetZ); + GL11.glTranslatef(-this.neck6.rotationPointX * f5, -this.neck6.rotationPointY * f5, -this.neck6.rotationPointZ * f5); this.neck6.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); - GL11.glTranslatef(this.neck9.offsetX, - this.neck9.offsetY, - this.neck9.offsetZ); - GL11.glTranslatef(this.neck9.rotationPointX * f5, - this.neck9.rotationPointY * f5, + GL11.glTranslatef(this.neck9.offsetX, this.neck9.offsetY, this.neck9.offsetZ); + GL11.glTranslatef(this.neck9.rotationPointX * f5, this.neck9.rotationPointY * f5, this.neck9.rotationPointZ * f5); GL11.glScaled(0.5D, 0.5D, 0.5D); - GL11.glTranslatef(-this.neck9.offsetX, - -this.neck9.offsetY, - -this.neck9.offsetZ); - GL11.glTranslatef(-this.neck9.rotationPointX * f5, - -this.neck9.rotationPointY * f5, + GL11.glTranslatef(-this.neck9.offsetX, -this.neck9.offsetY, -this.neck9.offsetZ); + GL11.glTranslatef(-this.neck9.rotationPointX * f5, -this.neck9.rotationPointY * f5, -this.neck9.rotationPointZ * f5); this.neck9.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); - GL11.glTranslatef(this.neck4.offsetX, - this.neck4.offsetY, - this.neck4.offsetZ); - GL11.glTranslatef(this.neck4.rotationPointX * f5, - this.neck4.rotationPointY * f5, + GL11.glTranslatef(this.neck4.offsetX, this.neck4.offsetY, this.neck4.offsetZ); + GL11.glTranslatef(this.neck4.rotationPointX * f5, this.neck4.rotationPointY * f5, this.neck4.rotationPointZ * f5); GL11.glScaled(0.5D, 0.5D, 0.5D); - GL11.glTranslatef(-this.neck4.offsetX, - -this.neck4.offsetY, - -this.neck4.offsetZ); - GL11.glTranslatef(-this.neck4.rotationPointX * f5, - -this.neck4.rotationPointY * f5, + GL11.glTranslatef(-this.neck4.offsetX, -this.neck4.offsetY, -this.neck4.offsetZ); + GL11.glTranslatef(-this.neck4.rotationPointX * f5, -this.neck4.rotationPointY * f5, -this.neck4.rotationPointZ * f5); this.neck4.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); - GL11.glTranslatef(this.neck2.offsetX, - this.neck2.offsetY, - this.neck2.offsetZ); - GL11.glTranslatef(this.neck2.rotationPointX * f5, - this.neck2.rotationPointY * f5, + GL11.glTranslatef(this.neck2.offsetX, this.neck2.offsetY, this.neck2.offsetZ); + GL11.glTranslatef(this.neck2.rotationPointX * f5, this.neck2.rotationPointY * f5, this.neck2.rotationPointZ * f5); GL11.glScaled(0.5D, 0.5D, 0.5D); - GL11.glTranslatef(-this.neck2.offsetX, - -this.neck2.offsetY, - -this.neck2.offsetZ); - GL11.glTranslatef(-this.neck2.rotationPointX * f5, - -this.neck2.rotationPointY * f5, + GL11.glTranslatef(-this.neck2.offsetX, -this.neck2.offsetY, -this.neck2.offsetZ); + GL11.glTranslatef(-this.neck2.rotationPointX * f5, -this.neck2.rotationPointY * f5, -this.neck2.rotationPointZ * f5); this.neck2.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); - GL11.glTranslatef(this.neck5.offsetX, - this.neck5.offsetY, - this.neck5.offsetZ); - GL11.glTranslatef(this.neck5.rotationPointX * f5, - this.neck5.rotationPointY * f5, + GL11.glTranslatef(this.neck5.offsetX, this.neck5.offsetY, this.neck5.offsetZ); + GL11.glTranslatef(this.neck5.rotationPointX * f5, this.neck5.rotationPointY * f5, this.neck5.rotationPointZ * f5); GL11.glScaled(0.5D, 0.5D, 0.5D); - GL11.glTranslatef(-this.neck5.offsetX, - -this.neck5.offsetY, - -this.neck5.offsetZ); - GL11.glTranslatef(-this.neck5.rotationPointX * f5, - -this.neck5.rotationPointY * f5, + GL11.glTranslatef(-this.neck5.offsetX, -this.neck5.offsetY, -this.neck5.offsetZ); + GL11.glTranslatef(-this.neck5.rotationPointX * f5, -this.neck5.rotationPointY * f5, -this.neck5.rotationPointZ * f5); this.neck5.render(f5); GL11.glPopMatrix(); @@ -218,25 +161,15 @@ public class ModelNeckalce extends ModelBase { int red = gemColor >> 16 & 0xff; int green = gemColor >> 8 & 0xff; int blue = gemColor & 0xff; - GL11.glColor3f((float) red / 255, - (float) green / 255, - (float) blue / 255); + GL11.glColor3f((float) red / 255, (float) green / 255, (float) blue / 255); GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_COLOR, - GL11.GL_ONE_MINUS_DST_COLOR); + GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE_MINUS_DST_COLOR); GL11.glPushMatrix(); - GL11.glTranslatef(this.gem.offsetX, - this.gem.offsetY, - this.gem.offsetZ); - GL11.glTranslatef(this.gem.rotationPointX * f5, - this.gem.rotationPointY * f5, - this.gem.rotationPointZ * f5); + GL11.glTranslatef(this.gem.offsetX, this.gem.offsetY, this.gem.offsetZ); + GL11.glTranslatef(this.gem.rotationPointX * f5, this.gem.rotationPointY * f5, this.gem.rotationPointZ * f5); GL11.glScaled(0.25D, 0.25D, 0.25D); - GL11.glTranslatef(-this.gem.offsetX, - -this.gem.offsetY, - -this.gem.offsetZ); - GL11.glTranslatef(-this.gem.rotationPointX * f5, - -this.gem.rotationPointY * f5, + GL11.glTranslatef(-this.gem.offsetX, -this.gem.offsetY, -this.gem.offsetZ); + GL11.glTranslatef(-this.gem.rotationPointX * f5, -this.gem.rotationPointY * f5, -this.gem.rotationPointZ * f5); this.gem.render(f5); GL11.glPopMatrix(); @@ -246,11 +179,9 @@ public class ModelNeckalce extends ModelBase { } /** - * This is a helper function from Tabula to set the rotation of - * model parts + * This is a helper function from Tabula to set the rotation of model parts */ - public void setRotateAngle(ModelRenderer modelRenderer, float x, - float y, float z) { + public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) { modelRenderer.rotateAngleX = x; modelRenderer.rotateAngleY = y; modelRenderer.rotateAngleZ = z; diff --git a/src/main/java/darkknight/jewelrycraft/model/ModelRing.java b/src/main/java/darkknight/jewelrycraft/model/ModelRing.java index a9b8e34..2bde63d 100755 --- a/src/main/java/darkknight/jewelrycraft/model/ModelRing.java +++ b/src/main/java/darkknight/jewelrycraft/model/ModelRing.java @@ -10,12 +10,12 @@ import net.minecraft.entity.Entity; * ModelRing - OnyxDarkKnight Created using Tabula 4.1.1 */ public class ModelRing extends ModelBase { - public ModelRenderer ring1; - public ModelRenderer ring2; - public ModelRenderer ring3; - public ModelRenderer gem; - public ModelRenderer gem1; - public ModelRenderer gem2; + public ModelRenderer ring1; + public ModelRenderer ring2; + public ModelRenderer ring3; + public ModelRenderer gem; + public ModelRenderer gem1; + public ModelRenderer gem2; public ModelRing() { this.textureWidth = 32; @@ -41,62 +41,41 @@ public class ModelRing extends ModelBase { } @Override - public void render(Entity entity, float f, float f1, float f2, - float f3, float f4, float f5) { + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { // GL11.glEnable(GL11.GL_LIGHTING); if ((int) f3 != -1) { int ingotColor = (int) f3; int red = (ingotColor >> 16) & 0xff; int green = (ingotColor >> 8) & 0xff; int blue = ingotColor & 0xff; - GL11.glColor3f((float) red / 255, - (float) green / 255, - (float) blue / 255); + GL11.glColor3f((float) red / 255, (float) green / 255, (float) blue / 255); GL11.glPushMatrix(); - GL11.glTranslatef(this.ring1.offsetX, - this.ring1.offsetY, - this.ring1.offsetZ); - GL11.glTranslatef(this.ring1.rotationPointX * f5, - this.ring1.rotationPointY * f5, + GL11.glTranslatef(this.ring1.offsetX, this.ring1.offsetY, this.ring1.offsetZ); + GL11.glTranslatef(this.ring1.rotationPointX * f5, this.ring1.rotationPointY * f5, this.ring1.rotationPointZ * f5); GL11.glScaled(0.1D, 0.3D, 0.3D); - GL11.glTranslatef(-this.ring1.offsetX, - -this.ring1.offsetY, - -this.ring1.offsetZ); - GL11.glTranslatef(-this.ring1.rotationPointX * f5, - -this.ring1.rotationPointY * f5, + GL11.glTranslatef(-this.ring1.offsetX, -this.ring1.offsetY, -this.ring1.offsetZ); + GL11.glTranslatef(-this.ring1.rotationPointX * f5, -this.ring1.rotationPointY * f5, -this.ring1.rotationPointZ * f5); this.ring1.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); - GL11.glTranslatef(this.ring2.offsetX, - this.ring2.offsetY, - this.ring2.offsetZ); - GL11.glTranslatef(this.ring2.rotationPointX * f5, - this.ring2.rotationPointY * f5, + GL11.glTranslatef(this.ring2.offsetX, this.ring2.offsetY, this.ring2.offsetZ); + GL11.glTranslatef(this.ring2.rotationPointX * f5, this.ring2.rotationPointY * f5, this.ring2.rotationPointZ * f5); GL11.glScaled(0.1D, 0.3D, 0.3D); - GL11.glTranslatef(-this.ring2.offsetX, - -this.ring2.offsetY, - -this.ring2.offsetZ); - GL11.glTranslatef(-this.ring2.rotationPointX * f5, - -this.ring2.rotationPointY * f5, + GL11.glTranslatef(-this.ring2.offsetX, -this.ring2.offsetY, -this.ring2.offsetZ); + GL11.glTranslatef(-this.ring2.rotationPointX * f5, -this.ring2.rotationPointY * f5, -this.ring2.rotationPointZ * f5); this.ring2.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); - GL11.glTranslatef(this.ring3.offsetX, - this.ring3.offsetY, - this.ring3.offsetZ); - GL11.glTranslatef(this.ring3.rotationPointX * f5, - this.ring3.rotationPointY * f5, + GL11.glTranslatef(this.ring3.offsetX, this.ring3.offsetY, this.ring3.offsetZ); + GL11.glTranslatef(this.ring3.rotationPointX * f5, this.ring3.rotationPointY * f5, this.ring3.rotationPointZ * f5); GL11.glScaled(0.2D, 0.3D, 0.1D); - GL11.glTranslatef(-this.ring3.offsetX, - -this.ring3.offsetY, - -this.ring3.offsetZ); - GL11.glTranslatef(-this.ring3.rotationPointX * f5, - -this.ring3.rotationPointY * f5, + GL11.glTranslatef(-this.ring3.offsetX, -this.ring3.offsetY, -this.ring3.offsetZ); + GL11.glTranslatef(-this.ring3.rotationPointX * f5, -this.ring3.rotationPointY * f5, -this.ring3.rotationPointZ * f5); this.ring3.render(f5); GL11.glPopMatrix(); @@ -106,57 +85,35 @@ public class ModelRing extends ModelBase { int red = gemColor >> 16 & 0xff; int green = gemColor >> 8 & 0xff; int blue = gemColor & 0xff; - GL11.glColor3f((float) red / 255, - (float) green / 255, - (float) blue / 255); + GL11.glColor3f((float) red / 255, (float) green / 255, (float) blue / 255); GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_COLOR, - GL11.GL_ONE_MINUS_DST_COLOR); + GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE_MINUS_DST_COLOR); GL11.glPushMatrix(); - GL11.glTranslatef(this.gem.offsetX, - this.gem.offsetY, - this.gem.offsetZ); - GL11.glTranslatef(this.gem.rotationPointX * f5, - this.gem.rotationPointY * f5, - this.gem.rotationPointZ * f5); + GL11.glTranslatef(this.gem.offsetX, this.gem.offsetY, this.gem.offsetZ); + GL11.glTranslatef(this.gem.rotationPointX * f5, this.gem.rotationPointY * f5, this.gem.rotationPointZ * f5); GL11.glScaled(0.1D, 0.1D, 0.1D); - GL11.glTranslatef(-this.gem.offsetX, - -this.gem.offsetY, - -this.gem.offsetZ); - GL11.glTranslatef(-this.gem.rotationPointX * f5, - -this.gem.rotationPointY * f5, + GL11.glTranslatef(-this.gem.offsetX, -this.gem.offsetY, -this.gem.offsetZ); + GL11.glTranslatef(-this.gem.rotationPointX * f5, -this.gem.rotationPointY * f5, -this.gem.rotationPointZ * f5); this.gem.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); - GL11.glTranslatef(this.gem1.offsetX, - this.gem1.offsetY, - this.gem1.offsetZ); - GL11.glTranslatef(this.gem1.rotationPointX * f5, - this.gem1.rotationPointY * f5, + GL11.glTranslatef(this.gem1.offsetX, this.gem1.offsetY, this.gem1.offsetZ); + GL11.glTranslatef(this.gem1.rotationPointX * f5, this.gem1.rotationPointY * f5, this.gem1.rotationPointZ * f5); GL11.glScaled(0.1D, 0.05D, 0.1D); - GL11.glTranslatef(-this.gem1.offsetX, - -this.gem1.offsetY, - -this.gem1.offsetZ); - GL11.glTranslatef(-this.gem1.rotationPointX * f5, - -this.gem1.rotationPointY * f5, + GL11.glTranslatef(-this.gem1.offsetX, -this.gem1.offsetY, -this.gem1.offsetZ); + GL11.glTranslatef(-this.gem1.rotationPointX * f5, -this.gem1.rotationPointY * f5, -this.gem1.rotationPointZ * f5); this.gem1.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); - GL11.glTranslatef(this.gem2.offsetX, - this.gem2.offsetY, - this.gem2.offsetZ); - GL11.glTranslatef(this.gem2.rotationPointX * f5, - this.gem2.rotationPointY * f5, + GL11.glTranslatef(this.gem2.offsetX, this.gem2.offsetY, this.gem2.offsetZ); + GL11.glTranslatef(this.gem2.rotationPointX * f5, this.gem2.rotationPointY * f5, this.gem2.rotationPointZ * f5); GL11.glScaled(0.1D, 0.05D, 0.1D); - GL11.glTranslatef(-this.gem2.offsetX, - -this.gem2.offsetY, - -this.gem2.offsetZ); - GL11.glTranslatef(-this.gem2.rotationPointX * f5, - -this.gem2.rotationPointY * f5, + GL11.glTranslatef(-this.gem2.offsetX, -this.gem2.offsetY, -this.gem2.offsetZ); + GL11.glTranslatef(-this.gem2.rotationPointX * f5, -this.gem2.rotationPointY * f5, -this.gem2.rotationPointZ * f5); this.gem2.render(f5); GL11.glPopMatrix(); @@ -165,11 +122,9 @@ public class ModelRing extends ModelBase { } /** - * This is a helper function from Tabula to set the rotation of - * model parts + * This is a helper function from Tabula to set the rotation of model parts */ - public void setRotateAngle(ModelRenderer modelRenderer, float x, - float y, float z) { + public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) { modelRenderer.rotateAngleX = x; modelRenderer.rotateAngleY = y; modelRenderer.rotateAngleZ = z; diff --git a/src/main/java/darkknight/jewelrycraft/model/ModelShadowEye.java b/src/main/java/darkknight/jewelrycraft/model/ModelShadowEye.java index 1ea7819..8116c45 100755 --- a/src/main/java/darkknight/jewelrycraft/model/ModelShadowEye.java +++ b/src/main/java/darkknight/jewelrycraft/model/ModelShadowEye.java @@ -13,16 +13,16 @@ import net.minecraft.entity.Entity; public class ModelShadowEye extends ModelBase { // fields - ModelRenderer Eye; - ModelRenderer Platform1; - ModelRenderer Platform2; - ModelRenderer Atachement1; - ModelRenderer Atachement2; - ModelRenderer Cable1; - ModelRenderer Cable2; - ModelRenderer Cable3; - ModelRenderer Cable4; - float field_82221_e, field_82220_d; + ModelRenderer Eye; + ModelRenderer Platform1; + ModelRenderer Platform2; + ModelRenderer Atachement1; + ModelRenderer Atachement2; + ModelRenderer Cable1; + ModelRenderer Cable2; + ModelRenderer Cable3; + ModelRenderer Cable4; + float field_82221_e, field_82220_d; /** * @@ -96,8 +96,7 @@ public class ModelShadowEye extends ModelBase { * @param f5 */ @Override - public void render(Entity entity, float f, float f1, float f2, - float f3, float f4, float f5) { + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { Platform1.render(f5); Platform2.render(f5); Atachement1.render(f5); @@ -121,20 +120,17 @@ public class ModelShadowEye extends ModelBase { Eye.rotateAngleX = 0F; Eye.rotateAngleZ = 0F; if (f3 == 0) - Eye.rotateAngleY = (float) (0.5F - * Math.PI); + Eye.rotateAngleY = (float) (0.5F * Math.PI); else if (f3 == 1) Eye.rotateAngleY = (float) (Math.PI); else if (f3 == 2) - Eye.rotateAngleY = (float) (1.5F - * Math.PI); + Eye.rotateAngleY = (float) (1.5F * Math.PI); else if (f3 == 3) Eye.rotateAngleY = (float) (0F * Math.PI); } } - public static float[] getRotation(double posX1, double posY1, - double posZ1, double posX2, double posY2, + public static float[] getRotation(double posX1, double posY1, double posZ1, double posX2, double posY2, double posZ2) { float[] rotation = new float[2]; double diffX = posX2 - posX1; @@ -149,11 +145,9 @@ public class ModelShadowEye extends ModelBase { } else if (diffZ >= 0.0D && diffX <= 0.0D) { yaw = Math.toDegrees(-Math.atan(diffX / diffZ)); } else if (diffZ <= 0.0D && diffX >= 0.0D) { - yaw = -90D + Math.toDegrees( - Math.atan(diffZ / diffX)); + yaw = -90D + Math.toDegrees(Math.atan(diffZ / diffX)); } else if (diffZ <= 0.0D && diffX <= 0.0D) { - yaw = 90D + Math.toDegrees( - Math.atan(diffZ / diffX)); + yaw = 90D + Math.toDegrees(Math.atan(diffZ / diffX)); } rotation[0] = (float) yaw; return rotation; @@ -165,8 +159,7 @@ public class ModelShadowEye extends ModelBase { * @param y * @param z */ - private void setRotation(ModelRenderer model, float x, float y, - float z) { + private void setRotation(ModelRenderer model, float x, float y, float z) { model.rotateAngleX = x; model.rotateAngleY = y; model.rotateAngleZ = z; diff --git a/src/main/java/darkknight/jewelrycraft/model/ModelShadowHand.java b/src/main/java/darkknight/jewelrycraft/model/ModelShadowHand.java index 28d48d7..116ba21 100755 --- a/src/main/java/darkknight/jewelrycraft/model/ModelShadowHand.java +++ b/src/main/java/darkknight/jewelrycraft/model/ModelShadowHand.java @@ -19,11 +19,8 @@ public class ModelShadowHand extends ModelHandPedestal { */ @Override protected void initPedestalRenderers() { - plinth = createModelRenderer(0, 0).addBox(-3, 6, -3, 6, 2, - 6); - base = createModelRenderer(0, 15).addBox(-2, 0, -2, 4, 6, - 4); - shaft = createModelRenderer(28, 0).addBox(-3, -4, -3, 6, 4, - 6); + plinth = createModelRenderer(0, 0).addBox(-3, 6, -3, 6, 2, 6); + base = createModelRenderer(0, 15).addBox(-2, 0, -2, 4, 6, 4); + shaft = createModelRenderer(28, 0).addBox(-3, -4, -3, 6, 4, 6); } }
\ No newline at end of file diff --git a/src/main/java/darkknight/jewelrycraft/model/ModelSmelter.java b/src/main/java/darkknight/jewelrycraft/model/ModelSmelter.java index b5e3baf..7489cf3 100755 --- a/src/main/java/darkknight/jewelrycraft/model/ModelSmelter.java +++ b/src/main/java/darkknight/jewelrycraft/model/ModelSmelter.java @@ -6,36 +6,36 @@ import net.minecraft.entity.Entity; public class ModelSmelter extends ModelBase { // fields - ModelRenderer Support1; - ModelRenderer Support2; - ModelRenderer Hold1; - ModelRenderer Hold2; - ModelRenderer SmelterBase; - ModelRenderer SmelterSide1; - ModelRenderer SmelterSide2; - ModelRenderer SmelterSide3; - ModelRenderer SmelterSide4; - ModelRenderer SmelterSide5; - ModelRenderer SmelterSide6; - ModelRenderer SmelterSide7; - ModelRenderer SmelterSide8; - ModelRenderer SmelterSide9; - ModelRenderer SmelterSide10; - ModelRenderer SmelterSide11; - ModelRenderer SmelterSide12; - ModelRenderer HeatSourceSide1; - ModelRenderer HeatSourceSide2; - ModelRenderer HeatSourceSide3; - ModelRenderer HeatSourceSide4; - ModelRenderer HeatSourceSide5; - ModelRenderer HeatSourceBase; - ModelRenderer HeatSourceSide6; - ModelRenderer HeatSourceSide7; - ModelRenderer HeatSourceSide8; - ModelRenderer HeatSourceSide9; - ModelRenderer HeatSourceSide10; - ModelRenderer HeatSourceSide11; - ModelRenderer HeatSourceSide12; + ModelRenderer Support1; + ModelRenderer Support2; + ModelRenderer Hold1; + ModelRenderer Hold2; + ModelRenderer SmelterBase; + ModelRenderer SmelterSide1; + ModelRenderer SmelterSide2; + ModelRenderer SmelterSide3; + ModelRenderer SmelterSide4; + ModelRenderer SmelterSide5; + ModelRenderer SmelterSide6; + ModelRenderer SmelterSide7; + ModelRenderer SmelterSide8; + ModelRenderer SmelterSide9; + ModelRenderer SmelterSide10; + ModelRenderer SmelterSide11; + ModelRenderer SmelterSide12; + ModelRenderer HeatSourceSide1; + ModelRenderer HeatSourceSide2; + ModelRenderer HeatSourceSide3; + ModelRenderer HeatSourceSide4; + ModelRenderer HeatSourceSide5; + ModelRenderer HeatSourceBase; + ModelRenderer HeatSourceSide6; + ModelRenderer HeatSourceSide7; + ModelRenderer HeatSourceSide8; + ModelRenderer HeatSourceSide9; + ModelRenderer HeatSourceSide10; + ModelRenderer HeatSourceSide11; + ModelRenderer HeatSourceSide12; /** * @@ -235,8 +235,7 @@ public class ModelSmelter extends ModelBase { * @param f5 */ @Override - public void render(Entity entity, float f, float f1, float f2, - float f3, float f4, float f5) { + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { super.render(entity, f, f1, f2, f3, f4, f5); setRotationAngles(f, f1, f2, f3, f4, f5); Support1.render(f5); @@ -277,8 +276,7 @@ public class ModelSmelter extends ModelBase { * @param y * @param z */ - private void setRotation(ModelRenderer model, float x, float y, - float z) { + private void setRotation(ModelRenderer model, float x, float y, float z) { model.rotateAngleX = x; model.rotateAngleY = y; model.rotateAngleZ = z; @@ -292,8 +290,7 @@ public class ModelSmelter extends ModelBase { * @param f4 * @param f5 */ - public void setRotationAngles(float f, float f1, float f2, - float f3, float f4, float f5) { + public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5) { super.setRotationAngles(f, f1, f2, f3, f4, f5, null); } } diff --git a/src/main/java/darkknight/jewelrycraft/network/PacketHandler.java b/src/main/java/darkknight/jewelrycraft/network/PacketHandler.java index c9fefa3..fe65843 100755 --- a/src/main/java/darkknight/jewelrycraft/network/PacketHandler.java +++ b/src/main/java/darkknight/jewelrycraft/network/PacketHandler.java @@ -9,30 +9,18 @@ import darkknight.jewelrycraft.util.Variables; public class PacketHandler {
public static void preInit(FMLPreInitializationEvent e) {
- JewelrycraftMod.netWrapper = NetworkRegistry.INSTANCE
- .newSimpleChannel(Variables.MODID);
- JewelrycraftMod.netWrapper.registerMessage(
- PacketKeyPressEvent.class,
- PacketKeyPressEvent.class, 3, Side.SERVER);
- JewelrycraftMod.netWrapper.registerMessage(
- PacketRequestPlayerInfo.class,
- PacketRequestPlayerInfo.class, 4,
+ JewelrycraftMod.netWrapper = NetworkRegistry.INSTANCE.newSimpleChannel(Variables.MODID);
+ JewelrycraftMod.netWrapper.registerMessage(PacketKeyPressEvent.class, PacketKeyPressEvent.class, 3,
Side.SERVER);
- JewelrycraftMod.netWrapper.registerMessage(
- PacketSendClientPlayerInfo.class,
- PacketSendClientPlayerInfo.class, 5,
- Side.CLIENT);
- JewelrycraftMod.netWrapper.registerMessage(
- PacketSendServerPlayersInfo.class,
- PacketSendServerPlayersInfo.class, 6,
- Side.CLIENT);
- JewelrycraftMod.netWrapper.registerMessage(
- PacketRequestSetSlot.class,
- PacketRequestSetSlot.class, 7,
+ JewelrycraftMod.netWrapper.registerMessage(PacketRequestPlayerInfo.class, PacketRequestPlayerInfo.class, 4,
Side.SERVER);
- JewelrycraftMod.netWrapper.registerMessage(
- PacketSendServerPlayerInfo.class,
- PacketSendServerPlayerInfo.class, 8,
+ JewelrycraftMod.netWrapper.registerMessage(PacketSendClientPlayerInfo.class, PacketSendClientPlayerInfo.class,
+ 5, Side.CLIENT);
+ JewelrycraftMod.netWrapper.registerMessage(PacketSendServerPlayersInfo.class, PacketSendServerPlayersInfo.class,
+ 6, Side.CLIENT);
+ JewelrycraftMod.netWrapper.registerMessage(PacketRequestSetSlot.class, PacketRequestSetSlot.class, 7,
Side.SERVER);
+ JewelrycraftMod.netWrapper.registerMessage(PacketSendServerPlayerInfo.class, PacketSendServerPlayerInfo.class,
+ 8, Side.SERVER);
}
}
diff --git a/src/main/java/darkknight/jewelrycraft/network/PacketKeyPressEvent.java b/src/main/java/darkknight/jewelrycraft/network/PacketKeyPressEvent.java index d90cf1a..1ef3fb9 100755 --- a/src/main/java/darkknight/jewelrycraft/network/PacketKeyPressEvent.java +++ b/src/main/java/darkknight/jewelrycraft/network/PacketKeyPressEvent.java @@ -7,8 +7,7 @@ import darkknight.jewelrycraft.JewelrycraftMod; import io.netty.buffer.ByteBuf;
import net.minecraft.entity.player.EntityPlayer;
-public class PacketKeyPressEvent implements IMessage,
- IMessageHandler<PacketKeyPressEvent, IMessage> {
+public class PacketKeyPressEvent implements IMessage, IMessageHandler<PacketKeyPressEvent, IMessage> {
public int actionID;
/**
@@ -30,19 +29,14 @@ public class PacketKeyPressEvent implements IMessage, * @return
*/
@Override
- public IMessage onMessage(PacketKeyPressEvent message,
- MessageContext ctx) {
+ public IMessage onMessage(PacketKeyPressEvent message, MessageContext ctx) {
EntityPlayer sender = ctx.getServerHandler().playerEntity;
// Jewelry inventory
if (message.actionID == 0)
- sender.openGui(JewelrycraftMod.instance, 2,
- sender.worldObj, (int) sender.posX,
- (int) sender.posY,
+ sender.openGui(JewelrycraftMod.instance, 2, sender.worldObj, (int) sender.posX, (int) sender.posY,
(int) sender.posZ);
if (message.actionID == 1)
- sender.openGui(JewelrycraftMod.instance, 4,
- sender.worldObj, (int) sender.posX,
- (int) sender.posY,
+ sender.openGui(JewelrycraftMod.instance, 4, sender.worldObj, (int) sender.posX, (int) sender.posY,
(int) sender.posZ);
return null;
}
diff --git a/src/main/java/darkknight/jewelrycraft/network/PacketRequestPlayerInfo.java b/src/main/java/darkknight/jewelrycraft/network/PacketRequestPlayerInfo.java index 393647f..f2afc1b 100755 --- a/src/main/java/darkknight/jewelrycraft/network/PacketRequestPlayerInfo.java +++ b/src/main/java/darkknight/jewelrycraft/network/PacketRequestPlayerInfo.java @@ -7,8 +7,7 @@ import darkknight.jewelrycraft.util.PlayerUtils; import darkknight.jewelrycraft.util.Variables;
import io.netty.buffer.ByteBuf;
-public class PacketRequestPlayerInfo implements IMessage,
- IMessageHandler<PacketRequestPlayerInfo, IMessage> {
+public class PacketRequestPlayerInfo implements IMessage, IMessageHandler<PacketRequestPlayerInfo, IMessage> {
/**
*
@@ -22,12 +21,9 @@ public class PacketRequestPlayerInfo implements IMessage, * @return
*/
@Override
- public IMessage onMessage(PacketRequestPlayerInfo message,
- MessageContext ctx) {
+ public IMessage onMessage(PacketRequestPlayerInfo message, MessageContext ctx) {
return new PacketSendClientPlayerInfo(
- PlayerUtils.getModPlayerPersistTag(ctx
- .getServerHandler().playerEntity,
- Variables.MODID));
+ PlayerUtils.getModPlayerPersistTag(ctx.getServerHandler().playerEntity, Variables.MODID));
}
/**
diff --git a/src/main/java/darkknight/jewelrycraft/network/PacketRequestSetSlot.java b/src/main/java/darkknight/jewelrycraft/network/PacketRequestSetSlot.java index d335b6a..b7fd8eb 100755 --- a/src/main/java/darkknight/jewelrycraft/network/PacketRequestSetSlot.java +++ b/src/main/java/darkknight/jewelrycraft/network/PacketRequestSetSlot.java @@ -15,8 +15,7 @@ import net.minecraft.item.ItemStack; * @author Sorin
*
*/
-public class PacketRequestSetSlot implements IMessage,
- IMessageHandler<PacketRequestSetSlot, IMessage> {
+public class PacketRequestSetSlot implements IMessage, IMessageHandler<PacketRequestSetSlot, IMessage> {
ItemStack stack;
public PacketRequestSetSlot() {
@@ -32,14 +31,10 @@ public class PacketRequestSetSlot implements IMessage, * @return
*/
@Override
- public IMessage onMessage(PacketRequestSetSlot message,
- MessageContext ctx) {
+ public IMessage onMessage(PacketRequestSetSlot message, MessageContext ctx) {
if (ctx.getServerHandler().playerEntity.openContainer instanceof ContainerJewelryModifier) {
- ((ContainerJewelryModifier) ctx
- .getServerHandler().playerEntity.openContainer).modInv
- .setInventorySlotContents(
- 36,
- message.stack);
+ ((ContainerJewelryModifier) ctx.getServerHandler().playerEntity.openContainer).modInv
+ .setInventorySlotContents(36, message.stack);
}
return null;
}
diff --git a/src/main/java/darkknight/jewelrycraft/network/PacketSendClientPlayerInfo.java b/src/main/java/darkknight/jewelrycraft/network/PacketSendClientPlayerInfo.java index 21000de..fea1d9b 100755 --- a/src/main/java/darkknight/jewelrycraft/network/PacketSendClientPlayerInfo.java +++ b/src/main/java/darkknight/jewelrycraft/network/PacketSendClientPlayerInfo.java @@ -8,8 +8,7 @@ import darkknight.jewelrycraft.events.ScreenHandler; import io.netty.buffer.ByteBuf;
import net.minecraft.nbt.NBTTagCompound;
-public class PacketSendClientPlayerInfo implements IMessage,
- IMessageHandler<PacketSendClientPlayerInfo, IMessage> {
+public class PacketSendClientPlayerInfo implements IMessage, IMessageHandler<PacketSendClientPlayerInfo, IMessage> {
public NBTTagCompound tagCompound;
/**
@@ -31,8 +30,7 @@ public class PacketSendClientPlayerInfo implements IMessage, * @return
*/
@Override
- public IMessage onMessage(PacketSendClientPlayerInfo message,
- MessageContext ctx) {
+ public IMessage onMessage(PacketSendClientPlayerInfo message, MessageContext ctx) {
ScreenHandler.tagCache = message.tagCompound;
return null;
}
diff --git a/src/main/java/darkknight/jewelrycraft/network/PacketSendServerPlayerInfo.java b/src/main/java/darkknight/jewelrycraft/network/PacketSendServerPlayerInfo.java index bf3ce1a..52df853 100755 --- a/src/main/java/darkknight/jewelrycraft/network/PacketSendServerPlayerInfo.java +++ b/src/main/java/darkknight/jewelrycraft/network/PacketSendServerPlayerInfo.java @@ -10,16 +10,14 @@ import io.netty.buffer.ByteBuf; import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.nbt.NBTTagCompound;
-public class PacketSendServerPlayerInfo implements IMessage,
- IMessageHandler<PacketSendServerPlayerInfo, IMessage> {
- public NBTTagCompound tagCompound;
- public String curse, action;
+public class PacketSendServerPlayerInfo implements IMessage, IMessageHandler<PacketSendServerPlayerInfo, IMessage> {
+ public NBTTagCompound tagCompound;
+ public String curse, action;
/**
* @param tagCompound
*/
- public PacketSendServerPlayerInfo(String action, String curse,
- NBTTagCompound tagCompound) {
+ public PacketSendServerPlayerInfo(String action, String curse, NBTTagCompound tagCompound) {
this.tagCompound = tagCompound;
this.curse = curse;
this.action = action;
@@ -37,22 +35,13 @@ public class PacketSendServerPlayerInfo implements IMessage, * @return
*/
@Override
- public IMessage onMessage(PacketSendServerPlayerInfo message,
- MessageContext ctx) {
- EntityPlayerMP serverPlayer = ctx
- .getServerHandler().playerEntity;
- NBTTagCompound playerInfo = PlayerUtils
- .getModPlayerPersistTag(serverPlayer,
- Variables.MODID);
- playerInfo.setInteger(message.curse,
- message.action.equals("remove") ? 0 : 1);
- playerInfo.setInteger("activeCurses", message.tagCompound
- .getInteger("activeCurses"));
- System.out.println(message.action + " " + message.curse
- + " "
- + message.tagCompound.getInteger(curse)
- + " " + message.tagCompound.getInteger(
- "activeCurses"));
+ public IMessage onMessage(PacketSendServerPlayerInfo message, MessageContext ctx) {
+ EntityPlayerMP serverPlayer = ctx.getServerHandler().playerEntity;
+ NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(serverPlayer, Variables.MODID);
+ playerInfo.setInteger(message.curse, message.action.equals("remove") ? 0 : 1);
+ playerInfo.setInteger("activeCurses", message.tagCompound.getInteger("activeCurses"));
+ System.out.println(message.action + " " + message.curse + " " + message.tagCompound.getInteger(curse) + " "
+ + message.tagCompound.getInteger("activeCurses"));
return null;
}
diff --git a/src/main/java/darkknight/jewelrycraft/network/PacketSendServerPlayersInfo.java b/src/main/java/darkknight/jewelrycraft/network/PacketSendServerPlayersInfo.java index 5b67e59..836dabc 100755 --- a/src/main/java/darkknight/jewelrycraft/network/PacketSendServerPlayersInfo.java +++ b/src/main/java/darkknight/jewelrycraft/network/PacketSendServerPlayersInfo.java @@ -21,8 +21,7 @@ import net.minecraft.server.MinecraftServer; * @author Sorin
*
*/
-public class PacketSendServerPlayersInfo implements IMessage,
- IMessageHandler<PacketSendServerPlayersInfo, IMessage> {
+public class PacketSendServerPlayersInfo implements IMessage, IMessageHandler<PacketSendServerPlayersInfo, IMessage> {
public PacketSendServerPlayersInfo() {
}
@@ -33,8 +32,7 @@ public class PacketSendServerPlayersInfo implements IMessage, * @return
*/
@Override
- public IMessage onMessage(PacketSendServerPlayersInfo message,
- MessageContext ctx) {
+ public IMessage onMessage(PacketSendServerPlayersInfo message, MessageContext ctx) {
return null;
}
@@ -55,17 +53,12 @@ public class PacketSendServerPlayersInfo implements IMessage, */
@Override
public void toBytes(ByteBuf buf) {
- Iterator<EntityPlayer> players = MinecraftServer
- .getServer()
- .getConfigurationManager().playerEntityList
- .iterator();
+ Iterator<EntityPlayer> players = MinecraftServer.getServer().getConfigurationManager().playerEntityList
+ .iterator();
NBTTagCompound nbt = new NBTTagCompound();
while (players.hasNext()) {
EntityPlayer current = players.next();
- nbt.setTag(current.getDisplayName(),
- PlayerUtils.getModPlayerPersistTag(
- current,
- Variables.MODID));
+ nbt.setTag(current.getDisplayName(), PlayerUtils.getModPlayerPersistTag(current, Variables.MODID));
}
ByteBufUtils.writeTag(buf, nbt);
}
diff --git a/src/main/java/darkknight/jewelrycraft/particles/EntityFlatShadowFX.java b/src/main/java/darkknight/jewelrycraft/particles/EntityFlatShadowFX.java index 2fd304d..59ad161 100755 --- a/src/main/java/darkknight/jewelrycraft/particles/EntityFlatShadowFX.java +++ b/src/main/java/darkknight/jewelrycraft/particles/EntityFlatShadowFX.java @@ -9,8 +9,8 @@ import net.minecraft.util.ResourceLocation; import net.minecraft.world.World;
public class EntityFlatShadowFX extends EntityFX {
- float moteParticleScale;
- ResourceLocation texture;
+ float moteParticleScale;
+ ResourceLocation texture;
/**
* @param world
@@ -21,12 +21,10 @@ public class EntityFlatShadowFX extends EntityFX { * @param maxAge
* @param texture
*/
- public EntityFlatShadowFX(World world, double x, double y,
- double z, float size, float maxAge,
+ public EntityFlatShadowFX(World world, double x, double y, double z, float size, float maxAge,
ResourceLocation texture) {
super(world, x, y, z, 0D, 0D, 0D);
- particleMaxAge = (int) (28D / (Math.random() * 0.3D + 0.7D)
- * maxAge);
+ particleMaxAge = (int) (28D / (Math.random() * 0.3D + 0.7D) * maxAge);
particleGravity = 0F;
motionX = motionY = motionZ = 0;
particleScale = size;
@@ -45,37 +43,27 @@ public class EntityFlatShadowFX extends EntityFX { * @param maxZ
*/
@Override
- public void renderParticle(Tessellator tessellator,
- float partialTicks, float minX, float minY,
- float minZ, float maxX, float maxZ) {
+ public void renderParticle(Tessellator tessellator, float partialTicks, float minX, float minY, float minZ,
+ float maxX, float maxZ) {
tessellator.draw();
Minecraft.getMinecraft().renderEngine.bindTexture(texture);
tessellator.startDrawingQuads();
GL11.glEnable(GL11.GL_BLEND);
- GL11.glBlendFunc(GL11.GL_SRC_ALPHA,
- GL11.GL_ONE_MINUS_SRC_ALPHA);
+ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glDepthMask(false);
float scale = 1F * particleScale;
float x = (float) (posX - interpPosX);
float y = (float) (posX - interpPosY);
float z = (float) (posZ - interpPosZ);
tessellator.setColorRGBA_F(0F, 0F, 0F, 1F);
- tessellator.addVertexWithUV(
- x - minX * scale - maxX * scale,
- y + minY * scale,
- z - minZ * scale - maxZ * scale, 0, 0);
- tessellator.addVertexWithUV(
- x - minX * scale + maxX * scale,
- y + minY * scale,
- z - minZ * scale + maxZ * scale, 1, 0);
- tessellator.addVertexWithUV(
- x + minX * scale + maxX * scale,
- y + minY * scale,
- z + minZ * scale + maxZ * scale, 1, 1);
- tessellator.addVertexWithUV(
- x + minX * scale - maxX * scale,
- y + minY * scale,
- z + minZ * scale - maxZ * scale, 0, 1);
+ tessellator.addVertexWithUV(x - minX * scale - maxX * scale, y + minY * scale, z - minZ * scale - maxZ * scale,
+ 0, 0);
+ tessellator.addVertexWithUV(x - minX * scale + maxX * scale, y + minY * scale, z - minZ * scale + maxZ * scale,
+ 1, 0);
+ tessellator.addVertexWithUV(x + minX * scale + maxX * scale, y + minY * scale, z + minZ * scale + maxZ * scale,
+ 1, 1);
+ tessellator.addVertexWithUV(x + minX * scale - maxX * scale, y + minY * scale, z + minZ * scale - maxZ * scale,
+ 0, 1);
tessellator.draw();
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glDisable(GL11.GL_BLEND);
diff --git a/src/main/java/darkknight/jewelrycraft/particles/EntityShadowsFX.java b/src/main/java/darkknight/jewelrycraft/particles/EntityShadowsFX.java index 6157927..e29530e 100755 --- a/src/main/java/darkknight/jewelrycraft/particles/EntityShadowsFX.java +++ b/src/main/java/darkknight/jewelrycraft/particles/EntityShadowsFX.java @@ -16,8 +16,8 @@ import net.minecraft.util.ResourceLocation; import net.minecraft.world.World;
public class EntityShadowsFX extends EntityFX {
- float moteParticleScale;
- ResourceLocation texture;
+ float moteParticleScale;
+ ResourceLocation texture;
/**
* @param world
@@ -28,12 +28,10 @@ public class EntityShadowsFX extends EntityFX { * @param maxAge
* @param texture
*/
- public EntityShadowsFX(World world, double x, double y, double z,
- float size, float maxAge,
+ public EntityShadowsFX(World world, double x, double y, double z, float size, float maxAge,
ResourceLocation texture) {
super(world, x, y, z, 0D, 0D, 0D);
- particleMaxAge = (int) (28D / (Math.random() * 0.3D + 0.7D)
- * maxAge);
+ particleMaxAge = (int) (28D / (Math.random() * 0.3D + 0.7D) * maxAge);
particleGravity = 0F;
motionX = motionY = motionZ = 0;
particleScale *= size;
@@ -53,9 +51,8 @@ public class EntityShadowsFX extends EntityFX { * @param maxZ
*/
@Override
- public void renderParticle(Tessellator tessellator,
- float partialTicks, float minX, float minY,
- float minZ, float maxX, float maxZ) {
+ public void renderParticle(Tessellator tessellator, float partialTicks, float minX, float minY, float minZ,
+ float maxX, float maxZ) {
tessellator.draw();
Minecraft.getMinecraft().renderEngine.bindTexture(texture);
GL11.glColor4f(1, 1, 1, 1);
@@ -66,22 +63,14 @@ public class EntityShadowsFX extends EntityFX { float y = (float) (posY - interpPosY);
float z = (float) (posZ - interpPosZ);
tessellator.setColorRGBA_F(0F, 0F, 0F, 0.5F);
- tessellator.addVertexWithUV(
- x - minX * scale - maxX * scale,
- y - minY * scale,
- z - minZ * scale - maxZ * scale, 0, 0);
- tessellator.addVertexWithUV(
- x - minX * scale + maxX * scale,
- y + minY * scale,
- z - minZ * scale + maxZ * scale, 1, 0);
- tessellator.addVertexWithUV(
- x + minX * scale + maxX * scale,
- y + minY * scale,
- z + minZ * scale + maxZ * scale, 1, 1);
- tessellator.addVertexWithUV(
- x + minX * scale - maxX * scale,
- y - minY * scale,
- z + minZ * scale - maxZ * scale, 0, 1);
+ tessellator.addVertexWithUV(x - minX * scale - maxX * scale, y - minY * scale, z - minZ * scale - maxZ * scale,
+ 0, 0);
+ tessellator.addVertexWithUV(x - minX * scale + maxX * scale, y + minY * scale, z - minZ * scale + maxZ * scale,
+ 1, 0);
+ tessellator.addVertexWithUV(x + minX * scale + maxX * scale, y + minY * scale, z + minZ * scale + maxZ * scale,
+ 1, 1);
+ tessellator.addVertexWithUV(x + minX * scale - maxX * scale, y - minY * scale, z + minZ * scale - maxZ * scale,
+ 0, 1);
tessellator.draw();
tessellator.startDrawingQuads();
}
@@ -97,30 +86,17 @@ public class EntityShadowsFX extends EntityFX { motionX = motionY = motionZ = 0;
if (particleAge++ >= particleMaxAge)
setDead();
- AxisAlignedBB axisalignedbb = boundingBox.expand(16.0D,
- 16.0D, 16.0D);
- List<?> list1 = worldObj.getEntitiesWithinAABB(
- Entity.class, axisalignedbb);
- if (!worldObj.isRemote && list1 != null
- && !list1.isEmpty()) {
+ AxisAlignedBB axisalignedbb = boundingBox.expand(16.0D, 16.0D, 16.0D);
+ List<?> list1 = worldObj.getEntitiesWithinAABB(Entity.class, axisalignedbb);
+ if (!worldObj.isRemote && list1 != null && !list1.isEmpty()) {
Iterator<?> iterator = list1.iterator();
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();
- if (entity != null
- && posX <= entity.posX
- + 0.5F
- && posX >= entity.posX
- - 0.5F
- && posZ <= entity.posZ
- + 0.5F
- && posZ >= entity.posZ
- - 0.5F)
- entity.attackEntityFrom(
- DamageSourceList.shadows,
- 100F);
+ if (entity != null && posX <= entity.posX + 0.5F && posX >= entity.posX - 0.5F
+ && posZ <= entity.posZ + 0.5F && posZ >= entity.posZ - 0.5F)
+ entity.attackEntityFrom(DamageSourceList.shadows, 100F);
if (entity instanceof EntityThrowable)
- ((EntityThrowable) entity)
- .setDead();
+ ((EntityThrowable) entity).setDead();
}
}
}
diff --git a/src/main/java/darkknight/jewelrycraft/potions/PotionList.java b/src/main/java/darkknight/jewelrycraft/potions/PotionList.java index 53c768e..f6d5739 100755 --- a/src/main/java/darkknight/jewelrycraft/potions/PotionList.java +++ b/src/main/java/darkknight/jewelrycraft/potions/PotionList.java @@ -23,9 +23,7 @@ public class PotionList { if (Potion.potionTypes.length > 231) {
stun = new PotionStun(230, true, 0x000000);
} else {
- stun = new PotionStun(
- Potion.potionTypes.length - 2,
- true, 0x000000);
+ stun = new PotionStun(Potion.potionTypes.length - 2, true, 0x000000);
}
}
diff --git a/src/main/java/darkknight/jewelrycraft/potions/PotionStun.java b/src/main/java/darkknight/jewelrycraft/potions/PotionStun.java index a0fca81..7bc304f 100755 --- a/src/main/java/darkknight/jewelrycraft/potions/PotionStun.java +++ b/src/main/java/darkknight/jewelrycraft/potions/PotionStun.java @@ -35,12 +35,10 @@ public class PotionStun extends PotionBase { entity.rotationPitch = entity.prevRotationPitch;
entity.rotationYaw = entity.prevRotationYaw;
- entity.worldObj.spawnParticle("spell", entity.posX,
- entity.posY + entity.getEyeHeight(),
- entity.posZ, 0.0D, 0.3D, 0.0D);
+ entity.worldObj.spawnParticle("spell", entity.posX, entity.posY + entity.getEyeHeight(), entity.posZ, 0.0D,
+ 0.3D, 0.0D);
- if (entity.getActivePotionEffect(PotionList.stun)
- .getDuration() == 0) {
+ if (entity.getActivePotionEffect(PotionList.stun).getDuration() == 0) {
entity.removePotionEffect(PotionList.stun.id);
}
}
diff --git a/src/main/java/darkknight/jewelrycraft/proxy/ClientProxy.java b/src/main/java/darkknight/jewelrycraft/proxy/ClientProxy.java index f7a6842..3da7ebd 100755 --- a/src/main/java/darkknight/jewelrycraft/proxy/ClientProxy.java +++ b/src/main/java/darkknight/jewelrycraft/proxy/ClientProxy.java @@ -22,31 +22,9 @@ import darkknight.jewelrycraft.events.ScreenHandler; import darkknight.jewelrycraft.events.TextureEvent;
import darkknight.jewelrycraft.item.ItemList;
import darkknight.jewelrycraft.item.render.ItemRender;
-import darkknight.jewelrycraft.model.ModelDisplayer;
-import darkknight.jewelrycraft.model.ModelHalfHeart;
-import darkknight.jewelrycraft.model.ModelHandPedestal;
-import darkknight.jewelrycraft.model.ModelHeart;
-import darkknight.jewelrycraft.model.ModelJewlersCraftingBench;
-import darkknight.jewelrycraft.model.ModelMolder;
-import darkknight.jewelrycraft.model.ModelShadowEye;
-import darkknight.jewelrycraft.model.ModelShadowHand;
-import darkknight.jewelrycraft.model.ModelSmelter;
-import darkknight.jewelrycraft.tileentity.TileEntityDisplayer;
-import darkknight.jewelrycraft.tileentity.TileEntityHandPedestal;
-import darkknight.jewelrycraft.tileentity.TileEntityJewelrsCraftingTable;
-import darkknight.jewelrycraft.tileentity.TileEntityMidasTouch;
-import darkknight.jewelrycraft.tileentity.TileEntityMolder;
-import darkknight.jewelrycraft.tileentity.TileEntityShadowEye;
-import darkknight.jewelrycraft.tileentity.TileEntityShadowHand;
-import darkknight.jewelrycraft.tileentity.TileEntitySmelter;
-import darkknight.jewelrycraft.tileentity.renders.TileEntityDisplayerRender;
-import darkknight.jewelrycraft.tileentity.renders.TileEntityHandPedestalRender;
-import darkknight.jewelrycraft.tileentity.renders.TileEntityJewelrsCraftingTableRender;
-import darkknight.jewelrycraft.tileentity.renders.TileEntityMidasTouchRender;
-import darkknight.jewelrycraft.tileentity.renders.TileEntityMolderRender;
-import darkknight.jewelrycraft.tileentity.renders.TileEntityShadowEyeRender;
-import darkknight.jewelrycraft.tileentity.renders.TileEntityShadowHandRender;
-import darkknight.jewelrycraft.tileentity.renders.TileEntitySmelterRender;
+import darkknight.jewelrycraft.model.*;
+import darkknight.jewelrycraft.tileentity.*;
+import darkknight.jewelrycraft.tileentity.renders.*;
import darkknight.jewelrycraft.util.JewelrycraftUtil;
import darkknight.jewelrycraft.util.Variables;
import net.minecraft.client.Minecraft;
@@ -72,123 +50,65 @@ public class ClientProxy extends CommonProxy { @Override
public void preInit() {
TileEntityHandPedestalRender pedestalRender = new TileEntityHandPedestalRender(
- new ModelHandPedestal(
- Variables.PEDESTAL_TEXTURE),
- Variables.PEDESTAL_TEXTURE);
+ new ModelHandPedestal(Variables.PEDESTAL_TEXTURE), Variables.PEDESTAL_TEXTURE);
TileEntityShadowHandRender shadowHandRender = new TileEntityShadowHandRender(
- new ModelShadowHand(
- Variables.SHADOW_HAND_TEXTURE),
- Variables.SHADOW_HAND_TEXTURE);
+ new ModelShadowHand(Variables.SHADOW_HAND_TEXTURE), Variables.SHADOW_HAND_TEXTURE);
- JewelrycraftMod.logger.log(Level.INFO,
- "Binding Tileentities to their Special Rendered");
- ClientRegistry.bindTileEntitySpecialRenderer(
- TileEntitySmelter.class,
- new TileEntitySmelterRender());
- ClientRegistry.bindTileEntitySpecialRenderer(
- TileEntityMolder.class,
- new TileEntityMolderRender());
- ClientRegistry.bindTileEntitySpecialRenderer(
- TileEntityJewelrsCraftingTable.class,
+ JewelrycraftMod.logger.log(Level.INFO, "Binding Tileentities to their Special Rendered");
+ ClientRegistry.bindTileEntitySpecialRenderer(TileEntitySmelter.class, new TileEntitySmelterRender());
+ ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMolder.class, new TileEntityMolderRender());
+ ClientRegistry.bindTileEntitySpecialRenderer(TileEntityJewelrsCraftingTable.class,
new TileEntityJewelrsCraftingTableRender());
- ClientRegistry.bindTileEntitySpecialRenderer(
- TileEntityDisplayer.class,
- new TileEntityDisplayerRender());
- ClientRegistry.bindTileEntitySpecialRenderer(
- TileEntityShadowEye.class,
- new TileEntityShadowEyeRender());
- ClientRegistry.bindTileEntitySpecialRenderer(
- TileEntityMidasTouch.class,
- new TileEntityMidasTouchRender());
- ClientRegistry.bindTileEntitySpecialRenderer(
- TileEntityHandPedestal.class,
- pedestalRender);
- ClientRegistry.bindTileEntitySpecialRenderer(
- TileEntityShadowHand.class,
- shadowHandRender);
+ ClientRegistry.bindTileEntitySpecialRenderer(TileEntityDisplayer.class, new TileEntityDisplayerRender());
+ ClientRegistry.bindTileEntitySpecialRenderer(TileEntityShadowEye.class, new TileEntityShadowEyeRender());
+ ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMidasTouch.class, new TileEntityMidasTouchRender());
+ ClientRegistry.bindTileEntitySpecialRenderer(TileEntityHandPedestal.class, pedestalRender);
+ ClientRegistry.bindTileEntitySpecialRenderer(TileEntityShadowHand.class, shadowHandRender);
- JewelrycraftMod.logger.log(Level.INFO,
- "Registering Item Renderes");
- MinecraftForgeClient.registerItemRenderer(
- Item.getItemFromBlock(BlockList.displayer),
- new ItemRender(new TileEntityDisplayerRender(),
- new TileEntityDisplayer(),
- new ModelDisplayer()));
- MinecraftForgeClient.registerItemRenderer(
- Item.getItemFromBlock(
- BlockList.jewelCraftingTable),
- new ItemRender(new TileEntityJewelrsCraftingTableRender(),
- new TileEntityJewelrsCraftingTable(),
+ JewelrycraftMod.logger.log(Level.INFO, "Registering Item Renderes");
+ MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(BlockList.displayer),
+ new ItemRender(new TileEntityDisplayerRender(), new TileEntityDisplayer(), new ModelDisplayer()));
+ MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(BlockList.jewelCraftingTable),
+ new ItemRender(new TileEntityJewelrsCraftingTableRender(), new TileEntityJewelrsCraftingTable(),
new ModelJewlersCraftingBench()));
- MinecraftForgeClient.registerItemRenderer(
- Item.getItemFromBlock(BlockList.smelter),
- new ItemRender(new TileEntitySmelterRender(),
- new TileEntitySmelter(),
- new ModelSmelter()));
- MinecraftForgeClient.registerItemRenderer(
- Item.getItemFromBlock(BlockList.molder),
- new ItemRender(new TileEntityMolderRender(),
- new TileEntityMolder(),
- new ModelMolder()));
- MinecraftForgeClient.registerItemRenderer(
- Item.getItemFromBlock(BlockList.shadowEye),
- new ItemRender(new TileEntityShadowEyeRender(),
- new TileEntityShadowEye(),
- new ModelShadowEye()));
- MinecraftForgeClient.registerItemRenderer(
- Item.getItemFromBlock(
- BlockList.handPedestal),
- new ItemRender(pedestalRender,
- new TileEntityHandPedestal(),
- new ModelHandPedestal(
- Variables.PEDESTAL_TEXTURE)));
- MinecraftForgeClient.registerItemRenderer(
- Item.getItemFromBlock(
- BlockList.shadowHand),
- new ItemRender(shadowHandRender,
- new TileEntityShadowHand(),
- new ModelShadowHand(
- Variables.SHADOW_HAND_TEXTURE)));
- MinecraftForgeClient.registerItemRenderer(ItemList.goldObj,
- new ItemRender());
+ MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(BlockList.smelter),
+ new ItemRender(new TileEntitySmelterRender(), new TileEntitySmelter(), new ModelSmelter()));
+ MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(BlockList.molder),
+ new ItemRender(new TileEntityMolderRender(), new TileEntityMolder(), new ModelMolder()));
+ MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(BlockList.shadowEye),
+ new ItemRender(new TileEntityShadowEyeRender(), new TileEntityShadowEye(), new ModelShadowEye()));
+ MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(BlockList.handPedestal), new ItemRender(
+ pedestalRender, new TileEntityHandPedestal(), new ModelHandPedestal(Variables.PEDESTAL_TEXTURE)));
+ MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(BlockList.shadowHand), new ItemRender(
+ shadowHandRender, new TileEntityShadowHand(), new ModelShadowHand(Variables.SHADOW_HAND_TEXTURE)));
+ MinecraftForgeClient.registerItemRenderer(ItemList.goldObj, new ItemRender());
- VillagerRegistry.instance().registerVillagerSkin(3000,
- Variables.VILLAGER_TEXTURE);
+ VillagerRegistry.instance().registerVillagerSkin(3000, Variables.VILLAGER_TEXTURE);
- JewelrycraftMod.logger.log(Level.INFO,
- "Registering Entity Renders");
- RenderingRegistry.registerEntityRenderingHandler(
- EntityHeart.class,
- new HeartRender(new ModelHeart(), 0.25F));
- RenderingRegistry.registerEntityRenderingHandler(
- EntityHalfHeart.class,
- new HeartRender(new ModelHalfHeart(),
- 0.25F));
+ JewelrycraftMod.logger.log(Level.INFO, "Registering Entity Renders");
+ RenderingRegistry.registerEntityRenderingHandler(EntityHeart.class, new HeartRender(new ModelHeart(), 0.25F));
+ RenderingRegistry.registerEntityRenderingHandler(EntityHalfHeart.class,
+ new HeartRender(new ModelHalfHeart(), 0.25F));
- RenderingRegistry.registerBlockHandler(
- new BlockCrystalRenderer());
+ RenderingRegistry.registerBlockHandler(new BlockCrystalRenderer());
TabRegistry.registerTab(new InventoryTabVanilla());
TabRegistry.registerTab(new TabJewelry());
TabRegistry.registerTab(new TabCurses());
MinecraftForge.EVENT_BUS.register(new TabRegistry());
- MinecraftForge.EVENT_BUS
- .register(new PlayerRenderHandler());
- MinecraftForge.EVENT_BUS.register(new ScreenHandler(
- Minecraft.getMinecraft()));
+ MinecraftForge.EVENT_BUS.register(new PlayerRenderHandler());
+ MinecraftForge.EVENT_BUS.register(new ScreenHandler(Minecraft.getMinecraft()));
}
@Override
public void init() {
- FMLCommonHandler.instance().bus()
- .register(new KeyBindings());
+ FMLCommonHandler.instance().bus().register(new KeyBindings());
MinecraftForge.EVENT_BUS.register(new TextureEvent());
}
@Override
public void postInit() {
- JewelrycraftMod.logger.log(Level.INFO,
- "Generating colors for each item");
+ JewelrycraftMod.logger.log(Level.INFO, "Generating colors for each item");
JewelrycraftUtil.generateColors();
}
}
diff --git a/src/main/java/darkknight/jewelrycraft/random/WeightedRandomItem.java b/src/main/java/darkknight/jewelrycraft/random/WeightedRandomItem.java index cc84ab4..351046b 100755 --- a/src/main/java/darkknight/jewelrycraft/random/WeightedRandomItem.java +++ b/src/main/java/darkknight/jewelrycraft/random/WeightedRandomItem.java @@ -6,8 +6,8 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.WeightedRandom;
public class WeightedRandomItem extends WeightedRandom.Item {
- private final ItemStack item;
- private int maxMeta, minMeta, minItem, maxItem;
+ private final ItemStack item;
+ private int maxMeta, minMeta, minItem, maxItem;
public WeightedRandomItem(ItemStack item, int weight) {
super(weight);
@@ -18,14 +18,12 @@ public class WeightedRandomItem extends WeightedRandom.Item { this.minMeta = 0;
}
- public WeightedRandomItem(ItemStack item, int maxMetadata,
- int weight) {
+ public WeightedRandomItem(ItemStack item, int maxMetadata, int weight) {
this(item, weight);
this.maxMeta = maxMetadata;
}
- public WeightedRandomItem(ItemStack item, int weight, int minItem,
- int maxItem) {
+ public WeightedRandomItem(ItemStack item, int weight, int minItem, int maxItem) {
this(item, weight);
this.minItem = minItem;
this.maxItem = maxItem;
@@ -54,13 +52,9 @@ public class WeightedRandomItem extends WeightedRandom.Item { public ItemStack getItem(Random random) {
ItemStack itemstack = this.item.copy();
if (maxMeta > 0)
- itemstack.setItemDamage(minMeta + random
- .nextInt(maxMeta - minMeta));
+ itemstack.setItemDamage(minMeta + random.nextInt(maxMeta - minMeta));
if (maxItem > 1)
- itemstack.stackSize = this.minItem
- + random.nextInt(this.maxItem
- - this.minItem
- + 1);
+ itemstack.stackSize = this.minItem + random.nextInt(this.maxItem - this.minItem + 1);
return itemstack;
}
}
\ No newline at end of file diff --git a/src/main/java/darkknight/jewelrycraft/recipes/CraftingRecipes.java b/src/main/java/darkknight/jewelrycraft/recipes/CraftingRecipes.java index ca2f2aa..f47e48e 100755 --- a/src/main/java/darkknight/jewelrycraft/recipes/CraftingRecipes.java +++ b/src/main/java/darkknight/jewelrycraft/recipes/CraftingRecipes.java @@ -18,153 +18,54 @@ public class CraftingRecipes { public static void preInit(FMLPreInitializationEvent e) {
if (!isInitialized) {
// Items
- GameRegistry.addRecipe(new ItemStack(
- ItemList.thiefGloves), "x x",
- "yxy", "yxy", 'x',
- ItemList.shadowIngot, 'y',
- new ItemStack(Blocks.wool, 1, 15));
+ GameRegistry.addRecipe(new ItemStack(ItemList.thiefGloves), "x x", "yxy", "yxy", 'x', ItemList.shadowIngot,
+ 'y', new ItemStack(Blocks.wool, 1, 15));
// Disable ingot molds for balance reasons
// GameRegistry.addRecipe(new
// ItemStack(ItemList.clayMolds, 1, 0),
// "xx", 'x', Items.clay_ball);
- GameRegistry.addRecipe(
- new ItemStack(ItemList.clayMolds,
- 1, 1),
- " x ", "x x", " x ", 'x',
- Items.clay_ball);
- GameRegistry.addRecipe(
- new ItemStack(ItemList.clayMolds,
- 1, 2),
- "x x", "x x", " x ", 'x',
- Items.clay_ball);
- GameRegistry.addRecipe(
- new ItemStack(ItemList.clayMolds,
- 1, 3),
- "xxx", "x x", "xxx", 'x',
- Items.clay_ball);
- GameRegistry.addRecipe(
- new ItemStack(ItemList.clayMolds,
- 1, 4),
- "x x", 'x', Items.clay_ball);
- GameRegistry.addRecipe(new ItemStack(
- BlockList.handPedestal), "bbb",
- " x ", "yxy", 'x',
- Blocks.stonebrick, 'y',
- new ItemStack(Blocks.stone_slab, 1,
- 5),
- 'b', Blocks.cobblestone_wall);
- GameRegistry.addRecipe(
- new ItemStack(BlockList.shadowEye),
- "bcb", "cec", "bcb", 'b',
- Blocks.stonebrick, 'c',
- new ItemStack(Blocks.stained_hardened_clay,
- 1, 15),
- 'e', Items.ender_eye);
- GameRegistry.addShapelessRecipe(
- new ItemStack(ItemList.shadowIngot,
- 9),
- new Object[] {
- new ItemStack(BlockList.shadowBlock)
- });
- GameRegistry.addShapelessRecipe(
- new ItemStack(ItemList.guide),
- new Object[] {
- new ItemStack(Items.book),
- new ItemStack(ItemList.molds,
- 1,
- 0)
- });
- GameRegistry.addShapelessRecipe(
- new ItemStack(ItemList.guide),
- new Object[] {
- new ItemStack(Items.book),
- new ItemStack(ItemList.molds,
- 1,
- 1)
- });
- GameRegistry.addShapelessRecipe(
- new ItemStack(ItemList.guide),
- new Object[] {
- new ItemStack(Items.book),
- new ItemStack(ItemList.molds,
- 1,
- 2)
- });
- GameRegistry.addShapelessRecipe(
- new ItemStack(ItemList.guide),
- new Object[] {
- new ItemStack(Items.book),
- new ItemStack(ItemList.molds,
- 1,
- 3)
- });
- GameRegistry.addShapelessRecipe(
- new ItemStack(ItemList.guide),
- new Object[] {
- new ItemStack(Items.book),
- new ItemStack(ItemList.molds,
- 1,
- 4)
- });
+ GameRegistry.addRecipe(new ItemStack(ItemList.clayMolds, 1, 1), " x ", "x x", " x ", 'x', Items.clay_ball);
+ GameRegistry.addRecipe(new ItemStack(ItemList.clayMolds, 1, 2), "x x", "x x", " x ", 'x', Items.clay_ball);
+ GameRegistry.addRecipe(new ItemStack(ItemList.clayMolds, 1, 3), "xxx", "x x", "xxx", 'x', Items.clay_ball);
+ GameRegistry.addRecipe(new ItemStack(ItemList.clayMolds, 1, 4), "x x", 'x', Items.clay_ball);
+ GameRegistry.addRecipe(new ItemStack(BlockList.handPedestal), "bbb", " x ", "yxy", 'x', Blocks.stonebrick,
+ 'y', new ItemStack(Blocks.stone_slab, 1, 5), 'b', Blocks.cobblestone_wall);
+ GameRegistry.addRecipe(new ItemStack(BlockList.shadowEye), "bcb", "cec", "bcb", 'b', Blocks.stonebrick, 'c',
+ new ItemStack(Blocks.stained_hardened_clay, 1, 15), 'e', Items.ender_eye);
+ GameRegistry.addShapelessRecipe(new ItemStack(ItemList.shadowIngot, 9),
+ new Object[] { new ItemStack(BlockList.shadowBlock) });
+ GameRegistry.addShapelessRecipe(new ItemStack(ItemList.guide),
+ new Object[] { new ItemStack(Items.book), new ItemStack(ItemList.molds, 1, 0) });
+ GameRegistry.addShapelessRecipe(new ItemStack(ItemList.guide),
+ new Object[] { new ItemStack(Items.book), new ItemStack(ItemList.molds, 1, 1) });
+ GameRegistry.addShapelessRecipe(new ItemStack(ItemList.guide),
+ new Object[] { new ItemStack(Items.book), new ItemStack(ItemList.molds, 1, 2) });
+ GameRegistry.addShapelessRecipe(new ItemStack(ItemList.guide),
+ new Object[] { new ItemStack(Items.book), new ItemStack(ItemList.molds, 1, 3) });
+ GameRegistry.addShapelessRecipe(new ItemStack(ItemList.guide),
+ new Object[] { new ItemStack(Items.book), new ItemStack(ItemList.molds, 1, 4) });
// Blocks
- GameRegistry.addRecipe(new ShapedOreRecipe(
- new ItemStack(BlockList.molder),
- "x x", "xxx", 'x',
- Blocks.cobblestone));
- GameRegistry.addRecipe(new ShapedOreRecipe(
- new ItemStack(BlockList.smelter),
- "xyx", "x x", "xzx", 'x',
- Blocks.cobblestone, 'y',
- Items.bucket, 'z',
- Items.lava_bucket));
- GameRegistry.addRecipe(new ShapedOreRecipe(
- new ItemStack(BlockList.jewelCraftingTable),
- "xxx", "y y", "y y", 'x',
- Blocks.planks, 'y', Blocks.stone));
- GameRegistry.addRecipe(new ShapedOreRecipe(
- new ItemStack(BlockList.displayer,
- 2),
- " x ", "xxx", "yyy", 'x',
- Items.iron_ingot, 'y',
- Blocks.emerald_block));
- GameRegistry.addRecipe(new ShapedOreRecipe(
- new ItemStack(BlockList.shadowBlock,
- 1),
- "xxx", "xxx", "xxx", 'x',
- ItemList.shadowIngot));
+ GameRegistry.addRecipe(
+ new ShapedOreRecipe(new ItemStack(BlockList.molder), "x x", "xxx", 'x', Blocks.cobblestone));
+ GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(BlockList.smelter), "xyx", "x x", "xzx", 'x',
+ Blocks.cobblestone, 'y', Items.bucket, 'z', Items.lava_bucket));
+ GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(BlockList.jewelCraftingTable), "xxx", "y y", "y y",
+ 'x', Blocks.planks, 'y', Blocks.stone));
+ GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(BlockList.displayer, 2), " x ", "xxx", "yyy", 'x',
+ Items.iron_ingot, 'y', Blocks.emerald_block));
+ GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(BlockList.shadowBlock, 1), "xxx", "xxx", "xxx",
+ 'x', ItemList.shadowIngot));
// Smelting
- GameRegistry.addSmelting(BlockList.shadowOre,
- new ItemStack(ItemList.shadowIngot),
- 1.5f);
- GameRegistry.addSmelting(
- new ItemStack(ItemList.clayMolds,
- 1, 0),
- new ItemStack(ItemList.molds, 1,
- 0),
+ GameRegistry.addSmelting(BlockList.shadowOre, new ItemStack(ItemList.shadowIngot), 1.5f);
+ GameRegistry.addSmelting(new ItemStack(ItemList.clayMolds, 1, 0), new ItemStack(ItemList.molds, 1, 0),
0.2F);
- GameRegistry.addSmelting(
- new ItemStack(ItemList.clayMolds,
- 1, 1),
- new ItemStack(ItemList.molds, 1,
- 1),
+ GameRegistry.addSmelting(new ItemStack(ItemList.clayMolds, 1, 1), new ItemStack(ItemList.molds, 1, 1),
0.2F);
- GameRegistry.addSmelting(
- new ItemStack(ItemList.clayMolds,
- 1, 2),
- new ItemStack(ItemList.molds, 1,
- 2),
+ GameRegistry.addSmelting(new ItemStack(ItemList.clayMolds, 1, 2), new ItemStack(ItemList.molds, 1, 2),
0.2F);
- GameRegistry.addSmelting(
- new ItemStack(ItemList.clayMolds,
- 1, 3),
- new ItemStack(ItemList.molds, 1,
- 3),
+ GameRegistry.addSmelting(new ItemStack(ItemList.clayMolds, 1, 3), new ItemStack(ItemList.molds, 1, 3),
0.2F);
- GameRegistry.addSmelting(
- new ItemStack(ItemList.clayMolds,
- 1, 4),
- new ItemStack(ItemList.molds, 1,
- 4),
+ GameRegistry.addSmelting(new ItemStack(ItemList.clayMolds, 1, 4), new ItemStack(ItemList.molds, 1, 4),
0.2F);
isInitialized = true;
}
diff --git a/src/main/java/darkknight/jewelrycraft/thirdparty/EE3.java b/src/main/java/darkknight/jewelrycraft/thirdparty/EE3.java index 8f61767..26be29f 100755 --- a/src/main/java/darkknight/jewelrycraft/thirdparty/EE3.java +++ b/src/main/java/darkknight/jewelrycraft/thirdparty/EE3.java @@ -25,53 +25,30 @@ public class EE3 implements IThirdParty { @Override
public void postInit() {
- EnergyValueRegistryProxy.addPostAssignedEnergyValue(
- new ItemStack(BlockList.shadowOre), 4096);
+ EnergyValueRegistryProxy.addPostAssignedEnergyValue(new ItemStack(BlockList.shadowOre), 4096);
- EnergyValueRegistryProxy.addPostAssignedEnergyValue(
- new ItemStack(BlockList.shadowBlock),
- 36864);
+ EnergyValueRegistryProxy.addPostAssignedEnergyValue(new ItemStack(BlockList.shadowBlock), 36864);
- EnergyValueRegistryProxy.addPostAssignedEnergyValue(
- new ItemStack(ItemList.shadowIngot), 4096);
+ EnergyValueRegistryProxy.addPostAssignedEnergyValue(new ItemStack(ItemList.shadowIngot), 4096);
- EnergyValueRegistryProxy.addPostAssignedEnergyValue(
- new ItemStack(BlockList.jewelCraftingTable),
- 16640);
+ EnergyValueRegistryProxy.addPostAssignedEnergyValue(new ItemStack(BlockList.jewelCraftingTable), 16640);
- EnergyValueRegistryProxy.addPostAssignedEnergyValue(
- new ItemStack(ItemList.guide), 288);
+ EnergyValueRegistryProxy.addPostAssignedEnergyValue(new ItemStack(ItemList.guide), 288);
for (int i = 0; i < ItemClayMolds.moldsItemNames.length; i++) {
- EnergyValueRegistryProxy
- .addPostAssignedEnergyValue(
- new ItemStack(ItemList.clayMolds,
- 1,
- i),
- 128);
+ EnergyValueRegistryProxy.addPostAssignedEnergyValue(new ItemStack(ItemList.clayMolds, 1, i), 128);
}
for (int i = 0; i < ItemMolds.moldsItemNames.length; i++) {
- EnergyValueRegistryProxy
- .addPostAssignedEnergyValue(
- new ItemStack(ItemList.molds,
- 1,
- i),
- 128);
+ EnergyValueRegistryProxy.addPostAssignedEnergyValue(new ItemStack(ItemList.molds, 1, i), 128);
}
for (int i = 0; i < BlockCrystal.colors.length; i++) {
- EnergyValueRegistryProxy
- .addPostAssignedEnergyValue(
- new ItemStack(BlockList.crystal,
- 1,
- i),
- 64);
+ EnergyValueRegistryProxy.addPostAssignedEnergyValue(new ItemStack(BlockList.crystal, 1, i), 64);
}
for (int i = 0; i < Names.Items.GEM_SUBTYPES.length; i++) {
- JewelrycraftUtil.gem.add(
- new ItemStack(ModItems.gem, 1, i));
+ JewelrycraftUtil.gem.add(new ItemStack(ModItems.gem, 1, i));
}
}
diff --git a/src/main/java/darkknight/jewelrycraft/thirdparty/ModIds.java b/src/main/java/darkknight/jewelrycraft/thirdparty/ModIds.java index 42fc800..ae394d1 100755 --- a/src/main/java/darkknight/jewelrycraft/thirdparty/ModIds.java +++ b/src/main/java/darkknight/jewelrycraft/thirdparty/ModIds.java @@ -4,26 +4,26 @@ package darkknight.jewelrycraft.thirdparty; * @author MineMarteen from Pneumaticraft
*/
public class ModIds {
- public static final String BUILDCRAFT = "BuildCraft|Core";
- public static final String COMPUTERCRAFT = "ComputerCraft";
- public static final String INDUSTRIALCRAFT = "IC2";
- public static final String IGWMOD = "IGWMod";
- public static final String FMP = "ForgeMultipart";
- public static final String WAILA = "Waila";
- public static final String TE = "ThermalExpansion";
- public static final String HC = "HydCraft";
- public static final String NEI = "NotEnoughItems";
- public static final String THAUMCRAFT = "Thaumcraft";
- public static final String BLOOD_MAGIC = "AWWayofTime";
- public static final String AE2 = "appliedenergistics2";
- public static final String CHISEL = "chisel";
- public static final String FORESTRY = "Forestry";
- public static final String MFR = "MineFactoryReloaded";
- public static final String OPEN_BLOCKS = "OpenBlocks";
- public static final String COFH_CORE = "CoFHCore";
- public static final String NOT_ENOUGH_KEYS = "notenoughkeys";
- public static final String OPEN_COMPUTERS = "OpenComputers|Core";
- public static final String EE3 = "EE3";
- public static final String PENUMATICRAFT = "PneumaticCraft";
- public static final String ALPACA = "alpaca";
+ public static final String BUILDCRAFT = "BuildCraft|Core";
+ public static final String COMPUTERCRAFT = "ComputerCraft";
+ public static final String INDUSTRIALCRAFT = "IC2";
+ public static final String IGWMOD = "IGWMod";
+ public static final String FMP = "ForgeMultipart";
+ public static final String WAILA = "Waila";
+ public static final String TE = "ThermalExpansion";
+ public static final String HC = "HydCraft";
+ public static final String NEI = "NotEnoughItems";
+ public static final String THAUMCRAFT = "Thaumcraft";
+ public static final String BLOOD_MAGIC = "AWWayofTime";
+ public static final String AE2 = "appliedenergistics2";
+ public static final String CHISEL = "chisel";
+ public static final String FORESTRY = "Forestry";
+ public static final String MFR = "MineFactoryReloaded";
+ public static final String OPEN_BLOCKS = "OpenBlocks";
+ public static final String COFH_CORE = "CoFHCore";
+ public static final String NOT_ENOUGH_KEYS = "notenoughkeys";
+ public static final String OPEN_COMPUTERS = "OpenComputers|Core";
+ public static final String EE3 = "EE3";
+ public static final String PENUMATICRAFT = "PneumaticCraft";
+ public static final String ALPACA = "alpaca";
}
\ No newline at end of file diff --git a/src/main/java/darkknight/jewelrycraft/thirdparty/NEI.java b/src/main/java/darkknight/jewelrycraft/thirdparty/NEI.java index 70a8744..212faf1 100755 --- a/src/main/java/darkknight/jewelrycraft/thirdparty/NEI.java +++ b/src/main/java/darkknight/jewelrycraft/thirdparty/NEI.java @@ -19,14 +19,10 @@ public class NEI implements IThirdParty { @Override
public void postInit() {
for (int i = 0; i < Curse.getCurseList().size(); i++)
- codechicken.nei.api.API.hideItem(new ItemStack(
- ItemList.testItem, 1, i));
- codechicken.nei.api.API
- .hideItem(new ItemStack(ItemList.goldObj));
- codechicken.nei.api.API.hideItem(
- new ItemStack(BlockList.midasTouchBlock));
- codechicken.nei.api.API
- .hideItem(new ItemStack(ItemList.metal));
+ codechicken.nei.api.API.hideItem(new ItemStack(ItemList.testItem, 1, i));
+ codechicken.nei.api.API.hideItem(new ItemStack(ItemList.goldObj));
+ codechicken.nei.api.API.hideItem(new ItemStack(BlockList.midasTouchBlock));
+ codechicken.nei.api.API.hideItem(new ItemStack(ItemList.metal));
}
@Override
diff --git a/src/main/java/darkknight/jewelrycraft/thirdparty/ThirdPartyManager.java b/src/main/java/darkknight/jewelrycraft/thirdparty/ThirdPartyManager.java index bb819d5..35dd49b 100755 --- a/src/main/java/darkknight/jewelrycraft/thirdparty/ThirdPartyManager.java +++ b/src/main/java/darkknight/jewelrycraft/thirdparty/ThirdPartyManager.java @@ -21,8 +21,8 @@ import net.minecraft.world.World; */
public class ThirdPartyManager implements IGuiHandler {
- private static ThirdPartyManager INSTANCE = new ThirdPartyManager();
- private final List<IThirdParty> thirdPartyMods = new ArrayList<>();
+ private static ThirdPartyManager INSTANCE = new ThirdPartyManager();
+ private final List<IThirdParty> thirdPartyMods = new ArrayList<>();
public static ThirdPartyManager instance() {
return INSTANCE;
@@ -36,34 +36,24 @@ public class ThirdPartyManager implements IGuiHandler { List<String> enabledThirdParty = new ArrayList<>();
- ConfigHandler.config.addCustomCategoryComment(
- "third_party_enabling",
+ ConfigHandler.config.addCustomCategoryComment("third_party_enabling",
"With these options you can disable third party content by mod."
+ " Useful if something in the mod changes and causes crashes.");
for (String modid : thirdPartyClasses.keySet()) {
- if (ConfigHandler.config
- .get("Third_Party_Enabling", modid,
- true)
- .getBoolean()) {
+ if (ConfigHandler.config.get("Third_Party_Enabling", modid, true).getBoolean()) {
enabledThirdParty.add(modid);
}
}
ConfigHandler.config.save();
- for (Map.Entry<String, Class<? extends IThirdParty>> entry : thirdPartyClasses
- .entrySet()) {
- if (enabledThirdParty.contains(entry.getKey())
- && Loader.isModLoaded(
- entry.getKey())) {
+ for (Map.Entry<String, Class<? extends IThirdParty>> entry : thirdPartyClasses.entrySet()) {
+ if (enabledThirdParty.contains(entry.getKey()) && Loader.isModLoaded(entry.getKey())) {
try {
- thirdPartyMods.add(entry.getValue()
- .newInstance());
+ thirdPartyMods.add(entry.getValue().newInstance());
} catch (Exception e) {
- JewelrycraftMod.logger.log(
- Level.ERROR,
- "Failed to instantiate third party handler!");
+ JewelrycraftMod.logger.log(Level.ERROR, "Failed to instantiate third party handler!");
e.printStackTrace();
}
}
@@ -73,16 +63,14 @@ public class ThirdPartyManager implements IGuiHandler { public void onItemRegistry(Item item) {
for (IThirdParty thirdParty : thirdPartyMods) {
if (thirdParty instanceof IRegistryListener)
- ((IRegistryListener) thirdParty)
- .onItemRegistry(item);
+ ((IRegistryListener) thirdParty).onItemRegistry(item);
}
}
public void onBlockRegistry(Block block) {
for (IThirdParty thirdParty : thirdPartyMods) {
if (thirdParty instanceof IRegistryListener)
- ((IRegistryListener) thirdParty)
- .onBlockRegistry(block);
+ ((IRegistryListener) thirdParty).onBlockRegistry(block);
}
}
@@ -93,8 +81,7 @@ public class ThirdPartyManager implements IGuiHandler { } catch (Throwable e) {
JewelrycraftMod.logger.log(Level.ERROR,
"Jewelrycraft wasn't able to load third party content from the third party class "
- + thirdParty.getClass()
- + " in the PreInit phase!");
+ + thirdParty.getClass() + " in the PreInit phase!");
e.printStackTrace();
}
}
@@ -107,8 +94,7 @@ public class ThirdPartyManager implements IGuiHandler { } catch (Throwable e) {
JewelrycraftMod.logger.log(Level.ERROR,
"Jewelrycraft wasn't able to load third party content from the third party class "
- + thirdParty.getClass()
- + " in the Init phase!");
+ + thirdParty.getClass() + " in the Init phase!");
e.printStackTrace();
}
}
@@ -121,8 +107,7 @@ public class ThirdPartyManager implements IGuiHandler { } catch (Throwable e) {
JewelrycraftMod.logger.log(Level.ERROR,
"Jewelrycraft wasn't able to load third party content from the third party class "
- + thirdParty.getClass()
- + " in the PostInit phase!");
+ + thirdParty.getClass() + " in the PostInit phase!");
e.printStackTrace();
}
}
@@ -135,8 +120,7 @@ public class ThirdPartyManager implements IGuiHandler { } catch (Throwable e) {
JewelrycraftMod.logger.log(Level.ERROR,
"Jewelrycraft wasn't able to load third party content from the third party class "
- + thirdParty.getClass()
- + " client side!");
+ + thirdParty.getClass() + " client side!");
e.printStackTrace();
}
}
@@ -149,23 +133,17 @@ public class ThirdPartyManager implements IGuiHandler { } catch (Throwable e) {
JewelrycraftMod.logger.log(Level.ERROR,
"Jewelrycraft wasn't able to load third party content from the third party class "
- + thirdParty.getClass()
- + " client side on the init!");
+ + thirdParty.getClass() + " client side on the init!");
e.printStackTrace();
}
}
}
@Override
- public Object getServerGuiElement(int ID, EntityPlayer player,
- World world, int x, int y, int z) {
+ public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
for (IThirdParty thirdParty : thirdPartyMods) {
if (thirdParty instanceof IGuiHandler) {
- Object obj = ((IGuiHandler) thirdParty)
- .getServerGuiElement(ID,
- player,
- world, x,
- y, z);
+ Object obj = ((IGuiHandler) thirdParty).getServerGuiElement(ID, player, world, x, y, z);
if (obj != null)
return obj;
}
@@ -174,15 +152,10 @@ public class ThirdPartyManager implements IGuiHandler { }
@Override
- public Object getClientGuiElement(int ID, EntityPlayer player,
- World world, int x, int y, int z) {
+ public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
for (IThirdParty thirdParty : thirdPartyMods) {
if (thirdParty instanceof IGuiHandler) {
- Object obj = ((IGuiHandler) thirdParty)
- .getClientGuiElement(ID,
- player,
- world, x,
- y, z);
+ Object obj = ((IGuiHandler) thirdParty).getClientGuiElement(ID, player, world, x, y, z);
if (obj != null)
return obj;
}
diff --git a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityBlockShadow.java b/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityBlockShadow.java index dc387ff..5e4bf87 100755 --- a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityBlockShadow.java +++ b/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityBlockShadow.java @@ -43,46 +43,30 @@ public class TileEntityBlockShadow extends TileEntity { public void updateEntity() { super.updateEntity(); int blockLight, realLight; - int lightValue = worldObj.getSavedLightValue( - EnumSkyBlock.Sky, xCoord, yCoord, zCoord) + int lightValue = worldObj.getSavedLightValue(EnumSkyBlock.Sky, xCoord, yCoord, zCoord) - worldObj.skylightSubtracted; - float sunPosAngle = worldObj - .getCelestialAngleRadians(1.0F); + float sunPosAngle = worldObj.getCelestialAngleRadians(1.0F); if (sunPosAngle < (float) Math.PI) sunPosAngle += (0.0F - sunPosAngle) * 0.2F; else - sunPosAngle += ((float) Math.PI * 2F - sunPosAngle) - * 0.2F; - lightValue = Math.round( - lightValue * MathHelper.cos(sunPosAngle)); + sunPosAngle += ((float) Math.PI * 2F - sunPosAngle) * 0.2F; + lightValue = Math.round(lightValue * MathHelper.cos(sunPosAngle)); if (lightValue < 0) lightValue = 0; if (lightValue > 15) lightValue = 15; - blockLight = worldObj - .getChunkFromBlockCoords(xCoord, zCoord) - .getSavedLightValue(EnumSkyBlock.Block, - xCoord & 15, yCoord, - zCoord & 15); - realLight = worldObj - .getChunkFromBlockCoords(xCoord, zCoord) - .getBlockLightValue(xCoord & 15, yCoord, - zCoord & 15, 0); - if (blockLight == 0 - && worldObj.canBlockSeeTheSky(xCoord, - yCoord, zCoord) - || lightValue >= blockLight) + blockLight = worldObj.getChunkFromBlockCoords(xCoord, zCoord).getSavedLightValue(EnumSkyBlock.Block, + xCoord & 15, yCoord, zCoord & 15); + realLight = worldObj.getChunkFromBlockCoords(xCoord, zCoord).getBlockLightValue(xCoord & 15, yCoord, + zCoord & 15, 0); + if (blockLight == 0 && worldObj.canBlockSeeTheSky(xCoord, yCoord, zCoord) || lightValue >= blockLight) metadata = 15 - lightValue; - else if (!worldObj.canBlockSeeTheSky(xCoord, yCoord, - zCoord)) + else if (!worldObj.canBlockSeeTheSky(xCoord, yCoord, zCoord)) metadata = 15 - realLight; else if (lightValue < blockLight) metadata = 15 - blockLight; - worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, - metadata, 2); - worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, - zCoord, - worldObj.getBlock(xCoord, yCoord, zCoord)); + worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, metadata, 2); + worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord)); } /** @@ -92,8 +76,7 @@ public class TileEntityBlockShadow extends TileEntity { public Packet getDescriptionPacket() { NBTTagCompound nbttagcompound = new NBTTagCompound(); writeToNBT(nbttagcompound); - return new S35PacketUpdateTileEntity(xCoord, yCoord, - zCoord, 1, nbttagcompound); + return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, nbttagcompound); } /** @@ -101,8 +84,7 @@ public class TileEntityBlockShadow extends TileEntity { * @param packet */ @Override - public void onDataPacket(NetworkManager net, - S35PacketUpdateTileEntity packet) { + public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet) { readFromNBT(packet.func_148857_g()); worldObj.func_147479_m(xCoord, yCoord, zCoord); } diff --git a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityCrystal.java b/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityCrystal.java index 90fbd99..7b5fdaf 100755 --- a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityCrystal.java +++ b/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityCrystal.java @@ -10,9 +10,9 @@ import net.minecraft.tileentity.TileEntity; * @author Sorin
*/
public class TileEntityCrystal extends TileEntity {
- public int shine = 120;
- boolean descent = false;
- int timer = 0;
+ public int shine = 120;
+ boolean descent = false;
+ int timer = 0;
@Override
public void updateEntity() {
@@ -28,9 +28,7 @@ public class TileEntityCrystal extends TileEntity { if (shine <= 100)
descent = false;
}
- this.worldObj.markBlockRangeForRenderUpdate(
- xCoord, yCoord, zCoord,
- xCoord, yCoord, zCoord);
+ this.worldObj.markBlockRangeForRenderUpdate(xCoord, yCoord, zCoord, xCoord, yCoord, zCoord);
timer = 0;
}
}
diff --git a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityDisplayer.java b/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityDisplayer.java index 72fa7c0..ccbedf3 100755 --- a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityDisplayer.java +++ b/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityDisplayer.java @@ -9,12 +9,10 @@ import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity;
public class TileEntityDisplayer extends TileEntity {
- public float ringTranslation1, ringTranslation2,
- ringTranslation3, rotAngle;
- public boolean isDescending1, isDescending2,
- isDescending3, isDirty, hasObject;
- public ItemStack object;
- public int quantity, infoIndex, timer = 0;
+ public float ringTranslation1, ringTranslation2, ringTranslation3, rotAngle;
+ public boolean isDescending1, isDescending2, isDescending3, isDirty, hasObject;
+ public ItemStack object;
+ public int quantity, infoIndex, timer = 0;
/**
*
@@ -82,8 +80,7 @@ public class TileEntityDisplayer extends TileEntity { public void updateEntity() {
super.updateEntity();
if (isDirty) {
- worldObj.markBlockForUpdate(xCoord, yCoord,
- zCoord);
+ worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
isDirty = false;
}
if (ringTranslation1 >= 0.6)
@@ -128,8 +125,7 @@ public class TileEntityDisplayer extends TileEntity { public Packet getDescriptionPacket() {
NBTTagCompound nbttagcompound = new NBTTagCompound();
writeToNBT(nbttagcompound);
- return new S35PacketUpdateTileEntity(xCoord, yCoord,
- zCoord, 1, nbttagcompound);
+ return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, nbttagcompound);
}
/**
@@ -137,8 +133,7 @@ public class TileEntityDisplayer extends TileEntity { * @param packet
*/
@Override
- public void onDataPacket(NetworkManager net,
- S35PacketUpdateTileEntity packet) {
+ public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet) {
readFromNBT(packet.func_148857_g());
worldObj.func_147479_m(xCoord, yCoord, zCoord);
}
diff --git a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityHandPedestal.java b/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityHandPedestal.java index f6fb323..69841b2 100755 --- a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityHandPedestal.java +++ b/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityHandPedestal.java @@ -12,16 +12,16 @@ import net.minecraft.tileentity.TileEntity; * @author Paul Fulham (pau101)
*/
public class TileEntityHandPedestal extends TileEntity {
- protected boolean isDirty;
- protected ItemStack heldItemStack;
+ protected boolean isDirty;
+ protected ItemStack heldItemStack;
/**
* When the hand is open the grip is 0 and is 20 when closed.
*/
- private float grip;
- private float prevGrip;
- private float gripMax;
- private float gripScale;
- private boolean isHandOpen;
+ private float grip;
+ private float prevGrip;
+ private float gripMax;
+ private float gripScale;
+ private boolean isHandOpen;
/**
*
@@ -56,9 +56,7 @@ public class TileEntityHandPedestal extends TileEntity { public void readFromNBT(NBTTagCompound tagCompound) {
super.readFromNBT(tagCompound);
if (tagCompound.hasKey("object", 10))
- setHeldItemStack(ItemStack.loadItemStackFromNBT(
- tagCompound.getCompoundTag(
- "object")));
+ setHeldItemStack(ItemStack.loadItemStackFromNBT(tagCompound.getCompoundTag("object")));
else
removeHeldItemStack();
isHandOpen = tagCompound.getBoolean("isHandOpen");
@@ -72,8 +70,7 @@ public class TileEntityHandPedestal extends TileEntity { super.updateEntity();
updateGrip();
if (isDirty) {
- worldObj.markBlockForUpdate(xCoord, yCoord,
- zCoord);
+ worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
isDirty = false;
}
}
@@ -96,8 +93,7 @@ public class TileEntityHandPedestal extends TileEntity { public Packet getDescriptionPacket() {
NBTTagCompound nbttagcompound = new NBTTagCompound();
writeToNBT(nbttagcompound);
- return new S35PacketUpdateTileEntity(xCoord, yCoord,
- zCoord, 0, nbttagcompound);
+ return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 0, nbttagcompound);
}
/**
@@ -105,8 +101,7 @@ public class TileEntityHandPedestal extends TileEntity { * @param packet
*/
@Override
- public void onDataPacket(NetworkManager networkManager,
- S35PacketUpdateTileEntity packet) {
+ public void onDataPacket(NetworkManager networkManager, S35PacketUpdateTileEntity packet) {
readFromNBT(packet.func_148857_g());
worldObj.func_147479_m(xCoord, yCoord, zCoord);
}
@@ -131,8 +126,7 @@ public class TileEntityHandPedestal extends TileEntity { * @param heldItemStack
*/
public void setHeldItemStack(ItemStack heldItemStack) {
- if (heldItemStack != null
- && heldItemStack.getItem() != null) {
+ if (heldItemStack != null && heldItemStack.getItem() != null) {
heldItemStack.stackSize = 1;
this.heldItemStack = heldItemStack;
if (heldItemStack.getItem() instanceof ItemBlock)
diff --git a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityJewelrsCraftingTable.java b/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityJewelrsCraftingTable.java index 66d54b0..992e111 100755 --- a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityJewelrsCraftingTable.java +++ b/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityJewelrsCraftingTable.java @@ -14,11 +14,10 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World;
public class TileEntityJewelrsCraftingTable extends TileEntity {
- public boolean hasJewelry, hasEndItem, isDirty, hasGem,
- crafting;
- public ItemStack jewelry, endItem, gem;
- public int carving, effect;
- public float angle;
+ public boolean hasJewelry, hasEndItem, isDirty, hasGem, crafting;
+ public ItemStack jewelry, endItem, gem;
+ public int carving, effect;
+ public float angle;
/**
*
@@ -89,8 +88,7 @@ public class TileEntityJewelrsCraftingTable extends TileEntity { public void updateEntity() {
super.updateEntity();
if (isDirty) {
- worldObj.markBlockForUpdate(xCoord, yCoord,
- zCoord);
+ worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
isDirty = false;
}
if (angle < 360F)
@@ -101,81 +99,42 @@ public class TileEntityJewelrsCraftingTable extends TileEntity { if (carving > 0)
carving--;
if (crafting)
- for (int l = 0; l < ConfigHandler.GEM_PLACEMENT_TIME
- / (carving + 2); ++l) {
+ for (int l = 0; l < ConfigHandler.GEM_PLACEMENT_TIME / (carving + 2); ++l) {
if (worldObj.rand.nextInt(10) == 0)
- worldObj.playSoundEffect(
- xCoord,
- yCoord + 0.5F,
- zCoord,
- "random.orb",
- 0.05F, 1F);
+ worldObj.playSoundEffect(xCoord, yCoord + 0.5F, zCoord, "random.orb", 0.05F, 1F);
if (getBlockMetadata() == 0)
- worldObj.spawnParticle(
- "instantSpell",
- xCoord + 0.5F,
- (double) yCoord + 0.8F,
- zCoord + 0.2F,
- 0.0D, 0.0D,
- 0.0D);
+ worldObj.spawnParticle("instantSpell", xCoord + 0.5F, (double) yCoord + 0.8F, zCoord + 0.2F,
+ 0.0D, 0.0D, 0.0D);
if (getBlockMetadata() == 1)
- worldObj.spawnParticle(
- "instantSpell",
- xCoord + 0.8F,
- (double) yCoord + 0.8F,
- zCoord + 0.5F,
- 0.0D, 0.0D,
- 0.0D);
+ worldObj.spawnParticle("instantSpell", xCoord + 0.8F, (double) yCoord + 0.8F, zCoord + 0.5F,
+ 0.0D, 0.0D, 0.0D);
if (getBlockMetadata() == 2)
- worldObj.spawnParticle(
- "instantSpell",
- xCoord + 0.5F,
- (double) yCoord + 0.8F,
- zCoord + 0.8F,
- 0.0D, 0.0D,
- 0.0D);
+ worldObj.spawnParticle("instantSpell", xCoord + 0.5F, (double) yCoord + 0.8F, zCoord + 0.8F,
+ 0.0D, 0.0D, 0.0D);
if (getBlockMetadata() == 3)
- worldObj.spawnParticle(
- "instantSpell",
- xCoord + 0.2F,
- (double) yCoord + 0.8F,
- zCoord + 0.5F,
- 0.0D, 0.0D,
- 0.0D);
+ worldObj.spawnParticle("instantSpell", xCoord + 0.2F, (double) yCoord + 0.8F, zCoord + 0.5F,
+ 0.0D, 0.0D, 0.0D);
}
if (carving == 0) {
hasEndItem = true;
endItem = jewelry.copy();
- if (hasGem && gem != new ItemStack(
- Item.getItemById(0), 0, 0))
- if (!JewelryNBT.hasTag(jewelry,
- "gem")) {
- JewelryNBT.addGem(endItem,
- gem);
+ if (hasGem && gem != new ItemStack(Item.getItemById(0), 0, 0))
+ if (!JewelryNBT.hasTag(jewelry, "gem")) {
+ JewelryNBT.addGem(endItem, gem);
hasGem = false;
- gem = new ItemStack(Item
- .getItemById(0),
- 0, 0);
+ gem = new ItemStack(Item.getItemById(0), 0, 0);
} else {
- ItemStack aux = JewelryNBT
- .gem(jewelry);
- JewelryNBT.addGem(endItem,
- gem);
- if (JewelrycraftUtil.rand
- .nextBoolean())
+ ItemStack aux = JewelryNBT.gem(jewelry);
+ JewelryNBT.addGem(endItem, gem);
+ if (JewelrycraftUtil.rand.nextBoolean())
gem = aux.copy();
else {
hasGem = false;
- gem = new ItemStack(
- Item.getItemById(
- 0),
- 0,
- 0);
+ gem = new ItemStack(Item.getItemById(0), 0, 0);
}
}
hasJewelry = false;
- jewelry = new ItemStack(
- Item.getItemById(0), 0, 0);
+ jewelry = new ItemStack(Item.getItemById(0), 0, 0);
carving = -1;
crafting = false;
isDirty = true;
@@ -235,10 +194,8 @@ public class TileEntityJewelrsCraftingTable extends TileEntity { isDirty = true;
}
- public void dropItem(World world, double x, double y, double z,
- ItemStack stack) {
- EntityItem entityitem = new EntityItem(world, x + 0.5D,
- y + 1D, z + 0.5D, stack);
+ public void dropItem(World world, double x, double y, double z, ItemStack stack) {
+ EntityItem entityitem = new EntityItem(world, x + 0.5D, y + 1D, z + 0.5D, stack);
entityitem.motionX = 0;
entityitem.motionZ = 0;
entityitem.motionY = 0.21000000298023224D;
@@ -252,8 +209,7 @@ public class TileEntityJewelrsCraftingTable extends TileEntity { public Packet getDescriptionPacket() {
NBTTagCompound nbttagcompound = new NBTTagCompound();
writeToNBT(nbttagcompound);
- return new S35PacketUpdateTileEntity(xCoord, yCoord,
- zCoord, 1, nbttagcompound);
+ return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, nbttagcompound);
}
/**
@@ -261,8 +217,7 @@ public class TileEntityJewelrsCraftingTable extends TileEntity { * @param packet
*/
@Override
- public void onDataPacket(NetworkManager net,
- S35PacketUpdateTileEntity packet) {
+ public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet) {
readFromNBT(packet.func_148857_g());
worldObj.func_147479_m(xCoord, yCoord, zCoord);
}
diff --git a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityMidasTouch.java b/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityMidasTouch.java index eab8bfb..3895810 100755 --- a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityMidasTouch.java +++ b/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityMidasTouch.java @@ -39,8 +39,7 @@ public class TileEntityMidasTouch extends TileEntity { super.readFromNBT(nbt); NBTTagCompound en = (NBTTagCompound) nbt.getTag("entity"); int entityID = nbt.getInteger("entityID"); - EntityLivingBase entity = (EntityLivingBase) EntityList - .createEntityByID(entityID, worldObj); + EntityLivingBase entity = (EntityLivingBase) EntityList.createEntityByID(entityID, worldObj); if (entity != null) { entity.readFromNBT(en); target = entity; @@ -62,8 +61,7 @@ public class TileEntityMidasTouch extends TileEntity { public Packet getDescriptionPacket() { NBTTagCompound nbttagcompound = new NBTTagCompound(); writeToNBT(nbttagcompound); - return new S35PacketUpdateTileEntity(xCoord, yCoord, - zCoord, 1, nbttagcompound); + return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, nbttagcompound); } /** @@ -71,8 +69,7 @@ public class TileEntityMidasTouch extends TileEntity { * @param packet */ @Override - public void onDataPacket(NetworkManager net, - S35PacketUpdateTileEntity packet) { + public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet) { readFromNBT(packet.func_148857_g()); worldObj.func_147479_m(xCoord, yCoord, zCoord); } diff --git a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityMolder.java b/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityMolder.java index c7607a4..3b99fb9 100755 --- a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityMolder.java +++ b/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityMolder.java @@ -11,11 +11,10 @@ import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity;
public class TileEntityMolder extends TileEntity {
- public int cooling;
- public boolean hasMoltenMetal, hasJewelBase, hasMold,
- isDirty;
- public ItemStack mold, jewelBase, moltenMetal, ringMetal;
- public float quantity;
+ public int cooling;
+ public boolean hasMoltenMetal, hasJewelBase, hasMold, isDirty;
+ public ItemStack mold, jewelBase, moltenMetal, ringMetal;
+ public float quantity;
/**
*
@@ -86,24 +85,15 @@ public class TileEntityMolder extends TileEntity { public void updateEntity() {
super.updateEntity();
if (isDirty) {
- worldObj.markBlockForUpdate(xCoord, yCoord,
- zCoord);
+ worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
isDirty = false;
}
- if (hasMoltenMetal
- && moltenMetal.getItem() != Item
- .getItemById(0)
- && quantity > 0f) {
+ if (hasMoltenMetal && moltenMetal.getItem() != Item.getItemById(0) && quantity > 0f) {
if (worldObj.rand.nextInt(20) == 0)
- worldObj.playSoundEffect(xCoord,
- yCoord + 0.5F, zCoord,
- "random.fizz", 0.5F, 1F);
+ worldObj.playSoundEffect(xCoord, yCoord + 0.5F, zCoord, "random.fizz", 0.5F, 1F);
for (int l = 0; l < 2; ++l)
- worldObj.spawnParticle("reddust",
- xCoord + Math.random(),
- (double) yCoord + 0.2F,
- zCoord + Math.random(),
- 0.0D, 1.0D, 1.0D);
+ worldObj.spawnParticle("reddust", xCoord + Math.random(), (double) yCoord + 0.2F,
+ zCoord + Math.random(), 0.0D, 1.0D, 1.0D);
}
if (hasMoltenMetal && !hasJewelBase && quantity >= 0.1f) {
ringMetal = moltenMetal.copy();
@@ -113,29 +103,19 @@ public class TileEntityMolder extends TileEntity { if (mold.getItemDamage() == 0)
jewelBase = moltenMetal;
else if (mold.getItemDamage() == 1)
- jewelBase = new ItemStack(
- ItemList.ring);
+ jewelBase = new ItemStack(ItemList.ring);
else if (mold.getItemDamage() == 2)
- jewelBase = new ItemStack(
- ItemList.necklace);
+ jewelBase = new ItemStack(ItemList.necklace);
else if (mold.getItemDamage() == 3)
- jewelBase = new ItemStack(
- ItemList.bracelet);
+ jewelBase = new ItemStack(ItemList.bracelet);
else if (mold.getItemDamage() == 4)
- jewelBase = new ItemStack(
- ItemList.earrings);
+ jewelBase = new ItemStack(ItemList.earrings);
ringMetal.stackSize = 1;
jewelBase.stackSize = 1;
- if (mold.getItemDamage() != 0
- && jewelBase != new ItemStack(
- Item.getItemById(
- 0),
- 0, 0))
- JewelryNBT.addMetal(jewelBase,
- ringMetal);
+ if (mold.getItemDamage() != 0 && jewelBase != new ItemStack(Item.getItemById(0), 0, 0))
+ JewelryNBT.addMetal(jewelBase, ringMetal);
hasMoltenMetal = false;
- moltenMetal = new ItemStack(
- Item.getItemById(0), 0, 0);
+ moltenMetal = new ItemStack(Item.getItemById(0), 0, 0);
hasJewelBase = true;
cooling = -1;
quantity = 0f;
@@ -151,8 +131,7 @@ public class TileEntityMolder extends TileEntity { public Packet getDescriptionPacket() {
NBTTagCompound nbttagcompound = new NBTTagCompound();
writeToNBT(nbttagcompound);
- return new S35PacketUpdateTileEntity(xCoord, yCoord,
- zCoord, 1, nbttagcompound);
+ return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, nbttagcompound);
}
/**
@@ -160,8 +139,7 @@ public class TileEntityMolder extends TileEntity { * @param packet
*/
@Override
- public void onDataPacket(NetworkManager net,
- S35PacketUpdateTileEntity packet) {
+ public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet) {
readFromNBT(packet.func_148857_g());
worldObj.func_147479_m(xCoord, yCoord, zCoord);
}
diff --git a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityMoltenMetal.java b/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityMoltenMetal.java index 77e06c7..f3a2d7e 100755 --- a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityMoltenMetal.java +++ b/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityMoltenMetal.java @@ -50,8 +50,7 @@ public class TileEntityMoltenMetal extends TileEntity { public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
if (nbt.hasKey("metal"))
- setMetal(ItemStack.loadItemStackFromNBT(
- nbt.getCompoundTag("metal")));
+ setMetal(ItemStack.loadItemStackFromNBT(nbt.getCompoundTag("metal")));
else
metal = null;
}
@@ -60,13 +59,11 @@ public class TileEntityMoltenMetal extends TileEntity { public Packet getDescriptionPacket() {
NBTTagCompound nbttagcompound = new NBTTagCompound();
writeToNBT(nbttagcompound);
- return new S35PacketUpdateTileEntity(xCoord, yCoord,
- zCoord, 0, nbttagcompound);
+ return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 0, nbttagcompound);
}
@Override
- public void onDataPacket(NetworkManager net,
- S35PacketUpdateTileEntity packet) {
+ public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet) {
readFromNBT(packet.func_148857_g());
worldObj.func_147479_m(xCoord, yCoord, zCoord);
}
diff --git a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityShadowEye.java b/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityShadowEye.java index c5b5aef..65be5cb 100755 --- a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityShadowEye.java +++ b/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityShadowEye.java @@ -27,13 +27,12 @@ import net.minecraft.util.ResourceLocation; import net.minecraft.world.World;
public class TileEntityShadowEye extends TileEntity {
- public int opening, timer, t = 20, soundTimer;
- public boolean active, shouldAddData;
- public ArrayList<ItemStack> pedestalItems = new ArrayList<ItemStack>();
- ResourceLocation particleTexture = new ResourceLocation(
- Variables.MODID, "textures/particle/shadows.png");
- public EntityPlayer target;
- public ModelShadowEye model = new ModelShadowEye();
+ public int opening, timer, t = 20, soundTimer;
+ public boolean active, shouldAddData;
+ public ArrayList<ItemStack> pedestalItems = new ArrayList<ItemStack>();
+ ResourceLocation particleTexture = new ResourceLocation(Variables.MODID, "textures/particle/shadows.png");
+ public EntityPlayer target;
+ public ModelShadowEye model = new ModelShadowEye();
public TileEntityShadowEye() {
opening = 1;
@@ -62,27 +61,16 @@ public class TileEntityShadowEye extends TileEntity { @Override
public void updateEntity() {
super.updateEntity();
- boolean valid = isValidStructure(worldObj, xCoord, yCoord,
- zCoord, blockMetadata);
+ 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;
+ && ((TileEntityHandPedestal) worldObj.getTileEntity(xCoord, yCoord - 3, zCoord)).heldItemStack != null
+ && getNumberOfItems(worldObj, xCoord, yCoord, zCoord) > 0;
if (active) {
timer--;
- if (canStartRitual && canChangePedestals(worldObj,
- xCoord, yCoord, zCoord)
- && opening == 4)
- changePedestals(worldObj, xCoord, yCoord,
- zCoord);
+ if (canStartRitual && canChangePedestals(worldObj, xCoord, yCoord, zCoord) && opening == 4)
+ changePedestals(worldObj, xCoord, yCoord, zCoord);
}
- if (active && target != null
- && this.getDistanceFrom(target.posX,
- target.posY,
- target.posZ) > 27D) {
+ if (active && target != null && this.getDistanceFrom(target.posX, target.posY, target.posZ) > 27D) {
active = false;
timer = -1;
shouldAddData = false;
@@ -98,17 +86,11 @@ public class TileEntityShadowEye extends TileEntity { t = 20;
}
}
- if (opening == 2 && timer <= 0 && t == 10
- && shouldAddData) {
+ 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 target = (TileEntityHandPedestal) worldObj.getTileEntity(xCoord, yCoord - 3, zCoord);
+ if (target != null && target.getHeldItemStack() != null)
+ JewelryNBT.addModifiers(target.getHeldItemStack(), pedestalItems);
revertPedestals(worldObj, xCoord, yCoord, zCoord);
}
if (active && timer <= 0) {
@@ -124,38 +106,23 @@ public class TileEntityShadowEye extends TileEntity { active = false;
timer = -1;
if (!worldObj.isRemote) {
- JewelrycraftUtil.addCursePoints(
- target, 50);
- target.addChatMessage(
- new ChatComponentText(
- EnumChatFormatting.BLACK
- + "The Shadows don't like to be disturbed for no reason!"));
- target.addChatMessage(
- new ChatComponentText(
- EnumChatFormatting.DARK_PURPLE
- + "You feel a strange aura encumbering you."));
+ JewelrycraftUtil.addCursePoints(target, 50);
+ target.addChatMessage(new ChatComponentText(
+ EnumChatFormatting.BLACK + "The Shadows don't like to be disturbed for no reason!"));
+ target.addChatMessage(new ChatComponentText(
+ EnumChatFormatting.DARK_PURPLE + "You feel a strange aura encumbering you."));
}
}
}
if (active && opening == 4) {
for (int l = 0; l <= 100; l++)
worldObj.spawnParticle("depthsuspend",
- xCoord + 6.5F - worldObj.rand
- .nextInt(12)
- - worldObj.rand.nextFloat(),
- yCoord - 2F + worldObj.rand
- .nextInt(9)
- - worldObj.rand.nextFloat(),
- zCoord + 6.5F - worldObj.rand
- .nextInt(12)
- - worldObj.rand.nextFloat(),
- 0, 0, 0);
+ xCoord + 6.5F - worldObj.rand.nextInt(12) - worldObj.rand.nextFloat(),
+ yCoord - 2F + worldObj.rand.nextInt(9) - worldObj.rand.nextFloat(),
+ zCoord + 6.5F - worldObj.rand.nextInt(12) - worldObj.rand.nextFloat(), 0, 0, 0);
if (soundTimer == 0)
- worldObj.playSound(xCoord + 0.5D,
- yCoord + 0.5D,
- zCoord + 0.5D,
- "jewelrycraft2:Ritual",
- 1.0F, 1.0F, false);
+ worldObj.playSound(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D, "jewelrycraft2:Ritual", 1.0F, 1.0F,
+ false);
if (soundTimer < 20 * 14)
soundTimer++;
else
@@ -163,346 +130,211 @@ public class TileEntityShadowEye extends TileEntity { }
}
- public boolean isValidStructure(World world, int x, int y, int z,
- int metadata) {
- if (world.getBlockMetadata(x, y, z) == 0
- || world.getBlockMetadata(x, y, z) == 2) {
+ public boolean isValidStructure(World world, int x, int y, int z, int metadata) {
+ 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 || world.getBlockMetadata(x, y + 1, z) != 5)
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 || world.getBlockMetadata(x + 1, y + 1, z) != 5)
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 || world.getBlockMetadata(x - 1, y + 1, z) != 5)
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 || world.getBlockMetadata(x + 2, y, z) != 1)
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 || world.getBlockMetadata(x + 1, y, z) != 4)
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 || world.getBlockMetadata(x - 1, y, z) != 5)
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 || world.getBlockMetadata(x - 2, y, z) != 0)
return false;
// 3rd Layer
- if (world.getBlock(x + 2, y - 1,
- z) != Blocks.stonebrick)
+ if (world.getBlock(x + 2, y - 1, z) != Blocks.stonebrick)
return false;
- if (world.getBlock(x - 2, y - 1,
- z) != Blocks.stonebrick)
+ if (world.getBlock(x - 2, y - 1, z) != Blocks.stonebrick)
return false;
// 4th Layer
- if (world.getBlock(x + 2, y - 2,
- z) != Blocks.stonebrick)
+ if (world.getBlock(x + 2, y - 2, z) != Blocks.stonebrick)
return false;
- if (world.getBlock(x - 2, y - 2,
- z) != Blocks.stonebrick)
+ if (world.getBlock(x - 2, y - 2, z) != Blocks.stonebrick)
return false;
// 5th Layer
- if (world.getBlock(x + 2, y - 3,
- z) != Blocks.stonebrick)
+ if (world.getBlock(x + 2, y - 3, z) != Blocks.stonebrick)
return false;
- if (world.getBlock(x - 2, y - 3,
- z) != Blocks.stonebrick)
+ if (world.getBlock(x - 2, y - 3, z) != Blocks.stonebrick)
return false;
- } else if (world.getBlockMetadata(x, y, z) == 1
- || world.getBlockMetadata(x, y, z) == 3) {
+ } 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 || world.getBlockMetadata(x, y + 1, z) != 5)
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 || world.getBlockMetadata(x, y + 1, z + 1) != 5)
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 || world.getBlockMetadata(x, y + 1, z - 1) != 5)
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 || world.getBlockMetadata(x, y, z + 2) != 3)
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 || world.getBlockMetadata(x, y, z + 1) != 6)
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 || world.getBlockMetadata(x, y, z - 1) != 7)
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 || world.getBlockMetadata(x, y, z - 2) != 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)
return false;
- if (world.getBlock(x, y - 1,
- z - 2) != Blocks.stonebrick)
+ if (world.getBlock(x, y - 1, z - 2) != Blocks.stonebrick)
return false;
// 4th Layer
- if (world.getBlock(x, y - 2,
- z + 2) != Blocks.stonebrick)
+ if (world.getBlock(x, y - 2, z + 2) != Blocks.stonebrick)
return false;
- if (world.getBlock(x, y - 2,
- z - 2) != Blocks.stonebrick)
+ if (world.getBlock(x, y - 2, z - 2) != Blocks.stonebrick)
return false;
// 5th Layer
- if (world.getBlock(x, y - 3,
- z + 2) != Blocks.stonebrick)
+ if (world.getBlock(x, y - 3, z + 2) != Blocks.stonebrick)
return false;
- if (world.getBlock(x, y - 3,
- z - 2) != Blocks.stonebrick)
+ if (world.getBlock(x, y - 3, z - 2) != Blocks.stonebrick)
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)
return false;
- if (world.getBlock(x - 4, y - 1,
- z + 4) != BlockList.shadowBlock)
+ if (world.getBlock(x - 4, y - 1, z + 4) != BlockList.shadowBlock)
return false;
- if (world.getBlock(x + 4, y - 1,
- z - 4) != BlockList.shadowBlock)
+ if (world.getBlock(x + 4, y - 1, z - 4) != BlockList.shadowBlock)
return false;
- if (world.getBlock(x + 4, y - 1,
- z + 4) != BlockList.shadowBlock)
+ if (world.getBlock(x + 4, y - 1, z + 4) != BlockList.shadowBlock)
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)
return false;
- if (world.getBlock(x - 4, y - 2,
- z + 4) != Blocks.stonebrick)
+ if (world.getBlock(x - 4, y - 2, z + 4) != Blocks.stonebrick)
return false;
- if (world.getBlock(x + 4, y - 2,
- z - 4) != Blocks.stonebrick)
+ if (world.getBlock(x + 4, y - 2, z - 4) != Blocks.stonebrick)
return false;
- if (world.getBlock(x + 4, y - 2,
- z + 4) != Blocks.stonebrick)
+ if (world.getBlock(x + 4, y - 2, z + 4) != Blocks.stonebrick)
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)
return false;
- if (world.getBlock(x - 4, y - 3,
- z + 4) != Blocks.stonebrick)
+ if (world.getBlock(x - 4, y - 3, z + 4) != Blocks.stonebrick)
return false;
- if (world.getBlock(x + 4, y - 3,
- z - 4) != Blocks.stonebrick)
+ if (world.getBlock(x + 4, y - 3, z - 4) != Blocks.stonebrick)
return false;
- if (world.getBlock(x + 4, y - 3,
- z + 4) != Blocks.stonebrick)
+ if (world.getBlock(x + 4, y - 3, z + 4) != Blocks.stonebrick)
return false;
// Pedestals
- if (!(world.getBlock(x, y - 3,
- z) instanceof BlockHandPedestal))
- return false;
- if (world.getBlock(x - 4, y - 3,
- z + 2) != BlockList.handPedestal
- || world.getBlockMetadata(x - 4, y - 3,
- z + 2) != 1)
- return false;
- if (world.getBlock(x - 5, y - 3,
- z) != BlockList.handPedestal
- || world.getBlockMetadata(x - 5, y - 3,
- z) != 2)
- return false;
- if (world.getBlock(x - 4, y - 3,
- z - 2) != BlockList.handPedestal
- || world.getBlockMetadata(x - 4, y - 3,
- z - 2) != 3)
- return false;
- if (world.getBlock(x - 2, y - 3,
- z - 4) != BlockList.handPedestal
- || world.getBlockMetadata(x - 2, y - 3,
- z - 4) != 3)
- return false;
- if (world.getBlock(x, y - 3,
- z - 5) != BlockList.handPedestal
- || world.getBlockMetadata(x, y - 3,
- z - 5) != 4)
- return false;
- if (world.getBlock(x + 2, y - 3,
- z - 4) != BlockList.handPedestal
- || world.getBlockMetadata(x + 2, y - 3,
- z - 4) != 5)
- return false;
- if (world.getBlock(x + 4, y - 3,
- z - 2) != BlockList.handPedestal
- || world.getBlockMetadata(x + 4, y - 3,
- z - 2) != 5)
- return false;
- if (world.getBlock(x + 5, y - 3,
- z) != BlockList.handPedestal
- || world.getBlockMetadata(x + 5, y - 3,
- z) != 6)
- return false;
- if (world.getBlock(x + 4, y - 3,
- z + 2) != BlockList.handPedestal
- || world.getBlockMetadata(x + 4, y - 3,
- z + 2) != 7)
- return false;
- if (world.getBlock(x + 2, y - 3,
- z + 4) != BlockList.handPedestal
- || world.getBlockMetadata(x + 2, y - 3,
- z + 4) != 7)
- return false;
- if (world.getBlock(x, y - 3,
- z + 5) != BlockList.handPedestal
- || world.getBlockMetadata(x, y - 3,
- z + 5) != 0)
- 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, y - 3, z) instanceof BlockHandPedestal))
+ return false;
+ if (world.getBlock(x - 4, y - 3, z + 2) != BlockList.handPedestal
+ || world.getBlockMetadata(x - 4, y - 3, z + 2) != 1)
+ return false;
+ if (world.getBlock(x - 5, y - 3, z) != BlockList.handPedestal || world.getBlockMetadata(x - 5, y - 3, z) != 2)
+ return false;
+ if (world.getBlock(x - 4, y - 3, z - 2) != BlockList.handPedestal
+ || world.getBlockMetadata(x - 4, y - 3, z - 2) != 3)
+ return false;
+ if (world.getBlock(x - 2, y - 3, z - 4) != BlockList.handPedestal
+ || world.getBlockMetadata(x - 2, y - 3, z - 4) != 3)
+ return false;
+ if (world.getBlock(x, y - 3, z - 5) != BlockList.handPedestal || world.getBlockMetadata(x, y - 3, z - 5) != 4)
+ return false;
+ if (world.getBlock(x + 2, y - 3, z - 4) != BlockList.handPedestal
+ || world.getBlockMetadata(x + 2, y - 3, z - 4) != 5)
+ return false;
+ if (world.getBlock(x + 4, y - 3, z - 2) != BlockList.handPedestal
+ || world.getBlockMetadata(x + 4, y - 3, z - 2) != 5)
+ return false;
+ if (world.getBlock(x + 5, y - 3, z) != BlockList.handPedestal || world.getBlockMetadata(x + 5, y - 3, z) != 6)
+ return false;
+ if (world.getBlock(x + 4, y - 3, z + 2) != BlockList.handPedestal
+ || world.getBlockMetadata(x + 4, y - 3, z + 2) != 7)
+ return false;
+ if (world.getBlock(x + 2, y - 3, z + 4) != BlockList.handPedestal
+ || world.getBlockMetadata(x + 2, y - 3, z + 4) != 7)
+ return false;
+ if (world.getBlock(x, y - 3, z + 5) != BlockList.handPedestal || world.getBlockMetadata(x, y - 3, z + 5) != 0)
+ return false;
+ if (world.getBlock(x - 2, y - 3, z + 4) != BlockList.handPedestal
+ || world.getBlockMetadata(x - 2, y - 3, z + 4) != 1)
return false;
return true;
}
public void addData(World world, int x, int y, int z) {
pedestalItems.clear();
- addPedestalInfo((TileEntityHandPedestal) world
- .getTileEntity(x + 2, y - 3, z - 4));
- addPedestalInfo((TileEntityHandPedestal) world
- .getTileEntity(x - 4, y - 3, z + 2));
- addPedestalInfo((TileEntityHandPedestal) world
- .getTileEntity(x, y - 3, z - 5));
- addPedestalInfo((TileEntityHandPedestal) world
- .getTileEntity(x - 2, y - 3, z - 4));
- addPedestalInfo((TileEntityHandPedestal) world
- .getTileEntity(x - 4, y - 3, z - 2));
- addPedestalInfo((TileEntityHandPedestal) world
- .getTileEntity(x - 5, y - 3, z));
- addPedestalInfo((TileEntityHandPedestal) world
- .getTileEntity(x + 4, y - 3, z - 2));
- addPedestalInfo((TileEntityHandPedestal) world
- .getTileEntity(x + 5, y - 3, z));
- addPedestalInfo((TileEntityHandPedestal) world
- .getTileEntity(x + 4, y - 3, z + 2));
- addPedestalInfo((TileEntityHandPedestal) world
- .getTileEntity(x + 2, y - 3, z + 4));
- addPedestalInfo((TileEntityHandPedestal) world
- .getTileEntity(x, y - 3, z + 5));
- addPedestalInfo((TileEntityHandPedestal) world
- .getTileEntity(x - 2, y - 3, z + 4));
+ addPedestalInfo((TileEntityHandPedestal) world.getTileEntity(x + 2, y - 3, z - 4));
+ addPedestalInfo((TileEntityHandPedestal) world.getTileEntity(x - 4, y - 3, z + 2));
+ addPedestalInfo((TileEntityHandPedestal) world.getTileEntity(x, y - 3, z - 5));
+ addPedestalInfo((TileEntityHandPedestal) world.getTileEntity(x - 2, y - 3, z - 4));
+ addPedestalInfo((TileEntityHandPedestal) world.getTileEntity(x - 4, y - 3, z - 2));
+ addPedestalInfo((TileEntityHandPedestal) world.getTileEntity(x - 5, y - 3, z));
+ addPedestalInfo((TileEntityHandPedestal) world.getTileEntity(x + 4, y - 3, z - 2));
+ addPedestalInfo((TileEntityHandPedestal) world.getTileEntity(x + 5, y - 3, z));
+ addPedestalInfo((TileEntityHandPedestal) world.getTileEntity(x + 4, y - 3, z + 2));
+ addPedestalInfo((TileEntityHandPedestal) world.getTileEntity(x + 2, y - 3, z + 4));
+ addPedestalInfo((TileEntityHandPedestal) world.getTileEntity(x, y - 3, z + 5));
+ addPedestalInfo((TileEntityHandPedestal) world.getTileEntity(x - 2, y - 3, z + 4));
}
public int getNumberOfItems(World world, int x, int y, int z) {
int items = 0;
- if (((TileEntityHandPedestal) world.getTileEntity(x + 2,
- y - 3, z - 4)).heldItemStack != null)
+ if (((TileEntityHandPedestal) world.getTileEntity(x + 2, y - 3, z - 4)).heldItemStack != null)
items++;
- if (((TileEntityHandPedestal) world.getTileEntity(x - 4,
- y - 3, z + 2)).heldItemStack != null)
+ if (((TileEntityHandPedestal) world.getTileEntity(x - 4, y - 3, z + 2)).heldItemStack != null)
items++;
- if (((TileEntityHandPedestal) world.getTileEntity(x, y - 3,
- z - 5)).heldItemStack != null)
+ if (((TileEntityHandPedestal) world.getTileEntity(x, y - 3, z - 5)).heldItemStack != null)
items++;
- if (((TileEntityHandPedestal) world.getTileEntity(x - 2,
- y - 3, z - 4)).heldItemStack != null)
+ if (((TileEntityHandPedestal) world.getTileEntity(x - 2, y - 3, z - 4)).heldItemStack != null)
items++;
- if (((TileEntityHandPedestal) world.getTileEntity(x - 4,
- y - 3, z - 2)).heldItemStack != null)
+ if (((TileEntityHandPedestal) world.getTileEntity(x - 4, y - 3, z - 2)).heldItemStack != null)
items++;
- if (((TileEntityHandPedestal) world.getTileEntity(x - 5,
- y - 3, z)).heldItemStack != null)
+ if (((TileEntityHandPedestal) world.getTileEntity(x - 5, y - 3, z)).heldItemStack != null)
items++;
- if (((TileEntityHandPedestal) world.getTileEntity(x + 4,
- y - 3, z - 2)).heldItemStack != null)
+ if (((TileEntityHandPedestal) world.getTileEntity(x + 4, y - 3, z - 2)).heldItemStack != null)
items++;
- if (((TileEntityHandPedestal) world.getTileEntity(x + 5,
- y - 3, z)).heldItemStack != null)
+ if (((TileEntityHandPedestal) world.getTileEntity(x + 5, y - 3, z)).heldItemStack != null)
items++;
- if (((TileEntityHandPedestal) world.getTileEntity(x + 4,
- y - 3, z + 2)).heldItemStack != null)
+ if (((TileEntityHandPedestal) world.getTileEntity(x + 4, y - 3, z + 2)).heldItemStack != null)
items++;
- if (((TileEntityHandPedestal) world.getTileEntity(x + 2,
- y - 3, z + 4)).heldItemStack != null)
+ if (((TileEntityHandPedestal) world.getTileEntity(x + 2, y - 3, z + 4)).heldItemStack != null)
items++;
- if (((TileEntityHandPedestal) world.getTileEntity(x, y - 3,
- z + 5)).heldItemStack != null)
+ if (((TileEntityHandPedestal) world.getTileEntity(x, y - 3, z + 5)).heldItemStack != null)
items++;
- if (((TileEntityHandPedestal) world.getTileEntity(x - 2,
- y - 3, z + 4)).heldItemStack != null)
+ if (((TileEntityHandPedestal) world.getTileEntity(x - 2, y - 3, z + 4)).heldItemStack != null)
items++;
return items;
}
- public boolean canChangePedestals(World world, int x, int y,
- int z) {
+ public boolean canChangePedestals(World world, int x, int y, int z) {
if (world.getBlock(x, y - 3, z) != BlockList.handPedestal)
return false;
- if (world.getBlock(x + 2, y - 3,
- z - 4) != BlockList.handPedestal)
+ if (world.getBlock(x + 2, y - 3, z - 4) != BlockList.handPedestal)
return false;
- if (world.getBlock(x - 4, y - 3,
- z + 2) != BlockList.handPedestal)
+ if (world.getBlock(x - 4, y - 3, z + 2) != BlockList.handPedestal)
return false;
- if (world.getBlock(x, y - 3,
- z - 5) != BlockList.handPedestal)
+ if (world.getBlock(x, y - 3, z - 5) != BlockList.handPedestal)
return false;
- if (world.getBlock(x - 2, y - 3,
- z - 4) != BlockList.handPedestal)
+ if (world.getBlock(x - 2, y - 3, z - 4) != BlockList.handPedestal)
return false;
- if (world.getBlock(x - 4, y - 3,
- z - 2) != BlockList.handPedestal)
+ if (world.getBlock(x - 4, y - 3, z - 2) != BlockList.handPedestal)
return false;
- if (world.getBlock(x - 5, y - 3,
- z) != BlockList.handPedestal)
+ if (world.getBlock(x - 5, y - 3, z) != BlockList.handPedestal)
return false;
- if (world.getBlock(x + 4, y - 3,
- z - 2) != BlockList.handPedestal)
+ if (world.getBlock(x + 4, y - 3, z - 2) != BlockList.handPedestal)
return false;
- if (world.getBlock(x + 5, y - 3,
- z) != BlockList.handPedestal)
+ if (world.getBlock(x + 5, y - 3, z) != BlockList.handPedestal)
return false;
- if (world.getBlock(x + 4, y - 3,
- z + 2) != BlockList.handPedestal)
+ if (world.getBlock(x + 4, y - 3, z + 2) != BlockList.handPedestal)
return false;
- if (world.getBlock(x + 2, y - 3,
- z + 4) != BlockList.handPedestal)
+ if (world.getBlock(x + 2, y - 3, z + 4) != BlockList.handPedestal)
return false;
- if (world.getBlock(x, y - 3,
- z + 5) != BlockList.handPedestal)
+ if (world.getBlock(x, y - 3, z + 5) != BlockList.handPedestal)
return false;
- if (world.getBlock(x - 2, y - 3,
- z + 4) != BlockList.handPedestal)
+ if (world.getBlock(x - 2, y - 3, z + 4) != BlockList.handPedestal)
return false;
return true;
}
@@ -525,25 +357,15 @@ public class TileEntityShadowEye extends TileEntity { public void changeHand(World world, int x, int y, int z) {
int l = world.getBlockMetadata(x, y, z);
- world.playAuxSFX(2001, x, y, z, Block
- .getIdFromBlock(world.getBlock(x, y, z)));
+ world.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(world.getBlock(x, y, z)));
TileEntityShadowHand tile = new TileEntityShadowHand();
- if (world.getTileEntity(x, y,
- z) instanceof TileEntityHandPedestal) {
- if (((TileEntityHandPedestal) world.getTileEntity(
- x, y, z)).heldItemStack != null)
- tile.setHeldItemStack(
- ((TileEntityHandPedestal) world
- .getTileEntity(x,
- y,
- z)).heldItemStack
- .copy());
+ if (world.getTileEntity(x, y, z) instanceof TileEntityHandPedestal) {
+ if (((TileEntityHandPedestal) world.getTileEntity(x, y, z)).heldItemStack != null)
+ tile.setHeldItemStack(((TileEntityHandPedestal) world.getTileEntity(x, y, z)).heldItemStack.copy());
if (tile.heldItemStack != null)
tile.closeHand();
- ((TileEntityHandPedestal) world.getTileEntity(x, y,
- z)).removeHeldItemStack();
- world.setBlock(x, y, z, BlockList.shadowHand, l,
- 2);
+ ((TileEntityHandPedestal) world.getTileEntity(x, y, z)).removeHeldItemStack();
+ world.setBlock(x, y, z, BlockList.shadowHand, l, 2);
world.setTileEntity(x, y, z, tile);
}
}
@@ -566,66 +388,39 @@ public class TileEntityShadowEye extends TileEntity { public void revertHand(World world, int x, int y, int z) {
int l = world.getBlockMetadata(x, y, z);
- world.playAuxSFX(2001, x, y, z, Block
- .getIdFromBlock(BlockList.handPedestal));
+ world.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(BlockList.handPedestal));
world.playSoundEffect(x, y + 0.5F, z, "step.wood", 1F, 1F);
TileEntityHandPedestal tile = new TileEntityHandPedestal();
- if (world.getTileEntity(x, y,
- z) instanceof TileEntityShadowHand) {
- if (((TileEntityShadowHand) world.getTileEntity(x,
- y, z)).heldItemStack != null)
- tile.setHeldItemStack(
- ((TileEntityShadowHand) world
- .getTileEntity(x,
- y,
- z)).heldItemStack
- .copy());
- ((TileEntityShadowHand) world.getTileEntity(x, y,
- z)).removeHeldItemStack();
- world.setBlock(x, y, z, BlockList.handPedestal, l,
- 2);
+ if (world.getTileEntity(x, y, z) instanceof TileEntityShadowHand) {
+ if (((TileEntityShadowHand) world.getTileEntity(x, y, z)).heldItemStack != null)
+ tile.setHeldItemStack(((TileEntityShadowHand) world.getTileEntity(x, y, z)).heldItemStack.copy());
+ ((TileEntityShadowHand) world.getTileEntity(x, y, z)).removeHeldItemStack();
+ world.setBlock(x, y, z, BlockList.handPedestal, l, 2);
world.setTileEntity(x, y, z, tile);
}
}
public void addPedestalInfo(TileEntityHandPedestal pedestal) {
ItemStack heldItemStack;
- if (pedestal != null && (heldItemStack = pedestal
- .getHeldItemStack()) != null) {
+ if (pedestal != null && (heldItemStack = pedestal.getHeldItemStack()) != null) {
if (pedestalItems.isEmpty())
pedestalItems.add(heldItemStack.copy());
else {
boolean hasItem = false;
int index = 0;
- for (int ind = 0; ind < pedestalItems
- .size() && !hasItem; ind++)
- if (heldItemStack.getItem().equals(
- pedestalItems.get(
- ind)
- .getItem())
- && heldItemStack.getItemDamage() == pedestalItems
- .get(ind)
- .getItemDamage()) {
+ for (int ind = 0; ind < pedestalItems.size() && !hasItem; ind++)
+ if (heldItemStack.getItem().equals(pedestalItems.get(ind).getItem())
+ && heldItemStack.getItemDamage() == pedestalItems.get(ind).getItemDamage()) {
index = ind;
hasItem = true;
- if (heldItemStack
- .hasTagCompound()
- && pedestalItems.get(
- ind)
- .hasTagCompound()
- && !heldItemStack
- .getTagCompound()
- .equals(pedestalItems
- .get(ind)
- .getTagCompound()))
+ if (heldItemStack.hasTagCompound() && pedestalItems.get(ind).hasTagCompound()
+ && !heldItemStack.getTagCompound().equals(pedestalItems.get(ind).getTagCompound()))
hasItem = false;
}
if (!hasItem)
- pedestalItems.add(heldItemStack
- .copy());
+ pedestalItems.add(heldItemStack.copy());
else {
- ItemStack object = pedestalItems
- .get(index).copy();
+ ItemStack object = pedestalItems.get(index).copy();
object.stackSize++;
pedestalItems.set(index, object);
}
@@ -639,9 +434,7 @@ public class TileEntityShadowEye extends TileEntity { @Override
@SideOnly(Side.CLIENT)
public AxisAlignedBB getRenderBoundingBox() {
- AxisAlignedBB bb = AxisAlignedBB.getBoundingBox(
- xCoord - 5.5D, yCoord - 5.5D,
- zCoord - 5.5D, xCoord + 5.5D,
+ AxisAlignedBB bb = AxisAlignedBB.getBoundingBox(xCoord - 5.5D, yCoord - 5.5D, zCoord - 5.5D, xCoord + 5.5D,
yCoord + 5.5D, zCoord + 5.5D);
return bb;
}
@@ -650,13 +443,11 @@ public class TileEntityShadowEye extends TileEntity { public Packet getDescriptionPacket() {
NBTTagCompound nbttagcompound = new NBTTagCompound();
writeToNBT(nbttagcompound);
- return new S35PacketUpdateTileEntity(xCoord, yCoord,
- zCoord, 1, nbttagcompound);
+ return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, nbttagcompound);
}
@Override
- public void onDataPacket(NetworkManager net,
- S35PacketUpdateTileEntity packet) {
+ public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet) {
readFromNBT(packet.func_148857_g());
worldObj.func_147479_m(xCoord, yCoord, zCoord);
}
diff --git a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntitySmelter.java b/src/main/java/darkknight/jewelrycraft/tileentity/TileEntitySmelter.java index dd73951..6982888 100755 --- a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntitySmelter.java +++ b/src/main/java/darkknight/jewelrycraft/tileentity/TileEntitySmelter.java @@ -14,10 +14,10 @@ import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity;
public class TileEntitySmelter extends TileEntity {
- public int melting, flow, n = 0, p = 0;
- public boolean hasMetal, hasMoltenMetal, isDirty, pouring;
- public ItemStack metal, moltenMetal;
- public float quantity, pouredQuantity = 0.1f;
+ public int melting, flow, n = 0, p = 0;
+ public boolean hasMetal, hasMoltenMetal, isDirty, pouring;
+ public ItemStack metal, moltenMetal;
+ public float quantity, pouredQuantity = 0.1f;
/**
*
@@ -78,8 +78,7 @@ public class TileEntitySmelter extends TileEntity { super.updateEntity();
Random rand = new Random();
if (isDirty) {
- worldObj.markBlockForUpdate(xCoord, yCoord,
- zCoord);
+ worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
isDirty = false;
}
if (p > 0)
@@ -98,19 +97,14 @@ public class TileEntitySmelter extends TileEntity { }
if (hasMetal)
for (int l = 0; l < 2; ++l)
- worldObj.spawnParticle("flame",
- xCoord + rand.nextFloat(),
- (double) yCoord + 0.3F,
- zCoord + rand.nextFloat(),
- 0.0D, 0.0D, 0.0D);
+ worldObj.spawnParticle("flame", xCoord + rand.nextFloat(), (double) yCoord + 0.3F,
+ zCoord + rand.nextFloat(), 0.0D, 0.0D, 0.0D);
if (rand.nextInt(65) == 0) {
double d5 = xCoord + rand.nextFloat();
double d7 = yCoord;
double d6 = zCoord + rand.nextFloat();
- worldObj.playSound(d5, d7, d6, "liquid.lavapop",
- 0.2F + rand.nextFloat() * 0.2F,
- 0.9F + rand.nextFloat() * 0.15F,
- false);
+ worldObj.playSound(d5, d7, d6, "liquid.lavapop", 0.2F + rand.nextFloat() * 0.2F,
+ 0.9F + rand.nextFloat() * 0.15F, false);
}
if (hasMetal && !hasMoltenMetal) {
boolean isOre = JewelrycraftUtil.isOre(metal);
@@ -119,16 +113,12 @@ public class TileEntitySmelter extends TileEntity { if (melting == 0) {
hasMetal = false;
if (!isOre) {
- if (JewelryNBT.ingot(
- metal) == null)
+ if (JewelryNBT.ingot(metal) == null)
moltenMetal = metal;
else
- moltenMetal = JewelryNBT
- .ingot(metal);
+ moltenMetal = JewelryNBT.ingot(metal);
} else {
- moltenMetal = JewelrycraftUtil
- .getIngotFromOre(
- metal);
+ moltenMetal = JewelrycraftUtil.getIngotFromOre(metal);
moltenMetal.stackSize *= 2;
}
hasMoltenMetal = true;
@@ -136,8 +126,7 @@ public class TileEntitySmelter extends TileEntity { quantity = 0.1f * metal.stackSize;
else
quantity = 0.2f * metal.stackSize;
- metal = new ItemStack(Item.getItemById(0),
- 0, 0);
+ metal = new ItemStack(Item.getItemById(0), 0, 0);
melting = -1;
isDirty = true;
}
@@ -150,52 +139,33 @@ public class TileEntitySmelter extends TileEntity { if (!isOre)
moltenMetal.stackSize += metal.stackSize;
else
- moltenMetal.stackSize += metal.stackSize
- * 2;
+ moltenMetal.stackSize += metal.stackSize * 2;
if (!isOre)
quantity += 0.1f * metal.stackSize;
else
quantity += 0.2f * metal.stackSize;
- metal = new ItemStack(Item.getItemById(0),
- 0, 0);
+ metal = new ItemStack(Item.getItemById(0), 0, 0);
melting = -1;
isDirty = true;
}
}
TileEntityMolder me = null;
if (worldObj.getBlockMetadata(xCoord, yCoord, zCoord) == 0
- && worldObj.getTileEntity(xCoord, yCoord,
- zCoord - 1) != null
- && worldObj.getTileEntity(xCoord, yCoord,
- zCoord - 1) instanceof TileEntityMolder)
- me = (TileEntityMolder) worldObj.getTileEntity(
- xCoord, yCoord, zCoord - 1);
- else if (worldObj.getBlockMetadata(xCoord, yCoord,
- zCoord) == 1
- && worldObj.getTileEntity(xCoord + 1,
- yCoord, zCoord) != null
- && worldObj.getTileEntity(xCoord + 1,
- yCoord,
- zCoord) instanceof TileEntityMolder)
- me = (TileEntityMolder) worldObj.getTileEntity(
- xCoord + 1, yCoord, zCoord);
- else if (worldObj.getBlockMetadata(xCoord, yCoord,
- zCoord) == 2
- && worldObj.getTileEntity(xCoord, yCoord,
- zCoord + 1) != null
- && worldObj.getTileEntity(xCoord, yCoord,
- zCoord + 1) instanceof TileEntityMolder)
- me = (TileEntityMolder) worldObj.getTileEntity(
- xCoord, yCoord, zCoord + 1);
- else if (worldObj.getBlockMetadata(xCoord, yCoord,
- zCoord) == 3
- && worldObj.getTileEntity(xCoord - 1,
- yCoord, zCoord) != null
- && worldObj.getTileEntity(xCoord - 1,
- yCoord,
- zCoord) instanceof TileEntityMolder)
- me = (TileEntityMolder) worldObj.getTileEntity(
- xCoord - 1, yCoord, zCoord);
+ && worldObj.getTileEntity(xCoord, yCoord, zCoord - 1) != null
+ && worldObj.getTileEntity(xCoord, yCoord, zCoord - 1) instanceof TileEntityMolder)
+ me = (TileEntityMolder) worldObj.getTileEntity(xCoord, yCoord, zCoord - 1);
+ else if (worldObj.getBlockMetadata(xCoord, yCoord, zCoord) == 1
+ && worldObj.getTileEntity(xCoord + 1, yCoord, zCoord) != null
+ && worldObj.getTileEntity(xCoord + 1, yCoord, zCoord) instanceof TileEntityMolder)
+ me = (TileEntityMolder) worldObj.getTileEntity(xCoord + 1, yCoord, zCoord);
+ else if (worldObj.getBlockMetadata(xCoord, yCoord, zCoord) == 2
+ && worldObj.getTileEntity(xCoord, yCoord, zCoord + 1) != null
+ && worldObj.getTileEntity(xCoord, yCoord, zCoord + 1) instanceof TileEntityMolder)
+ me = (TileEntityMolder) worldObj.getTileEntity(xCoord, yCoord, zCoord + 1);
+ else if (worldObj.getBlockMetadata(xCoord, yCoord, zCoord) == 3
+ && worldObj.getTileEntity(xCoord - 1, yCoord, zCoord) != null
+ && worldObj.getTileEntity(xCoord - 1, yCoord, zCoord) instanceof TileEntityMolder)
+ me = (TileEntityMolder) worldObj.getTileEntity(xCoord - 1, yCoord, zCoord);
if (pouring && pouredQuantity > 0f) {
quantity -= 0.01f;
pouredQuantity -= 0.01f;
@@ -212,8 +182,7 @@ public class TileEntitySmelter extends TileEntity { if (quantity <= 0f) {
quantity = 0f;
hasMoltenMetal = false;
- moltenMetal = new ItemStack(
- Item.getItemById(0), 0, 0);
+ moltenMetal = new ItemStack(Item.getItemById(0), 0, 0);
me.cooling = ConfigHandler.INGOT_COOLING_TIME;
}
me.isDirty = true;
@@ -227,8 +196,7 @@ public class TileEntitySmelter extends TileEntity { public Packet getDescriptionPacket() {
NBTTagCompound nbttagcompound = new NBTTagCompound();
writeToNBT(nbttagcompound);
- return new S35PacketUpdateTileEntity(xCoord, yCoord,
- zCoord, 1, nbttagcompound);
+ return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, nbttagcompound);
}
/**
@@ -236,8 +204,7 @@ public class TileEntitySmelter extends TileEntity { * @param packet
*/
@Override
- public void onDataPacket(NetworkManager net,
- S35PacketUpdateTileEntity packet) {
+ public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet) {
readFromNBT(packet.func_148857_g());
worldObj.func_147479_m(xCoord, yCoord, zCoord);
}
diff --git a/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntityDisplayerRender.java b/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntityDisplayerRender.java index aaf4613..360c027 100755 --- a/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntityDisplayerRender.java +++ b/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntityDisplayerRender.java @@ -26,8 +26,7 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation;
public class TileEntityDisplayerRender extends TileEntitySpecialRenderer {
- private final class ChatColorMap
- extends HashMap<EnumChatFormatting, Integer> {
+ private final class ChatColorMap extends HashMap<EnumChatFormatting, Integer> {
private static final long serialVersionUID = -6532830760345687407L;
{
put(EnumChatFormatting.AQUA, 5636095);
@@ -49,155 +48,84 @@ public class TileEntityDisplayerRender extends TileEntitySpecialRenderer { }
}
- ModelDisplayer displayer = new ModelDisplayer();
- String texture = "textures/tileentities/Displayer.png";
- HashMap<EnumChatFormatting, Integer> colors = new ChatColorMap();
+ ModelDisplayer displayer = new ModelDisplayer();
+ String texture = "textures/tileentities/Displayer.png";
+ HashMap<EnumChatFormatting, Integer> colors = new ChatColorMap();
@Override
- public void renderTileEntityAt(TileEntity te, double x, double y,
- double z, float scale) {
+ public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale) {
GL11.glPushMatrix();
- GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F,
- (float) z + 0.5F);
+ GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
TileEntityDisplayer disp = (TileEntityDisplayer) te;
- ResourceLocation blockTexture = new ResourceLocation(
- Variables.MODID, texture);
- Minecraft.getMinecraft().renderEngine
- .bindTexture(blockTexture);
+ ResourceLocation blockTexture = new ResourceLocation(Variables.MODID, texture);
+ Minecraft.getMinecraft().renderEngine.bindTexture(blockTexture);
GL11.glPushMatrix();
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
- displayer.render((Entity) null, disp.ringTranslation1,
- disp.ringTranslation2,
- disp.ringTranslation3, 0.0F, 0.0F,
+ displayer.render((Entity) null, disp.ringTranslation1, disp.ringTranslation2, disp.ringTranslation3, 0.0F, 0.0F,
0.0625F);
try {
int block = disp.getBlockMetadata();
- if (disp != null && disp.hasObject
- && disp.object != null
- && disp.object.getItem() != null
- && disp.object != new ItemStack(
- Item.getItemById(
- 0),
- 0, 0)) {
+ if (disp != null && disp.hasObject && disp.object != null && disp.object.getItem() != null
+ && disp.object != new ItemStack(Item.getItemById(0), 0, 0)) {
int ind = -3;
GL11.glPushMatrix();
- EntityItem entityitem = new EntityItem(
- te.getWorldObj(), 0.0D,
- 0.0D, 0.0D, disp.object);
+ EntityItem entityitem = new EntityItem(te.getWorldObj(), 0.0D, 0.0D, 0.0D, disp.object);
entityitem.hoverStart = 0.0F;
disp.object.stackSize = 1;
GL11.glRotatef(180F, 1F, 0F, 0F);
- GL11.glTranslatef(0.0F, -0.6F
- + disp.ringTranslation1
- / 5,
- 0F);
+ GL11.glTranslatef(0.0F, -0.6F + disp.ringTranslation1 / 5, 0F);
GL11.glRotatef(disp.rotAngle, 0F, 1F, 0F);
GL11.glColor4f(1F, 1F, 1F, 1F);
if (RenderManager.instance.options.fancyGraphics)
- RenderManager.instance
- .renderEntityWithPosYaw(
- entityitem,
- 0.0D,
- 0.0D,
- 0.0D,
- 0.0F,
- 0.0F);
+ RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
else {
GL11.glRotatef(180F, 0F, 1F, 0F);
RenderManager.instance.options.fancyGraphics = true;
int i = 15728880;
int j = i % 65536;
int k = i / 65536;
- OpenGlHelper.setLightmapTextureCoords(
- OpenGlHelper.lightmapTexUnit,
- j / 1.0F,
- k / 1.0F);
- RenderManager.instance
- .renderEntityWithPosYaw(
- entityitem,
- 0.0D,
- 0.0D,
- 0.0D,
- 0.0F,
- 0.0F);
+ OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, j / 1.0F, k / 1.0F);
+ RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
RenderManager.instance.options.fancyGraphics = false;
}
- EntityPlayer player = te.getWorldObj()
- .getClosestPlayer(
- te.xCoord,
- te.yCoord,
- te.zCoord,
- 5D);
+ EntityPlayer player = te.getWorldObj().getClosestPlayer(te.xCoord, te.yCoord, te.zCoord, 5D);
GL11.glPopMatrix();
GL11.glPushMatrix();
if (player != null)
- renderLabel(disp.object
- .getDisplayName(),
- 0F, -0.171F * ind,
- 0F, block, disp,
- colors.get(disp.object
- .getRarity().rarityColor));
+ renderLabel(disp.object.getDisplayName(), 0F, -0.171F * ind, 0F, block, disp,
+ colors.get(disp.object.getRarity().rarityColor));
GL11.glPopMatrix();
ind++;
if (player != null && disp.quantity > 1) {
GL11.glPushMatrix();
- renderLabel("x" + Integer.toString(
- disp.quantity), 0F,
- -0.171F * ind, 0F,
- block, disp,
+ renderLabel("x" + Integer.toString(disp.quantity), 0F, -0.171F * ind, 0F, block, disp,
Color.GRAY.getRGB());
GL11.glPopMatrix();
ind++;
}
- if (disp.object.getItem() != Items.map
- && player != null
- && disp.object.getTooltip(
- player,
- true) != null) {
- List<?> tooltips = disp.object
- .getTooltip(player,
- true);
- if (disp.infoIndex + 5 > tooltips
- .size())
+ if (disp.object.getItem() != Items.map && player != null
+ && disp.object.getTooltip(player, true) != null) {
+ List<?> tooltips = disp.object.getTooltip(player, true);
+ if (disp.infoIndex + 5 > tooltips.size())
disp.infoIndex = 1;
if (tooltips.size() < 5)
- for (int i = 1; i < tooltips
- .size(); i++) {
- String tooltip = tooltips
- .get(i)
- .toString();
- RenderManager.instance
- .getFontRenderer();
+ for (int i = 1; i < tooltips.size(); i++) {
+ String tooltip = tooltips.get(i).toString();
+ RenderManager.instance.getFontRenderer();
if (tooltip != "") {
GL11.glPushMatrix();
- renderLabel(tooltip,
- 0F,
- -0.171F * ind,
- 0F,
- block,
- disp,
- Color.GRAY.getRGB());
+ renderLabel(tooltip, 0F, -0.171F * ind, 0F, block, disp, Color.GRAY.getRGB());
GL11.glPopMatrix();
ind++;
}
}
else
- for (int i = disp.infoIndex; i < disp.infoIndex
- + 5; i++) {
- String tooltip = tooltips
- .get(i)
- .toString();
- RenderManager.instance
- .getFontRenderer();
+ for (int i = disp.infoIndex; i < disp.infoIndex + 5; i++) {
+ String tooltip = tooltips.get(i).toString();
+ RenderManager.instance.getFontRenderer();
if (tooltip != "") {
GL11.glPushMatrix();
- renderLabel(tooltip,
- 0F,
- -0.171F * ind,
- 0F,
- block,
- disp,
- Color.GRAY.getRGB());
+ renderLabel(tooltip, 0F, -0.171F * ind, 0F, block, disp, Color.GRAY.getRGB());
GL11.glPopMatrix();
ind++;
}
@@ -210,10 +138,8 @@ public class TileEntityDisplayerRender extends TileEntitySpecialRenderer { GL11.glPopMatrix();
}
- protected void renderLabel(String text, double x, double y,
- double z, int metadata, TileEntity te, int color) {
- FontRenderer fontrenderer = RenderManager.instance
- .getFontRenderer();
+ protected void renderLabel(String text, double x, double y, double z, int metadata, TileEntity te, int color) {
+ FontRenderer fontrenderer = RenderManager.instance.getFontRenderer();
float width = 0.015F, height = 1F;
GL11.glRotatef(180F, 0F, 0F, 1F);
GL11.glRotatef(360 - metadata * 90F, 0F, 1F, 0F);
@@ -233,35 +159,19 @@ public class TileEntityDisplayerRender extends TileEntitySpecialRenderer { tessellator.draw();
if (fontrenderer.getStringWidth(text) / 2 > 20) {
width = 0.9F / fontrenderer.getStringWidth(text);
- height = 1F - fontrenderer.getStringWidth(text)
- / 20 * 0.06F;
+ height = 1F - fontrenderer.getStringWidth(text) / 20 * 0.06F;
}
- GL11.glTranslatef((float) x + 1f, (float) y + 1f,
- (float) z);
+ GL11.glTranslatef((float) x + 1f, (float) y + 1f, (float) z);
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glScalef(width * 70F, height, 0F);
- fontrenderer.drawString(
- text.replaceFirst("�0", "�r")
- .replaceFirst("�1", "�r")
- .replaceFirst("�2", "�r")
- .replaceFirst("�3", "�r")
- .replaceFirst("�4", "�r")
- .replaceFirst("�5", "�r")
- .replaceFirst("�6", "�r")
- .replaceFirst("�7", "�r")
- .replaceFirst("�8", "�r")
- .replaceFirst("�9", "�r")
- .replaceFirst("�a", "�r")
- .replaceFirst("�b", "�r")
- .replaceFirst("�c", "�r")
- .replaceFirst("�d", "�r")
- .replaceFirst("�e", "�r")
- .replaceFirst("�f", "�r"),
- -j, 0, 1973790);
+ fontrenderer.drawString(text.replaceFirst("�0", "�r").replaceFirst("�1", "�r").replaceFirst("�2", "�r")
+ .replaceFirst("�3", "�r").replaceFirst("�4", "�r").replaceFirst("�5", "�r").replaceFirst("�6", "�r")
+ .replaceFirst("�7", "�r").replaceFirst("�8", "�r").replaceFirst("�9", "�r").replaceFirst("�a", "�r")
+ .replaceFirst("�b", "�r").replaceFirst("�c", "�r").replaceFirst("�d", "�r").replaceFirst("�e", "�r")
+ .replaceFirst("�f", "�r"), -j, 0, 1973790);
GL11.glPopMatrix();
- GL11.glTranslatef((float) x - 0.5f, (float) y - 0.5f,
- (float) z - 0.5F);
+ GL11.glTranslatef((float) x - 0.5f, (float) y - 0.5f, (float) z - 0.5F);
GL11.glScalef(width * 70F, height, 0F);
fontrenderer.drawString(text, -j, 0, color);
GL11.glEnable(GL11.GL_LIGHTING);
diff --git a/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntityHandPedestalRender.java b/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntityHandPedestalRender.java index da8fa58..d3ff955 100755 --- a/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntityHandPedestalRender.java +++ b/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntityHandPedestalRender.java @@ -11,17 +11,15 @@ import net.minecraft.util.ResourceLocation; /**
* @author Paul Fulham (pau101)
*/
-public class TileEntityHandPedestalRender
- extends TileEntitySpecialRenderer {
- private ModelHandPedestal model;
- private ResourceLocation texture;
+public class TileEntityHandPedestalRender extends TileEntitySpecialRenderer {
+ private ModelHandPedestal model;
+ private ResourceLocation texture;
/**
* @param model
* @param texture
*/
- public TileEntityHandPedestalRender(ModelHandPedestal model,
- ResourceLocation texture) {
+ public TileEntityHandPedestalRender(ModelHandPedestal model, ResourceLocation texture) {
this.model = model;
this.texture = texture;
}
@@ -34,18 +32,13 @@ public class TileEntityHandPedestalRender * @param partialRenderTicks
*/
@Override
- public void renderTileEntityAt(TileEntity te, double x, double y,
- double z, float partialRenderTicks) {
+ public void renderTileEntityAt(TileEntity te, double x, double y, double z, float partialRenderTicks) {
GL11.glPushMatrix();
- GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F,
- (float) z + 0.5F);
+ GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
TileEntityHandPedestal pedestal = (TileEntityHandPedestal) te;
bindTexture(texture);
GL11.glRotatef(180, 0, 0, 1);
- GL11.glRotatef(pedestal.getWorldObj() == null ? 180
- : pedestal.getBlockMetadata() % 8 / 8F
- * 360,
- 0, 1, 0);
+ GL11.glRotatef(pedestal.getWorldObj() == null ? 180 : pedestal.getBlockMetadata() % 8 / 8F * 360, 0, 1, 0);
model.render(pedestal, partialRenderTicks, 0.0625F);
GL11.glPopMatrix();
}
diff --git a/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntityJewelrsCraftingTableRender.java b/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntityJewelrsCraftingTableRender.java index fbe3db6..8612eb7 100755 --- a/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntityJewelrsCraftingTableRender.java +++ b/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntityJewelrsCraftingTableRender.java @@ -17,10 +17,9 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
-public class TileEntityJewelrsCraftingTableRender
- extends TileEntitySpecialRenderer {
- ModelJewlersCraftingBench modelTable = new ModelJewlersCraftingBench();
- String texture = "textures/tileentities/JewelrsCraftingBench.png";
+public class TileEntityJewelrsCraftingTableRender extends TileEntitySpecialRenderer {
+ ModelJewlersCraftingBench modelTable = new ModelJewlersCraftingBench();
+ String texture = "textures/tileentities/JewelrsCraftingBench.png";
/**
* @param te
@@ -30,15 +29,11 @@ public class TileEntityJewelrsCraftingTableRender * @param scale
*/
@Override
- public void renderTileEntityAt(TileEntity te, double x, double y,
- double z, float scale) {
+ public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale) {
GL11.glPushMatrix();
- GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F,
- (float) z + 0.5F);
- ResourceLocation blockTexture = new ResourceLocation(
- Variables.MODID, texture);
- Minecraft.getMinecraft().renderEngine
- .bindTexture(blockTexture);
+ GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
+ ResourceLocation blockTexture = new ResourceLocation(Variables.MODID, texture);
+ Minecraft.getMinecraft().renderEngine.bindTexture(blockTexture);
TileEntityJewelrsCraftingTable jt = (TileEntityJewelrsCraftingTable) te;
GL11.glPushMatrix();
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
@@ -55,18 +50,12 @@ public class TileEntityJewelrsCraftingTableRender }
} catch (Exception e) {
}
- modelTable.render((Entity) null, 0.0F, 0.0F, -0.1F, 0.0F,
- 0.0F, 0.0625F);
+ modelTable.render((Entity) null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
if (jt != null) {
- if (jt.hasJewelry && jt.jewelry
- .getIconIndex() != null
- && jt.jewelry.getIconIndex()
- .getIconName() != "") {
+ if (jt.hasJewelry && jt.jewelry.getIconIndex() != null && jt.jewelry.getIconIndex().getIconName() != "") {
GL11.glPushMatrix();
GL11.glDisable(GL11.GL_LIGHTING);
- EntityItem entityitem = new EntityItem(
- te.getWorldObj(), 0.0D,
- 0.0D, 0.0D, jt.jewelry);
+ EntityItem entityitem = new EntityItem(te.getWorldObj(), 0.0D, 0.0D, 0.0D, jt.jewelry);
entityitem.getEntityItem().stackSize = 1;
entityitem.hoverStart = 0.0F;
GL11.glRotatef(180F, 1F, 0F, 0F);
@@ -74,37 +63,20 @@ public class TileEntityJewelrsCraftingTableRender GL11.glTranslatef(0.55F, -1.5F, -0.45F);
GL11.glRotatef(jt.angle, 0F, 1F, 0F);
if (RenderManager.instance.options.fancyGraphics)
- RenderManager.instance
- .renderEntityWithPosYaw(
- entityitem,
- 0.0D,
- 0.0D,
- 0.0D,
- 0.0F,
- 0.0F);
+ RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
else {
GL11.glRotatef(180F, 0F, 1F, 0F);
RenderManager.instance.options.fancyGraphics = true;
- RenderManager.instance
- .renderEntityWithPosYaw(
- entityitem,
- 0.0D,
- 0.0D,
- 0.0D,
- 0.0F,
- 0.0F);
+ RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
RenderManager.instance.options.fancyGraphics = false;
}
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glPopMatrix();
}
- if (jt.hasEndItem && jt.endItem.getIconIndex()
- .getIconName() != "") {
+ if (jt.hasEndItem && jt.endItem.getIconIndex().getIconName() != "") {
GL11.glPushMatrix();
GL11.glDisable(GL11.GL_LIGHTING);
- EntityItem entityitem = new EntityItem(
- te.getWorldObj(), 0.0D,
- 0.0D, 0.0D, jt.endItem);
+ EntityItem entityitem = new EntityItem(te.getWorldObj(), 0.0D, 0.0D, 0.0D, jt.endItem);
entityitem.getEntityItem().stackSize = 1;
entityitem.hoverStart = 0.0F;
GL11.glRotatef(180F, 1F, 0F, 0F);
@@ -112,37 +84,20 @@ public class TileEntityJewelrsCraftingTableRender GL11.glTranslatef(0.0F, -1.6F, 0.6F);
GL11.glRotatef(jt.angle, 0F, 1F, 0F);
if (RenderManager.instance.options.fancyGraphics)
- RenderManager.instance
- .renderEntityWithPosYaw(
- entityitem,
- 0.0D,
- 0.0D,
- 0.0D,
- 0.0F,
- 0.0F);
+ RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
else {
GL11.glRotatef(180F, 0F, 1F, 0F);
RenderManager.instance.options.fancyGraphics = true;
- RenderManager.instance
- .renderEntityWithPosYaw(
- entityitem,
- 0.0D,
- 0.0D,
- 0.0D,
- 0.0F,
- 0.0F);
+ RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
RenderManager.instance.options.fancyGraphics = false;
}
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glPopMatrix();
}
- if (jt.hasGem && jt.gem.getIconIndex()
- .getIconName() != "") {
+ if (jt.hasGem && jt.gem.getIconIndex().getIconName() != "") {
GL11.glPushMatrix();
GL11.glDisable(GL11.GL_LIGHTING);
- EntityItem entityitem = new EntityItem(
- te.getWorldObj(), 0.0D,
- 0.0D, 0.0D, jt.gem);
+ EntityItem entityitem = new EntityItem(te.getWorldObj(), 0.0D, 0.0D, 0.0D, jt.gem);
entityitem.getEntityItem().stackSize = 1;
entityitem.hoverStart = 0.0F;
GL11.glRotatef(180F, 1F, 0F, 0F);
@@ -150,25 +105,11 @@ public class TileEntityJewelrsCraftingTableRender GL11.glTranslatef(-0.55F, -1.5F, -0.45F);
GL11.glRotatef(jt.angle, 0F, 1F, 0F);
if (RenderManager.instance.options.fancyGraphics)
- RenderManager.instance
- .renderEntityWithPosYaw(
- entityitem,
- 0.0D,
- 0.0D,
- 0.0D,
- 0.0F,
- 0.0F);
+ RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
else {
GL11.glRotatef(180F, 0F, 1F, 0F);
RenderManager.instance.options.fancyGraphics = true;
- RenderManager.instance
- .renderEntityWithPosYaw(
- entityitem,
- 0.0D,
- 0.0D,
- 0.0D,
- 0.0F,
- 0.0F);
+ RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
RenderManager.instance.options.fancyGraphics = false;
}
GL11.glEnable(GL11.GL_LIGHTING);
@@ -186,17 +127,13 @@ public class TileEntityJewelrsCraftingTableRender * @param k
* @param block
*/
- public void adjustLightFixture(World world, int i, int j, int k,
- Block block) {
+ public void adjustLightFixture(World world, int i, int j, int k, Block block) {
Tessellator tess = Tessellator.instance;
float brightness = block.getLightOpacity(world, i, j, k);
- int skyLight = world.getLightBrightnessForSkyBlocks(i, j,
- k, 0);
+ int skyLight = world.getLightBrightnessForSkyBlocks(i, j, k, 0);
int modulousModifier = skyLight % 65536;
int divModifier = skyLight / 65536;
tess.setColorOpaque_F(brightness, brightness, brightness);
- OpenGlHelper.setLightmapTextureCoords(
- OpenGlHelper.lightmapTexUnit,
- modulousModifier, divModifier);
+ OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, modulousModifier, divModifier);
}
}
diff --git a/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntityMidasTouchRender.java b/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntityMidasTouchRender.java index f423bc8..e4b1a93 100755 --- a/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntityMidasTouchRender.java +++ b/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntityMidasTouchRender.java @@ -11,8 +11,7 @@ import net.minecraft.tileentity.TileEntity; public class TileEntityMidasTouchRender extends TileEntitySpecialRenderer {
@Override
- public void renderTileEntityAt(TileEntity te, double x, double y,
- double z, float scale) {
+ public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale) {
GL11.glPushMatrix();
TileEntityMidasTouch midas = (TileEntityMidasTouch) te;
if (midas.target != null) {
@@ -20,21 +19,14 @@ public class TileEntityMidasTouchRender extends TileEntitySpecialRenderer { target.hurtTime = 0;
GL11.glTranslatef(0.5F, 0.0F, 0.5F);
GL11.glColor3f(1.0F, 1.0F, 0.0F);
- RenderManager.instance.renderEntityWithPosYaw(
- target,
- midas.xCoord - RenderManager.renderPosX,
- midas.yCoord - RenderManager.renderPosY,
- midas.zCoord - RenderManager.renderPosZ,
- 0F, 1F);
+ RenderManager.instance.renderEntityWithPosYaw(target, midas.xCoord - RenderManager.renderPosX,
+ midas.yCoord - RenderManager.renderPosY, midas.zCoord - RenderManager.renderPosZ, 0F, 1F);
} else {
GL11.glTranslatef(0.5F, 0.0F, 0.5F);
GL11.glColor3f(1.0F, 1.0F, 0.0F);
- RenderManager.instance.renderEntityWithPosYaw(
- new EntityPig(te.getWorldObj()),
- midas.xCoord - RenderManager.renderPosX,
- midas.yCoord - RenderManager.renderPosY,
- midas.zCoord - RenderManager.renderPosZ,
- 0F, 1F);
+ RenderManager.instance.renderEntityWithPosYaw(new EntityPig(te.getWorldObj()),
+ midas.xCoord - RenderManager.renderPosX, midas.yCoord - RenderManager.renderPosY,
+ midas.zCoord - RenderManager.renderPosZ, 0F, 1F);
}
GL11.glPopMatrix();
}
diff --git a/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntityMolderRender.java b/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntityMolderRender.java index c93a09b..269d475 100755 --- a/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntityMolderRender.java +++ b/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntityMolderRender.java @@ -35,17 +35,13 @@ public class TileEntityMolderRender extends TileEntitySpecialRenderer { * @param scale
*/
@Override
- public void renderTileEntityAt(TileEntity te, double x, double y,
- double z, float scale) {
+ public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale) {
GL11.glPushMatrix();
- GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F,
- (float) z + 0.5F);
+ GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
TileEntityMolder me = (TileEntityMolder) te;
String texture = "textures/tileentities/Molder.png";
- ResourceLocation blockTexture = new ResourceLocation(
- Variables.MODID, texture);
- Minecraft.getMinecraft().renderEngine
- .bindTexture(blockTexture);
+ ResourceLocation blockTexture = new ResourceLocation(Variables.MODID, texture);
+ Minecraft.getMinecraft().renderEngine.bindTexture(blockTexture);
GL11.glPushMatrix();
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
try {
@@ -61,16 +57,12 @@ public class TileEntityMolderRender extends TileEntitySpecialRenderer { }
} catch (Exception e) {
}
- modelMolder.render((Entity) null, 0.0F, 0.0F, -0.1F, 0.0F,
- 0.0F, 0.0625F);
- boolean fancyGraphics = Minecraft
- .getMinecraft().gameSettings.fancyGraphics;
+ modelMolder.render((Entity) null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
+ boolean fancyGraphics = Minecraft.getMinecraft().gameSettings.fancyGraphics;
if (me != null) {
if (me.hasMold) {
GL11.glPushMatrix();
- EntityItem entityitem = new EntityItem(
- te.getWorldObj(), 0.0D,
- 0.0D, 0.0D, me.mold);
+ EntityItem entityitem = new EntityItem(te.getWorldObj(), 0.0D, 0.0D, 0.0D, me.mold);
entityitem.getEntityItem().stackSize = 1;
entityitem.hoverStart = 0.0F;
GL11.glTranslatef(0F, 1.43F, -0.28F);
@@ -78,37 +70,16 @@ public class TileEntityMolderRender extends TileEntitySpecialRenderer { GL11.glRotatef(90F, 1F, 0F, 0f);
Minecraft.getMinecraft().gameSettings.fancyGraphics = true;
if (entityitem != null) {
- RenderManager.instance
- .renderEntityWithPosYaw(
- entityitem,
- 0.0D,
- 0.0D,
- 0.0D,
- 0.0F,
- 0.0F);
- RenderManager.instance
- .renderEntityWithPosYaw(
- entityitem,
- 0.0D,
- 0.0D,
- 0.03D,
- 0.0F,
- 0.0F);
+ RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
+ RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.03D, 0.0F, 0.0F);
}
Minecraft.getMinecraft().gameSettings.fancyGraphics = fancyGraphics;
GL11.glPopMatrix();
}
- if (me.hasJewelBase && me.jewelBase != null
- && me.jewelBase.getItem() != Item
- .getItemFromBlock(
- Blocks.air)
- && me.jewelBase.getIconIndex() != null
- && me.jewelBase.getIconIndex()
- .getIconName() != "") {
+ if (me.hasJewelBase && me.jewelBase != null && me.jewelBase.getItem() != Item.getItemFromBlock(Blocks.air)
+ && me.jewelBase.getIconIndex() != null && me.jewelBase.getIconIndex().getIconName() != "") {
GL11.glPushMatrix();
- EntityItem entityitem = new EntityItem(
- te.getWorldObj(), 0.0D,
- 0.0D, 0.0D, me.jewelBase);
+ EntityItem entityitem = new EntityItem(te.getWorldObj(), 0.0D, 0.0D, 0.0D, me.jewelBase);
entityitem.getEntityItem().stackSize = 1;
entityitem.hoverStart = 0.0F;
GL11.glTranslatef(0F, 1.4F, -0.28F);
@@ -116,51 +87,30 @@ public class TileEntityMolderRender extends TileEntitySpecialRenderer { GL11.glRotatef(90F, 1F, 0F, 0f);
Minecraft.getMinecraft().gameSettings.fancyGraphics = true;
if (entityitem != null)
- RenderManager.instance
- .renderEntityWithPosYaw(
- entityitem,
- 0.0D,
- 0.0D,
- 0.01D,
- 0.0F,
- 0.0F);
+ RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.01D, 0.0F, 0.0F);
Minecraft.getMinecraft().gameSettings.fancyGraphics = fancyGraphics;
GL11.glColor4f(1, 1F, 1F, 1.0F);
GL11.glPopMatrix();
}
if (me.hasMoltenMetal && me.moltenMetal != null
- && me.moltenMetal != new ItemStack(
- Item.getItemById(
- 0),
- 0, 0)) {
+ && me.moltenMetal != new ItemStack(Item.getItemById(0), 0, 0)) {
GL11.glPushMatrix();
GL11.glDisable(GL11.GL_LIGHTING);
if (JewelrycraftMod.fancyRender) {
GL11.glEnable(GL11.GL_BLEND);
- OpenGlHelper.glBlendFunc(1, 1, 0,
- 0);
+ OpenGlHelper.glBlendFunc(1, 1, 0, 0);
}
- ItemStack metal = new ItemStack(
- ItemList.metal);
+ ItemStack metal = new ItemStack(ItemList.metal);
ItemStack ingot = me.moltenMetal.copy();
JewelryNBT.addMetal(metal, ingot);
- EntityItem moltenMetal = new EntityItem(
- te.getWorldObj(), 0.0D,
- 0.0D, 0.0D, metal);
+ EntityItem moltenMetal = new EntityItem(te.getWorldObj(), 0.0D, 0.0D, 0.0D, metal);
moltenMetal.getEntityItem().stackSize = 1;
moltenMetal.hoverStart = 0.0F;
- GL11.glTranslatef(-0F, 1.4f
- - 0.005f * me.quantity,
- -0.29F);
+ GL11.glTranslatef(-0F, 1.4f - 0.005f * me.quantity, -0.29F);
GL11.glScalef(1.2F, 1.0F, 1.4F);
GL11.glRotatef(90F, 1F, 0F, 0f);
RenderItem.renderInFrame = true;
- RenderManager.instance
- .renderEntityWithPosYaw(
- moltenMetal,
- 0.0D, 0.0D,
- 0.0D, 0.0F,
- 0.0F);
+ RenderManager.instance.renderEntityWithPosYaw(moltenMetal, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
RenderItem.renderInFrame = false;
if (JewelrycraftMod.fancyRender)
GL11.glDisable(GL11.GL_BLEND);
@@ -179,17 +129,13 @@ public class TileEntityMolderRender extends TileEntitySpecialRenderer { * @param k
* @param block
*/
- public void adjustLightFixture(World world, int i, int j, int k,
- Block block) {
+ public void adjustLightFixture(World world, int i, int j, int k, Block block) {
Tessellator tess = Tessellator.instance;
float brightness = block.getLightOpacity(world, i, j, k);
- int skyLight = world.getLightBrightnessForSkyBlocks(i, j,
- k, 0);
+ int skyLight = world.getLightBrightnessForSkyBlocks(i, j, k, 0);
int modulousModifier = skyLight % 65536;
int divModifier = skyLight / 65536;
tess.setColorOpaque_F(brightness, brightness, brightness);
- OpenGlHelper.setLightmapTextureCoords(
- OpenGlHelper.lightmapTexUnit,
- modulousModifier, divModifier);
+ OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, modulousModifier, divModifier);
}
}
diff --git a/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntityShadowEyeRender.java b/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntityShadowEyeRender.java index 5e191ec..67e20a5 100755 --- a/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntityShadowEyeRender.java +++ b/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntityShadowEyeRender.java @@ -19,8 +19,8 @@ import net.minecraft.util.ResourceLocation; import net.minecraft.world.World;
public class TileEntityShadowEyeRender extends TileEntitySpecialRenderer {
- ModelShadowEye eye = new ModelShadowEye();
- Sphere shadow = new Sphere();
+ ModelShadowEye eye = new ModelShadowEye();
+ Sphere shadow = new Sphere();
/**
* @param te
@@ -30,18 +30,13 @@ public class TileEntityShadowEyeRender extends TileEntitySpecialRenderer { * @param scale
*/
@Override
- public void renderTileEntityAt(TileEntity te, double x, double y,
- double z, float scale) {
+ public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale) {
GL11.glPushMatrix();
- GL11.glTranslatef((float) x + 0.5F, (float) y + 1.6F,
- (float) z + 0.5F);
+ GL11.glTranslatef((float) x + 0.5F, (float) y + 1.6F, (float) z + 0.5F);
TileEntityShadowEye eyeS = (TileEntityShadowEye) te;
- String texture = "textures/tileentities/ShadowEye"
- + eyeS.opening + ".png";
- ResourceLocation blockTexture = new ResourceLocation(
- Variables.MODID, texture);
- Minecraft.getMinecraft().renderEngine
- .bindTexture(blockTexture);
+ String texture = "textures/tileentities/ShadowEye" + eyeS.opening + ".png";
+ ResourceLocation blockTexture = new ResourceLocation(Variables.MODID, texture);
+ Minecraft.getMinecraft().renderEngine.bindTexture(blockTexture);
GL11.glPushMatrix();
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
try {
@@ -55,39 +50,24 @@ public class TileEntityShadowEyeRender extends TileEntitySpecialRenderer { } catch (Exception e) {
}
if (te != null && te.getWorldObj() != null) {
- EntityPlayer player = te.getWorldObj()
- .getClosestPlayer(te.xCoord,
- te.yCoord,
- te.zCoord, 16D);
+ EntityPlayer player = te.getWorldObj().getClosestPlayer(te.xCoord, te.yCoord, te.zCoord, 16D);
if (player != null) {
- float x1 = (float) (te.xCoord
- - player.posX) + 0.5F;
- float y1 = (float) (te.yCoord
- - player.posY) + 0.5F;
- float z1 = (float) (te.zCoord
- - player.posZ) + 0.5F;
- eyeS.model.render(player, 0,
- (float) (x1 >= 0 ? Math
- .atan(z1 / x1)
- : Math.PI + Math.atan(
- z1 / x1)),
- (float) (y1 >= 0 ? Math
- .atan(y1 / x1)
- : Math.atan(y1 / x1)),
- te.blockMetadata,
- eyeS.opening, 0.0625F);
+ float x1 = (float) (te.xCoord - player.posX) + 0.5F;
+ float y1 = (float) (te.yCoord - player.posY) + 0.5F;
+ float z1 = (float) (te.zCoord - player.posZ) + 0.5F;
+ eyeS.model.render(player, 0, (float) (x1 >= 0 ? Math.atan(z1 / x1) : Math.PI + Math.atan(z1 / x1)),
+ (float) (y1 >= 0 ? Math.atan(y1 / x1) : Math.atan(y1 / x1)), te.blockMetadata, eyeS.opening,
+ 0.0625F);
}
} else
- eyeS.model.render((Entity) null, 0.0F, 0.0F, 0.0F,
- 0.0F, 0.0F, 0.0625F);
+ eyeS.model.render((Entity) null, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F);
if (eyeS.opening == 4) {
GL11.glPushMatrix();
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glEnable(GL11.GL_BLEND);
- GL11.glBlendFunc(GL11.GL_ONE_MINUS_SRC_ALPHA,
- GL11.GL_ONE_MINUS_SRC_ALPHA);
+ GL11.glBlendFunc(GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glColor4f(0.0F, 0.0F, 0.0F, 1F);
GL11.glRotatef(eyeS.timer * 10F, 0, 1, 0);
GL11.glRotatef(90.0F, 1, 0, 0);
@@ -110,17 +90,13 @@ public class TileEntityShadowEyeRender extends TileEntitySpecialRenderer { * @param k
* @param block
*/
- public void adjustLightFixture(World world, int i, int j, int k,
- Block block) {
+ public void adjustLightFixture(World world, int i, int j, int k, Block block) {
Tessellator tess = Tessellator.instance;
float brightness = block.getLightOpacity(world, i, j, k);
- int skyLight = world.getLightBrightnessForSkyBlocks(i, j,
- k, 0);
+ int skyLight = world.getLightBrightnessForSkyBlocks(i, j, k, 0);
int modulousModifier = skyLight % 65536;
int divModifier = skyLight / 65536;
tess.setColorOpaque_F(brightness, brightness, brightness);
- OpenGlHelper.setLightmapTextureCoords(
- OpenGlHelper.lightmapTexUnit,
- modulousModifier, divModifier);
+ OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, modulousModifier, divModifier);
}
}
diff --git a/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntityShadowHandRender.java b/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntityShadowHandRender.java index dd960d0..e4d73e9 100755 --- a/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntityShadowHandRender.java +++ b/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntityShadowHandRender.java @@ -6,15 +6,13 @@ import net.minecraft.util.ResourceLocation; /**
* @author Paul Fulham (pau101)
*/
-public class TileEntityShadowHandRender
- extends TileEntityHandPedestalRender {
+public class TileEntityShadowHandRender extends TileEntityHandPedestalRender {
/**
* @param model
* @param texture
*/
- public TileEntityShadowHandRender(ModelHandPedestal model,
- ResourceLocation texture) {
+ public TileEntityShadowHandRender(ModelHandPedestal model, ResourceLocation texture) {
super(model, texture);
}
}
\ No newline at end of file diff --git a/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntitySmelterRender.java b/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntitySmelterRender.java index b694afa..bc49008 100755 --- a/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntitySmelterRender.java +++ b/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntitySmelterRender.java @@ -21,9 +21,8 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation;
public class TileEntitySmelterRender extends TileEntitySpecialRenderer {
- ModelSmelter modelSmelter = new ModelSmelter();
- public static final float p = 1 / 16,
- p3 = 3 * p, p13 = 13 * p, p15 = 15 * p;
+ ModelSmelter modelSmelter = new ModelSmelter();
+ public static final float p = 1 / 16, p3 = 3 * p, p13 = 13 * p, p15 = 15 * p;
/**
* @param te
@@ -33,16 +32,12 @@ public class TileEntitySmelterRender extends TileEntitySpecialRenderer { * @param scale
*/
@Override
- public void renderTileEntityAt(TileEntity te, double x, double y,
- double z, float scale) {
+ public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale) {
GL11.glPushMatrix();
- GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F,
- (float) z + 0.5F);
+ GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
String texture = "textures/tileentities/Smelter.png";
- ResourceLocation blockTexture = new ResourceLocation(
- Variables.MODID, texture);
- Minecraft.getMinecraft().renderEngine
- .bindTexture(blockTexture);
+ ResourceLocation blockTexture = new ResourceLocation(Variables.MODID, texture);
+ Minecraft.getMinecraft().renderEngine.bindTexture(blockTexture);
TileEntitySmelter st = (TileEntitySmelter) te;
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
try {
@@ -58,10 +53,8 @@ public class TileEntitySmelterRender extends TileEntitySpecialRenderer { }
} catch (Exception e) {
}
- boolean fancyGraphics = Minecraft
- .getMinecraft().gameSettings.fancyGraphics;
- modelSmelter.render((Entity) null, 0.0F, 0.0F, -0.1F, 0.0F,
- 0.0F, 0.0625F);
+ boolean fancyGraphics = Minecraft.getMinecraft().gameSettings.fancyGraphics;
+ modelSmelter.render((Entity) null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
if (scale != 0) {
GL11.glPushMatrix();
GL11.glDisable(GL11.GL_LIGHTING);
@@ -69,8 +62,7 @@ public class TileEntitySmelterRender extends TileEntitySpecialRenderer { GL11.glEnable(GL11.GL_BLEND);
OpenGlHelper.glBlendFunc(1, 1, 0, 0);
}
- EntityItem entityitem = new EntityItem(
- te.getWorldObj(), 0.0D, 0.0D, 0.0D,
+ EntityItem entityitem = new EntityItem(te.getWorldObj(), 0.0D, 0.0D, 0.0D,
new ItemStack(Blocks.lava, 1, 1));
entityitem.hoverStart = 0.0F;
GL11.glTranslatef(-0F, 1.25F, -0.345F);
@@ -80,12 +72,8 @@ public class TileEntitySmelterRender extends TileEntitySpecialRenderer { int i = 15728880;
int j = i % 65536;
int k = i / 65536;
- OpenGlHelper.setLightmapTextureCoords(
- OpenGlHelper.lightmapTexUnit,
- j / 1.0F, k / 1.0F);
- RenderManager.instance.renderEntityWithPosYaw(
- entityitem, 0.0D, 0.0D, 0.0D, 0.0F,
- 0.0F);
+ OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, j / 1.0F, k / 1.0F);
+ RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
RenderItem.renderInFrame = false;
if (JewelrycraftMod.fancyRender)
GL11.glDisable(GL11.GL_BLEND);
@@ -93,12 +81,9 @@ public class TileEntitySmelterRender extends TileEntitySpecialRenderer { GL11.glPopMatrix();
}
if (st != null) {
- if (st.hasMetal && st.metal != null
- && st.metal.getItem() != null) {
+ if (st.hasMetal && st.metal != null && st.metal.getItem() != null) {
GL11.glPushMatrix();
- EntityItem metal = new EntityItem(
- te.getWorldObj(), 0.0D,
- 0.0D, 0.0D, st.metal);
+ EntityItem metal = new EntityItem(te.getWorldObj(), 0.0D, 0.0D, 0.0D, st.metal);
metal.getEntityItem().stackSize = 1;
metal.hoverStart = 0.0F;
GL11.glRotatef(-50F, 1F, 0F, 0F);
@@ -107,46 +92,28 @@ public class TileEntitySmelterRender extends TileEntitySpecialRenderer { GL11.glScalef(0.5F, 0.5F, 0.5F);
GL11.glTranslatef(-0.9F, -0.9F, -1.6F);
Minecraft.getMinecraft().gameSettings.fancyGraphics = true;
- RenderManager.instance
- .renderEntityWithPosYaw(
- metal,
- 0.0D, 0.0D,
- 0.0D, 0.0F,
- 0.0F);
+ RenderManager.instance.renderEntityWithPosYaw(metal, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
Minecraft.getMinecraft().gameSettings.fancyGraphics = fancyGraphics;
GL11.glPopMatrix();
}
- if (st.hasMoltenMetal && st.moltenMetal != null
- && st.moltenMetal
- .getItem() != null) {
+ if (st.hasMoltenMetal && st.moltenMetal != null && st.moltenMetal.getItem() != null) {
GL11.glPushMatrix();
GL11.glDisable(GL11.GL_LIGHTING);
if (JewelrycraftMod.fancyRender) {
GL11.glEnable(GL11.GL_BLEND);
- OpenGlHelper.glBlendFunc(1, 1, 0,
- 0);
+ OpenGlHelper.glBlendFunc(1, 1, 0, 0);
}
- ItemStack metal = new ItemStack(
- ItemList.metal);
+ ItemStack metal = new ItemStack(ItemList.metal);
ItemStack ingot = st.moltenMetal.copy();
JewelryNBT.addMetal(metal, ingot);
- EntityItem moltenMetal = new EntityItem(
- te.getWorldObj(), 0.0D,
- 0.0D, 0.0D, metal);
+ EntityItem moltenMetal = new EntityItem(te.getWorldObj(), 0.0D, 0.0D, 0.0D, metal);
moltenMetal.getEntityItem().stackSize = 1;
moltenMetal.hoverStart = 0.0F;
- GL11.glTranslatef(-0F,
- 1.00f - .4F * st.quantity,
- -0.14F);
+ GL11.glTranslatef(-0F, 1.00f - .4F * st.quantity, -0.14F);
GL11.glScalef(0.71F, 1F, 0.84F);
GL11.glRotatef(90F, 1F, 0F, 0f);
RenderItem.renderInFrame = true;
- RenderManager.instance
- .renderEntityWithPosYaw(
- moltenMetal,
- 0.0D, 0.0D,
- 0.0D, 0.0F,
- 0.0F);
+ RenderManager.instance.renderEntityWithPosYaw(moltenMetal, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
RenderItem.renderInFrame = false;
if (JewelrycraftMod.fancyRender)
GL11.glDisable(GL11.GL_BLEND);
diff --git a/src/main/java/darkknight/jewelrycraft/util/BlockUtils.java b/src/main/java/darkknight/jewelrycraft/util/BlockUtils.java index 17a6cdc..615f2ac 100755 --- a/src/main/java/darkknight/jewelrycraft/util/BlockUtils.java +++ b/src/main/java/darkknight/jewelrycraft/util/BlockUtils.java @@ -13,29 +13,26 @@ public class BlockUtils { public static final ForgeDirection DEFAULT_BLOCK_DIRECTION = ForgeDirection.WEST;
/**
- * This method is used to get the direction an entity is facing
- * (NORTH, SOUTH, EAST or WEST) based on the entity's rotationYaw.
+ * This method is used to get the direction an entity is facing (NORTH, SOUTH,
+ * EAST or WEST) based on the entity's rotationYaw.
*
* @param entity
- * the living entity
+ * the living entity
* @return a direction
*/
- public static ForgeDirection get2dOrientation(
- EntityLivingBase entity) {
- int l = MathHelper.floor_double(
- entity.rotationYaw * 4.0F / 360.0F + 0.5D)
- & 0x3;
+ public static ForgeDirection get2dOrientation(EntityLivingBase entity) {
+ int l = MathHelper.floor_double(entity.rotationYaw * 4.0F / 360.0F + 0.5D) & 0x3;
switch (l) {
- case 0:
- return ForgeDirection.SOUTH;
- case 1:
- return ForgeDirection.WEST;
- case 2:
- return ForgeDirection.NORTH;
- case 3:
- return ForgeDirection.EAST;
- default:
- return ForgeDirection.SOUTH;
+ case 0:
+ return ForgeDirection.SOUTH;
+ case 1:
+ return ForgeDirection.WEST;
+ case 2:
+ return ForgeDirection.NORTH;
+ case 3:
+ return ForgeDirection.EAST;
+ default:
+ return ForgeDirection.SOUTH;
}
}
@@ -43,40 +40,38 @@ public class BlockUtils { * This gets a float value depending on a direction
*
* @param direction
- * the forge direction
+ * the forge direction
* @return value depending on direction
*/
- public static float getRotationFromDirection(
- ForgeDirection direction) {
+ public static float getRotationFromDirection(ForgeDirection direction) {
switch (direction) {
- case NORTH:
- return 0F;
- case SOUTH:
- return 180F;
- case WEST:
- return 90F;
- case EAST:
- return -90F;
- case DOWN:
- return -90f;
- case UP:
- return 90f;
- case UNKNOWN:
- default:
- return 0f;
+ case NORTH:
+ return 0F;
+ case SOUTH:
+ return 180F;
+ case WEST:
+ return 90F;
+ case EAST:
+ return -90F;
+ case DOWN:
+ return -90f;
+ case UP:
+ return 90f;
+ case UNKNOWN:
+ default:
+ return 0f;
}
}
/**
- * This method is used to get the direction an entity is looking at
- * (UP or DOWN) based on the entitiy's rotationPitch
+ * This method is used to get the direction an entity is looking at (UP or DOWN)
+ * based on the entitiy's rotationPitch
*
* @param entity
- * the living entity
+ * the living entity
* @return a forge direction
*/
- public static ForgeDirection get3dOrientation(
- EntityLivingBase entity) {
+ public static ForgeDirection get3dOrientation(EntityLivingBase entity) {
if (entity.rotationPitch > 45.5F)
return ForgeDirection.DOWN;
else if (entity.rotationPitch < -45.5F)
@@ -85,38 +80,29 @@ public class BlockUtils { }
/**
- * This spawns the item specified and returns the EntityItem it
- * created
+ * This spawns the item specified and returns the EntityItem it created
*
* @param worldObj
- * the world
+ * the world
* @param x
- * position of the item to drop on the X axis
+ * position of the item to drop on the X axis
* @param y
- * position of the item to drop on the Y axis
+ * position of the item to drop on the Y axis
* @param z
- * position of the item to drop on the Z axis
+ * position of the item to drop on the Z axis
* @param stack
- * the item to spawn
+ * the item to spawn
* @return the EntityItem of the stack
*/
- public static EntityItem dropItemStackInWorld(World worldObj,
- double x, double y, double z, ItemStack stack) {
+ public static EntityItem dropItemStackInWorld(World worldObj, double x, double y, double z, ItemStack stack) {
float f = 0.7F;
- float d0 = worldObj.rand.nextFloat() * f
- + (1.0F - f) * 0.5F;
- float d1 = worldObj.rand.nextFloat() * f
- + (1.0F - f) * 0.5F;
- float d2 = worldObj.rand.nextFloat() * f
- + (1.0F - f) * 0.5F;
- EntityItem entityitem = new EntityItem(worldObj, x + d0,
- y + d1, z + d2, stack);
+ float d0 = worldObj.rand.nextFloat() * f + (1.0F - f) * 0.5F;
+ float d1 = worldObj.rand.nextFloat() * f + (1.0F - f) * 0.5F;
+ float d2 = worldObj.rand.nextFloat() * f + (1.0F - f) * 0.5F;
+ EntityItem entityitem = new EntityItem(worldObj, x + d0, y + d1, z + d2, stack);
entityitem.delayBeforeCanPickup = 10;
if (stack.hasTagCompound())
- entityitem.getEntityItem().setTagCompound(
- (NBTTagCompound) stack
- .getTagCompound()
- .copy());
+ entityitem.getEntityItem().setTagCompound((NBTTagCompound) stack.getTagCompound().copy());
worldObj.spawnEntityInWorld(entityitem);
return entityitem;
}
@@ -125,24 +111,22 @@ public class BlockUtils { * It spawns the item with momentum in a certain direction
*
* @param world
- * the world to spawn the item
+ * the world to spawn the item
* @param x
- * the X coordinate to spawn it in
+ * the X coordinate to spawn it in
* @param y
- * the Y coordinate to spawn it in
+ * the Y coordinate to spawn it in
* @param z
- * the Z coordinate to spawn it in
+ * the Z coordinate to spawn it in
* @param direction
- * the direction towards which it should eject
+ * the direction towards which it should eject
* @param stack
- * the item to spawn
+ * the item to spawn
* @return the spawned EntityItem
*/
- public static EntityItem ejectItemInDirection(World world,
- double x, double y, double z,
- ForgeDirection direction, ItemStack stack) {
- EntityItem item = BlockUtils.dropItemStackInWorld(world, x,
- y, z, stack);
+ public static EntityItem ejectItemInDirection(World world, double x, double y, double z, ForgeDirection direction,
+ ItemStack stack) {
+ EntityItem item = BlockUtils.dropItemStackInWorld(world, x, y, z, stack);
item.motionX = direction.offsetX / 5F;
item.motionY = direction.offsetY / 5F;
item.motionZ = direction.offsetZ / 5F;
@@ -153,25 +137,23 @@ public class BlockUtils { * Drops the content of an inventory with doubles as coordinates
*
* @param inventory
- * the inventory the items are contained in
+ * the inventory the items are contained in
* @param world
- * the world in which to spawn
+ * the world in which to spawn
* @param x
- * the X coordinate to spawn it in
+ * the X coordinate to spawn it in
* @param y
- * the Y coordinate to spawn it in
+ * the Y coordinate to spawn it in
* @param z
- * the Z coordinate to spawn it in
+ * the Z coordinate to spawn it in
*/
- public static void dropInventory(IInventory inventory, World world,
- double x, double y, double z) {
+ public static void dropInventory(IInventory inventory, World world, double x, double y, double z) {
if (inventory == null)
return;
for (int i = 0; i < inventory.getSizeInventory(); ++i) {
ItemStack itemStack = inventory.getStackInSlot(i);
if (itemStack != null)
- dropItemStackInWorld(world, x, y, z,
- itemStack);
+ dropItemStackInWorld(world, x, y, z, itemStack);
}
}
@@ -179,18 +161,17 @@ public class BlockUtils { * Drops the content of an inventory with integer as coordinates
*
* @param inventory
- * the inventory the items are contained in
+ * the inventory the items are contained in
* @param world
- * the world in which to spawn
+ * the world in which to spawn
* @param x
- * the X coordinate to spawn it in
+ * the X coordinate to spawn it in
* @param y
- * the Y coordinate to spawn it in
+ * the Y coordinate to spawn it in
* @param z
- * the Z coordinate to spawn it in
+ * the Z coordinate to spawn it in
*/
- public static void dropInventory(IInventory inventory, World world,
- int x, int y, int z) {
+ public static void dropInventory(IInventory inventory, World world, int x, int y, int z) {
dropInventory(inventory, world, x + 0.5, y + 0.5, z + 0.5);
}
}
\ No newline at end of file diff --git a/src/main/java/darkknight/jewelrycraft/util/EntitySelector.java b/src/main/java/darkknight/jewelrycraft/util/EntitySelector.java index 2398817..572e2e9 100755 --- a/src/main/java/darkknight/jewelrycraft/util/EntitySelector.java +++ b/src/main/java/darkknight/jewelrycraft/util/EntitySelector.java @@ -13,9 +13,7 @@ public class EntitySelector { @Override public boolean isEntityApplicable(Entity arg0) { - if (arg0.isCreatureType( - EnumCreatureType.monster, - false)) { + if (arg0.isCreatureType(EnumCreatureType.monster, false)) { return true; } diff --git a/src/main/java/darkknight/jewelrycraft/util/JewelryNBT.java b/src/main/java/darkknight/jewelrycraft/util/JewelryNBT.java index 320497b..3d42750 100755 --- a/src/main/java/darkknight/jewelrycraft/util/JewelryNBT.java +++ b/src/main/java/darkknight/jewelrycraft/util/JewelryNBT.java @@ -25,9 +25,9 @@ public class JewelryNBT { /**
* @param item
- * The item you want to add the NBT data on
+ * The item you want to add the NBT data on
* @param metal
- * The metal you want to add on the item
+ * The metal you want to add on the item
*/
public static void addMetal(ItemStack item, ItemStack metal) {
NBTTagCompound itemStackData;
@@ -46,9 +46,9 @@ public class JewelryNBT { /**
* @param item
- * The item you want to add the NBT data on
+ * The item you want to add the NBT data on
* @param gem
- * The gem you want to add on the item
+ * The gem you want to add on the item
*/
public static void addGem(ItemStack item, ItemStack gem) {
if (gem != null) {
@@ -67,12 +67,11 @@ public class JewelryNBT { /**
* @param item
- * The item you want to add the NBT data on
+ * The item you want to add the NBT data on
* @param modifier
- * The modifier you want to add on the item
+ * The modifier you want to add on the item
*/
- public static void addModifiers(ItemStack item,
- ArrayList<ItemStack> modifier) {
+ public static void addModifiers(ItemStack item, ArrayList<ItemStack> modifier) {
if (modifier != null) {
NBTTagCompound itemStackData;
if (item.hasTagCompound())
@@ -84,11 +83,9 @@ public class JewelryNBT { for (int i = 0; i < modifier.size(); i++) {
NBTTagCompound modifierNBT = new NBTTagCompound();
modifier.get(i).writeToNBT(modifierNBT);
- itemStackData.setTag("modifier" + i,
- modifierNBT);
+ itemStackData.setTag("modifier" + i, modifierNBT);
}
- itemStackData.setInteger("modifierSize",
- modifier.size());
+ itemStackData.setInteger("modifierSize", modifier.size());
}
}
@@ -148,10 +145,8 @@ public class JewelryNBT { * @return
*/
public static boolean isGemX(ItemStack stack, ItemStack gem) {
- if (gem(stack) != null
- && gem(stack).getItem() == gem.getItem()
- && gem(stack).getItemDamage() == gem
- .getItemDamage())
+ if (gem(stack) != null && gem(stack).getItem() == gem.getItem()
+ && gem(stack).getItemDamage() == gem.getItemDamage())
return true;
return false;
}
@@ -161,29 +156,23 @@ public class JewelryNBT { * @param modifier
* @return
*/
- public static boolean doesModifierExist(ItemStack stack,
- ItemStack modifier) {
+ public static boolean doesModifierExist(ItemStack stack, ItemStack modifier) {
if (modifier(stack) != null) {
ArrayList<ItemStack> list = modifier(stack);
for (int i = 0; i < list.size(); i++)
- if (list.get(i).getItem() == modifier
- .getItem()
- && list.get(i).getItemDamage() == modifier
- .getItemDamage())
+ if (list.get(i).getItem() == modifier.getItem()
+ && list.get(i).getItemDamage() == modifier.getItemDamage())
return true;
}
return false;
}
- public static int modifierSize(ItemStack stack,
- ItemStack modifier) {
+ public static int modifierSize(ItemStack stack, ItemStack modifier) {
if (modifier(stack) != null) {
ArrayList<ItemStack> list = modifier(stack);
for (int i = 0; i < list.size(); i++)
- if (list.get(i).getItem() == modifier
- .getItem()
- && list.get(i).getItemDamage() == modifier
- .getItemDamage())
+ if (list.get(i).getItem() == modifier.getItem()
+ && list.get(i).getItemDamage() == modifier.getItemDamage())
return list.get(i).stackSize;
}
return -1;
@@ -201,27 +190,18 @@ public class JewelryNBT { * @return
*/
public static boolean isIngotX(ItemStack stack, ItemStack ingot) {
- if (ingot(stack) != null
- && ingot(stack).getItem() == ingot
- .getItem()
- && ingot(stack).getItemDamage() == ingot
- .getItemDamage())
+ if (ingot(stack) != null && ingot(stack).getItem() == ingot.getItem()
+ && ingot(stack).getItemDamage() == ingot.getItemDamage())
return true;
return false;
}
// TODO Return components based on NBT
public static ItemStack item(ItemStack stack) {
- if (stack != null
- && stack != new ItemStack(
- Item.getItemById(0), 0, 0)
- && stack.hasTagCompound()
- && stack.getTagCompound()
- .hasKey("target")) {
- NBTTagCompound itemNBT = (NBTTagCompound) stack
- .getTagCompound().getTag("target");
- ItemStack target = new ItemStack(
- Item.getItemById(0), 0, 0);
+ if (stack != null && stack != new ItemStack(Item.getItemById(0), 0, 0) && stack.hasTagCompound()
+ && stack.getTagCompound().hasKey("target")) {
+ NBTTagCompound itemNBT = (NBTTagCompound) stack.getTagCompound().getTag("target");
+ ItemStack target = new ItemStack(Item.getItemById(0), 0, 0);
target.readFromNBT(itemNBT);
return target;
}
@@ -233,15 +213,10 @@ public class JewelryNBT { * @return
*/
public static ItemStack gem(ItemStack stack) {
- if (stack != null
- && stack != new ItemStack(
- Item.getItemById(0), 0, 0)
- && stack.hasTagCompound()
+ if (stack != null && stack != new ItemStack(Item.getItemById(0), 0, 0) && stack.hasTagCompound()
&& stack.getTagCompound().hasKey("gem")) {
- NBTTagCompound jewelNBT = (NBTTagCompound) stack
- .getTagCompound().getTag("gem");
- ItemStack gem = new ItemStack(Item.getItemById(0),
- 0, 0);
+ NBTTagCompound jewelNBT = (NBTTagCompound) stack.getTagCompound().getTag("gem");
+ ItemStack gem = new ItemStack(Item.getItemById(0), 0, 0);
gem.readFromNBT(jewelNBT);
return gem;
}
@@ -253,19 +228,12 @@ public class JewelryNBT { * @return
*/
public static ArrayList<ItemStack> modifier(ItemStack stack) {
- if (stack != null
- && stack != new ItemStack(
- Item.getItemById(0), 0, 0)
- && stack.hasTagCompound()) {
- int size = stack.getTagCompound()
- .getInteger("modifierSize");
+ if (stack != null && stack != new ItemStack(Item.getItemById(0), 0, 0) && stack.hasTagCompound()) {
+ int size = stack.getTagCompound().getInteger("modifierSize");
ArrayList<ItemStack> list = new ArrayList<>();
for (int i = 0; i < size; i++) {
- ItemStack modifier = new ItemStack(
- Item.getItemById(0), 0, 0);
- NBTTagCompound modifierNBT = (NBTTagCompound) stack
- .getTagCompound()
- .getTag("modifier" + i);
+ ItemStack modifier = new ItemStack(Item.getItemById(0), 0, 0);
+ NBTTagCompound modifierNBT = (NBTTagCompound) stack.getTagCompound().getTag("modifier" + i);
modifier.readFromNBT(modifierNBT);
list.add(modifier);
}
@@ -279,16 +247,10 @@ public class JewelryNBT { * @return
*/
public static ItemStack ingot(ItemStack stack) {
- if (stack != null
- && stack != new ItemStack(
- Item.getItemById(0), 0, 0)
- && stack.hasTagCompound()
- && stack.getTagCompound()
- .hasKey("ingot")) {
- NBTTagCompound ingotNBT = (NBTTagCompound) stack
- .getTagCompound().getTag("ingot");
- ItemStack ingot = new ItemStack(
- Item.getItemById(0), 0, 0);
+ if (stack != null && stack != new ItemStack(Item.getItemById(0), 0, 0) && stack.hasTagCompound()
+ && stack.getTagCompound().hasKey("ingot")) {
+ NBTTagCompound ingotNBT = (NBTTagCompound) stack.getTagCompound().getTag("ingot");
+ ItemStack ingot = new ItemStack(Item.getItemById(0), 0, 0);
ingot.readFromNBT(ingotNBT);
return ingot;
}
@@ -300,14 +262,9 @@ public class JewelryNBT { * @return
*/
public static int ingotColor(ItemStack stack) {
- if (stack != null
- && stack != new ItemStack(
- Item.getItemById(0), 0, 0)
- && stack.hasTagCompound()
- && stack.getTagCompound()
- .hasKey("ingotColor"))
- return stack.getTagCompound()
- .getInteger("ingotColor");
+ if (stack != null && stack != new ItemStack(Item.getItemById(0), 0, 0) && stack.hasTagCompound()
+ && stack.getTagCompound().hasKey("ingotColor"))
+ return stack.getTagCompound().getInteger("ingotColor");
return 16777215;
}
@@ -317,14 +274,9 @@ public class JewelryNBT { * @return
*/
public static int gemColor(ItemStack stack) {
- if (stack != null
- && stack != new ItemStack(
- Item.getItemById(0), 0, 0)
- && stack.hasTagCompound()
- && stack.getTagCompound()
- .hasKey("gemColor"))
- return stack.getTagCompound()
- .getInteger("gemColor");
+ if (stack != null && stack != new ItemStack(Item.getItemById(0), 0, 0) && stack.hasTagCompound()
+ && stack.getTagCompound().hasKey("gemColor"))
+ return stack.getTagCompound().getInteger("gemColor");
return 16777215;
}
diff --git a/src/main/java/darkknight/jewelrycraft/util/JewelrycraftUtil.java b/src/main/java/darkknight/jewelrycraft/util/JewelrycraftUtil.java index 6d207ff..80dfdf1 100755 --- a/src/main/java/darkknight/jewelrycraft/util/JewelrycraftUtil.java +++ b/src/main/java/darkknight/jewelrycraft/util/JewelrycraftUtil.java @@ -7,11 +7,8 @@ import java.util.Iterator; import java.util.Random;
import cpw.mods.fml.common.FMLCommonHandler;
-import cpw.mods.fml.common.Loader;
-import cpw.mods.fml.common.registry.GameData;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
-import darkknight.jewelrycraft.JewelrycraftMod;
import darkknight.jewelrycraft.api.Curse;
import darkknight.jewelrycraft.block.BlockList;
import darkknight.jewelrycraft.item.ItemList;
@@ -29,13 +26,11 @@ import net.minecraft.init.Blocks; import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
-import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.stats.Achievement;
import net.minecraft.util.IIcon;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
-import net.minecraftforge.oredict.OreDictionary;
public class JewelrycraftUtil {
public static ArrayList<ItemStack> objects = new ArrayList<>();
@@ -48,8 +43,8 @@ public class JewelrycraftUtil { public static ArrayList<ItemStack> ores = new ArrayList<>();
- public static HashMap<ItemStack, ItemStack> oreToIngot = new HashMap<>();
- public static HashMap<ItemStack, Integer> colors = new HashMap<>();
+ public static HashMap<ItemStack, ItemStack> oreToIngot = new HashMap<>();
+ public static HashMap<ItemStack, Integer> colors = new HashMap<>();
public static ArrayList<String> jamcraftPlayers = new ArrayList<>();
@@ -84,11 +79,11 @@ public class JewelrycraftUtil { jewelry.add(new ItemStack(ItemList.bracelet));
jewelry.add(new ItemStack(ItemList.earrings));
- for(ItemStack is : gem) {
+ for (ItemStack is : gem) {
objects.add(is.copy());
}
- for(ItemStack is : metal) {
+ for (ItemStack is : metal) {
objects.add(is.copy());
}
@@ -100,8 +95,7 @@ public class JewelrycraftUtil { // Structures
try {
- for (Field f : Generation.class
- .getDeclaredFields()) {
+ for (Field f : Generation.class.getDeclaredFields()) {
Object obj = f.get(null);
if (obj instanceof WorldGenStructure) {
structures.add((WorldGenStructure) obj);
@@ -113,24 +107,19 @@ public class JewelrycraftUtil { }
private static boolean itemHasSubtypes(Object item) {
- return ((Item) item).getHasSubtypes() && FMLCommonHandler
- .instance().getSide() == Side.CLIENT;
+ return ((Item) item).getHasSubtypes() && FMLCommonHandler.instance().getSide() == Side.CLIENT;
}
@SideOnly(Side.CLIENT)
public static void generateColors() {
-
+
}
@SideOnly(Side.CLIENT)
public static int getColor(ItemStack item) {
for (ItemStack stack : colors.keySet()) {
- if (item != null && item.getItem() != null
- && stack.getItem() != null
- && item.getItem().equals(
- stack.getItem())
- && item.getItemDamage() == stack
- .getItemDamage()) {
+ if (item != null && item.getItem() != null && stack.getItem() != null
+ && item.getItem().equals(stack.getItem()) && item.getItemDamage() == stack.getItemDamage()) {
return colors.get(stack);
}
}
@@ -142,15 +131,11 @@ public class JewelrycraftUtil { public static int color(ItemStack stack, int pass) {
if (stack != null) {
if (Item.getIdFromItem(stack.getItem()) > 0
- && stack.getItem()
- .getColorFromItemStack(
- stack,
- pass) == 16777215) {
+ && stack.getItem().getColorFromItemStack(stack, pass) == 16777215) {
return (int) Math.random() * 16777215;
}
- return stack.getItem().getColorFromItemStack(stack,
- pass);
+ return stack.getItem().getColorFromItemStack(stack, pass);
}
return (int) Math.random() * 16777215;
@@ -164,67 +149,46 @@ public class JewelrycraftUtil { IIcon itemIcon = item.getItem().getIcon(item, 0);
if (isValidBlockFromItem(item)) {
- itemIcon = Block.getBlockFromItem(item.getItem())
- .getIcon(0, item.getItemDamage());
+ 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();
+ 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";
+ texture = iconName.substring(iconName.lastIndexOf(":") + 1) + ".png";
ResourceLocation textureLocation = null;
- TextureManager texturemanager = Minecraft.getMinecraft()
- .getTextureManager();
+ TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager();
- if (texturemanager
- .getResourceLocation(
- item.getItemSpriteNumber())
- .toString().contains("items")) {
- textureLocation = new ResourceLocation(
- domain.toLowerCase(),
- "textures/items/" + texture);
+ if (texturemanager.getResourceLocation(item.getItemSpriteNumber()).toString().contains("items")) {
+ textureLocation = new ResourceLocation(domain.toLowerCase(), "textures/items/" + texture);
} else {
- textureLocation = new ResourceLocation(
- domain.toLowerCase(),
- "textures/blocks/" + texture);
+ textureLocation = new ResourceLocation(domain.toLowerCase(), "textures/blocks/" + texture);
}
return textureLocation;
}
private static boolean isValidBlockFromItem(ItemStack item) {
- return !(Block.getBlockFromItem(
- item.getItem()) instanceof BlockAir)
- && !Block.getBlockFromItem(item.getItem())
- .getIcon(0, item.getItemDamage())
- .getIconName()
- .equals("soul_sand");
+ return !(Block.getBlockFromItem(item.getItem()) instanceof BlockAir) && !Block.getBlockFromItem(item.getItem())
+ .getIcon(0, item.getItemDamage()).getIconName().equals("soul_sand");
}
/*
- * @SideOnly(Side.CLIENT) public static int getMostCommonColour(Map
- * map) { List list = new LinkedList(map.entrySet());
- * Collections.sort(list, new Comparator() { public int
- * compare(Object o1, Object o2) { return ((Comparable)
- * ((Map.Entry) o1).getValue()) .compareTo(((Map.Entry)
- * o2).getValue()); } }); Map.Entry me = (Map.Entry)
- * list.get(list.size() - 1); for (int i = 0; i < list.size(); i++)
- * { float alpha = Float
- * .valueOf(list.get(i).toString().split("=")[1]); if (alpha < 180)
- * me = (Map.Entry) list.get(i); } int rgb = (Integer) me.getKey();
- * return rgb; }
+ * @SideOnly(Side.CLIENT) public static int getMostCommonColour(Map map) { List
+ * list = new LinkedList(map.entrySet()); Collections.sort(list, new
+ * Comparator() { public int compare(Object o1, Object o2) { return
+ * ((Comparable) ((Map.Entry) o1).getValue()) .compareTo(((Map.Entry)
+ * o2).getValue()); } }); Map.Entry me = (Map.Entry) list.get(list.size() - 1);
+ * for (int i = 0; i < list.size(); i++) { float alpha = Float
+ * .valueOf(list.get(i).toString().split("=")[1]); if (alpha < 180) me =
+ * (Map.Entry) list.get(i); } int rgb = (Integer) me.getKey(); return rgb; }
*/
@SideOnly(Side.CLIENT)
@@ -238,17 +202,12 @@ public class JewelrycraftUtil { return true;
}
- public static WeightedRandomCurse[] getCurses(World world,
- EntityPlayer player, Random random) {
- WeightedRandomCurse[] curses = new WeightedRandomCurse[Curse.availableCurses
- .size()];
+ public static WeightedRandomCurse[] getCurses(World world, EntityPlayer player, Random random) {
+ WeightedRandomCurse[] curses = new WeightedRandomCurse[Curse.availableCurses.size()];
for (int c = 0; c < Curse.availableCurses.size(); c++) {
- curses[c] = new WeightedRandomCurse(
- Curse.availableCurses.get(c),
- Curse.availableCurses.get(c)
- .weight(world, player,
- random));
+ curses[c] = new WeightedRandomCurse(Curse.availableCurses.get(c),
+ Curse.availableCurses.get(c).weight(world, player, random));
}
return curses;
@@ -258,27 +217,21 @@ public class JewelrycraftUtil { * Adds curse points to a player
*
* @param player
- * the player to add the points to
+ * the player to add the points to
* @param points
- * amount of curse points
+ * amount of curse points
*/
- public static void addCursePoints(EntityPlayer player,
- int points) {
- NBTTagCompound playerInfo = PlayerUtils
- .getModPlayerPersistTag(player,
- Variables.MODID);
+ public static void addCursePoints(EntityPlayer player, int points) {
+ NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(player, Variables.MODID);
playerInfo.setInteger("cursePoints",
- playerInfo.hasKey(
- "cursePoints") ? (playerInfo.getInteger("cursePoints") + points) : points);
+ playerInfo.hasKey("cursePoints") ? (playerInfo.getInteger("cursePoints") + points) : points);
playerInfo.setBoolean("playerCursePointsChanged", true);
}
public static int getCursePoints(EntityPlayer player) {
- NBTTagCompound playerInfo = PlayerUtils
- .getModPlayerPersistTag(player,
- Variables.MODID);
+ NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(player, Variables.MODID);
return playerInfo.getInteger("cursePoints");
}
@@ -287,56 +240,37 @@ public class JewelrycraftUtil { * Adds the UUID's of the jamcrafters in a list (+ special people)
*/
public static void jamcrafters() {
- jamcraftPlayers.add(
- "d3214311-7550-4c9c-a372-d9292c10b8a6"); // allout58
- jamcraftPlayers.add(
- "a690119f-c4a2-4bd6-a99d-d63679abb328"); // ChewBaker
- jamcraftPlayers.add(
- "de7c9903-51fa-4a24-88cd-48faf122ca36"); // domi1819
- jamcraftPlayers.add(
- "70aeb298-3a7b-46da-a393-ab10df9359f2"); // founderio
- jamcraftPlayers.add(
- "6fbe603c-14bf-4085-afdd-abe592c26e7c"); // GerbShert
- jamcraftPlayers.add(
- "b0d21306-36bf-4d85-84df-a956d183c45a"); // isomgirls6
- jamcraftPlayers.add(
- "1733a31f-01f9-4f4d-82aa-7de30ca810d3"); // TH3N00B
- jamcraftPlayers.add(
- "4833eacf-1d94-49a7-9f89-4cf88d69dcf9"); // Joban
- jamcraftPlayers.add(
- "718cf671-9084-4e78-b91f-033e80aa11bf"); // KJ4IPS
- jamcraftPlayers.add(
- "bea5e0c4-85c4-454d-a081-e1eaae6895ee"); // Mitchellbrine
- jamcraftPlayers.add(
- "7ecf3e2f-fedf-4f7e-8d24-6731d078db4f"); // MrComputerGhost
- jamcraftPlayers.add(
- "1b11ad3a-f0ca-4695-a019-2d7e5d83a5fd"); // Resinresin
- jamcraftPlayers.add(
- "3ec9ac58-2f1b-4d3f-b4eb-3b875da877ae"); // sci4me
- jamcraftPlayers.add(
- "cf9fa23f-205e-4eed-aba3-9f2848cd6a4d"); // OnyxDarkKnight
- jamcraftPlayers.add(
- "91880caa-b032-48e3-bfe8-c2c7ed31824e"); // theminecoder
- jamcraftPlayers.add(
- "8d0b3804-f71c-4219-897b-8c315448ea7c"); // YSPilot
- jamcraftPlayers.add(
- "bbb87dbe-690f-4205-bdc5-72ffb8ebc29d"); // direwolf20
+ jamcraftPlayers.add("d3214311-7550-4c9c-a372-d9292c10b8a6"); // allout58
+ jamcraftPlayers.add("a690119f-c4a2-4bd6-a99d-d63679abb328"); // ChewBaker
+ jamcraftPlayers.add("de7c9903-51fa-4a24-88cd-48faf122ca36"); // domi1819
+ jamcraftPlayers.add("70aeb298-3a7b-46da-a393-ab10df9359f2"); // founderio
+ jamcraftPlayers.add("6fbe603c-14bf-4085-afdd-abe592c26e7c"); // GerbShert
+ jamcraftPlayers.add("b0d21306-36bf-4d85-84df-a956d183c45a"); // isomgirls6
+ jamcraftPlayers.add("1733a31f-01f9-4f4d-82aa-7de30ca810d3"); // TH3N00B
+ jamcraftPlayers.add("4833eacf-1d94-49a7-9f89-4cf88d69dcf9"); // Joban
+ jamcraftPlayers.add("718cf671-9084-4e78-b91f-033e80aa11bf"); // KJ4IPS
+ jamcraftPlayers.add("bea5e0c4-85c4-454d-a081-e1eaae6895ee"); // Mitchellbrine
+ jamcraftPlayers.add("7ecf3e2f-fedf-4f7e-8d24-6731d078db4f"); // MrComputerGhost
+ jamcraftPlayers.add("1b11ad3a-f0ca-4695-a019-2d7e5d83a5fd"); // Resinresin
+ jamcraftPlayers.add("3ec9ac58-2f1b-4d3f-b4eb-3b875da877ae"); // sci4me
+ jamcraftPlayers.add("cf9fa23f-205e-4eed-aba3-9f2848cd6a4d"); // OnyxDarkKnight
+ jamcraftPlayers.add("91880caa-b032-48e3-bfe8-c2c7ed31824e"); // theminecoder
+ jamcraftPlayers.add("8d0b3804-f71c-4219-897b-8c315448ea7c"); // YSPilot
+ jamcraftPlayers.add("bbb87dbe-690f-4205-bdc5-72ffb8ebc29d"); // direwolf20
}
/**
* Adds a random amount of modifiers to a list
*
* @param randValue
- * maximum number of modifiers
+ * maximum number of modifiers
* @return a list containing the random modifiers
*/
- public static ArrayList<ItemStack> addRandomModifiers(
- int randValue) {
+ public static ArrayList<ItemStack> addRandomModifiers(int randValue) {
ArrayList<ItemStack> list = new ArrayList<>();
for (int i = 0; i < 2 + randValue; i++) {
- ItemStack item = objects.get(new Random()
- .nextInt(objects.size()));
+ ItemStack item = objects.get(new Random().nextInt(objects.size()));
item.stackSize = 1 + new Random().nextInt(2);
@@ -357,7 +291,7 @@ public class JewelrycraftUtil { * Checks to see if the specified item is a gem
*
* @param item
- * ItemStack containing the item
+ * ItemStack containing the item
* @return is the item a gem
*/
public static boolean isGem(ItemStack item) {
@@ -368,7 +302,7 @@ public class JewelrycraftUtil { * Checks to see if the specified item is a metal
*
* @param item
- * ItemStack containing the item
+ * ItemStack containing the item
* @return is the item a metal
*/
public static boolean isMetal(ItemStack item) {
@@ -379,20 +313,17 @@ public class JewelrycraftUtil { * Checks to see if the specified item is a piece of jewelry
*
* @param item
- * ItemStack containing the item
+ * ItemStack containing the item
* @return is the item a piece of jewelry
*/
public static boolean isJewelry(ItemStack item) {
return isItemStackIn(item, jewelry.iterator());
}
- private static boolean isItemStackIn(ItemStack item,
- Iterator<ItemStack> i) {
+ private static boolean isItemStackIn(ItemStack item, Iterator<ItemStack> i) {
while (i.hasNext()) {
ItemStack temp = i.next();
- if (temp.getItem() == item.getItem()
- && temp.getItemDamage() == item
- .getItemDamage()) {
+ if (temp.getItem() == item.getItem() && temp.getItemDamage() == item.getItemDamage()) {
return true;
}
}
@@ -404,7 +335,7 @@ public class JewelrycraftUtil { * Checks to see if the specified item is an ore
*
* @param item
- * ItemStack containing the item
+ * ItemStack containing the item
* @return is the item an ore
*/
public static boolean isOre(ItemStack item) {
@@ -415,14 +346,12 @@ public class JewelrycraftUtil { * Gets the ingot from the ore
*
* @param ore
- * the ore
+ * the ore
* @return the ingot
*/
public static ItemStack getIngotFromOre(ItemStack ore) {
for (ItemStack ors : JewelrycraftUtil.oreToIngot.keySet())
- if (ors.getItem().equals(ore.getItem())
- && ors.getItemDamage() == ore
- .getItemDamage()) {
+ if (ors.getItem().equals(ore.getItem()) && ors.getItemDamage() == ore.getItemDamage()) {
return oreToIngot.get(ors);
}
@@ -430,19 +359,16 @@ public class JewelrycraftUtil { }
/**
- * This determines whether the player unlocked an achievement or
- * not.
+ * This determines whether the player unlocked an achievement or not.
*
* @param player
- * The player to unlock the achievement
+ * The player to unlock the achievement
* @param achievement
- * The achievement to be unlocked
- * @return True or False depending if the player did unlock the
- * achievement or not
+ * The achievement to be unlocked
+ * @return True or False depending if the player did unlock the achievement or
+ * not
*/
- public static boolean isAchievementUnlocked(EntityPlayer player,
- Achievement achievement) {
- return ((EntityPlayerMP) player).func_147099_x()
- .hasAchievementUnlocked(achievement);
+ public static boolean isAchievementUnlocked(EntityPlayer player, Achievement achievement) {
+ return ((EntityPlayerMP) player).func_147099_x().hasAchievementUnlocked(achievement);
}
}
diff --git a/src/main/java/darkknight/jewelrycraft/util/PlayerUtils.java b/src/main/java/darkknight/jewelrycraft/util/PlayerUtils.java index 8a3abe3..90b507e 100755 --- a/src/main/java/darkknight/jewelrycraft/util/PlayerUtils.java +++ b/src/main/java/darkknight/jewelrycraft/util/PlayerUtils.java @@ -12,26 +12,22 @@ public class PlayerUtils { * Returns the NBTTag of the player * * @param player - * the player + * the player * @param modName - * the mod name + * the mod name * @return appropriate NBTTag */ - public static NBTTagCompound getModPlayerPersistTag( - EntityPlayer player, String modName) { - if (player.worldObj.isRemote - && ScreenHandler.tagCache != null) + public static NBTTagCompound getModPlayerPersistTag(EntityPlayer player, String modName) { + if (player.worldObj.isRemote && ScreenHandler.tagCache != null) return ScreenHandler.tagCache; NBTTagCompound tag = player.getEntityData(); NBTTagCompound persistTag = null; if (tag.hasKey(EntityPlayer.PERSISTED_NBT_TAG)) - persistTag = tag.getCompoundTag( - EntityPlayer.PERSISTED_NBT_TAG); + persistTag = tag.getCompoundTag(EntityPlayer.PERSISTED_NBT_TAG); else { persistTag = new NBTTagCompound(); - tag.setTag(EntityPlayer.PERSISTED_NBT_TAG, - persistTag); + tag.setTag(EntityPlayer.PERSISTED_NBT_TAG, persistTag); } NBTTagCompound modTag = null; if (persistTag.hasKey(modName)) diff --git a/src/main/java/darkknight/jewelrycraft/util/Variables.java b/src/main/java/darkknight/jewelrycraft/util/Variables.java index 8b853ef..f1537c6 100755 --- a/src/main/java/darkknight/jewelrycraft/util/Variables.java +++ b/src/main/java/darkknight/jewelrycraft/util/Variables.java @@ -5,23 +5,21 @@ import net.minecraft.util.ResourceLocation; public class Variables {
public static final int CURSE_POINTS_PER_LEVEL = 7000;
- public static final String MODID = "jewelrycraft2";
- public static final String MODNAME = "Jewelrycraft 2";
- public static final String VERSION = "1.1.4";
- public static final String PACKET_CHANNEL = "jewelrycraft2";
+ public static final String MODID = "jewelrycraft2";
+ public static final String MODNAME = "Jewelrycraft 2";
+ public static final String VERSION = "1.1.4";
+ public static final String PACKET_CHANNEL = "jewelrycraft2";
- public static final String CONFIG_GUI = "darkknight.jewelrycraft.config.ConfigGuiFactory";
- public static final String CLIENT_PROXY = "darkknight.jewelrycraft.proxy.ClientProxy";
- public static final String SERVER_PROXY = "darkknight.jewelrycraft.proxy.CommonProxy";
+ public static final String CONFIG_GUI = "darkknight.jewelrycraft.config.ConfigGuiFactory";
+ public static final String CLIENT_PROXY = "darkknight.jewelrycraft.proxy.ClientProxy";
+ public static final String SERVER_PROXY = "darkknight.jewelrycraft.proxy.CommonProxy";
- public static final ResourceLocation PEDESTAL_TEXTURE = new ResourceLocation(
- Variables.MODID,
+ public static final ResourceLocation PEDESTAL_TEXTURE = new ResourceLocation(Variables.MODID,
"textures/tileentities/BricksPedestal.png");
- public static final ResourceLocation SHADOW_HAND_TEXTURE = new ResourceLocation(
- Variables.MODID,
+ public static final ResourceLocation SHADOW_HAND_TEXTURE = new ResourceLocation(Variables.MODID,
"textures/tileentities/ShadowHand.png");
- public static final ResourceLocation VILLAGER_TEXTURE = new ResourceLocation(
- Variables.MODID, "textures/entities/jeweler.png");
- public static final ResourceLocation MISC_TEXTURE = new ResourceLocation(
- Variables.MODID, "textures/gui/hearts.png");
+ public static final ResourceLocation VILLAGER_TEXTURE = new ResourceLocation(Variables.MODID,
+ "textures/entities/jeweler.png");
+ public static final ResourceLocation MISC_TEXTURE = new ResourceLocation(Variables.MODID,
+ "textures/gui/hearts.png");
}
diff --git a/src/main/java/darkknight/jewelrycraft/worldGen/ChestGeneration.java b/src/main/java/darkknight/jewelrycraft/worldGen/ChestGeneration.java index c84696d..fca251c 100755 --- a/src/main/java/darkknight/jewelrycraft/worldGen/ChestGeneration.java +++ b/src/main/java/darkknight/jewelrycraft/worldGen/ChestGeneration.java @@ -17,69 +17,45 @@ import net.minecraftforge.common.ChestGenHooks; *
*/
public class ChestGeneration {
- static Item[] jewelry = new Item[] {
- ItemList.ring, ItemList.necklace,
- ItemList.bracelet, ItemList.earrings
- };
+ static Item[] jewelry = new Item[] { ItemList.ring, ItemList.necklace, ItemList.bracelet, ItemList.earrings };
static Random random = new Random();
public static void preInit(FMLPreInitializationEvent e) {
- addItemToDifferentPlaces(new WeightedRandomChestContent(
- new ItemStack(ItemList.thiefGloves), 1, 1,
- 2), true, true, false, false, true);
+ addItemToDifferentPlaces(new WeightedRandomChestContent(new ItemStack(ItemList.thiefGloves), 1, 1, 2), true,
+ true, false, false, true);
- addItemToDifferentPlaces(new WeightedRandomChestContent(
- new ItemStack(ItemList.guide), 1, 1, 7),
- true, true, true, true, true, false, true,
- true);
+ addItemToDifferentPlaces(new WeightedRandomChestContent(new ItemStack(ItemList.guide), 1, 1, 7), true, true,
+ true, true, true, false, true, true);
- addVillageBlacksmithLoot(new WeightedRandomChestContent(
- new ItemStack(ItemList.shadowIngot), 1, 4,
- 5));
+ addVillageBlacksmithLoot(new WeightedRandomChestContent(new ItemStack(ItemList.shadowIngot), 1, 4, 5));
for (int i = 0; i < 16 && i % 3 == 0; i++)
- addItemToDifferentPlaces(
- new WeightedRandomChestContent(
- new ItemStack(BlockList.crystal,
- 1,
- i),
- 1, 3, 3),
+ addItemToDifferentPlaces(new WeightedRandomChestContent(new ItemStack(BlockList.crystal, 1, i), 1, 3, 3),
true, true, true, true);
- ItemStack special = new ItemStack(
- jewelry[random.nextInt(4)]);
+ ItemStack special = new ItemStack(jewelry[random.nextInt(4)]);
int randValue = random.nextInt(4);
if (JewelrycraftUtil.metal.size() > 0) {
- JewelryNBT.addMetal(special, JewelrycraftUtil.metal
- .get(random.nextInt(
- JewelrycraftUtil.metal
- .size())));
+ JewelryNBT.addMetal(special, JewelrycraftUtil.metal.get(random.nextInt(JewelrycraftUtil.metal.size())));
}
if (JewelrycraftUtil.objects.size() > 0) {
- JewelryNBT.addModifiers(special, JewelrycraftUtil
- .addRandomModifiers(randValue));
+ JewelryNBT.addModifiers(special, JewelrycraftUtil.addRandomModifiers(randValue));
}
if (JewelrycraftUtil.gem.size() > 0) {
- JewelryNBT.addGem(special, JewelrycraftUtil.gem
- .get(random.nextInt(
- JewelrycraftUtil.gem
- .size())));
+ JewelryNBT.addGem(special, JewelrycraftUtil.gem.get(random.nextInt(JewelrycraftUtil.gem.size())));
}
- addItemToDifferentPlaces(
- new WeightedRandomChestContent(special, 1,
- 1, 1),
- true, true, true, true);
+ addItemToDifferentPlaces(new WeightedRandomChestContent(special, 1, 1, 1), true, true, true, true);
}
/**
- * The booleans determine in which places should the items be
- * added. The order is like so:
+ * The booleans determine in which places should the items be added. The order
+ * is like so:
* <p>
* <ul>
* <li>Dungeon
@@ -93,9 +69,7 @@ public class ChestGeneration { * </ul>
* <p>
*/
- public static void addItemToDifferentPlaces(
- WeightedRandomChestContent item,
- Boolean... options) {
+ public static void addItemToDifferentPlaces(WeightedRandomChestContent item, Boolean... options) {
if (options.length > 0 && options[0])
addDungeonLoot(item);
if (options.length > 1 && options[1])
@@ -114,54 +88,37 @@ public class ChestGeneration { addStrongholdLibraryLoot(item);
}
- public static void addDungeonLoot(
- WeightedRandomChestContent item) {
+ public static void addDungeonLoot(WeightedRandomChestContent item) {
ChestGenHooks.addItem(ChestGenHooks.DUNGEON_CHEST, item);
}
- public static void addStrongholdLoot(
- WeightedRandomChestContent item) {
- ChestGenHooks.addItem(ChestGenHooks.STRONGHOLD_CORRIDOR,
- item);
- ChestGenHooks.addItem(ChestGenHooks.STRONGHOLD_CROSSING,
- item);
+ public static void addStrongholdLoot(WeightedRandomChestContent item) {
+ ChestGenHooks.addItem(ChestGenHooks.STRONGHOLD_CORRIDOR, item);
+ ChestGenHooks.addItem(ChestGenHooks.STRONGHOLD_CROSSING, item);
}
- public static void addPyramidLoot(
- WeightedRandomChestContent item) {
- ChestGenHooks.addItem(ChestGenHooks.PYRAMID_DESERT_CHEST,
- item);
- ChestGenHooks.addItem(ChestGenHooks.PYRAMID_JUNGLE_CHEST,
- item);
+ public static void addPyramidLoot(WeightedRandomChestContent item) {
+ ChestGenHooks.addItem(ChestGenHooks.PYRAMID_DESERT_CHEST, item);
+ ChestGenHooks.addItem(ChestGenHooks.PYRAMID_JUNGLE_CHEST, item);
}
- public static void addMineshaftLoot(
- WeightedRandomChestContent item) {
- ChestGenHooks.addItem(ChestGenHooks.MINESHAFT_CORRIDOR,
- item);
+ public static void addMineshaftLoot(WeightedRandomChestContent item) {
+ ChestGenHooks.addItem(ChestGenHooks.MINESHAFT_CORRIDOR, item);
}
- public static void addVillageBlacksmithLoot(
- WeightedRandomChestContent item) {
- ChestGenHooks.addItem(ChestGenHooks.VILLAGE_BLACKSMITH,
- item);
+ public static void addVillageBlacksmithLoot(WeightedRandomChestContent item) {
+ ChestGenHooks.addItem(ChestGenHooks.VILLAGE_BLACKSMITH, item);
}
- public static void addDispenserLoot(
- WeightedRandomChestContent item) {
- ChestGenHooks.addItem(
- ChestGenHooks.PYRAMID_JUNGLE_DISPENSER,
- item);
+ public static void addDispenserLoot(WeightedRandomChestContent item) {
+ ChestGenHooks.addItem(ChestGenHooks.PYRAMID_JUNGLE_DISPENSER, item);
}
- public static void addBonusChestLoot(
- WeightedRandomChestContent item) {
+ public static void addBonusChestLoot(WeightedRandomChestContent item) {
ChestGenHooks.addItem(ChestGenHooks.BONUS_CHEST, item);
}
- public static void addStrongholdLibraryLoot(
- WeightedRandomChestContent item) {
- ChestGenHooks.addItem(ChestGenHooks.STRONGHOLD_LIBRARY,
- item);
+ public static void addStrongholdLibraryLoot(WeightedRandomChestContent item) {
+ ChestGenHooks.addItem(ChestGenHooks.STRONGHOLD_LIBRARY, item);
}
}
diff --git a/src/main/java/darkknight/jewelrycraft/worldGen/Generation.java b/src/main/java/darkknight/jewelrycraft/worldGen/Generation.java index cc7790b..4d39023 100755 --- a/src/main/java/darkknight/jewelrycraft/worldGen/Generation.java +++ b/src/main/java/darkknight/jewelrycraft/worldGen/Generation.java @@ -13,85 +13,57 @@ import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.chunk.IChunkProvider;
public class Generation implements IWorldGenerator {
- public static WorldGenStructure STRUCTURE_1 = new WorldGenStructure1();
- public static WorldGenStructure STRUCTURE_2 = new WorldGenStructure2();
- public static WorldGenStructure STRUCTURE_3 = new WorldGenStructure3();
- public static WorldGenStructure STRUCTURE_4 = new WorldGenStructure4();
- public static WorldGenStructure STRUCTURE_5 = new WorldGenStructure5();
- public static WorldGenStructure STRUCTURE_6 = new WorldGenStructure6();
+ public static WorldGenStructure STRUCTURE_1 = new WorldGenStructure1();
+ public static WorldGenStructure STRUCTURE_2 = new WorldGenStructure2();
+ public static WorldGenStructure STRUCTURE_3 = new WorldGenStructure3();
+ public static WorldGenStructure STRUCTURE_4 = new WorldGenStructure4();
+ public static WorldGenStructure STRUCTURE_5 = new WorldGenStructure5();
+ public static WorldGenStructure STRUCTURE_6 = new WorldGenStructure6();
@Override
- public void generate(Random random, int chunkX, int chunkZ,
- World world, IChunkProvider chunkGenerator,
+ public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator,
IChunkProvider chunkProvider) {
switch (world.provider.dimensionId) {
- case -1:
- generateNether(world, random, chunkX << 4,
- chunkZ << 4);
- break;
- case 0:
- generateSurface(world, random, chunkX << 4,
- chunkZ << 4);
- break;
- case 1:
- generateEnd(world, random, chunkX << 4,
- chunkZ << 4);
- break;
- default:
- generateSurface(world, random, chunkX << 4,
- chunkZ << 4);
- break;
+ case -1:
+ generateNether(world, random, chunkX << 4, chunkZ << 4);
+ break;
+ case 0:
+ generateSurface(world, random, chunkX << 4, chunkZ << 4);
+ break;
+ case 1:
+ generateEnd(world, random, chunkX << 4, chunkZ << 4);
+ break;
+ default:
+ generateSurface(world, random, chunkX << 4, chunkZ << 4);
+ break;
}
}
- private void generateEnd(World world, Random random, int i,
- int j) {
+ private void generateEnd(World world, Random random, int i, int j) {
}
- private void generateSurface(World world, Random random, int i,
- int j) {
+ private void generateSurface(World world, Random random, int i, int j) {
if (ConfigHandler.ENABLE_WORLD_GEN) {
- if (!world.getWorldInfo().getTerrainType()
- .equals(WorldType.FLAT)) {
+ if (!world.getWorldInfo().getTerrainType().equals(WorldType.FLAT)) {
if (ConfigHandler.ORE_GEN)
- generateShadowOre(world, random, i,
- j);
+ generateShadowOre(world, random, i, j);
if (ConfigHandler.CRYSTAL_GEN)
- generateCrystals(world, random, i,
- j);
+ generateCrystals(world, random, i, j);
try {
- for (Field f : this.getClass()
- .getDeclaredFields()) {
+ for (Field f : this.getClass().getDeclaredFields()) {
Object obj = f.get(null);
if (obj instanceof WorldGenStructure
- && ConfigHandler.STRUCTURES[((WorldGenStructure) obj)
- .structureNo()
- - 1])
- if (((WorldGenStructure) obj)
- .isUnderground())
- generateStructureUnderground(
- (WorldGenStructure) obj,
- world,
- random,
- i,
- j,
- ConfigHandler.STRUCTURES_SPAWN_CHANCE[((WorldGenStructure) obj)
- .structureNo()
+ && ConfigHandler.STRUCTURES[((WorldGenStructure) obj).structureNo() - 1])
+ if (((WorldGenStructure) obj).isUnderground())
+ generateStructureUnderground((WorldGenStructure) obj, world, random, i, j,
+ ConfigHandler.STRUCTURES_SPAWN_CHANCE[((WorldGenStructure) obj).structureNo()
- 1],
- false,
- true);
+ false, true);
else
- generateStructureOverground(
- (WorldGenStructure) obj,
- world,
- random,
- i,
- j,
- ConfigHandler.STRUCTURES_SPAWN_CHANCE[((WorldGenStructure) obj)
- .structureNo()
+ generateStructureOverground((WorldGenStructure) obj, world, random, i, j,
+ ConfigHandler.STRUCTURES_SPAWN_CHANCE[((WorldGenStructure) obj).structureNo()
- 1],
- false,
- true);
+ false, true);
}
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
@@ -100,33 +72,23 @@ public class Generation implements IWorldGenerator { }
}
- private void generateNether(World world, Random random, int i,
- int j) {
+ private void generateNether(World world, Random random, int i, int j) {
}
- private void generateShadowOre(World world, Random random, int i,
- int j) {
+ private void generateShadowOre(World world, Random random, int i, int j) {
for (int k = 0; k < 1; k++) {
int x = i + random.nextInt(16);
int y = 5 + random.nextInt(4);
int z = j + random.nextInt(16);
if (world.getBlock(x, y, z) == Blocks.stone)
- world.setBlock(x, y, z,
- BlockList.shadowOre);
- int randX = random.nextInt(2),
- randY = random.nextInt(1),
- randZ = random.nextInt(2);
- if (random.nextInt(3) == 0 && world.getBlock(
- x + randX, y + randY,
- z + randZ) == Blocks.stone)
- world.setBlock(x + randX, y + randY,
- z + randZ,
- BlockList.shadowOre);
+ world.setBlock(x, y, z, BlockList.shadowOre);
+ int randX = random.nextInt(2), randY = random.nextInt(1), randZ = random.nextInt(2);
+ if (random.nextInt(3) == 0 && world.getBlock(x + randX, y + randY, z + randZ) == Blocks.stone)
+ world.setBlock(x + randX, y + randY, z + randZ, BlockList.shadowOre);
}
}
- private void generateCrystals(World world, Random random, int i,
- int j) {
+ private void generateCrystals(World world, Random random, int i, int j) {
for (int k = 0; k < 16; k++) {
int x = i + random.nextInt(12);
int y = 5 + random.nextInt(64);
@@ -135,113 +97,57 @@ public class Generation implements IWorldGenerator { int randX = random.nextInt(4);
int randY = random.nextInt(2);
int randZ = random.nextInt(4);
- if (world.getBlock(x + randX,
- y + randY - 1,
- z + randZ) == Blocks.stone
- && world.getBlock(
- x + randX,
- y + randY,
- z + randZ) == Blocks.air)
- world.setBlock(x + randX,
- y + randY,
- z + randZ,
- BlockList.crystal,
- random.nextInt(16),
- 2);
+ if (world.getBlock(x + randX, y + randY - 1, z + randZ) == Blocks.stone
+ && world.getBlock(x + randX, y + randY, z + randZ) == Blocks.air)
+ world.setBlock(x + randX, y + randY, z + randZ, BlockList.crystal, random.nextInt(16), 2);
}
}
}
- private void generateStructureUnderground(
- WorldGenStructure structure, World world,
- Random random, int i, int j, int maxAttempts,
- boolean noOfAttempts, boolean chanceOfSpawning) {
+ private void generateStructureUnderground(WorldGenStructure structure, World world, Random random, int i, int j,
+ int maxAttempts, boolean noOfAttempts, boolean chanceOfSpawning) {
BiomeGenBase biomeBase = world.getBiomeGenForCoords(i, j);
if (noOfAttempts) {
for (int k = 0; k < maxAttempts; k++) {
int x = i + random.nextInt(16);
int y = random.nextInt(64);
int z = j + random.nextInt(16);
- if (world.getBlock(x, y,
- z) == Blocks.stone)
- structure.generate(world,
- biomeBase, random,
- x, y, z);
+ if (world.getBlock(x, y, z) == Blocks.stone)
+ structure.generate(world, biomeBase, random, x, y, z);
}
} else if (chanceOfSpawning) {
if (random.nextInt(maxAttempts) == 0) {
int x = i + random.nextInt(16);
int y = random.nextInt(64);
int z = j + random.nextInt(16);
- if (world.getBlock(x, y,
- z) == Blocks.stone)
- structure.generate(world,
- biomeBase, random,
- x, y, z);
+ if (world.getBlock(x, y, z) == Blocks.stone)
+ structure.generate(world, biomeBase, random, x, y, z);
}
}
}
- private void generateStructureOverground(
- WorldGenStructure structure, World world,
- Random random, int i, int j, int maxAttempts,
- boolean noOfAttempts, boolean chanceOfSpawning) {
+ private void generateStructureOverground(WorldGenStructure structure, World world, Random random, int i, int j,
+ int maxAttempts, boolean noOfAttempts, boolean chanceOfSpawning) {
BiomeGenBase biomeBase = world.getBiomeGenForCoords(i, j);
if (noOfAttempts) {
for (int k = 0; k < maxAttempts; k++) {
int x = i + random.nextInt(16);
- int y = (world.getChunkHeightMapMinimum(i,
- j) > 0 ? world.getChunkHeightMapMinimum(
- i, j)
- : world.getChunkFromChunkCoords(
- i,
- j).heightMapMinimum
- - 16)
- + random.nextInt(4);
+ int y = (world.getChunkHeightMapMinimum(i, j) > 0 ? world.getChunkHeightMapMinimum(i, j)
+ : world.getChunkFromChunkCoords(i, j).heightMapMinimum - 16) + random.nextInt(4);
int z = j + random.nextInt(16);
- if (world.getBlock(x, y, z) == Blocks.air
- && (world.getBlock(x,
- y - 1,
- z) == Blocks.stone
- || world.getBlock(
- x,
- y - 1,
- z) == Blocks.sand
- || world.getBlock(
- x,
- y - 1,
- z) == Blocks.grass))
- structure.generate(world,
- biomeBase, random,
- x, y, z);
+ if (world.getBlock(x, y, z) == Blocks.air && (world.getBlock(x, y - 1, z) == Blocks.stone
+ || world.getBlock(x, y - 1, z) == Blocks.sand || world.getBlock(x, y - 1, z) == Blocks.grass))
+ structure.generate(world, biomeBase, random, x, y, z);
}
} else if (chanceOfSpawning) {
if (random.nextInt(maxAttempts) == 0) {
int x = i + random.nextInt(16);
- int y = (world.getChunkHeightMapMinimum(i,
- j) > 0 ? world.getChunkHeightMapMinimum(
- i, j)
- : world.getChunkFromChunkCoords(
- i,
- j).heightMapMinimum
- - 16)
- + random.nextInt(4);
+ int y = (world.getChunkHeightMapMinimum(i, j) > 0 ? world.getChunkHeightMapMinimum(i, j)
+ : world.getChunkFromChunkCoords(i, j).heightMapMinimum - 16) + random.nextInt(4);
int z = j + random.nextInt(16);
- if (world.getBlock(x, y, z) == Blocks.air
- && (world.getBlock(x,
- y - 1,
- z) == Blocks.stone
- || world.getBlock(
- x,
- y - 1,
- z) == Blocks.sand
- || world.getBlock(
- x,
- y - 1,
- z) == Blocks.grass)) {
- structure.generate(world,
- biomeBase, random,
- x, y, z);
+ if (world.getBlock(x, y, z) == Blocks.air && (world.getBlock(x, y - 1, z) == Blocks.stone
+ || world.getBlock(x, y - 1, z) == Blocks.sand || world.getBlock(x, y - 1, z) == Blocks.grass)) {
+ structure.generate(world, biomeBase, random, x, y, z);
System.out.println(x + " " + z);
}
}
diff --git a/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure.java b/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure.java index bc4f508..1165de8 100755 --- a/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure.java +++ b/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure.java @@ -13,14 +13,12 @@ import net.minecraft.world.gen.feature.WorldGenerator; * @author Sorin
*/
public class WorldGenStructure extends WorldGenerator {
- public boolean generate(World world, BiomeGenBase biome,
- Random rand, int x, int y, int z) {
+ public boolean generate(World world, BiomeGenBase biome, Random rand, int x, int y, int z) {
return false;
}
@Override
- public boolean generate(World world, Random rand, int x, int y,
- int z) {
+ public boolean generate(World world, Random rand, int x, int y, int z) {
return false;
}
diff --git a/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure1.java b/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure1.java index 9e86822..11fcf18 100755 --- a/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure1.java +++ b/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure1.java @@ -22,37 +22,21 @@ import net.minecraft.world.biome.BiomeGenBase; */
public class WorldGenStructure1 extends WorldGenStructure {
public static final WeightedRandomItem[] items = new WeightedRandomItem[] {
- new WeightedRandomItem(new ItemStack(
- ItemList.thiefGloves), 10),
- new WeightedRandomItem(
- new ItemStack(Items.golden_apple),
- 8),
- new WeightedRandomItem(new ItemStack(
- Items.golden_apple, 1, 1), 1),
- new WeightedRandomItem(
- new ItemStack(ItemList.guide), 20),
- new WeightedRandomItem(new ItemStack(
- ItemList.shadowIngot), 25),
- new WeightedRandomItem(
- new ItemStack(BlockList.shadowEye),
- 2),
- new WeightedRandomItem(
- new ItemStack(Items.nether_star),
- 1),
- new WeightedRandomItem(new ItemStack(
- BlockList.shadowBlock), 2),
- new WeightedRandomItem(
- new ItemStack(BlockList.crystal),
- 16, 20)
- };
+ new WeightedRandomItem(new ItemStack(ItemList.thiefGloves), 10),
+ new WeightedRandomItem(new ItemStack(Items.golden_apple), 8),
+ new WeightedRandomItem(new ItemStack(Items.golden_apple, 1, 1), 1),
+ new WeightedRandomItem(new ItemStack(ItemList.guide), 20),
+ new WeightedRandomItem(new ItemStack(ItemList.shadowIngot), 25),
+ new WeightedRandomItem(new ItemStack(BlockList.shadowEye), 2),
+ new WeightedRandomItem(new ItemStack(Items.nether_star), 1),
+ new WeightedRandomItem(new ItemStack(BlockList.shadowBlock), 2),
+ new WeightedRandomItem(new ItemStack(BlockList.crystal), 16, 20) };
@Override
- public boolean generate(World world, BiomeGenBase biome,
- Random rand, int x, int y, int z) {
+ public boolean generate(World world, BiomeGenBase biome, Random rand, int x, int y, int z) {
Block block = Blocks.stonebrick;
int metadata = 0, slabMeta = 5;
- if (biome == BiomeGenBase.desert
- || biome == BiomeGenBase.desertHills) {
+ if (biome == BiomeGenBase.desert || biome == BiomeGenBase.desertHills) {
block = Blocks.sandstone;
metadata = 2;
slabMeta = 1;
@@ -60,36 +44,25 @@ public class WorldGenStructure1 extends WorldGenStructure { for (int i = -2; i <= 2; i++)
for (int j = -1; j <= 4; j++)
for (int k = -2; k <= 2; k++)
- world.setBlock(x + i, y + j, z + k,
- Blocks.air);
+ world.setBlock(x + i, y + j, z + k, Blocks.air);
for (int i = -2; i <= 2; i++)
for (int k = -2; k <= 2; k++) {
- world.setBlock(x + i, y - 1, z + k, block,
- metadata, 2);
- if (i % 2 == 0 && k % 2 == 0 && i != 0
- && k != 0)
- world.setBlock(x + i, y, z + k,
- BlockList.crystal);
+ world.setBlock(x + i, y - 1, z + k, block, metadata, 2);
+ if (i % 2 == 0 && k % 2 == 0 && i != 0 && k != 0)
+ world.setBlock(x + i, y, z + k, BlockList.crystal);
}
for (int i = -1; i <= 1; i++)
for (int k = -1; k <= 1; k++)
- world.setBlock(x + i, y, z + k,
- Blocks.stone_slab,
- slabMeta, 2);
+ world.setBlock(x + i, y, z + k, Blocks.stone_slab, slabMeta, 2);
world.setBlock(x, y, z, block, metadata, 2);
world.setBlock(x, y + 1, z, BlockList.handPedestal, 6, 2);
- TileEntityHandPedestal pedestal = (TileEntityHandPedestal) world
- .getTileEntity(x, y + 1, z);
- pedestal.setHeldItemStack(
- ((WeightedRandomItem) WeightedRandom
- .getRandomItem(rand,
- items)).getItem(rand));
+ TileEntityHandPedestal pedestal = (TileEntityHandPedestal) world.getTileEntity(x, y + 1, z);
+ pedestal.setHeldItemStack(((WeightedRandomItem) WeightedRandom.getRandomItem(rand, items)).getItem(rand));
return true;
}
@Override
- public boolean generate(World world, Random rand, int x, int y,
- int z) {
+ public boolean generate(World world, Random rand, int x, int y, int z) {
return generate(world, BiomeGenBase.plains, rand, x, y, z);
}
diff --git a/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure2.java b/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure2.java index b61b9cd..3c304b0 100755 --- a/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure2.java +++ b/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure2.java @@ -18,60 +18,42 @@ import net.minecraft.world.biome.BiomeGenBase; */
public class WorldGenStructure2 extends WorldGenStructure {
@Override
- public boolean generate(World world, BiomeGenBase biome,
- Random rand, int x, int y, int z) {
+ public boolean generate(World world, BiomeGenBase biome, Random rand, int x, int y, int z) {
Block block = Blocks.stonebrick;
Block stair = Blocks.stone_brick_stairs;
int metadata = 0;
- if (biome == BiomeGenBase.desert
- || biome == BiomeGenBase.desertHills) {
+ if (biome == BiomeGenBase.desert || biome == BiomeGenBase.desertHills) {
block = Blocks.sandstone;
stair = Blocks.sandstone_stairs;
metadata = 2;
}
for (int i = -1; i <= 1; i++)
for (int k = -1; k <= 1; k++)
- world.setBlock(x + i, y, z + k,
- Blocks.air);
+ world.setBlock(x + i, y, z + k, Blocks.air);
for (int i = -1; i <= 1; i++)
for (int k = -1; k <= 1; k++)
- world.setBlock(x + i, y - 1, z + k, block,
- metadata, 2);
+ world.setBlock(x + i, y - 1, z + k, block, metadata, 2);
for (int i = -1; i <= 1; i++)
for (int k = -1; k <= 1; k++)
world.setBlock(x + i, y, z + k, stair);
for (int i = -1; i <= 1; i++)
for (int k = -1; k <= 1; k++)
- world.setBlockMetadataWithNotify(x + i, y,
- z + k,
- (k == -1) ? 3
- : (k == 0) ? (i == 1)
- ? 0
- : 1
- : 2,
- 2);
+ 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())));
+ 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);
- world.setBlock(x, y, z, BlockList.moltenMetal, 0,
- 3);
- if (BlockMoltenMetal.getTileEntity(world, x, y,
- z) != null)
- BlockMoltenMetal.getTileEntity(world, x, y,
- z)
- .setMetal(JewelryNBT.ingot(
- stack));
+ world.setBlock(x, y, z, BlockList.moltenMetal, 0, 3);
+ if (BlockMoltenMetal.getTileEntity(world, x, y, z) != null)
+ BlockMoltenMetal.getTileEntity(world, x, y, z).setMetal(JewelryNBT.ingot(stack));
}
return true;
}
@Override
- public boolean generate(World world, Random rand, int x, int y,
- int z) {
+ public boolean generate(World world, Random rand, int x, int y, int z) {
return generate(world, BiomeGenBase.plains, rand, x, y, z);
}
diff --git a/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure3.java b/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure3.java index 5eafd03..0af7443 100755 --- a/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure3.java +++ b/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure3.java @@ -17,83 +17,54 @@ import net.minecraftforge.common.DungeonHooks; */
public class WorldGenStructure3 extends WorldGenStructure {
@Override
- public boolean generate(World world, BiomeGenBase biome,
- Random rand, int x, int y, int z) {
+ public boolean generate(World world, BiomeGenBase biome, Random rand, int x, int y, int z) {
Block slab = Blocks.stone_slab;
Block stair = Blocks.stone_brick_stairs;
int slabMeta = 13;
- if (biome == BiomeGenBase.desert
- || biome == BiomeGenBase.desertHills) {
+ if (biome == BiomeGenBase.desert || biome == BiomeGenBase.desertHills) {
stair = Blocks.sandstone_stairs;
slabMeta = 9;
}
for (int i = -1; i <= 1; i++)
for (int j = -1; j <= 2; j++)
for (int k = -1; k <= 1; k++)
- world.setBlock(x + i, y + j, z + k,
- Blocks.air);
+ world.setBlock(x + i, y + j, z + k, Blocks.air);
for (int i = -1; i <= 1; i++)
for (int k = -1; k <= 1; k++)
- world.setBlock(x + i, y - 1, z + k, slab,
- slabMeta, 1);
+ world.setBlock(x + i, y - 1, z + k, slab, slabMeta, 1);
for (int i = -1; i <= 1; i++)
for (int k = -1; k <= 1; k++)
world.setBlock(x + i, y, z + k, stair);
for (int i = -1; i <= 1; i++)
for (int k = -1; k <= 1; k++)
- world.setBlockMetadataWithNotify(x + i, y,
- z + k,
- (k == -1) ? 3
- : (k == 0) ? (i == 1)
- ? 0
- : 1
- : 2,
- 2);
+ world.setBlockMetadataWithNotify(x + i, y, z + k, (k == -1) ? 3 : (k == 0) ? (i == 1) ? 0 : 1 : 2, 2);
for (int i = -1; i <= 1; i++)
for (int k = -1; k <= 1; k++)
world.setBlock(x + i, y + 1, z + k, stair);
for (int i = -1; i <= 1; i++)
for (int k = -1; k <= 1; k++)
- world.setBlockMetadataWithNotify(x + i,
- y + 1, z + k,
- (k == -1) ? 7
- : (k == 0) ? (i == 1)
- ? 4
- : 5
- : 6,
+ world.setBlockMetadataWithNotify(x + i, y + 1, z + k, (k == -1) ? 7 : (k == 0) ? (i == 1) ? 4 : 5 : 6,
2);
slabMeta = 5;
- if (biome == BiomeGenBase.desert
- || biome == BiomeGenBase.desertHills)
+ if (biome == BiomeGenBase.desert || biome == BiomeGenBase.desertHills)
slabMeta = 1;
for (int i = -1; i <= 1; i++)
for (int k = -1; k <= 1; k++)
- world.setBlock(x + i, y + 2, z + k, slab,
- slabMeta, 2);
+ world.setBlock(x + i, y + 2, z + k, slab, slabMeta, 2);
world.setBlock(x, y, z, Blocks.mob_spawner);
world.setBlock(x, y + 1, z, Blocks.mob_spawner);
for (int l = 0; l < 2; l++) {
- TileEntityMobSpawner tileentitymobspawner = (TileEntityMobSpawner) world
- .getTileEntity(x, y + l, z);
+ TileEntityMobSpawner tileentitymobspawner = (TileEntityMobSpawner) world.getTileEntity(x, y + l, z);
if (tileentitymobspawner != null)
- tileentitymobspawner.func_145881_a()
- .setEntityName(DungeonHooks
- .getRandomDungeonMob(
- rand));
+ tileentitymobspawner.func_145881_a().setEntityName(DungeonHooks.getRandomDungeonMob(rand));
else
- System.err.println(
- "Failed to fetch mob spawner entity at ("
- + x + ", "
- + (y + l)
- + ", " + z
- + ")");
+ System.err.println("Failed to fetch mob spawner entity at (" + x + ", " + (y + l) + ", " + z + ")");
}
return true;
}
@Override
- public boolean generate(World world, Random rand, int x, int y,
- int z) {
+ public boolean generate(World world, Random rand, int x, int y, int z) {
return generate(world, BiomeGenBase.plains, rand, x, y, z);
}
diff --git a/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure4.java b/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure4.java index 2dc2544..78eb883 100755 --- a/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure4.java +++ b/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure4.java @@ -16,13 +16,11 @@ import net.minecraft.world.biome.BiomeGenBase; */
public class WorldGenStructure4 extends WorldGenStructure {
@Override
- public boolean generate(World world, BiomeGenBase biome,
- Random rand, int x, int y, int z) {
+ public boolean generate(World world, BiomeGenBase biome, Random rand, int x, int y, int z) {
Block stair = Blocks.stone_brick_stairs;
Block block = Blocks.stonebrick;
int metadata = 0, slabMeta = 5;
- if (biome == BiomeGenBase.desert
- || biome == BiomeGenBase.desertHills) {
+ if (biome == BiomeGenBase.desert || biome == BiomeGenBase.desertHills) {
stair = Blocks.sandstone_stairs;
block = Blocks.sandstone;
metadata = 2;
@@ -31,13 +29,10 @@ public class WorldGenStructure4 extends WorldGenStructure { for (int i = -1; i <= 1; i++)
for (int j = 0; j <= 3; j++)
for (int k = -1; k <= 1; k++)
- world.setBlock(x + i, y + j, z + k,
- Blocks.air);
+ world.setBlock(x + i, y + j, z + k, Blocks.air);
for (int i = -1; i <= 1; i++)
for (int k = -1; k <= 1; k++)
- world.setBlock(x + i, y, z + k,
- Blocks.stone_slab,
- slabMeta, 2);
+ world.setBlock(x + i, y, z + k, Blocks.stone_slab, slabMeta, 2);
world.setBlock(x, y, z, block, metadata, 2);
world.setBlock(x, y, z - 1, stair, 3, 1);
world.setBlock(x, y, z + 1, stair, 2, 1);
@@ -49,23 +44,19 @@ public class WorldGenStructure4 extends WorldGenStructure { world.setBlock(x + 1, y + 1, z, stair, 4, 1);
world.setBlock(x, y + 1, z, BlockList.shadowBlock);
slabMeta = 5;
- if (biome == BiomeGenBase.desert
- || biome == BiomeGenBase.desertHills)
+ if (biome == BiomeGenBase.desert || biome == BiomeGenBase.desertHills)
slabMeta = 1;
for (int i = -1; i <= 1; i++)
for (int k = -1; k <= 1; k++)
if (i == 0 || k == 0)
- world.setBlock(x + i, y + 2, z + k,
- Blocks.stone_slab,
- slabMeta, 2);
+ world.setBlock(x + i, y + 2, z + k, Blocks.stone_slab, slabMeta, 2);
world.setBlock(x, y + 2, z, block, metadata, 2);
world.setBlock(x, y + 3, z, BlockList.crystal);
return true;
}
@Override
- public boolean generate(World world, Random rand, int x, int y,
- int z) {
+ public boolean generate(World world, Random rand, int x, int y, int z) {
return generate(world, BiomeGenBase.plains, rand, x, y, z);
}
diff --git a/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure5.java b/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure5.java index 16782af..5208aa0 100755 --- a/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure5.java +++ b/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure5.java @@ -21,14 +21,12 @@ import net.minecraft.world.biome.BiomeGenBase; */
public class WorldGenStructure5 extends WorldGenStructure {
@Override
- public boolean generate(World world, BiomeGenBase biome,
- Random rand, int x, int y, int z) {
+ public boolean generate(World world, BiomeGenBase biome, Random rand, int x, int y, int z) {
Block slab = Blocks.stone_slab;
Block stair = Blocks.stone_brick_stairs;
Block block = Blocks.stonebrick;
int metadata = 0, slabMeta = 5;
- if (biome == BiomeGenBase.desert
- || biome == BiomeGenBase.desertHills) {
+ if (biome == BiomeGenBase.desert || biome == BiomeGenBase.desertHills) {
stair = Blocks.sandstone_stairs;
block = Blocks.sandstone;
metadata = 2;
@@ -37,30 +35,23 @@ public class WorldGenStructure5 extends WorldGenStructure { for (int i = -2; i <= 2; i++)
for (int j = 0; j <= 3; j++)
for (int k = -3; k <= -1; k++)
- world.setBlock(x + i, y + j, z + k,
- Blocks.air);
+ world.setBlock(x + i, y + j, z + k, Blocks.air);
for (int i = -5; i <= -3; i++)
for (int k = -3; k <= 2; k++)
- world.setBlock(x + i, y, z + k,
- Blocks.air);
+ world.setBlock(x + i, y, z + k, Blocks.air);
for (int i = -2; i <= 2; i++)
for (int k = -3; k <= -1; k++)
- world.setBlock(x + i, y, z + k, block,
- metadata, 2);
+ world.setBlock(x + i, y, z + k, block, metadata, 2);
for (int i = 1; i <= 2; i++)
for (int k = -3; k <= -1; k++)
- world.setBlock(x + i, y + 1, z + k, block,
- metadata, 2);
+ world.setBlock(x + i, y + 1, z + k, block, metadata, 2);
for (int i = -5; i <= -3; i++)
for (int k = -3; k <= 2; k++)
- world.setBlock(x + i, y - 1, z + k, block,
- metadata, 2);
+ world.setBlock(x + i, y - 1, z + k, block, metadata, 2);
for (int i = -5; i <= -3; i++)
for (int k = -3; k <= 2; k++)
- if ((i != -4 || k <= -3 || k >= 2)
- && !(i == -3 && k == -2))
- world.setBlock(x + i, y, z + k,
- slab, slabMeta, 2);
+ if ((i != -4 || k <= -3 || k >= 2) && !(i == -3 && k == -2))
+ world.setBlock(x + i, y, z + k, slab, slabMeta, 2);
world.setBlock(x - 3, y, z - 1, stair, 0, 2);
world.setBlock(x - 3, y, z - 3, stair, 0, 2);
world.setBlock(x - 2, y + 1, z - 3, slab, slabMeta, 2);
@@ -72,37 +63,24 @@ public class WorldGenStructure5 extends WorldGenStructure { world.setBlock(x + 1, y + 2, z - 3, slab, slabMeta, 2);
world.setBlock(x + 1, y + 2, z - 1, slab, slabMeta, 2);
for (int k = -3; k <= -1; k++)
- world.setBlock(x + 2, y + 2, z + k, block,
- metadata, 2);
+ world.setBlock(x + 2, y + 2, z + k, block, metadata, 2);
if (rand.nextInt(5) == 0) {
ItemStack stack = new ItemStack(ItemList.bucket);
- JewelryNBT.addMetal(stack,
- new ItemStack(Items.gold_ingot));
- if (stack != null && JewelryNBT
- .ingot(stack) != null) {
+ JewelryNBT.addMetal(stack, new ItemStack(Items.gold_ingot));
+ if (stack != null && JewelryNBT.ingot(stack) != null) {
if (!world.isRemote)
world.func_147480_a(x, y, z, true);
- world.setBlock(x + 1, y + 2, z - 2,
- BlockList.moltenMetal, 0,
- 3);
- if (BlockMoltenMetal.getTileEntity(world,
- x + 1, y + 2,
- z - 2) != null)
- BlockMoltenMetal.getTileEntity(
- world, x + 1,
- y + 2, z - 2)
- .setMetal(JewelryNBT
- .ingot(stack));
+ world.setBlock(x + 1, y + 2, z - 2, BlockList.moltenMetal, 0, 3);
+ if (BlockMoltenMetal.getTileEntity(world, x + 1, y + 2, z - 2) != null)
+ BlockMoltenMetal.getTileEntity(world, x + 1, y + 2, z - 2).setMetal(JewelryNBT.ingot(stack));
}
} else
- world.setBlock(x + 1, y + 2, z - 2, Blocks.water,
- 0, 3);
+ world.setBlock(x + 1, y + 2, z - 2, Blocks.water, 0, 3);
return true;
}
@Override
- public boolean generate(World world, Random rand, int x, int y,
- int z) {
+ public boolean generate(World world, Random rand, int x, int y, int z) {
return generate(world, BiomeGenBase.plains, rand, x, y, z);
}
diff --git a/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure6.java b/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure6.java index ec85f35..8196bd4 100755 --- a/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure6.java +++ b/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure6.java @@ -29,116 +29,75 @@ import net.minecraft.world.biome.BiomeGenBase; */
public class WorldGenStructure6 extends WorldGenStructure {
@Override
- public boolean generate(World world, BiomeGenBase biome,
- Random rand, int x, int y, int z) {
+ public boolean generate(World world, BiomeGenBase biome, Random rand, int x, int y, int z) {
int randBlock, randBlockMeta;
Block block;
for (int i = -2; i <= 1; i++)
for (int j = -1; j <= 1; j++)
for (int k = -2; k <= 1; k++)
- world.setBlock(x + i, y + j, z + k,
- Blocks.air);
+ world.setBlock(x + i, y + j, z + k, Blocks.air);
for (int i = -2; i <= 1; i++)
for (int k = -2; k <= 1; k++) {
randBlock = rand.nextInt(4);
switch (randBlock) {
- case 0:
- block = Blocks.cobblestone;
- randBlockMeta = 0;
- break;
- case 1:
- block = Blocks.stonebrick;
- randBlockMeta = 2;
- break;
- case 2:
- block = Blocks.stonebrick;
- randBlockMeta = 0;
- break;
- default:
- block = Blocks.cobblestone;
- randBlockMeta = 0;
- break;
+ case 0:
+ block = Blocks.cobblestone;
+ randBlockMeta = 0;
+ break;
+ case 1:
+ block = Blocks.stonebrick;
+ randBlockMeta = 2;
+ break;
+ case 2:
+ block = Blocks.stonebrick;
+ randBlockMeta = 0;
+ break;
+ default:
+ block = Blocks.cobblestone;
+ randBlockMeta = 0;
+ break;
}
- world.setBlock(x + i, y - 1, z + k, block,
- randBlockMeta, 2);
+ world.setBlock(x + i, y - 1, z + k, block, randBlockMeta, 2);
}
int crystalCol = rand.nextInt(15);
world.setBlock(x - 2, y, z - 2, BlockList.crystal, 0, 2);
- world.setBlock(x - 2, y, z + 1, BlockList.crystal,
- 1 + crystalCol, 2);
- world.setBlock(x + 1, y, z - 2, BlockList.crystal,
- 1 + crystalCol, 2);
+ world.setBlock(x - 2, y, z + 1, BlockList.crystal, 1 + crystalCol, 2);
+ world.setBlock(x + 1, y, z - 2, BlockList.crystal, 1 + crystalCol, 2);
world.setBlock(x + 1, y, z + 1, BlockList.crystal, 0, 2);
world.setBlock(x - 1, y, z - 1, Blocks.skull, 1, 2);
- TileEntity tileentity = world.getTileEntity(x - 1, y,
- z - 1);
- if (tileentity != null
- && tileentity instanceof TileEntitySkull) {
- ((TileEntitySkull) tileentity).func_152107_a(
- rand.nextInt(50) == 0 ? 1 : 0);
- ((TileEntitySkull) tileentity).func_145903_a(
- MathHelper.floor_double(
- (double) (rand.nextInt(
- 361)
- * 16.0F
- / 360.0F)
- + 0.5D)
- & 15);
- ((BlockSkull) Blocks.skull).func_149965_a(world,
- x - 1, y, z - 1,
- (TileEntitySkull) tileentity);
+ TileEntity tileentity = world.getTileEntity(x - 1, y, z - 1);
+ if (tileentity != null && tileentity instanceof TileEntitySkull) {
+ ((TileEntitySkull) tileentity).func_152107_a(rand.nextInt(50) == 0 ? 1 : 0);
+ ((TileEntitySkull) tileentity)
+ .func_145903_a(MathHelper.floor_double((double) (rand.nextInt(361) * 16.0F / 360.0F) + 0.5D) & 15);
+ ((BlockSkull) Blocks.skull).func_149965_a(world, x - 1, y, z - 1, (TileEntitySkull) tileentity);
}
- world.setBlock(x + 1, y, z - 1,
- BlockList.jewelCraftingTable, 3, 2);
- TileEntity jewelersTable = world.getTileEntity(x + 1, y,
- z - 1);
- Item[] jewelry = new Item[] {
- ItemList.ring, ItemList.necklace,
- ItemList.bracelet, ItemList.earrings
- };
- if (jewelersTable != null
- && jewelersTable instanceof TileEntityJewelrsCraftingTable) {
+ world.setBlock(x + 1, y, z - 1, BlockList.jewelCraftingTable, 3, 2);
+ TileEntity jewelersTable = world.getTileEntity(x + 1, y, z - 1);
+ Item[] jewelry = new Item[] { ItemList.ring, ItemList.necklace, ItemList.bracelet, ItemList.earrings };
+ if (jewelersTable != null && jewelersTable instanceof TileEntityJewelrsCraftingTable) {
if (rand.nextBoolean())
((TileEntityJewelrsCraftingTable) jewelersTable)
- .setGemItemStack(
- JewelrycraftUtil.gem
- .get(rand.nextInt(
- JewelrycraftUtil.gem
- .size())));
+ .setGemItemStack(JewelrycraftUtil.gem.get(rand.nextInt(JewelrycraftUtil.gem.size())));
else if (rand.nextBoolean()) {
- ItemStack result = new ItemStack(
- jewelry[rand.nextInt(4)],
- 1, 0);
+ ItemStack result = new ItemStack(jewelry[rand.nextInt(4)], 1, 0);
if (JewelrycraftUtil.metal.size() > 0)
JewelryNBT.addMetal(result,
- JewelrycraftUtil.metal
- .get(rand.nextInt(
- JewelrycraftUtil.metal
- .size())));
- ((TileEntityJewelrsCraftingTable) jewelersTable)
- .setJewelryItemStack(
- result);
+ JewelrycraftUtil.metal.get(rand.nextInt(JewelrycraftUtil.metal.size())));
+ ((TileEntityJewelrsCraftingTable) jewelersTable).setJewelryItemStack(result);
}
}
- world.setBlock(x - 1, y, z + 1, BlockList.handPedestal, 0,
- 2);
+ world.setBlock(x - 1, y, z + 1, BlockList.handPedestal, 0, 2);
TileEntity pedestal = world.getTileEntity(x - 1, y, z + 1);
- if (pedestal != null
- && pedestal instanceof TileEntityHandPedestal)
- ((TileEntityHandPedestal) pedestal)
- .setHeldItemStack(
- ((WeightedRandomItem) WeightedRandom
- .getRandomItem(rand,
- WorldGenStructure1.items))
- .getItem(rand));
- world.setBlock(x - 1, y + 1, z + 1, BlockList.shadowEye, 0,
- 2);
+ if (pedestal != null && pedestal instanceof TileEntityHandPedestal)
+ ((TileEntityHandPedestal) pedestal).setHeldItemStack(
+ ((WeightedRandomItem) WeightedRandom.getRandomItem(rand, WorldGenStructure1.items)).getItem(rand));
+ world.setBlock(x - 1, y + 1, z + 1, BlockList.shadowEye, 0, 2);
return true;
}
@Override
- public boolean generate(World world, Random rand, int x, int y,
- int z) {
+ public boolean generate(World world, Random rand, int x, int y, int z) {
return generate(world, BiomeGenBase.plains, rand, x, y, z);
}
diff --git a/src/main/java/darkknight/jewelrycraft/worldGen/village/ComponentJewelry.java b/src/main/java/darkknight/jewelrycraft/worldGen/village/ComponentJewelry.java index c5d0cc2..0580f57 100755 --- a/src/main/java/darkknight/jewelrycraft/worldGen/village/ComponentJewelry.java +++ b/src/main/java/darkknight/jewelrycraft/worldGen/village/ComponentJewelry.java @@ -33,497 +33,264 @@ public class ComponentJewelry extends StructureVillagePieces.House1 { public ComponentJewelry() {
}
- public ComponentJewelry(Start par1ComponentVillageStartPiece,
- int par2, Random par3Random,
- StructureBoundingBox par4StructureBoundingBox,
- int par5) {
+ public ComponentJewelry(Start par1ComponentVillageStartPiece, int par2, Random par3Random,
+ StructureBoundingBox par4StructureBoundingBox, int par5) {
super();
coordBaseMode = par5;
boundingBox = par4StructureBoundingBox;
}
@SuppressWarnings("rawtypes")
- public static ComponentJewelry buildComponent(Start villagePiece,
- List pieces, Random random, int p1, int p2, int p3,
- int p4, int p5) {
- StructureBoundingBox structureboundingbox = StructureBoundingBox
- .getComponentToAddBoundingBox(p1, p2, p3,
- 0, 0, 0, 11, 5, 12, p4);
+ public static ComponentJewelry buildComponent(Start villagePiece, List pieces, Random random, int p1, int p2,
+ int p3, int p4, int p5) {
+ StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p1, p2, p3, 0, 0,
+ 0, 11, 5, 12, p4);
return canVillageGoDeeper(structureboundingbox)
- && StructureComponent.findIntersecting(
- pieces,
- structureboundingbox) == null
- ? new ComponentJewelry(
- villagePiece,
- p5,
- random,
- structureboundingbox,
- p4)
- : null;
+ && StructureComponent.findIntersecting(pieces, structureboundingbox) == null
+ ? new ComponentJewelry(villagePiece, p5, random, structureboundingbox, p4)
+ : null;
}
@Override
- public boolean addComponentParts(World world, Random random,
- StructureBoundingBox sbb) {
+ public boolean addComponentParts(World world, Random random, StructureBoundingBox sbb) {
if (averageGroundLevel < 0) {
- averageGroundLevel = getAverageGroundLevel(world,
- sbb);
+ averageGroundLevel = getAverageGroundLevel(world, sbb);
if (averageGroundLevel < 0)
return true;
- boundingBox.offset(0, averageGroundLevel
- - boundingBox.maxY + 3, 0);
+ boundingBox.offset(0, averageGroundLevel - boundingBox.maxY + 3, 0);
}
- fillWithBlocks(world, sbb, 0, 0, 6, 10, 5, 11,
- Block.getBlockById(0),
- Block.getBlockById(0), false);
- fillWithBlocks(world, sbb, 2, 0, 0, 8, 5, 5,
- Block.getBlockById(0),
- Block.getBlockById(0), false);
+ fillWithBlocks(world, sbb, 0, 0, 6, 10, 5, 11, Block.getBlockById(0), Block.getBlockById(0), false);
+ fillWithBlocks(world, sbb, 2, 0, 0, 8, 5, 5, Block.getBlockById(0), Block.getBlockById(0), false);
// Pillars
- fillWithBlocks(world, sbb, 2, 0, 0, 2, 3, 0, Blocks.log,
- Blocks.log, false);
- fillWithBlocks(world, sbb, 2, 0, 3, 2, 3, 3, Blocks.log,
- Blocks.log, false);
- fillWithBlocks(world, sbb, 8, 0, 0, 8, 3, 0, Blocks.log,
- Blocks.log, false);
- fillWithBlocks(world, sbb, 8, 0, 3, 8, 3, 3, Blocks.log,
- Blocks.log, false);
+ fillWithBlocks(world, sbb, 2, 0, 0, 2, 3, 0, Blocks.log, Blocks.log, false);
+ fillWithBlocks(world, sbb, 2, 0, 3, 2, 3, 3, Blocks.log, Blocks.log, false);
+ fillWithBlocks(world, sbb, 8, 0, 0, 8, 3, 0, Blocks.log, Blocks.log, false);
+ fillWithBlocks(world, sbb, 8, 0, 3, 8, 3, 3, Blocks.log, Blocks.log, false);
// Walls
- fillWithBlocks(world, sbb, 2, 0, 1, 2, 3, 2, Blocks.planks,
- Blocks.planks, false);
- fillWithBlocks(world, sbb, 2, 0, 4, 2, 3, 5, Blocks.planks,
- Blocks.planks, false);
- fillWithBlocks(world, sbb, 8, 0, 1, 8, 3, 2, Blocks.planks,
- Blocks.planks, false);
- fillWithBlocks(world, sbb, 8, 0, 4, 8, 3, 5, Blocks.planks,
- Blocks.planks, false);
- fillWithBlocks(world, sbb, 3, 0, 0, 7, 3, 0, Blocks.planks,
- Blocks.planks, false);
- fillWithBlocks(world, sbb, 0, 0, 6, 10, 3, 6,
- Blocks.cobblestone, Blocks.cobblestone,
- false);
- fillWithBlocks(world, sbb, 0, 0, 11, 10, 3, 11,
- Blocks.cobblestone, Blocks.cobblestone,
- false);
- fillWithBlocks(world, sbb, 0, 0, 6, 0, 3, 11,
- Blocks.cobblestone, Blocks.cobblestone,
- false);
- fillWithBlocks(world, sbb, 10, 0, 6, 10, 3, 11,
- Blocks.cobblestone, Blocks.cobblestone,
- false);
+ fillWithBlocks(world, sbb, 2, 0, 1, 2, 3, 2, Blocks.planks, Blocks.planks, false);
+ fillWithBlocks(world, sbb, 2, 0, 4, 2, 3, 5, Blocks.planks, Blocks.planks, false);
+ fillWithBlocks(world, sbb, 8, 0, 1, 8, 3, 2, Blocks.planks, Blocks.planks, false);
+ fillWithBlocks(world, sbb, 8, 0, 4, 8, 3, 5, Blocks.planks, Blocks.planks, false);
+ fillWithBlocks(world, sbb, 3, 0, 0, 7, 3, 0, Blocks.planks, Blocks.planks, false);
+ fillWithBlocks(world, sbb, 0, 0, 6, 10, 3, 6, Blocks.cobblestone, Blocks.cobblestone, false);
+ fillWithBlocks(world, sbb, 0, 0, 11, 10, 3, 11, Blocks.cobblestone, Blocks.cobblestone, false);
+ fillWithBlocks(world, sbb, 0, 0, 6, 0, 3, 11, Blocks.cobblestone, Blocks.cobblestone, false);
+ fillWithBlocks(world, sbb, 10, 0, 6, 10, 3, 11, Blocks.cobblestone, Blocks.cobblestone, false);
// Roof
for (int i = 3; i <= 7; i++)
for (int j = 1; j <= 5; j++)
- placeBlockAtCurrentPosition(world,
- Blocks.wooden_slab, 2, i,
- 4, j, sbb);
+ placeBlockAtCurrentPosition(world, Blocks.wooden_slab, 2, i, 4, j, sbb);
for (int i = 3; i <= 7; i++)
for (int j = 6; j <= 6; j++)
- placeBlockAtCurrentPosition(world,
- Blocks.stone_slab, 0, i, 4,
- j, sbb);
+ placeBlockAtCurrentPosition(world, Blocks.stone_slab, 0, i, 4, j, sbb);
for (int i = 1; i <= 9; i++)
for (int j = 7; j <= 10; j++)
- placeBlockAtCurrentPosition(world,
- Blocks.stone_slab, 3, i, 4,
- j, sbb);
+ placeBlockAtCurrentPosition(world, Blocks.stone_slab, 3, i, 4, j, sbb);
for (int i = 2; i <= 8; i++)
- placeBlockAtCurrentPosition(world,
- Blocks.double_wooden_slab, 2, i, 4,
- 0, sbb);
+ placeBlockAtCurrentPosition(world, Blocks.double_wooden_slab, 2, i, 4, 0, sbb);
for (int i = 1; i <= 5; i++) {
- placeBlockAtCurrentPosition(world,
- Blocks.double_wooden_slab, 2, 2, 4,
- i, sbb);
- placeBlockAtCurrentPosition(world,
- Blocks.double_wooden_slab, 2, 8, 4,
- i, sbb);
+ placeBlockAtCurrentPosition(world, Blocks.double_wooden_slab, 2, 2, 4, i, sbb);
+ placeBlockAtCurrentPosition(world, Blocks.double_wooden_slab, 2, 8, 4, i, sbb);
}
for (int i = 0; i <= 2; i++) {
- placeBlockAtCurrentPosition(world,
- Blocks.double_stone_slab, 0, i, 4,
- 6, sbb);
- placeBlockAtCurrentPosition(world,
- Blocks.double_stone_slab, 0, i + 8,
- 4, 6, sbb);
+ placeBlockAtCurrentPosition(world, Blocks.double_stone_slab, 0, i, 4, 6, sbb);
+ placeBlockAtCurrentPosition(world, Blocks.double_stone_slab, 0, i + 8, 4, 6, sbb);
}
for (int i = 7; i <= 11; i++) {
- placeBlockAtCurrentPosition(world,
- Blocks.double_stone_slab, 0, 0, 4,
- i, sbb);
- placeBlockAtCurrentPosition(world,
- Blocks.double_stone_slab, 0, 10, 4,
- i, sbb);
+ placeBlockAtCurrentPosition(world, Blocks.double_stone_slab, 0, 0, 4, i, sbb);
+ placeBlockAtCurrentPosition(world, Blocks.double_stone_slab, 0, 10, 4, i, sbb);
}
for (int i = 0; i <= 10; i++)
- placeBlockAtCurrentPosition(world,
- Blocks.double_stone_slab, 0, i, 4,
- 11, sbb);
+ placeBlockAtCurrentPosition(world, Blocks.double_stone_slab, 0, i, 4, 11, sbb);
// Base
for (int i = 2; i <= 8; i++)
for (int j = 0; j <= 5; j++)
- placeBlockAtCurrentPosition(world,
- Blocks.planks, 1, i, 0, j,
- sbb);
- fillWithBlocks(world, sbb, 0, 0, 6, 10, 0, 11,
- Blocks.stonebrick, Blocks.stonebrick,
- false);
+ placeBlockAtCurrentPosition(world, Blocks.planks, 1, i, 0, j, sbb);
+ fillWithBlocks(world, sbb, 0, 0, 6, 10, 0, 11, Blocks.stonebrick, Blocks.stonebrick, false);
for (int i = 6; i <= 10; i++)
- placeBlockAtCurrentPosition(world,
- Blocks.double_stone_slab, 0, 5, 0,
- i, sbb);
+ placeBlockAtCurrentPosition(world, Blocks.double_stone_slab, 0, 5, 0, i, sbb);
for (int i = 7; i <= 10; i++) {
- placeBlockAtCurrentPosition(world,
- Blocks.stonebrick, 3, 1, 0, i,
- sbb);
- placeBlockAtCurrentPosition(world,
- Blocks.stonebrick, 3, 9, 0, i,
- sbb);
+ placeBlockAtCurrentPosition(world, Blocks.stonebrick, 3, 1, 0, i, sbb);
+ placeBlockAtCurrentPosition(world, Blocks.stonebrick, 3, 9, 0, i, sbb);
}
// Decorations
- placeDoorAtCurrentPosition(world, sbb, random, 6, 1, 0,
- getMetadataWithOffset(Blocks.wooden_door,
- 1));
- placeDoorAtCurrentPosition(world, sbb, random, 5, 1, 6,
- getMetadataWithOffset(Blocks.wooden_door,
- 1));
- placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 3,
- 2, 0, sbb);
- placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 4,
- 2, 0, sbb);
- placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 2,
- 2, 1, sbb);
- placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 2,
- 2, 2, sbb);
- placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 2,
- 2, 4, sbb);
- placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 2,
- 2, 5, sbb);
- placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 8,
- 2, 1, sbb);
- placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 8,
- 2, 2, sbb);
- placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 8,
- 2, 4, sbb);
- placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 8,
- 2, 5, sbb);
- placeBlockAtCurrentPosition(world, Blocks.torch, 0, 6, 3,
- 1, sbb);
- placeBlockAtCurrentPosition(world, Blocks.torch, 0, 3, 3,
- 3, sbb);
- placeBlockAtCurrentPosition(world, Blocks.torch, 0, 7, 3,
- 3, sbb);
- placeBlockAtCurrentPosition(world, Blocks.torch, 0, 5, 3,
- 5, sbb);
- placeBlockAtCurrentPosition(world, Blocks.torch, 0, 5, 3,
- 7, sbb);
- placeBlockAtCurrentPosition(world, Blocks.torch, 0, 5, 3,
- 10, sbb);
- placeBlockAtCurrentPosition(world, Blocks.torch, 0, 1, 3,
- 8, sbb);
- placeBlockAtCurrentPosition(world, Blocks.torch, 0, 1, 3,
- 9, sbb);
- placeBlockAtCurrentPosition(world, Blocks.torch, 0, 9, 3,
- 8, sbb);
- placeBlockAtCurrentPosition(world, Blocks.torch, 0, 9, 3,
- 9, sbb);
+ placeDoorAtCurrentPosition(world, sbb, random, 6, 1, 0, getMetadataWithOffset(Blocks.wooden_door, 1));
+ placeDoorAtCurrentPosition(world, sbb, random, 5, 1, 6, getMetadataWithOffset(Blocks.wooden_door, 1));
+ placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 3, 2, 0, sbb);
+ placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 4, 2, 0, sbb);
+ placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 2, 2, 1, sbb);
+ placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 2, 2, 2, sbb);
+ placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 2, 2, 4, sbb);
+ placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 2, 2, 5, sbb);
+ placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 8, 2, 1, sbb);
+ placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 8, 2, 2, sbb);
+ placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 8, 2, 4, sbb);
+ placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 8, 2, 5, sbb);
+ placeBlockAtCurrentPosition(world, Blocks.torch, 0, 6, 3, 1, sbb);
+ placeBlockAtCurrentPosition(world, Blocks.torch, 0, 3, 3, 3, sbb);
+ placeBlockAtCurrentPosition(world, Blocks.torch, 0, 7, 3, 3, sbb);
+ placeBlockAtCurrentPosition(world, Blocks.torch, 0, 5, 3, 5, sbb);
+ placeBlockAtCurrentPosition(world, Blocks.torch, 0, 5, 3, 7, sbb);
+ placeBlockAtCurrentPosition(world, Blocks.torch, 0, 5, 3, 10, sbb);
+ placeBlockAtCurrentPosition(world, Blocks.torch, 0, 1, 3, 8, sbb);
+ placeBlockAtCurrentPosition(world, Blocks.torch, 0, 1, 3, 9, sbb);
+ placeBlockAtCurrentPosition(world, Blocks.torch, 0, 9, 3, 8, sbb);
+ placeBlockAtCurrentPosition(world, Blocks.torch, 0, 9, 3, 9, sbb);
int bgCarpetColor = random.nextInt(16);
for (int i = 4; i <= 7; i++)
for (int j = 1; j <= 5; j++)
- placeBlockAtCurrentPosition(world,
- Blocks.carpet,
- bgCarpetColor, i, 1, j,
- sbb);
- generateChest(world, 3, 1, 1, 0, random, sbb,
- ConfigHandler.GEM_CHEST_MIN,
- ConfigHandler.GEM_CHEST_MAX);
- generateDisplayer(world, 3, 1, 2,
- coordBaseMode == 0 || coordBaseMode == 2
- ? 1
- : 2,
- random, sbb);
- placeBlockAtCurrentPosition(world,
- BlockList.jewelCraftingTable,
- coordBaseMode == 0 || coordBaseMode == 2
- ? 1
- : 2,
- 3, 1, 3, sbb);
- generateDisplayer(world, 3, 1, 4,
- coordBaseMode == 0 || coordBaseMode == 2
- ? 1
- : 2,
- random, sbb);
- generateChest(world, 3, 1, 5, 0, random, sbb,
- ConfigHandler.GEM_CHEST_MIN,
- ConfigHandler.GEM_CHEST_MAX);
- generateFurnace(world, 1, 1, 7, 0, random, sbb,
- ConfigHandler.FURNACE_MIN_INGOT_STACK,
- ConfigHandler.FURNACE_MAX_INGOT_STACK,
- ConfigHandler.CAN_FURNACE_GENERATE_INGOTS);
- generateFurnace(world, 1, 2, 7, 0, random, sbb,
- ConfigHandler.FURNACE_MIN_INGOT_STACK,
- ConfigHandler.FURNACE_MAX_INGOT_STACK,
- ConfigHandler.CAN_FURNACE_GENERATE_INGOTS);
- generateFurnace(world, 1, 3, 7, 0, random, sbb,
- ConfigHandler.FURNACE_MIN_INGOT_STACK,
- ConfigHandler.FURNACE_MAX_INGOT_STACK,
- ConfigHandler.CAN_FURNACE_GENERATE_INGOTS);
- generateFurnace(world, 1, 1, 10, 0, random, sbb,
- ConfigHandler.FURNACE_MIN_INGOT_STACK,
- ConfigHandler.FURNACE_MAX_INGOT_STACK,
- ConfigHandler.CAN_FURNACE_GENERATE_INGOTS);
- generateFurnace(world, 1, 2, 10, 0, random, sbb,
- ConfigHandler.FURNACE_MIN_INGOT_STACK,
- ConfigHandler.FURNACE_MAX_INGOT_STACK,
- ConfigHandler.CAN_FURNACE_GENERATE_INGOTS);
- generateFurnace(world, 1, 3, 10, 0, random, sbb,
- ConfigHandler.FURNACE_MIN_INGOT_STACK,
- ConfigHandler.FURNACE_MAX_INGOT_STACK,
- ConfigHandler.CAN_FURNACE_GENERATE_INGOTS);
- generateSmelter(world, 1, 1, 8,
- coordBaseMode == 0 || coordBaseMode == 2
- ? 1
- : 2,
- random, sbb, random.nextBoolean());
- generateSmelter(world, 1, 1, 9,
- coordBaseMode == 0 || coordBaseMode == 2
- ? 1
- : 2,
- random, sbb, random.nextBoolean());
- generateMolder(world, 2, 1, 8,
- coordBaseMode == 0 || coordBaseMode == 2
- ? 1
- : 2,
- random, sbb, random.nextBoolean(),
+ placeBlockAtCurrentPosition(world, Blocks.carpet, bgCarpetColor, i, 1, j, sbb);
+ generateChest(world, 3, 1, 1, 0, random, sbb, ConfigHandler.GEM_CHEST_MIN, ConfigHandler.GEM_CHEST_MAX);
+ generateDisplayer(world, 3, 1, 2, coordBaseMode == 0 || coordBaseMode == 2 ? 1 : 2, random, sbb);
+ placeBlockAtCurrentPosition(world, BlockList.jewelCraftingTable,
+ coordBaseMode == 0 || coordBaseMode == 2 ? 1 : 2, 3, 1, 3, sbb);
+ generateDisplayer(world, 3, 1, 4, coordBaseMode == 0 || coordBaseMode == 2 ? 1 : 2, random, sbb);
+ generateChest(world, 3, 1, 5, 0, random, sbb, ConfigHandler.GEM_CHEST_MIN, ConfigHandler.GEM_CHEST_MAX);
+ generateFurnace(world, 1, 1, 7, 0, random, sbb, ConfigHandler.FURNACE_MIN_INGOT_STACK,
+ ConfigHandler.FURNACE_MAX_INGOT_STACK, ConfigHandler.CAN_FURNACE_GENERATE_INGOTS);
+ generateFurnace(world, 1, 2, 7, 0, random, sbb, ConfigHandler.FURNACE_MIN_INGOT_STACK,
+ ConfigHandler.FURNACE_MAX_INGOT_STACK, ConfigHandler.CAN_FURNACE_GENERATE_INGOTS);
+ generateFurnace(world, 1, 3, 7, 0, random, sbb, ConfigHandler.FURNACE_MIN_INGOT_STACK,
+ ConfigHandler.FURNACE_MAX_INGOT_STACK, ConfigHandler.CAN_FURNACE_GENERATE_INGOTS);
+ generateFurnace(world, 1, 1, 10, 0, random, sbb, ConfigHandler.FURNACE_MIN_INGOT_STACK,
+ ConfigHandler.FURNACE_MAX_INGOT_STACK, ConfigHandler.CAN_FURNACE_GENERATE_INGOTS);
+ generateFurnace(world, 1, 2, 10, 0, random, sbb, ConfigHandler.FURNACE_MIN_INGOT_STACK,
+ ConfigHandler.FURNACE_MAX_INGOT_STACK, ConfigHandler.CAN_FURNACE_GENERATE_INGOTS);
+ generateFurnace(world, 1, 3, 10, 0, random, sbb, ConfigHandler.FURNACE_MIN_INGOT_STACK,
+ ConfigHandler.FURNACE_MAX_INGOT_STACK, ConfigHandler.CAN_FURNACE_GENERATE_INGOTS);
+ generateSmelter(world, 1, 1, 8, coordBaseMode == 0 || coordBaseMode == 2 ? 1 : 2, random, sbb,
random.nextBoolean());
- generateMolder(world, 2, 1, 9,
- coordBaseMode == 0 || coordBaseMode == 2
- ? 1
- : 2,
- random, sbb, random.nextBoolean(),
+ generateSmelter(world, 1, 1, 9, coordBaseMode == 0 || coordBaseMode == 2 ? 1 : 2, random, sbb,
random.nextBoolean());
+ generateMolder(world, 2, 1, 8, coordBaseMode == 0 || coordBaseMode == 2 ? 1 : 2, random, sbb,
+ random.nextBoolean(), random.nextBoolean());
+ generateMolder(world, 2, 1, 9, coordBaseMode == 0 || coordBaseMode == 2 ? 1 : 2, random, sbb,
+ random.nextBoolean(), random.nextBoolean());
if (random.nextBoolean())
- generateIngotChest(world, 9, 1, 7, 0, random, sbb,
- ConfigHandler.INGOT_CHEST_MIN,
- ConfigHandler.INGOT_CHEST_MAX,
- Blocks.chest,
- ConfigHandler.INGOT_CHEST_MAX_STACK);
+ generateIngotChest(world, 9, 1, 7, 0, random, sbb, ConfigHandler.INGOT_CHEST_MIN,
+ ConfigHandler.INGOT_CHEST_MAX, Blocks.chest, ConfigHandler.INGOT_CHEST_MAX_STACK);
else
- generateOresChest(world, 9, 1, 7, 0, random, sbb,
- ConfigHandler.INGOT_CHEST_MIN,
- ConfigHandler.INGOT_CHEST_MAX,
- Blocks.chest,
- ConfigHandler.INGOT_CHEST_MAX_STACK);
+ generateOresChest(world, 9, 1, 7, 0, random, sbb, ConfigHandler.INGOT_CHEST_MIN,
+ ConfigHandler.INGOT_CHEST_MAX, Blocks.chest, ConfigHandler.INGOT_CHEST_MAX_STACK);
if (random.nextBoolean())
- generateIngotChest(world, 9, 1, 8, 0, random, sbb,
- ConfigHandler.INGOT_CHEST_MIN,
- ConfigHandler.INGOT_CHEST_MAX,
- Blocks.chest,
- ConfigHandler.INGOT_CHEST_MAX_STACK);
+ generateIngotChest(world, 9, 1, 8, 0, random, sbb, ConfigHandler.INGOT_CHEST_MIN,
+ ConfigHandler.INGOT_CHEST_MAX, Blocks.chest, ConfigHandler.INGOT_CHEST_MAX_STACK);
else
- generateOresChest(world, 9, 1, 8, 0, random, sbb,
- ConfigHandler.INGOT_CHEST_MIN,
- ConfigHandler.INGOT_CHEST_MAX,
- Blocks.chest,
- ConfigHandler.INGOT_CHEST_MAX_STACK);
+ generateOresChest(world, 9, 1, 8, 0, random, sbb, ConfigHandler.INGOT_CHEST_MIN,
+ ConfigHandler.INGOT_CHEST_MAX, Blocks.chest, ConfigHandler.INGOT_CHEST_MAX_STACK);
if (random.nextBoolean())
- generateIngotChest(world, 9, 1, 9, 0, random, sbb,
- ConfigHandler.INGOT_CHEST_MIN,
- ConfigHandler.INGOT_CHEST_MAX,
- Blocks.trapped_chest,
- ConfigHandler.INGOT_CHEST_MAX_STACK);
+ generateIngotChest(world, 9, 1, 9, 0, random, sbb, ConfigHandler.INGOT_CHEST_MIN,
+ ConfigHandler.INGOT_CHEST_MAX, Blocks.trapped_chest, ConfigHandler.INGOT_CHEST_MAX_STACK);
else
- generateOresChest(world, 9, 1, 9, 0, random, sbb,
- ConfigHandler.INGOT_CHEST_MIN,
- ConfigHandler.INGOT_CHEST_MAX,
- Blocks.trapped_chest,
- ConfigHandler.INGOT_CHEST_MAX_STACK);
+ generateOresChest(world, 9, 1, 9, 0, random, sbb, ConfigHandler.INGOT_CHEST_MIN,
+ ConfigHandler.INGOT_CHEST_MAX, Blocks.trapped_chest, ConfigHandler.INGOT_CHEST_MAX_STACK);
if (random.nextBoolean())
- generateIngotChest(world, 9, 1, 10, 0, random, sbb,
- ConfigHandler.INGOT_CHEST_MIN,
- ConfigHandler.INGOT_CHEST_MAX,
- Blocks.trapped_chest,
- ConfigHandler.INGOT_CHEST_MAX_STACK);
+ generateIngotChest(world, 9, 1, 10, 0, random, sbb, ConfigHandler.INGOT_CHEST_MIN,
+ ConfigHandler.INGOT_CHEST_MAX, Blocks.trapped_chest, ConfigHandler.INGOT_CHEST_MAX_STACK);
else
- generateOresChest(world, 9, 1, 10, 0, random, sbb,
- ConfigHandler.INGOT_CHEST_MIN,
- ConfigHandler.INGOT_CHEST_MAX,
- Blocks.trapped_chest,
- ConfigHandler.INGOT_CHEST_MAX_STACK);
+ generateOresChest(world, 9, 1, 10, 0, random, sbb, ConfigHandler.INGOT_CHEST_MIN,
+ ConfigHandler.INGOT_CHEST_MAX, Blocks.trapped_chest, ConfigHandler.INGOT_CHEST_MAX_STACK);
for (int l = 0; l < 6; ++l)
for (int i1 = 2; i1 < 9; ++i1) {
- clearCurrentPositionBlocksUpwards(world,
- i1, 9, l, sbb);
- func_151554_b(world, Blocks.cobblestone, 0,
- i1, -1, l, sbb);
+ clearCurrentPositionBlocksUpwards(world, i1, 9, l, sbb);
+ func_151554_b(world, Blocks.cobblestone, 0, i1, -1, l, sbb);
}
for (int l = 6; l < 12; ++l)
for (int i1 = 0; i1 < 11; ++i1) {
- clearCurrentPositionBlocksUpwards(world,
- i1, 9, l, sbb);
- func_151554_b(world, Blocks.cobblestone, 0,
- i1, -1, l, sbb);
+ clearCurrentPositionBlocksUpwards(world, i1, 9, l, sbb);
+ func_151554_b(world, Blocks.cobblestone, 0, i1, -1, l, sbb);
}
spawnVillagers(world, sbb, 3, 1, 3, 1);
return true;
}
- public void generateChest(World world, int i, int j, int k,
- int metadata, Random random,
- StructureBoundingBox sbb, int min, int max) {
+ public void generateChest(World world, int i, int j, int k, int metadata, Random random, StructureBoundingBox sbb,
+ int min, int max) {
int i1 = getXWithOffset(i, k);
int j1 = getYWithOffset(j);
int k1 = getZWithOffset(i, k);
if (max >= min) {
int t = random.nextInt(max - min + 1) + min;
- placeBlockAtCurrentPosition(world, Blocks.chest,
- metadata, i, j, k, sbb);
+ placeBlockAtCurrentPosition(world, Blocks.chest, metadata, i, j, k, sbb);
if (world.getTileEntity(i1, j1, k1) != null) {
- TileEntityChest chest = (TileEntityChest) world
- .getTileEntity(i1, j1, k1);
- while (chest != null && t > 0
- && JewelrycraftUtil.gem
- .size() > 0) {
- ItemStack jewels = JewelrycraftUtil.gem
- .get(random.nextInt(
- JewelrycraftUtil.gem
- .size()));
- chest.func_145976_a(StatCollector
- .translateToLocal(
- "jeweler." + Variables.MODID
- + ".jewelerchest"));
- if (jewels.getItem() == Items.nether_star
- && ConfigHandler.GENERATE_VILLAGE_NETHERSTAR)
- chest.setInventorySlotContents(
- random.nextInt(chest
- .getSizeInventory()),
- jewels);
- else if (random.nextBoolean()
- && jewels.getItem() != Items.nether_star)
- chest.setInventorySlotContents(
- random.nextInt(chest
- .getSizeInventory()),
- jewels);
+ TileEntityChest chest = (TileEntityChest) world.getTileEntity(i1, j1, k1);
+ while (chest != null && t > 0 && JewelrycraftUtil.gem.size() > 0) {
+ ItemStack jewels = JewelrycraftUtil.gem.get(random.nextInt(JewelrycraftUtil.gem.size()));
+ chest.func_145976_a(StatCollector.translateToLocal("jeweler." + Variables.MODID + ".jewelerchest"));
+ if (jewels.getItem() == Items.nether_star && ConfigHandler.GENERATE_VILLAGE_NETHERSTAR)
+ chest.setInventorySlotContents(random.nextInt(chest.getSizeInventory()), jewels);
+ else if (random.nextBoolean() && jewels.getItem() != Items.nether_star)
+ chest.setInventorySlotContents(random.nextInt(chest.getSizeInventory()), jewels);
t--;
}
}
}
}
- public void generateIngotChest(World world, int i, int j, int k,
- int metadata, Random random,
- StructureBoundingBox sbb, int min, int max,
- Block chestB, int randomAmount) {
+ public void generateIngotChest(World world, int i, int j, int k, int metadata, Random random,
+ StructureBoundingBox sbb, int min, int max, Block chestB, int randomAmount) {
int i1 = getXWithOffset(i, k);
int j1 = getYWithOffset(j);
int k1 = getZWithOffset(i, k);
if (max >= min) {
int t = random.nextInt(max - min + 1) + min;
- placeBlockAtCurrentPosition(world, chestB,
- metadata, i, j, k, sbb);
+ placeBlockAtCurrentPosition(world, chestB, metadata, i, j, k, sbb);
if (world.getTileEntity(i1, j1, k1) != null) {
- TileEntityChest chest = (TileEntityChest) world
- .getTileEntity(i1, j1, k1);
- while (chest != null && t > 0
- && JewelrycraftUtil.metal
- .size() > 0) {
- chest.func_145976_a(StatCollector
- .translateToLocal(
- "jeweler." + Variables.MODID
- + ".ingotchest"));
- int metalID = random.nextInt(
- JewelrycraftUtil.metal
- .size());
- ItemStack metal = JewelrycraftUtil.metal
- .get(metalID)
- .copy();
- metal.stackSize = 2 + random
- .nextInt(randomAmount);
+ TileEntityChest chest = (TileEntityChest) world.getTileEntity(i1, j1, k1);
+ while (chest != null && t > 0 && JewelrycraftUtil.metal.size() > 0) {
+ chest.func_145976_a(StatCollector.translateToLocal("jeweler." + Variables.MODID + ".ingotchest"));
+ int metalID = random.nextInt(JewelrycraftUtil.metal.size());
+ ItemStack metal = JewelrycraftUtil.metal.get(metalID).copy();
+ metal.stackSize = 2 + random.nextInt(randomAmount);
if (random.nextBoolean())
- chest.setInventorySlotContents(
- random.nextInt(chest
- .getSizeInventory()),
- metal);
+ chest.setInventorySlotContents(random.nextInt(chest.getSizeInventory()), metal);
t--;
}
}
}
}
- public void generateOresChest(World world, int i, int j, int k,
- int metadata, Random random,
- StructureBoundingBox sbb, int min, int max,
- Block chestB, int randomAmount) {
+ public void generateOresChest(World world, int i, int j, int k, int metadata, Random random,
+ StructureBoundingBox sbb, int min, int max, Block chestB, int randomAmount) {
int i1 = getXWithOffset(i, k);
int j1 = getYWithOffset(j);
int k1 = getZWithOffset(i, k);
if (max >= min) {
int t = random.nextInt(max - min + 1) + min;
- placeBlockAtCurrentPosition(world, chestB,
- metadata, i, j, k, sbb);
+ placeBlockAtCurrentPosition(world, chestB, metadata, i, j, k, sbb);
if (world.getTileEntity(i1, j1, k1) != null) {
- TileEntityChest chest = (TileEntityChest) world
- .getTileEntity(i1, j1, k1);
- while (chest != null && t > 0
- && JewelrycraftUtil.ores
- .size() > 0) {
- chest.func_145976_a(StatCollector
- .translateToLocal(
- "jeweler." + Variables.MODID
- + ".orechest"));
- int oreID = random.nextInt(
- JewelrycraftUtil.ores
- .size());
- ItemStack ores = JewelrycraftUtil.ores
- .get(oreID).copy();
- ores.stackSize = 2 + random
- .nextInt(randomAmount);
+ TileEntityChest chest = (TileEntityChest) world.getTileEntity(i1, j1, k1);
+ while (chest != null && t > 0 && JewelrycraftUtil.ores.size() > 0) {
+ chest.func_145976_a(StatCollector.translateToLocal("jeweler." + Variables.MODID + ".orechest"));
+ int oreID = random.nextInt(JewelrycraftUtil.ores.size());
+ ItemStack ores = JewelrycraftUtil.ores.get(oreID).copy();
+ ores.stackSize = 2 + random.nextInt(randomAmount);
if (random.nextBoolean())
- chest.setInventorySlotContents(
- random.nextInt(chest
- .getSizeInventory()),
- ores);
+ chest.setInventorySlotContents(random.nextInt(chest.getSizeInventory()), ores);
t--;
}
}
}
}
- public void generateDisplayer(World world, int i, int j, int k,
- int metadata, Random random,
+ public void generateDisplayer(World world, int i, int j, int k, int metadata, Random random,
StructureBoundingBox sbb) {
int i1 = getXWithOffset(i, k);
int j1 = getYWithOffset(j);
int k1 = getZWithOffset(i, k);
- placeBlockAtCurrentPosition(world, BlockList.displayer,
- metadata, i, j, k, sbb);
+ placeBlockAtCurrentPosition(world, BlockList.displayer, metadata, i, j, k, sbb);
if (world.getTileEntity(i1, j1, k1) != null) {
- TileEntityDisplayer displayer = (TileEntityDisplayer) world
- .getTileEntity(i1, j1, k1);
+ TileEntityDisplayer displayer = (TileEntityDisplayer) world.getTileEntity(i1, j1, k1);
if (displayer != null) {
- Item[] jewels = {
- ItemList.ring,
- ItemList.necklace
- };
- ItemStack jewel = new ItemStack(
- jewels[random.nextInt(
- jewels.length)]);
+ Item[] jewels = { ItemList.ring, ItemList.necklace };
+ ItemStack jewel = new ItemStack(jewels[random.nextInt(jewels.length)]);
if (JewelrycraftUtil.metal.size() > 0)
JewelryNBT.addMetal(jewel,
- JewelrycraftUtil.metal
- .get(random.nextInt(
- JewelrycraftUtil.metal
- .size())));
+ JewelrycraftUtil.metal.get(random.nextInt(JewelrycraftUtil.metal.size())));
if (JewelrycraftUtil.objects.size() > 0)
- JewelryNBT.addModifiers(jewel,
- JewelrycraftUtil.addRandomModifiers(
- random.nextInt(4)));
+ JewelryNBT.addModifiers(jewel, JewelrycraftUtil.addRandomModifiers(random.nextInt(4)));
if (JewelrycraftUtil.gem.size() > 0)
- JewelryNBT.addGem(jewel,
- JewelrycraftUtil.gem
- .get(random.nextInt(
- JewelrycraftUtil.gem
- .size())));
+ JewelryNBT.addGem(jewel, JewelrycraftUtil.gem.get(random.nextInt(JewelrycraftUtil.gem.size())));
displayer.object = jewel;
displayer.quantity = 1;
displayer.hasObject = true;
@@ -531,103 +298,55 @@ public class ComponentJewelry extends StructureVillagePieces.House1 { }
}
- public void generateSmelter(World world, int i, int j, int k,
- int metadata, Random random,
- StructureBoundingBox sbb, boolean isEmpty) {
+ public void generateSmelter(World world, int i, int j, int k, int metadata, Random random, StructureBoundingBox sbb,
+ boolean isEmpty) {
int i1 = getXWithOffset(i, k);
int j1 = getYWithOffset(j);
int k1 = getZWithOffset(i, k);
- placeBlockAtCurrentPosition(world, BlockList.smelter,
- metadata, i, j, k, sbb);
+ placeBlockAtCurrentPosition(world, BlockList.smelter, metadata, i, j, k, sbb);
if (world.getTileEntity(i1, j1, k1) != null) {
- TileEntitySmelter smelter = (TileEntitySmelter) world
- .getTileEntity(i1, j1, k1);
- if (smelter != null && !isEmpty
- && JewelrycraftUtil.metal
- .size() > 0) {
- int metal = random.nextInt(
- JewelrycraftUtil.metal
- .size());
- smelter.moltenMetal = JewelrycraftUtil.metal
- .get(metal).copy();
- smelter.hasMoltenMetal = random
- .nextBoolean();
+ TileEntitySmelter smelter = (TileEntitySmelter) world.getTileEntity(i1, j1, k1);
+ if (smelter != null && !isEmpty && JewelrycraftUtil.metal.size() > 0) {
+ int metal = random.nextInt(JewelrycraftUtil.metal.size());
+ smelter.moltenMetal = JewelrycraftUtil.metal.get(metal).copy();
+ smelter.hasMoltenMetal = random.nextBoolean();
float quantity = random.nextFloat();
if (smelter.hasMoltenMetal)
- smelter.quantity = quantity < 0.9F
- ? 0.1F + Math.round(
- quantity * 10)
- / 10
- : Math.round(quantity
- * 10)
- / 10;
+ smelter.quantity = quantity < 0.9F ? 0.1F + Math.round(quantity * 10) / 10
+ : Math.round(quantity * 10) / 10;
}
}
}
- public void generateMolder(World world, int i, int j, int k,
- int metadata, Random random,
- StructureBoundingBox sbb, boolean hasMold,
- boolean hasStuff) {
+ public void generateMolder(World world, int i, int j, int k, int metadata, Random random, StructureBoundingBox sbb,
+ boolean hasMold, boolean hasStuff) {
int i1 = getXWithOffset(i, k);
int j1 = getYWithOffset(j);
int k1 = getZWithOffset(i, k);
- placeBlockAtCurrentPosition(world, BlockList.molder,
- metadata, i, j, k, sbb);
+ placeBlockAtCurrentPosition(world, BlockList.molder, metadata, i, j, k, sbb);
if (world.getTileEntity(i1, j1, k1) != null) {
- TileEntityMolder molder = (TileEntityMolder) world
- .getTileEntity(i1, j1, k1);
+ TileEntityMolder molder = (TileEntityMolder) world.getTileEntity(i1, j1, k1);
if (molder != null && !molder.hasMold)
if (hasMold) {
- int meta = random.nextInt(
- ItemMolds.moldsItemNames.length
- - 1);
- molder.mold = new ItemStack(
- ItemList.molds, 1,
- meta + 1);
+ int meta = random.nextInt(ItemMolds.moldsItemNames.length - 1);
+ molder.mold = new ItemStack(ItemList.molds, 1, meta + 1);
molder.hasMold = true;
- if (hasStuff && JewelrycraftUtil.metal
- .size() > 0) {
- ItemStack ring = new ItemStack(
- ItemList.ring);
+ if (hasStuff && JewelrycraftUtil.metal.size() > 0) {
+ ItemStack ring = new ItemStack(ItemList.ring);
JewelryNBT.addMetal(ring,
- JewelrycraftUtil.metal
- .get(random.nextInt(
- JewelrycraftUtil.metal
- .size()))
- .copy());
- ItemStack necklace = new ItemStack(
- ItemList.necklace);
- JewelryNBT.addMetal(
- necklace,
- JewelrycraftUtil.metal
- .get(random.nextInt(
- JewelrycraftUtil.metal
- .size()))
- .copy());
- ItemStack bracelet = new ItemStack(
- ItemList.bracelet);
- JewelryNBT.addMetal(
- bracelet,
- JewelrycraftUtil.metal
- .get(random.nextInt(
- JewelrycraftUtil.metal
- .size()))
- .copy());
- ItemStack earrings = new ItemStack(
- ItemList.earrings);
- JewelryNBT.addMetal(
- earrings,
- JewelrycraftUtil.metal
- .get(random.nextInt(
- JewelrycraftUtil.metal
- .size()))
- .copy());
+ JewelrycraftUtil.metal.get(random.nextInt(JewelrycraftUtil.metal.size())).copy());
+ ItemStack necklace = new ItemStack(ItemList.necklace);
+ JewelryNBT.addMetal(necklace,
+ JewelrycraftUtil.metal.get(random.nextInt(JewelrycraftUtil.metal.size())).copy());
+ ItemStack bracelet = new ItemStack(ItemList.bracelet);
+ JewelryNBT.addMetal(bracelet,
+ JewelrycraftUtil.metal.get(random.nextInt(JewelrycraftUtil.metal.size())).copy());
+ ItemStack earrings = new ItemStack(ItemList.earrings);
+ JewelryNBT.addMetal(earrings,
+ JewelrycraftUtil.metal.get(random.nextInt(JewelrycraftUtil.metal.size())).copy());
if (meta == 0)
molder.jewelBase = JewelrycraftUtil.metal
- .get(random.nextInt(
- JewelrycraftUtil.metal
- .size()));
+ .get(random.nextInt(JewelrycraftUtil.metal.size()));
else if (meta == 1)
molder.jewelBase = ring;
else if (meta == 2)
@@ -642,37 +361,22 @@ public class ComponentJewelry extends StructureVillagePieces.House1 { }
}
- public void generateFurnace(World world, int i, int j, int k,
- int metadata, Random random,
- StructureBoundingBox sbb, int min, int max,
- boolean hasMetal) {
+ public void generateFurnace(World world, int i, int j, int k, int metadata, Random random, StructureBoundingBox sbb,
+ int min, int max, boolean hasMetal) {
int i1 = getXWithOffset(i, k);
int j1 = getYWithOffset(j);
int k1 = getZWithOffset(i, k);
- placeBlockAtCurrentPosition(world, Blocks.furnace,
- metadata, i, j, k, sbb);
+ placeBlockAtCurrentPosition(world, Blocks.furnace, metadata, i, j, k, sbb);
if (world.getTileEntity(i1, j1, k1) != null) {
- TileEntityFurnace furnace = (TileEntityFurnace) world
- .getTileEntity(i1, j1, k1);
+ TileEntityFurnace furnace = (TileEntityFurnace) world.getTileEntity(i1, j1, k1);
if (furnace != null) {
if (random.nextBoolean())
- furnace.setInventorySlotContents(1,
- new ItemStack(Items.coal,
- 1 + random.nextInt(
- 16)));
- if (hasMetal && JewelrycraftUtil.metal
- .size() > 0) {
- int metalID = random.nextInt(
- JewelrycraftUtil.metal
- .size());
- ItemStack metal = JewelrycraftUtil.metal
- .get(metalID)
- .copy();
- metal.stackSize = random.nextInt(
- max - min + 1)
- + min;
- furnace.setInventorySlotContents(2,
- metal);
+ furnace.setInventorySlotContents(1, new ItemStack(Items.coal, 1 + random.nextInt(16)));
+ if (hasMetal && JewelrycraftUtil.metal.size() > 0) {
+ int metalID = random.nextInt(JewelrycraftUtil.metal.size());
+ ItemStack metal = JewelrycraftUtil.metal.get(metalID).copy();
+ metal.stackSize = random.nextInt(max - min + 1) + min;
+ furnace.setInventorySlotContents(2, metal);
}
}
}
diff --git a/src/main/java/darkknight/jewelrycraft/worldGen/village/JCTrades.java b/src/main/java/darkknight/jewelrycraft/worldGen/village/JCTrades.java index d905948..f23dee6 100755 --- a/src/main/java/darkknight/jewelrycraft/worldGen/village/JCTrades.java +++ b/src/main/java/darkknight/jewelrycraft/worldGen/village/JCTrades.java @@ -17,10 +17,7 @@ import net.minecraft.village.MerchantRecipe; import net.minecraft.village.MerchantRecipeList;
public class JCTrades implements IVillageTradeHandler {
- Item[] jewelry = new Item[] {
- ItemList.ring, ItemList.necklace,
- ItemList.bracelet, ItemList.earrings
- };
+ Item[] jewelry = new Item[] { ItemList.ring, ItemList.necklace, ItemList.bracelet, ItemList.earrings };
public JCTrades() {
super();
@@ -32,227 +29,112 @@ public class JCTrades implements IVillageTradeHandler { * @param random
*/
@Override
- public void manipulateTradesForVillager(EntityVillager villager,
- MerchantRecipeList recipeList, Random random) {
+ public void manipulateTradesForVillager(EntityVillager villager, MerchantRecipeList recipeList, Random random) {
if (villager.getProfession() == 3000) {
ItemStack ingredient = null;
ItemStack ingredient2 = null;
ItemStack result;
int type = random.nextInt(12);
switch (type) {
- case 0:
- if (JewelrycraftUtil.metal
- .size() > 0) {
- result = JewelrycraftUtil.metal
- .get(random.nextInt(
- JewelrycraftUtil.metal
- .size()));
- result.stackSize = 5
- + random.nextInt(
- 5);
- ingredient = new ItemStack(
- Items.emerald,
- 2 + random.nextInt(
- 7));
- if (random.nextBoolean())
- ingredient2 = new ItemStack(
- Items.emerald,
- 2 + random.nextInt(
- 2));
- break;
- }
- case 1: {
- result = new ItemStack(
- ItemList.molds,
- 5 + random.nextInt(
- 7),
- random.nextInt(ItemMolds.moldsItemNames.length));
- ingredient = new ItemStack(
- Items.emerald, 1);
- if (random.nextBoolean())
- ingredient2 = new ItemStack(
- Items.emerald,
- 1 + random.nextInt(
- 2));
- break;
- }
- case 2: {
- int number = random.nextInt(3);
- result = new ItemStack(
- BlockList.displayer,
- 1 + number);
- ingredient = new ItemStack(
- Blocks.emerald_block,
- 2 + number * 3 + random
- .nextInt(2));
- ingredient2 = new ItemStack(
- Items.emerald,
- 3 + number + random
- .nextInt(8));
- break;
- }
- case 3: {
- result = new ItemStack(
- BlockList.jewelCraftingTable);
- ingredient = new ItemStack(
- Items.emerald,
- 1 + random.nextInt(
- 2));
+ case 0:
+ if (JewelrycraftUtil.metal.size() > 0) {
+ result = JewelrycraftUtil.metal.get(random.nextInt(JewelrycraftUtil.metal.size()));
+ result.stackSize = 5 + random.nextInt(5);
+ ingredient = new ItemStack(Items.emerald, 2 + random.nextInt(7));
if (random.nextBoolean())
- ingredient2 = new ItemStack(
- Items.emerald,
- 1 + random.nextInt(
- 2));
+ ingredient2 = new ItemStack(Items.emerald, 2 + random.nextInt(2));
break;
}
- case 4: {
- result = new ItemStack(
- BlockList.shadowOre,
- 1 + random.nextInt(
- 6));
- ingredient = new ItemStack(
- Items.emerald,
- 3 + random.nextInt(
- 4));
- if (random.nextBoolean())
- ingredient2 = new ItemStack(
- Items.emerald,
- 3 + random.nextInt(
- 4));
- break;
- }
- case 5: {
- result = new ItemStack(
- BlockList.molder,
- 5 + random.nextInt(
- 5));
- ingredient = new ItemStack(
- Items.emerald, 1);
- if (random.nextBoolean())
- ingredient2 = new ItemStack(
- Items.emerald,
- 1);
- break;
- }
- case 6: {
- result = new ItemStack(
- BlockList.smelter);
- ingredient = new ItemStack(
- Items.emerald,
- 1 + random.nextInt(
- 2));
- if (random.nextBoolean())
- ingredient2 = new ItemStack(
- Items.emerald,
- 1 + random.nextInt(
- 2));
- break;
- }
- case 7:
- if (JewelrycraftUtil.gem
- .size() > 0) {
- int end = random.nextInt(
- JewelrycraftUtil.gem
- .size());
- result = JewelrycraftUtil.gem
- .get(end);
- result.stackSize = 1
- + random.nextInt(
- JewelrycraftUtil.gem
- .size()
- - end);
- if (JewelrycraftUtil.gem
- .size() - 1
- - end >= 1) {
- int value = 1 + end;
- if (value > 64)
- value = 64;
- ingredient = new ItemStack(
- Items.emerald,
- 2 + random.nextInt(
- value));
- if (random.nextBoolean())
- ingredient2 = new ItemStack(
- Items.emerald,
- 2 + random.nextInt(
- value));
- } else {
- ingredient = new ItemStack(
- Blocks.emerald_block,
- 16 + random.nextInt(
- 32));
- ingredient2 = new ItemStack(
- Blocks.emerald_block,
- 8 + random.nextInt(
- 48));
- }
- break;
- }
- case 8:
- if (JewelrycraftUtil.ores
- .size() > 0) {
- result = JewelrycraftUtil.ores
- .get(random.nextInt(
- JewelrycraftUtil.ores
- .size()));
- result.stackSize = 3
- + random.nextInt(
- 3);
- ingredient = new ItemStack(
- Items.emerald,
- 2 + random.nextInt(
- 5));
+ case 1: {
+ result = new ItemStack(ItemList.molds, 5 + random.nextInt(7),
+ random.nextInt(ItemMolds.moldsItemNames.length));
+ ingredient = new ItemStack(Items.emerald, 1);
+ if (random.nextBoolean())
+ ingredient2 = new ItemStack(Items.emerald, 1 + random.nextInt(2));
+ break;
+ }
+ case 2: {
+ int number = random.nextInt(3);
+ result = new ItemStack(BlockList.displayer, 1 + number);
+ ingredient = new ItemStack(Blocks.emerald_block, 2 + number * 3 + random.nextInt(2));
+ ingredient2 = new ItemStack(Items.emerald, 3 + number + random.nextInt(8));
+ break;
+ }
+ case 3: {
+ result = new ItemStack(BlockList.jewelCraftingTable);
+ ingredient = new ItemStack(Items.emerald, 1 + random.nextInt(2));
+ if (random.nextBoolean())
+ ingredient2 = new ItemStack(Items.emerald, 1 + random.nextInt(2));
+ break;
+ }
+ case 4: {
+ result = new ItemStack(BlockList.shadowOre, 1 + random.nextInt(6));
+ ingredient = new ItemStack(Items.emerald, 3 + random.nextInt(4));
+ if (random.nextBoolean())
+ ingredient2 = new ItemStack(Items.emerald, 3 + random.nextInt(4));
+ break;
+ }
+ case 5: {
+ result = new ItemStack(BlockList.molder, 5 + random.nextInt(5));
+ ingredient = new ItemStack(Items.emerald, 1);
+ if (random.nextBoolean())
+ ingredient2 = new ItemStack(Items.emerald, 1);
+ break;
+ }
+ case 6: {
+ result = new ItemStack(BlockList.smelter);
+ ingredient = new ItemStack(Items.emerald, 1 + random.nextInt(2));
+ if (random.nextBoolean())
+ ingredient2 = new ItemStack(Items.emerald, 1 + random.nextInt(2));
+ break;
+ }
+ case 7:
+ if (JewelrycraftUtil.gem.size() > 0) {
+ int end = random.nextInt(JewelrycraftUtil.gem.size());
+ result = JewelrycraftUtil.gem.get(end);
+ result.stackSize = 1 + random.nextInt(JewelrycraftUtil.gem.size() - end);
+ if (JewelrycraftUtil.gem.size() - 1 - end >= 1) {
+ int value = 1 + end;
+ if (value > 64)
+ value = 64;
+ ingredient = new ItemStack(Items.emerald, 2 + random.nextInt(value));
if (random.nextBoolean())
- ingredient2 = new ItemStack(
- Items.emerald,
- 2 + random.nextInt(
- 6));
- break;
+ ingredient2 = new ItemStack(Items.emerald, 2 + random.nextInt(value));
+ } else {
+ ingredient = new ItemStack(Blocks.emerald_block, 16 + random.nextInt(32));
+ ingredient2 = new ItemStack(Blocks.emerald_block, 8 + random.nextInt(48));
}
- case 9: {
- result = new ItemStack(
- ItemList.guide, 1);
- ingredient = new ItemStack(
- Items.emerald, 1);
break;
}
- default: {
- result = new ItemStack(
- jewelry[random.nextInt(
- 4)],
- 1, 0);
- int randValue = random.nextInt(4);
- if (JewelrycraftUtil.metal
- .size() > 0)
- JewelryNBT.addMetal(result,
- JewelrycraftUtil.metal
- .get(random.nextInt(
- JewelrycraftUtil.metal
- .size())));
- if (JewelrycraftUtil.objects
- .size() > 0)
- JewelryNBT.addModifiers(
- result,
- JewelrycraftUtil.addRandomModifiers(
- randValue));
- if (JewelrycraftUtil.gem
- .size() > 0)
- JewelryNBT.addGem(result,
- JewelrycraftUtil.gem
- .get(random.nextInt(
- JewelrycraftUtil.gem
- .size())));
- ingredient = new ItemStack(
- Items.emerald,
- 16 + random.nextInt(
- 20));
- ingredient2 = new ItemStack(
- Blocks.emerald_block,
- 2 + randValue);
+ case 8:
+ if (JewelrycraftUtil.ores.size() > 0) {
+ result = JewelrycraftUtil.ores.get(random.nextInt(JewelrycraftUtil.ores.size()));
+ result.stackSize = 3 + random.nextInt(3);
+ ingredient = new ItemStack(Items.emerald, 2 + random.nextInt(5));
+ if (random.nextBoolean())
+ ingredient2 = new ItemStack(Items.emerald, 2 + random.nextInt(6));
+ break;
}
+ case 9: {
+ result = new ItemStack(ItemList.guide, 1);
+ ingredient = new ItemStack(Items.emerald, 1);
+ break;
+ }
+ default: {
+ result = new ItemStack(jewelry[random.nextInt(4)], 1, 0);
+ int randValue = random.nextInt(4);
+ if (JewelrycraftUtil.metal.size() > 0)
+ JewelryNBT.addMetal(result,
+ JewelrycraftUtil.metal.get(random.nextInt(JewelrycraftUtil.metal.size())));
+ if (JewelrycraftUtil.objects.size() > 0)
+ JewelryNBT.addModifiers(result, JewelrycraftUtil.addRandomModifiers(randValue));
+ if (JewelrycraftUtil.gem.size() > 0)
+ JewelryNBT.addGem(result, JewelrycraftUtil.gem.get(random.nextInt(JewelrycraftUtil.gem.size())));
+ ingredient = new ItemStack(Items.emerald, 16 + random.nextInt(20));
+ ingredient2 = new ItemStack(Blocks.emerald_block, 2 + randValue);
+ }
}
- recipeList.addToListWithCheck(new MerchantRecipe(
- ingredient, ingredient2, result));
+ recipeList.addToListWithCheck(new MerchantRecipe(ingredient, ingredient2, result));
}
}
}
\ No newline at end of file diff --git a/src/main/java/darkknight/jewelrycraft/worldGen/village/VillageHandler.java b/src/main/java/darkknight/jewelrycraft/worldGen/village/VillageHandler.java index 0a4b832..49c2d37 100755 --- a/src/main/java/darkknight/jewelrycraft/worldGen/village/VillageHandler.java +++ b/src/main/java/darkknight/jewelrycraft/worldGen/village/VillageHandler.java @@ -12,14 +12,10 @@ import net.minecraft.world.gen.structure.MapGenStructureIO; public class VillageHandler {
public static void preInit(FMLPreInitializationEvent e) {
VillagerRegistry.instance().registerVillagerId(3000);
- VillagerRegistry.instance().registerVillageTradeHandler(
- 3000, new JCTrades());
- VillagerRegistry.instance().registerVillageCreationHandler(
- new VillageJewelryHandler());
+ VillagerRegistry.instance().registerVillageTradeHandler(3000, new JCTrades());
+ VillagerRegistry.instance().registerVillageCreationHandler(new VillageJewelryHandler());
try {
- MapGenStructureIO.func_143031_a(
- ComponentJewelry.class,
- Variables.MODID + ":Jewelry");
+ MapGenStructureIO.func_143031_a(ComponentJewelry.class, Variables.MODID + ":Jewelry");
} catch (Throwable thrw) {
JewelrycraftMod.logger.error(
"Error registering Jewelrycraft Structures with Vanilla Minecraft: this is expected in versions earlier than 1.7.10");
diff --git a/src/main/java/darkknight/jewelrycraft/worldGen/village/VillageJewelryHandler.java b/src/main/java/darkknight/jewelrycraft/worldGen/village/VillageJewelryHandler.java index 3b9c274..4953461 100755 --- a/src/main/java/darkknight/jewelrycraft/worldGen/village/VillageJewelryHandler.java +++ b/src/main/java/darkknight/jewelrycraft/worldGen/village/VillageJewelryHandler.java @@ -17,8 +17,7 @@ public class VillageJewelryHandler implements IVillageCreationHandler { */
@Override
public PieceWeight getVillagePieceWeight(Random random, int i) {
- return new PieceWeight(ComponentJewelry.class,
- ConfigHandler.JEWELER_WEIGHT,
+ return new PieceWeight(ComponentJewelry.class, ConfigHandler.JEWELER_WEIGHT,
ConfigHandler.MAX_VILLAGE_JEWELERS);
}
@@ -43,10 +42,8 @@ public class VillageJewelryHandler implements IVillageCreationHandler { * @return
*/
@Override
- public Object buildComponent(PieceWeight villagePiece,
- Start startPiece, List pieces, Random random,
- int p1, int p2, int p3, int p4, int p5) {
- return ComponentJewelry.buildComponent(startPiece, pieces,
- random, p1, p2, p3, p4, p5);
+ public Object buildComponent(PieceWeight villagePiece, Start startPiece, List pieces, Random random, int p1, int p2,
+ int p3, int p4, int p5) {
+ return ComponentJewelry.buildComponent(startPiece, pieces, random, p1, p2, p3, p4, p5);
}
}
\ No newline at end of file |
