diff options
| author | bculkin2442 <bjculkin@mix.wvu.edu> | 2019-08-22 19:54:41 -0400 |
|---|---|---|
| committer | bculkin2442 <bjculkin@mix.wvu.edu> | 2019-08-22 19:54:41 -0400 |
| commit | c918a1b6d8008773e9beebb48ba1a770405aee20 (patch) | |
| tree | 7588d9e570addc61d2f318697662e6f2156fa04e | |
| parent | 3eb8c7a8fca3f22475d53e30f0b90a6737f313fa (diff) | |
Bulk update back to sanity
96 files changed, 2423 insertions, 4953 deletions
diff --git a/YWD/src/main/java/fyresmodjam/ClientProxy.java b/YWD/src/main/java/fyresmodjam/ClientProxy.java index 6bc688a..37650fa 100755 --- a/YWD/src/main/java/fyresmodjam/ClientProxy.java +++ b/YWD/src/main/java/fyresmodjam/ClientProxy.java @@ -42,65 +42,40 @@ public class ClientProxy extends CommonProxy { @SubscribeEvent
public void guiRenderEvent(RenderGameOverlayEvent.Post event) {
if (event.type == RenderGameOverlayEvent.ElementType.HOTBAR) {
- MovingObjectPosition mouse = Minecraft
- .getMinecraft().objectMouseOver;
+ MovingObjectPosition mouse = Minecraft.getMinecraft().objectMouseOver;
World world = Minecraft.getMinecraft().theWorld;
- EntityClientPlayerMP thePlayer = Minecraft
- .getMinecraft().thePlayer;
-
- FontRenderer fontRenderer = Minecraft
- .getMinecraft().fontRenderer;
-
- int halfedWidth = event.resolution.getScaledWidth()
- / 2;
- if (mouse != null && world != null
- && mouse.typeOfHit == MovingObjectType.BLOCK) {
- TileEntity te = world.getTileEntity(
- mouse.blockX, mouse.blockY,
- mouse.blockZ);
- Block id = world.getBlock(mouse.blockX,
- mouse.blockY,
- mouse.blockZ);
-
- if (id == ModjamMod.blockPillar
- || (id == ModjamMod.blockTrap
- && te != null
- && te instanceof TileEntityTrap
- && ((TileEntityTrap) te).placedBy != null)) {
+ EntityClientPlayerMP thePlayer = Minecraft.getMinecraft().thePlayer;
+
+ FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;
+
+ int halfedWidth = event.resolution.getScaledWidth() / 2;
+ if (mouse != null && world != null && mouse.typeOfHit == MovingObjectType.BLOCK) {
+ TileEntity te = world.getTileEntity(mouse.blockX, mouse.blockY, mouse.blockZ);
+ Block id = world.getBlock(mouse.blockX, mouse.blockY, mouse.blockZ);
+
+ if (id == ModjamMod.blockPillar || (id == ModjamMod.blockTrap && te != null
+ && te instanceof TileEntityTrap && ((TileEntityTrap) te).placedBy != null)) {
TileEntityTrap tileEntityTrap = null;
- if(te instanceof TileEntityTrap)
+ if (te instanceof TileEntityTrap)
tileEntityTrap = (TileEntityTrap) te;
if (tileEntityTrap != null && tileEntityTrap.placedBy != null) {
- String key = Keyboard
- .getKeyName(FyresKeyHandler.examine
- .getKeyCode());
- String string = "Press "
- + key
- + " to Examine";
-
- if (thePlayer != null
- && tileEntityTrap.placedBy
- .equals(thePlayer
- .getCommandSenderName())) {
+ String key = Keyboard.getKeyName(FyresKeyHandler.examine.getKeyCode());
+ String string = "Press " + key + " to Examine";
+
+ if (thePlayer != null && tileEntityTrap.placedBy.equals(thePlayer.getCommandSenderName())) {
if (thePlayer.isSneaking())
string = "Use to disarm (Stand to toggle setting)";
else
string = "Use to toggle setting (Sneak to disarm)";
}
- fontRenderer.drawStringWithShadow(
- string,
- halfedWidth - (fontRenderer
- .getStringWidth(string)
- / 2),
- event.resolution.getScaledHeight()
- / 2
- + 16,
- Color.WHITE.getRGB());
+ fontRenderer.drawStringWithShadow(string,
+ halfedWidth - (fontRenderer.getStringWidth(string) / 2),
+ event.resolution.getScaledHeight() / 2 + 16, Color.WHITE.getRGB());
}
}
}
@@ -109,29 +84,15 @@ public class ClientProxy extends CommonProxy { EntityPlayer player = thePlayer;
if (BlessingUtils.hasBlessing(player)) {
- if (BlessingUtils.hasBlessing(
- player,
- "BlessingBerserker")) {
- if (!EntityStatHelper
- .hasStat(player, "BlessingCounter")) {
- EntityStatHelper.giveStat(
- player,
- "BlessingCounter",
- 0);
+ if (BlessingUtils.hasBlessing(player, "BlessingBerserker")) {
+ if (!EntityStatHelper.hasStat(player, "BlessingCounter")) {
+ EntityStatHelper.giveStat(player, "BlessingCounter", 0);
}
- String string = EntityStatHelper
- .getStat(player, "BlessingCounter");
- fontRenderer.drawStringWithShadow(
- string,
- halfedWidth - (fontRenderer
- .getStringWidth(string)
- / 2),
- event.resolution.getScaledHeight()
- - 48
- + (player.capabilities.isCreativeMode
- ? 16
- : 0),
+ String string = EntityStatHelper.getStat(player, "BlessingCounter");
+ fontRenderer.drawStringWithShadow(string,
+ halfedWidth - (fontRenderer.getStringWidth(string) / 2),
+ event.resolution.getScaledHeight() - 48 + (player.capabilities.isCreativeMode ? 16 : 0),
Color.RED.getRGB());
}
}
@@ -144,56 +105,38 @@ public class ClientProxy extends CommonProxy { ClientTickHandler clientHandler = new ClientTickHandler();
FMLCommonHandler.instance().bus().register(clientHandler);
- FMLCommonHandler.instance().bus()
- .register(new FyresKeyHandler());
-
- ClientRegistry.bindTileEntitySpecialRenderer(
- TileEntityPillar.class,
- new TileEntityPillarRenderer());
- ClientRegistry.bindTileEntitySpecialRenderer(
- TileEntityTrap.class,
- new TileEntityTrapRenderer());
- ClientRegistry.bindTileEntitySpecialRenderer(
- TileEntityCrystal.class,
- new TileEntityCrystalRenderer());
- ClientRegistry.bindTileEntitySpecialRenderer(
- TileEntityCrystalStand.class,
+ FMLCommonHandler.instance().bus().register(new FyresKeyHandler());
+
+ ClientRegistry.bindTileEntitySpecialRenderer(TileEntityPillar.class, new TileEntityPillarRenderer());
+ ClientRegistry.bindTileEntitySpecialRenderer(TileEntityTrap.class, new TileEntityTrapRenderer());
+ ClientRegistry.bindTileEntitySpecialRenderer(TileEntityCrystal.class, new TileEntityCrystalRenderer());
+ ClientRegistry.bindTileEntitySpecialRenderer(TileEntityCrystalStand.class,
new TileEntityCrystalStandRenderer());
- RenderingRegistry.registerEntityRenderingHandler(
- EntityMysteryPotion.class,
- new RenderMysteryPotion(
- ModjamMod.mysteryPotion));
+ RenderingRegistry.registerEntityRenderingHandler(EntityMysteryPotion.class,
+ new RenderMysteryPotion(ModjamMod.mysteryPotion));
MinecraftForge.EVENT_BUS.register(this);
}
@Override
public void sendPlayerMessage(String message) {
- NewPacketHandler.SEND_MESSAGE.data = new Object[] {
- message
- };
+ NewPacketHandler.SEND_MESSAGE.data = new Object[] { message };
- NewPacketHandler.SEND_MESSAGE.executeClient(
- Minecraft.getMinecraft().thePlayer);
+ NewPacketHandler.SEND_MESSAGE.executeClient(Minecraft.getMinecraft().thePlayer);
}
public void loadFromConfig(Configuration config) {
ConfigData.loadFromConfig(config);
- ConfigData.examineKey = config
- .get("Keybindings", "examine_key",
- ConfigData.examineKey)
+ ConfigData.examineKey = config.get("Keybindings", "examine_key", ConfigData.examineKey)
.getInt(ConfigData.examineKey);
- ConfigData.blessingKey = config
- .get("Keybindings", "blessing_key",
- ConfigData.blessingKey)
+ ConfigData.blessingKey = config.get("Keybindings", "blessing_key", ConfigData.blessingKey)
.getInt(ConfigData.blessingKey);
FyresKeyHandler.examine.setKeyCode(ConfigData.examineKey);
- FyresKeyHandler.activateBlessing
- .setKeyCode(ConfigData.blessingKey);
+ FyresKeyHandler.activateBlessing.setKeyCode(ConfigData.blessingKey);
}
}
diff --git a/YWD/src/main/java/fyresmodjam/EntityLevelStat.java b/YWD/src/main/java/fyresmodjam/EntityLevelStat.java index 93ff574..249e6ae 100755 --- a/YWD/src/main/java/fyresmodjam/EntityLevelStat.java +++ b/YWD/src/main/java/fyresmodjam/EntityLevelStat.java @@ -3,6 +3,7 @@ package fyresmodjam; import java.util.Random; import fyresmodjam.blessings.BlessingUtils; +import fyresmodjam.misc.ConfigData; import fyresmodjam.misc.EntityStat; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; @@ -11,10 +12,6 @@ import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.monster.EntityCreeper; public final class EntityLevelStat extends EntityStat { - private static final int DIABOLIC_CHANCE = 20; - private static final int BLESSING_LEVEL = 5; - private static final int LEVELUP_CHANCE = 3; - public EntityLevelStat(String name, String value) { super(name, value); } @@ -26,7 +23,7 @@ public final class EntityLevelStat extends EntityStat { while (true) { int chance = 5 * (Math.max(1, lvl / 5)); - if (ModjamMod.r.nextInt(chance) < LEVELUP_CHANCE) { + if (ModjamMod.r.nextInt(chance) < ConfigData.levelupChance) { return lvl; } @@ -39,8 +36,7 @@ public final class EntityLevelStat extends EntityStat { int level = 1; try { - String entityName = entity.getEntityData() - .getString(name); + String entityName = entity.getEntityData().getString(name); level = Integer.parseInt(entityName); } catch (Exception e) { @@ -57,36 +53,36 @@ public final class EntityLevelStat extends EntityStat { String rank = "Unelisted "; switch (level) { - case 2: - rank = "Private"; - break; - case 3: - rank = "Corporal"; - break; - case 4: - rank = "Sergeant"; - break; - case 5: - rank = "Lieutenant"; - break; - case 6: - rank = "Captain"; - break; - case 7: - rank = "Major"; - break; - case 8: - rank = "Colonel"; - break; - case 9: - rank = "General"; - break; - default: - if (level > 9) { - rank = "Field Marshal"; - } else { - rank = "Unelisted"; - } + case 2: + rank = "Private"; + break; + case 3: + rank = "Corporal"; + break; + case 4: + rank = "Sergeant"; + break; + case 5: + rank = "Lieutenant"; + break; + case 6: + rank = "Captain"; + break; + case 7: + rank = "Major"; + break; + case 8: + rank = "Colonel"; + break; + case 9: + rank = "General"; + break; + default: + if (level > 9) { + rank = "Field Marshal"; + } else { + rank = "Unelisted"; + } } newName = String.format("%s %s", rank, entityName); @@ -97,8 +93,7 @@ public final class EntityLevelStat extends EntityStat { colPrefix = "\u00A7c"; } - newName = String.format("%s%s, %s", colPrefix, - entityName, levelSuffix); + newName = String.format("%s%s, %s", colPrefix, entityName, levelSuffix); } return newName; @@ -109,8 +104,7 @@ public final class EntityLevelStat extends EntityStat { int level = 1; try { - level = Integer.parseInt(entity.getEntityData() - .getString(name)); + level = Integer.parseInt(entity.getEntityData().getString(name)); } catch (Exception e) { e.printStackTrace(); } @@ -120,21 +114,16 @@ public final class EntityLevelStat extends EntityStat { if (healthGain != 0) { EntityLivingBase livingBase = (EntityLivingBase) entity; - float newHealth = livingBase.getMaxHealth() - + healthGain; + float newHealth = livingBase.getMaxHealth() + healthGain; - livingBase.getEntityAttribute( - SharedMonsterAttributes.maxHealth) - .setBaseValue(newHealth); + livingBase.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(newHealth); livingBase.setHealth(newHealth); } - if (level >= BLESSING_LEVEL) { + if (level >= ConfigData.blessingLevel) { blessMob(entity); - } else if (BlessingUtils.hasDisadvantage("Diabolic") - && ModjamMod.r.nextInt( - DIABOLIC_CHANCE) == 0) { + } else if (BlessingUtils.hasDisadvantage("Diabolic") && ModjamMod.r.nextInt(ConfigData.diabolicChance) == 0) { blessMob(entity); } @@ -148,14 +137,11 @@ public final class EntityLevelStat extends EntityStat { return; } - float regionalDifficulty = entity.worldObj.func_147462_b( - entity.posX, entity.posY, entity.posZ); + float regionalDifficulty = entity.worldObj.func_147462_b(entity.posX, entity.posY, entity.posZ); - int adjustedDifficulty = (int) Math - .ceil(level + regionalDifficulty); + int adjustedDifficulty = (int) Math.ceil(level + regionalDifficulty); - if (ModjamMod.r.nextInt(10) == 0 - || adjustedDifficulty > 5) { + if (ModjamMod.r.nextInt(10) == 0 || adjustedDifficulty > 5) { } @@ -163,43 +149,45 @@ public final class EntityLevelStat extends EntityStat { } private int calculateMobHealthGain(Entity entity, int level) { - int levelBase = level - 1; - float quarteredHealth = ((EntityLivingBase) entity) - .getMaxHealth() / 4; - - float adjustedMaxHealth = quarteredHealth; - - float bonusLevel5Health; - - if (level >= 5) { - bonusLevel5Health = quarteredHealth; - - bonusLevel5Health *= Math.max(1, level / 5); - } else { - bonusLevel5Health = 0; - } - - return (int) ((levelBase * adjustedMaxHealth) - + bonusLevel5Health); + float initHealth = ((EntityLivingBase) entity).getMaxHealth(); + + double mult = level * ConfigData.healthLevelMult; + double addHealth = initHealth * mult; + + int flatHealth = level * ConfigData.healthLevelFlat; + + /* + * int levelBase = level - 1; float quarteredHealth = ((EntityLivingBase) + * entity).getMaxHealth() / 4; + * + * float adjustedMaxHealth = quarteredHealth; + * + * float bonusLevel5Health; + * + * if (level >= 5) { bonusLevel5Health = quarteredHealth; + * + * bonusLevel5Health *= Math.max(1, level / 5); } else { bonusLevel5Health = 0; + * } + */ + + return (int) ((initHealth + addHealth) + flatHealth); } private void blessMob(Entity entity) { String chosenBlessing = BlessingUtils.getMobBlessing(); - entity.getEntityData().setString("Blessing", - chosenBlessing); + entity.getEntityData().setString("Blessing", chosenBlessing); - BlessingUtils.getBlessingInstance(chosenBlessing) - .correctBlessing(entity); + // Make sure that any mob type specific blessings are patched up + BlessingUtils.getBlessingInstance(chosenBlessing).correctBlessing(entity); if (entity instanceof EntityCreeper) { + // Blessed creepers are auto-empowered EntityCreeper creeper = (EntityCreeper) entity; - creeper.getDataWatcher().updateObject(17, - (byte) 1); + creeper.getDataWatcher().updateObject(17, (byte) 1); - creeper.getEntityData().setBoolean("powered", - true); + creeper.getEntityData().setBoolean("powered", true); } } }
\ No newline at end of file diff --git a/YWD/src/main/java/fyresmodjam/ModjamMod.java b/YWD/src/main/java/fyresmodjam/ModjamMod.java index 6a69d81..aac2f32 100755 --- a/YWD/src/main/java/fyresmodjam/ModjamMod.java +++ b/YWD/src/main/java/fyresmodjam/ModjamMod.java @@ -28,31 +28,14 @@ import fyresmodjam.blessings.BlessingUtils; import fyresmodjam.blocks.BlockMysteryMushroom;
import fyresmodjam.blocks.BlockPillar;
import fyresmodjam.blocks.BlockTrap;
-import fyresmodjam.commands.CommandCraftingStats;
-import fyresmodjam.commands.CommandCurrentBlessing;
-import fyresmodjam.commands.CommandCurrentDisadvantage;
-import fyresmodjam.commands.CommandCurrentWorldTask;
-import fyresmodjam.commands.CommandKillStats;
-import fyresmodjam.commands.CommandWeaponStats;
+import fyresmodjam.commands.*;
import fyresmodjam.entities.EntityMysteryPotion;
+import fyresmodjam.handlers.ChannelHandler;
import fyresmodjam.handlers.CommonTickHandler;
import fyresmodjam.handlers.GUIHandler;
import fyresmodjam.handlers.NewPacketHandler;
-import fyresmodjam.handlers.NewPacketHandler.ChannelHandler;
-import fyresmodjam.items.ItemMysteryMushroom;
-import fyresmodjam.items.ItemMysteryPotion;
-import fyresmodjam.items.ItemObsidianSceptre;
-import fyresmodjam.items.ItemPillar;
-import fyresmodjam.items.ItemTrap;
-import fyresmodjam.misc.ArmorStatTracker;
-import fyresmodjam.misc.ConfigData;
-import fyresmodjam.misc.CreativeTabModjamMod;
-import fyresmodjam.misc.EntityStat;
-import fyresmodjam.misc.EntityStatHelper;
-import fyresmodjam.misc.EntityStatTracker;
-import fyresmodjam.misc.ItemStatHelper;
-import fyresmodjam.misc.ItemStatTracker;
-import fyresmodjam.misc.WeaponRankStat;
+import fyresmodjam.items.*;
+import fyresmodjam.misc.*;
import fyresmodjam.tileentities.TileEntityPillar;
import fyresmodjam.tileentities.TileEntityTrap;
import fyresmodjam.worldgen.FyresWorldData;
@@ -66,12 +49,7 @@ import net.minecraft.entity.monster.EntityMob; 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.ItemBow;
-import net.minecraft.item.ItemStack;
-import net.minecraft.item.ItemSword;
+import net.minecraft.item.*;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.stats.Achievement;
import net.minecraft.util.ChatComponentTranslation;
@@ -90,147 +68,113 @@ public class ModjamMod extends CommandHandler { @Instance("fyresmodjam")
public static ModjamMod instance;
- public static EnumMap<Side, FMLEmbeddedChannel> channels = NetworkRegistry.INSTANCE
- .newChannel("YWDMod", new ChannelHandler());
+ public static EnumMap<Side, FMLEmbeddedChannel> channels = NetworkRegistry.INSTANCE.newChannel("YWDMod",
+ new ChannelHandler());
public static Random r = new Random();
- public static CreativeTabs tabModjamMod = new CreativeTabModjamMod(
- CreativeTabs.getNextID(),
+ public static CreativeTabs tabModjamMod = new CreativeTabModjamMod(CreativeTabs.getNextID(),
"The \"You Will Die\" Mod");
- public static Block blockPillar;
- public static Block blockTrap;
- public static Block mysteryMushroomBlock;
+ public static Block blockPillar;
+ public static Block blockTrap;
+ public static Block mysteryMushroomBlock;
- public static Item itemPillar;
- public static Item mysteryPotion;
- public static Item itemTrap;
- public static Item mysteryMushroom;
- public static Item sceptre;
+ public static Item itemPillar;
+ public static Item mysteryPotion;
+ public static Item itemTrap;
+ public static Item mysteryMushroom;
+ public static Item sceptre;
- public static Item crystalItem;
- public static Item scroll;
+ public static Item crystalItem;
+ public static Item scroll;
- public static Block crystal;
- public static Block crystalStand;
+ public static Block crystal;
+ public static Block crystalStand;
- public static Achievement startTheGame;
- public static Achievement losingIsFun;
- public static Achievement whoops;
+ public static Achievement startTheGame;
+ public static Achievement losingIsFun;
+ public static Achievement whoops;
- public static Achievement theHunt;
- public static Achievement jackOfAllTrades;
+ public static Achievement theHunt;
+ public static Achievement jackOfAllTrades;
public static AchievementPage page;
- public static String version = "v0.0.3e";
- public static String foundVersion = "v0.0.3e";
- public static boolean newerVersion = false;
+ public static String version = "v0.0.3e";
+ public static String foundVersion = "v0.0.3e";
+ public static boolean newerVersion = false;
public static String configPath = null;
@EventHandler
public void preInit(FMLPreInitializationEvent event) {
- String absolutePath = event.getSuggestedConfigurationFile()
- .getAbsolutePath();
+ String absolutePath = event.getSuggestedConfigurationFile().getAbsolutePath();
- File old = new File(absolutePath.replace("fyresmodjam",
- "YouWillDieMod"));
+ File old = new File(absolutePath.replace("fyresmodjam", "YouWillDieMod"));
if (old.exists()) {
old.delete();
System.out.println(true);
}
- configPath = absolutePath.replace("fyresmodjam",
- "TheYouWillDieMod");
+ configPath = absolutePath.replace("fyresmodjam", "TheYouWillDieMod");
- Configuration config = new Configuration(
- new File(configPath));
+ Configuration config = new Configuration(new File(configPath));
config.load();
ConfigData.loadFromConfig(config);
+ BlessingUtils.loadBlessings(config);
config.save();
// Item and Block loading
- blockPillar = new BlockPillar().setBlockUnbreakable()
- .setResistance(6000000.0F);
- blockTrap = new BlockTrap().setBlockUnbreakable()
- .setResistance(6000000.0F);
- mysteryMushroomBlock = new BlockMysteryMushroom()
- .setHardness(0.0F)
- .setStepSound(Block.soundTypeGrass)
- .setLightLevel(0.125F)
- .setBlockName("mysteryMushroomBlock");
-
- itemPillar = new ItemPillar()
- .setUnlocalizedName("blockPillar");
+ blockPillar = new BlockPillar().setBlockUnbreakable().setResistance(6000000.0F);
+ blockTrap = new BlockTrap().setBlockUnbreakable().setResistance(6000000.0F);
+ mysteryMushroomBlock = new BlockMysteryMushroom().setHardness(0.0F).setStepSound(Block.soundTypeGrass)
+ .setLightLevel(0.125F).setBlockName("mysteryMushroomBlock");
+
+ itemPillar = new ItemPillar().setUnlocalizedName("blockPillar");
GameRegistry.registerItem(itemPillar, "itemPillar");
- mysteryPotion = new ItemMysteryPotion()
- .setUnlocalizedName("mysteryPotion")
+ mysteryPotion = new ItemMysteryPotion().setUnlocalizedName("mysteryPotion")
.setCreativeTab(CreativeTabs.tabBrewing);
GameRegistry.registerItem(mysteryPotion, "mysteryPotion");
- itemTrap = new ItemTrap().setUnlocalizedName("itemTrap")
- .setCreativeTab(CreativeTabs.tabBlock);
+ itemTrap = new ItemTrap().setUnlocalizedName("itemTrap").setCreativeTab(CreativeTabs.tabBlock);
GameRegistry.registerItem(itemTrap, "itemTrap");
- mysteryMushroom = new ItemMysteryMushroom()
- .setUnlocalizedName("mysteryMushroom")
+ mysteryMushroom = new ItemMysteryMushroom().setUnlocalizedName("mysteryMushroom")
.setCreativeTab(CreativeTabs.tabBrewing);
- GameRegistry.registerItem(mysteryMushroom,
- "mysteryMushroom");
+ GameRegistry.registerItem(mysteryMushroom, "mysteryMushroom");
- sceptre = new ItemObsidianSceptre()
- .setUnlocalizedName("sceptre")
- .setCreativeTab(CreativeTabs.tabTools)
+ sceptre = new ItemObsidianSceptre().setUnlocalizedName("sceptre").setCreativeTab(CreativeTabs.tabTools)
.setFull3D();
GameRegistry.registerItem(sceptre, "sceptre");
GameRegistry.registerBlock(blockPillar, "blockPillar");
- GameRegistry.registerTileEntity(TileEntityPillar.class,
- "Pillar Tile Entity");
+ GameRegistry.registerTileEntity(TileEntityPillar.class, "Pillar Tile Entity");
GameRegistry.registerBlock(blockTrap, "blockTrap");
- GameRegistry.registerTileEntity(TileEntityTrap.class,
- "Trap Entity");
-
- GameRegistry.registerBlock(mysteryMushroomBlock,
- "mysteryMushroomBlock");
-
- startTheGame = getNewAchievement(ConfigData.achievementID,
- 0, 0, new ItemStack(Items.iron_sword, 1),
- "startTheGame", "You Will Die",
- "Join a world with this mod installed",
- null, true);
- losingIsFun = getNewAchievement(
- ConfigData.achievementID + 1, -2, 0,
- new ItemStack(itemTrap, 1), "losingIsFun",
- "Losing Is Fun", "Experience \"fun\"",
- startTheGame, false);
- whoops = getNewAchievement(ConfigData.achievementID + 2, 2,
- 0, new ItemStack(itemTrap, 1, 1), "whoops",
- "Whoops", "Fail to disarm a trap",
- startTheGame, false);
- theHunt = getNewAchievement(ConfigData.achievementID + 3,
- 0, -2, new ItemStack(Items.bow, 1),
- "theHunt", "The Hunt",
- "Become a competent slayer of 5 or more different creatures",
- startTheGame, false);
- jackOfAllTrades = getNewAchievement(
- ConfigData.achievementID + 4, 0, 2,
- new ItemStack(Blocks.crafting_table, 1),
- "jackOfAllTrades", "Jack of All Trades",
- "Become a novice user of at least 10 different weapons",
+ GameRegistry.registerTileEntity(TileEntityTrap.class, "Trap Entity");
+
+ GameRegistry.registerBlock(mysteryMushroomBlock, "mysteryMushroomBlock");
+
+ startTheGame = getNewAchievement(ConfigData.achievementID, 0, 0, new ItemStack(Items.iron_sword, 1),
+ "startTheGame", "You Will Die", "Join a world with this mod installed", null, true);
+ losingIsFun = getNewAchievement(ConfigData.achievementID + 1, -2, 0, new ItemStack(itemTrap, 1), "losingIsFun",
+ "Losing Is Fun", "Experience \"fun\"", startTheGame, false);
+ whoops = getNewAchievement(ConfigData.achievementID + 2, 2, 0, new ItemStack(itemTrap, 1, 1), "whoops",
+ "Whoops", "Fail to disarm a trap", startTheGame, false);
+ theHunt = getNewAchievement(ConfigData.achievementID + 3, 0, -2, new ItemStack(Items.bow, 1), "theHunt",
+ "The Hunt", "Become a competent slayer of 5 or more different creatures", startTheGame, false);
+ jackOfAllTrades = getNewAchievement(ConfigData.achievementID + 4, 0, 2, new ItemStack(Blocks.crafting_table, 1),
+ "jackOfAllTrades", "Jack of All Trades", "Become a novice user of at least 10 different weapons",
startTheGame, false);
- page = new AchievementPage("The \"You Will Die\" Mod",
- startTheGame, losingIsFun, whoops, theHunt,
+ page = new AchievementPage("The \"You Will Die\" Mod", startTheGame, losingIsFun, whoops, theHunt,
jackOfAllTrades);
AchievementPage.registerAchievementPage(page);
@@ -251,116 +195,64 @@ public class ModjamMod extends CommandHandler { new ItemStatHelper().register();
new EntityStatHelper().register();
- NetworkRegistry.INSTANCE.registerGuiHandler(this,
- new GUIHandler());
+ NetworkRegistry.INSTANCE.registerGuiHandler(this, new GUIHandler());
GameRegistry.registerWorldGenerator(new PillarGen(), 0);
- GameRegistry.registerWorldGenerator(
- new WorldGenTrapsTowersAndMore(), 0);
+ GameRegistry.registerWorldGenerator(new WorldGenTrapsTowersAndMore(), 0);
for (int i = 0; i < 3; i++) {
- GameRegistry.registerWorldGenerator(
- new WorldGenMoreDungeons(), 0);
+ GameRegistry.registerWorldGenerator(new WorldGenMoreDungeons(), 0);
}
- EntityRegistry.registerGlobalEntityID(
- EntityMysteryPotion.class, "MysteryPotion",
+ EntityRegistry.registerGlobalEntityID(EntityMysteryPotion.class, "MysteryPotion",
EntityRegistry.findGlobalUniqueEntityId());
- EntityRegistry.registerModEntity(EntityMysteryPotion.class,
- "MysteryPotion", 0, instance, 128, 1,
- true);
-
- GameRegistry.addShapelessRecipe(
- new ItemStack(itemTrap, 1, 0),
- new Object[] {
- Blocks.heavy_weighted_pressure_plate,
- Blocks.cactus
- });
- GameRegistry.addShapelessRecipe(
- new ItemStack(itemTrap, 1, 1),
- new Object[] {
- Blocks.heavy_weighted_pressure_plate,
- Blocks.torch
- });
- GameRegistry.addShapelessRecipe(
- new ItemStack(itemTrap, 1, 2),
- new Object[] {
- Blocks.heavy_weighted_pressure_plate,
- new ItemStack(Items.dye, 1,
- 0)
- });
+ EntityRegistry.registerModEntity(EntityMysteryPotion.class, "MysteryPotion", 0, instance, 128, 1, true);
+
+ GameRegistry.addShapelessRecipe(new ItemStack(itemTrap, 1, 0),
+ new Object[] { Blocks.heavy_weighted_pressure_plate, Blocks.cactus });
+ GameRegistry.addShapelessRecipe(new ItemStack(itemTrap, 1, 1),
+ new Object[] { Blocks.heavy_weighted_pressure_plate, Blocks.torch });
+ GameRegistry.addShapelessRecipe(new ItemStack(itemTrap, 1, 2),
+ new Object[] { Blocks.heavy_weighted_pressure_plate, new ItemStack(Items.dye, 1, 0) });
for (int i = 0; i < 13; i++) {
- GameRegistry.addShapelessRecipe(
- new ItemStack(mysteryPotion, 1,
- i + 13),
- new Object[] {
- new ItemStack(mysteryPotion,
- 1,
- i),
- Items.gunpowder
- });
- GameRegistry.addShapelessRecipe(
- new ItemStack(mysteryPotion, 1, i),
- new Object[] {
- new ItemStack(Items.potionitem,
- 1,
- 0),
- Items.leather,
- new ItemStack(mysteryMushroom,
- 1,
- i)
- });
+ GameRegistry.addShapelessRecipe(new ItemStack(mysteryPotion, 1, i + 13),
+ new Object[] { new ItemStack(mysteryPotion, 1, i), Items.gunpowder });
+ GameRegistry.addShapelessRecipe(new ItemStack(mysteryPotion, 1, i), new Object[] {
+ new ItemStack(Items.potionitem, 1, 0), Items.leather, new ItemStack(mysteryMushroom, 1, i) });
}
- GameRegistry.addRecipe(new ItemStack(sceptre, 1, 0), "X",
- "Y", "X", 'X', Blocks.obsidian, 'Y',
- Blocks.end_stone);
- GameRegistry.addShapelessRecipe(
- new ItemStack(sceptre, 1, 1),
- new Object[] {
- new ItemStack(sceptre, 1,
- 0),
- Items.ender_pearl,
- Items.book
- });
+ // GameRegistry.addRecipe(new ItemStack(sceptre, 1, 0), "X", "Y", "X", 'X',
+ // Blocks.obsidian, 'Y',
+ // Blocks.end_stone);
+ // GameRegistry.addShapelessRecipe(new ItemStack(sceptre, 1, 1),
+ // new Object[] { new ItemStack(sceptre, 1, 0), Items.ender_pearl, Items.book
+ // });
proxy.register();
// Entity Trackers
- EntityStatTracker playerTracker = new EntityStatTracker(
- EntityPlayer.class, true);
+ EntityStatTracker playerTracker = new EntityStatTracker(EntityPlayer.class, true);
- playerTracker.addStat(new EntityStat("BlessingCooldown",
- "" + 0));
- playerTracker.addStat(
- new EntityStat("BlessingCounter", "" + 0));
+ playerTracker.addStat(new EntityStat("BlessingCooldown", "" + 0));
+ playerTracker.addStat(new EntityStat("BlessingCounter", "" + 0));
- EntityStatTracker mobTracker = new EntityStatTracker(
- EntityMob.class, true);
+ EntityStatTracker mobTracker = new EntityStatTracker(EntityMob.class, true);
mobTracker.addStat(new EntityLevelStat("Level", ""));
EntityStatHelper.addStatTracker(mobTracker);
// Item Trackers
-
ItemStatTracker weaponTracker = new ItemStatTracker(
- new Class[] {
- ItemSword.class,
- ItemAxe.class,
- ItemBow.class
- }, true);
+ new Class[] { ItemSword.class, ItemAxe.class, ItemBow.class }, true);
weaponTracker.addStat(new WeaponRankStat("Rank", ""));
ItemStatHelper.addStatTracker(weaponTracker);
- ItemStatTracker armorTracker = new ItemStatTracker(
- new Class[] {
- ItemArmor.class
- }, true);
+ ItemStatTracker armorTracker = new ItemStatTracker(new Class[] { ItemArmor.class }, true);
armorTracker.addStat(new ArmorStatTracker("Rank", ""));
@@ -370,14 +262,9 @@ public class ModjamMod extends CommandHandler { for (int i = 0; i < 13; i++) {
ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST)
- .addItem(new WeightedRandomChestContent(
- mysteryPotion, i,
- 1, 3, 2));
-
- WorldGenTrapsTowersAndMore.chestGenInfo.addItem(
- new WeightedRandomChestContent(
- mysteryPotion, i,
- 1, 3, 2));
+ .addItem(new WeightedRandomChestContent(mysteryPotion, i, 1, 3, 2));
+
+ WorldGenTrapsTowersAndMore.chestGenInfo.addItem(new WeightedRandomChestContent(mysteryPotion, i, 1, 3, 2));
}
}
@@ -391,34 +278,22 @@ public class ModjamMod extends CommandHandler { EntityPlayer player = event.player;
if (!player.worldObj.isRemote) {
- NewPacketHandler.UPDATE_WORLD_DATA.sendToPlayer(
- player,
- CommonTickHandler.worldData.potionValues,
- CommonTickHandler.worldData.potionDurations,
- CommonTickHandler.worldData
- .getDisadvantage(),
- CommonTickHandler.worldData.currentTask,
- CommonTickHandler.worldData.currentTaskID,
- CommonTickHandler.worldData.currentTaskAmount,
- CommonTickHandler.worldData.progress,
- CommonTickHandler.worldData.tasksCompleted,
- CommonTickHandler.worldData.enderDragonKilled,
- ConfigData.spawnTraps,
- CommonTickHandler.worldData.rewardLevels,
+ NewPacketHandler.UPDATE_WORLD_DATA.sendToPlayer(player, CommonTickHandler.worldData.potionValues,
+ CommonTickHandler.worldData.potionDurations, CommonTickHandler.worldData.getDisadvantage(),
+ CommonTickHandler.worldData.currentTask, CommonTickHandler.worldData.currentTaskID,
+ CommonTickHandler.worldData.currentTaskAmount, CommonTickHandler.worldData.progress,
+ CommonTickHandler.worldData.tasksCompleted, CommonTickHandler.worldData.enderDragonKilled,
+ ConfigData.spawnTraps, CommonTickHandler.worldData.rewardLevels,
CommonTickHandler.worldData.mushroomColors);
// TODO make tasks into their own class
- String name = CommonTickHandler.worldData.currentTask
- .equals("Kill") ? FyresWorldData.validMobNames[CommonTickHandler.worldData.currentTaskID]
- : FyresWorldData.validItems[CommonTickHandler.worldData.currentTaskID]
- .getDisplayName();
+ String name = CommonTickHandler.worldData.currentTask.equals("Kill")
+ ? FyresWorldData.validMobNames[CommonTickHandler.worldData.currentTaskID]
+ : FyresWorldData.validItems[CommonTickHandler.worldData.currentTaskID].getDisplayName();
if (CommonTickHandler.worldData.currentTaskAmount > 1) {
if (name.contains("Block")) {
- name = name.replace("Block",
- "Blocks")
- .replace("block",
- "blocks");
+ name = name.replace("Block", "Blocks").replace("block", "blocks");
} else {
name += "s";
}
@@ -427,63 +302,38 @@ public class ModjamMod extends CommandHandler { // TODO move disadvantages into a class
int index = -1;
for (int i = 0; i < FyresWorldData.validDisadvantages.length; i++) {
- if (FyresWorldData.validDisadvantages[i]
- .equals(CommonTickHandler.worldData
- .getDisadvantage())) {
+ if (FyresWorldData.validDisadvantages[i].equals(CommonTickHandler.worldData.getDisadvantage())) {
index = i;
break;
}
}
NewPacketHandler.SEND_MESSAGE.sendToPlayer(player,
- "\u00A7eWorld disadvantage: "
- + CommonTickHandler.worldData
- .getDisadvantage()
- + (index == -1 ? ""
- : " (" + FyresWorldData.disadvantageDescriptions[index]
- + ")"));
+ "\u00A7eWorld disadvantage: " + CommonTickHandler.worldData.getDisadvantage()
+ + (index == -1 ? "" : " (" + FyresWorldData.disadvantageDescriptions[index] + ")"));
NewPacketHandler.SEND_MESSAGE.sendToPlayer(player,
- "\u00A7eWorld goal: "
- + CommonTickHandler.worldData.currentTask
- + " "
- + CommonTickHandler.worldData.currentTaskAmount
- + " " + name
- + ". ("
- + CommonTickHandler.worldData.progress
- + " "
- + CommonTickHandler.worldData.currentTask
+ "\u00A7eWorld goal: " + CommonTickHandler.worldData.currentTask + " "
+ + CommonTickHandler.worldData.currentTaskAmount + " " + name + ". ("
+ + CommonTickHandler.worldData.progress + " " + CommonTickHandler.worldData.currentTask
+ "ed)");
NBTTagCompound playerData = player.getEntityData();
if (!BlessingUtils.hasBlessing(player)) {
- String selectedBlessing = BlessingUtils
- .getPlayerBlessing();
- Blessing blessing = BlessingUtils
- .getBlessingInstance(
- selectedBlessing);
-
- playerData.setString("Blessing",
- selectedBlessing);
-
- NewPacketHandler.SEND_MESSAGE.sendToPlayer(
- player,
- "\u00A72You've been granted the "
- + blessing.customName()
- + ". (Use /currentBlessing to check effect)");
+ String selectedBlessing = BlessingUtils.getPlayerBlessing();
+ Blessing blessing = BlessingUtils.getBlessingInstance(selectedBlessing);
+
+ playerData.setString("Blessing", selectedBlessing);
+
+ NewPacketHandler.SEND_MESSAGE.sendToPlayer(player, "\u00A72You've been granted the "
+ + blessing.customName() + ". (Use /currentBlessing to check effect)");
}
- NewPacketHandler.UPDATE_BLESSING.sendToPlayer(
- player,
- playerData.getString("Blessing"));
-
- if (EntityStatHelper.hasStat(player,
- "BlessingCounter")) {
- NewPacketHandler.UPDATE_STAT.sendToPlayer(
- player, "BlessingCounter",
- EntityStatHelper.getStat(
- player,
- "BlessingCounter"));
+ NewPacketHandler.UPDATE_BLESSING.sendToPlayer(player, playerData.getString("Blessing"));
+
+ if (EntityStatHelper.hasStat(player, "BlessingCounter")) {
+ NewPacketHandler.UPDATE_STAT.sendToPlayer(player, "BlessingCounter",
+ EntityStatHelper.getStat(player, "BlessingCounter"));
}
if (!playerData.hasKey("PotionKnowledge")) {
@@ -493,52 +343,36 @@ public class ModjamMod extends CommandHandler { potionData[i] = -1;
}
- playerData.setIntArray("PotionKnowledge",
- potionData);
+ playerData.setIntArray("PotionKnowledge", potionData);
}
- NewPacketHandler.UPDATE_POTION_KNOWLEDGE
- .sendToPlayer(player, playerData
- .getIntArray("PotionKnowledge"));
+ NewPacketHandler.UPDATE_POTION_KNOWLEDGE.sendToPlayer(player, playerData.getIntArray("PotionKnowledge"));
}
if (ConfigData.versionChecking && newerVersion) {
- player.addChatComponentMessage(
- new ChatComponentTranslation(
- "fyresmodjam.newVersion"));
+ player.addChatComponentMessage(new ChatComponentTranslation("fyresmodjam.newVersion"));
}
player.triggerAchievement(startTheGame);
}
@SubscribeEvent
- public void onPlayerChangedDimension(
- PlayerChangedDimensionEvent event) {
+ public void onPlayerChangedDimension(PlayerChangedDimensionEvent event) {
EntityPlayer player = event.player;
- NewPacketHandler.UPDATE_WORLD_DATA.sendToPlayer(player,
- CommonTickHandler.worldData.potionValues,
- CommonTickHandler.worldData.potionDurations,
- CommonTickHandler.worldData
- .getDisadvantage(),
- CommonTickHandler.worldData.currentTask,
- CommonTickHandler.worldData.currentTaskID,
- CommonTickHandler.worldData.currentTaskAmount,
- CommonTickHandler.worldData.progress,
- CommonTickHandler.worldData.tasksCompleted,
- CommonTickHandler.worldData.enderDragonKilled,
- ConfigData.spawnTraps,
- CommonTickHandler.worldData.rewardLevels,
+ NewPacketHandler.UPDATE_WORLD_DATA.sendToPlayer(player, CommonTickHandler.worldData.potionValues,
+ CommonTickHandler.worldData.potionDurations, CommonTickHandler.worldData.getDisadvantage(),
+ CommonTickHandler.worldData.currentTask, CommonTickHandler.worldData.currentTaskID,
+ CommonTickHandler.worldData.currentTaskAmount, CommonTickHandler.worldData.progress,
+ CommonTickHandler.worldData.tasksCompleted, CommonTickHandler.worldData.enderDragonKilled,
+ ConfigData.spawnTraps, CommonTickHandler.worldData.rewardLevels,
CommonTickHandler.worldData.mushroomColors);
- NewPacketHandler.UPDATE_BLESSING.sendToPlayer(player,
- BlessingUtils.getBlessing(player));
+ NewPacketHandler.UPDATE_BLESSING.sendToPlayer(player, BlessingUtils.getBlessing(player));
if (EntityStatHelper.hasStat(player, "BlessingCounter")) {
- NewPacketHandler.UPDATE_STAT.sendToPlayer(player,
- "BlessingCounter",
- EntityStatHelper.getStat(player,
- "BlessingCounter"));
+ NewPacketHandler.UPDATE_STAT.sendToPlayer(player, "BlessingCounter",
+ EntityStatHelper.getStat(player, "BlessingCounter"));
}
if (!player.getEntityData().hasKey("PotionKnowledge")) {
@@ -548,24 +382,19 @@ public class ModjamMod extends CommandHandler { potionData[i] = -1;
}
- player.getEntityData().setIntArray(
- "PotionKnowledge", potionData);
+ player.getEntityData().setIntArray("PotionKnowledge", potionData);
}
- NewPacketHandler.UPDATE_POTION_KNOWLEDGE.sendToPlayer(
- player, player.getEntityData().getIntArray(
- "PotionKnowledge"));
+ NewPacketHandler.UPDATE_POTION_KNOWLEDGE.sendToPlayer(player,
+ player.getEntityData().getIntArray("PotionKnowledge"));
}
@SubscribeEvent
public void checkBreakSpeed(PlayerEvent.BreakSpeed event) {
EntityPlayer entityPlayer = event.entityPlayer;
- if (entityPlayer != null && BlessingUtils
- .hasBlessing(entityPlayer)) {
- BlessingUtils.getBlessingInstance(BlessingUtils
- .getBlessing(entityPlayer))
- .checkBreakSpeed(event);
+ if (entityPlayer != null && BlessingUtils.hasBlessing(entityPlayer)) {
+ BlessingUtils.getBlessingInstance(BlessingUtils.getBlessing(entityPlayer)).checkBreakSpeed(event);
}
}
@@ -576,8 +405,7 @@ public class ModjamMod extends CommandHandler { public void initCommands(FMLServerStartingEvent event) {
event.registerServerCommand(new CommandCurrentBlessing());
- event.registerServerCommand(
- new CommandCurrentDisadvantage());
+ event.registerServerCommand(new CommandCurrentDisadvantage());
event.registerServerCommand(new CommandCurrentWorldTask());
event.registerServerCommand(new CommandKillStats());
event.registerServerCommand(new CommandWeaponStats());
@@ -585,21 +413,14 @@ public class ModjamMod extends CommandHandler { }
@SuppressWarnings("deprecation")
- public static Achievement getNewAchievement(int id, int x, int y,
- ItemStack stack, String name, String displayName,
- String desc, Achievement prereq,
- boolean independent) {
- Achievement achievement = new Achievement("YWD-" + id,
- name, x, y, stack, prereq);
+ public static Achievement getNewAchievement(int id, int x, int y, ItemStack stack, String name, String displayName,
+ String desc, Achievement prereq, boolean independent) {
+ Achievement achievement = new Achievement("YWD-" + id, name, x, y, stack, prereq);
if (independent) {
achievement = achievement.initIndependentStat();
}
- LanguageRegistry.instance().addStringLocalization(
- "achievement." + name, "en_US",
- displayName);
- LanguageRegistry.instance().addStringLocalization(
- "achievement." + name + ".desc", "en_US",
- desc);
+ LanguageRegistry.instance().addStringLocalization("achievement." + name, "en_US", displayName);
+ LanguageRegistry.instance().addStringLocalization("achievement." + name + ".desc", "en_US", desc);
achievement.registerStat();
return achievement;
}
diff --git a/YWD/src/main/java/fyresmodjam/blessings/Blessing.java b/YWD/src/main/java/fyresmodjam/blessings/Blessing.java index afa167a..e85dfad 100644 --- a/YWD/src/main/java/fyresmodjam/blessings/Blessing.java +++ b/YWD/src/main/java/fyresmodjam/blessings/Blessing.java @@ -5,6 +5,7 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraftforge.event.entity.living.LivingDeathEvent; import net.minecraftforge.event.entity.living.LivingHurtEvent; +import net.minecraftforge.event.entity.player.PlayerDropsEvent; import net.minecraftforge.event.entity.player.PlayerEvent; /** @@ -39,7 +40,7 @@ public abstract class Blessing { } public String customName() { - return type().displayPrefix + name(); + return type().displayPrefix + " " + name(); } /** @@ -69,7 +70,7 @@ public abstract class Blessing { * Modify the player's break speed. * * @param pebsev - * The break speed event. + * The break speed event. */ public void checkBreakSpeed(PlayerEvent.BreakSpeed pebsev) { return; @@ -79,7 +80,7 @@ public abstract class Blessing { * Correct inappropriate blessings for mobs. * * @param ent - * The mob to correct for. + * The mob to correct for. */ public void correctBlessing(Entity ent) { return; @@ -89,7 +90,7 @@ public abstract class Blessing { * Do something on every tick. * * @param stev - * The tick event + * The tick event */ public void commonTick(ServerTickEvent stev, EntityPlayer play) { return; @@ -99,15 +100,14 @@ public abstract class Blessing { * Handle adjusting the damage multiplier for mob knowledge. * * @param lhev - * The event being dealt with. + * The event being dealt with. * * @param pickedDamageBonus - * The base damage bonus for mob knowledge. + * The base damage bonus for mob knowledge. * * @return The new damage bonus for mob knowledge */ - public float adjustMobKnowledgeBonus(LivingHurtEvent lhev, - float pickedDamageBonus) { + public float adjustMobKnowledgeBonus(LivingHurtEvent lhev, float pickedDamageBonus) { return pickedDamageBonus; } @@ -115,29 +115,30 @@ public abstract class Blessing { * Handle adjusting the damage multiplier for weapon knowledge. * * @param lhev - * The event being dealt with. + * The event being dealt with. * * @param pickedDamageBonus - * The base damage bonus for weapon knowledge. + * The base damage bonus for weapon knowledge. * * @return The new damage bonus for weapon knowledge */ - public float adjustWeaponKnowledgeBonus(LivingHurtEvent lhev, - float pickedDamageBonus) { + public float adjustWeaponKnowledgeBonus(LivingHurtEvent lhev, float pickedDamageBonus) { return pickedDamageBonus; } - public float onIncomingDamage(LivingHurtEvent lhev, - float damageMultiplier) { + public float onIncomingDamage(LivingHurtEvent lhev, float damageMultiplier) { return damageMultiplier; } - public float onOutgoingDamage(LivingHurtEvent event, - float damageMultiplier) { + public float onOutgoingDamage(LivingHurtEvent event, float damageMultiplier) { return damageMultiplier; } public void onMobKill(LivingDeathEvent event) { return; } + + public void onPlayerDrops(PlayerDropsEvent event) { + + } } diff --git a/YWD/src/main/java/fyresmodjam/blessings/BlessingType.java b/YWD/src/main/java/fyresmodjam/blessings/BlessingType.java index 21bc72c..adc44ae 100644 --- a/YWD/src/main/java/fyresmodjam/blessings/BlessingType.java +++ b/YWD/src/main/java/fyresmodjam/blessings/BlessingType.java @@ -20,8 +20,8 @@ public enum BlessingType { */ MARK("Mark", "Mark of"); - public final String internalPrefix; - public final String displayPrefix; + public final String internalPrefix; + public final String displayPrefix; private BlessingType(String internalPrefix, String displayPrefix) { this.internalPrefix = internalPrefix; diff --git a/YWD/src/main/java/fyresmodjam/blessings/BlessingUtils.java b/YWD/src/main/java/fyresmodjam/blessings/BlessingUtils.java index c240a7a..ec29a1a 100755 --- a/YWD/src/main/java/fyresmodjam/blessings/BlessingUtils.java +++ b/YWD/src/main/java/fyresmodjam/blessings/BlessingUtils.java @@ -12,12 +12,13 @@ import fyresmodjam.blessings.standard.*; import net.minecraft.entity.Entity; import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.common.config.Configuration; public class BlessingUtils { - public final static Map<String, Blessing> playerBlessings; - public final static Map<String, Blessing> mobBlessings; + public static Map<String, Blessing> playerBlessings; + public static Map<String, Blessing> mobBlessings; - static { + public static void loadBlessings(Configuration cfg) { playerBlessings = new HashMap<String, Blessing>(); mobBlessings = new HashMap<String, Blessing>(); @@ -31,14 +32,14 @@ public class BlessingUtils { GuardingMark guardingMark = new GuardingMark(); HuntingMark huntingMark = new HuntingMark(); ScoutingMark scoutingMark = new ScoutingMark(); - VampirismMark vampirismMark = new VampirismMark(); + // VampirismMark vampirismMark = new VampirismMark(); WarMark warMark = new WarMark(); addOmniBlessing("MarkBerserking", berserkingMark); addOmniBlessing("MarkFalseLife", falseLifeMark); addOmniBlessing("MarkGuarding", guardingMark); addOmniBlessing("MarkHunting", huntingMark); - addOmniBlessing("MarkVampirism", vampirismMark); + // addOmniBlessing("MarkVampirism", vampirismMark); addOmniBlessing("MarkWar", warMark); playerBlessings.put("MarkScouting", scoutingMark); @@ -73,22 +74,17 @@ public class BlessingUtils { addOmniBlessing("BlessingVampire", vampireBlessing); addOmniBlessing("BlessingInferno", infernoBlessing); addOmniBlessing("BlessingLoner", lonerBlessing); - addOmniBlessing("BlessingParatrooper", - paratrooperBlessing); + addOmniBlessing("BlessingParatrooper", paratrooperBlessing); addOmniBlessing("BlessingPorcupine", porcupineBlessing); - addOmniBlessing("BlessingThick-Skinned", - thickSkinnedBlessing); + addOmniBlessing("BlessingThick-Skinned", thickSkinnedBlessing); PaladinBlessing paladinBlessing = new PaladinBlessing(); - playerBlessings.put("BlessingAlchemist", - alchemistBlessing); - playerBlessings.put("BlessingBerserker", - berserkerBlessing); + playerBlessings.put("BlessingAlchemist", alchemistBlessing); + playerBlessings.put("BlessingBerserker", berserkerBlessing); playerBlessings.put("BlessingDiver", diverBlessing); playerBlessings.put("BlessingLooter", looterBlessing); - playerBlessings.put("BlessingLumberjack", - lumberjackBlessing); + playerBlessings.put("BlessingLumberjack", lumberjackBlessing); playerBlessings.put("BlessingMechanic", mechanicBlessing); playerBlessings.put("BlessingMiner", minerBlessing); playerBlessings.put("BlessingNinja", ninjaBlessing); @@ -97,20 +93,16 @@ public class BlessingUtils { playerBlessings.put("BlessingThief", thiefBlessing); } - private static void addOmniBlessing(String blessName, - Blessing blessInst) { + private static void addOmniBlessing(String blessName, Blessing blessInst) { playerBlessings.put(blessName, blessInst); mobBlessings.put(blessName, blessInst); } public static boolean hasDisadvantage() { if (CommonTickHandler.worldData != null) { - String currentDisadvantage = CommonTickHandler.worldData - .getDisadvantage(); + String currentDisadvantage = CommonTickHandler.worldData.getDisadvantage(); - return currentDisadvantage != null - && !(currentDisadvantage - .equals("")); + return currentDisadvantage != null && !(currentDisadvantage.equals("")); } return false; @@ -118,9 +110,7 @@ public class BlessingUtils { public static boolean hasDisadvantage(String disadvantage) { if (hasDisadvantage()) { - return CommonTickHandler.worldData - .getDisadvantage() - .equals(disadvantage); + return CommonTickHandler.worldData.getDisadvantage().equals(disadvantage); } return false; @@ -137,14 +127,12 @@ public class BlessingUtils { public static boolean hasBlessing(Entity ent) { NBTTagCompound entityData = ent.getEntityData(); - return entityData.hasKey("Blessing") && !(entityData - .getString("Blessing").equals("")); + return entityData.hasKey("Blessing") && !(entityData.getString("Blessing").equals("")); } public static boolean hasBlessing(Entity ent, String blessing) { if (hasBlessing(ent)) { - return ent.getEntityData().getString("Blessing") - .equals(blessing); + return ent.getEntityData().getString("Blessing").equals(blessing); } return false; @@ -155,23 +143,18 @@ public class BlessingUtils { } public static int getBlessingCounter(Entity ent) { - return Integer.parseInt(EntityStatHelper.getStat(ent, - "BlessingCounter")); + return Integer.parseInt(EntityStatHelper.getStat(ent, "BlessingCounter")); } public static boolean isBlessingActive(Entity ent) { - return ent.getEntityData().hasKey("BlessingActive") - && ent.getEntityData().getBoolean( - "BlessingActive"); + return ent.getEntityData().hasKey("BlessingActive") && ent.getEntityData().getBoolean("BlessingActive"); } public static Blessing getBlessingInstance(String blessing) { if (playerBlessings.containsKey(blessing)) { return playerBlessings.get(blessing); } else { - System.err.printf( - "ERROR: Blessing '%s' not found, using default blessing\n", - blessing); + System.err.printf("ERROR: Blessing '%s' not found, using default blessing\n", blessing); return playerBlessings.get("BlessingGuardian"); } } @@ -188,8 +171,7 @@ public class BlessingUtils { i += 1; } - System.err.println( - "ERROR: Couldn't get blessing for player; using default."); + System.err.println("ERROR: Couldn't get blessing for player; using default."); return "BlessingGuardian"; } @@ -205,8 +187,7 @@ public class BlessingUtils { i += 1; } - System.err.println( - "ERROR: Couldn't get blessing for mob; using default."); + System.err.println("ERROR: Couldn't get blessing for mob; using default."); return "BlessingGuardian"; } diff --git a/YWD/src/main/java/fyresmodjam/blessings/marks/ArcaneNullityMark.java b/YWD/src/main/java/fyresmodjam/blessings/marks/ArcaneNullityMark.java index 594bafd..6cf6db3 100644 --- a/YWD/src/main/java/fyresmodjam/blessings/marks/ArcaneNullityMark.java +++ b/YWD/src/main/java/fyresmodjam/blessings/marks/ArcaneNullityMark.java @@ -18,8 +18,7 @@ public class ArcaneNullityMark extends Mark { } @Override - public float onIncomingDamage(LivingHurtEvent lhev, - float damageMultiplier) { + public float onIncomingDamage(LivingHurtEvent lhev, float damageMultiplier) { if (lhev.source.isMagicDamage()) { lhev.setCanceled(true); } @@ -28,8 +27,7 @@ public class ArcaneNullityMark extends Mark { } @Override - public float onOutgoingDamage(LivingHurtEvent lhev, - float damageMultiplier) { + public float onOutgoingDamage(LivingHurtEvent lhev, float damageMultiplier) { if (lhev.source.isMagicDamage()) { lhev.setCanceled(true); } diff --git a/YWD/src/main/java/fyresmodjam/blessings/marks/BerserkingMark.java b/YWD/src/main/java/fyresmodjam/blessings/marks/BerserkingMark.java index 6ac0ca1..f3b6785 100644 --- a/YWD/src/main/java/fyresmodjam/blessings/marks/BerserkingMark.java +++ b/YWD/src/main/java/fyresmodjam/blessings/marks/BerserkingMark.java @@ -18,14 +18,12 @@ public class BerserkingMark extends Mark { } @Override - public float onOutgoingDamage(LivingHurtEvent event, - float damageMultiplier) { + public float onOutgoingDamage(LivingHurtEvent event, float damageMultiplier) { return damageMultiplier + .5f; } @Override - public float onIncomingDamage(LivingHurtEvent event, - float damageMultiplier) { + public float onIncomingDamage(LivingHurtEvent event, float damageMultiplier) { return damageMultiplier + .5f; } } diff --git a/YWD/src/main/java/fyresmodjam/blessings/marks/FalseLifeMark.java b/YWD/src/main/java/fyresmodjam/blessings/marks/FalseLifeMark.java index 74bda57..c7ac9a0 100644 --- a/YWD/src/main/java/fyresmodjam/blessings/marks/FalseLifeMark.java +++ b/YWD/src/main/java/fyresmodjam/blessings/marks/FalseLifeMark.java @@ -21,35 +21,20 @@ public class FalseLifeMark extends Mark { } @Override - public float onIncomingDamage(LivingHurtEvent event, - float damageMultiplier) { - float totalAmount = Math.max(0.5f, - event.ammount * damageMultiplier); + public float onIncomingDamage(LivingHurtEvent event, float damageMultiplier) { + float totalAmount = Math.max(0.5f, event.ammount * damageMultiplier); if (totalAmount > event.entityLiving.getMaxHealth()) { event.setCanceled(true); - event.entityLiving.getEntityAttribute( - SharedMonsterAttributes.maxHealth) - .setBaseValue(event.entityLiving - .getMaxHealth() - / 0.75f); - - event.entityLiving.setHealth( - event.entityLiving.getMaxHealth()); - - event.entityLiving - .addPotionEffect(new PotionEffect( - Potion.moveSpeed.id, - 30, 1)); - event.entityLiving - .addPotionEffect(new PotionEffect( - Potion.resistance.id, - 20, 1)); - event.entityLiving - .addPotionEffect(new PotionEffect( - Potion.damageBoost.id, - 20, 1)); + event.entityLiving.getEntityAttribute(SharedMonsterAttributes.maxHealth) + .setBaseValue(event.entityLiving.getMaxHealth() / 0.75f); + + event.entityLiving.setHealth(event.entityLiving.getMaxHealth()); + + event.entityLiving.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 30, 1)); + event.entityLiving.addPotionEffect(new PotionEffect(Potion.resistance.id, 20, 1)); + event.entityLiving.addPotionEffect(new PotionEffect(Potion.damageBoost.id, 20, 1)); return 0; } diff --git a/YWD/src/main/java/fyresmodjam/blessings/marks/GuardingMark.java b/YWD/src/main/java/fyresmodjam/blessings/marks/GuardingMark.java index 1914dcc..992c31b 100644 --- a/YWD/src/main/java/fyresmodjam/blessings/marks/GuardingMark.java +++ b/YWD/src/main/java/fyresmodjam/blessings/marks/GuardingMark.java @@ -18,14 +18,12 @@ public class GuardingMark extends Mark { } @Override - public float onOutgoingDamage(LivingHurtEvent event, - float damageMultiplier) { + public float onOutgoingDamage(LivingHurtEvent event, float damageMultiplier) { return damageMultiplier - 1f; } @Override - public float onIncomingDamage(LivingHurtEvent lhev, - float damageMultiplier) { + public float onIncomingDamage(LivingHurtEvent lhev, float damageMultiplier) { return damageMultiplier - 1f; } } diff --git a/YWD/src/main/java/fyresmodjam/blessings/marks/HolyLightMark.java b/YWD/src/main/java/fyresmodjam/blessings/marks/HolyLightMark.java index 4895b79..1298419 100644 --- a/YWD/src/main/java/fyresmodjam/blessings/marks/HolyLightMark.java +++ b/YWD/src/main/java/fyresmodjam/blessings/marks/HolyLightMark.java @@ -18,15 +18,12 @@ public class HolyLightMark extends Mark { } @Override - public float onOutgoingDamage(LivingHurtEvent event, - float damageMultiplier) { + public float onOutgoingDamage(LivingHurtEvent event, float damageMultiplier) { if (event.entityLiving.isEntityUndead()) { return damageMultiplier + .5f; } - float healed = Math.max(0.5f, - (event.ammount * damageMultiplier) - * 0.25f); + float healed = Math.max(0.5f, (event.ammount * damageMultiplier) * 0.25f); event.entityLiving.heal(healed); diff --git a/YWD/src/main/java/fyresmodjam/blessings/marks/HuntingMark.java b/YWD/src/main/java/fyresmodjam/blessings/marks/HuntingMark.java index c3349b8..24a8404 100644 --- a/YWD/src/main/java/fyresmodjam/blessings/marks/HuntingMark.java +++ b/YWD/src/main/java/fyresmodjam/blessings/marks/HuntingMark.java @@ -22,14 +22,12 @@ public class HuntingMark extends Mark { @Override public void correctBlessing(Entity ent) { if (!(ent instanceof IRangedAttackMob)) { - ent.getEntityData().setString("Blessing", - "MarkWar"); + ent.getEntityData().setString("Blessing", "MarkWar"); } } @Override - public float onOutgoingDamage(LivingHurtEvent event, - float damageMultiplier) { + public float onOutgoingDamage(LivingHurtEvent event, float damageMultiplier) { if (event.source.isProjectile()) { return damageMultiplier + 0.4f; } diff --git a/YWD/src/main/java/fyresmodjam/blessings/marks/Mark.java b/YWD/src/main/java/fyresmodjam/blessings/marks/Mark.java index b768dfa..f0f4639 100644 --- a/YWD/src/main/java/fyresmodjam/blessings/marks/Mark.java +++ b/YWD/src/main/java/fyresmodjam/blessings/marks/Mark.java @@ -7,20 +7,20 @@ public abstract class Mark extends Blessing { protected Mark(String name) { this(name, true); } - + protected Mark(String name, boolean mobAppropriate) { super(name, mobAppropriate); } - + public abstract String benefit(); - + public abstract String drawback(); - + @Override public String description() { return String.format("BENEFIT - %s\nDRAWBACK - %s", benefit(), drawback()); } - + @Override public BlessingType type() { return BlessingType.MARK; diff --git a/YWD/src/main/java/fyresmodjam/blessings/marks/RetaliationMark.java b/YWD/src/main/java/fyresmodjam/blessings/marks/RetaliationMark.java index c138d11..527dd30 100644 --- a/YWD/src/main/java/fyresmodjam/blessings/marks/RetaliationMark.java +++ b/YWD/src/main/java/fyresmodjam/blessings/marks/RetaliationMark.java @@ -21,30 +21,25 @@ public class RetaliationMark extends Mark { } @Override - public float onOutgoingDamage(LivingHurtEvent event, - float damageMultiplier) { + public float onOutgoingDamage(LivingHurtEvent event, float damageMultiplier) { doRetaliation(event, damageMultiplier); return damageMultiplier; } @Override - public float onIncomingDamage(LivingHurtEvent event, - float damageMultiplier) { + public float onIncomingDamage(LivingHurtEvent event, float damageMultiplier) { doRetaliation(event, damageMultiplier); return damageMultiplier; } - private void doRetaliation(LivingHurtEvent event, - float damageMultiplier) { + private void doRetaliation(LivingHurtEvent event, float damageMultiplier) { if (!event.source.damageType.equals("retaliation")) { // Don't retaliate for retaliation if (ModjamMod.r.nextDouble() < ConfigData.RETALIATION_CHANCE) { - event.entityLiving.attackEntityFrom( - DamageSources.retaliation, - Math.max(0.5f, event.ammount - * damageMultiplier)); + event.entityLiving.attackEntityFrom(DamageSources.retaliation, + Math.max(0.5f, event.ammount * damageMultiplier)); event.setCanceled(true); } diff --git a/YWD/src/main/java/fyresmodjam/blessings/marks/VampirismMark.java b/YWD/src/main/java/fyresmodjam/blessings/marks/VampirismMark.java index 63d242f..5b4f2a5 100644 --- a/YWD/src/main/java/fyresmodjam/blessings/marks/VampirismMark.java +++ b/YWD/src/main/java/fyresmodjam/blessings/marks/VampirismMark.java @@ -23,13 +23,10 @@ public class VampirismMark extends Mark { } @Override - public float onIncomingDamage(LivingHurtEvent event, - float damageMultiplier) { + public float onIncomingDamage(LivingHurtEvent event, float damageMultiplier) { Entity targetEntity = event.entity; - if (targetEntity.getBrightness(1.0F) > 0.5F - && canSeeTheWorld(targetEntity.worldObj, - targetEntity)) { + if (targetEntity.getBrightness(1.0F) > 0.5F && canSeeTheWorld(targetEntity.worldObj, targetEntity)) { return damageMultiplier + 0.4F; } @@ -37,21 +34,15 @@ public class VampirismMark extends Mark { } @Override - public float onOutgoingDamage(LivingHurtEvent event, - float damageMultiplier) { + public float onOutgoingDamage(LivingHurtEvent event, float damageMultiplier) { Entity sourceEntity = event.source.getEntity(); if (sourceEntity instanceof EntityLivingBase) { - ((EntityLivingBase) sourceEntity).heal( - (event.ammount * damageMultiplier) - * 0.25F); + ((EntityLivingBase) sourceEntity).heal((event.ammount * damageMultiplier) * 0.25F); - boolean seeTheSky = canSeeTheWorld( - sourceEntity.worldObj, - sourceEntity); + boolean seeTheSky = canSeeTheWorld(sourceEntity.worldObj, sourceEntity); - if (sourceEntity.getBrightness(1.0F) > 0.5F - && seeTheSky) { + if (sourceEntity.getBrightness(1.0F) > 0.5F && seeTheSky) { return damageMultiplier - 0.4F; } } @@ -61,15 +52,12 @@ public class VampirismMark extends Mark { @Override public void commonTick(ServerTickEvent stev, EntityPlayer play) { - if (play.getBrightness(1.0f) > 0.5f - && canSeeTheWorld(play.worldObj, play) - && play.ticksExisted % 20 == 0) { + if (play.getBrightness(1.0f) > 0.5f && canSeeTheWorld(play.worldObj, play) && play.ticksExisted % 20 == 0) { play.setFire(5); } } private boolean canSeeTheWorld(World wld, Entity ent) { - return wld.canBlockSeeTheSky((int) (ent.posX), - (int) (ent.posY), (int) (ent.posZ)); + return wld.canBlockSeeTheSky((int) (ent.posX), (int) (ent.posY), (int) (ent.posZ)); } } diff --git a/YWD/src/main/java/fyresmodjam/blessings/marks/WarMark.java b/YWD/src/main/java/fyresmodjam/blessings/marks/WarMark.java index 208a1e4..afa8837 100644 --- a/YWD/src/main/java/fyresmodjam/blessings/marks/WarMark.java +++ b/YWD/src/main/java/fyresmodjam/blessings/marks/WarMark.java @@ -18,11 +18,8 @@ public class WarMark extends Mark { } @Override - public float onOutgoingDamage(LivingHurtEvent event, - float damageMultiplier) { - if ((event.source.getDamageType().equals("player") - || event.source.getDamageType() - .equals("mob"))) { + public float onOutgoingDamage(LivingHurtEvent event, float damageMultiplier) { + if ((event.source.getDamageType().equals("player") || event.source.getDamageType().equals("mob"))) { return damageMultiplier + 0.4f; } diff --git a/YWD/src/main/java/fyresmodjam/blessings/standard/AlchemistBlessing.java b/YWD/src/main/java/fyresmodjam/blessings/standard/AlchemistBlessing.java index aed4e0e..e78fa1b 100644 --- a/YWD/src/main/java/fyresmodjam/blessings/standard/AlchemistBlessing.java +++ b/YWD/src/main/java/fyresmodjam/blessings/standard/AlchemistBlessing.java @@ -6,7 +6,7 @@ public class AlchemistBlessing extends StandardBlessing { public AlchemistBlessing() { super("Alchemist", false); } - + @Override public String name() { return "Alchemist"; diff --git a/YWD/src/main/java/fyresmodjam/blessings/standard/BerserkerBlessing.java b/YWD/src/main/java/fyresmodjam/blessings/standard/BerserkerBlessing.java index fc11ebf..0fa022f 100644 --- a/YWD/src/main/java/fyresmodjam/blessings/standard/BerserkerBlessing.java +++ b/YWD/src/main/java/fyresmodjam/blessings/standard/BerserkerBlessing.java @@ -17,10 +17,8 @@ public class BerserkerBlessing extends StandardBlessing { } @Override - public float onOutgoingDamage(LivingHurtEvent event, - float damageMultiplier) { - if (BlessingUtils.isBlessingActive( - event.source.getEntity())) { + public float onOutgoingDamage(LivingHurtEvent event, float damageMultiplier) { + if (BlessingUtils.isBlessingActive(event.source.getEntity())) { return damageMultiplier + 0.3f; } @@ -29,18 +27,11 @@ public class BerserkerBlessing extends StandardBlessing { @Override public void onMobKill(LivingDeathEvent event) { - if (!EntityStatHelper.hasStat(event.source.getEntity(), - "BlessingCounter")) { - EntityStatHelper.giveStat(event.source.getEntity(), - "BlessingCounter", 0); + if (!EntityStatHelper.hasStat(event.source.getEntity(), "BlessingCounter")) { + EntityStatHelper.giveStat(event.source.getEntity(), "BlessingCounter", 0); } - EntityStatHelper.giveStat(event.source.getEntity(), - "BlessingCounter", - Math.min(10, Integer.parseInt( - EntityStatHelper.getStat( - event.source.getEntity(), - "BlessingCounter")) - + 1)); + EntityStatHelper.giveStat(event.source.getEntity(), "BlessingCounter", Math.min(10, + Integer.parseInt(EntityStatHelper.getStat(event.source.getEntity(), "BlessingCounter")) + 1)); } } diff --git a/YWD/src/main/java/fyresmodjam/blessings/standard/GuardianBlessing.java b/YWD/src/main/java/fyresmodjam/blessings/standard/GuardianBlessing.java index a103221..cf1388c 100644 --- a/YWD/src/main/java/fyresmodjam/blessings/standard/GuardianBlessing.java +++ b/YWD/src/main/java/fyresmodjam/blessings/standard/GuardianBlessing.java @@ -7,7 +7,7 @@ public class GuardianBlessing extends StandardBlessing { public GuardianBlessing() { super("Guardian"); } - + @Override public String name() { return "Guardian"; @@ -19,8 +19,7 @@ public class GuardianBlessing extends StandardBlessing { } @Override - public float onIncomingDamage(LivingHurtEvent lhev, - float damageMultiplier) { + public float onIncomingDamage(LivingHurtEvent lhev, float damageMultiplier) { return damageMultiplier - 0.2f; } } diff --git a/YWD/src/main/java/fyresmodjam/blessings/standard/HunterBlessing.java b/YWD/src/main/java/fyresmodjam/blessings/standard/HunterBlessing.java index 88100e1..baf9d8c 100644 --- a/YWD/src/main/java/fyresmodjam/blessings/standard/HunterBlessing.java +++ b/YWD/src/main/java/fyresmodjam/blessings/standard/HunterBlessing.java @@ -18,14 +18,12 @@ public class HunterBlessing extends StandardBlessing { @Override public void correctBlessing(Entity ent) { if (!(ent instanceof IRangedAttackMob)) { - ent.getEntityData().setString("Blessing", - "BlessingWarrior"); + ent.getEntityData().setString("Blessing", "BlessingWarrior"); } } @Override - public float onOutgoingDamage(LivingHurtEvent event, - float damageMultiplier) { + public float onOutgoingDamage(LivingHurtEvent event, float damageMultiplier) { if (event.source.isProjectile()) { return damageMultiplier + 0.2f; } diff --git a/YWD/src/main/java/fyresmodjam/blessings/standard/InfernoBlessing.java b/YWD/src/main/java/fyresmodjam/blessings/standard/InfernoBlessing.java index c3d3b3f..942673f 100644 --- a/YWD/src/main/java/fyresmodjam/blessings/standard/InfernoBlessing.java +++ b/YWD/src/main/java/fyresmodjam/blessings/standard/InfernoBlessing.java @@ -21,7 +21,10 @@ public class InfernoBlessing extends StandardBlessing { @Override public String description() { - return "Benefit: Take no fire damage, and do increased damage while on fire\nDrawback: Take damge while wet"; + return "Benefit: Take no fire damage"; + + // return "Benefit: Take no fire damage, and do increased damage while on + // fire\nDrawback: Take damge while wet"; } @Override @@ -32,15 +35,9 @@ public class InfernoBlessing extends StandardBlessing { } @Override - public float onIncomingDamage(LivingHurtEvent event, - float damageMultiplier) { - if (event.source.isFireDamage() - || event.source.getDamageType() - .equals("inFire") - || event.source.getDamageType() - .equals("onFire") - || event.source.getDamageType() - .equals("lava")) { + public float onIncomingDamage(LivingHurtEvent event, float damageMultiplier) { + if (event.source.isFireDamage() || event.source.getDamageType().equals("inFire") + || event.source.getDamageType().equals("onFire") || event.source.getDamageType().equals("lava")) { event.setCanceled(true); return 0; @@ -50,10 +47,9 @@ public class InfernoBlessing extends StandardBlessing { } @Override - public float onOutgoingDamage(LivingHurtEvent event, - float damageMultiplier) { + public float onOutgoingDamage(LivingHurtEvent event, float damageMultiplier) { if (event.source.getEntity().isBurning()) { - return damageMultiplier + 0.35f; + // return damageMultiplier + 0.35f; } return damageMultiplier; diff --git a/YWD/src/main/java/fyresmodjam/blessings/standard/LonerBlessing.java b/YWD/src/main/java/fyresmodjam/blessings/standard/LonerBlessing.java index fa44795..3bae3dc 100644 --- a/YWD/src/main/java/fyresmodjam/blessings/standard/LonerBlessing.java +++ b/YWD/src/main/java/fyresmodjam/blessings/standard/LonerBlessing.java @@ -15,14 +15,10 @@ public class LonerBlessing extends StandardBlessing { } @Override - public float onOutgoingDamage(LivingHurtEvent event, - float damageMultiplier) { + public float onOutgoingDamage(LivingHurtEvent event, float damageMultiplier) { if (event.source.getEntity() instanceof EntityLivingBase) { - float scaleFactor = 1.0F - - (((EntityLivingBase) event.source - .getEntity()).getHealth() - / ((EntityLivingBase) event.source - .getEntity()).getMaxHealth()); + float scaleFactor = 1.0F - (((EntityLivingBase) event.source.getEntity()).getHealth() + / ((EntityLivingBase) event.source.getEntity()).getMaxHealth()); return damageMultiplier + 0.35F * scaleFactor; } diff --git a/YWD/src/main/java/fyresmodjam/blessings/standard/LooterBlessing.java b/YWD/src/main/java/fyresmodjam/blessings/standard/LooterBlessing.java index 80fed2b..cb1cb38 100644 --- a/YWD/src/main/java/fyresmodjam/blessings/standard/LooterBlessing.java +++ b/YWD/src/main/java/fyresmodjam/blessings/standard/LooterBlessing.java @@ -9,7 +9,7 @@ public class LooterBlessing extends StandardBlessing { public LooterBlessing() { super("Looter", false); } - + @Override public String description() { return "Enemies have a chance to drop dungeon loot"; @@ -19,10 +19,7 @@ public class LooterBlessing extends StandardBlessing { public void onMobKill(LivingDeathEvent event) { if (ModjamMod.r.nextInt(50) == 0) { if (!event.entity.worldObj.isRemote) { - event.entity.dropItem(ChestGenHooks - .getOneItem(ChestGenHooks.DUNGEON_CHEST, - ModjamMod.r) - .getItem(), 1); + event.entity.dropItem(ChestGenHooks.getOneItem(ChestGenHooks.DUNGEON_CHEST, ModjamMod.r).getItem(), 1); } } } diff --git a/YWD/src/main/java/fyresmodjam/blessings/standard/LumberjackBlessing.java b/YWD/src/main/java/fyresmodjam/blessings/standard/LumberjackBlessing.java index e4136dc..c180671 100644 --- a/YWD/src/main/java/fyresmodjam/blessings/standard/LumberjackBlessing.java +++ b/YWD/src/main/java/fyresmodjam/blessings/standard/LumberjackBlessing.java @@ -26,13 +26,11 @@ public class LumberjackBlessing extends StandardBlessing { } @Override - public float onOutgoingDamage(LivingHurtEvent event, - float damageMultiplier) { + public float onOutgoingDamage(LivingHurtEvent event, float damageMultiplier) { ItemStack held = null; if (event.source.getEntity() instanceof EntityLivingBase) { - held = ((EntityLivingBase) event.source - .getEntity()).getHeldItem(); + held = ((EntityLivingBase) event.source.getEntity()).getHeldItem(); } if (held != null && itemIsAxe(held)) { @@ -44,9 +42,7 @@ public class LumberjackBlessing extends StandardBlessing { private boolean itemIsAxe(ItemStack held) { if (held.getItem() instanceof ItemTool) { - return ((ItemTool) held.getItem()) - .getToolClasses(held) - .contains("axe"); + return ((ItemTool) held.getItem()).getToolClasses(held).contains("axe"); } return false; diff --git a/YWD/src/main/java/fyresmodjam/blessings/standard/MechanicBlessing.java b/YWD/src/main/java/fyresmodjam/blessings/standard/MechanicBlessing.java index e992d17..c1e8138 100644 --- a/YWD/src/main/java/fyresmodjam/blessings/standard/MechanicBlessing.java +++ b/YWD/src/main/java/fyresmodjam/blessings/standard/MechanicBlessing.java @@ -6,7 +6,7 @@ public class MechanicBlessing extends StandardBlessing { public MechanicBlessing() { super("Mechanic", false); } - + @Override public String name() { return "Mechanic"; diff --git a/YWD/src/main/java/fyresmodjam/blessings/standard/MinerBlessing.java b/YWD/src/main/java/fyresmodjam/blessings/standard/MinerBlessing.java index a73d019..5eb9d36 100644 --- a/YWD/src/main/java/fyresmodjam/blessings/standard/MinerBlessing.java +++ b/YWD/src/main/java/fyresmodjam/blessings/standard/MinerBlessing.java @@ -20,20 +20,17 @@ public class MinerBlessing extends StandardBlessing { @Override public void checkBreakSpeed(BreakSpeed pebsev) { - if (pebsev.block.getMaterial() == Material.rock - || pebsev.block.getMaterial() == Material.iron) { + if (pebsev.block.getMaterial() == Material.rock || pebsev.block.getMaterial() == Material.iron) { pebsev.newSpeed = pebsev.originalSpeed * 1.25F; } } @Override - public float onOutgoingDamage(LivingHurtEvent event, - float damageMultiplier) { + public float onOutgoingDamage(LivingHurtEvent event, float damageMultiplier) { ItemStack held = null; if (event.source.getEntity() instanceof EntityLivingBase) { - held = ((EntityLivingBase) event.source - .getEntity()).getHeldItem(); + held = ((EntityLivingBase) event.source.getEntity()).getHeldItem(); } if (held != null && itemIsPickaxe(held)) { @@ -45,9 +42,7 @@ public class MinerBlessing extends StandardBlessing { private boolean itemIsPickaxe(ItemStack held) { if (held.getItem() instanceof ItemTool) { - return ((ItemTool) held.getItem()) - .getToolClasses(held) - .contains("pickaxe"); + return ((ItemTool) held.getItem()).getToolClasses(held).contains("pickaxe"); } return false; diff --git a/YWD/src/main/java/fyresmodjam/blessings/standard/NinjaBlessing.java b/YWD/src/main/java/fyresmodjam/blessings/standard/NinjaBlessing.java index 1d61065..b4f66e6 100644 --- a/YWD/src/main/java/fyresmodjam/blessings/standard/NinjaBlessing.java +++ b/YWD/src/main/java/fyresmodjam/blessings/standard/NinjaBlessing.java @@ -11,7 +11,7 @@ public class NinjaBlessing extends StandardBlessing { public NinjaBlessing() { super("Ninja", false); } - + @Override public String description() { return "- Go invisible while sneaking\n- Attacks on enemies with full health deal 2x damage"; @@ -20,27 +20,18 @@ public class NinjaBlessing extends StandardBlessing { @Override public void commonTick(ServerTickEvent stev, EntityPlayer player) { if (player.isSneaking()) { - PotionEffect e = player.getActivePotionEffect( - Potion.invisibility); + PotionEffect e = player.getActivePotionEffect(Potion.invisibility); - if (e == null || player.getActivePotionEffect( - Potion.invisibility) - .getDuration() < 10) { - player.addPotionEffect(new PotionEffect( - Potion.invisibility.id, 10, - 1, false)); + if (e == null || player.getActivePotionEffect(Potion.invisibility).getDuration() < 10) { + player.addPotionEffect(new PotionEffect(Potion.invisibility.id, 10, 1, false)); } } } @Override - public float onOutgoingDamage(LivingHurtEvent event, - float damageMultiplier) { - if (event.entityLiving != null - && event.source.getEntity().isSneaking() - && event.entityLiving - .getHealth() == event.entityLiving - .getMaxHealth()) { + public float onOutgoingDamage(LivingHurtEvent event, float damageMultiplier) { + if (event.entityLiving != null && event.source.getEntity().isSneaking() + && event.entityLiving.getHealth() == event.entityLiving.getMaxHealth()) { return damageMultiplier + 1.0F; } diff --git a/YWD/src/main/java/fyresmodjam/blessings/standard/PaladinBlessing.java b/YWD/src/main/java/fyresmodjam/blessings/standard/PaladinBlessing.java index b5be58b..0b8a3ab 100644 --- a/YWD/src/main/java/fyresmodjam/blessings/standard/PaladinBlessing.java +++ b/YWD/src/main/java/fyresmodjam/blessings/standard/PaladinBlessing.java @@ -14,8 +14,7 @@ public class PaladinBlessing extends StandardBlessing { } @Override - public float onOutgoingDamage(LivingHurtEvent event, - float damageMultiplier) { + public float onOutgoingDamage(LivingHurtEvent event, float damageMultiplier) { if (event.entityLiving.isEntityUndead()) { return damageMultiplier + .2f; } diff --git a/YWD/src/main/java/fyresmodjam/blessings/standard/ParatrooperBlessing.java b/YWD/src/main/java/fyresmodjam/blessings/standard/ParatrooperBlessing.java index ec02d76..3010873 100644 --- a/YWD/src/main/java/fyresmodjam/blessings/standard/ParatrooperBlessing.java +++ b/YWD/src/main/java/fyresmodjam/blessings/standard/ParatrooperBlessing.java @@ -7,21 +7,20 @@ public class ParatrooperBlessing extends StandardBlessing { public ParatrooperBlessing() { super("Paratrooper"); } - + @Override public String description() { return "Take no fall damage"; } @Override - public float onIncomingDamage(LivingHurtEvent event, - float damageMultiplier) { - if(event.source.damageType.equals("fall")) { + public float onIncomingDamage(LivingHurtEvent event, float damageMultiplier) { + if (event.source.damageType.equals("fall")) { event.setCanceled(true); - + return 0; } - + return damageMultiplier; } } diff --git a/YWD/src/main/java/fyresmodjam/blessings/standard/PorcupineBlessing.java b/YWD/src/main/java/fyresmodjam/blessings/standard/PorcupineBlessing.java index 73f5dc2..7763bac 100644 --- a/YWD/src/main/java/fyresmodjam/blessings/standard/PorcupineBlessing.java +++ b/YWD/src/main/java/fyresmodjam/blessings/standard/PorcupineBlessing.java @@ -18,24 +18,17 @@ public class PorcupineBlessing extends StandardBlessing { } @Override - public float onIncomingDamage(LivingHurtEvent event, - float damageMultiplier) { + public float onIncomingDamage(LivingHurtEvent event, float damageMultiplier) { DamageSource damageSource = event.source; Entity source = damageSource.getEntity(); - if (source != null && source instanceof EntityLivingBase - && !damageSource.isProjectile() - && (damageSource.getDamageType() - .equals("mob") - || damageSource.getDamageType() - .equals("player"))) { + if (source != null && source instanceof EntityLivingBase && !damageSource.isProjectile() + && (damageSource.getDamageType().equals("mob") || damageSource.getDamageType().equals("player"))) { - DamageSource damage = DamageSource - .causeThornsDamage(source); + DamageSource damage = DamageSource.causeThornsDamage(source); - ((EntityLivingBase) source).attackEntityFrom( - damage, event.ammount * 0.07F); + ((EntityLivingBase) source).attackEntityFrom(damage, event.ammount * 0.07F); } return damageMultiplier; diff --git a/YWD/src/main/java/fyresmodjam/blessings/standard/ScholarBlessing.java b/YWD/src/main/java/fyresmodjam/blessings/standard/ScholarBlessing.java index f4cbe65..d89d232 100644 --- a/YWD/src/main/java/fyresmodjam/blessings/standard/ScholarBlessing.java +++ b/YWD/src/main/java/fyresmodjam/blessings/standard/ScholarBlessing.java @@ -14,14 +14,12 @@ public class ScholarBlessing extends StandardBlessing { } @Override - public float adjustMobKnowledgeBonus(LivingHurtEvent lhev, - float pickedDamageBonus) { + public float adjustMobKnowledgeBonus(LivingHurtEvent lhev, float pickedDamageBonus) { return pickedDamageBonus + (pickedDamageBonus * 0.5f); } - + @Override - public float adjustWeaponKnowledgeBonus(LivingHurtEvent lhev, - float pickedDamageBonus) { + public float adjustWeaponKnowledgeBonus(LivingHurtEvent lhev, float pickedDamageBonus) { return pickedDamageBonus + (pickedDamageBonus * 0.5f); } } diff --git a/YWD/src/main/java/fyresmodjam/blessings/standard/SwampBlessing.java b/YWD/src/main/java/fyresmodjam/blessings/standard/SwampBlessing.java index 21c3fc8..24c9f35 100644 --- a/YWD/src/main/java/fyresmodjam/blessings/standard/SwampBlessing.java +++ b/YWD/src/main/java/fyresmodjam/blessings/standard/SwampBlessing.java @@ -16,15 +16,11 @@ public class SwampBlessing extends StandardBlessing { } @Override - public float onOutgoingDamage(LivingHurtEvent event, - float damageMultiplier) { + public float onOutgoingDamage(LivingHurtEvent event, float damageMultiplier) { if (event.entityLiving != null) { - event.entityLiving - .addPotionEffect(new PotionEffect( - Potion.moveSlowdown.id, - 100, 1, false)); + event.entityLiving.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 100, 1, false)); } - + return damageMultiplier; } } diff --git a/YWD/src/main/java/fyresmodjam/blessings/standard/ThickSkinnedBlessing.java b/YWD/src/main/java/fyresmodjam/blessings/standard/ThickSkinnedBlessing.java index 9504eb0..978d962 100644 --- a/YWD/src/main/java/fyresmodjam/blessings/standard/ThickSkinnedBlessing.java +++ b/YWD/src/main/java/fyresmodjam/blessings/standard/ThickSkinnedBlessing.java @@ -7,7 +7,7 @@ public class ThickSkinnedBlessing extends StandardBlessing { public ThickSkinnedBlessing() { super("Thick-Skinned"); } - + @Override public String description() { return "Reduce damage taken by a flat amount"; @@ -16,7 +16,7 @@ public class ThickSkinnedBlessing extends StandardBlessing { @Override public float onIncomingDamage(LivingHurtEvent lhev, float damageMultiplier) { lhev.ammount = Math.max(0.5f, lhev.ammount - 1f); - + return damageMultiplier; } } diff --git a/YWD/src/main/java/fyresmodjam/blessings/standard/ThiefBlessing.java b/YWD/src/main/java/fyresmodjam/blessings/standard/ThiefBlessing.java index 267054f..b83472a 100644 --- a/YWD/src/main/java/fyresmodjam/blessings/standard/ThiefBlessing.java +++ b/YWD/src/main/java/fyresmodjam/blessings/standard/ThiefBlessing.java @@ -16,10 +16,9 @@ public class ThiefBlessing extends StandardBlessing { @Override public void onMobKill(LivingDeathEvent event) { - if(ModjamMod.r.nextInt(20) == 0) { + if (ModjamMod.r.nextInt(20) == 0) { if (!event.entity.worldObj.isRemote) { - event.entity.dropItem(Items.gold_nugget, - 1); + event.entity.dropItem(Items.gold_nugget, 1); } } } diff --git a/YWD/src/main/java/fyresmodjam/blessings/standard/VampireBlessing.java b/YWD/src/main/java/fyresmodjam/blessings/standard/VampireBlessing.java index 914f9c6..25515ee 100644 --- a/YWD/src/main/java/fyresmodjam/blessings/standard/VampireBlessing.java +++ b/YWD/src/main/java/fyresmodjam/blessings/standard/VampireBlessing.java @@ -14,12 +14,9 @@ public class VampireBlessing extends StandardBlessing { } @Override - public float onOutgoingDamage(LivingHurtEvent event, - float damageMultiplier) { + public float onOutgoingDamage(LivingHurtEvent event, float damageMultiplier) { if (event.source.getEntity() instanceof EntityLivingBase) { - ((EntityLivingBase) event.source.getEntity()).heal( - (event.ammount * damageMultiplier) - * 0.07F); + ((EntityLivingBase) event.source.getEntity()).heal((event.ammount * damageMultiplier) * 0.07F); } return damageMultiplier; diff --git a/YWD/src/main/java/fyresmodjam/blessings/standard/WarriorBlessing.java b/YWD/src/main/java/fyresmodjam/blessings/standard/WarriorBlessing.java index 83fed42..e264531 100644 --- a/YWD/src/main/java/fyresmodjam/blessings/standard/WarriorBlessing.java +++ b/YWD/src/main/java/fyresmodjam/blessings/standard/WarriorBlessing.java @@ -17,17 +17,13 @@ public class WarriorBlessing extends StandardBlessing { @Override public void correctBlessing(Entity ent) { if (ent instanceof IRangedAttackMob) { - ent.getEntityData().setString("Blessing", - "BlessingHunter"); + ent.getEntityData().setString("Blessing", "BlessingHunter"); } } @Override - public float onOutgoingDamage(LivingHurtEvent event, - float damageMultiplier) { - if ((event.source.getDamageType().equals("player") - || event.source.getDamageType() - .equals("mob"))) { + public float onOutgoingDamage(LivingHurtEvent event, float damageMultiplier) { + if ((event.source.getDamageType().equals("player") || event.source.getDamageType().equals("mob"))) { return damageMultiplier + 0.2f; } diff --git a/YWD/src/main/java/fyresmodjam/blocks/BlockCrystal.java b/YWD/src/main/java/fyresmodjam/blocks/BlockCrystal.java index 24d76d2..a62827b 100755 --- a/YWD/src/main/java/fyresmodjam/blocks/BlockCrystal.java +++ b/YWD/src/main/java/fyresmodjam/blocks/BlockCrystal.java @@ -51,14 +51,12 @@ public class BlockCrystal extends BlockContainer { @Override
@SideOnly(Side.CLIENT)
- public boolean shouldSideBeRendered(IBlockAccess blockAccess,
- int i, int i2, int i3, int i4) {
+ public boolean shouldSideBeRendered(IBlockAccess blockAccess, int i, int i2, int i3, int i4) {
return false;
}
@Override
- public ItemStack getPickBlock(MovingObjectPosition object,
- World par1World, int par2, int par3, int par4) {
+ public ItemStack getPickBlock(MovingObjectPosition object, World par1World, int par2, int par3, int par4) {
return new ItemStack(ModjamMod.crystalItem);
}
@@ -68,11 +66,9 @@ public class BlockCrystal extends BlockContainer { }
@Override
- public void onBlockPlacedBy(World par1World, int par2, int par3,
- int par4, EntityLivingBase par5EntityLivingBase,
+ public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase,
ItemStack par6ItemStack) {
- par1World.setBlockMetadataWithNotify(par2, par3, par4,
- par6ItemStack.getItemDamage(), 0);
+ par1World.setBlockMetadataWithNotify(par2, par3, par4, par6ItemStack.getItemDamage(), 0);
}
@Override
diff --git a/YWD/src/main/java/fyresmodjam/blocks/BlockCrystalStand.java b/YWD/src/main/java/fyresmodjam/blocks/BlockCrystalStand.java index 9855dd4..67bcc4b 100755 --- a/YWD/src/main/java/fyresmodjam/blocks/BlockCrystalStand.java +++ b/YWD/src/main/java/fyresmodjam/blocks/BlockCrystalStand.java @@ -39,8 +39,7 @@ public class BlockCrystalStand extends BlockContainer { @Override
@SideOnly(Side.CLIENT)
- public boolean shouldSideBeRendered(IBlockAccess blockAccess,
- int i, int i2, int i3, int i4) {
+ public boolean shouldSideBeRendered(IBlockAccess blockAccess, int i, int i2, int i3, int i4) {
return false;
}
}
diff --git a/YWD/src/main/java/fyresmodjam/blocks/BlockMysteryMushroom.java b/YWD/src/main/java/fyresmodjam/blocks/BlockMysteryMushroom.java index e738c94..c2baf95 100755 --- a/YWD/src/main/java/fyresmodjam/blocks/BlockMysteryMushroom.java +++ b/YWD/src/main/java/fyresmodjam/blocks/BlockMysteryMushroom.java @@ -21,14 +21,13 @@ import net.minecraftforge.common.util.ForgeDirection; public class BlockMysteryMushroom extends BlockFlower {
- public IIcon icon;
- public IIcon overlay;
+ public IIcon icon;
+ public IIcon overlay;
public BlockMysteryMushroom() {
super(0);
float f = 0.2F;
- setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f,
- f * 2.0F, 0.5F + f);
+ setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f * 2.0F, 0.5F + f);
setTickRandomly(true);
setCreativeTab(null);
}
@@ -36,10 +35,8 @@ public class BlockMysteryMushroom extends BlockFlower { @Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister par1IconRegister) {
- icon = par1IconRegister
- .registerIcon("fyresmodjam:mushroomBlock");
- overlay = par1IconRegister.registerIcon(
- "fyresmodjam:mushroomBlock_overlay");
+ icon = par1IconRegister.registerIcon("fyresmodjam:mushroomBlock");
+ overlay = par1IconRegister.registerIcon("fyresmodjam:mushroomBlock_overlay");
blockIcon = icon;
}
@@ -50,8 +47,7 @@ public class BlockMysteryMushroom extends BlockFlower { }
@Override
- public void updateTick(World par1World, int par2, int par3,
- int par4, Random par5Random) {
+ public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) {
if (par5Random.nextInt(25) == 0) {
byte b0 = 4;
int l = 5;
@@ -60,13 +56,9 @@ public class BlockMysteryMushroom extends BlockFlower { int k1;
for (i1 = par2 - b0; i1 <= par2 + b0; ++i1) {
- for (j1 = par4 - b0; j1 <= par4
- + b0; ++j1) {
- for (k1 = par3 - 1; k1 <= par3
- + 1; ++k1) {
- if (par1World.getBlock(i1,
- k1,
- j1) == this) {
+ for (j1 = par4 - b0; j1 <= par4 + b0; ++j1) {
+ for (k1 = par3 - 1; k1 <= par3 + 1; ++k1) {
+ if (par1World.getBlock(i1, k1, j1) == this) {
--l;
if (l <= 0) {
@@ -78,55 +70,37 @@ public class BlockMysteryMushroom extends BlockFlower { }
i1 = par2 + par5Random.nextInt(3) - 1;
- j1 = par3 + par5Random.nextInt(2)
- - par5Random.nextInt(2);
+ j1 = par3 + par5Random.nextInt(2) - par5Random.nextInt(2);
k1 = par4 + par5Random.nextInt(3) - 1;
for (int l1 = 0; l1 < 4; ++l1) {
- if (par1World.isAirBlock(i1, j1, k1)
- && canBlockStay(par1World,
- i1, j1,
- k1)) {
+ if (par1World.isAirBlock(i1, j1, k1) && canBlockStay(par1World, i1, j1, k1)) {
par2 = i1;
par3 = j1;
par4 = k1;
}
i1 = par2 + par5Random.nextInt(3) - 1;
- j1 = par3 + par5Random.nextInt(2)
- - par5Random.nextInt(2);
+ j1 = par3 + par5Random.nextInt(2) - par5Random.nextInt(2);
k1 = par4 + par5Random.nextInt(3) - 1;
}
- if (par1World.isAirBlock(i1, j1, k1)
- && canBlockStay(par1World, i1, j1,
- k1)) {
- par1World.setBlock(i1, j1, k1, this,
- par1World.getBlockMetadata(
- par2, par3,
- par4),
- 2);
+ if (par1World.isAirBlock(i1, j1, k1) && canBlockStay(par1World, i1, j1, k1)) {
+ par1World.setBlock(i1, j1, k1, this, par1World.getBlockMetadata(par2, par3, par4), 2);
}
}
}
@Override
- public boolean canPlaceBlockAt(World par1World, int par2, int par3,
- int par4) {
- return super.canPlaceBlockAt(par1World, par2, par3, par4)
- && canBlockStay(par1World, par2, par3,
- par4);
+ public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) {
+ return super.canPlaceBlockAt(par1World, par2, par3, par4) && canBlockStay(par1World, par2, par3, par4);
}
@Override
- public boolean canBlockStay(World par1World, int par2, int par3,
- int par4) {
+ public boolean canBlockStay(World par1World, int par2, int par3, int par4) {
if (par3 >= 0 && par3 < 256) {
- Block soil = par1World.getBlock(par2, par3 - 1,
- par4);
- return (soil != null && soil.canSustainPlant(
- par1World, par2, par3 - 1, par4,
- ForgeDirection.UP, this));
+ Block soil = par1World.getBlock(par2, par3 - 1, par4);
+ return (soil != null && soil.canSustainPlant(par1World, par2, par3 - 1, par4, ForgeDirection.UP, this));
} else {
return false;
}
@@ -134,8 +108,7 @@ public class BlockMysteryMushroom extends BlockFlower { @Override
@SideOnly(Side.CLIENT)
- public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs,
- List par3List) {
+ public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) {
for (int i = 0; i < 13; i++) {
par3List.add(new ItemStack(par1, 1, i));
}
@@ -148,11 +121,8 @@ public class BlockMysteryMushroom extends BlockFlower { @Override
@SideOnly(Side.CLIENT)
- public int colorMultiplier(IBlockAccess par1IBlockAccess, int par2,
- int par3, int par4) {
- return NewPacketHandler.mushroomColors[par1IBlockAccess
- .getBlockMetadata(par2, par3,
- par4)][renderPass];
+ public int colorMultiplier(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) {
+ return NewPacketHandler.mushroomColors[par1IBlockAccess.getBlockMetadata(par2, par3, par4)][renderPass];
}
public static int renderPass;
@@ -164,14 +134,12 @@ public class BlockMysteryMushroom extends BlockFlower { }
@Override
- public ItemStack getPickBlock(MovingObjectPosition object,
- World par1World, int par2, int par3, int par4) {
+ public ItemStack getPickBlock(MovingObjectPosition object, World par1World, int par2, int par3, int par4) {
return new ItemStack(ModjamMod.mysteryMushroom);
}
@Override
- public Item getItemDropped(int p_149650_1_, Random p_149650_2_,
- int p_149650_3_) {
+ public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) {
return ModjamMod.mysteryMushroom;
}
diff --git a/YWD/src/main/java/fyresmodjam/blocks/BlockPillar.java b/YWD/src/main/java/fyresmodjam/blocks/BlockPillar.java index a80d099..07eebbe 100755 --- a/YWD/src/main/java/fyresmodjam/blocks/BlockPillar.java +++ b/YWD/src/main/java/fyresmodjam/blocks/BlockPillar.java @@ -35,8 +35,7 @@ public class BlockPillar extends BlockContainer { @Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister par1IconRegister) {
- blockIcon = par1IconRegister
- .registerIcon("fyresmodjam:pillar");
+ blockIcon = par1IconRegister.registerIcon("fyresmodjam:pillar");
}
public int idDropped(int par1, Random par2Random, int par3) {
@@ -44,24 +43,19 @@ public class BlockPillar extends BlockContainer { }
@Override
- public int getDamageValue(World par1World, int par2, int par3,
- int par4) {
+ public int getDamageValue(World par1World, int par2, int par3, int par4) {
int damage = 0;
if (ConfigData.showAllPillarsInCreative) {
- int meta = par1World.getBlockMetadata(par2, par3,
- par4);
- TileEntity te = par1World.getTileEntity(par2,
- par3 - (meta == 1 ? 1 : 0), par4);
+ int meta = par1World.getBlockMetadata(par2, par3, par4);
+ TileEntity te = par1World.getTileEntity(par2, par3 - (meta == 1 ? 1 : 0), par4);
if (te != null && te instanceof TileEntityPillar) {
TileEntityPillar pte = (TileEntityPillar) te;
int i = 0;
- for (String blessingName : BlessingUtils.playerBlessings
- .keySet()) {
- if (pte.blessing.equals(
- blessingName)) {
+ for (String blessingName : BlessingUtils.playerBlessings.keySet()) {
+ if (pte.blessing.equals(blessingName)) {
damage = i + 1;
break;
}
@@ -75,65 +69,45 @@ public class BlockPillar extends BlockContainer { }
@Override
- public ItemStack getPickBlock(MovingObjectPosition object,
- World par1World, int par2, int par3, int par4) {
+ public ItemStack getPickBlock(MovingObjectPosition object, World par1World, int par2, int par3, int par4) {
return new ItemStack(ModjamMod.itemPillar);
}
@Override
- public boolean canHarvestBlock(EntityPlayer par1EntityPlayer,
- int par2) {
+ public boolean canHarvestBlock(EntityPlayer par1EntityPlayer, int par2) {
return false;
}
@Override
- public boolean onBlockActivated(World par1World, int par2,
- int par3, int par4, EntityPlayer par5EntityPlayer,
+ public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer,
int par6, float par7, float par8, float par9) {
- if (par1World.getBlockMetadata(par2, par3, par4)
- % 2 == 1) {
+ if (par1World.getBlockMetadata(par2, par3, par4) % 2 == 1) {
par3--;
}
TileEntity te = par1World.getTileEntity(par2, par3, par4);
- if (par5EntityPlayer.getHeldItem() == null
- || par5EntityPlayer.getHeldItem()
- .getItem() == null
- || par5EntityPlayer.getHeldItem()
- .getItemDamage() != 1
- || par5EntityPlayer.getHeldItem()
- .getItem() != ModjamMod.sceptre) {
- if (te != null && te instanceof TileEntityPillar
- && (!BlessingUtils.hasBlessing(
- par5EntityPlayer)
- || !BlessingUtils
- .hasBlessing(par5EntityPlayer,
- ((TileEntityPillar) te).blessing))) {
+ if (par5EntityPlayer.getHeldItem() == null || par5EntityPlayer.getHeldItem().getItem() == null
+ || par5EntityPlayer.getHeldItem().getItemDamage() != 1
+ || par5EntityPlayer.getHeldItem().getItem() != ModjamMod.sceptre) {
+ if (te != null && te instanceof TileEntityPillar && (!BlessingUtils.hasBlessing(par5EntityPlayer)
+ || !BlessingUtils.hasBlessing(par5EntityPlayer, ((TileEntityPillar) te).blessing))) {
boolean skip = false;
- for (int i = 0; i < par1World.loadedEntityList
- .size(); i++) {
- Entity e = (Entity) par1World.loadedEntityList
- .get(i);
+ for (int i = 0; i < par1World.loadedEntityList.size(); i++) {
+ Entity e = (Entity) par1World.loadedEntityList.get(i);
if (e instanceof EntityMob) {
- double xDiff = par2
- - e.posX;
- double yDiff = par3
- - e.posY;
- double zDiff = par4
- - e.posZ;
+ double xDiff = par2 - e.posX;
+ double yDiff = par3 - e.posY;
+ double zDiff = par4 - e.posZ;
if (Math.abs(yDiff) > 4) {
continue;
}
- double dist = Math.sqrt(
- xDiff * xDiff + yDiff
- * yDiff
- + zDiff * zDiff);
+ double dist = Math.sqrt(xDiff * xDiff + yDiff * yDiff + zDiff * zDiff);
if (dist <= 14) {
skip = true;
@@ -143,42 +117,21 @@ public class BlockPillar extends BlockContainer { if (!skip) {
if (((TileEntityPillar) te).blessing != null) {
- EntityStatHelper.giveStat(
- par5EntityPlayer,
- "Blessing",
- ((TileEntityPillar) te).blessing);
- EntityStatHelper.giveStat(
- par5EntityPlayer,
- "BlessingActive",
- false);
- EntityStatHelper.giveStat(
- par5EntityPlayer,
- "BlessingCounter",
- 0);
- EntityStatHelper.giveStat(
- par5EntityPlayer,
- "BlessingCooldown",
- 0);
+ EntityStatHelper.giveStat(par5EntityPlayer, "Blessing", ((TileEntityPillar) te).blessing);
+ EntityStatHelper.giveStat(par5EntityPlayer, "BlessingActive", false);
+ EntityStatHelper.giveStat(par5EntityPlayer, "BlessingCounter", 0);
+ EntityStatHelper.giveStat(par5EntityPlayer, "BlessingCooldown", 0);
if (!par1World.isRemote) {
- par1World.playSoundAtEntity(
- par5EntityPlayer,
- "fyresmodjam:pillarActivated",
- 1.0F,
- 1.0F);
- NewPacketHandler.SEND_MESSAGE
- .sendToPlayer(par5EntityPlayer,
- "Activated "
- + BlessingUtils.getBlessingInstance(
- ((TileEntityPillar) te).blessing)
- .customName()
- + ".");
+ par1World.playSoundAtEntity(par5EntityPlayer, "fyresmodjam:pillarActivated", 1.0F, 1.0F);
+ NewPacketHandler.SEND_MESSAGE.sendToPlayer(par5EntityPlayer, "Activated "
+ + BlessingUtils.getBlessingInstance(((TileEntityPillar) te).blessing).customName()
+ + ".");
}
}
} else if (!par1World.isRemote) {
- NewPacketHandler.SEND_MESSAGE
- .sendToPlayer(par5EntityPlayer,
- "\u00A7cCannot activate pillar with monsters nearby!");
+ NewPacketHandler.SEND_MESSAGE.sendToPlayer(par5EntityPlayer,
+ "\u00A7cCannot activate pillar with monsters nearby!");
}
}
} else if (!par1World.isRemote) {
@@ -188,10 +141,8 @@ public class BlockPillar extends BlockContainer { TileEntityPillar pte = (TileEntityPillar) te;
int i = 0;
- for (String blessingName : BlessingUtils.playerBlessings
- .keySet()) {
- if (pte.blessing.equals(
- blessingName)) {
+ for (String blessingName : BlessingUtils.playerBlessings.keySet()) {
+ if (pte.blessing.equals(blessingName)) {
damage = i + 1;
break;
}
@@ -203,15 +154,11 @@ public class BlockPillar extends BlockContainer { if (!par5EntityPlayer.capabilities.isCreativeMode) {
par5EntityPlayer.getHeldItem().stackSize--;
}
- par1World.spawnEntityInWorld(new EntityItem(
- par1World, par2 + 0.5F,
- par3 + 0.5F, par4 + 0.5F,
- new ItemStack(ModjamMod.itemPillar,
- 1, damage)));
+ par1World.spawnEntityInWorld(new EntityItem(par1World, par2 + 0.5F, par3 + 0.5F, par4 + 0.5F,
+ new ItemStack(ModjamMod.itemPillar, 1, damage)));
par1World.setBlockToAir(par2, par3, par4);
- NewPacketHandler.SEND_MESSAGE.sendToPlayer(
- par5EntityPlayer,
+ NewPacketHandler.SEND_MESSAGE.sendToPlayer(par5EntityPlayer,
"\u00A7e\u00A7oThe pillar deconstructs before you.");
}
@@ -219,71 +166,45 @@ public class BlockPillar extends BlockContainer { }
@Override
- public void onNeighborBlockChange(World par1World, int par2,
- int par3, int par4, Block par5) {
- super.onNeighborBlockChange(par1World, par2, par3, par4,
- par5);
+ public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, Block par5) {
+ super.onNeighborBlockChange(par1World, par2, par3, par4, par5);
- if (!par1World.isRemote
- && !WorldGenTrapsTowersAndMore.genning) {
- int i1 = par1World.getBlockMetadata(par2, par3,
- par4);
+ if (!par1World.isRemote && !WorldGenTrapsTowersAndMore.genning) {
+ int i1 = par1World.getBlockMetadata(par2, par3, par4);
if (i1 % 2 == 0) {
- if (par1World.isAirBlock(par2, par3 + 1,
- par4)
- || par1World.getBlock(par2,
- par3 + 1,
- par4) != par1World
- .getBlock(par2, par3,
- par4)) {
- par1World.setBlockToAir(par2, par3,
- par4);
+ if (par1World.isAirBlock(par2, par3 + 1, par4)
+ || par1World.getBlock(par2, par3 + 1, par4) != par1World.getBlock(par2, par3, par4)) {
+ par1World.setBlockToAir(par2, par3, par4);
}
- } else if (par1World.isAirBlock(par2, par3 - 1,
- par4)
- || par1World.getBlock(par2,
- par3 - 1,
- par4) != par1World
- .getBlock(par2, par3,
- par4)) {
+ } else if (par1World.isAirBlock(par2, par3 - 1, par4)
+ || par1World.getBlock(par2, par3 - 1, par4) != par1World.getBlock(par2, par3, par4)) {
par1World.setBlockToAir(par2, par3, par4);
}
}
}
@Override
- public boolean canPlaceBlockAt(World par1World, int par2, int par3,
- int par4) {
+ public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) {
return par3 >= 255 ? false
- : (super.canPlaceBlockAt(par1World, par2,
- par3, par4)
- && super.canPlaceBlockAt(
- par1World,
- par2,
- par3 + 1,
- par4));
+ : (super.canPlaceBlockAt(par1World, par2, par3, par4)
+ && super.canPlaceBlockAt(par1World, par2, par3 + 1, par4));
}
@Override
- public void setBlockBoundsBasedOnState(
- IBlockAccess par1IBlockAccess, int par2, int par3,
- int par4) {
- int l = par1IBlockAccess.getBlockMetadata(par2, par3,
- par4);
+ public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) {
+ int l = par1IBlockAccess.getBlockMetadata(par2, par3, par4);
if (l % 2 == 0) {
setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 2.0F, 1.0F);
} else {
- setBlockBounds(0.0F, -1.0F, 0.0F, 1.0F, 1.0F,
- 1.0F);
+ setBlockBounds(0.0F, -1.0F, 0.0F, 1.0F, 1.0F, 1.0F);
}
}
@Override
@SideOnly(Side.CLIENT)
- public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess,
- int par2, int par3, int par4, int par5) {
+ public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) {
return false;
}
@@ -308,16 +229,13 @@ public class BlockPillar extends BlockContainer { }
@Override
- public void onBlockHarvested(World par1World, int par2, int par3,
- int par4, int par5,
+ public void onBlockHarvested(World par1World, int par2, int par3, int par4, int par5,
EntityPlayer par6EntityPlayer) {
- if (par6EntityPlayer.capabilities.isCreativeMode
- && par5 >= 2 && par1World.getBlock(par2,
- par3 - 1, par4) == this) {
+ if (par6EntityPlayer.capabilities.isCreativeMode && par5 >= 2
+ && par1World.getBlock(par2, par3 - 1, par4) == this) {
par1World.setBlockToAir(par2, par3 - 1, par4);
} else {
- super.onBlockHarvested(par1World, par2, par3, par4,
- par5, par6EntityPlayer);
+ super.onBlockHarvested(par1World, par2, par3, par4, par5, par6EntityPlayer);
}
}
@@ -331,21 +249,14 @@ public class BlockPillar extends BlockContainer { return block.getLightValue(world, x, y, z);
}
- if (ConfigData.pillarGlow && net.minecraft.client.Minecraft
- .getMinecraft().theWorld != null
- && net.minecraft.client.Minecraft
- .getMinecraft().theWorld.isRemote) {
- EntityPlayer player = net.minecraft.client.Minecraft
- .getMinecraft().thePlayer;
-
- boolean blessingMatches = te instanceof TileEntityPillar
- && ((TileEntityPillar) te).blessing != null
- && BlessingUtils.hasBlessing(
- player,
- ((TileEntityPillar) te).blessing);
-
- if (player != null && te != null
- && blessingMatches) {
+ if (ConfigData.pillarGlow && net.minecraft.client.Minecraft.getMinecraft().theWorld != null
+ && net.minecraft.client.Minecraft.getMinecraft().theWorld.isRemote) {
+ EntityPlayer player = net.minecraft.client.Minecraft.getMinecraft().thePlayer;
+
+ boolean blessingMatches = te instanceof TileEntityPillar && ((TileEntityPillar) te).blessing != null
+ && BlessingUtils.hasBlessing(player, ((TileEntityPillar) te).blessing);
+
+ if (player != null && te != null && blessingMatches) {
return 4;
}
}
diff --git a/YWD/src/main/java/fyresmodjam/blocks/BlockTrap.java b/YWD/src/main/java/fyresmodjam/blocks/BlockTrap.java index 1de921a..cecfa63 100755 --- a/YWD/src/main/java/fyresmodjam/blocks/BlockTrap.java +++ b/YWD/src/main/java/fyresmodjam/blocks/BlockTrap.java @@ -53,8 +53,7 @@ public class BlockTrap extends BlockContainer implements IShearable { @Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister par1IconRegister) {
- blockIcon = par1IconRegister
- .registerIcon("fyresmodjam:spikes2");
+ blockIcon = par1IconRegister.registerIcon("fyresmodjam:spikes2");
}
public int idDropped(int par1, Random par2Random, int par3) {
@@ -62,31 +61,24 @@ public class BlockTrap extends BlockContainer implements IShearable { }
@Override
- public ItemStack getPickBlock(MovingObjectPosition object,
- World par1World, int par2, int par3, int par4) {
+ public ItemStack getPickBlock(MovingObjectPosition object, World par1World, int par2, int par3, int par4) {
return new ItemStack(ModjamMod.blockTrap);
}
@Override
- public boolean canHarvestBlock(EntityPlayer par1EntityPlayer,
- int par2) {
+ public boolean canHarvestBlock(EntityPlayer par1EntityPlayer, int par2) {
return false;
}
@Override
- public boolean onBlockActivated(World par1World, int par2,
- int par3, int par4, EntityPlayer par5EntityPlayer,
+ public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer,
int par6, float par7, float par8, float par9) {
if (par5EntityPlayer.getHeldItem() == null) {
- TileEntity te = par1World.getTileEntity(par2, par3,
- par4);
+ TileEntity te = par1World.getTileEntity(par2, par3, par4);
- if (!par5EntityPlayer.isSneaking() && te != null
- && te instanceof TileEntityTrap
+ if (!par5EntityPlayer.isSneaking() && te != null && te instanceof TileEntityTrap
&& ((TileEntityTrap) te).placedBy != null
- && ((TileEntityTrap) te).placedBy
- .equals(par5EntityPlayer
- .getCommandSenderName())) {
+ && ((TileEntityTrap) te).placedBy.equals(par5EntityPlayer.getCommandSenderName())) {
if (!par1World.isRemote) {
((TileEntityTrap) te).setting++;
if (((TileEntityTrap) te).setting >= TileEntityTrap.settings.length) {
@@ -95,18 +87,12 @@ public class BlockTrap extends BlockContainer implements IShearable { te.markDirty();
- NewPacketHandler.SEND_MESSAGE
- .sendToPlayer(par5EntityPlayer,
- "\u00A7e\u00A7oSet to: "
- + TileEntityTrap.settings[((TileEntityTrap) te).setting]
- + ".");
+ NewPacketHandler.SEND_MESSAGE.sendToPlayer(par5EntityPlayer,
+ "\u00A7e\u00A7oSet to: " + TileEntityTrap.settings[((TileEntityTrap) te).setting] + ".");
}
} else if (par1World.isRemote) {
- NewPacketHandler.DISARM_TRAP.sendToServer(
- par2, par3, par4,
- BlessingUtils.hasBlessing(
- par5EntityPlayer,
- "BlessingMechanic"));
+ NewPacketHandler.DISARM_TRAP.sendToServer(par2, par3, par4,
+ BlessingUtils.hasBlessing(par5EntityPlayer, "BlessingMechanic"));
}
}
@@ -115,8 +101,7 @@ public class BlockTrap extends BlockContainer implements IShearable { @Override
@SideOnly(Side.CLIENT)
- public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess,
- int par2, int par3, int par4, int par5) {
+ public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) {
return false;
}
@@ -141,164 +126,88 @@ public class BlockTrap extends BlockContainer implements IShearable { }
@Override
- public void addCollisionBoxesToList(World par1World, int par2,
- int par3, int par4,
- AxisAlignedBB par5AxisAlignedBB, List par6List,
- Entity par7Entity) {
+ public void addCollisionBoxesToList(World par1World, int par2, int par3, int par4, AxisAlignedBB par5AxisAlignedBB,
+ List par6List, Entity par7Entity) {
}
@Override
- public AxisAlignedBB getCollisionBoundingBoxFromPool(
- World par1World, int par2, int par3, int par4) {
- return super.getCollisionBoundingBoxFromPool(par1World,
- par2, par3, par4);
+ public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4) {
+ return super.getCollisionBoundingBoxFromPool(par1World, par2, par3, par4);
}
@Override
@SideOnly(Side.CLIENT)
- public MovingObjectPosition collisionRayTrace(World par1World,
- int par2, int par3, int par4, Vec3 par5Vec3,
+ public MovingObjectPosition collisionRayTrace(World par1World, int par2, int par3, int par4, Vec3 par5Vec3,
Vec3 par6Vec3) {
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
TileEntity te = par1World.getTileEntity(par2, par3, par4);
return (player != null && te instanceof TileEntityTrap
- && (((TileEntityTrap) te).placedBy != null
- || !NewPacketHandler.trapsDisabled)
- && (player.getCommandSenderName().equals(
- ((TileEntityTrap) te).placedBy)
- || player.isSneaking()
- || (BlessingUtils
- .hasBlessing(player,
- "MarkScouting")))) ? super.collisionRayTrace(
- par1World,
- par2,
- par3,
- par4,
- par5Vec3,
- par6Vec3)
- : null;
+ && (((TileEntityTrap) te).placedBy != null || !NewPacketHandler.trapsDisabled)
+ && (player.getCommandSenderName().equals(((TileEntityTrap) te).placedBy) || player.isSneaking()
+ || (BlessingUtils.hasBlessing(player, "MarkScouting"))))
+ ? super.collisionRayTrace(par1World, par2, par3, par4, par5Vec3, par6Vec3)
+ : null;
}
@Override
- public void onEntityCollidedWithBlock(World par1World, int par2,
- int par3, int par4, Entity par5Entity) {
+ public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int par4, Entity par5Entity) {
TileEntity te = par1World.getTileEntity(par2, par3, par4);
boolean b1 = (((TileEntityTrap) te).placedBy == null
- || !par5Entity.getCommandSenderName()
- .equals(((TileEntityTrap) te).placedBy));
+ || !par5Entity.getCommandSenderName().equals(((TileEntityTrap) te).placedBy));
boolean b2 = ((TileEntityTrap) te).setting != 3
- && (!(par5Entity instanceof EntityPlayer)
- || ((TileEntityTrap) te).setting < 2);
- boolean b3 = (ConfigData.spawnTraps
- || ((TileEntityTrap) te).placedBy != null);
- boolean b4 = ((par5Entity instanceof EntityPlayer
- && !((EntityPlayer) par5Entity).capabilities.isCreativeMode)
+ && (!(par5Entity instanceof EntityPlayer) || ((TileEntityTrap) te).setting < 2);
+ boolean b3 = (ConfigData.spawnTraps || ((TileEntityTrap) te).placedBy != null);
+ boolean b4 = ((par5Entity instanceof EntityPlayer && !((EntityPlayer) par5Entity).capabilities.isCreativeMode)
|| par5Entity instanceof EntityMob);
- if (!par1World.isRemote && par5Entity.ridingEntity == null
- && te != null
- && te instanceof TileEntityTrap && b1 && b2
- && b3 && b4) {
+ if (!par1World.isRemote && par5Entity.ridingEntity == null && te != null && te instanceof TileEntityTrap && b1
+ && b2 && b3 && b4) {
- int type = par1World.getBlockMetadata(par2, par3,
- par4);
+ int type = par1World.getBlockMetadata(par2, par3, par4);
boolean scout = BlessingUtils.hasBlessing(par5Entity, "MarkScouting");
if (par5Entity instanceof EntityPlayer) {
if (type % trapTypes == 0) {
- par5Entity.attackEntityFrom(
- DamageSource.cactus,
- 8.0F + (scout ? 2.0F
- : 0.0F));
- if (ModjamMod.r.nextInt(8 - (scout
- ? 2
- : 0)) == 0) {
+ par5Entity.attackEntityFrom(DamageSource.cactus, 8.0F + (scout ? 2.0F : 0.0F));
+ if (ModjamMod.r.nextInt(8 - (scout ? 2 : 0)) == 0) {
((EntityLivingBase) par5Entity)
- .addPotionEffect(
- new PotionEffect(
- Potion.poison.id,
- 100 + (scout ? 25
- : 0),
- 1));
+ .addPotionEffect(new PotionEffect(Potion.poison.id, 100 + (scout ? 25 : 0), 1));
}
} else if (type % trapTypes == 1) {
if (!par5Entity.isBurning()) {
- par5Entity.setFire(10
- + (scout ? 2
- : 0));
+ par5Entity.setFire(10 + (scout ? 2 : 0));
}
} else if (type % trapTypes == 2) {
((EntityLivingBase) par5Entity)
- .addPotionEffect(
- new PotionEffect(
- Potion.blindness.id,
- 200 + (scout ? 50
- : 0),
- 1));
+ .addPotionEffect(new PotionEffect(Potion.blindness.id, 200 + (scout ? 50 : 0), 1));
((EntityLivingBase) par5Entity)
- .addPotionEffect(
- new PotionEffect(
- Potion.moveSlowdown.id,
- 200 + (scout ? 50
- : 0),
- 1));
+ .addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 200 + (scout ? 50 : 0), 1));
}
- if (CommonTickHandler.worldData
- .getDisadvantage()
- .equals("Explosive Traps")) {
- par5Entity.worldObj.setBlockToAir(
- par2, par3, par4);
- par5Entity.worldObj
- .createExplosion(
- null,
- par2 + 0.5F,
- par3 + 0.5F,
- par4 + 0.5F,
- 1.33F,
- true);
+ if (CommonTickHandler.worldData.getDisadvantage().equals("Explosive Traps")) {
+ par5Entity.worldObj.setBlockToAir(par2, par3, par4);
+ par5Entity.worldObj.createExplosion(null, par2 + 0.5F, par3 + 0.5F, par4 + 0.5F, 1.33F, true);
}
par1World.setBlockToAir(par2, par3, par4);
- NewPacketHandler.SEND_MESSAGE.sendToPlayer(
- (EntityPlayer) par5Entity,
- "\u00A7c\u00A7oYou triggered a "
- + ItemTrap.names[type
- % trapTypes].toLowerCase()
- + "!");
+ NewPacketHandler.SEND_MESSAGE.sendToPlayer((EntityPlayer) par5Entity,
+ "\u00A7c\u00A7oYou triggered a " + ItemTrap.names[type % trapTypes].toLowerCase() + "!");
} else {
if (type % trapTypes == 0) {
- par5Entity.attackEntityFrom(
- DamageSource.cactus,
- 2.0F);
+ par5Entity.attackEntityFrom(DamageSource.cactus, 2.0F);
if (ModjamMod.r.nextInt(32) == 0) {
- ((EntityLivingBase) par5Entity)
- .addPotionEffect(
- new PotionEffect(
- Potion.poison.id,
- 100,
- 1));
+ ((EntityLivingBase) par5Entity).addPotionEffect(new PotionEffect(Potion.poison.id, 100, 1));
}
} else if (type % trapTypes == 1) {
if (!par5Entity.isBurning()) {
par5Entity.setFire(5);
}
} else if (type % trapTypes == 2) {
- ((EntityLivingBase) par5Entity)
- .addPotionEffect(
- new PotionEffect(
- Potion.blindness.id,
- 100,
- 1));
- ((EntityLivingBase) par5Entity)
- .addPotionEffect(
- new PotionEffect(
- Potion.moveSlowdown.id,
- 100,
- 1));
+ ((EntityLivingBase) par5Entity).addPotionEffect(new PotionEffect(Potion.blindness.id, 100, 1));
+ ((EntityLivingBase) par5Entity).addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 100, 1));
}
}
@@ -306,42 +215,28 @@ public class BlockTrap extends BlockContainer implements IShearable { }
@Override
- public void onNeighborBlockChange(World par1World, int par2,
- int par3, int par4, Block par5) {
- super.onNeighborBlockChange(par1World, par2, par3, par4,
- par5);
-
- if (!par1World.isRemote && !par1World.isSideSolid(par2,
- par3 - 1, par4, ForgeDirection.SOUTH,
- true)) {
+ public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, Block par5) {
+ super.onNeighborBlockChange(par1World, par2, par3, par4, par5);
+
+ if (!par1World.isRemote && !par1World.isSideSolid(par2, par3 - 1, par4, ForgeDirection.SOUTH, true)) {
par1World.setBlockToAir(par2, par3, par4);
- TileEntity te = par1World.getTileEntity(par2, par3,
- par4);
- if ((ConfigData.spawnTraps || (te != null
- && te instanceof TileEntityTrap
- && ((TileEntityTrap) te).placedBy != null))
+ TileEntity te = par1World.getTileEntity(par2, par3, par4);
+ if ((ConfigData.spawnTraps
+ || (te != null && te instanceof TileEntityTrap && ((TileEntityTrap) te).placedBy != null))
&& CommonTickHandler.worldData != null
- && CommonTickHandler.worldData
- .getDisadvantage()
- .equals("Explosive Traps")) {
- par1World.createExplosion(null,
- par2 + 0.5F, par3 + 0.5F,
- par4 + 0.5F, 1.33F, true);
+ && CommonTickHandler.worldData.getDisadvantage().equals("Explosive Traps")) {
+ par1World.createExplosion(null, par2 + 0.5F, par3 + 0.5F, par4 + 0.5F, 1.33F, true);
}
}
}
@Override
- public boolean isReplaceable(IBlockAccess world, int x, int y,
- int z) {
+ public boolean isReplaceable(IBlockAccess world, int x, int y, int z) {
TileEntity te = world.getTileEntity(x, y, z);
return super.isReplaceable(world, x, y, z)
- || (((world instanceof World
- && ((World) world).isRemote)
- ? NewPacketHandler.trapsDisabled
- : !ConfigData.spawnTraps)
- && (te == null || !(te instanceof TileEntityTrap)
- || ((TileEntityTrap) te).placedBy == null));
+ || (((world instanceof World && ((World) world).isRemote) ? NewPacketHandler.trapsDisabled
+ : !ConfigData.spawnTraps)
+ && (te == null || !(te instanceof TileEntityTrap) || ((TileEntityTrap) te).placedBy == null));
}
@Override
@@ -352,9 +247,7 @@ public class BlockTrap extends BlockContainer implements IShearable { @Override
public boolean canPlaceBlockAt(World world, int x, int y, int z) {
- return super.canPlaceBlockAt(world, x, y, z)
- && (y == 0 || world.getBlock(x, y - 1,
- z) != ModjamMod.blockTrap);
+ return super.canPlaceBlockAt(world, x, y, z) && (y == 0 || world.getBlock(x, y - 1, z) != ModjamMod.blockTrap);
}
@Override
@@ -364,63 +257,48 @@ public class BlockTrap extends BlockContainer implements IShearable { @Override
@SideOnly(Side.CLIENT)
- public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs,
- List par3List) {
+ public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) {
for (int i = 0; i < trapTypes; i++) {
par3List.add(new ItemStack(par1, 1, i));
}
}
@Override
- public void onBlockPlacedBy(World par1World, int par2, int par3,
- int par4, EntityLivingBase par5EntityLivingBase,
+ public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase,
ItemStack par6ItemStack) {
- super.onBlockPlacedBy(par1World, par2, par3, par4,
- par5EntityLivingBase, par6ItemStack);
+ super.onBlockPlacedBy(par1World, par2, par3, par4, par5EntityLivingBase, par6ItemStack);
- par1World.setBlockMetadataWithNotify(par2, par3, par4,
- par6ItemStack.getItemDamage(), 0);
+ par1World.setBlockMetadataWithNotify(par2, par3, par4, par6ItemStack.getItemDamage(), 0);
- if (par5EntityLivingBase != null
- && par5EntityLivingBase instanceof EntityPlayer) {
+ if (par5EntityLivingBase != null && par5EntityLivingBase instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) par5EntityLivingBase;
- if (!player.capabilities.isCreativeMode
- || NewPacketHandler.trapsDisabled) {
- TileEntity te = par1World.getTileEntity(
- par2, par3, par4);
+ if (!player.capabilities.isCreativeMode || NewPacketHandler.trapsDisabled) {
+ TileEntity te = par1World.getTileEntity(par2, par3, par4);
if (te != null && te instanceof TileEntityTrap) {
- ((TileEntityTrap) te).placedBy = player
- .getCommandSenderName();
+ ((TileEntityTrap) te).placedBy = player.getCommandSenderName();
}
}
}
}
@Override
- public boolean isShearable(ItemStack item,
- IBlockAccess blockAccess, int x, int y, int z) {
+ public boolean isShearable(ItemStack item, IBlockAccess blockAccess, int x, int y, int z) {
return true;
}
@Override
- public ArrayList<ItemStack> onSheared(ItemStack item,
- IBlockAccess blockAccess, int x, int y, int z,
- int fortune) {
+ public ArrayList<ItemStack> onSheared(ItemStack item, IBlockAccess blockAccess, int x, int y, int z, int fortune) {
if (blockAccess instanceof World) {
World world = (World) blockAccess;
world.setBlockToAir(x, y, z);
if (!world.isRemote) {
- MinecraftServer server = FMLCommonHandler
- .instance()
- .getMinecraftServerInstance();
+ MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
for (int i = 0; i < server.worldServers.length; i++) {
- WorldServer s = FMLCommonHandler
- .instance()
- .getMinecraftServerInstance().worldServers[i];
+ WorldServer s = FMLCommonHandler.instance().getMinecraftServerInstance().worldServers[i];
if (s == null) {
continue;
@@ -433,11 +311,8 @@ public class BlockTrap extends BlockContainer implements IShearable { EntityPlayer player = (EntityPlayer) o;
- if (item.equals(player
- .getHeldItem())) {
- NewPacketHandler.SEND_MESSAGE
- .sendToPlayer(player,
- "\u00A7e\u00A7oYou disarmed the trap.");
+ if (item.equals(player.getHeldItem())) {
+ NewPacketHandler.SEND_MESSAGE.sendToPlayer(player, "\u00A7e\u00A7oYou disarmed the trap.");
}
}
}
@@ -450,17 +325,10 @@ public class BlockTrap extends BlockContainer implements IShearable { }
@Override
- public float getPlayerRelativeBlockHardness(
- EntityPlayer par1EntityPlayer, World par2World,
- int par3, int par4, int par5) {
- return (par1EntityPlayer.getHeldItem() != null
- && par1EntityPlayer.getHeldItem()
- .getItem() == Items.shears)
- ? 1.0F
- : getBlockHardness(
- par2World,
- par3,
- par4,
- par5);
+ public float getPlayerRelativeBlockHardness(EntityPlayer par1EntityPlayer, World par2World, int par3, int par4,
+ int par5) {
+ return (par1EntityPlayer.getHeldItem() != null && par1EntityPlayer.getHeldItem().getItem() == Items.shears)
+ ? 1.0F
+ : getBlockHardness(par2World, par3, par4, par5);
}
}
diff --git a/YWD/src/main/java/fyresmodjam/commands/CommandCraftingStats.java b/YWD/src/main/java/fyresmodjam/commands/CommandCraftingStats.java index aecf4d5..fd31d52 100755 --- a/YWD/src/main/java/fyresmodjam/commands/CommandCraftingStats.java +++ b/YWD/src/main/java/fyresmodjam/commands/CommandCraftingStats.java @@ -33,11 +33,8 @@ public class CommandCraftingStats implements ICommand { }
@Override
- public void processCommand(ICommandSender icommandsender,
- String[] astring) {
- int page = astring.length > 0
- ? Integer.parseInt(astring[0]) - 1
- : 0, maxPage = 0;
+ public void processCommand(ICommandSender icommandsender, String[] astring) {
+ int page = astring.length > 0 ? Integer.parseInt(astring[0]) - 1 : 0, maxPage = 0;
if (icommandsender instanceof EntityPlayer) {
EntityPlayer entityplayer = (EntityPlayer) icommandsender;
@@ -46,28 +43,17 @@ public class CommandCraftingStats implements ICommand { if (ConfigData.enableCraftingStats) {
message = "@Crafting Knowledge:";
- if (entityplayer.getEntityData()
- .hasKey("CraftingStats")) {
- NBTTagCompound craftingStats = entityplayer
- .getEntityData()
- .getCompoundTag("CraftingStats");
-
- String trackedItems = craftingStats
- .hasKey("TrackedItemList")
- ? craftingStats.getString(
- "TrackedItemList")
- : "";
-
- if (trackedItems != null
- && trackedItems.length() > 0) {
- String[] trackedItemList = trackedItems
- .split(";");
-
- maxPage = Math.max(0,
- (craftingStats.func_150296_c()
- .size()
- - 1)
- / 4);
+ if (entityplayer.getEntityData().hasKey("CraftingStats")) {
+ NBTTagCompound craftingStats = entityplayer.getEntityData().getCompoundTag("CraftingStats");
+
+ String trackedItems = craftingStats.hasKey("TrackedItemList")
+ ? craftingStats.getString("TrackedItemList")
+ : "";
+
+ if (trackedItems != null && trackedItems.length() > 0) {
+ String[] trackedItemList = trackedItems.split(";");
+
+ maxPage = Math.max(0, (craftingStats.func_150296_c().size() - 1) / 4);
if (page > maxPage) {
page = maxPage;
}
@@ -75,11 +61,7 @@ public class CommandCraftingStats implements ICommand { page = 0;
}
- message = "@Crafting Knowledge (page "
- + (page + 1)
- + "/"
- + (maxPage + 1)
- + "):";
+ message = "@Crafting Knowledge (page " + (page + 1) + "/" + (maxPage + 1) + "):";
int count = 0, skip = 0;
for (String item : trackedItemList) {
@@ -88,13 +70,11 @@ public class CommandCraftingStats implements ICommand { continue;
}
- int kills = craftingStats
- .getInteger(item);
+ int kills = craftingStats.getInteger(item);
int last = 0;
for (int i = 0; i < EntityStatHelper.killCount.length; i++) {
- if (kills >= EntityStatHelper.killCount[i]
- * 2) {
+ if (kills >= EntityStatHelper.killCount[i] * 2) {
last = i;
continue;
} else {
@@ -102,15 +82,12 @@ public class CommandCraftingStats implements ICommand { }
}
- message += "@\u00A7b "
- + EntityStatHelper.knowledge[last]
- + " "
- + item.toLowerCase()
- + " smith\u00A73 ("
- + kills
- + " craft(s)"
- + (last < EntityStatHelper.knowledge.length
- - 1 ? ", " + (EntityStatHelper.killCount[last + 1] * 2 - kills + " craft(s) to next rank)") : ")");
+ message += "@\u00A7b " + EntityStatHelper.knowledge[last] + " " + item.toLowerCase()
+ + " smith\u00A73 (" + kills + " craft(s)"
+ + (last < EntityStatHelper.knowledge.length - 1
+ ? ", " + (EntityStatHelper.killCount[last + 1] * 2 - kills
+ + " craft(s) to next rank)")
+ : ")");
count++;
if (count >= 4) {
@@ -123,20 +100,17 @@ public class CommandCraftingStats implements ICommand { }
}
- NewPacketHandler.SEND_MESSAGE.sendToPlayer(
- entityplayer, message);
+ NewPacketHandler.SEND_MESSAGE.sendToPlayer(entityplayer, message);
}
}
@Override
- public boolean canCommandSenderUseCommand(
- ICommandSender icommandsender) {
+ public boolean canCommandSenderUseCommand(ICommandSender icommandsender) {
return true;
}
@Override
- public List addTabCompletionOptions(ICommandSender icommandsender,
- String[] astring) {
+ public List addTabCompletionOptions(ICommandSender icommandsender, String[] astring) {
return null;
}
diff --git a/YWD/src/main/java/fyresmodjam/commands/CommandCurrentBlessing.java b/YWD/src/main/java/fyresmodjam/commands/CommandCurrentBlessing.java index 09b82df..95bdad9 100755 --- a/YWD/src/main/java/fyresmodjam/commands/CommandCurrentBlessing.java +++ b/YWD/src/main/java/fyresmodjam/commands/CommandCurrentBlessing.java @@ -32,43 +32,33 @@ public class CommandCurrentBlessing implements ICommand { }
@Override
- public void processCommand(ICommandSender icommandsender,
- String[] astring) {
+ public void processCommand(ICommandSender icommandsender, String[] astring) {
if (icommandsender instanceof EntityPlayer) {
EntityPlayer entityplayer = (EntityPlayer) icommandsender;
- boolean hasBlessing = BlessingUtils
- .hasBlessing(entityplayer);
+ boolean hasBlessing = BlessingUtils.hasBlessing(entityplayer);
String blessingMsg = "";
if (hasBlessing) {
- Blessing bless = BlessingUtils
- .getBlessingInstance(
- entityplayer);
-
- blessingMsg = String.format(
- "§eCurrent Blessing - §o%s\n%s",
- bless.customName(),
- bless.description());
+ Blessing bless = BlessingUtils.getBlessingInstance(entityplayer);
+
+ blessingMsg = String.format("§eCurrent Blessing - §o%s\n%s", bless.customName(), bless.description());
} else {
blessingMsg = "You don't currently have a blessing";
}
- NewPacketHandler.SEND_MESSAGE.sendToPlayer(
- entityplayer, blessingMsg);
+ NewPacketHandler.SEND_MESSAGE.sendToPlayer(entityplayer, blessingMsg);
}
}
@Override
- public boolean canCommandSenderUseCommand(
- ICommandSender icommandsender) {
+ public boolean canCommandSenderUseCommand(ICommandSender icommandsender) {
return true;
}
@Override
- public List addTabCompletionOptions(ICommandSender icommandsender,
- String[] astring) {
+ public List addTabCompletionOptions(ICommandSender icommandsender, String[] astring) {
return null;
}
diff --git a/YWD/src/main/java/fyresmodjam/commands/CommandCurrentDisadvantage.java b/YWD/src/main/java/fyresmodjam/commands/CommandCurrentDisadvantage.java index 0ab796d..1d58ae2 100755 --- a/YWD/src/main/java/fyresmodjam/commands/CommandCurrentDisadvantage.java +++ b/YWD/src/main/java/fyresmodjam/commands/CommandCurrentDisadvantage.java @@ -32,40 +32,30 @@ public class CommandCurrentDisadvantage implements ICommand { }
@Override
- public void processCommand(ICommandSender icommandsender,
- String[] astring) {
+ public void processCommand(ICommandSender icommandsender, String[] astring) {
if (icommandsender instanceof EntityPlayer) {
EntityPlayer entityplayer = (EntityPlayer) icommandsender;
int index = -1;
for (int i = 0; i < FyresWorldData.validDisadvantages.length; i++) {
- if (FyresWorldData.validDisadvantages[i]
- .equals(CommonTickHandler.worldData
- .getDisadvantage())) {
+ if (FyresWorldData.validDisadvantages[i].equals(CommonTickHandler.worldData.getDisadvantage())) {
index = i;
break;
}
}
- NewPacketHandler.SEND_MESSAGE.sendToPlayer(
- entityplayer,
- "\u00A7eWorld disadvantage: "
- + CommonTickHandler.worldData
- .getDisadvantage()
- + (index == -1 ? ""
- : " (" + FyresWorldData.disadvantageDescriptions[index]
- + ")"));
+ NewPacketHandler.SEND_MESSAGE.sendToPlayer(entityplayer,
+ "\u00A7eWorld disadvantage: " + CommonTickHandler.worldData.getDisadvantage()
+ + (index == -1 ? "" : " (" + FyresWorldData.disadvantageDescriptions[index] + ")"));
}
}
@Override
- public boolean canCommandSenderUseCommand(
- ICommandSender icommandsender) {
+ public boolean canCommandSenderUseCommand(ICommandSender icommandsender) {
return true;
}
@Override
- public List addTabCompletionOptions(ICommandSender icommandsender,
- String[] astring) {
+ public List addTabCompletionOptions(ICommandSender icommandsender, String[] astring) {
return null;
}
diff --git a/YWD/src/main/java/fyresmodjam/commands/CommandCurrentWorldTask.java b/YWD/src/main/java/fyresmodjam/commands/CommandCurrentWorldTask.java index 34db008..fdf98d8 100755 --- a/YWD/src/main/java/fyresmodjam/commands/CommandCurrentWorldTask.java +++ b/YWD/src/main/java/fyresmodjam/commands/CommandCurrentWorldTask.java @@ -32,65 +32,45 @@ public class CommandCurrentWorldTask implements ICommand { }
@Override
- public void processCommand(ICommandSender icommandsender,
- String[] astring) {
+ public void processCommand(ICommandSender icommandsender, String[] astring) {
if (icommandsender instanceof EntityPlayer) {
EntityPlayer entityplayer = (EntityPlayer) icommandsender;
- String name = CommonTickHandler.worldData.currentTask
- .equals("Kill") ? FyresWorldData.validMobNames[CommonTickHandler.worldData.currentTaskID]
- : FyresWorldData.validItems[CommonTickHandler.worldData.currentTaskID]
- .getDisplayName();
+ String name = CommonTickHandler.worldData.currentTask.equals("Kill")
+ ? FyresWorldData.validMobNames[CommonTickHandler.worldData.currentTaskID]
+ : FyresWorldData.validItems[CommonTickHandler.worldData.currentTaskID].getDisplayName();
if (CommonTickHandler.worldData.currentTaskAmount > 1) {
if (name.contains("Block")) {
if (name.contains("Block")) {
- name = name.replace(
- "Block",
- "Blocks")
- .replace("block",
- "blocks");
+ name = name.replace("Block", "Blocks").replace("block", "blocks");
}
} else {
name += "s";
}
}
- NewPacketHandler.SEND_MESSAGE.sendToPlayer(
- entityplayer,
- "\u00A7eWorld goal: "
- + CommonTickHandler.worldData.currentTask
- + " "
- + CommonTickHandler.worldData.currentTaskAmount
- + " " + name
- + ". ("
- + CommonTickHandler.worldData.progress
- + " "
- + CommonTickHandler.worldData.currentTask
+ NewPacketHandler.SEND_MESSAGE.sendToPlayer(entityplayer,
+ "\u00A7eWorld goal: " + CommonTickHandler.worldData.currentTask + " "
+ + CommonTickHandler.worldData.currentTaskAmount + " " + name + ". ("
+ + CommonTickHandler.worldData.progress + " " + CommonTickHandler.worldData.currentTask
+ "ed)");
- NewPacketHandler.SEND_MESSAGE.sendToPlayer(
- entityplayer,
- "\u00A7f Reward: "
- + CommonTickHandler.worldData.rewardLevels
- + " Experience Levels");
+ NewPacketHandler.SEND_MESSAGE.sendToPlayer(entityplayer,
+ "\u00A7f Reward: " + CommonTickHandler.worldData.rewardLevels + " Experience Levels");
- NewPacketHandler.SEND_MESSAGE.sendToPlayer(
- entityplayer,
- "\u00A7eGoals completed: "
- + CommonTickHandler.worldData.tasksCompleted);
+ NewPacketHandler.SEND_MESSAGE.sendToPlayer(entityplayer,
+ "\u00A7eGoals completed: " + CommonTickHandler.worldData.tasksCompleted);
}
}
@Override
- public boolean canCommandSenderUseCommand(
- ICommandSender icommandsender) {
+ public boolean canCommandSenderUseCommand(ICommandSender icommandsender) {
return true;
}
@Override
- public List addTabCompletionOptions(ICommandSender icommandsender,
- String[] astring) {
+ public List addTabCompletionOptions(ICommandSender icommandsender, String[] astring) {
return null;
}
diff --git a/YWD/src/main/java/fyresmodjam/commands/CommandKillStats.java b/YWD/src/main/java/fyresmodjam/commands/CommandKillStats.java index 582f38c..61ee87c 100755 --- a/YWD/src/main/java/fyresmodjam/commands/CommandKillStats.java +++ b/YWD/src/main/java/fyresmodjam/commands/CommandKillStats.java @@ -33,11 +33,8 @@ public class CommandKillStats implements ICommand { }
@Override
- public void processCommand(ICommandSender icommandsender,
- String[] astring) {
- int page = astring.length > 0
- ? Integer.parseInt(astring[0]) - 1
- : 0, maxPage = 0;
+ public void processCommand(ICommandSender icommandsender, String[] astring) {
+ int page = astring.length > 0 ? Integer.parseInt(astring[0]) - 1 : 0, maxPage = 0;
if (icommandsender instanceof EntityPlayer) {
EntityPlayer entityplayer = (EntityPlayer) icommandsender;
@@ -47,28 +44,16 @@ public class CommandKillStats implements ICommand { if (ConfigData.enableMobKillStats) {
message = "@Creature Knowledge:";
- if (entityplayer.getEntityData()
- .hasKey("KillStats")) {
- NBTTagCompound killStats = entityplayer
- .getEntityData()
- .getCompoundTag("KillStats");
-
- String trackedMobs = killStats
- .hasKey("TrackedMobList")
- ? killStats.getString(
- "TrackedMobList")
- : "";
-
- if (trackedMobs != null
- && trackedMobs.length() > 0) {
- String[] trackedMobList = trackedMobs
- .split(";");
-
- maxPage = Math.max(0,
- (killStats.func_150296_c()
- .size()
- - 1)
- / 4);
+ if (entityplayer.getEntityData().hasKey("KillStats")) {
+ NBTTagCompound killStats = entityplayer.getEntityData().getCompoundTag("KillStats");
+
+ String trackedMobs = killStats.hasKey("TrackedMobList") ? killStats.getString("TrackedMobList")
+ : "";
+
+ if (trackedMobs != null && trackedMobs.length() > 0) {
+ String[] trackedMobList = trackedMobs.split(";");
+
+ maxPage = Math.max(0, (killStats.func_150296_c().size() - 1) / 4);
if (page > maxPage) {
page = maxPage;
}
@@ -76,11 +61,7 @@ public class CommandKillStats implements ICommand { page = 0;
}
- message = "@Creature Knowledge (page "
- + (page + 1)
- + "/"
- + (maxPage + 1)
- + "):";
+ message = "@Creature Knowledge (page " + (page + 1) + "/" + (maxPage + 1) + "):";
int count = 0, skip = 0;
for (String mob : trackedMobList) {
@@ -89,8 +70,7 @@ public class CommandKillStats implements ICommand { continue;
}
- int kills = killStats
- .getInteger(mob);
+ int kills = killStats.getInteger(mob);
int last = 0;
for (int i = 0; i < EntityStatHelper.killCount.length; i++) {
@@ -102,19 +82,14 @@ public class CommandKillStats implements ICommand { }
}
- message += "@\u00A7b "
- + EntityStatHelper.knowledge[last]
- + " "
- + mob.toLowerCase()
+ message += "@\u00A7b " + EntityStatHelper.knowledge[last] + " " + mob.toLowerCase()
+ " slayer\u00A73 "
+ (last > 0 ? "+"
- + EntityStatHelper.damageBonusString[last]
- + "% damage bonus ("
- : "(")
- + kills
- + " kill(s)"
- + (last < EntityStatHelper.knowledge.length
- - 1 ? ", " + (EntityStatHelper.killCount[last + 1] - kills + " kill(s) to next rank)") : ")");
+ + EntityStatHelper.damageBonusString[last] + "% damage bonus (" : "(")
+ + kills + " kill(s)"
+ + (last < EntityStatHelper.knowledge.length - 1 ? ", "
+ + (EntityStatHelper.killCount[last + 1] - kills + " kill(s) to next rank)")
+ : ")");
count++;
if (count >= 4) {
@@ -127,20 +102,17 @@ public class CommandKillStats implements ICommand { }
}
- NewPacketHandler.SEND_MESSAGE.sendToPlayer(
- entityplayer, message);
+ NewPacketHandler.SEND_MESSAGE.sendToPlayer(entityplayer, message);
}
}
@Override
- public boolean canCommandSenderUseCommand(
- ICommandSender icommandsender) {
+ public boolean canCommandSenderUseCommand(ICommandSender icommandsender) {
return true;
}
@Override
- public List addTabCompletionOptions(ICommandSender icommandsender,
- String[] astring) {
+ public List addTabCompletionOptions(ICommandSender icommandsender, String[] astring) {
return null;
}
diff --git a/YWD/src/main/java/fyresmodjam/commands/CommandWeaponStats.java b/YWD/src/main/java/fyresmodjam/commands/CommandWeaponStats.java index 95c91f7..4957e52 100755 --- a/YWD/src/main/java/fyresmodjam/commands/CommandWeaponStats.java +++ b/YWD/src/main/java/fyresmodjam/commands/CommandWeaponStats.java @@ -33,11 +33,8 @@ public class CommandWeaponStats implements ICommand { }
@Override
- public void processCommand(ICommandSender icommandsender,
- String[] astring) {
- int page = astring.length > 0
- ? Integer.parseInt(astring[0]) - 1
- : 0, maxPage = 0;
+ public void processCommand(ICommandSender icommandsender, String[] astring) {
+ int page = astring.length > 0 ? Integer.parseInt(astring[0]) - 1 : 0, maxPage = 0;
if (icommandsender instanceof EntityPlayer) {
EntityPlayer entityplayer = (EntityPlayer) icommandsender;
@@ -46,27 +43,16 @@ public class CommandWeaponStats implements ICommand { if (ConfigData.enableWeaponKillStats) {
message = "@Weapon Knowledge:";
- if (entityplayer.getEntityData()
- .hasKey("WeaponStats")) {
- NBTTagCompound itemStats = entityplayer
- .getEntityData()
- .getCompoundTag("WeaponStats");
-
- String trackedItems = itemStats
- .hasKey("TrackedItemList")
- ? itemStats.getString(
- "TrackedItemList")
- : "";
-
- if (trackedItems != null
- && trackedItems.length() > 0) {
- String[] trackedItemList = trackedItems
- .split(";");
-
- maxPage = Math.max(0,
- (itemStats.func_150296_c()
- .size())
- / 4);
+ if (entityplayer.getEntityData().hasKey("WeaponStats")) {
+ NBTTagCompound itemStats = entityplayer.getEntityData().getCompoundTag("WeaponStats");
+
+ String trackedItems = itemStats.hasKey("TrackedItemList") ? itemStats.getString("TrackedItemList")
+ : "";
+
+ if (trackedItems != null && trackedItems.length() > 0) {
+ String[] trackedItemList = trackedItems.split(";");
+
+ maxPage = Math.max(0, (itemStats.func_150296_c().size()) / 4);
if (page > maxPage) {
page = maxPage;
}
@@ -74,11 +60,7 @@ public class CommandWeaponStats implements ICommand { page = 0;
}
- message = "@Weapon Knowledge (page "
- + (page + 1)
- + "/"
- + (maxPage + 1)
- + "):";
+ message = "@Weapon Knowledge (page " + (page + 1) + "/" + (maxPage + 1) + "):";
int count = 0, skip = 0;
for (String item : trackedItemList) {
@@ -87,13 +69,11 @@ public class CommandWeaponStats implements ICommand { continue;
}
- int kills = itemStats
- .getInteger(item);
+ int kills = itemStats.getInteger(item);
int last = 0;
for (int i = 0; i < EntityStatHelper.killCount.length; i++) {
- if (kills >= EntityStatHelper.killCount[i]
- * 2) {
+ if (kills >= EntityStatHelper.killCount[i] * 2) {
last = i;
continue;
} else {
@@ -101,19 +81,15 @@ public class CommandWeaponStats implements ICommand { }
}
- message += "@\u00A7b "
- + EntityStatHelper.knowledge[last]
- + " "
- + item.toLowerCase()
+ message += "@\u00A7b " + EntityStatHelper.knowledge[last] + " " + item.toLowerCase()
+ " user\u00A73 "
- + (last > 0 ? "+"
- + EntityStatHelper.damageBonusString[last]
- + "% damage bonus ("
+ + (last > 0 ? "+" + EntityStatHelper.damageBonusString[last] + "% damage bonus ("
: "(")
- + kills
- + " kill(s)"
- + (last < EntityStatHelper.knowledge.length
- - 1 ? ", " + (EntityStatHelper.killCount[last + 1] * 2 - kills + " kill(s) to next rank)") : ")");
+ + kills + " kill(s)"
+ + (last < EntityStatHelper.knowledge.length - 1
+ ? ", " + (EntityStatHelper.killCount[last + 1] * 2 - kills
+ + " kill(s) to next rank)")
+ : ")");
count++;
if (count >= 4) {
@@ -126,20 +102,17 @@ public class CommandWeaponStats implements ICommand { }
}
- NewPacketHandler.SEND_MESSAGE.sendToPlayer(
- entityplayer, message);
+ NewPacketHandler.SEND_MESSAGE.sendToPlayer(entityplayer, message);
}
}
@Override
- public boolean canCommandSenderUseCommand(
- ICommandSender icommandsender) {
+ public boolean canCommandSenderUseCommand(ICommandSender icommandsender) {
return true;
}
@Override
- public List addTabCompletionOptions(ICommandSender icommandsender,
- String[] astring) {
+ public List addTabCompletionOptions(ICommandSender icommandsender, String[] astring) {
return null;
}
diff --git a/YWD/src/main/java/fyresmodjam/entities/EntityMysteryPotion.java b/YWD/src/main/java/fyresmodjam/entities/EntityMysteryPotion.java index 6c4eef5..975e18b 100755 --- a/YWD/src/main/java/fyresmodjam/entities/EntityMysteryPotion.java +++ b/YWD/src/main/java/fyresmodjam/entities/EntityMysteryPotion.java @@ -28,23 +28,18 @@ public class EntityMysteryPotion extends EntityThrowable { super(par1World);
}
- public EntityMysteryPotion(World par1World,
- EntityLivingBase par2EntityLivingBase, int par3) {
+ public EntityMysteryPotion(World par1World, EntityLivingBase par2EntityLivingBase, int par3) {
this(par1World, par2EntityLivingBase, null);
}
- public EntityMysteryPotion(World par1World,
- EntityLivingBase par2EntityLivingBase,
- ItemStack par4ItemStack) {
+ public EntityMysteryPotion(World par1World, EntityLivingBase par2EntityLivingBase, ItemStack par4ItemStack) {
super(par1World, par2EntityLivingBase);
if (par4ItemStack != null) {
int damage = par4ItemStack.getItemDamage();
dataWatcher.updateObject(24, damage);
if (damage % 13 < 12) {
- dataWatcher.updateObject(25,
- CommonTickHandler.worldData.potionDurations[damage
- % 13]);
+ dataWatcher.updateObject(25, CommonTickHandler.worldData.potionDurations[damage % 13]);
}
}
}
@@ -58,23 +53,17 @@ public class EntityMysteryPotion extends EntityThrowable { }
@SideOnly(Side.CLIENT)
- public EntityMysteryPotion(World par1World, double par2,
- double par4, double par6, int par8) {
- this(par1World, par2, par4, par6,
- new ItemStack(Items.potionitem, 1, par8));
+ public EntityMysteryPotion(World par1World, double par2, double par4, double par6, int par8) {
+ this(par1World, par2, par4, par6, new ItemStack(Items.potionitem, 1, par8));
}
- public EntityMysteryPotion(World par1World, double par2,
- double par4, double par6,
- ItemStack par4ItemStack) {
+ public EntityMysteryPotion(World par1World, double par2, double par4, double par6, ItemStack par4ItemStack) {
super(par1World, par2, par4, par6);
if (par4ItemStack != null) {
int damage = par4ItemStack.getItemDamage();
dataWatcher.updateObject(24, damage);
- dataWatcher.updateObject(25,
- CommonTickHandler.worldData.potionDurations[damage
- % 13]);
+ dataWatcher.updateObject(25, CommonTickHandler.worldData.potionDurations[damage % 13]);
}
}
@@ -95,36 +84,21 @@ public class EntityMysteryPotion extends EntityThrowable { @Override
@SuppressWarnings("rawtypes")
- protected void onImpact(
- MovingObjectPosition par1MovingObjectPosition) {
+ protected void onImpact(MovingObjectPosition par1MovingObjectPosition) {
if (!worldObj.isRemote) {
- AxisAlignedBB axisalignedbb = boundingBox
- .expand(4.0D, 2.0D, 4.0D);
- List list1 = worldObj.getEntitiesWithinAABB(
- EntityLivingBase.class,
- axisalignedbb);
+ AxisAlignedBB axisalignedbb = boundingBox.expand(4.0D, 2.0D, 4.0D);
+ List list1 = worldObj.getEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb);
if (list1 != null && !list1.isEmpty()) {
- int type = getDataWatcher()
- .getWatchableObjectInt(24)
- % 13;
- int j = type >= 12
- ? (5 + ModjamMod.r.nextInt(
- 26))
- : getDataWatcher()
- .getWatchableObjectInt(
- 25);
+ int type = getDataWatcher().getWatchableObjectInt(24) % 13;
+ int j = type >= 12 ? (5 + ModjamMod.r.nextInt(26)) : getDataWatcher().getWatchableObjectInt(25);
int damage = 0;
- if (type >= 12 || (BlessingUtils
- .hasBlessing(getThrower(),
- "BlessingAlchemist"))) {
- damage = ModjamMod.r.nextInt(
- Potion.potionTypes.length);
+ if (type >= 12 || (BlessingUtils.hasBlessing(getThrower(), "BlessingAlchemist"))) {
+ damage = ModjamMod.r.nextInt(Potion.potionTypes.length);
while (Potion.potionTypes[damage] == null) {
- damage = ModjamMod.r
- .nextInt(Potion.potionTypes.length);
+ damage = ModjamMod.r.nextInt(Potion.potionTypes.length);
}
} else {
damage = CommonTickHandler.worldData.potionValues[type];
@@ -133,26 +107,14 @@ public class EntityMysteryPotion extends EntityThrowable { Iterator iterator = list1.iterator();
while (iterator.hasNext()) {
- EntityLivingBase entitylivingbase = (EntityLivingBase) iterator
- .next();
- double d0 = getDistanceSqToEntity(
- entitylivingbase);
+ EntityLivingBase entitylivingbase = (EntityLivingBase) iterator.next();
+ double d0 = getDistanceSqToEntity(entitylivingbase);
if (d0 < 16.0D) {
- if (Potion.potionTypes[damage]
- .isInstant()) {
- Potion.potionTypes[damage]
- .affectEntity(getThrower(),
- entitylivingbase,
- 1,
- 1);
+ if (Potion.potionTypes[damage].isInstant()) {
+ Potion.potionTypes[damage].affectEntity(getThrower(), entitylivingbase, 1, 1);
} else {
- entitylivingbase.addPotionEffect(
- new PotionEffect(
- damage,
- j * 20,
- 1,
- false));
+ entitylivingbase.addPotionEffect(new PotionEffect(damage, j * 20, 1, false));
}
}
}
@@ -160,83 +122,43 @@ public class EntityMysteryPotion extends EntityThrowable { if (getThrower() instanceof EntityPlayer) {
EntityPlayer par3EntityPlayer = (EntityPlayer) getThrower();
- if (type < 12 && (!BlessingUtils
- .hasBlessing(getThrower(),
- "BlessingAlchemist"))) {
- if (!par3EntityPlayer
- .getEntityData()
- .hasKey("PotionKnowledge")) {
- par3EntityPlayer.getEntityData()
- .setIntArray("PotionKnowledge",
- new int[] {
- -1,
- -1,
- -1,
- -1,
- -1,
- -1,
- -1,
- -1,
- -1,
- -1,
- -1,
- -1
- });
+ if (type < 12 && (!BlessingUtils.hasBlessing(getThrower(), "BlessingAlchemist"))) {
+ if (!par3EntityPlayer.getEntityData().hasKey("PotionKnowledge")) {
+ par3EntityPlayer.getEntityData().setIntArray("PotionKnowledge",
+ new int[] { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 });
}
- if (par3EntityPlayer
- .getEntityData()
- .getIntArray("PotionKnowledge")[type] == -1) {
- par3EntityPlayer.getEntityData()
- .getIntArray("PotionKnowledge")[type] = 1;
+ if (par3EntityPlayer.getEntityData().getIntArray("PotionKnowledge")[type] == -1) {
+ par3EntityPlayer.getEntityData().getIntArray("PotionKnowledge")[type] = 1;
- NewPacketHandler.UPDATE_POTION_KNOWLEDGE
- .sendToPlayer(par3EntityPlayer,
- par3EntityPlayer.getEntityData()
- .getIntArray("PotionKnowledge"));
+ NewPacketHandler.UPDATE_POTION_KNOWLEDGE.sendToPlayer(par3EntityPlayer,
+ par3EntityPlayer.getEntityData().getIntArray("PotionKnowledge"));
Potion potion = Potion.potionTypes[CommonTickHandler.worldData.potionValues[type]];
- String name = StatCollector
- .translateToLocal(
- potion.getName())
- + " Potion";
+ String name = StatCollector.translateToLocal(potion.getName()) + " Potion";
if (!potion.isInstant()) {
int time = CommonTickHandler.worldData.potionDurations[type];
- name += " (" + time
- + " seconds)";
+ name += " (" + time + " seconds)";
}
- NewPacketHandler.SEND_MESSAGE
- .sendToPlayer(par3EntityPlayer,
- "\u00A7oYou learnt Mystery Potion #"
- + (type + 1)
- + " was a "
- + name
- + "!");
+ NewPacketHandler.SEND_MESSAGE.sendToPlayer(par3EntityPlayer,
+ "\u00A7oYou learnt Mystery Potion #" + (type + 1) + " was a " + name + "!");
}
} else {
Potion potion = Potion.potionTypes[damage];
- String name = StatCollector
- .translateToLocal(
- potion.getName())
- + " Potion";
+ String name = StatCollector.translateToLocal(potion.getName()) + " Potion";
if (!potion.isInstant()) {
name += " (" + j + " seconds)";
}
- NewPacketHandler.SEND_MESSAGE
- .sendToPlayer(par3EntityPlayer,
- "\u00A7oYou threw a "
- + name
- + ".");
+ NewPacketHandler.SEND_MESSAGE.sendToPlayer(par3EntityPlayer,
+ "\u00A7oYou threw a " + name + ".");
}
}
}
- worldObj.playAuxSFX(2002, (int) Math.round(posX),
- (int) Math.round(posY),
- (int) Math.round(posZ), 1);
+ worldObj.playAuxSFX(2002, (int) Math.round(posX), (int) Math.round(posY), (int) Math.round(posZ), 1);
setDead();
}
}
diff --git a/YWD/src/main/java/fyresmodjam/entities/renderers/RenderMysteryPotion.java b/YWD/src/main/java/fyresmodjam/entities/renderers/RenderMysteryPotion.java index ea79e25..43d2c55 100755 --- a/YWD/src/main/java/fyresmodjam/entities/renderers/RenderMysteryPotion.java +++ b/YWD/src/main/java/fyresmodjam/entities/renderers/RenderMysteryPotion.java @@ -26,37 +26,27 @@ public class RenderMysteryPotion extends Render { }
@Override
- public void doRender(Entity par1Entity, double par2, double par4,
- double par6, float par8, float par9) {
+ public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9) {
IIcon icon = (par1Entity instanceof EntityMysteryPotion)
- ? field_94151_a.getIconFromDamage(
- par1Entity.getDataWatcher()
- .getWatchableObjectInt(
- 24))
+ ? field_94151_a.getIconFromDamage(par1Entity.getDataWatcher().getWatchableObjectInt(24))
: field_94151_a.getIconFromDamage(0);
if (icon != null) {
GL11.glPushMatrix();
- GL11.glTranslatef((float) par2, (float) par4,
- (float) par6);
+ GL11.glTranslatef((float) par2, (float) par4, (float) par6);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glScalef(0.5F, 0.5F, 0.5F);
bindEntityTexture(par1Entity);
Tessellator tessellator = Tessellator.instance;
- if (icon == ItemPotion
- .func_94589_d("bottle_splash")) {
- int i = PotionHelper.func_77915_a(
- ((EntityPotion) par1Entity)
- .getPotionDamage(),
- false);
+ if (icon == ItemPotion.func_94589_d("bottle_splash")) {
+ int i = PotionHelper.func_77915_a(((EntityPotion) par1Entity).getPotionDamage(), false);
float f2 = (i >> 16 & 255) / 255.0F;
float f3 = (i >> 8 & 255) / 255.0F;
float f4 = (i & 255) / 255.0F;
GL11.glColor3f(f2, f3, f4);
GL11.glPushMatrix();
- func_77026_a(tessellator, ItemPotion
- .func_94589_d("overlay"));
+ func_77026_a(tessellator, ItemPotion.func_94589_d("overlay"));
GL11.glPopMatrix();
GL11.glColor3f(1.0F, 1.0F, 1.0F);
}
@@ -72,8 +62,7 @@ public class RenderMysteryPotion extends Render { return TextureMap.locationItemsTexture;
}
- private void func_77026_a(Tessellator par1Tessellator,
- IIcon par2Icon) {
+ private void func_77026_a(Tessellator par1Tessellator, IIcon par2Icon) {
float f = par2Icon.getMinU();
float f1 = par2Icon.getMaxU();
float f2 = par2Icon.getMinV();
@@ -81,20 +70,14 @@ public class RenderMysteryPotion extends Render { float f4 = 1.0F;
float f5 = 0.5F;
float f6 = 0.25F;
- GL11.glRotatef(180.0F - renderManager.playerViewY, 0.0F,
- 1.0F, 0.0F);
- GL11.glRotatef(-renderManager.playerViewX, 1.0F, 0.0F,
- 0.0F);
+ GL11.glRotatef(180.0F - renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
+ GL11.glRotatef(-renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
par1Tessellator.startDrawingQuads();
par1Tessellator.setNormal(0.0F, 1.0F, 0.0F);
- par1Tessellator.addVertexWithUV(0.0F - f5, 0.0F - f6, 0.0D,
- f, f3);
- par1Tessellator.addVertexWithUV(f4 - f5, 0.0F - f6, 0.0D,
- f1, f3);
- par1Tessellator.addVertexWithUV(f4 - f5, f4 - f6, 0.0D, f1,
- f2);
- par1Tessellator.addVertexWithUV(0.0F - f5, f4 - f6, 0.0D,
- f, f2);
+ par1Tessellator.addVertexWithUV(0.0F - f5, 0.0F - f6, 0.0D, f, f3);
+ par1Tessellator.addVertexWithUV(f4 - f5, 0.0F - f6, 0.0D, f1, f3);
+ par1Tessellator.addVertexWithUV(f4 - f5, f4 - f6, 0.0D, f1, f2);
+ par1Tessellator.addVertexWithUV(0.0F - f5, f4 - f6, 0.0D, f, f2);
par1Tessellator.draw();
}
}
diff --git a/YWD/src/main/java/fyresmodjam/handlers/BasicPacket.java b/YWD/src/main/java/fyresmodjam/handlers/BasicPacket.java new file mode 100644 index 0000000..dcf9fd8 --- /dev/null +++ b/YWD/src/main/java/fyresmodjam/handlers/BasicPacket.java @@ -0,0 +1,211 @@ +package fyresmodjam.handlers; + +import java.nio.charset.Charset; +import java.util.ArrayList; + +import io.netty.buffer.ByteBuf; +import net.minecraft.entity.player.EntityPlayer; + +public class BasicPacket implements IPacket { + public static Class<?>[] validClassArray = { Integer.class, Boolean.class, String.class, Character.class, + Byte.class, Float.class, Double.class, int[].class, int[][].class }; + public static ArrayList<Class<?>> validClasses = new ArrayList<Class<?>>(); + static { + for (Class<?> c : validClassArray) { + validClasses.add(c); + } + } + + public Object[] data = null; + public byte type; + + public BasicPacket() { + } + + public BasicPacket(int type) { + if (type == 0 || NewPacketHandler.packetTypes[type] != null) { + throw new RuntimeException("Packet slot " + type + " already in use."); + } + + NewPacketHandler.packetTypes[type] = this; + + this.type = (byte) type; + } + + public BasicPacket(BasicPacket packet, Object... data) { + if (isValidPacketType(packet)) { + type = packet.type; + } else { + throw new RuntimeException("Must supply valid packet type."); + } + + Class<?>[] classes = getExpectedClasses(); + + if (classes != null) { + for (Class<?> c : classes) { + if (!validClasses.contains(c)) { + throw new RuntimeException("Argument class not valid. (" + c + ")"); + } + } + + if (data == null || data.length != classes.length) { + throw new RuntimeException("Wrong number of arguments provided."); + } else { + for (int i = 0; i < data.length; i++) { + if (data[i].getClass() != classes[i]) { + throw new RuntimeException("Wrong argument class provided. (" + data[i].getClass() + + ", expected " + classes[i] + ")"); + } + } + } + } + + this.data = data; + } + + private boolean isValidPacketType(BasicPacket packet) { + boolean packetTypeInBounds = packet.type > 0 && packet.type < NewPacketHandler.packetTypes.length; + boolean packetTypeMatches = packet == NewPacketHandler.packetTypes[packet.type]; + + return packetTypeInBounds && packetTypeMatches; + } + + @Override + public void readBytes(ByteBuf bytes) { + type = bytes.readByte(); + + Class<?>[] classes = getExpectedClasses(); + + if (classes != null) { + data = new Object[classes.length]; + + for (int i = 0; i < classes.length; i++) { + if (classes[i] == Integer.class) { + data[i] = bytes.readInt(); + } + if (classes[i] == int[].class) { + int[] array = new int[bytes.readInt()]; + for (int i2 = 0; i2 < array.length; i2++) { + array[i2] = bytes.readInt(); + } + data[i] = array; + } + if (classes[i] == int[][].class) { + int[][] array = new int[bytes.readInt()][]; + + for (int i2 = 0; i2 < array.length; i2++) { + array[i2] = new int[bytes.readInt()]; + for (int i3 = 0; i3 < array[i2].length; i3++) { + array[i2][i3] = bytes.readInt(); + } + } + + data[i] = array; + } else if (classes[i] == Boolean.class) { + data[i] = bytes.readBoolean(); + } else if (classes[i] == String.class) { + int length = bytes.readInt(); + try { + byte[] stringBytes = new byte[length]; + bytes.readBytes(stringBytes); + data[i] = new String(stringBytes, "UTF-8"); + } catch (Exception e) { + e.printStackTrace(); + } + } else if (classes[i] == Byte.class) { + data[i] = bytes.readByte(); + } else if (classes[i] == Float.class) { + data[i] = bytes.readDouble(); + } else if (classes[i] == Double.class) { + data[i] = bytes.readFloat(); + } else if (classes[i] == Character.class) { + data[i] = bytes.readChar(); + } + } + } + } + + @Override + public void writeBytes(ByteBuf bytes) { + bytes.writeByte(type); + + if (data != null) { + for (int i = 0; i < data.length; i++) { + if (data[i] instanceof Integer) { + bytes.writeInt((Integer) data[i]); + } else if (data[i] instanceof int[]) { + bytes.writeInt(((int[]) data[i]).length); + for (int i2 = 0; i2 < ((int[]) data[i]).length; i2++) { + bytes.writeInt(((int[]) data[i])[i2]); + } + } else if (data[i] instanceof int[][]) { + int[][] values = (int[][]) data[i]; + + bytes.writeInt(values.length); + + for (int i2 = 0; i2 < values.length; i2++) { + bytes.writeInt(values[i2].length); + for (int i3 = 0; i3 < values[i2].length; i3++) { + bytes.writeInt(values[i2][i3]); + } + } + } else if (data[i] instanceof Boolean) { + bytes.writeBoolean((Boolean) data[i]); + } else if (data[i] instanceof String) { + byte[] stringBytes = ((String) data[i]).getBytes(Charset.forName("UTF-8")); + bytes.writeInt(stringBytes.length); + bytes.writeBytes(stringBytes); + } else if (data[i] instanceof Byte) { + bytes.writeByte((Byte) data[i]); + } else if (data[i] instanceof Float) { + bytes.writeDouble((Double) data[i]); + } else if (data[i] instanceof Double) { + bytes.writeFloat((Float) data[i]); + } else if (data[i] instanceof Character) { + bytes.writeChar((Character) data[i]); + } + } + } + } + + @Override + public void executeClient(EntityPlayer player) { + if (NewPacketHandler.packetTypes[type] != this) { + NewPacketHandler.packetTypes[type].executeClient(player); + } + } + + @Override + public void executeServer(EntityPlayer player) { + if (NewPacketHandler.packetTypes[type] != this) { + NewPacketHandler.packetTypes[type].executeServer(player); + } + } + + @Override + public void executeBoth(EntityPlayer player) { + if (NewPacketHandler.packetTypes[type] != this) { + NewPacketHandler.packetTypes[type].executeBoth(player); + } + } + + public Class<?>[] getExpectedClasses() { + if (NewPacketHandler.packetTypes[type] != this) { + return NewPacketHandler.packetTypes[type].getExpectedClasses(); + } else { + return null; + } + } + + public void sendToPlayer(EntityPlayer player, Object... data) { + NewPacketHandler.sendPacketToPlayer(new BasicPacket(this, data), player); + } + + public void sendToAllPlayers(Object... data) { + NewPacketHandler.sendPacketToAllPlayers(new BasicPacket(this, data)); + } + + public void sendToServer(Object... data) { + NewPacketHandler.sendPacketToServer(new BasicPacket(this, data)); + } +} diff --git a/YWD/src/main/java/fyresmodjam/handlers/ChannelHandler.java b/YWD/src/main/java/fyresmodjam/handlers/ChannelHandler.java new file mode 100644 index 0000000..82a07c6 --- /dev/null +++ b/YWD/src/main/java/fyresmodjam/handlers/ChannelHandler.java @@ -0,0 +1,72 @@ +package fyresmodjam.handlers; + +import cpw.mods.fml.common.FMLCommonHandler; +import cpw.mods.fml.common.network.FMLIndexedMessageToMessageCodec; +import cpw.mods.fml.common.network.NetworkRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; +import io.netty.channel.ChannelHandlerContext; +import net.minecraft.client.Minecraft; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.network.INetHandler; +import net.minecraft.network.NetHandlerPlayServer; + +public class ChannelHandler extends FMLIndexedMessageToMessageCodec<IPacket> { + + public ChannelHandler() { + addDiscriminator(0, BasicPacket.class); + + } + + @Override + public void encodeInto(ChannelHandlerContext ctx, IPacket packet, ByteBuf data) throws Exception { + packet.writeBytes(data); + } + + @Override + public void decodeInto(ChannelHandlerContext ctx, ByteBuf data, IPacket packet) { + packet.readBytes(data); + + if (packet instanceof BasicPacket) { + NewPacketHandler.packetTypes[((BasicPacket) packet).type].data = ((BasicPacket) packet).data; + } + + EntityPlayer player = null; + + switch (FMLCommonHandler.instance().getEffectiveSide()) { + + case CLIENT: + + player = getClientPlayer(); + + if (player != null) { + packet.executeClient(player); + packet.executeBoth(player); + } + + break; + + case SERVER: + + INetHandler netHandler = ctx.channel().attr(NetworkRegistry.NET_HANDLER).get(); + player = ((NetHandlerPlayServer) netHandler).playerEntity; + + if (player != null) { + packet.executeServer(player); + packet.executeBoth(player); + } + + break; + + default: + break; + + } + } + + @SideOnly(Side.CLIENT) + public EntityPlayer getClientPlayer() { + return Minecraft.getMinecraft().thePlayer; + } +}
\ No newline at end of file diff --git a/YWD/src/main/java/fyresmodjam/handlers/ClientTickHandler.java b/YWD/src/main/java/fyresmodjam/handlers/ClientTickHandler.java index a8bd717..69388db 100755 --- a/YWD/src/main/java/fyresmodjam/handlers/ClientTickHandler.java +++ b/YWD/src/main/java/fyresmodjam/handlers/ClientTickHandler.java @@ -20,36 +20,26 @@ public class ClientTickHandler { public void clientTick(ClientTickEvent event) {
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
- if (System.currentTimeMillis() - time > 200
- && player != null) {
+ if (System.currentTimeMillis() - time > 200 && player != null) {
if (player.openContainer != null) {
boolean sendPacket = false;
for (Object object : player.inventory.mainInventory) {
- if (object == null
- || !(object instanceof ItemStack)) {
+ if (object == null || !(object instanceof ItemStack)) {
continue;
}
ItemStack stack = (ItemStack) object;
- if (stack.getItem() != null
- && !ItemStatHelper.skip
- .contains(stack.getItem()
- .getClass())
- && (stack.getTagCompound() == null
- || !stack.getTagCompound()
- .hasKey("processed")
- || stack.getTagCompound()
- .getString("processed")
- .equals("false"))) {
+ if (stack.getItem() != null && !ItemStatHelper.skip.contains(stack.getItem().getClass())
+ && (stack.getTagCompound() == null || !stack.getTagCompound().hasKey("processed")
+ || stack.getTagCompound().getString("processed").equals("false"))) {
sendPacket = true;
}
}
if (sendPacket) {
- NewPacketHandler.UPDATE_PLAYER_ITEMS
- .sendToServer((Object) null);
+ NewPacketHandler.UPDATE_PLAYER_ITEMS.sendToServer((Object) null);
time = System.currentTimeMillis();
}
}
@@ -57,24 +47,15 @@ public class ClientTickHandler { player.triggerAchievement(ModjamMod.startTheGame);
}
- if (FyresKeyHandler.examine
- .getKeyCode() != ConfigData.examineKey
- || FyresKeyHandler.activateBlessing
- .getKeyCode() != ConfigData.blessingKey) {
- ConfigData.examineKey = FyresKeyHandler.examine
- .getKeyCode();
- ConfigData.blessingKey = FyresKeyHandler.activateBlessing
- .getKeyCode();
+ if (FyresKeyHandler.examine.getKeyCode() != ConfigData.examineKey
+ || FyresKeyHandler.activateBlessing.getKeyCode() != ConfigData.blessingKey) {
+ ConfigData.examineKey = FyresKeyHandler.examine.getKeyCode();
+ ConfigData.blessingKey = FyresKeyHandler.activateBlessing.getKeyCode();
- Configuration config = new Configuration(
- new File(ModjamMod.configPath));
+ Configuration config = new Configuration(new File(ModjamMod.configPath));
config.load();
- config.get("Keybindings", "examine_key",
- ConfigData.examineKey)
- .set(ConfigData.examineKey);
- config.get("Keybindings", "blessing_key",
- ConfigData.blessingKey)
- .set(ConfigData.blessingKey);
+ config.get("Keybindings", "examine_key", ConfigData.examineKey).set(ConfigData.examineKey);
+ config.get("Keybindings", "blessing_key", ConfigData.blessingKey).set(ConfigData.blessingKey);
config.save();
}
}
diff --git a/YWD/src/main/java/fyresmodjam/handlers/CommonTickHandler.java b/YWD/src/main/java/fyresmodjam/handlers/CommonTickHandler.java index 1a50f3f..2df3e3a 100755 --- a/YWD/src/main/java/fyresmodjam/handlers/CommonTickHandler.java +++ b/YWD/src/main/java/fyresmodjam/handlers/CommonTickHandler.java @@ -26,10 +26,8 @@ public class CommonTickHandler { @SubscribeEvent
public void worldTick(WorldTickEvent event) {
if (event.phase == TickEvent.Phase.START) {
- if (event.world != null
- && event.world.provider.dimensionId == 0) {
- worldData = FyresWorldData
- .forWorld(event.world);
+ if (event.world != null && event.world.provider.dimensionId == 0) {
+ worldData = FyresWorldData.forWorld(event.world);
worldData.markDirty();
}
}
@@ -37,12 +35,10 @@ public class CommonTickHandler { @SubscribeEvent
public void serverTick(ServerTickEvent event) {
- MinecraftServer server = FMLCommonHandler.instance()
- .getMinecraftServerInstance();
+ MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
for (int i = 0; i < server.worldServers.length; i++) {
- WorldServer s = FMLCommonHandler.instance()
- .getMinecraftServerInstance().worldServers[i];
+ WorldServer s = FMLCommonHandler.instance().getMinecraftServerInstance().worldServers[i];
if (s == null) {
continue;
@@ -57,10 +53,8 @@ public class CommonTickHandler { String blessing;
- if (player.getEntityData()
- .hasKey("Blessing")) {
- blessing = player.getEntityData()
- .getString("Blessing");
+ if (player.getEntityData().hasKey("Blessing")) {
+ blessing = player.getEntityData().getString("Blessing");
} else {
blessing = null;
}
@@ -69,32 +63,21 @@ public class CommonTickHandler { boolean blessingActive;
- if (EntityStatHelper.hasStat(player,
- "BlessingActive")) {
- blessingActive = Boolean
- .parseBoolean(EntityStatHelper
- .getStat(player, "BlessingActive"));
+ if (EntityStatHelper.hasStat(player, "BlessingActive")) {
+ blessingActive = Boolean.parseBoolean(EntityStatHelper.getStat(player, "BlessingActive"));
} else {
blessingActive = false;
}
- if (EntityStatHelper.hasStat(player,
- "BlessingCooldown")) {
- coolDown = Integer.parseInt(
- EntityStatHelper.getStat(
- player,
- "BlessingCooldown"));
+ if (EntityStatHelper.hasStat(player, "BlessingCooldown")) {
+ coolDown = Integer.parseInt(EntityStatHelper.getStat(player, "BlessingCooldown"));
if (coolDown > 0) {
coolDown--;
}
}
- if (EntityStatHelper.hasStat(player,
- "BlessingTimer")) {
- timer = Integer.parseInt(
- EntityStatHelper.getStat(
- player,
- "BlessingTimer"));
+ if (EntityStatHelper.hasStat(player, "BlessingTimer")) {
+ timer = Integer.parseInt(EntityStatHelper.getStat(player, "BlessingTimer"));
if (blessingActive) {
timer++;
} else {
@@ -102,25 +85,16 @@ public class CommonTickHandler { }
}
- if (EntityStatHelper.hasStat(player,
- "BlessingCounter")) {
- counter = Integer.parseInt(
- EntityStatHelper.getStat(
- player,
- "BlessingCounter"));
+ if (EntityStatHelper.hasStat(player, "BlessingCounter")) {
+ counter = Integer.parseInt(EntityStatHelper.getStat(player, "BlessingCounter"));
if (BlessingUtils.hasBlessing(player)) {
- if (blessingActive
- && BlessingUtils.hasBlessing(player, "BlessingBerserker")
+ if (blessingActive && BlessingUtils.hasBlessing(player, "BlessingBerserker")
&& timer % 40 == 0) {
- counter = Math.max(
- 0,
- counter - 1);
+ counter = Math.max(0, counter - 1);
if (counter == 0) {
- NewPacketHandler.SEND_MESSAGE
- .sendToPlayer(player,
- "\u00A7cYou calm down.");
+ NewPacketHandler.SEND_MESSAGE.sendToPlayer(player, "\u00A7cYou calm down.");
coolDown = 1200;
timer = 0;
blessingActive = false;
@@ -133,29 +107,15 @@ public class CommonTickHandler { BlessingUtils.getBlessingInstance(blessing).commonTick(event, player);
}
- if (EntityStatHelper.hasStat(player,
- "BlessingCounter")
- && Integer.parseInt(
- EntityStatHelper.getStat(
- player,
- "BlessingCounter")) != counter) {
- NewPacketHandler.UPDATE_STAT
- .sendToPlayer(player,
- "BlessingCounter",
- "" + counter);
+ if (EntityStatHelper.hasStat(player, "BlessingCounter")
+ && Integer.parseInt(EntityStatHelper.getStat(player, "BlessingCounter")) != counter) {
+ NewPacketHandler.UPDATE_STAT.sendToPlayer(player, "BlessingCounter", "" + counter);
}
- EntityStatHelper.giveStat(player,
- "BlessingActive",
- blessingActive);
- EntityStatHelper.giveStat(player,
- "BlessingCooldown",
- coolDown);
- EntityStatHelper.giveStat(player,
- "BlessingCounter",
- counter);
- EntityStatHelper.giveStat(player,
- "BlessingTimer", timer);
+ EntityStatHelper.giveStat(player, "BlessingActive", blessingActive);
+ EntityStatHelper.giveStat(player, "BlessingCooldown", coolDown);
+ EntityStatHelper.giveStat(player, "BlessingCounter", counter);
+ EntityStatHelper.giveStat(player, "BlessingTimer", timer);
}
@@ -168,128 +128,77 @@ public class CommonTickHandler { EntityItem item = (EntityItem) o;
if (((EntityItem) o).isBurning()) {
- ItemStack stack = item
- .getDataWatcher()
- .getWatchableObjectItemStack(
- 10);
+ ItemStack stack = item.getDataWatcher().getWatchableObjectItemStack(10);
- if (canAdvanceBurnTaskProgress(
- stack)) {
+ if (canAdvanceBurnTaskProgress(stack)) {
worldData.progress += stack.stackSize;
((EntityItem) o).isDead = true;
String name1;
- if (CommonTickHandler.worldData.currentTask
- .equals("Kill")) {
+ if (CommonTickHandler.worldData.currentTask.equals("Kill")) {
name1 = FyresWorldData.validMobNames[CommonTickHandler.worldData.currentTaskID];
} else {
name1 = FyresWorldData.validItems[CommonTickHandler.worldData.currentTaskID]
.getDisplayName();
}
- if (name1.contains(
- "Block")) {
- if (name1.contains(
- "Block")) {
- name1 = name1.replace(
- "Block",
- "Blocks")
- .replace("block",
- "blocks");
+ if (name1.contains("Block")) {
+ if (name1.contains("Block")) {
+ name1 = name1.replace("Block", "Blocks").replace("block", "blocks");
}
} else {
name1 += "s";
}
- NewPacketHandler.SEND_MESSAGE
- .sendToAllPlayers(
- "\u00A7fCurrent Goal Progress: "
- + worldData.progress
- + "/"
- + worldData.currentTaskAmount
- + " "
- + name1
- + " "
- + worldData.currentTask
- + "ed.");
+ NewPacketHandler.SEND_MESSAGE.sendToAllPlayers("\u00A7fCurrent Goal Progress: "
+ + worldData.progress + "/" + worldData.currentTaskAmount + " " + name1 + " "
+ + worldData.currentTask + "ed.");
if (worldData.progress >= worldData.currentTaskAmount) {
worldData.progress = 0;
worldData.tasksCompleted++;
- NewPacketHandler.LEVEL_UP
- .sendToAllPlayers(
- worldData.rewardLevels);
+ NewPacketHandler.LEVEL_UP.sendToAllPlayers(worldData.rewardLevels);
worldData.giveNewTask();
String name;
- if (worldData.currentTask
- .equals("Kill")) {
+ if (worldData.currentTask.equals("Kill")) {
name = FyresWorldData.validMobNames[worldData.currentTaskID];
} else {
- name = FyresWorldData.validItems[worldData.currentTaskID]
- .getDisplayName();
+ name = FyresWorldData.validItems[worldData.currentTaskID].getDisplayName();
}
if (worldData.currentTaskAmount > 1) {
- if (name.contains(
- "Block")) {
- if (name.contains(
- "Block")) {
- name = name.replace(
- "Block",
- "Blocks")
- .replace("block",
- "blocks");
+ if (name.contains("Block")) {
+ if (name.contains("Block")) {
+ name = name.replace("Block", "Blocks").replace("block", "blocks");
}
} else {
name += "s";
}
}
- NewPacketHandler.SEND_MESSAGE
- .sendToAllPlayers(
- "\u00A7eA world goal has been completed!"
- + (!worldData.getDisadvantage()
- .equals("None") ? " World disadvantage has been lifted!"
- : ""));
-
- NewPacketHandler.SEND_MESSAGE
- .sendToAllPlayers(
- "\u00A7eA new world goal has been set: "
- + (worldData.currentTask
- + " "
- + worldData.currentTaskAmount
- + " "
- + name
- + ". ("
- + worldData.progress
- + " "
- + worldData.currentTask
- + "ed)"));
+ NewPacketHandler.SEND_MESSAGE.sendToAllPlayers("\u00A7eA world goal has been completed!"
+ + (!worldData.getDisadvantage().equals("None")
+ ? " World disadvantage has been lifted!"
+ : ""));
+
+ NewPacketHandler.SEND_MESSAGE.sendToAllPlayers("\u00A7eA new world goal has been set: "
+ + (worldData.currentTask + " " + worldData.currentTaskAmount + " " + name
+ + ". (" + worldData.progress + " " + worldData.currentTask + "ed)"));
worldData.currentDisadvantage = "None";
}
- NewPacketHandler.UPDATE_WORLD_DATA
- .sendToAllPlayers(
- worldData.potionValues,
- worldData.potionDurations,
- worldData.getDisadvantage(),
- worldData.currentTask,
- worldData.currentTaskID,
- worldData.currentTaskAmount,
- worldData.progress,
- worldData.tasksCompleted,
- worldData.enderDragonKilled,
- ConfigData.spawnTraps,
- worldData.rewardLevels,
- worldData.mushroomColors);
-
- worldData.setDirty(
- true);
+ NewPacketHandler.UPDATE_WORLD_DATA.sendToAllPlayers(worldData.potionValues,
+ worldData.potionDurations, worldData.getDisadvantage(), worldData.currentTask,
+ worldData.currentTaskID, worldData.currentTaskAmount, worldData.progress,
+ worldData.tasksCompleted, worldData.enderDragonKilled, ConfigData.spawnTraps,
+ worldData.rewardLevels, worldData.mushroomColors);
+
+ worldData.setDirty(true);
}
}
}
@@ -299,8 +208,7 @@ public class CommonTickHandler { for (Entity e : addLater) {
WorldServer world = null;
- for (WorldServer s : MinecraftServer
- .getServer().worldServers) {
+ for (WorldServer s : MinecraftServer.getServer().worldServers) {
if (s.provider.dimensionId == e.dimension) {
world = s;
break;
@@ -315,30 +223,16 @@ public class CommonTickHandler { addLater.clear();
if (worldData != null) {
- if (worldData.getDisadvantage()
- .equals("Neverending Rain")) {
- if (!MinecraftServer
- .getServer().worldServers[0]
- .getWorldInfo()
- .isRaining()) {
- MinecraftServer.getServer().worldServers[0]
- .getWorldInfo()
- .setRaining(true);
+ if (worldData.getDisadvantage().equals("Neverending Rain")) {
+ if (!MinecraftServer.getServer().worldServers[0].getWorldInfo().isRaining()) {
+ MinecraftServer.getServer().worldServers[0].getWorldInfo().setRaining(true);
}
- if (!MinecraftServer
- .getServer().worldServers[0]
- .getWorldInfo()
- .isThundering()) {
- MinecraftServer.getServer().worldServers[0]
- .getWorldInfo()
- .setThundering(true);
+ if (!MinecraftServer.getServer().worldServers[0].getWorldInfo().isThundering()) {
+ MinecraftServer.getServer().worldServers[0].getWorldInfo().setThundering(true);
}
- } else if (worldData.getDisadvantage()
- .equals("Neverending Night")) {
- MinecraftServer.getServer().worldServers[0]
- .getWorldInfo()
- .setWorldTime(18000);
+ } else if (worldData.getDisadvantage().equals("Neverending Night")) {
+ MinecraftServer.getServer().worldServers[0].getWorldInfo().setWorldTime(18000);
}
}
}
@@ -346,17 +240,18 @@ public class CommonTickHandler { private boolean canAdvanceBurnTaskProgress(ItemStack stack) {
String task = worldData.currentTask;
- if(task == null || !(task.equals("Burn"))) return false;
+ if (task == null || !(task.equals("Burn")))
+ return false;
- if(stack != null && stack.getItem() != null) {
+ if (stack != null && stack.getItem() != null) {
ItemStack target = FyresWorldData.validItems[worldData.currentTaskID];
- if(target != null && target.getItem() != null) {
- if(stack.getItem() != target.getItem()) {
+ if (target != null && target.getItem() != null) {
+ if (stack.getItem() != target.getItem()) {
return false;
}
- if(stack.getItemDamage() != target.getItemDamage()) {
+ if (stack.getItemDamage() != target.getItemDamage()) {
return false;
}
diff --git a/YWD/src/main/java/fyresmodjam/handlers/FyresKeyHandler.java b/YWD/src/main/java/fyresmodjam/handlers/FyresKeyHandler.java index 4b3dd35..55cb2ed 100755 --- a/YWD/src/main/java/fyresmodjam/handlers/FyresKeyHandler.java +++ b/YWD/src/main/java/fyresmodjam/handlers/FyresKeyHandler.java @@ -16,21 +16,16 @@ import fyresmodjam.tileentities.TileEntityTrap; import net.minecraft.client.Minecraft;
import net.minecraft.client.settings.KeyBinding;
import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.MovingObjectPosition.MovingObjectType;
public class FyresKeyHandler {
- public static KeyBinding examine = new KeyBinding(
- "Examine", Keyboard.KEY_X, "YWD");
- public static KeyBinding activateBlessing = new KeyBinding(
- "Activate Blessing", Keyboard.KEY_K, "YWD");
+ public static KeyBinding examine = new KeyBinding("Examine", Keyboard.KEY_X, "YWD");
+ public static KeyBinding activateBlessing = new KeyBinding("Activate Blessing", Keyboard.KEY_K, "YWD");
- public static KeyBinding[] keyBindings = new KeyBinding[] {
- examine, activateBlessing
- };
+ public static KeyBinding[] keyBindings = new KeyBinding[] { examine, activateBlessing };
public FyresKeyHandler() {
for (KeyBinding k : keyBindings) {
@@ -46,143 +41,84 @@ public class FyresKeyHandler { if (player != null) {
if (examine.isPressed()) {
- if (minecraft.objectMouseOver != null) {
-
- MovingObjectPosition o = minecraft.objectMouseOver;
-
- if (o.typeOfHit == MovingObjectType.BLOCK) {
- int x = minecraft.objectMouseOver.blockX;
- int y = minecraft.objectMouseOver.blockY;
- int z = minecraft.objectMouseOver.blockZ;
-
- if (minecraft.theWorld
- .getBlock(x, y, z) == ModjamMod.blockPillar
- && (minecraft.theWorld
- .getBlockMetadata(
- x,
- y,
- z)
- % 2) == 1) {
- y--;
- }
-
- TileEntity te = minecraft.theWorld
- .getTileEntity(x,
- y,
- z);
-
- if (te != null && te instanceof TileEntityPillar) {
- Blessing bless = BlessingUtils
- .getBlessingInstance(
- ((TileEntityPillar) te).blessing);
-
- String s = "@\u00A7e "
- + bless.customName()
- + "\n"
- + bless.description()
- + ".";
-
- for (String s2 : s
- .split("@")) {
-
- NewPacketHandler.SEND_MESSAGE.data = new Object[] {
- s2
- };
- NewPacketHandler.SEND_MESSAGE
- .executeClient(Minecraft
- .getMinecraft().thePlayer);
- }
-
- } else if (te != null
- && te instanceof TileEntityTrap) {
- String placedBy = ((TileEntityTrap) te).placedBy;
-
- String s = (placedBy != null
- ? "\u00A7eThis " + ItemTrap.names[te
- .getBlockMetadata()
- % BlockTrap.trapTypes]
- .toLowerCase()
- + " was placed by "
- + (placedBy.equals(
- player.getCommandSenderName())
- ? "you"
- : placedBy)
- + "."
- : "\u00A7eThis " + ItemTrap.names[te
- .getBlockMetadata()
- % BlockTrap.trapTypes]
- .toLowerCase()
- + " doesn't seem to have been placed by anyone.");
- s += " \u00A7eTrap is set to "
- + TileEntityTrap.settings[((TileEntityTrap) te).setting]
- + ".";
-
- NewPacketHandler.SEND_MESSAGE.data = new Object[] {
- s
- };
- NewPacketHandler.SEND_MESSAGE
- .executeClient(Minecraft
- .getMinecraft().thePlayer);
- } else {
- ItemStack stack = new ItemStack(
- minecraft.theWorld
- .getBlock(x, y, z),
- 1,
- minecraft.theWorld
- .getBlockMetadata(
- x,
- y,
- z));
-
- if (stack.getItem() != null) {
- String name = stack
- .getDisplayName()
- .toLowerCase();
-
- NewPacketHandler.SEND_MESSAGE.data = new Object[] {
- "\u00A7eIt's a " + name
- + (!name.contains(
- "block") ? " block."
- : ".")
- };
- NewPacketHandler.SEND_MESSAGE
- .executeClient(Minecraft
- .getMinecraft().thePlayer);
- }
- }
- } else if (o.typeOfHit == MovingObjectType.ENTITY
- && o.entityHit != null) {
- NewPacketHandler.EXAMINE_MOB
- .sendToServer(o.entityHit.dimension,
- o.entityHit.getEntityId());
- }
- }
+ doExamine(minecraft, player);
}
if (activateBlessing.isPressed()) {
- String blessing = player
- .getEntityData()
- .getString("Blessing");
-
- if (blessing != null) {
- FMLLog.info("Triggering blessing");
-
- if (minecraft.objectMouseOver != null) {
- MovingObjectPosition o = minecraft.objectMouseOver;
- if (o.typeOfHit == MovingObjectType.BLOCK) {
- NewPacketHandler.ACTIVATE_BLESSING
- .sendToServer(minecraft.objectMouseOver.blockX,
- minecraft.objectMouseOver.blockY,
- minecraft.objectMouseOver.blockZ);
- }
- } else {
- NewPacketHandler.ACTIVATE_BLESSING
- .sendToServer(player.chunkCoordX,
- player.chunkCoordY,
- player.chunkCoordZ);
- }
+ doActivateBlessing(minecraft, player);
+ }
+ }
+ }
+ }
+
+ private void doActivateBlessing(Minecraft minecraft, EntityPlayer player) {
+ String blessing = player.getEntityData().getString("Blessing");
+
+ if (blessing != null) {
+ FMLLog.info("Triggering blessing");
+
+ if (minecraft.objectMouseOver != null) {
+ MovingObjectPosition o = minecraft.objectMouseOver;
+ if (o.typeOfHit == MovingObjectType.BLOCK) {
+ NewPacketHandler.ACTIVATE_BLESSING.sendToServer(minecraft.objectMouseOver.blockX,
+ minecraft.objectMouseOver.blockY, minecraft.objectMouseOver.blockZ);
+ }
+ } else {
+ NewPacketHandler.ACTIVATE_BLESSING.sendToServer(player.chunkCoordX, player.chunkCoordY,
+ player.chunkCoordZ);
+ }
+ }
+ }
+
+ private void doExamine(Minecraft minecraft, EntityPlayer player) {
+ if (minecraft.objectMouseOver != null) {
+ MovingObjectPosition o = minecraft.objectMouseOver;
+
+ if (o.typeOfHit == MovingObjectType.BLOCK) {
+ int x = minecraft.objectMouseOver.blockX;
+ int y = minecraft.objectMouseOver.blockY;
+ int z = minecraft.objectMouseOver.blockZ;
+
+ if (minecraft.theWorld.getBlock(x, y, z) == ModjamMod.blockPillar
+ && (minecraft.theWorld.getBlockMetadata(x, y, z) % 2) == 1) {
+ y--;
+ }
+
+ TileEntity te = minecraft.theWorld.getTileEntity(x, y, z);
+
+ if (te != null && te instanceof TileEntityPillar) {
+ Blessing bless = BlessingUtils.getBlessingInstance(((TileEntityPillar) te).blessing);
+
+ String s = "@\u00A7e " + bless.customName() + "\n" + bless.description() + ".";
+
+ for (String s2 : s.split("@")) {
+
+ NewPacketHandler.SEND_MESSAGE.data = new Object[] { s2 };
+ NewPacketHandler.SEND_MESSAGE.executeClient(Minecraft.getMinecraft().thePlayer);
}
+
+ } else if (te != null && te instanceof TileEntityTrap) {
+ String placedBy = ((TileEntityTrap) te).placedBy;
+
+ String s = (placedBy != null
+ ? "\u00A7eThis " + ItemTrap.names[te.getBlockMetadata() % BlockTrap.trapTypes].toLowerCase()
+ + " was placed by "
+ + (placedBy.equals(player.getCommandSenderName()) ? "you" : placedBy) + "."
+ : "\u00A7eThis " + ItemTrap.names[te.getBlockMetadata() % BlockTrap.trapTypes].toLowerCase()
+ + " doesn't seem to have been placed by anyone.");
+ s += " \u00A7eTrap is set to " + TileEntityTrap.settings[((TileEntityTrap) te).setting] + ".";
+
+ NewPacketHandler.SEND_MESSAGE.data = new Object[] { s };
+ NewPacketHandler.SEND_MESSAGE.executeClient(Minecraft.getMinecraft().thePlayer);
+ } else {
+ String name = minecraft.theWorld.getBlock(x, y, z).getLocalizedName().toLowerCase();
+
+ NewPacketHandler.SEND_MESSAGE.data = new Object[] {
+ "\u00A7eIt's a " + name + (!name.contains("block") ? " block." : ".") };
+ NewPacketHandler.SEND_MESSAGE.executeClient(Minecraft.getMinecraft().thePlayer);
}
+ } else if (o.typeOfHit == MovingObjectType.ENTITY && o.entityHit != null) {
+ NewPacketHandler.EXAMINE_MOB.sendToServer(o.entityHit.dimension, o.entityHit.getEntityId());
}
}
}
diff --git a/YWD/src/main/java/fyresmodjam/handlers/GUIHandler.java b/YWD/src/main/java/fyresmodjam/handlers/GUIHandler.java index 207a569..eb61f54 100755 --- a/YWD/src/main/java/fyresmodjam/handlers/GUIHandler.java +++ b/YWD/src/main/java/fyresmodjam/handlers/GUIHandler.java @@ -7,14 +7,12 @@ import net.minecraft.world.World; public class GUIHandler implements IGuiHandler {
@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) {
return null;
}
@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) {
return null;
}
diff --git a/YWD/src/main/java/fyresmodjam/handlers/IPacket.java b/YWD/src/main/java/fyresmodjam/handlers/IPacket.java new file mode 100644 index 0000000..558c28b --- /dev/null +++ b/YWD/src/main/java/fyresmodjam/handlers/IPacket.java @@ -0,0 +1,16 @@ +package fyresmodjam.handlers; + +import io.netty.buffer.ByteBuf; +import net.minecraft.entity.player.EntityPlayer; + +public interface IPacket { + public void readBytes(ByteBuf bytes); + + public void writeBytes(ByteBuf bytes); + + public void executeClient(EntityPlayer player); + + public void executeServer(EntityPlayer player); + + public void executeBoth(EntityPlayer player); +}
\ No newline at end of file diff --git a/YWD/src/main/java/fyresmodjam/handlers/NewPacketHandler.java b/YWD/src/main/java/fyresmodjam/handlers/NewPacketHandler.java index 787a8c9..9a85d40 100755 --- a/YWD/src/main/java/fyresmodjam/handlers/NewPacketHandler.java +++ b/YWD/src/main/java/fyresmodjam/handlers/NewPacketHandler.java @@ -1,30 +1,19 @@ package fyresmodjam.handlers;
-import java.nio.charset.Charset;
-import java.util.ArrayList;
-
-import cpw.mods.fml.common.FMLCommonHandler;
-import cpw.mods.fml.common.network.FMLIndexedMessageToMessageCodec;
import cpw.mods.fml.common.network.FMLOutboundHandler;
-import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.relauncher.Side;
-import cpw.mods.fml.relauncher.SideOnly;
import fyresmodjam.ModjamMod;
import fyresmodjam.blessings.BlessingUtils;
import fyresmodjam.blocks.BlockTrap;
+import fyresmodjam.misc.DamageSources;
import fyresmodjam.misc.EntityStatHelper;
import fyresmodjam.misc.ItemStatHelper;
import fyresmodjam.tileentities.TileEntityTrap;
-import io.netty.buffer.ByteBuf;
-import io.netty.channel.ChannelHandlerContext;
-import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
-import net.minecraft.network.INetHandler;
-import net.minecraft.network.NetHandlerPlayServer;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.server.MinecraftServer;
@@ -38,933 +27,378 @@ public class NewPacketHandler { public static BasicPacket[] packetTypes = new BasicPacket[256];
- public static int[] potionValues = new int[12];
- public static int[] potionDurations = new int[12];
+ public static int[] potionValues = new int[12];
+ public static int[] potionDurations = new int[12];
public static int[][] mushroomColors = new int[13][2];
public static String currentDisadvantage = null;
- public static String currentTask = null;
- public static int currentTaskID = -1;
- public static int currentTaskAmount = 0;
- public static int progress = 0;
- public static int tasksCompleted = 0;
- public static int rewardLevels = 0;
-
- public static boolean enderDragonKilled = false;
- public static boolean trapsDisabled = false;
-
- public static interface IPacket {
- public void readBytes(ByteBuf bytes);
+ public static String currentTask = null;
+ public static int currentTaskID = -1;
+ public static int currentTaskAmount = 0;
+ public static int progress = 0;
+ public static int tasksCompleted = 0;
+ public static int rewardLevels = 0;
- public void writeBytes(ByteBuf bytes);
+ public static boolean enderDragonKilled = false;
+ public static boolean trapsDisabled = false;
- public void executeClient(EntityPlayer player);
+ public static void sendPacketToPlayer(IPacket packet, EntityPlayer player) {
+ ModjamMod.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET)
+ .set(FMLOutboundHandler.OutboundTarget.PLAYER);
+ ModjamMod.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(player);
+ ModjamMod.channels.get(Side.SERVER).writeOutbound(packet);
+ }
- public void executeServer(EntityPlayer player);
+ public static void sendPacketToAllPlayers(IPacket packet) {
+ ModjamMod.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET)
+ .set(FMLOutboundHandler.OutboundTarget.ALL);
+ ModjamMod.channels.get(Side.SERVER).writeOutbound(packet);
+ }
- public void executeBoth(EntityPlayer player);
+ public static void sendPacketToServer(IPacket packet) {
+ ModjamMod.channels.get(Side.CLIENT).attr(FMLOutboundHandler.FML_MESSAGETARGET)
+ .set(FMLOutboundHandler.OutboundTarget.TOSERVER);
+ ModjamMod.channels.get(Side.CLIENT).writeOutbound(packet);
}
- public static class ChannelHandler
- extends FMLIndexedMessageToMessageCodec<IPacket> {
+ public static final BasicPacket UPDATE_BLESSING = new BasicPacket(1) {
+ @Override
+ public void executeBoth(EntityPlayer player) {
+ player.getEntityData().setString("Blessing", (String) data[0]);
+ }
+
+ @Override
+ public Class[] getExpectedClasses() {
+ return new Class[] { String.class };
+ }
+ };
- public ChannelHandler() {
- addDiscriminator(0, BasicPacket.class);
+ public static final BasicPacket PLAY_SOUND = new BasicPacket(2) {
+ @Override
+ public void executeServer(EntityPlayer player) {
+ String sound = (String) data[0];
+ int x = (Integer) data[1], y = (Integer) data[2], z = (Integer) data[3];
+ player.worldObj.playSound(x, y, z, "fyresmodjam:" + sound, 1.0F, 1.0F, false);
+ }
+ @Override
+ public Class[] getExpectedClasses() {
+ return new Class[] { String.class, Integer.class, Integer.class, Integer.class };
}
+ };
+ public static final BasicPacket UPDATE_POTION_KNOWLEDGE = new BasicPacket(3) {
@Override
- public void encodeInto(ChannelHandlerContext ctx,
- IPacket packet, ByteBuf data)
- throws Exception {
- packet.writeBytes(data);
+ public void executeBoth(EntityPlayer player) {
+ player.getEntityData().setIntArray("PotionKnowledge", (int[]) data[0]);
}
@Override
- public void decodeInto(ChannelHandlerContext ctx,
- ByteBuf data, IPacket packet) {
- packet.readBytes(data);
+ public Class[] getExpectedClasses() {
+ return new Class[] { int[].class };
+ }
+ };
- if (packet instanceof BasicPacket) {
- packetTypes[((BasicPacket) packet).type].data = ((BasicPacket) packet).data;
- }
+ public static final BasicPacket SEND_MESSAGE = new BasicPacket(4) {
+ @Override
+ public void executeClient(EntityPlayer player) {
+ String style = "";
- EntityPlayer player = null;
+ for (String s : ((String) data[0]).split("@")) {
+ String[] words = s.split(" ");
+ s = "";
- switch (FMLCommonHandler.instance()
- .getEffectiveSide()) {
+ for (String word : words) {
+ s += style + word + " ";
- case CLIENT:
+ while (word.contains("\u00A7")) {
+ int firstOccurance = word.indexOf("\u00A7");
+ String string = word.substring(firstOccurance, firstOccurance + 2);
- player = getClientPlayer();
+ if (style.contains(string)) {
+ style = style.replace(string, "");
+ }
+ style += string;
+ if (string.equals("\u00A7r")) {
+ style = "";
+ }
- if (player != null) {
- packet.executeClient(
- player);
- packet.executeBoth(player);
+ word = word.replaceFirst(string, "");
}
+ }
- break;
-
- case SERVER:
+ player.addChatComponentMessage(new ChatComponentText(s));
+ }
+ }
- INetHandler netHandler = ctx
- .channel()
- .attr(NetworkRegistry.NET_HANDLER)
- .get();
- player = ((NetHandlerPlayServer) netHandler).playerEntity;
+ @Override
+ public Class[] getExpectedClasses() {
+ return new Class[] { String.class };
+ }
+ };
- if (player != null) {
- packet.executeServer(
- player);
- packet.executeBoth(player);
- }
+ public static final BasicPacket UPDATE_WORLD_DATA = new BasicPacket(5) {
+ @Override
+ public void executeClient(EntityPlayer player) {
+ potionValues = (int[]) data[0];
+ potionDurations = (int[]) data[1];
+ currentDisadvantage = (String) data[2];
+ currentTask = (String) data[3];
+ currentTaskID = (Integer) data[4];
+ currentTaskAmount = (Integer) data[5];
+ progress = (Integer) data[6];
+ tasksCompleted = (Integer) data[7];
+ enderDragonKilled = (Boolean) data[8];
+ trapsDisabled = !((Boolean) data[9]);
+ rewardLevels = (Integer) data[10];
+ mushroomColors = (int[][]) data[11];
+ }
- break;
+ @Override
+ public Class[] getExpectedClasses() {
+ return new Class[] { int[].class, int[].class, String.class, String.class, Integer.class, Integer.class,
+ Integer.class, Integer.class, Boolean.class, Boolean.class, Integer.class, int[][].class };
+ }
+ };
- default:
- break;
+ public static final BasicPacket UPDATE_PLAYER_ITEMS = new BasicPacket(6) {
+ @Override
+ public void executeServer(EntityPlayer player) {
+ for (Object stack : player.inventory.mainInventory) {
+ if (stack == null || !(stack instanceof ItemStack)) {
+ continue;
+ }
+ ItemStatHelper.processItemStack((ItemStack) stack, ModjamMod.r);
}
}
- @SideOnly(Side.CLIENT)
- public EntityPlayer getClientPlayer() {
- return Minecraft.getMinecraft().thePlayer;
+ @Override
+ public Class[] getExpectedClasses() {
+ return null;
}
- }
+ };
- public static class BasicPacket implements IPacket {
- public static Class[] validClassArray = {
- Integer.class, Boolean.class, String.class,
- Character.class, Byte.class, Float.class,
- Double.class, int[].class, int[][].class
- };
- public static ArrayList<Class> validClasses = new ArrayList<Class>();
- static {
- for (Class c : validClassArray) {
- validClasses.add(c);
- }
- }
+ public final static BasicPacket DISARM_TRAP = new BasicPacket(7) {
+ @Override
+ public void executeServer(EntityPlayer player) {
+ int blockX = (Integer) data[0], blockY = (Integer) data[1], blockZ = (Integer) data[2];
+ boolean mechanic = (Boolean) data[3];
- public Object[] data = null;
- public byte type;
+ boolean isScout = BlessingUtils.hasBlessing(player, "MarkScouting");
- public BasicPacket() {
- }
+ TileEntity te = player.worldObj.getTileEntity(blockX, blockY, blockZ);
- public BasicPacket(int type) {
- if (type == 0 || packetTypes[type] != null) {
- throw new RuntimeException("Packet slot "
- + type
- + " already in use.");
- }
- packetTypes[type] = this;
- this.type = (byte) type;
- }
+ boolean isValidTrap = te == null || !(te instanceof TileEntityTrap);
+ boolean yours = isValidTrap ? false : player.getCommandSenderName().equals(((TileEntityTrap) te).placedBy);
- public BasicPacket(BasicPacket packet, Object... data) {
- if (packet.type > 0
- && packet.type < packetTypes.length
- && packet == packetTypes[packet.type]) {
- type = packet.type;
- } else {
- throw new RuntimeException(
- "Must supply valid packet type.");
- }
+ if (yours || (mechanic ? ModjamMod.r.nextInt(4) != 0 : ModjamMod.r.nextInt(4) == 0)) {
+ boolean salvage = yours || (mechanic ? ModjamMod.r.nextBoolean() : (ModjamMod.r.nextInt(4) == 0));
- Class[] classes = getExpectedClasses();
+ SEND_MESSAGE.sendToPlayer(player,
+ "\u00A7e\u00A7o" + (!salvage ? "You disarmed the trap." : "You disarm and salvage the trap."));
- if (classes != null) {
- for (Class c : classes) {
- if (!validClasses.contains(c)) {
- throw new RuntimeException(
- "Argument class not valid. ("
- + c
- + ")");
- }
- }
+ if (salvage) {
+ ItemStack spawned = new ItemStack(ModjamMod.itemTrap, 1,
+ player.worldObj.getBlockMetadata(blockX, blockY, blockZ) % BlockTrap.trapTypes);
- if (data == null || data.length != classes.length) {
- throw new RuntimeException(
- "Wrong number of arguments provided.");
- } else {
- for (int i = 0; i < data.length; i++) {
- if (data[i].getClass() != classes[i]) {
- throw new RuntimeException(
- "Wrong argument class provided. ("
- + data[i].getClass()
- + ", expected "
- + classes[i]
- + ")");
- }
- }
+ player.worldObj.spawnEntityInWorld(
+ new EntityItem(player.worldObj, blockX + 0.5F, blockY, blockZ + 0.5F, spawned));
}
- }
- this.data = data;
- }
+ player.worldObj.setBlockToAir(blockX, blockY, blockZ);
+ } else {
+ int trapType = player.worldObj.getBlockMetadata(blockX, blockY, blockZ);
- @Override
- public void readBytes(ByteBuf bytes) {
- type = bytes.readByte();
+ if (trapType % BlockTrap.trapTypes == 0) {
+ // Spike trap
- Class[] classes = getExpectedClasses();
+ player.attackEntityFrom(DamageSources.trap, 4.0F + (isScout ? 1 : 0));
- if (classes != null) {
- data = new Object[classes.length];
+ if (ModjamMod.r.nextInt(16 - (isScout ? 4 : 0)) == 0) {
+ // Spike traps have a chance to poison the player
+ PotionEffect poisonEff = new PotionEffect(Potion.poison.id, 100 + (isScout ? 25 : 0), 1);
- for (int i = 0; i < classes.length; i++) {
- if (classes[i] == Integer.class) {
- data[i] = bytes.readInt();
- }
- if (classes[i] == int[].class) {
- int[] array = new int[bytes
- .readInt()];
- for (int i2 = 0; i2 < array.length; i2++) {
- array[i2] = bytes
- .readInt();
- }
- data[i] = array;
+ ((EntityLivingBase) player).addPotionEffect(poisonEff);
}
- if (classes[i] == int[][].class) {
- int[][] array = new int[bytes
- .readInt()][];
-
- for (int i2 = 0; i2 < array.length; i2++) {
- array[i2] = new int[bytes
- .readInt()];
- for (int i3 = 0; i3 < array[i2].length; i3++) {
- array[i2][i3] = bytes
- .readInt();
- }
- }
+ } else if (trapType % BlockTrap.trapTypes == 1) {
+ // Flame trap
- data[i] = array;
- } else if (classes[i] == Boolean.class) {
- data[i] = bytes.readBoolean();
- } else if (classes[i] == String.class) {
- int length = bytes
- .readInt();
- try {
- byte[] stringBytes = new byte[length];
- bytes.readBytes(stringBytes);
- data[i] = new String(
- stringBytes,
- "UTF-8");
- } catch (Exception e) {
- e.printStackTrace();
- }
- } else if (classes[i] == Byte.class) {
- data[i] = bytes.readByte();
- } else if (classes[i] == Float.class) {
- data[i] = bytes.readDouble();
- } else if (classes[i] == Double.class) {
- data[i] = bytes.readFloat();
- } else if (classes[i] == Character.class) {
- data[i] = bytes.readChar();
+ if (!player.isBurning()) {
+ player.setFire(5 + (isScout ? 1 : 0));
}
+ } else if (trapType % BlockTrap.trapTypes == 2) {
+ // Smoke trap
+
+ PotionEffect blindEff = new PotionEffect(Potion.blindness.id, 100 + (isScout ? 25 : 0), 1);
+ PotionEffect slowEff = new PotionEffect(Potion.moveSlowdown.id, 100 + (isScout ? 25 : 0), 1);
+
+ player.addPotionEffect(blindEff);
+ player.addPotionEffect(slowEff);
}
- }
- }
- @Override
- public void writeBytes(ByteBuf bytes) {
- bytes.writeByte(type);
-
- if (data != null) {
- for (int i = 0; i < data.length; i++) {
- if (data[i] instanceof Integer) {
- bytes.writeInt((Integer) data[i]);
- } else if (data[i] instanceof int[]) {
- bytes.writeInt(((int[]) data[i]).length);
- for (int i2 = 0; i2 < ((int[]) data[i]).length; i2++) {
- bytes.writeInt(((int[]) data[i])[i2]);
- }
- } else if (data[i] instanceof int[][]) {
- int[][] values = (int[][]) data[i];
+ player.worldObj.setBlockToAir(blockX, blockY, blockZ);
- bytes.writeInt(values.length);
+ SEND_MESSAGE.sendToPlayer(player, "\u00A7c\u00A7oYou failed to disarm the trap.");
- for (int i2 = 0; i2 < values.length; i2++) {
- bytes.writeInt(values[i2].length);
- for (int i3 = 0; i3 < values[i2].length; i3++) {
- bytes.writeInt(values[i2][i3]);
- }
- }
- } else if (data[i] instanceof Boolean) {
- bytes.writeBoolean(
- (Boolean) data[i]);
- } else if (data[i] instanceof String) {
- byte[] stringBytes = ((String) data[i])
- .getBytes(Charset
- .forName("UTF-8"));
- bytes.writeInt(stringBytes.length);
- bytes.writeBytes(
- stringBytes);
- } else if (data[i] instanceof Byte) {
- bytes.writeByte((Byte) data[i]);
- } else if (data[i] instanceof Float) {
- bytes.writeDouble(
- (Double) data[i]);
- } else if (data[i] instanceof Double) {
- bytes.writeFloat(
- (Float) data[i]);
- } else if (data[i] instanceof Character) {
- bytes.writeChar((Character) data[i]);
- }
+ if (CommonTickHandler.worldData.getDisadvantage().equals("Explosive Traps")) {
+ player.worldObj.setBlockToAir(blockX, blockY, blockZ);
+ player.worldObj.createExplosion(null, blockX + 0.5F, blockY + 0.5F, blockZ + 0.5F, 1.33F, true);
}
+
+ player.triggerAchievement(ModjamMod.whoops);
}
}
@Override
- public void executeClient(EntityPlayer player) {
- if (packetTypes[type] != this) {
- packetTypes[type].executeClient(player);
- }
+ public Class[] getExpectedClasses() {
+ return new Class[] { Integer.class, Integer.class, Integer.class, Boolean.class };
}
+ };
+ public final static BasicPacket EXAMINE_MOB = new BasicPacket(8) {
@Override
public void executeServer(EntityPlayer player) {
- if (packetTypes[type] != this) {
- packetTypes[type].executeServer(player);
- }
- }
+ int dimension = (Integer) data[0];
+ int entityID = (Integer) data[1];
- @Override
- public void executeBoth(EntityPlayer player) {
- if (packetTypes[type] != this) {
- packetTypes[type].executeBoth(player);
- }
- }
+ WorldServer server = null;
- public Class[] getExpectedClasses() {
- if (packetTypes[type] != this) {
- return packetTypes[type]
- .getExpectedClasses();
- } else {
- return null;
+ for (WorldServer s : MinecraftServer.getServer().worldServers) {
+ if (s.provider.dimensionId == dimension) {
+ server = s;
+ break;
+ }
}
- }
-
- public void sendToPlayer(EntityPlayer player,
- Object... data) {
- sendPacketToPlayer(new BasicPacket(this, data),
- player);
- }
-
- public void sendToAllPlayers(Object... data) {
- sendPacketToAllPlayers(
- new BasicPacket(this, data));
- }
- public void sendToServer(Object... data) {
- sendPacketToServer(new BasicPacket(this, data));
- }
- }
+ if (server != null) {
+ Entity entity = server.getEntityByID(entityID);
- public static void sendPacketToPlayer(IPacket packet,
- EntityPlayer player) {
- ModjamMod.channels.get(Side.SERVER)
- .attr(FMLOutboundHandler.FML_MESSAGETARGET)
- .set(FMLOutboundHandler.OutboundTarget.PLAYER);
- ModjamMod.channels.get(Side.SERVER).attr(
- FMLOutboundHandler.FML_MESSAGETARGETARGS)
- .set(player);
- ModjamMod.channels.get(Side.SERVER).writeOutbound(packet);
- }
+ if (entity != null) {
+ boolean hasBlessing = entity.getEntityData().hasKey("Blessing");
- public static void sendPacketToAllPlayers(IPacket packet) {
- ModjamMod.channels.get(Side.SERVER)
- .attr(FMLOutboundHandler.FML_MESSAGETARGET)
- .set(FMLOutboundHandler.OutboundTarget.ALL);
- ModjamMod.channels.get(Side.SERVER).writeOutbound(packet);
- }
+ String blessing2 = hasBlessing ? entity.getEntityData().getString("Blessing") : null;
- public static void sendPacketToServer(IPacket packet) {
- ModjamMod.channels.get(Side.CLIENT)
- .attr(FMLOutboundHandler.FML_MESSAGETARGET)
- .set(FMLOutboundHandler.OutboundTarget.TOSERVER);
- ModjamMod.channels.get(Side.CLIENT).writeOutbound(packet);
- }
+ if (blessing2 != null) {
+ SEND_MESSAGE.sendToPlayer(player,
+ "\u00A7eYou notice " + entity.getCommandSenderName() + "\u00A7e is using "
+ + BlessingUtils.getBlessingInstance(blessing2).customName() + ".");
+ } else {
+ SEND_MESSAGE.sendToPlayer(player,
+ "\u00A7eThere doesn't seem to be anything special about "
+ + (entity instanceof EntityPlayer ? "" : "this ")
+ + entity.getCommandSenderName() + "\u00A7e.");
+ }
+ }
+ }
+ }
- public static final BasicPacket
+ @Override
+ public Class[] getExpectedClasses() {
+ return new Class[] { Integer.class, Integer.class };
+ }
+ };
- UPDATE_BLESSING = new BasicPacket(1) {
+ public final static BasicPacket LEVEL_UP = new BasicPacket(9) {
@Override
public void executeBoth(EntityPlayer player) {
- player.getEntityData().setString("Blessing",
- (String) data[0]);
+ player.addExperienceLevel((Integer) data[0]);
}
@Override
public Class[] getExpectedClasses() {
- return new Class[] {
- String.class
- };
+ return new Class[] { Integer.class };
}
- },
-
- PLAY_SOUND = new BasicPacket(2) {
- @Override
- public void executeServer(
- EntityPlayer player) {
- String sound = (String) data[0];
- int x = (Integer) data[1],
- y = (Integer) data[2],
- z = (Integer) data[3];
- player.worldObj.playSound(x, y, z,
- "fyresmodjam:" + sound,
- 1.0F, 1.0F, false);
- }
-
- @Override
- public Class[] getExpectedClasses() {
- return new Class[] {
- String.class,
- Integer.class,
- Integer.class,
- Integer.class
- };
- }
- },
-
- UPDATE_POTION_KNOWLEDGE = new BasicPacket(3) {
- @Override
- public void executeBoth(
- EntityPlayer player) {
- player.getEntityData().setIntArray(
- "PotionKnowledge",
- (int[]) data[0]);
- }
-
- @Override
- public Class[] getExpectedClasses() {
- return new Class[] {
- int[].class
- };
- }
- },
-
- SEND_MESSAGE = new BasicPacket(4) {
- @Override
- public void executeClient(
- EntityPlayer player) {
- String style = "";
-
- for (String s : ((String) data[0])
- .split("@")) {
- String[] words = s.split(
- " ");
- s = "";
-
- for (String word : words) {
- s += style + word
- + " ";
-
- while (word.contains(
- "\u00A7")) {
- int firstOccurance = word
- .indexOf("\u00A7");
- String string = word
- .substring(firstOccurance,
- firstOccurance + 2);
-
- if (style.contains(
- string)) {
- style = style.replace(
- string,
- "");
- }
- style += string;
- if (string.equals(
- "\u00A7r")) {
- style = "";
- }
-
- word = word.replaceFirst(
- string,
- "");
- }
- }
+ };
- player.addChatComponentMessage(
- new ChatComponentText(
- s));
- }
- }
+ public final static BasicPacket ACTIVATE_BLESSING = new BasicPacket(10) {
+ @Override
+ public void executeServer(EntityPlayer player) {
+ int x = (Integer) data[0], y = (Integer) data[1], z = (Integer) data[2];
- @Override
- public Class[] getExpectedClasses() {
- return new Class[] {
- String.class
- };
- }
- },
-
- UPDATE_WORLD_DATA = new BasicPacket(5) {
- @Override
- public void executeClient(
- EntityPlayer player) {
- potionValues = (int[]) data[0];
- potionDurations = (int[]) data[1];
- currentDisadvantage = (String) data[2];
- currentTask = (String) data[3];
- currentTaskID = (Integer) data[4];
- currentTaskAmount = (Integer) data[5];
- progress = (Integer) data[6];
- tasksCompleted = (Integer) data[7];
- enderDragonKilled = (Boolean) data[8];
- trapsDisabled = !((Boolean) data[9]);
- rewardLevels = (Integer) data[10];
- mushroomColors = (int[][]) data[11];
- }
+ boolean blessingActive = EntityStatHelper.hasStat(player, "BlessingActive")
+ ? Boolean.parseBoolean(EntityStatHelper.getStat(player, "BlessingActive"))
+ : false;
- @Override
- public Class[] getExpectedClasses() {
- return new Class[] {
- int[].class,
- int[].class,
- String.class,
- String.class,
- Integer.class,
- Integer.class,
- Integer.class,
- Integer.class,
- Boolean.class,
- Boolean.class,
- Integer.class,
- int[][].class
- };
- }
- },
-
- UPDATE_PLAYER_ITEMS = new BasicPacket(6) {
- @Override
- public void executeServer(
- EntityPlayer player) {
- for (Object stack : player.inventory.mainInventory) {
- if (stack == null
- || !(stack instanceof ItemStack)) {
- continue;
- }
- ItemStatHelper.processItemStack(
- (ItemStack) stack,
- ModjamMod.r);
- }
- }
-
- @Override
- public Class[] getExpectedClasses() {
- return null;
- }
- },
-
- DISARM_TRAP = new BasicPacket(7) {
- @Override
- public void executeServer(
- EntityPlayer player) {
- int blockX = (Integer) data[0],
- blockY = (Integer) data[1],
- blockZ = (Integer) data[2];
- boolean mechanic = (Boolean) data[3];
-
- boolean scout = BlessingUtils
- .hasBlessing(player,
- "MarkScouting");
-
- TileEntity te = player.worldObj
- .getTileEntity(blockX,
- blockY,
- blockZ);
-
- boolean yours = (te == null
- || !(te instanceof TileEntityTrap))
- ? false
- : player.getCommandSenderName()
- .equals(((TileEntityTrap) te).placedBy);
-
- if (yours || (mechanic
- ? ModjamMod.r.nextInt(
- 4) != 0
- : ModjamMod.r.nextInt(
- 4) == 0)) {
- boolean salvage = yours
- || (mechanic ? ModjamMod.r
- .nextBoolean()
- : (ModjamMod.r.nextInt(
- 4) == 0));
-
- SEND_MESSAGE.sendToPlayer(
- player,
- "\u00A7e\u00A7o" + (!salvage
- ? "You disarmed the trap."
- : "You disarm and salvage the trap."));
-
- if (salvage) {
- ItemStack spawned = new ItemStack(
- ModjamMod.itemTrap,
- 1,
- player.worldObj.getBlockMetadata(
- blockX,
- blockY,
- blockZ)
- % BlockTrap.trapTypes);
-
- player.worldObj.spawnEntityInWorld(
- new EntityItem(player.worldObj,
- blockX + 0.5F,
- blockY,
- blockZ + 0.5F,
- spawned));
- }
+ if (!EntityStatHelper.hasStat(player, "BlessingCooldown")) {
+ EntityStatHelper.giveStat(player, "BlessingCooldown", 0);
+ }
- player.worldObj.setBlockToAir(
- blockX,
- blockY,
- blockZ);
- } else {
- int trapType = player.worldObj
- .getBlockMetadata(
- blockX,
- blockY,
- blockZ);
-
- // TODO use a custom damage
- // type for the traps
- if (trapType % BlockTrap.trapTypes == 0) {
- player.attackEntityFrom(
- DamageSource.cactus,
- 4.0F + (scout ? 1
- : 0));
- if (ModjamMod.r.nextInt(
- 16 - (scout ? 4
- : 0)) == 0) {
- ((EntityLivingBase) player)
- .addPotionEffect(
- new PotionEffect(
- Potion.poison.id,
- 100 + (scout ? 25
- : 0),
- 1));
- }
- } else if (trapType
- % BlockTrap.trapTypes == 1) {
- if (!player.isBurning()) {
- player.setFire(5 + (scout
- ? 1
- : 0));
+ long time = (CommonTickHandler.worldData != null
+ && CommonTickHandler.worldData.getDisadvantage().equals("Neverending Rain"))
+ ? player.worldObj.getTotalWorldTime()
+ : player.worldObj.getWorldTime();
+
+ if (EntityStatHelper.getStat(player, "BlessingCooldown").equals("0")) {
+ if (!blessingActive) {
+ if (BlessingUtils.hasBlessing(player)) {
+ if (BlessingUtils.hasBlessing(player, "BlessingBerserker")) {
+ if (hasBlessingCounters(player)) {
+ blessingActive = true;
+ SEND_MESSAGE.sendToPlayer(player, "\u00A7cYou enter berserk mode.");
+ } else {
+ SEND_MESSAGE.sendToPlayer(player, "\u00A7cYou have no berserk counters.");
}
- } else if (trapType
- % BlockTrap.trapTypes == 2) {
- player.addPotionEffect(
- new PotionEffect(
- Potion.blindness.id,
- 100 + (scout ? 25
- : 0),
- 1));
- player.addPotionEffect(
- new PotionEffect(
- Potion.moveSlowdown.id,
- 100 + (scout ? 25
- : 0),
- 1));
- }
+ } else if (BlessingUtils.hasBlessing(player, "BlessingMechanic")) {
+ TileEntity te = player.worldObj.getTileEntity(x, y, z);
- player.worldObj.setBlockToAir(
- blockX,
- blockY,
- blockZ);
-
- SEND_MESSAGE.sendToPlayer(
- player,
- "\u00A7c\u00A7oYou failed to disarm the trap.");
-
- if (CommonTickHandler.worldData
- .getDisadvantage()
- .equals("Explosive Traps")) {
- player.worldObj.setBlockToAir(
- blockX,
- blockY,
- blockZ);
- player.worldObj.createExplosion(
- null,
- blockX + 0.5F,
- blockY + 0.5F,
- blockZ + 0.5F,
- 1.33F,
- true);
- }
- player.triggerAchievement(
- ModjamMod.whoops);
- }
- }
+ if (te != null && te instanceof TileEntityTrap) {
+ SEND_MESSAGE.sendToPlayer(player, "\u00A7e\u00A7oYou disarm and salvage the trap.");
- @Override
- public Class[] getExpectedClasses() {
- return new Class[] {
- Integer.class,
- Integer.class,
- Integer.class,
- Boolean.class
- };
- }
- },
-
- EXAMINE_MOB = new BasicPacket(8) {
- @Override
- public void executeServer(
- EntityPlayer player) {
- int dimension = (Integer) data[0];
- int entityID = (Integer) data[1];
-
- WorldServer server = null;
-
- for (WorldServer s : MinecraftServer
- .getServer().worldServers) {
- if (s.provider.dimensionId == dimension) {
- server = s;
- break;
- }
- }
+ player.worldObj.spawnEntityInWorld(new EntityItem(player.worldObj, x + 0.5F, y,
+ z + 0.5F, new ItemStack(ModjamMod.itemTrap, 1,
+ player.worldObj.getBlockMetadata(x, y, z) % BlockTrap.trapTypes)));
+ player.worldObj.setBlockToAir(x, y, z);
- if (server != null) {
- Entity entity = server
- .getEntityByID(entityID);
-
- if (entity != null) {
- String blessing2 = entity
- .getEntityData()
- .hasKey("Blessing")
- ? entity.getEntityData()
- .getString("Blessing")
- : null;
-
- if (blessing2 != null) {
- SEND_MESSAGE.sendToPlayer(
- player,
- "\u00A7eYou notice "
- + entity.getCommandSenderName()
- + "\u00A7e is using "
- + BlessingUtils.getBlessingInstance(
- blessing2)
- .customName()
- + ".");
+ EntityStatHelper.giveStat(player, "BlessingCooldown", 24000 - (time % 24000));
} else {
- SEND_MESSAGE.sendToPlayer(
- player,
- "\u00A7eThere doesn't seem to be anything special about "
- + (entity instanceof EntityPlayer
- ? ""
- : "this ")
- + entity.getCommandSenderName()
- + "\u00A7e.");
+ SEND_MESSAGE.sendToPlayer(player, "\u00A7e\u00A7oNo selected trap.");
}
}
}
- }
-
- @Override
- public Class[] getExpectedClasses() {
- return new Class[] {
- Integer.class,
- Integer.class
- };
- }
- },
-
- LEVEL_UP = new BasicPacket(9) {
- @Override
- public void executeBoth(
- EntityPlayer player) {
- player.addExperienceLevel(
- (Integer) data[0]);
- }
-
- @Override
- public Class[] getExpectedClasses() {
- return new Class[] {
- Integer.class
- };
- }
- },
-
- ACTIVATE_BLESSING = new BasicPacket(10) {
- @Override
- public void executeServer(
- EntityPlayer player) {
-
- int x = (Integer) data[0],
- y = (Integer) data[1],
- z = (Integer) data[2];
-
- boolean blessingActive = EntityStatHelper
- .hasStat(player, "BlessingActive")
- ? Boolean.parseBoolean(
- EntityStatHelper.getStat(
- player,
- "BlessingActive"))
- : false;
-
- if (!EntityStatHelper.hasStat(
- player,
- "BlessingCooldown")) {
- EntityStatHelper.giveStat(
- player,
- "BlessingCooldown",
- 0);
- }
+ } else {
+ blessingActive = false;
- long time = (CommonTickHandler.worldData != null
- && CommonTickHandler.worldData
- .getDisadvantage()
- .equals("Neverending Rain"))
- ? player.worldObj
- .getTotalWorldTime()
- : player.worldObj
- .getWorldTime();
-
- if (EntityStatHelper.getStat(
- player,
- "BlessingCooldown")
- .equals("0")) {
- if (!blessingActive) {
- if (BlessingUtils
- .hasBlessing(player)) {
- if (BlessingUtils
- .hasBlessing(player,
- "BlessingBerserker")) {
- if (hasBlessingCounters(
- player)) {
- blessingActive = true;
- SEND_MESSAGE.sendToPlayer(
- player,
- "\u00A7cYou enter berserk mode.");
- } else {
- SEND_MESSAGE.sendToPlayer(
- player,
- "\u00A7cYou have no berserk counters.");
- }
- } else if (BlessingUtils
- .hasBlessing(player,
- "BlessingMechanic")) {
- TileEntity te = player.worldObj
- .getTileEntity(x,
- y,
- z);
-
- if (te != null && te instanceof TileEntityTrap) {
- SEND_MESSAGE.sendToPlayer(
- player,
- "\u00A7e\u00A7oYou disarm and salvage the trap.");
-
- player.worldObj.spawnEntityInWorld(
- new EntityItem(player.worldObj,
- x + 0.5F,
- y,
- z + 0.5F,
- new ItemStack(ModjamMod.itemTrap,
- 1,
- player.worldObj.getBlockMetadata(
- x,
- y,
- z)
- % BlockTrap.trapTypes)));
- player.worldObj.setBlockToAir(
- x,
- y,
- z);
-
- EntityStatHelper.giveStat(
- player,
- "BlessingCooldown",
- 24000 - (time % 24000));
- } else {
- SEND_MESSAGE.sendToPlayer(
- player,
- "\u00A7e\u00A7oNo selected trap.");
- }
- }
- }
- } else {
- blessingActive = false;
-
- if (BlessingUtils
- .hasBlessing(player)) {
- if (BlessingUtils
- .hasBlessing(player,
- "BlessingBerserker")) {
- SEND_MESSAGE.sendToPlayer(
- player,
- "\u00A7cYou calm down.");
-
- EntityStatHelper.giveStat(
- player,
- "BlessingCooldown",
- 1200);
- }
- }
+ if (BlessingUtils.hasBlessing(player)) {
+ if (BlessingUtils.hasBlessing(player, "BlessingBerserker")) {
+ SEND_MESSAGE.sendToPlayer(player, "\u00A7cYou calm down.");
- EntityStatHelper.giveStat(
- player,
- "BlessingTimer",
- 0);
+ EntityStatHelper.giveStat(player, "BlessingCooldown", 1200);
}
- } else {
- SEND_MESSAGE.sendToPlayer(
- player,
- "\u00A7cBlessing is on cooldown. ("
- + (Integer.parseInt(
- EntityStatHelper.getStat(
- player,
- "BlessingCooldown")))
- / 20
- + "s)");
}
- EntityStatHelper.giveStat(player,
- "BlessingActive",
- blessingActive);
+ EntityStatHelper.giveStat(player, "BlessingTimer", 0);
}
+ } else {
+ SEND_MESSAGE.sendToPlayer(player, "\u00A7cBlessing is on cooldown. ("
+ + (Integer.parseInt(EntityStatHelper.getStat(player, "BlessingCooldown"))) / 20 + "s)");
+ }
- private boolean hasBlessingCounters(
- EntityPlayer player) {
- return EntityStatHelper.hasStat(
- player,
- "BlessingCounter")
- && Integer.parseInt(
- EntityStatHelper.getStat(
- player,
- "BlessingCounter")) > 0;
- }
+ EntityStatHelper.giveStat(player, "BlessingActive", blessingActive);
+ }
- @Override
- public Class[] getExpectedClasses() {
- return new Class[] {
- Integer.class,
- Integer.class,
- Integer.class
- };
- }
- },
-
- UPDATE_STAT = new BasicPacket(11) {
- @Override
- public void executeBoth(
- EntityPlayer player) {
- EntityStatHelper.giveStat(player,
- (String) data[0],
- data[1]);
- }
+ private boolean hasBlessingCounters(EntityPlayer player) {
+ return EntityStatHelper.hasStat(player, "BlessingCounter")
+ && Integer.parseInt(EntityStatHelper.getStat(player, "BlessingCounter")) > 0;
+ }
- @Override
- public Class[] getExpectedClasses() {
- return new Class[] {
- String.class,
- String.class
- };
- }
- };
-}
+ @Override
+ public Class[] getExpectedClasses() {
+ return new Class[] { Integer.class, Integer.class, Integer.class };
+ }
+ };
+
+ public final static BasicPacket UPDATE_STAT = new BasicPacket(11) {
+ @Override
+ public void executeBoth(EntityPlayer player) {
+ EntityStatHelper.giveStat(player, (String) data[0], data[1]);
+ }
+
+ @Override
+ public Class[] getExpectedClasses() {
+ return new Class[] { String.class, String.class };
+ }
+ };
+}
\ No newline at end of file diff --git a/YWD/src/main/java/fyresmodjam/handlers/UpdateBlessingPacket.java b/YWD/src/main/java/fyresmodjam/handlers/UpdateBlessingPacket.java new file mode 100644 index 0000000..dc2aa32 --- /dev/null +++ b/YWD/src/main/java/fyresmodjam/handlers/UpdateBlessingPacket.java @@ -0,0 +1,5 @@ +package fyresmodjam.handlers; + +public class UpdateBlessingPacket extends BasicPacket { + +} diff --git a/YWD/src/main/java/fyresmodjam/items/ItemCrystal.java b/YWD/src/main/java/fyresmodjam/items/ItemCrystal.java index ee4a6e8..4c28d4a 100755 --- a/YWD/src/main/java/fyresmodjam/items/ItemCrystal.java +++ b/YWD/src/main/java/fyresmodjam/items/ItemCrystal.java @@ -19,16 +19,10 @@ public class ItemCrystal extends ItemBlock { public IIcon texture;
- public static String[] names = new String[] {
- "Shining", "Void", "Firey"
- };
- public static String[] particleNames = new String[] {
- "spell", "portal", "flame"
- };
- public static Color[] colors = new Color[] {
- new Color(255, 255, 173), new Color(33, 0, 73),
- new Color(255, 55, 0)
- };
+ public static String[] names = new String[] { "Shining", "Void", "Firey" };
+ public static String[] particleNames = new String[] { "spell", "portal", "flame" };
+ public static Color[] colors = new Color[] { new Color(255, 255, 173), new Color(33, 0, 73),
+ new Color(255, 55, 0) };
public ItemCrystal() {
super(ModjamMod.crystal);
@@ -37,31 +31,27 @@ public class ItemCrystal extends ItemBlock { }
@Override
- public void getSubItems(Item id, CreativeTabs creativeTab,
- List list) {
+ public void getSubItems(Item id, CreativeTabs creativeTab, List list) {
for (int i = 0; i < names.length; i++) {
list.add(new ItemStack(id, 1, i));
}
}
public String getItemDisplayName(ItemStack itemStack) {
- return names[itemStack.getItemDamage() % names.length]
- + " Crystal";
+ return names[itemStack.getItemDamage() % names.length] + " Crystal";
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister) {
- texture = iconRegister
- .registerIcon("fyresmodjam:crystal_item");
+ texture = iconRegister.registerIcon("fyresmodjam:crystal_item");
itemIcon = texture;
}
@Override
@SideOnly(Side.CLIENT)
public int getColorFromItemStack(ItemStack itemStack, int i) {
- return colors[itemStack.getItemDamage() % colors.length]
- .getRGB();
+ return colors[itemStack.getItemDamage() % colors.length].getRGB();
}
@Override
@@ -77,8 +67,7 @@ public class ItemCrystal extends ItemBlock { }
@Override
- public ItemStack onItemRightClick(ItemStack par1ItemStack,
- World par2World, EntityPlayer par3EntityPlayer) {
+ public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
// int value =
// (!par3EntityPlayer.getEntityData().hasKey("equippedCrystal")
@@ -88,23 +77,18 @@ public class ItemCrystal extends ItemBlock { // par1ItemStack.getItemDamage() : -1;
/*
- * if(par2World.isRemote) {
- * PacketDispatcher.sendPacketToServer(PacketHandler.
- * newPacket( PacketHandler.UPDATE_STAT, new Object[]
- * {"equippedCrystal", "int",
+ * if(par2World.isRemote) { PacketDispatcher.sendPacketToServer(PacketHandler.
+ * newPacket( PacketHandler.UPDATE_STAT, new Object[] {"equippedCrystal", "int",
* par1ItemStack.getItemDamage()})); } else {
- * PacketDispatcher.sendPacketToPlayer(PacketHandler.
- * newPacket( PacketHandler.UPDATE_STAT, new Object[]
- * {"equippedCrystal", "int",
- * par1ItemStack.getItemDamage()}), (Player)
- * par3EntityPlayer); }
+ * PacketDispatcher.sendPacketToPlayer(PacketHandler. newPacket(
+ * PacketHandler.UPDATE_STAT, new Object[] {"equippedCrystal", "int",
+ * par1ItemStack.getItemDamage()}), (Player) par3EntityPlayer); }
*/
/*
- * if(par2World.isRemote) {
- * par3EntityPlayer.openGui(ModjamMod.instance, 1,
- * par2World, (int) par3EntityPlayer.posX, (int)
- * par3EntityPlayer.posY, (int) par3EntityPlayer.posZ); }
+ * if(par2World.isRemote) { par3EntityPlayer.openGui(ModjamMod.instance, 1,
+ * par2World, (int) par3EntityPlayer.posX, (int) par3EntityPlayer.posY, (int)
+ * par3EntityPlayer.posZ); }
*/
return par1ItemStack;
diff --git a/YWD/src/main/java/fyresmodjam/items/ItemMysteryMushroom.java b/YWD/src/main/java/fyresmodjam/items/ItemMysteryMushroom.java index f38d488..d4e9b2f 100755 --- a/YWD/src/main/java/fyresmodjam/items/ItemMysteryMushroom.java +++ b/YWD/src/main/java/fyresmodjam/items/ItemMysteryMushroom.java @@ -28,16 +28,13 @@ public class ItemMysteryMushroom extends Item { @Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister par1IconRegister) {
- icon = par1IconRegister
- .registerIcon("fyresmodjam:mushroom");
- overlay = par1IconRegister.registerIcon(
- "fyresmodjam:mushroom_overlay");
+ icon = par1IconRegister.registerIcon("fyresmodjam:mushroom");
+ overlay = par1IconRegister.registerIcon("fyresmodjam:mushroom_overlay");
itemIcon = icon;
}
@Override
- public void getSubItems(Item par1, CreativeTabs par2CreativeTabs,
- List par3List) {
+ public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List par3List) {
for (int i = 0; i < 13; i++) {
par3List.add(new ItemStack(par1, 1, i));
}
@@ -45,10 +42,8 @@ public class ItemMysteryMushroom extends Item { @Override
@SideOnly(Side.CLIENT)
- public int getColorFromItemStack(ItemStack par1ItemStack,
- int par2) {
- return NewPacketHandler.mushroomColors[par1ItemStack
- .getItemDamage() % 13][par2 % 2];
+ public int getColorFromItemStack(ItemStack par1ItemStack, int par2) {
+ return NewPacketHandler.mushroomColors[par1ItemStack.getItemDamage() % 13][par2 % 2];
}
@Override
@@ -64,20 +59,14 @@ public class ItemMysteryMushroom extends Item { }
@Override
- public boolean onItemUse(ItemStack par1ItemStack,
- EntityPlayer par2EntityPlayer, World par3World,
- int par4, int par5, int par6, int par7, float par8,
- float par9, float par10) {
+ public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4,
+ int par5, int par6, int par7, float par8, float par9, float par10) {
Block i1 = par3World.getBlock(par4, par5, par6);
- if (i1 == Blocks.snow && (par3World.getBlockMetadata(par4,
- par5, par6) & 7) < 1) {
+ if (i1 == Blocks.snow && (par3World.getBlockMetadata(par4, par5, par6) & 7) < 1) {
par7 = 1;
- } else if (i1 != Blocks.vine && i1 != Blocks.tallgrass
- && i1 != Blocks.deadbush
- && (i1 == null || !i1.isReplaceable(
- par3World, par4, par5,
- par6))) {
+ } else if (i1 != Blocks.vine && i1 != Blocks.tallgrass && i1 != Blocks.deadbush
+ && (i1 == null || !i1.isReplaceable(par3World, par4, par5, par6))) {
if (par7 == 0) {
--par5;
}
@@ -105,36 +94,22 @@ public class ItemMysteryMushroom extends Item { if (par1ItemStack.stackSize == 0) {
return false;
- } else if (!par2EntityPlayer.canPlayerEdit(par4, par5,
- par6, par7, par1ItemStack)) {
+ } else if (!par2EntityPlayer.canPlayerEdit(par4, par5, par6, par7, par1ItemStack)) {
return false;
- } else if (par5 == 255 && ModjamMod.mysteryMushroomBlock
- .getMaterial().isSolid()) {
+ } else if (par5 == 255 && ModjamMod.mysteryMushroomBlock.getMaterial().isSolid()) {
return false;
- } else if (par3World.canPlaceEntityOnSide(
- ModjamMod.mysteryMushroomBlock, par4, par5,
- par6, false, par7, par2EntityPlayer,
- par1ItemStack)) {
+ } else if (par3World.canPlaceEntityOnSide(ModjamMod.mysteryMushroomBlock, par4, par5, par6, false, par7,
+ par2EntityPlayer, par1ItemStack)) {
Block block = ModjamMod.mysteryMushroomBlock;
int j1 = par1ItemStack.getItemDamage();
- int k1 = ModjamMod.mysteryMushroomBlock
- .onBlockPlaced(par3World, par4,
- par5, par6, par7,
- par8, par9, par10,
- j1);
-
- if (onItemUseFirst(par1ItemStack, par2EntityPlayer,
- par3World, par4, par5, par6, par7,
- par8, par9, par10, k1)) {
- par3World.playSoundEffect(par4 + 0.5F,
- par5 + 0.5F, par6 + 0.5F,
- block.stepSound.func_150496_b(),
- (block.stepSound.getVolume()
- + 1.0F)
- / 2.0F,
- block.stepSound.getPitch()
- * 0.8F);
+ int k1 = ModjamMod.mysteryMushroomBlock.onBlockPlaced(par3World, par4, par5, par6, par7, par8, par9, par10,
+ j1);
+
+ if (onItemUseFirst(par1ItemStack, par2EntityPlayer, par3World, par4, par5, par6, par7, par8, par9, par10,
+ k1)) {
+ par3World.playSoundEffect(par4 + 0.5F, par5 + 0.5F, par6 + 0.5F, block.stepSound.func_150496_b(),
+ (block.stepSound.getVolume() + 1.0F) / 2.0F, block.stepSound.getPitch() * 0.8F);
--par1ItemStack.stackSize;
}
@@ -144,21 +119,15 @@ public class ItemMysteryMushroom extends Item { }
}
- public boolean onItemUseFirst(ItemStack stack, EntityPlayer player,
- World world, int x, int y, int z, int side,
+ public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side,
float hitX, float hitY, float hitZ, int metadata) {
- if (!world.setBlock(x, y, z,
- ModjamMod.mysteryMushroomBlock, metadata,
- 3)) {
+ if (!world.setBlock(x, y, z, ModjamMod.mysteryMushroomBlock, metadata, 3)) {
return false;
}
- if (world.getBlock(x, y,
- z) == ModjamMod.mysteryMushroomBlock) {
- ModjamMod.mysteryMushroomBlock.onBlockPlacedBy(
- world, x, y, z, player, stack);
- ModjamMod.mysteryMushroomBlock.onPostBlockPlaced(
- world, x, y, z, metadata);
+ if (world.getBlock(x, y, z) == ModjamMod.mysteryMushroomBlock) {
+ ModjamMod.mysteryMushroomBlock.onBlockPlacedBy(world, x, y, z, player, stack);
+ ModjamMod.mysteryMushroomBlock.onPostBlockPlaced(world, x, y, z, metadata);
}
return true;
diff --git a/YWD/src/main/java/fyresmodjam/items/ItemMysteryPotion.java b/YWD/src/main/java/fyresmodjam/items/ItemMysteryPotion.java index 8df424e..febb02a 100755 --- a/YWD/src/main/java/fyresmodjam/items/ItemMysteryPotion.java +++ b/YWD/src/main/java/fyresmodjam/items/ItemMysteryPotion.java @@ -38,12 +38,8 @@ public class ItemMysteryPotion extends Item { icons = new IIcon[26];
for (int i = 0; i < 13; i++) {
- icons[i] = par1IconRegister.registerIcon(
- "fyresmodjam:mysteryPotion_"
- + (i + 1));
- icons[i + 13] = par1IconRegister.registerIcon(
- "fyresmodjam:mysteryPotionThrowable_"
- + (i + 1));
+ icons[i] = par1IconRegister.registerIcon("fyresmodjam:mysteryPotion_" + (i + 1));
+ icons[i + 13] = par1IconRegister.registerIcon("fyresmodjam:mysteryPotionThrowable_" + (i + 1));
}
itemIcon = icons[0];
@@ -56,8 +52,7 @@ public class ItemMysteryPotion extends Item { }
@Override
- public void getSubItems(Item par1, CreativeTabs par2CreativeTabs,
- List par3List) {
+ public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List par3List) {
for (int i = 0; i < 13; i++) {
par3List.add(new ItemStack(par1, 1, i));
}
@@ -74,22 +69,14 @@ public class ItemMysteryPotion extends Item { if (damage < 12) {
if (Minecraft.getMinecraft().thePlayer != null
- && Minecraft.getMinecraft().thePlayer
- .getEntityData()
- .hasKey("PotionKnowledge")) {
- if (Minecraft.getMinecraft().thePlayer
- .getEntityData()
- .getIntArray("PotionKnowledge")[damage] != -1) {
+ && Minecraft.getMinecraft().thePlayer.getEntityData().hasKey("PotionKnowledge")) {
+ if (Minecraft.getMinecraft().thePlayer.getEntityData().getIntArray("PotionKnowledge")[damage] != -1) {
Potion potion = Potion.potionTypes[NewPacketHandler.potionValues[damage]];
- name = StatCollector
- .translateToLocal(
- potion.getName())
- + " Potion";
+ name = StatCollector.translateToLocal(potion.getName()) + " Potion";
if (!potion.isInstant()) {
int time = NewPacketHandler.potionDurations[damage];
- name += " (" + time
- + " seconds)";
+ name += " (" + time + " seconds)";
}
}
}
@@ -97,8 +84,7 @@ public class ItemMysteryPotion extends Item { name = "Wildcard Potion";
}
- if (FMLCommonHandler.instance().getSide() == Side.CLIENT
- && hasBlessing("Alchemist")) {
+ if (FMLCommonHandler.instance().getSide() == Side.CLIENT && hasBlessing("Alchemist")) {
name = "\u00A7k" + name;
}
@@ -107,49 +93,33 @@ public class ItemMysteryPotion extends Item { @Override
public EnumAction getItemUseAction(ItemStack par1ItemStack) {
- return par1ItemStack.getItemDamage() < 13
- ? EnumAction.drink
- : super.getItemUseAction(par1ItemStack);
+ return par1ItemStack.getItemDamage() < 13 ? EnumAction.drink : super.getItemUseAction(par1ItemStack);
}
@Override
- public ItemStack onItemRightClick(ItemStack par1ItemStack,
- World par2World, EntityPlayer par3EntityPlayer) {
+ public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
if (par1ItemStack.getItemDamage() < 13) {
- par3EntityPlayer.setItemInUse(par1ItemStack,
- getMaxItemUseDuration(
- par1ItemStack));
+ par3EntityPlayer.setItemInUse(par1ItemStack, getMaxItemUseDuration(par1ItemStack));
} else {
if (!par3EntityPlayer.capabilities.isCreativeMode) {
par1ItemStack.stackSize--;
}
- par2World.playSoundAtEntity(par3EntityPlayer,
- "random.bow", 0.5F,
- 0.4F / (itemRand.nextFloat() * 0.4F
- + 0.8F));
+ par2World.playSoundAtEntity(par3EntityPlayer, "random.bow", 0.5F,
+ 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
if (!par2World.isRemote) {
int value = 0;
- if (par1ItemStack.getItemDamage()
- % 13 >= 12) {
- value = ModjamMod.r.nextInt(
- Potion.potionTypes.length);
+ if (par1ItemStack.getItemDamage() % 13 >= 12) {
+ value = ModjamMod.r.nextInt(Potion.potionTypes.length);
while (Potion.potionTypes[value] == null) {
- value = ModjamMod.r
- .nextInt(Potion.potionTypes.length);
+ value = ModjamMod.r.nextInt(Potion.potionTypes.length);
}
} else {
- value = CommonTickHandler.worldData.potionValues[par1ItemStack
- .getItemDamage()
- % 13];
+ value = CommonTickHandler.worldData.potionValues[par1ItemStack.getItemDamage() % 13];
}
- par2World.spawnEntityInWorld(
- new EntityMysteryPotion(
- par2World,
- par3EntityPlayer,
- par1ItemStack));
+ par2World.spawnEntityInWorld(new EntityMysteryPotion(par2World, par3EntityPlayer, par1ItemStack));
}
}
@@ -158,127 +128,74 @@ public class ItemMysteryPotion extends Item { @Override
public int getMaxItemUseDuration(ItemStack par1ItemStack) {
- return par1ItemStack.getItemDamage() < 13 ? 32
- : super.getMaxItemUseDuration(
- par1ItemStack);
+ return par1ItemStack.getItemDamage() < 13 ? 32 : super.getMaxItemUseDuration(par1ItemStack);
}
@Override
- public ItemStack onEaten(ItemStack par1ItemStack, World par2World,
- EntityPlayer par3EntityPlayer) {
+ public ItemStack onEaten(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
if (!par3EntityPlayer.capabilities.isCreativeMode) {
--par1ItemStack.stackSize;
}
int damage = par1ItemStack.getItemDamage() % 13;
- if (!BlessingUtils.hasBlessing(par3EntityPlayer,
- "BlessingAlchemist") && damage < 12) {
+ if (!BlessingUtils.hasBlessing(par3EntityPlayer, "BlessingAlchemist") && damage < 12) {
if (!par2World.isRemote) {
int value = CommonTickHandler.worldData.potionValues[damage];
- if (!Potion.potionTypes[value]
- .isInstant()) {
- par3EntityPlayer.addPotionEffect(
- new PotionEffect(
- value,
- CommonTickHandler.worldData.potionDurations[damage]
- * 20,
- 1,
- false));
+ if (!Potion.potionTypes[value].isInstant()) {
+ par3EntityPlayer.addPotionEffect(new PotionEffect(value,
+ CommonTickHandler.worldData.potionDurations[damage] * 20, 1, false));
} else {
- Potion.potionTypes[value]
- .affectEntity(par3EntityPlayer,
- par3EntityPlayer,
- 1,
- 1);
+ Potion.potionTypes[value].affectEntity(par3EntityPlayer, par3EntityPlayer, 1, 1);
}
- if (!par3EntityPlayer.getEntityData()
- .hasKey("PotionKnowledge")) {
- par3EntityPlayer.getEntityData()
- .setIntArray("PotionKnowledge",
- new int[] {
- -1,
- -1,
- -1,
- -1,
- -1,
- -1,
- -1,
- -1,
- -1,
- -1,
- -1,
- -1
- });
+ if (!par3EntityPlayer.getEntityData().hasKey("PotionKnowledge")) {
+ par3EntityPlayer.getEntityData().setIntArray("PotionKnowledge",
+ new int[] { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 });
}
- if (par3EntityPlayer.getEntityData()
- .getIntArray("PotionKnowledge")[damage] == -1) {
- par3EntityPlayer.getEntityData()
- .getIntArray("PotionKnowledge")[damage] = 1;
+ if (par3EntityPlayer.getEntityData().getIntArray("PotionKnowledge")[damage] == -1) {
+ par3EntityPlayer.getEntityData().getIntArray("PotionKnowledge")[damage] = 1;
- NewPacketHandler.UPDATE_POTION_KNOWLEDGE
- .sendToPlayer(par3EntityPlayer,
- par3EntityPlayer.getEntityData()
- .getIntArray("PotionKnowledge"));
+ NewPacketHandler.UPDATE_POTION_KNOWLEDGE.sendToPlayer(par3EntityPlayer,
+ par3EntityPlayer.getEntityData().getIntArray("PotionKnowledge"));
Potion potion = Potion.potionTypes[CommonTickHandler.worldData.potionValues[damage]];
- String name = StatCollector
- .translateToLocal(
- potion.getName())
- + " Potion";
+ String name = StatCollector.translateToLocal(potion.getName()) + " Potion";
if (!potion.isInstant()) {
int time = CommonTickHandler.worldData.potionDurations[damage];
- name += " (" + time
- + " seconds)";
+ name += " (" + time + " seconds)";
}
- NewPacketHandler.SEND_MESSAGE
- .sendToPlayer(par3EntityPlayer,
- "\u00A7oYou learnt Mystery Potion #"
- + (damage + 1)
- + " was a "
- + name
- + "!");
+ NewPacketHandler.SEND_MESSAGE.sendToPlayer(par3EntityPlayer,
+ "\u00A7oYou learnt Mystery Potion #" + (damage + 1) + " was a " + name + "!");
}
}
} else if (!par2World.isRemote) {
- int value = ModjamMod.r.nextInt(
- Potion.potionTypes.length);
+ int value = ModjamMod.r.nextInt(Potion.potionTypes.length);
while (Potion.potionTypes[value] == null) {
- value = ModjamMod.r.nextInt(
- Potion.potionTypes.length);
+ value = ModjamMod.r.nextInt(Potion.potionTypes.length);
}
int time = 5 + ModjamMod.r.nextInt(26);
if (!Potion.potionTypes[value].isInstant()) {
- par3EntityPlayer.addPotionEffect(
- new PotionEffect(value,
- time * 20,
- 1, false));
+ par3EntityPlayer.addPotionEffect(new PotionEffect(value, time * 20, 1, false));
} else {
- Potion.potionTypes[value].affectEntity(
- par3EntityPlayer,
- par3EntityPlayer, 1, 1);
+ Potion.potionTypes[value].affectEntity(par3EntityPlayer, par3EntityPlayer, 1, 1);
}
Potion potion = Potion.potionTypes[value];
- String name = StatCollector.translateToLocal(
- potion.getName()) + " Potion";
+ String name = StatCollector.translateToLocal(potion.getName()) + " Potion";
if (!potion.isInstant()) {
name += " (" + time + " seconds)";
}
- NewPacketHandler.SEND_MESSAGE.sendToPlayer(
- par3EntityPlayer,
- "\u00A7oYou drank a " + name
- + ".");
+ NewPacketHandler.SEND_MESSAGE.sendToPlayer(par3EntityPlayer, "\u00A7oYou drank a " + name + ".");
}
return par1ItemStack;
@@ -287,16 +204,12 @@ public class ItemMysteryPotion extends Item { @SideOnly(Side.CLIENT)
public boolean hasBlessing(String bless) {
return (Minecraft.getMinecraft().thePlayer != null
- && BlessingUtils.hasBlessing(Minecraft
- .getMinecraft().thePlayer,
- bless));
+ && BlessingUtils.hasBlessing(Minecraft.getMinecraft().thePlayer, bless));
}
@Override
- public boolean onItemUse(ItemStack par1ItemStack,
- EntityPlayer par2EntityPlayer, World par3World,
- int par4, int par5, int par6, int par7, float par8,
- float par9, float par10) {
+ public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4,
+ int par5, int par6, int par7, float par8, float par9, float par10) {
return false;
}
diff --git a/YWD/src/main/java/fyresmodjam/items/ItemObsidianSceptre.java b/YWD/src/main/java/fyresmodjam/items/ItemObsidianSceptre.java index f1c179e..9bb5050 100755 --- a/YWD/src/main/java/fyresmodjam/items/ItemObsidianSceptre.java +++ b/YWD/src/main/java/fyresmodjam/items/ItemObsidianSceptre.java @@ -22,16 +22,13 @@ public class ItemObsidianSceptre extends Item { @Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister par1IconRegister) {
- icon = par1IconRegister.registerIcon(
- "fyresmodjam:unenchantedSceptre");
- icon2 = par1IconRegister.registerIcon(
- "fyresmodjam:enchantedSceptre");
+ icon = par1IconRegister.registerIcon("fyresmodjam:unenchantedSceptre");
+ icon2 = par1IconRegister.registerIcon("fyresmodjam:enchantedSceptre");
itemIcon = icon;
}
@Override
- public void getSubItems(Item par1, CreativeTabs par2CreativeTabs,
- List par3List) {
+ public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List par3List) {
for (int i = 0; i < 2; i++) {
par3List.add(new ItemStack(par1, 1, i));
}
@@ -40,10 +37,7 @@ public class ItemObsidianSceptre extends Item { @Override
@SideOnly(Side.CLIENT)
public String getItemStackDisplayName(ItemStack par1ItemStack) {
- return (par1ItemStack.getItemDamage() == 0 ? ""
- : "Infused ")
- + super.getItemStackDisplayName(
- par1ItemStack);
+ return (par1ItemStack.getItemDamage() == 0 ? "" : "Infused ") + super.getItemStackDisplayName(par1ItemStack);
}
@Override
diff --git a/YWD/src/main/java/fyresmodjam/items/ItemPillar.java b/YWD/src/main/java/fyresmodjam/items/ItemPillar.java index 3f47f15..29f41d8 100755 --- a/YWD/src/main/java/fyresmodjam/items/ItemPillar.java +++ b/YWD/src/main/java/fyresmodjam/items/ItemPillar.java @@ -27,25 +27,20 @@ public class ItemPillar extends Item { }
@Override
- public void getSubItems(Item par1, CreativeTabs par2CreativeTabs,
- List par3List) {
+ public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List par3List) {
if (ConfigData.showAllPillarsInCreative) {
- for (Blessing bless : BlessingUtils.playerBlessings
- .values()) {
- par3List.add(new ItemStack(par1, 1,
- bless.ordinal));
+ for (Blessing bless : BlessingUtils.playerBlessings.values()) {
+ par3List.add(new ItemStack(par1, 1, bless.ordinal));
}
} else {
- super.getSubItems(par1, par2CreativeTabs,
- par3List);
+ super.getSubItems(par1, par2CreativeTabs, par3List);
}
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister par1IconRegister) {
- itemIcon = par1IconRegister
- .registerIcon("fyresmodjam:itemPillar");
+ itemIcon = par1IconRegister.registerIcon("fyresmodjam:itemPillar");
}
@Override
@@ -53,34 +48,26 @@ public class ItemPillar extends Item { public String getItemStackDisplayName(ItemStack par1ItemStack) {
String blessingName = "Unknown";
- for (Blessing bless : BlessingUtils.playerBlessings
- .values()) {
- if (bless.ordinal == par1ItemStack.getItemDamage()
- - 1) {
+ for (Blessing bless : BlessingUtils.playerBlessings.values()) {
+ if (bless.ordinal == par1ItemStack.getItemDamage() - 1) {
blessingName = bless.customName();
}
}
String blessing = " ( " + blessingName + ")";
- return super.getItemStackDisplayName(par1ItemStack)
- + (par1ItemStack.getItemDamage() == 0 ? ""
- : blessing);
+ return super.getItemStackDisplayName(par1ItemStack) + (par1ItemStack.getItemDamage() == 0 ? "" : blessing);
}
@Override
- public boolean onItemUse(ItemStack par1ItemStack,
- EntityPlayer par2EntityPlayer, World par3World,
- int par4, int par5, int par6, int par7, float par8,
- float par9, float par10) {
+ public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4,
+ int par5, int par6, int par7, float par8, float par9, float par10) {
Block block = ModjamMod.blockPillar;
if (par7 == 0) {
par5 -= 2;
}
- if (par7 == 1 && !par3World.getBlock(par4, par5, par6)
- .isReplaceable(par3World, par4, par5,
- par6)) {
+ if (par7 == 1 && !par3World.getBlock(par4, par5, par6).isReplaceable(par3World, par4, par5, par6)) {
++par5;
}
if (par7 == 2) {
@@ -100,24 +87,15 @@ public class ItemPillar extends Item { return false;
} else {
par3World.setBlock(par4, par5, par6, block);
- par3World.setBlockMetadataWithNotify(par4, par5,
- par6, 0, 0);
+ par3World.setBlockMetadataWithNotify(par4, par5, par6, 0, 0);
par3World.setBlock(par4, par5 + 1, par6, block);
- par3World.setBlockMetadataWithNotify(par4,
- par5 + 1, par6, 1, 0);
+ par3World.setBlockMetadataWithNotify(par4, par5 + 1, par6, 1, 0);
if (par1ItemStack.getItemDamage() != 0) {
- for (Map.Entry<String, Blessing> bless : BlessingUtils.playerBlessings
- .entrySet()) {
- if (bless.getValue().ordinal == par1ItemStack
- .getItemDamage()
- - 1) {
- ((TileEntityPillar) par3World
- .getTileEntity(par4,
- par5,
- par6)).blessing = bless
- .getKey();
+ for (Map.Entry<String, Blessing> bless : BlessingUtils.playerBlessings.entrySet()) {
+ if (bless.getValue().ordinal == par1ItemStack.getItemDamage() - 1) {
+ ((TileEntityPillar) par3World.getTileEntity(par4, par5, par6)).blessing = bless.getKey();
}
}
}
diff --git a/YWD/src/main/java/fyresmodjam/items/ItemScroll.java b/YWD/src/main/java/fyresmodjam/items/ItemScroll.java index 5b1046d..8fda744 100755 --- a/YWD/src/main/java/fyresmodjam/items/ItemScroll.java +++ b/YWD/src/main/java/fyresmodjam/items/ItemScroll.java @@ -20,31 +20,25 @@ import net.minecraft.world.World; public class ItemScroll extends Item {
- public static String[][] scrollText = new String[][] {
- {
- "Unkown Adventurer",
- "Codex #1: Adventurer's Log",
- "This morning I fell out of the sky. I am unsure of where I am, or for what purpose, but I've begun construction of a small shelter for the time being.",
- "I've now spent days scouting the nearby area with no luck. Still alone, I'm made my decision to set out further.",
- "I've discovered an ancient stronghold. Writtings of end times cover the walls. What could it mean? Who built this place? Why was it here? And I have an unsettling feeling that I'm being watched..."
- }, {
- "Village Elder",
- "Codex #2: An Elders Warning",
+ public static String[][] scrollText = new String[][] { { "Unkown Adventurer", "Codex #1: Adventurer's Log",
+ "This morning I fell out of the sky. I am unsure of where I am, or for what purpose, but I've begun construction of a small shelter for the time being.",
+ "I've now spent days scouting the nearby area with no luck. Still alone, I'm made my decision to set out further.",
+ "I've discovered an ancient stronghold. Writtings of end times cover the walls. What could it mean? Who built this place? Why was it here? And I have an unsettling feeling that I'm being watched..." },
+ { "Village Elder", "Codex #2: An Elders Warning",
"For thousands of years, we have lived peacefully. As stories of the distant past began to fade in time, the elders became tasked with remembering. I now join their ranks, but still I see there are those who choose to forget.",
- "The lines between worlds begin to blur once again. In the deepest caverns, we can see in to their world, and theirs in to ours. The end returns, yet no other will listen. It's clear I must find the crystal alone."
- }, {
- "Pigman Warrior",
- "Codex #3: The Warriors Spirit",
+ "The lines between worlds begin to blur once again. In the deepest caverns, we can see in to their world, and theirs in to ours. The end returns, yet no other will listen. It's clear I must find the crystal alone." },
+ { "Pigman Warrior", "Codex #3: The Warriors Spirit",
"We fight through the fires of this realm, thinking as one. It is the only way to survive this wretched landscape. Hurt one and the horde will know.",
"Strangers enter our realm through even stranger portals. They seek the crystal which bonds our world. We refuse, we fight, but many die. Our numbers begin dwindle, but the crystal will stay ours.",
- "We can see the void seeping through the cracks of our realm, reanimating the dead. Empty husks of our fallen push back the intruders. But they too are affected by the void's forces."
- }, {
- "Enderman Urchin",
- "Codex #4: From the Shadows",
- "The darkness shall consume all, below each of the worlds it boils. We now wait for our time to return, watching through the cracks of space and time. Us children of the Ender will reclaim what was once ours."
- } /*
- * , {"Author", "Codex #5" , "Words"}
- */
+ "We can see the void seeping through the cracks of our realm, reanimating the dead. Empty husks of our fallen push back the intruders. But they too are affected by the void's forces." },
+ { "Enderman Urchin", "Codex #4: From the Shadows",
+ "The darkness shall consume all, below each of the worlds it boils. We now wait for our time to return, watching through the cracks of space and time. Us children of the Ender will reclaim what was once ours." } /*
+ * ,
+ * {"Author",
+ * "Codex #5"
+ * ,
+ * "Words"}
+ */
};
public IIcon texture;
@@ -63,39 +57,26 @@ public class ItemScroll extends Item { }
@Override
- public void onUpdate(ItemStack stack, World world, Entity entity,
- int par1, boolean b) {
+ public void onUpdate(ItemStack stack, World world, Entity entity, int par1, boolean b) {
if (!world.isRemote) {
if (!stack.hasTagCompound()) {
stack.stackTagCompound = new NBTTagCompound();
}
- if (!stack.getTagCompound().hasKey("initialized")
- || !stack.getTagCompound()
- .getBoolean("initialized")) {
- stack.getTagCompound().setBoolean(
- "initialized", true);
+ if (!stack.getTagCompound().hasKey("initialized") || !stack.getTagCompound().getBoolean("initialized")) {
+ stack.getTagCompound().setBoolean("initialized", true);
- ItemStack book = new ItemStack(
- Items.written_book, 1, 0);
+ ItemStack book = new ItemStack(Items.written_book, 1, 0);
NBTTagList pages = new NBTTagList();
- for (int i = 2; i < scrollText[stack
- .getItemDamage()
- % scrollText.length].length; i++) {
- pages.appendTag(new NBTTagString(
- scrollText[stack.getItemDamage()
- % scrollText.length][i]));
+ for (int i = 2; i < scrollText[stack.getItemDamage() % scrollText.length].length; i++) {
+ pages.appendTag(new NBTTagString(scrollText[stack.getItemDamage() % scrollText.length][i]));
}
book.setTagInfo("pages", pages);
- book.setTagInfo("author", new NBTTagString(
- scrollText[stack.getItemDamage()
- % scrollText.length][0]));
- book.setTagInfo("title", new NBTTagString(
- scrollText[stack.getItemDamage()
- % scrollText.length][1]));
+ book.setTagInfo("author", new NBTTagString(scrollText[stack.getItemDamage() % scrollText.length][0]));
+ book.setTagInfo("title", new NBTTagString(scrollText[stack.getItemDamage() % scrollText.length][1]));
NBTTagCompound bookTag = new NBTTagCompound();
book.writeToNBT(bookTag);
@@ -105,38 +86,29 @@ public class ItemScroll extends Item { }
@Override
- public void getSubItems(Item id, CreativeTabs creativeTab,
- List list) {
+ public void getSubItems(Item id, CreativeTabs creativeTab, List list) {
for (int i = 0; i < scrollText.length; i++) {
list.add(new ItemStack(id, 1, i));
}
}
@Override
- public ItemStack onItemRightClick(ItemStack par1ItemStack,
- World par2World, EntityPlayer par3EntityPlayer) {
- NBTTagCompound bookTag = par1ItemStack.getTagCompound()
- .getCompoundTag("book");
+ public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
+ NBTTagCompound bookTag = par1ItemStack.getTagCompound().getCompoundTag("book");
if (bookTag != null) {
- par3EntityPlayer.displayGUIBook(ItemStack
- .loadItemStackFromNBT(bookTag));
+ par3EntityPlayer.displayGUIBook(ItemStack.loadItemStackFromNBT(bookTag));
}
return par1ItemStack;
}
@Override
public String getItemStackDisplayName(ItemStack par1ItemStack) {
- return scrollText[par1ItemStack.getItemDamage()
- % scrollText.length][1];
+ return scrollText[par1ItemStack.getItemDamage() % scrollText.length][1];
}
@Override
@SideOnly(Side.CLIENT)
- public void addInformation(ItemStack par1ItemStack,
- EntityPlayer par2EntityPlayer, List par3List,
- boolean par4) {
- par3List.add(EnumChatFormatting.GRAY
- + scrollText[par1ItemStack.getItemDamage()
- % scrollText.length][0]);
+ public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
+ par3List.add(EnumChatFormatting.GRAY + scrollText[par1ItemStack.getItemDamage() % scrollText.length][0]);
}
}
diff --git a/YWD/src/main/java/fyresmodjam/items/ItemTrap.java b/YWD/src/main/java/fyresmodjam/items/ItemTrap.java index 8cf856e..b66c0f9 100755 --- a/YWD/src/main/java/fyresmodjam/items/ItemTrap.java +++ b/YWD/src/main/java/fyresmodjam/items/ItemTrap.java @@ -24,17 +24,14 @@ public class ItemTrap extends Item { private static final IBehaviorDispenseItem dispenseTrap = new BehaviorDispenseTrap();
- public IIcon[] icons;
- public static String[] iconLocations = new String[] {
- "fyresmodjam:itemTrap", "fyresmodjam:trap2",
- "fyresmodjam:trap3"
- };
+ public IIcon[] icons;
+ public static String[] iconLocations = new String[] { "fyresmodjam:itemTrap", "fyresmodjam:trap2",
+ "fyresmodjam:trap3" };
public ItemTrap() {
super();
setHasSubtypes(true);
- BlockDispenser.dispenseBehaviorRegistry.putObject(this,
- dispenseTrap);
+ BlockDispenser.dispenseBehaviorRegistry.putObject(this, dispenseTrap);
}
@Override
@@ -42,30 +39,25 @@ public class ItemTrap extends Item { public void registerIcons(IIconRegister par1IconRegister) {
icons = new IIcon[iconLocations.length];
for (int i = 0; i < iconLocations.length; i++) {
- icons[i] = par1IconRegister
- .registerIcon(iconLocations[i]);
+ icons[i] = par1IconRegister.registerIcon(iconLocations[i]);
}
itemIcon = icons[0];
}
@Override
- public void getSubItems(Item par1, CreativeTabs par2CreativeTabs,
- List par3List) {
+ public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List par3List) {
for (int i = 0; i < BlockTrap.trapTypes; i++) {
par3List.add(new ItemStack(par1, 1, i));
}
}
- public static String[] names = {
- "Spike Trap", "Flame Trap", "Smoke Trap"
- };
+ public static String[] names = { "Spike Trap", "Flame Trap", "Smoke Trap" };
@Override
@SideOnly(Side.CLIENT)
public String getItemStackDisplayName(ItemStack par1ItemStack) {
- return names[par1ItemStack.getItemDamage()
- % BlockTrap.trapTypes];
+ return names[par1ItemStack.getItemDamage() % BlockTrap.trapTypes];
}
@Override
@@ -75,20 +67,14 @@ public class ItemTrap extends Item { }
@Override
- public boolean onItemUse(ItemStack par1ItemStack,
- EntityPlayer par2EntityPlayer, World par3World,
- int par4, int par5, int par6, int par7, float par8,
- float par9, float par10) {
+ public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4,
+ int par5, int par6, int par7, float par8, float par9, float par10) {
Block i1 = par3World.getBlock(par4, par5, par6);
- if (i1 == Blocks.snow && (par3World.getBlockMetadata(par4,
- par5, par6) & 7) < 1) {
+ if (i1 == Blocks.snow && (par3World.getBlockMetadata(par4, par5, par6) & 7) < 1) {
par7 = 1;
- } else if (i1 != Blocks.vine && i1 != Blocks.tallgrass
- && i1 != Blocks.deadbush
- && (i1 == null || !i1.isReplaceable(
- par3World, par4, par5,
- par6))) {
+ } else if (i1 != Blocks.vine && i1 != Blocks.tallgrass && i1 != Blocks.deadbush
+ && (i1 == null || !i1.isReplaceable(par3World, par4, par5, par6))) {
if (par7 == 0) {
--par5;
}
@@ -111,34 +97,20 @@ public class ItemTrap extends Item { if (par1ItemStack.stackSize == 0) {
return false;
- } else if (!par2EntityPlayer.canPlayerEdit(par4, par5,
- par6, par7, par1ItemStack)) {
+ } else if (!par2EntityPlayer.canPlayerEdit(par4, par5, par6, par7, par1ItemStack)) {
return false;
- } else if (par5 == 255 && ModjamMod.blockTrap.getMaterial()
- .isSolid()) {
+ } else if (par5 == 255 && ModjamMod.blockTrap.getMaterial().isSolid()) {
return false;
- } else if (par3World.canPlaceEntityOnSide(
- ModjamMod.blockTrap, par4, par5, par6,
- false, par7, par2EntityPlayer,
+ } else if (par3World.canPlaceEntityOnSide(ModjamMod.blockTrap, par4, par5, par6, false, par7, par2EntityPlayer,
par1ItemStack)) {
Block block = ModjamMod.blockTrap;
- int j1 = getMetadata(
- par1ItemStack.getItemDamage());
- int k1 = ModjamMod.blockTrap.onBlockPlaced(
- par3World, par4, par5, par6, par7,
- par8, par9, par10, j1);
-
- if (placeBlockAt(par1ItemStack, par2EntityPlayer,
- par3World, par4, par5, par6, par7,
- par8, par9, par10, k1)) {
- par3World.playSoundEffect(par4 + 0.5F,
- par5 + 0.5F, par6 + 0.5F,
- block.stepSound.func_150496_b(),
- (block.stepSound.getVolume()
- + 1.0F)
- / 2.0F,
- block.stepSound.getPitch()
- * 0.8F);
+ int j1 = getMetadata(par1ItemStack.getItemDamage());
+ int k1 = ModjamMod.blockTrap.onBlockPlaced(par3World, par4, par5, par6, par7, par8, par9, par10, j1);
+
+ if (placeBlockAt(par1ItemStack, par2EntityPlayer, par3World, par4, par5, par6, par7, par8, par9, par10,
+ k1)) {
+ par3World.playSoundEffect(par4 + 0.5F, par5 + 0.5F, par6 + 0.5F, block.stepSound.func_150496_b(),
+ (block.stepSound.getVolume() + 1.0F) / 2.0F, block.stepSound.getPitch() * 0.8F);
--par1ItemStack.stackSize;
}
@@ -149,19 +121,14 @@ public class ItemTrap extends Item { }
@SideOnly(Side.CLIENT)
- public boolean canPlaceItemBlockOnSide(World par1World, int par2,
- int par3, int par4, int par5,
- EntityPlayer par6EntityPlayer,
- ItemStack par7ItemStack) {
+ public boolean canPlaceItemBlockOnSide(World par1World, int par2, int par3, int par4, int par5,
+ EntityPlayer par6EntityPlayer, ItemStack par7ItemStack) {
Block i1 = par1World.getBlock(par2, par3, par4);
if (i1 == Blocks.snow) {
par5 = 1;
- } else if (i1 != Blocks.vine && i1 != Blocks.tallgrass
- && i1 != Blocks.deadbush
- && (i1 == null || !i1.isReplaceable(
- par1World, par2, par3,
- par4))) {
+ } else if (i1 != Blocks.vine && i1 != Blocks.tallgrass && i1 != Blocks.deadbush
+ && (i1 == null || !i1.isReplaceable(par1World, par2, par3, par4))) {
if (par5 == 0) {
--par3;
}
@@ -182,24 +149,19 @@ public class ItemTrap extends Item { }
}
- return par1World.canPlaceEntityOnSide(ModjamMod.blockTrap,
- par2, par3, par4, false, par5,
- (Entity) null, par7ItemStack);
+ return par1World.canPlaceEntityOnSide(ModjamMod.blockTrap, par2, par3, par4, false, par5, (Entity) null,
+ par7ItemStack);
}
- public boolean placeBlockAt(ItemStack stack, EntityPlayer player,
- World world, int x, int y, int z, int side,
+ public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side,
float hitX, float hitY, float hitZ, int metadata) {
- if (!world.setBlock(x, y, z, ModjamMod.blockTrap, metadata,
- 3)) {
+ if (!world.setBlock(x, y, z, ModjamMod.blockTrap, metadata, 3)) {
return false;
}
if (world.getBlock(x, y, z) == ModjamMod.blockTrap) {
- ModjamMod.blockTrap.onBlockPlacedBy(world, x, y, z,
- player, stack);
- ModjamMod.blockTrap.onPostBlockPlaced(world, x, y,
- z, metadata);
+ ModjamMod.blockTrap.onBlockPlacedBy(world, x, y, z, player, stack);
+ ModjamMod.blockTrap.onPostBlockPlaced(world, x, y, z, metadata);
}
return true;
diff --git a/YWD/src/main/java/fyresmodjam/misc/ArmorStatTracker.java b/YWD/src/main/java/fyresmodjam/misc/ArmorStatTracker.java index 80a8c2a..89abffa 100755 --- a/YWD/src/main/java/fyresmodjam/misc/ArmorStatTracker.java +++ b/YWD/src/main/java/fyresmodjam/misc/ArmorStatTracker.java @@ -7,23 +7,9 @@ import net.minecraft.item.ItemBow; import net.minecraft.item.ItemStack; public final class ArmorStatTracker extends ItemStat { - public String[][] prefixesByRank = { - { - "Old", "Broken", "Worn", "Weak" - }, { - "Average", "Decent", "Modest", - "Ordinary" - }, { - "Polished", "Tough", "Hardened", - "Durable" - }, { - "Elite", "Astonishing", - "Reinforced", "Resilient" - }, { - "Godly", "Divine", "Fabled", - "Legendary" - } - }; + public String[][] prefixesByRank = { { "Old", "Broken", "Worn", "Weak" }, + { "Average", "Decent", "Modest", "Ordinary" }, { "Polished", "Tough", "Hardened", "Durable" }, + { "Elite", "Astonishing", "Reinforced", "Resilient" }, { "Godly", "Divine", "Fabled", "Legendary" } }; public ArmorStatTracker(String name, Object value) { super(name, value); @@ -42,35 +28,23 @@ public final class ArmorStatTracker extends ItemStat { @Override public void modifyStack(ItemStack stack, Random r) { - int rank = Integer.parseInt( - stack.getTagCompound().getString(name)); + int rank = Integer.parseInt(stack.getTagCompound().getString(name)); float damageReduction = (rank - 1) + r.nextFloat() * 0.5F; - ItemStatHelper.giveStat(stack, "DamageReduction", - String.format("%.2f", damageReduction)); - ItemStatHelper.addLore(stack, !String - .format("%.2f", damageReduction) - .equals("0.00") ? "\u00A77\u00A7o " - + (damageReduction > 0 - ? "+" - : "") - + String.format("%.2f", - damageReduction) - + "% damage reduction" - : null); + ItemStatHelper.giveStat(stack, "DamageReduction", String.format("%.2f", damageReduction)); + ItemStatHelper.addLore(stack, !String.format("%.2f", damageReduction).equals("0.00") ? "\u00A77\u00A7o " + + (damageReduction > 0 ? "+" : "") + String.format("%.2f", damageReduction) + "% damage reduction" + : null); ItemStatHelper.addLore(stack, "\u00A7eRank: " + rank); } @Override public String getAlteredStackName(ItemStack stack, Random r) { - String[] list = prefixesByRank[Integer.parseInt( - stack.getTagCompound().getString(name)) - - 1]; + String[] list = prefixesByRank[Integer.parseInt(stack.getTagCompound().getString(name)) - 1]; String prefix = list[r.nextInt(list.length)]; - if (prefix.equals("Sharp") - && stack.getItem() instanceof ItemBow) { + if (prefix.equals("Sharp") && stack.getItem() instanceof ItemBow) { prefix = "Long"; } diff --git a/YWD/src/main/java/fyresmodjam/misc/BehaviorDispenseTrap.java b/YWD/src/main/java/fyresmodjam/misc/BehaviorDispenseTrap.java index ee06715..f655fd6 100755 --- a/YWD/src/main/java/fyresmodjam/misc/BehaviorDispenseTrap.java +++ b/YWD/src/main/java/fyresmodjam/misc/BehaviorDispenseTrap.java @@ -13,28 +13,21 @@ public class BehaviorDispenseTrap extends BehaviorDefaultDispenseItem { private final BehaviorDefaultDispenseItem field_96465_b = new BehaviorDefaultDispenseItem();
@Override
- public ItemStack dispenseStack(IBlockSource par1IBlockSource,
- ItemStack par2ItemStack) {
+ public ItemStack dispenseStack(IBlockSource par1IBlockSource, ItemStack par2ItemStack) {
- EnumFacing enumfacing = BlockDispenser.func_149937_b(
- par1IBlockSource.getBlockMetadata());
+ EnumFacing enumfacing = BlockDispenser.func_149937_b(par1IBlockSource.getBlockMetadata());
World world = par1IBlockSource.getWorld();
- int i = par1IBlockSource.getXInt()
- + enumfacing.getFrontOffsetX();
- int j = par1IBlockSource.getYInt()
- + enumfacing.getFrontOffsetY();
- int k = par1IBlockSource.getZInt()
- + enumfacing.getFrontOffsetZ();
+ int i = par1IBlockSource.getXInt() + enumfacing.getFrontOffsetX();
+ int j = par1IBlockSource.getYInt() + enumfacing.getFrontOffsetY();
+ int k = par1IBlockSource.getZInt() + enumfacing.getFrontOffsetZ();
if (!ModjamMod.blockTrap.canPlaceBlockAt(world, i, j, k)) {
- return field_96465_b.dispense(par1IBlockSource,
- par2ItemStack);
+ return field_96465_b.dispense(par1IBlockSource, par2ItemStack);
}
- world.setBlock(i, j, k, ModjamMod.blockTrap,
- par2ItemStack.getItemDamage(), 0);
+ world.setBlock(i, j, k, ModjamMod.blockTrap, par2ItemStack.getItemDamage(), 0);
world.markBlockForUpdate(i, j, k);
par2ItemStack.splitStack(1);
diff --git a/YWD/src/main/java/fyresmodjam/misc/ConfigData.java b/YWD/src/main/java/fyresmodjam/misc/ConfigData.java index 0d7a328..c43930c 100644 --- a/YWD/src/main/java/fyresmodjam/misc/ConfigData.java +++ b/YWD/src/main/java/fyresmodjam/misc/ConfigData.java @@ -6,6 +6,12 @@ import net.minecraftforge.common.config.Configuration; public class ConfigData { /* + * Categories for config options. + */ + private static final String CTG_WORLDGEN = "worldgen"; + private static final String CTG_MOBS = "mobs"; + + /* * Starting ID for achievements */ public static int achievementID = 2500; @@ -13,32 +19,36 @@ public class ConfigData { /* * Keybindings */ - public static int examineKey = Keyboard.KEY_X; - public static int blessingKey = Keyboard.KEY_K; + public static int examineKey = Keyboard.KEY_X; + public static int blessingKey = Keyboard.KEY_K; /* * World generation settings */ + // Pillars - public static int pillarGenChance = 75; - public static int maxPillarsPerChunk = 3; - public static boolean spawnRandomPillars = true; + public static int pillarGenChance = 75; + public static int maxPillarsPerChunk = 3; + public static boolean spawnRandomPillars = true; + // Towers - public static int towerGenChance = 225; - public static boolean spawnTowers = true; + public static int towerGenChance = 225; + public static boolean spawnTowers = true; + // Traps - public static int trapGenChance = 300; - public static boolean spawnTraps = true; - public static boolean trapsBelowGroundOnly = false; + public static int trapGenChance = 300; + public static boolean spawnTraps = true; + public static boolean trapsBelowGroundOnly = false; + // Mushrooms public static int mushroomReplaceChance = 15; /* * Statistic tracking */ - public static boolean enableWeaponKillStats = true; - public static boolean enableMobKillStats = true; - public static boolean enableCraftingStats = true; + public static boolean enableWeaponKillStats = true; + public static boolean enableMobKillStats = true; + public static boolean enableCraftingStats = true; /* * Blessing/Mark parameters @@ -48,93 +58,63 @@ public class ConfigData { /* * Misc. Toggles */ - public static boolean pillarGlow = true; - public static boolean disableDisadvantages = false; - public static boolean versionChecking = true; - public static boolean showAllPillarsInCreative = false; + public static boolean pillarGlow = true; + public static boolean disableDisadvantages = false; + public static boolean versionChecking = true; + public static boolean showAllPillarsInCreative = false; + + /* + * Mob config data + */ + // One in X normal mobs will receive a blessing + public static int diabolicChance = 20; + // A mob of at least this level will receive a blessing + public static int blessingLevel = 5; + // Determines how likely a mob is to be leveled up. Higher is lower + public static int levelupChance = 3; + // A mob gets this percentage of their health additional per level + public static double healthLevelMult = 0.25; + // A mob gets this flat amount on top of their adjusted health, per level + public static int healthLevelFlat = 1; + public static void loadFromConfig(Configuration config) { - pillarGlow = config - .get(Configuration.CATEGORY_GENERAL, - "pillar_glow", - pillarGlow) - .getBoolean(pillarGlow); - - pillarGenChance = config - .get(Configuration.CATEGORY_GENERAL, - "pillar_gen_difficulty", - pillarGenChance) - .getInt(); - maxPillarsPerChunk = config.get( - Configuration.CATEGORY_GENERAL, - "max_pillars_per_chunk", - maxPillarsPerChunk).getInt(); - towerGenChance = config - .get(Configuration.CATEGORY_GENERAL, - "tower_gen_difficulty", - towerGenChance) - .getInt(); - trapGenChance = config - .get(Configuration.CATEGORY_GENERAL, - "trap_gen_difficulty", - trapGenChance) - .getInt(); - mushroomReplaceChance = config.get( - Configuration.CATEGORY_GENERAL, - "mushroom_replace_difficulty", - mushroomReplaceChance).getInt(); - - spawnTraps = !(config - .get(Configuration.CATEGORY_GENERAL, - "disable_traps", - !spawnTraps) - .getBoolean(!spawnTraps)); - spawnTowers = config - .get(Configuration.CATEGORY_GENERAL, - "spawn_towers", - spawnTowers) - .getBoolean(spawnTowers); - spawnRandomPillars = config.get( - Configuration.CATEGORY_GENERAL, - "spawn_random_pillars", - spawnRandomPillars) + diabolicChance = config.get(CTG_MOBS, "diabolic_chance", diabolicChance).getInt(); + blessingLevel = config.get(CTG_MOBS, "blessing_level", diabolicChance).getInt(); + levelupChance = config.get(CTG_MOBS, "levelup_chance", diabolicChance).getInt(); + healthLevelMult = config.get(CTG_MOBS, "health_level_mult", 0).getDouble(); + healthLevelFlat = config.get(CTG_MOBS, "health_level_flat", 0).getInt(); + + pillarGlow = config.get(Configuration.CATEGORY_GENERAL, "pillar_glow", pillarGlow).getBoolean(pillarGlow); + + pillarGenChance = config.get(CTG_WORLDGEN, "pillar_gen_difficulty", pillarGenChance).getInt(); + maxPillarsPerChunk = config.get(CTG_WORLDGEN, "max_pillars_per_chunk", maxPillarsPerChunk).getInt(); + towerGenChance = config.get(CTG_WORLDGEN, "tower_gen_difficulty", towerGenChance).getInt(); + trapGenChance = config.get(CTG_WORLDGEN, "trap_gen_difficulty", trapGenChance).getInt(); + mushroomReplaceChance = config.get(CTG_WORLDGEN, "mushroom_replace_difficulty", mushroomReplaceChance).getInt(); + spawnTraps = !(config.get(CTG_WORLDGEN, "disable_traps", !spawnTraps).getBoolean(!spawnTraps)); + spawnTowers = config.get(CTG_WORLDGEN, "spawn_towers", spawnTowers).getBoolean(spawnTowers); + spawnRandomPillars = config.get(CTG_WORLDGEN, "spawn_random_pillars", spawnRandomPillars) .getBoolean(spawnRandomPillars); - disableDisadvantages = config.get( - Configuration.CATEGORY_GENERAL, - "disable_disadvantages", - disableDisadvantages) + + disableDisadvantages = config.get(Configuration.CATEGORY_GENERAL, "disable_disadvantages", disableDisadvantages) .getBoolean(disableDisadvantages); - versionChecking = config - .get(Configuration.CATEGORY_GENERAL, - "version_checking", - versionChecking) + versionChecking = config.get(Configuration.CATEGORY_GENERAL, "version_checking", versionChecking) .getBoolean(versionChecking); - - showAllPillarsInCreative = config.get( - Configuration.CATEGORY_GENERAL, - "show_all_pillars_in_creative", - showAllPillarsInCreative) + + showAllPillarsInCreative = config + .get(Configuration.CATEGORY_GENERAL, "show_all_pillars_in_creative", showAllPillarsInCreative) .getBoolean(showAllPillarsInCreative); - - enableMobKillStats = config.get( - Configuration.CATEGORY_GENERAL, - "enable_mob_kill_stats", - enableMobKillStats) + + enableMobKillStats = config.get(Configuration.CATEGORY_GENERAL, "enable_mob_kill_stats", enableMobKillStats) .getBoolean(enableMobKillStats); - enableWeaponKillStats = config.get( - Configuration.CATEGORY_GENERAL, - "enable_weapon_kill_stats", - enableWeaponKillStats) + enableWeaponKillStats = config + .get(Configuration.CATEGORY_GENERAL, "enable_weapon_kill_stats", enableWeaponKillStats) .getBoolean(enableWeaponKillStats); - enableCraftingStats = config.get( - Configuration.CATEGORY_GENERAL, - "enable_crafting_stats", - enableCraftingStats) + enableCraftingStats = config.get(Configuration.CATEGORY_GENERAL, "enable_crafting_stats", enableCraftingStats) .getBoolean(enableCraftingStats); - - trapsBelowGroundOnly = config.get( - Configuration.CATEGORY_GENERAL, - "traps_below_ground_only", - trapsBelowGroundOnly) + + trapsBelowGroundOnly = config + .get(Configuration.CATEGORY_GENERAL, "traps_below_ground_only", trapsBelowGroundOnly) .getBoolean(trapsBelowGroundOnly); } }
\ No newline at end of file diff --git a/YWD/src/main/java/fyresmodjam/misc/CreativeTabModjamMod.java b/YWD/src/main/java/fyresmodjam/misc/CreativeTabModjamMod.java index 718e9e5..6177ec4 100755 --- a/YWD/src/main/java/fyresmodjam/misc/CreativeTabModjamMod.java +++ b/YWD/src/main/java/fyresmodjam/misc/CreativeTabModjamMod.java @@ -36,23 +36,17 @@ public class CreativeTabModjamMod extends CreativeTabs { for (Field f : ModjamMod.class.getFields()) {
if (f.getType() == Item.class) {
- Item item = (Item) f.get(
- ModjamMod.instance);
- if (item == null || item
- .getCreativeTab() == null) {
+ Item item = (Item) f.get(ModjamMod.instance);
+ if (item == null || item.getCreativeTab() == null) {
continue;
}
item.getSubItems(item, this, list);
} else if (f.getType() == Block.class) {
- Block block = (Block) f.get(
- ModjamMod.instance);
- if (block == null || block
- .getCreativeTabToDisplayOn() == null) {
+ Block block = (Block) f.get(ModjamMod.instance);
+ if (block == null || block.getCreativeTabToDisplayOn() == null) {
continue;
}
- block.getSubBlocks(block.getItem(
- null, 0, 0, 0),
- this, list);
+ block.getSubBlocks(block.getItem(null, 0, 0, 0), this, list);
}
}
diff --git a/YWD/src/main/java/fyresmodjam/misc/DamageSourceRetaliation.java b/YWD/src/main/java/fyresmodjam/misc/DamageSourceRetaliation.java deleted file mode 100644 index 2dc89fd..0000000 --- a/YWD/src/main/java/fyresmodjam/misc/DamageSourceRetaliation.java +++ /dev/null @@ -1,11 +0,0 @@ -package fyresmodjam.misc; - -import net.minecraft.util.DamageSource; - -public class DamageSourceRetaliation extends DamageSource { - - public DamageSourceRetaliation(String name) { - super(name); - } - -} diff --git a/YWD/src/main/java/fyresmodjam/misc/DamageSources.java b/YWD/src/main/java/fyresmodjam/misc/DamageSources.java index b1fdc01..754f75b 100644 --- a/YWD/src/main/java/fyresmodjam/misc/DamageSources.java +++ b/YWD/src/main/java/fyresmodjam/misc/DamageSources.java @@ -5,17 +5,18 @@ import net.minecraft.util.DamageSource; public class DamageSources { private static boolean isInitted = false; - public static DamageSource inferno, retaliation; + public static DamageSource inferno; + public static DamageSource retaliation; + public static DamageSource trap; public static void doInit() { if (isInitted) { - inferno = new DamageSource("inferno") - .setDamageBypassesArmor() - .setDamageIsAbsolute(); + inferno = new DamageSource("inferno").setDamageBypassesArmor().setDamageIsAbsolute(); - retaliation = new DamageSource("retaliation") - .setDamageBypassesArmor(); + retaliation = new DamageSource("retaliation").setDamageBypassesArmor(); + trap = new DamageSource("ywdtrap"); + isInitted = true; } } diff --git a/YWD/src/main/java/fyresmodjam/misc/EntityStat.java b/YWD/src/main/java/fyresmodjam/misc/EntityStat.java index 84afd71..d9ff9cf 100755 --- a/YWD/src/main/java/fyresmodjam/misc/EntityStat.java +++ b/YWD/src/main/java/fyresmodjam/misc/EntityStat.java @@ -6,8 +6,8 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; public class EntityStat { - public String name; - public String value; + public String name; + public String value; public EntityStat(String name, String value) { this.name = name; diff --git a/YWD/src/main/java/fyresmodjam/misc/EntityStatHelper.java b/YWD/src/main/java/fyresmodjam/misc/EntityStatHelper.java index 92635b9..ab40a98 100755 --- a/YWD/src/main/java/fyresmodjam/misc/EntityStatHelper.java +++ b/YWD/src/main/java/fyresmodjam/misc/EntityStatHelper.java @@ -31,28 +31,20 @@ import net.minecraftforge.event.entity.living.LivingDeathEvent; @SuppressWarnings("rawtypes")
public class EntityStatHelper {
- public static String[] knowledge = {
- "Clueless", "Novice", "Competent", "Talented",
- "Expert", "Professional", "Master", "Legendary"
- };
-
- public static int[] killCount = {
- 0, 10, 25, 50, 100, 250, 500, 1000
- };
-
- public static float[] damageBonus = {
- 0, 0.01F, 0.025F, 0.05F, 0.075F, 0.1F, 0.15F, 0.2F
- };
- public static String[] damageBonusString = {
- "0", "1", "2.5", "5", "7.5", "10", "15", "20"
- };
+ public static String[] knowledge = { "Clueless", "Novice", "Competent", "Talented", "Expert", "Professional",
+ "Master", "Legendary" };
+
+ public static int[] killCount = { 0, 10, 25, 50, 100, 250, 500, 1000 };
+
+ public static float[] damageBonus = { 0, 0.01F, 0.025F, 0.05F, 0.075F, 0.1F, 0.15F, 0.2F };
+ public static String[] damageBonusString = { "0", "1", "2.5", "5", "7.5", "10", "15", "20" };
public static HashMap<Class, EntityStatTracker> statTrackersByClass = new HashMap<Class, EntityStatTracker>();
public static ArrayList<EntityStatTracker> genericTrackers = new ArrayList<EntityStatTracker>();
- public static ArrayList<EntityStatTracker> temp = new ArrayList<EntityStatTracker>();
- public static boolean b = false;
+ public static ArrayList<EntityStatTracker> temp = new ArrayList<EntityStatTracker>();
+ public static boolean b = false;
public static void addStatTracker(EntityStatTracker statTracker) {
if (statTracker.classes != null) {
@@ -69,8 +61,7 @@ public class EntityStatHelper { public static String getStat(Entity entity, String name) {
String s = null;
- if (entity.getEntityData() != null
- && entity.getEntityData().hasKey(name)) {
+ if (entity.getEntityData() != null && entity.getEntityData().hasKey(name)) {
s = entity.getEntityData().getString(name);
}
@@ -78,8 +69,7 @@ public class EntityStatHelper { }
public static String getUnalteredItemName(Item item) {
- return StatCollector.translateToLocal(
- item.getUnlocalizedName() + ".name");
+ return StatCollector.translateToLocal(item.getUnlocalizedName() + ".name");
}
public static String getUnalteredName(Entity entity) {
@@ -89,23 +79,19 @@ public class EntityStatHelper { s = "generic";
}
- return StatCollector
- .translateToLocal("entity." + s + ".name");
+ return StatCollector.translateToLocal("entity." + s + ".name");
}
- public static Entity giveStat(Entity entity, String name,
- Object value) {
+ public static Entity giveStat(Entity entity, String name, Object value) {
if (entity != null && name != null && value != null) {
- entity.getEntityData().setString(name,
- value.toString());
+ entity.getEntityData().setString(name, value.toString());
}
return entity;
}
public static boolean hasStat(Entity entity, String name) {
- if (entity.getEntityData() != null
- && entity.getEntityData().hasKey(name)) {
+ if (entity.getEntityData() != null && entity.getEntityData().hasKey(name)) {
return true;
}
@@ -121,15 +107,13 @@ public class EntityStatHelper { temp.clear();
if (statTrackersByClass.containsKey(entity.getClass())) {
- temp.add(statTrackersByClass
- .get(entity.getClass()));
+ temp.add(statTrackersByClass.get(entity.getClass()));
}
for (EntityStatTracker e : genericTrackers) {
if (!temp.contains(e)) {
for (Class c : e.classes) {
- if (c.isAssignableFrom(entity
- .getClass())) {
+ if (c.isAssignableFrom(entity.getClass())) {
temp.add(e);
break;
}
@@ -138,24 +122,17 @@ public class EntityStatHelper { }
if (!temp.isEmpty()) {
- String processed = EntityStatHelper.getStat(entity,
- "processed");
+ String processed = EntityStatHelper.getStat(entity, "processed");
- if (processed == null
- || processed.equals("false")) {
- EntityStatHelper.giveStat(entity,
- "processed", "true");
+ if (processed == null || processed.equals("false")) {
+ EntityStatHelper.giveStat(entity, "processed", "true");
for (EntityStatTracker statTracker : temp) {
for (EntityStat s : statTracker.stats) {
- giveStat(entity, s.name, s
- .getNewValue(r)
- .toString());
+ giveStat(entity, s.name, s.getNewValue(r).toString());
if (entity instanceof EntityLiving) {
- setName((EntityLiving) entity,
- s.getAlteredEntityName(
- (EntityLiving) entity));
+ setName((EntityLiving) entity, s.getAlteredEntityName((EntityLiving) entity));
}
s.modifyEntity(entity);
@@ -165,20 +142,16 @@ public class EntityStatHelper { }
}
- public static void setEntitySize(Entity entity, float par1,
- float par2) {
+ public static void setEntitySize(Entity entity, float par1, float par2) {
float f2;
if (par1 != entity.width || par2 != entity.height) {
f2 = entity.width;
entity.width = par1;
entity.height = par2;
- entity.boundingBox.maxX = entity.boundingBox.minX
- + entity.width;
- entity.boundingBox.maxZ = entity.boundingBox.minZ
- + entity.width;
- entity.boundingBox.maxY = entity.boundingBox.minY
- + entity.height;
+ entity.boundingBox.maxX = entity.boundingBox.minX + entity.width;
+ entity.boundingBox.maxZ = entity.boundingBox.minZ + entity.width;
+ entity.boundingBox.maxY = entity.boundingBox.minY + entity.height;
}
f2 = par1 % 2.0F;
@@ -206,12 +179,10 @@ public class EntityStatHelper { private void addOnKillStats(EntityPlayer player, String mob) {
if (!player.getEntityData().hasKey("KillStats")) {
- player.getEntityData().setTag("KillStats",
- new NBTTagCompound());
+ player.getEntityData().setTag("KillStats", new NBTTagCompound());
}
- NBTTagCompound killStats = player.getEntityData()
- .getCompoundTag("KillStats");
+ NBTTagCompound killStats = player.getEntityData().getCompoundTag("KillStats");
if (!killStats.hasKey(mob)) {
killStats.setInteger(mob, 0);
@@ -219,11 +190,7 @@ public class EntityStatHelper { if (!killStats.hasKey("TrackedMobList")) {
killStats.setString("TrackedMobList", mob);
} else {
- killStats.setString("TrackedMobList",
- killStats.getString(
- "TrackedMobList")
- + ";"
- + mob);
+ killStats.setString("TrackedMobList", killStats.getString("TrackedMobList") + ";" + mob);
}
}
@@ -231,46 +198,29 @@ public class EntityStatHelper { if (ConfigData.enableMobKillStats) {
for (int i = 0; i < knowledge.length; i++) {
- if (killCount[i] == killStats
- .getInteger(mob)) {
- NewPacketHandler.SEND_MESSAGE
- .sendToPlayer(player,
- "\u00A7o\u00A73You've become a "
- + knowledge[i].toLowerCase()
- + " "
- + mob.toLowerCase()
- + " slayer! (+"
- + damageBonusString[i]
- + "% damage against "
- + mob.toLowerCase()
- + "s.)"
- + (i < knowledge.length
- - 1 ? " " + (killCount[i + 1] - killCount[i]) + " " + mob.toLowerCase() + " kills to next rank." : ""));
+ if (killCount[i] == killStats.getInteger(mob)) {
+ NewPacketHandler.SEND_MESSAGE.sendToPlayer(player,
+ "\u00A7o\u00A73You've become a " + knowledge[i].toLowerCase() + " " + mob.toLowerCase()
+ + " slayer! (+" + damageBonusString[i] + "% damage against " + mob.toLowerCase()
+ + "s.)" + (i < knowledge.length - 1 ? " " + (killCount[i + 1] - killCount[i]) + " "
+ + mob.toLowerCase() + " kills to next rank." : ""));
break;
}
}
int count = 0;
- if (killStats.hasKey("TrackedMobList") && killStats
- .getString("TrackedMobList") != null
- && killStats.getString(
- "TrackedMobList")
- .length() > 0) {
- for (String object : killStats.getString(
- "TrackedMobList")
- .split(";")) {
- if (killStats.hasKey(object)
- && killStats.getInteger(
- object) >= killCount[2]) {
+ if (killStats.hasKey("TrackedMobList") && killStats.getString("TrackedMobList") != null
+ && killStats.getString("TrackedMobList").length() > 0) {
+ for (String object : killStats.getString("TrackedMobList").split(";")) {
+ if (killStats.hasKey(object) && killStats.getInteger(object) >= killCount[2]) {
count++;
}
}
}
if (count >= 5) {
- player.triggerAchievement(
- ModjamMod.theHunt);
+ player.triggerAchievement(ModjamMod.theHunt);
}
}
@@ -279,168 +229,106 @@ public class EntityStatHelper { if (player.getHeldItem() == null) {
weapon = "fist";
} else if (player.getHeldItem().getItem() != null) {
- weapon = getUnalteredItemName(
- player.getHeldItem().getItem());
+ weapon = getUnalteredItemName(player.getHeldItem().getItem());
}
if (!player.getEntityData().hasKey("WeaponStats")) {
- player.getEntityData().setTag("WeaponStats",
- new NBTTagCompound());
+ player.getEntityData().setTag("WeaponStats", new NBTTagCompound());
}
- NBTTagCompound weaponStats = player.getEntityData()
- .getCompoundTag("WeaponStats");
+ NBTTagCompound weaponStats = player.getEntityData().getCompoundTag("WeaponStats");
if (!weaponStats.hasKey(weapon)) {
weaponStats.setInteger(weapon, 0);
if (!weaponStats.hasKey("TrackedItemList")) {
- weaponStats.setString("TrackedItemList",
- weapon);
+ weaponStats.setString("TrackedItemList", weapon);
} else {
- weaponStats.setString("TrackedItemList",
- weaponStats.getString(
- "TrackedItemList")
- + ";"
- + weapon);
+ weaponStats.setString("TrackedItemList", weaponStats.getString("TrackedItemList") + ";" + weapon);
}
}
- weaponStats.setInteger(weapon,
- weaponStats.getInteger(weapon) + 1);
+ weaponStats.setInteger(weapon, weaponStats.getInteger(weapon) + 1);
if (ConfigData.enableWeaponKillStats) {
for (int i = 0; i < knowledge.length; i++) {
- if (killCount[i] * 2 == weaponStats
- .getInteger(weapon)) {
- NewPacketHandler.SEND_MESSAGE
- .sendToPlayer(player,
- "\u00A7o\u00A73You've become a "
- + knowledge[i].toLowerCase()
- + " "
- + weapon.toLowerCase()
- + " user! (+"
- + damageBonusString[i]
- + "% damage with "
- + weapon.toLowerCase()
- + "s.)"
- + (i < knowledge.length
- - 1 ? " " + (killCount[i + 1] * 2 - killCount[i] * 2) + " " + weapon.toLowerCase() + " kills to next rank." : ""));
+ if (killCount[i] * 2 == weaponStats.getInteger(weapon)) {
+ NewPacketHandler.SEND_MESSAGE.sendToPlayer(player,
+ "\u00A7o\u00A73You've become a " + knowledge[i].toLowerCase() + " " + weapon.toLowerCase()
+ + " user! (+" + damageBonusString[i] + "% damage with " + weapon.toLowerCase()
+ + "s.)"
+ + (i < knowledge.length - 1 ? " " + (killCount[i + 1] * 2 - killCount[i] * 2) + " "
+ + weapon.toLowerCase() + " kills to next rank." : ""));
break;
}
}
int count = 0;
- if (weaponStats.hasKey("TrackedItemList")
- && weaponStats.getString(
- "TrackedItemList") != null
- && weaponStats.getString(
- "TrackedItemList")
- .length() > 0) {
- for (String object : weaponStats.getString(
- "TrackedItemList")
- .split(";")) {
- if (weaponStats.hasKey(object)
- && weaponStats.getInteger(
- object) >= killCount[1]
- * 2) {
+ if (weaponStats.hasKey("TrackedItemList") && weaponStats.getString("TrackedItemList") != null
+ && weaponStats.getString("TrackedItemList").length() > 0) {
+ for (String object : weaponStats.getString("TrackedItemList").split(";")) {
+ if (weaponStats.hasKey(object) && weaponStats.getInteger(object) >= killCount[1] * 2) {
count++;
}
}
}
if (count >= 10) {
- player.triggerAchievement(
- ModjamMod.jackOfAllTrades);
+ player.triggerAchievement(ModjamMod.jackOfAllTrades);
}
}
}
private void addPlayerStats(EntityJoinWorldEvent event) {
if (!event.entity.getEntityData().hasKey("Blessing")
- && CommonTickHandler.worldData.blessingByPlayer
- .containsKey(event.entity
- .getCommandSenderName())) {
+ && CommonTickHandler.worldData.blessingByPlayer.containsKey(event.entity.getCommandSenderName())) {
event.entity.getEntityData().setString("Blessing",
- CommonTickHandler.worldData.blessingByPlayer
- .get(event.entity
- .getCommandSenderName()));
-
- NewPacketHandler.UPDATE_BLESSING.sendToPlayer(
- (EntityPlayer) event.entity,
- event.entity.getEntityData()
- .getString("Blessing"));
-
- CommonTickHandler.worldData.blessingByPlayer
- .remove(event.entity
- .getCommandSenderName());
+ CommonTickHandler.worldData.blessingByPlayer.get(event.entity.getCommandSenderName()));
+
+ NewPacketHandler.UPDATE_BLESSING.sendToPlayer((EntityPlayer) event.entity,
+ event.entity.getEntityData().getString("Blessing"));
+
+ CommonTickHandler.worldData.blessingByPlayer.remove(event.entity.getCommandSenderName());
CommonTickHandler.worldData.markDirty();
}
if (!event.entity.getEntityData().hasKey("PotionKnowledge")
&& CommonTickHandler.worldData.potionKnowledgeByPlayer
- .containsKey(event.entity
- .getCommandSenderName())) {
- event.entity.getEntityData().setIntArray(
- "PotionKnowledge",
- CommonTickHandler.worldData.potionKnowledgeByPlayer
- .get(event.entity
- .getCommandSenderName()));
-
- NewPacketHandler.UPDATE_POTION_KNOWLEDGE
- .sendToPlayer((EntityPlayer) event.entity,
- event.entity.getEntityData()
- .getIntArray("PotionKnowledge"));
-
- CommonTickHandler.worldData.potionKnowledgeByPlayer
- .remove(event.entity
- .getCommandSenderName());
+ .containsKey(event.entity.getCommandSenderName())) {
+ event.entity.getEntityData().setIntArray("PotionKnowledge",
+ CommonTickHandler.worldData.potionKnowledgeByPlayer.get(event.entity.getCommandSenderName()));
+
+ NewPacketHandler.UPDATE_POTION_KNOWLEDGE.sendToPlayer((EntityPlayer) event.entity,
+ event.entity.getEntityData().getIntArray("PotionKnowledge"));
+
+ CommonTickHandler.worldData.potionKnowledgeByPlayer.remove(event.entity.getCommandSenderName());
CommonTickHandler.worldData.markDirty();
}
if (!event.entity.getEntityData().hasKey("KillStats")
- && CommonTickHandler.worldData.killStatsByPlayer
- .containsKey(event.entity
- .getCommandSenderName())) {
+ && CommonTickHandler.worldData.killStatsByPlayer.containsKey(event.entity.getCommandSenderName())) {
event.entity.getEntityData().setTag("KillStats",
- CommonTickHandler.worldData.killStatsByPlayer
- .get(event.entity
- .getCommandSenderName()));
+ CommonTickHandler.worldData.killStatsByPlayer.get(event.entity.getCommandSenderName()));
- CommonTickHandler.worldData.killStatsByPlayer
- .remove(event.entity
- .getCommandSenderName());
+ CommonTickHandler.worldData.killStatsByPlayer.remove(event.entity.getCommandSenderName());
CommonTickHandler.worldData.markDirty();
}
if (!event.entity.getEntityData().hasKey("WeaponStats")
- && CommonTickHandler.worldData.weaponStatsByPlayer
- .containsKey(event.entity
- .getCommandSenderName())) {
+ && CommonTickHandler.worldData.weaponStatsByPlayer.containsKey(event.entity.getCommandSenderName())) {
event.entity.getEntityData().setTag("WeaponStats",
- CommonTickHandler.worldData.weaponStatsByPlayer
- .get(event.entity
- .getCommandSenderName()));
+ CommonTickHandler.worldData.weaponStatsByPlayer.get(event.entity.getCommandSenderName()));
- CommonTickHandler.worldData.killStatsByPlayer
- .remove(event.entity
- .getCommandSenderName());
+ CommonTickHandler.worldData.killStatsByPlayer.remove(event.entity.getCommandSenderName());
CommonTickHandler.worldData.markDirty();
}
if (!event.entity.getEntityData().hasKey("CraftingStats")
- && CommonTickHandler.worldData.craftingStatsByPlayer
- .containsKey(event.entity
- .getCommandSenderName())) {
- event.entity.getEntityData().setTag(
- "CraftingStats",
- CommonTickHandler.worldData.craftingStatsByPlayer
- .get(event.entity
- .getCommandSenderName()));
-
- CommonTickHandler.worldData.craftingStatsByPlayer
- .remove(event.entity
- .getCommandSenderName());
+ && CommonTickHandler.worldData.craftingStatsByPlayer.containsKey(event.entity.getCommandSenderName())) {
+ event.entity.getEntityData().setTag("CraftingStats",
+ CommonTickHandler.worldData.craftingStatsByPlayer.get(event.entity.getCommandSenderName()));
+
+ CommonTickHandler.worldData.craftingStatsByPlayer.remove(event.entity.getCommandSenderName());
CommonTickHandler.worldData.markDirty();
}
}
@@ -448,83 +336,58 @@ public class EntityStatHelper { private void advanceKillTaskProgress(LivingDeathEvent event) {
CommonTickHandler.worldData.progress++;
- String name1 = CommonTickHandler.worldData.currentTask
- .equals("Kill") ? FyresWorldData.validMobNames[CommonTickHandler.worldData.currentTaskID]
- : FyresWorldData.validItems[CommonTickHandler.worldData.currentTaskID]
- .getDisplayName();
+ String name1 = CommonTickHandler.worldData.currentTask.equals("Kill")
+ ? FyresWorldData.validMobNames[CommonTickHandler.worldData.currentTaskID]
+ : FyresWorldData.validItems[CommonTickHandler.worldData.currentTaskID].getDisplayName();
if (name1.contains("Block")) {
if (name1.contains("Block")) {
- name1 = name1.replace("Block", "Blocks")
- .replace("block",
- "blocks");
+ name1 = name1.replace("Block", "Blocks").replace("block", "blocks");
}
} else {
name1 += "s";
}
- NewPacketHandler.SEND_MESSAGE.sendToAllPlayers(
- "\u00A7fCurrent Goal Progress: "
- + CommonTickHandler.worldData.progress
- + "/"
- + CommonTickHandler.worldData.currentTaskAmount
- + " " + name1 + " "
- + CommonTickHandler.worldData.currentTask
- + "ed.");
+ NewPacketHandler.SEND_MESSAGE.sendToAllPlayers("\u00A7fCurrent Goal Progress: "
+ + CommonTickHandler.worldData.progress + "/" + CommonTickHandler.worldData.currentTaskAmount + " "
+ + name1 + " " + CommonTickHandler.worldData.currentTask + "ed.");
if (CommonTickHandler.worldData.progress >= CommonTickHandler.worldData.currentTaskAmount) {
CommonTickHandler.worldData.progress = 0;
CommonTickHandler.worldData.tasksCompleted++;
- NewPacketHandler.LEVEL_UP.sendToAllPlayers(
- CommonTickHandler.worldData.rewardLevels);
+ NewPacketHandler.LEVEL_UP.sendToAllPlayers(CommonTickHandler.worldData.rewardLevels);
- if (!CommonTickHandler.worldData.enderDragonKilled
- && event.entity instanceof EntityDragon) {
+ if (!CommonTickHandler.worldData.enderDragonKilled && event.entity instanceof EntityDragon) {
CommonTickHandler.worldData.enderDragonKilled = true;
}
CommonTickHandler.worldData.giveNewTask();
- NewPacketHandler.SEND_MESSAGE.sendToAllPlayers(
- "\u00A7eA world goal has been completed!"
- + (!CommonTickHandler.worldData
- .getDisadvantage()
- .equals("None") ? " World disadvantage has been lifted!"
- : ""));
+ NewPacketHandler.SEND_MESSAGE.sendToAllPlayers("\u00A7eA world goal has been completed!"
+ + (!CommonTickHandler.worldData.getDisadvantage().equals("None")
+ ? " World disadvantage has been lifted!"
+ : ""));
NewPacketHandler.SEND_MESSAGE.sendToAllPlayers(
- "\u00A7eA new world goal has been set: "
- + (CommonTickHandler.worldData.currentTask
- + " "
- + CommonTickHandler.worldData.currentTaskAmount
- + " "
- + (CommonTickHandler.worldData.currentTask
- .equals("Kill") ? FyresWorldData.validMobNames[CommonTickHandler.worldData.currentTaskID]
- : FyresWorldData.validItems[CommonTickHandler.worldData.currentTaskID]
- .getDisplayName())
- + "s. ("
- + CommonTickHandler.worldData.progress
- + " "
- + CommonTickHandler.worldData.currentTask
- + "ed)"));
+ "\u00A7eA new world goal has been set: " + (CommonTickHandler.worldData.currentTask + " "
+ + CommonTickHandler.worldData.currentTaskAmount + " "
+ + (CommonTickHandler.worldData.currentTask.equals("Kill")
+ ? FyresWorldData.validMobNames[CommonTickHandler.worldData.currentTaskID]
+ : FyresWorldData.validItems[CommonTickHandler.worldData.currentTaskID]
+ .getDisplayName())
+ + "s. (" + CommonTickHandler.worldData.progress + " "
+ + CommonTickHandler.worldData.currentTask + "ed)"));
CommonTickHandler.worldData.currentDisadvantage = "None";
}
- NewPacketHandler.UPDATE_WORLD_DATA.sendToAllPlayers(
- CommonTickHandler.worldData.potionValues,
- CommonTickHandler.worldData.potionDurations,
- CommonTickHandler.worldData
- .getDisadvantage(),
- CommonTickHandler.worldData.currentTask,
- CommonTickHandler.worldData.currentTaskID,
- CommonTickHandler.worldData.currentTaskAmount,
- CommonTickHandler.worldData.progress,
- CommonTickHandler.worldData.tasksCompleted,
- CommonTickHandler.worldData.enderDragonKilled,
- ConfigData.spawnTraps,
- CommonTickHandler.worldData.rewardLevels,
+ NewPacketHandler.UPDATE_WORLD_DATA.sendToAllPlayers(CommonTickHandler.worldData.potionValues,
+ CommonTickHandler.worldData.potionDurations, CommonTickHandler.worldData.getDisadvantage(),
+ CommonTickHandler.worldData.currentTask, CommonTickHandler.worldData.currentTaskID,
+ CommonTickHandler.worldData.currentTaskAmount, CommonTickHandler.worldData.progress,
+ CommonTickHandler.worldData.tasksCompleted, CommonTickHandler.worldData.enderDragonKilled,
+ ConfigData.spawnTraps, CommonTickHandler.worldData.rewardLevels,
CommonTickHandler.worldData.mushroomColors);
CommonTickHandler.worldData.markDirty();
@@ -536,19 +399,13 @@ public class EntityStatHelper { Entity entityNew = null;
try {
- Constructor[] constructors = event.entity
- .getClass().getConstructors();
+ Constructor[] constructors = event.entity.getClass().getConstructors();
for (int i = 0; i < constructors.length; i++) {
- Class[] parameters = constructors[i]
- .getParameterTypes();
-
- if (parameters.length == 1 && parameters[0]
- .equals(World.class)) {
- entityNew = (Entity) event.entity
- .getClass()
- .getConstructors()[i]
- .newInstance(event.world);
+ Class[] parameters = constructors[i].getParameterTypes();
+
+ if (parameters.length == 1 && parameters[0].equals(World.class)) {
+ entityNew = (Entity) event.entity.getClass().getConstructors()[i].newInstance(event.world);
}
}
@@ -557,14 +414,10 @@ public class EntityStatHelper { }
if (entityNew != null) {
- entityNew.setLocationAndAngles(event.entity.posX,
- event.entity.posY,
- event.entity.posZ,
- event.entity.rotationYaw,
- event.entity.rotationPitch);
+ entityNew.setLocationAndAngles(event.entity.posX, event.entity.posY, event.entity.posZ,
+ event.entity.rotationYaw, event.entity.rotationPitch);
- entityNew.getEntityData().setBoolean("isClone",
- true);
+ entityNew.getEntityData().setBoolean("isClone", true);
entityNew.dimension = event.entity.dimension;
@@ -590,16 +443,14 @@ public class EntityStatHelper { }
private void handleBlessings(LivingDeathEvent event) {
- String blessing = event.source.getEntity().getEntityData()
- .getString("Blessing");
+ String blessing = event.source.getEntity().getEntityData().getString("Blessing");
BlessingUtils.getBlessingInstance(blessing).onMobKill(event);
}
private boolean isEntityClone(EntityJoinWorldEvent event) {
if (event.entity.getEntityData().hasKey("isClone")) {
- return event.entity.getEntityData()
- .getBoolean("isClone");
+ return event.entity.getEntityData().getBoolean("isClone");
} else {
return false;
}
@@ -609,12 +460,9 @@ public class EntityStatHelper { @SubscribeEvent
public void livingDeath(LivingDeathEvent event) {
if (!event.entity.worldObj.isRemote) {
- if (event.entity.worldObj.getGameRules()
- .getGameRuleBooleanValue(
- "doMobLoot")) {
+ if (event.entity.worldObj.getGameRules().getGameRuleBooleanValue("doMobLoot")) {
- if (event.entity instanceof EntityLivingBase
- && event.source != null
+ if (event.entity instanceof EntityLivingBase && event.source != null
&& event.source.getEntity() != null) {
if (BlessingUtils.hasBlessing(event.source.getEntity())) {
handleBlessings(event);
@@ -623,51 +471,31 @@ public class EntityStatHelper { int level = 0;
- if (event.entity.getEntityData()
- .hasKey("Level")) {
- level = Integer.parseInt(
- event.entity.getEntityData()
- .getString("Level"));
+ if (event.entity.getEntityData().hasKey("Level")) {
+ level = Integer.parseInt(event.entity.getEntityData().getString("Level"));
}
- if (ModjamMod.r.nextInt(30) == 0
- || level == 5) {
- event.entity.entityDropItem(
- new ItemStack(ModjamMod.mysteryPotion,
- 1,
- ModjamMod.r.nextInt(
- 13)),
- event.entity.height
- / 2);
+ if (ModjamMod.r.nextInt(30) == 0 || level == 5) {
+ event.entity.entityDropItem(new ItemStack(ModjamMod.mysteryPotion, 1, ModjamMod.r.nextInt(13)),
+ event.entity.height / 2);
}
}
- if (CommonTickHandler.worldData.currentTask
- .equals("Kill")
+ if (CommonTickHandler.worldData.currentTask.equals("Kill")
&& FyresWorldData.validMobs[CommonTickHandler.worldData.currentTaskID]
- .isAssignableFrom(
- event.entity.getClass())) {
+ .isAssignableFrom(event.entity.getClass())) {
advanceKillTaskProgress(event);
}
- if (!CommonTickHandler.worldData.enderDragonKilled
- && event.entity instanceof EntityDragon) {
+ if (!CommonTickHandler.worldData.enderDragonKilled && event.entity instanceof EntityDragon) {
CommonTickHandler.worldData.enderDragonKilled = true;
- NewPacketHandler.UPDATE_WORLD_DATA
- .sendToAllPlayers(
- CommonTickHandler.worldData.potionValues,
- CommonTickHandler.worldData.potionDurations,
- CommonTickHandler.worldData
- .getDisadvantage(),
- CommonTickHandler.worldData.currentTask,
- CommonTickHandler.worldData.currentTaskID,
- CommonTickHandler.worldData.currentTaskAmount,
- CommonTickHandler.worldData.progress,
- CommonTickHandler.worldData.tasksCompleted,
- CommonTickHandler.worldData.enderDragonKilled,
- ConfigData.spawnTraps,
- CommonTickHandler.worldData.rewardLevels,
- CommonTickHandler.worldData.mushroomColors);
+ NewPacketHandler.UPDATE_WORLD_DATA.sendToAllPlayers(CommonTickHandler.worldData.potionValues,
+ CommonTickHandler.worldData.potionDurations, CommonTickHandler.worldData.getDisadvantage(),
+ CommonTickHandler.worldData.currentTask, CommonTickHandler.worldData.currentTaskID,
+ CommonTickHandler.worldData.currentTaskAmount, CommonTickHandler.worldData.progress,
+ CommonTickHandler.worldData.tasksCompleted, CommonTickHandler.worldData.enderDragonKilled,
+ ConfigData.spawnTraps, CommonTickHandler.worldData.rewardLevels,
+ CommonTickHandler.worldData.mushroomColors);
CommonTickHandler.worldData.markDirty();
}
}
@@ -677,56 +505,33 @@ public class EntityStatHelper { player.triggerAchievement(ModjamMod.losingIsFun);
- CommonTickHandler.worldData.blessingByPlayer.put(
- player.getCommandSenderName(),
- player.getEntityData().getString(
- "Blessing"));
-
- CommonTickHandler.worldData.potionKnowledgeByPlayer
- .put(player.getCommandSenderName(),
- player.getEntityData()
- .getIntArray("PotionKnowledge"));
-
- if (player.getEntityData() != null
- && player.getEntityData().hasKey(
- "KillStats")) {
- CommonTickHandler.worldData.killStatsByPlayer
- .put(player.getCommandSenderName(),
- player.getEntityData()
- .getCompoundTag("KillStats"));
+ CommonTickHandler.worldData.blessingByPlayer.put(player.getCommandSenderName(),
+ player.getEntityData().getString("Blessing"));
+
+ CommonTickHandler.worldData.potionKnowledgeByPlayer.put(player.getCommandSenderName(),
+ player.getEntityData().getIntArray("PotionKnowledge"));
+
+ if (player.getEntityData() != null && player.getEntityData().hasKey("KillStats")) {
+ CommonTickHandler.worldData.killStatsByPlayer.put(player.getCommandSenderName(),
+ player.getEntityData().getCompoundTag("KillStats"));
}
- if (player.getEntityData() != null
- && player.getEntityData().hasKey(
- "WeaponStats")) {
- CommonTickHandler.worldData.weaponStatsByPlayer
- .put(player.getCommandSenderName(),
- player.getEntityData()
- .getCompoundTag("WeaponStats"));
+ if (player.getEntityData() != null && player.getEntityData().hasKey("WeaponStats")) {
+ CommonTickHandler.worldData.weaponStatsByPlayer.put(player.getCommandSenderName(),
+ player.getEntityData().getCompoundTag("WeaponStats"));
}
- if (player.getEntityData() != null
- && player.getEntityData().hasKey(
- "CraftingStats")) {
- CommonTickHandler.worldData.craftingStatsByPlayer
- .put(player.getCommandSenderName(),
- player.getEntityData()
- .getCompoundTag("CraftingStats"));
+ if (player.getEntityData() != null && player.getEntityData().hasKey("CraftingStats")) {
+ CommonTickHandler.worldData.craftingStatsByPlayer.put(player.getCommandSenderName(),
+ player.getEntityData().getCompoundTag("CraftingStats"));
}
- } else if (event.source != null
- && event.source.getEntity() != null
+ } else if (event.source != null && event.source.getEntity() != null
&& event.source.getEntity() instanceof EntityPlayer) {
- EntityPlayer player = (EntityPlayer) event.source
- .getEntity();
+ EntityPlayer player = (EntityPlayer) event.source.getEntity();
String mob = getUnalteredName(event.entity);
- if (CommonTickHandler.worldData.getDisadvantage()
- .equals("Trigger-happy")
- && ModjamMod.r.nextInt(10) == 0) {
- player.worldObj.createExplosion(player,
- event.entity.posX,
- event.entity.posY,
- event.entity.posZ, 1,
+ if (CommonTickHandler.worldData.getDisadvantage().equals("Trigger-happy") && ModjamMod.r.nextInt(10) == 0) {
+ player.worldObj.createExplosion(player, event.entity.posX, event.entity.posY, event.entity.posZ, 1,
true);
}
@@ -738,14 +543,10 @@ public class EntityStatHelper { MinecraftForge.EVENT_BUS.register(this);
}
- private boolean shouldCloneMob(EntityJoinWorldEvent event,
- boolean isClone) {
+ private boolean shouldCloneMob(EntityJoinWorldEvent event, boolean isClone) {
return CommonTickHandler.worldData != null
- && CommonTickHandler.worldData
- .getDisadvantage()
- .equals("Increased Mob Spawn")
- && (event.entity instanceof EntityMob)
- && !(event.entity instanceof EntityDragon)
- && !isClone && ModjamMod.r.nextInt(3) == 0;
+ && CommonTickHandler.worldData.getDisadvantage().equals("Increased Mob Spawn")
+ && (event.entity instanceof EntityMob) && !(event.entity instanceof EntityDragon) && !isClone
+ && ModjamMod.r.nextInt(3) == 0;
}
}
diff --git a/YWD/src/main/java/fyresmodjam/misc/EntityStatTracker.java b/YWD/src/main/java/fyresmodjam/misc/EntityStatTracker.java index f059141..1509d59 100755 --- a/YWD/src/main/java/fyresmodjam/misc/EntityStatTracker.java +++ b/YWD/src/main/java/fyresmodjam/misc/EntityStatTracker.java @@ -7,16 +7,13 @@ public class EntityStatTracker { public boolean instanceAllowed = false; - public EntityStatTracker(Class<?>[] classes, - boolean instancesAllowed) { + public EntityStatTracker(Class<?>[] classes, boolean instancesAllowed) { this.classes = classes; instanceAllowed = instancesAllowed; } public EntityStatTracker(Class<?> c, boolean instancesAllowed) { - this(new Class[] { - c - }, instancesAllowed); + this(new Class[] { c }, instancesAllowed); } public ArrayList<EntityStat> stats = new ArrayList<EntityStat>(); diff --git a/YWD/src/main/java/fyresmodjam/misc/ItemStat.java b/YWD/src/main/java/fyresmodjam/misc/ItemStat.java index 888a34c..dccb01d 100755 --- a/YWD/src/main/java/fyresmodjam/misc/ItemStat.java +++ b/YWD/src/main/java/fyresmodjam/misc/ItemStat.java @@ -5,8 +5,8 @@ import java.util.Random; import net.minecraft.item.ItemStack; public class ItemStat { - public String name; - public String value; + public String name; + public String value; public ItemStat(String name, Object value) { this.name = name; diff --git a/YWD/src/main/java/fyresmodjam/misc/ItemStatHelper.java b/YWD/src/main/java/fyresmodjam/misc/ItemStatHelper.java index 352fc76..701aeb3 100755 --- a/YWD/src/main/java/fyresmodjam/misc/ItemStatHelper.java +++ b/YWD/src/main/java/fyresmodjam/misc/ItemStatHelper.java @@ -2,16 +2,19 @@ package fyresmodjam.misc; import java.util.ArrayList;
import java.util.HashMap;
+import java.util.Map.Entry;
import java.util.Random;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.PlayerEvent.ItemCraftedEvent;
+import fyresmodjam.blessings.Blessing;
import fyresmodjam.blessings.BlessingUtils;
import fyresmodjam.handlers.NewPacketHandler;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.monster.EntityMob;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
+import net.minecraft.item.Item;
import net.minecraft.item.ItemAxe;
import net.minecraft.item.ItemBow;
import net.minecraft.item.ItemStack;
@@ -22,6 +25,7 @@ import net.minecraft.nbt.NBTTagString; import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.living.LivingHurtEvent;
import net.minecraftforge.event.entity.player.PlayerDropsEvent;
+import tconstruct.library.tools.ToolCore;
@SuppressWarnings("rawtypes")
public class ItemStatHelper {
@@ -35,12 +39,10 @@ public class ItemStatHelper { if (statTracker.classes != null) {
for (Class c : statTracker.classes) {
if (!statTrackersByClass.containsKey(c)) {
- statTrackersByClass.put(c,
- new ArrayList<ItemStatTracker>());
+ statTrackersByClass.put(c, new ArrayList<ItemStatTracker>());
}
- statTrackersByClass.get(c)
- .add(statTracker);
+ statTrackersByClass.get(c).add(statTracker);
}
}
@@ -49,8 +51,7 @@ public class ItemStatHelper { }
}
- public static ItemStack giveStat(ItemStack stack, String name,
- Object value) {
+ public static ItemStack giveStat(ItemStack stack, String name, Object value) {
if (!stack.hasTagCompound()) {
stack.setTagCompound(new NBTTagCompound());
}
@@ -66,12 +67,10 @@ public class ItemStatHelper { }
if (!stack.getTagCompound().hasKey("display")) {
- stack.getTagCompound().setTag("display",
- new NBTTagCompound());
+ stack.getTagCompound().setTag("display", new NBTTagCompound());
}
- stack.getTagCompound().getCompoundTag("display")
- .setString("Name", name);
+ stack.getTagCompound().getCompoundTag("display").setString("Name", name);
return stack;
}
@@ -82,36 +81,25 @@ public class ItemStatHelper { }
if (!stack.getTagCompound().hasKey("display")) {
- stack.getTagCompound().setTag("display",
- new NBTTagCompound());
+ stack.getTagCompound().setTag("display", new NBTTagCompound());
}
- if (!stack.getTagCompound().getCompoundTag("display")
- .hasKey("Lore")) {
- stack.getTagCompound().getCompoundTag("display")
- .setTag("Lore", new NBTTagList());
+ if (!stack.getTagCompound().getCompoundTag("display").hasKey("Lore")) {
+ stack.getTagCompound().getCompoundTag("display").setTag("Lore", new NBTTagList());
}
if (lore != null) {
- ((NBTTagList) stack.getTagCompound()
- .getCompoundTag("display")
- .getTag("Lore")).appendTag(
- new NBTTagString(
- lore));
+ ((NBTTagList) stack.getTagCompound().getCompoundTag("display").getTag("Lore"))
+ .appendTag(new NBTTagString(lore));
}
return stack;
}
public static String getName(ItemStack stack) {
- if (stack.getTagCompound() != null
- && stack.getTagCompound().hasKey("display")
- && stack.getTagCompound()
- .getCompoundTag("display")
- .hasKey("Name")) {
- return stack.getTagCompound()
- .getCompoundTag("display")
- .getString("Name");
+ if (stack.getTagCompound() != null && stack.getTagCompound().hasKey("display")
+ && stack.getTagCompound().getCompoundTag("display").hasKey("Name")) {
+ return stack.getTagCompound().getCompoundTag("display").getString("Name");
}
return null;
@@ -119,8 +107,7 @@ public class ItemStatHelper { public static String getStat(ItemStack stack, String name) {
String s = null;
- if (stack.getTagCompound() != null
- && stack.getTagCompound().hasKey(name)) {
+ if (stack.getTagCompound() != null && stack.getTagCompound().hasKey(name)) {
s = stack.getTagCompound().getString(name);
}
@@ -128,8 +115,7 @@ public class ItemStatHelper { }
public static boolean hasStat(ItemStack stack, String name) {
- if (stack.getTagCompound() != null
- && stack.getTagCompound().hasKey(name)) {
+ if (stack.getTagCompound() != null && stack.getTagCompound().hasKey(name)) {
return true;
}
@@ -139,6 +125,12 @@ public class ItemStatHelper { @SubscribeEvent
public void playerDrops(PlayerDropsEvent event) {
if (!event.entity.worldObj.isRemote) {
+ if (BlessingUtils.hasBlessing(event.entity)) {
+ Blessing blesz = BlessingUtils.getBlessingInstance(event.entity);
+
+ blesz.onPlayerDrops(event);
+ }
+
if (BlessingUtils.hasDisadvantage("Permadeath")) {
event.setCanceled(true);
}
@@ -151,19 +143,14 @@ public class ItemStatHelper { float damageMultiplier = 1.0F;
try {
- damageMultiplier = handlePlayerWeakening(
- event, damageMultiplier);
+ damageMultiplier = handlePlayerWeakening(event, damageMultiplier);
} catch (NullPointerException npex) {
damageMultiplier = 1.0F;
}
if (BlessingUtils.hasBlessing(event.entity)) {
- damageMultiplier = BlessingUtils
- .getBlessingInstance(
- BlessingUtils.getBlessing(
- event.entity))
- .onIncomingDamage(event,
- damageMultiplier);
+ damageMultiplier = BlessingUtils.getBlessingInstance(BlessingUtils.getBlessing(event.entity))
+ .onIncomingDamage(event, damageMultiplier);
}
if (event.isCanceled()) {
@@ -173,60 +160,33 @@ public class ItemStatHelper { if (event.entity instanceof EntityLivingBase) {
EntityLivingBase entity = (EntityLivingBase) event.entity;
- damageMultiplier = getArmorReduction(
- damageMultiplier, entity);
+ damageMultiplier = getArmorReduction(damageMultiplier, entity);
}
- if (event.source != null && event.source
- .getEntity() != null) {
+ if (event.source != null && event.source.getEntity() != null) {
if (event.source.getEntity() instanceof EntityLivingBase) {
handleWeaponDamage(event);
}
- String mob = EntityStatHelper
- .getUnalteredName(
- event.entity);
-
- if (ConfigData.enableMobKillStats
- && event.source.getEntity() instanceof EntityPlayer
- && event.source.getEntity()
- .getEntityData()
- .hasKey("KillStats")
- && event.source.getEntity()
- .getEntityData()
- .getCompoundTag("KillStats")
- .hasKey(mob)) {
- damageMultiplier = handleMobKnowledgeBonus(
- event,
- damageMultiplier,
- mob);
+ String mob = EntityStatHelper.getUnalteredName(event.entity);
+
+ if (ConfigData.enableMobKillStats && event.source.getEntity() instanceof EntityPlayer
+ && event.source.getEntity().getEntityData().hasKey("KillStats")
+ && event.source.getEntity().getEntityData().getCompoundTag("KillStats").hasKey(mob)) {
+ damageMultiplier = handleMobKnowledgeBonus(event, damageMultiplier, mob);
}
String weapon = "misc";
- if (ConfigData.enableWeaponKillStats
- && event.source.getEntity() instanceof EntityPlayer
- && event.source.getEntity()
- .getEntityData()
- .hasKey("WeaponStats")
- && event.source.getEntity()
- .getEntityData()
- .getCompoundTag("WeaponStats")
- .hasKey(weapon)) {
- damageMultiplier = handleWeaponKnowledgeBonus(
- event,
- damageMultiplier,
- weapon);
+ if (ConfigData.enableWeaponKillStats && event.source.getEntity() instanceof EntityPlayer
+ && event.source.getEntity().getEntityData().hasKey("WeaponStats")
+ && event.source.getEntity().getEntityData().getCompoundTag("WeaponStats").hasKey(weapon)) {
+ damageMultiplier = handleWeaponKnowledgeBonus(event, damageMultiplier, weapon);
}
- if (BlessingUtils.hasBlessing(event.source
- .getEntity())) {
+ if (BlessingUtils.hasBlessing(event.source.getEntity())) {
damageMultiplier = BlessingUtils
- .getBlessingInstance(
- BlessingUtils.getBlessing(
- event.source.getEntity()))
- .onOutgoingDamage(
- event,
- damageMultiplier);
+ .getBlessingInstance(BlessingUtils.getBlessing(event.source.getEntity()))
+ .onOutgoingDamage(event, damageMultiplier);
}
}
@@ -234,35 +194,24 @@ public class ItemStatHelper { return;
}
- if (event.ammount < event.entityLiving
- .getHealth()) {
- event.ammount = (float) Math.max(0.5,
- event.ammount * damageMultiplier);
+ if (event.ammount < event.entityLiving.getHealth()) {
+ event.ammount = (float) Math.max(0.5, event.ammount * damageMultiplier);
}
}
}
- private float handleWeaponKnowledgeBonus(LivingHurtEvent event,
- float damageMultiplier, String weapon) {
- EntityPlayer player = (EntityPlayer) event.source
- .getEntity();
+ private float handleWeaponKnowledgeBonus(LivingHurtEvent event, float damageMultiplier, String weapon) {
+ EntityPlayer player = (EntityPlayer) event.source.getEntity();
if (player.getHeldItem() == null) {
weapon = "fist";
- } else if (player.getHeldItem().getItem() != null && player
- .getHeldItem()
- .getItem() instanceof ItemSword
- || player.getHeldItem()
- .getItem() instanceof ItemBow
- || player.getHeldItem()
- .getItem() instanceof ItemAxe) {
- weapon = EntityStatHelper.getUnalteredItemName(
- player.getHeldItem().getItem());
+ } else if (player.getHeldItem().getItem() != null && player.getHeldItem().getItem() instanceof ItemSword
+ || player.getHeldItem().getItem() instanceof ItemBow
+ || player.getHeldItem().getItem() instanceof ItemAxe) {
+ weapon = EntityStatHelper.getUnalteredItemName(player.getHeldItem().getItem());
}
- int kills = event.source.getEntity().getEntityData()
- .getCompoundTag("WeaponStats")
- .getInteger(weapon);
+ int kills = event.source.getEntity().getEntityData().getCompoundTag("WeaponStats").getInteger(weapon);
int last = 0;
for (int i = 0; i < EntityStatHelper.killCount.length; i++) {
@@ -277,14 +226,9 @@ public class ItemStatHelper { float pickedDamageBonus = EntityStatHelper.damageBonus[last];
if (BlessingUtils.hasBlessing(event.source.getEntity())) {
- if (BlessingUtils.hasBlessing(
- event.source.getEntity())) {
- pickedDamageBonus = BlessingUtils
- .getBlessingInstance(
- event.source.getEntity())
- .adjustMobKnowledgeBonus(
- event,
- pickedDamageBonus);
+ if (BlessingUtils.hasBlessing(event.source.getEntity())) {
+ pickedDamageBonus = BlessingUtils.getBlessingInstance(event.source.getEntity())
+ .adjustMobKnowledgeBonus(event, pickedDamageBonus);
}
}
@@ -292,11 +236,8 @@ public class ItemStatHelper { return damageMultiplier;
}
- private float handleMobKnowledgeBonus(LivingHurtEvent event,
- float damageMultiplier, String mob) {
- int kills = event.source.getEntity().getEntityData()
- .getCompoundTag("KillStats")
- .getInteger(mob);
+ private float handleMobKnowledgeBonus(LivingHurtEvent event, float damageMultiplier, String mob) {
+ int kills = event.source.getEntity().getEntityData().getCompoundTag("KillStats").getInteger(mob);
int last = 0;
for (int i = 0; i < EntityStatHelper.killCount.length; i++) {
@@ -311,14 +252,9 @@ public class ItemStatHelper { float pickedDamageBonus = EntityStatHelper.damageBonus[last];
if (BlessingUtils.hasBlessing(event.source.getEntity())) {
- if (BlessingUtils.hasBlessing(
- event.source.getEntity())) {
- pickedDamageBonus = BlessingUtils
- .getBlessingInstance(
- event.source.getEntity())
- .adjustMobKnowledgeBonus(
- event,
- pickedDamageBonus);
+ if (BlessingUtils.hasBlessing(event.source.getEntity())) {
+ pickedDamageBonus = BlessingUtils.getBlessingInstance(event.source.getEntity())
+ .adjustMobKnowledgeBonus(event, pickedDamageBonus);
}
}
@@ -327,48 +263,36 @@ public class ItemStatHelper { }
private void handleWeaponDamage(LivingHurtEvent event) {
- EntityLivingBase entity = (EntityLivingBase) event.source
- .getEntity();
+ EntityLivingBase entity = (EntityLivingBase) event.source.getEntity();
ItemStack held = entity.getEquipmentInSlot(0);
- if (held != null && ((event.source.getDamageType()
- .equals("player")
- || event.source.getDamageType()
- .equals("mob")
- || (held.getItem() == Items.bow
- && event.source.isProjectile())))) {
+ if (held != null
+ && ((event.source.getDamageType().equals("player") || event.source.getDamageType().equals("mob")
+ || (held.getItem() == Items.bow && event.source.isProjectile())))) {
String s = getStat(held, "BonusDamage");
if (s != null) {
- event.ammount += Float.parseFloat(s.trim()
- .replace(",", "."));
+ event.ammount += Float.parseFloat(s.trim().replace(",", "."));
}
}
}
- private float getArmorReduction(float damageMultiplier,
- EntityLivingBase entity) {
+ private float getArmorReduction(float damageMultiplier, EntityLivingBase entity) {
for (int i = 0; i < 4; i++) {
ItemStack stack = entity.getEquipmentInSlot(i + 1);
- if (stack == null || stack.getTagCompound() == null
- || !stack.getTagCompound().hasKey(
- "DamageReduction")) {
+ if (stack == null || stack.getTagCompound() == null || !stack.getTagCompound().hasKey("DamageReduction")) {
continue;
}
- damageMultiplier -= Float.parseFloat(stack
- .getTagCompound()
- .getString("DamageReduction")
- .trim().replace(",", ".")) * 0.01F;
+ damageMultiplier -= Float
+ .parseFloat(stack.getTagCompound().getString("DamageReduction").trim().replace(",", ".")) * 0.01F;
}
return damageMultiplier;
}
- private float handlePlayerWeakening(LivingHurtEvent event,
- float damageMultiplier) {
+ private float handlePlayerWeakening(LivingHurtEvent event, float damageMultiplier) {
if (BlessingUtils.hasDisadvantage("Weak")) {
- if (event.source.getDamageType()
- .equals("player")) {
+ if (event.source.getDamageType().equals("player")) {
damageMultiplier -= 0.25F;
}
} else if (BlessingUtils.hasDisadvantage("Tougher Mobs")) {
@@ -387,35 +311,40 @@ public class ItemStatHelper { return;
}
+ for (String clasz : stack.getItem().getToolClasses(stack)) {
+ System.err.printf("Class: %s\n", clasz);
+ }
+
temp.clear();
Class itemClass = stack.getItem().getClass();
- if (statTrackersByClass.containsKey(itemClass)) {
- temp.addAll(statTrackersByClass.get(itemClass));
+ for (Entry<Class, ArrayList<ItemStatTracker>> entry : statTrackersByClass.entrySet()) {
+ if (entry.getKey().isAssignableFrom(itemClass)) {
+ temp.addAll(entry.getValue());
+ }
}
+ /*
+ * if (statTrackersByClass.containsKey(itemClass)) {
+ * temp.addAll(statTrackersByClass.get(itemClass)); }
+ */
+
for (ItemStatTracker e : genericTrackers) {
if (!temp.contains(e)) {
for (Class c : e.classes) {
- if (c.isAssignableFrom(
- itemClass)) {
+ if (c.isAssignableFrom(itemClass)) {
ArrayList<ItemStatTracker> list = null;
- if (statTrackersByClass
- .containsKey(itemClass)) {
+ if (statTrackersByClass.containsKey(itemClass)) {
list = new ArrayList<ItemStatTracker>();
- statTrackersByClass
- .put(itemClass, list);
+ statTrackersByClass.put(itemClass, list);
} else {
- list = statTrackersByClass
- .get(itemClass);
+ list = statTrackersByClass.get(itemClass);
}
try {
- if (!statTrackersByClass
- .get(itemClass)
- .contains(e)) {
+ if (!statTrackersByClass.get(itemClass).contains(e)) {
list.add(e);
}
@@ -435,32 +364,23 @@ public class ItemStatHelper { stack.setTagCompound(new NBTTagCompound());
}
- String processed = ItemStatHelper.getStat(stack,
- "processed");
+ String processed = ItemStatHelper.getStat(stack, "processed");
- if (processed == null
- || processed.equals("false")) {
- stack.getTagCompound().setTag("Lore",
- new NBTTagList());
+ if (processed == null || processed.equals("false")) {
+ stack.getTagCompound().setTag("Lore", new NBTTagList());
- ItemStatHelper.giveStat(stack, "processed",
- "true");
+ ItemStatHelper.giveStat(stack, "processed", "true");
for (ItemStatTracker statTracker : temp) {
for (ItemStat s : statTracker.stats) {
- giveStat(stack, s.name, s
- .getNewValue(stack,
- r)
- .toString());
+ giveStat(stack, s.name, s.getNewValue(stack, r).toString());
- String lore = s.getLore(
- stack);
+ String lore = s.getLore(stack);
if (lore != null) {
addLore(stack, lore);
}
- setName(stack, s.getAlteredStackName(
- stack, r));
+ setName(stack, s.getAlteredStackName(stack, r));
s.modifyStack(stack, r);
}
@@ -475,69 +395,47 @@ public class ItemStatHelper { public void onCrafting(ItemCraftedEvent event) {
EntityPlayer player = event.player;
- ItemStack item = event.crafting;
+ ItemStack itemStk = event.crafting;
if (!player.worldObj.isRemote) {
String itemName = null;
- if (item.getItem() != null && item
- .getItem() instanceof ItemSword
- || item.getItem() instanceof ItemBow
- || item.getItem() instanceof ItemAxe) {
- itemName = EntityStatHelper
- .getUnalteredItemName(item
- .getItem());
+ Item item = itemStk.getItem();
+ if (item == null)
+ return;
+
+ if (item instanceof ItemSword || item instanceof ItemBow || item instanceof ItemAxe) {
+ itemName = EntityStatHelper.getUnalteredItemName(item);
}
- if (ConfigData.enableCraftingStats
- && itemName != null) {
- if (!player.getEntityData()
- .hasKey("CraftingStats")) {
- player.getEntityData().setTag(
- "CraftingStats",
- new NBTTagCompound());
+ if (ConfigData.enableCraftingStats && itemName != null) {
+ if (!player.getEntityData().hasKey("CraftingStats")) {
+ player.getEntityData().setTag("CraftingStats", new NBTTagCompound());
}
- NBTTagCompound craftingStats = player
- .getEntityData()
- .getCompoundTag("CraftingStats");
+ NBTTagCompound craftingStats = player.getEntityData().getCompoundTag("CraftingStats");
if (!craftingStats.hasKey(itemName)) {
- craftingStats.setInteger(itemName,
- 0);
-
- if (!craftingStats.hasKey(
- "TrackedItemList")) {
- craftingStats.setString(
- "TrackedItemList",
- itemName);
+ craftingStats.setInteger(itemName, 0);
+
+ if (!craftingStats.hasKey("TrackedItemList")) {
+ craftingStats.setString("TrackedItemList", itemName);
} else {
- craftingStats.setString(
- "TrackedItemList",
- craftingStats.getString(
- "TrackedItemList")
- + ";"
- + itemName);
+ craftingStats.setString("TrackedItemList",
+ craftingStats.getString("TrackedItemList") + ";" + itemName);
}
}
- craftingStats.setInteger(itemName,
- craftingStats.getInteger(
- itemName)
- + 1);
+ craftingStats.setInteger(itemName, craftingStats.getInteger(itemName) + 1);
for (int i = 0; i < EntityStatHelper.knowledge.length; i++) {
- if (EntityStatHelper.killCount[i] == craftingStats
- .getInteger(itemName)) {
- NewPacketHandler.SEND_MESSAGE
- .sendToPlayer(player,
- "\u00A7o\u00A73You've become a "
- + EntityStatHelper.knowledge[i]
- .toLowerCase()
- + " "
- + itemName.toLowerCase()
- + " smith! ("
- + (i < EntityStatHelper.knowledge.length
- - 1 ? (EntityStatHelper.killCount[i + 1] * 2 - EntityStatHelper.killCount[i] * 2) + " " + itemName.toLowerCase() + " crafts to next rank." : ""));
+ if (EntityStatHelper.killCount[i] == craftingStats.getInteger(itemName)) {
+ NewPacketHandler.SEND_MESSAGE.sendToPlayer(player, "\u00A7o\u00A73You've become a "
+ + EntityStatHelper.knowledge[i].toLowerCase() + " " + itemName.toLowerCase()
+ + " smith! ("
+ + (i < EntityStatHelper.knowledge.length - 1
+ ? (EntityStatHelper.killCount[i + 1] * 2 - EntityStatHelper.killCount[i] * 2)
+ + " " + itemName.toLowerCase() + " crafts to next rank."
+ : ""));
break;
}
}
diff --git a/YWD/src/main/java/fyresmodjam/misc/ItemStatTracker.java b/YWD/src/main/java/fyresmodjam/misc/ItemStatTracker.java index 743f853..9237353 100755 --- a/YWD/src/main/java/fyresmodjam/misc/ItemStatTracker.java +++ b/YWD/src/main/java/fyresmodjam/misc/ItemStatTracker.java @@ -7,16 +7,13 @@ public class ItemStatTracker { public boolean instanceAllowed = false; - public ItemStatTracker(Class<?>[] classes, - boolean instanceAllowed) { + public ItemStatTracker(Class<?>[] classes, boolean instanceAllowed) { this.classes = classes; this.instanceAllowed = instanceAllowed; } public ItemStatTracker(Class<?> c, boolean instanceAllowed) { - this(new Class[] { - c - }, instanceAllowed); + this(new Class[] { c }, instanceAllowed); } public ArrayList<ItemStat> stats = new ArrayList<ItemStat>(); diff --git a/YWD/src/main/java/fyresmodjam/misc/WeaponRankStat.java b/YWD/src/main/java/fyresmodjam/misc/WeaponRankStat.java index e844dc2..00e9566 100755 --- a/YWD/src/main/java/fyresmodjam/misc/WeaponRankStat.java +++ b/YWD/src/main/java/fyresmodjam/misc/WeaponRankStat.java @@ -10,23 +10,10 @@ public final class WeaponRankStat extends ItemStat { /* * @formatter:off */ - public String[][] prefixesByRank = { - { - "Old", "Dull", "Broken", "Worn" - }, - { - "Average", "Decent", "Modest", "Ordinary" - }, - { - "Strong", "Sharp", "Polished", "Refined" - }, - { - "Powerful", "Ruthless", "Elite", "Astonishing" - }, - { - "Godly", "Divine", "Fabled", "Legendary" - } - }; + public String[][] prefixesByRank = { { "Old", "Dull", "Broken", "Worn" }, + { "Average", "Decent", "Modest", "Ordinary" }, { "Strong", "Sharp", "Polished", "Refined" }, + { "Powerful", "Ruthless", "Elite", "Astonishing" }, { "Godly", "Divine", "Fabled", "Legendary" } }; + /* * @formatter:on */ @@ -38,7 +25,7 @@ public final class WeaponRankStat extends ItemStat { public Object getNewValue(ItemStack stack, Random r) { int i = 1; for (; i < 5; i++) { - if (ModjamMod.r.nextInt(10) < 7) { + if (ModjamMod.r.nextInt(10) < 6) { break; } } @@ -47,34 +34,25 @@ public final class WeaponRankStat extends ItemStat { @Override public void modifyStack(ItemStack stack, Random r) { - int rank = Integer.parseInt( - stack.getTagCompound().getString(name)); - float bonusDamage = ((float) rank - 1) / 2 - + (r.nextInt(rank + 1) * r.nextFloat()); + int rank = Integer.parseInt(stack.getTagCompound().getString(name)); + float bonusDamage = ((float) rank - 1) / 2 + (r.nextInt(rank + 1) * r.nextFloat()); - ItemStatHelper.giveStat(stack, "BonusDamage", - String.format("%.2f", bonusDamage)); - ItemStatHelper.addLore(stack, !String.format("%.2f", - bonusDamage) - .equals("0.00") ? "\u00A77\u00A7o " - + (bonusDamage > 0 ? "+" - : "") - + String.format("%.2f", - bonusDamage) - + " bonus damage" : null); + ItemStatHelper.giveStat(stack, "BonusDamage", String.format("%.2f", bonusDamage)); + ItemStatHelper + .addLore(stack, + !String.format("%.2f", bonusDamage).equals("0.00") ? "\u00A77\u00A7o " + + (bonusDamage > 0 ? "+" : "") + String.format("%.2f", bonusDamage) + " bonus damage" + : null); ItemStatHelper.addLore(stack, "\u00A7eRank: " + rank); } @Override public String getAlteredStackName(ItemStack stack, Random r) { - String[] list = prefixesByRank[Integer.parseInt( - stack.getTagCompound().getString(name)) - - 1]; + String[] list = prefixesByRank[Integer.parseInt(stack.getTagCompound().getString(name)) - 1]; String prefix = list[r.nextInt(list.length)]; - if (prefix.equals("Sharp") - && stack.getItem() instanceof ItemBow) { + if (prefix.equals("Sharp") && stack.getItem() instanceof ItemBow) { prefix = "Long"; } diff --git a/YWD/src/main/java/fyresmodjam/models/ModelCrystal.java b/YWD/src/main/java/fyresmodjam/models/ModelCrystal.java index a9749fb..abab447 100755 --- a/YWD/src/main/java/fyresmodjam/models/ModelCrystal.java +++ b/YWD/src/main/java/fyresmodjam/models/ModelCrystal.java @@ -12,11 +12,11 @@ import net.minecraft.entity.Entity; public class ModelCrystal extends ModelBase { - ModelRenderer CrystalMain; - ModelRenderer CrystalEdge1; - ModelRenderer CrystalEdge2; - ModelRenderer CrystalTop1; - ModelRenderer CrystalTop2; + ModelRenderer CrystalMain; + ModelRenderer CrystalEdge1; + ModelRenderer CrystalEdge2; + ModelRenderer CrystalTop1; + ModelRenderer CrystalTop2; public ModelCrystal() { textureWidth = 64; @@ -55,8 +55,7 @@ public class ModelCrystal 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, entity); CrystalMain.render(f5); @@ -66,16 +65,14 @@ public class ModelCrystal extends ModelBase { CrystalTop2.render(f5); } - 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; } @Override - public void setRotationAngles(float f, float f1, float f2, - float f3, float f4, float f5, Entity entity) { + public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) { super.setRotationAngles(f, f1, f2, f3, f4, f5, entity); } diff --git a/YWD/src/main/java/fyresmodjam/models/ModelCrystalStand.java b/YWD/src/main/java/fyresmodjam/models/ModelCrystalStand.java index 1bdc9e0..66b95cb 100755 --- a/YWD/src/main/java/fyresmodjam/models/ModelCrystalStand.java +++ b/YWD/src/main/java/fyresmodjam/models/ModelCrystalStand.java @@ -12,8 +12,8 @@ import net.minecraft.entity.Entity; public class ModelCrystalStand extends ModelBase { // fields - ModelRenderer Shape1; - ModelRenderer Shape2; + ModelRenderer Shape1; + ModelRenderer Shape2; public ModelCrystalStand() { textureWidth = 64; @@ -34,24 +34,21 @@ public class ModelCrystalStand 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, entity); Shape1.render(f5); Shape2.render(f5); } - 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; } @Override - public void setRotationAngles(float f, float f1, float f2, - float f3, float f4, float f5, Entity entity) { + public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) { super.setRotationAngles(f, f1, f2, f3, f4, f5, entity); } diff --git a/YWD/src/main/java/fyresmodjam/models/ModelPillar.java b/YWD/src/main/java/fyresmodjam/models/ModelPillar.java index a0afe90..48dcc99 100755 --- a/YWD/src/main/java/fyresmodjam/models/ModelPillar.java +++ b/YWD/src/main/java/fyresmodjam/models/ModelPillar.java @@ -12,9 +12,9 @@ import net.minecraft.entity.Entity; public class ModelPillar extends ModelBase { // fields - ModelRenderer Shape1; - ModelRenderer Shape2; - ModelRenderer Shape3; + ModelRenderer Shape1; + ModelRenderer Shape2; + ModelRenderer Shape3; public ModelPillar() { textureWidth = 64; @@ -41,8 +41,7 @@ public class ModelPillar 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, entity); Shape1.render(f5); @@ -50,16 +49,14 @@ public class ModelPillar extends ModelBase { Shape3.render(f5); } - 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; } @Override - public void setRotationAngles(float f, float f1, float f2, - float f3, float f4, float f5, Entity entity) { + public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) { super.setRotationAngles(f, f1, f2, f3, f4, f5, entity); } diff --git a/YWD/src/main/java/fyresmodjam/models/ModelSpikes.java b/YWD/src/main/java/fyresmodjam/models/ModelSpikes.java index 8f77ec8..8ce4489 100755 --- a/YWD/src/main/java/fyresmodjam/models/ModelSpikes.java +++ b/YWD/src/main/java/fyresmodjam/models/ModelSpikes.java @@ -12,39 +12,39 @@ import net.minecraft.entity.Entity; public class ModelSpikes extends ModelBase { // fields - ModelRenderer Shape1; - ModelRenderer Shape2; - ModelRenderer Shape3; - ModelRenderer Shape4; - ModelRenderer Shape5; - ModelRenderer Shape6; - ModelRenderer Shape7; - ModelRenderer Shape8; - ModelRenderer Shape9; - ModelRenderer Shape10; - ModelRenderer Shape12; - ModelRenderer Shape13; - ModelRenderer Shape11; - ModelRenderer Shape14; - ModelRenderer Shape15; - ModelRenderer Shape16; - ModelRenderer Shape17; - ModelRenderer Shape18; - ModelRenderer Shape19; - ModelRenderer Shape20; - ModelRenderer Shape21; - ModelRenderer Shape22; - ModelRenderer Shape23; - ModelRenderer Shape24; - ModelRenderer Shape25; - ModelRenderer Shape26; - ModelRenderer Shape27; - ModelRenderer Shape28; - ModelRenderer Shape29; - ModelRenderer Shape30; - ModelRenderer Shape31; - ModelRenderer Shape32; - ModelRenderer Shape33; + ModelRenderer Shape1; + ModelRenderer Shape2; + ModelRenderer Shape3; + ModelRenderer Shape4; + ModelRenderer Shape5; + ModelRenderer Shape6; + ModelRenderer Shape7; + ModelRenderer Shape8; + ModelRenderer Shape9; + ModelRenderer Shape10; + ModelRenderer Shape12; + ModelRenderer Shape13; + ModelRenderer Shape11; + ModelRenderer Shape14; + ModelRenderer Shape15; + ModelRenderer Shape16; + ModelRenderer Shape17; + ModelRenderer Shape18; + ModelRenderer Shape19; + ModelRenderer Shape20; + ModelRenderer Shape21; + ModelRenderer Shape22; + ModelRenderer Shape23; + ModelRenderer Shape24; + ModelRenderer Shape25; + ModelRenderer Shape26; + ModelRenderer Shape27; + ModelRenderer Shape28; + ModelRenderer Shape29; + ModelRenderer Shape30; + ModelRenderer Shape31; + ModelRenderer Shape32; + ModelRenderer Shape33; public ModelSpikes() { textureWidth = 64; @@ -251,8 +251,7 @@ public class ModelSpikes 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, entity); Shape1.render(f5); @@ -290,16 +289,14 @@ public class ModelSpikes extends ModelBase { Shape33.render(f5); } - 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; } @Override - public void setRotationAngles(float f, float f1, float f2, - float f3, float f4, float f5, Entity entity) { + public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) { super.setRotationAngles(f, f1, f2, f3, f4, f5, entity); } diff --git a/YWD/src/main/java/fyresmodjam/models/ModelTrap2.java b/YWD/src/main/java/fyresmodjam/models/ModelTrap2.java index 34e2c8f..209b870 100755 --- a/YWD/src/main/java/fyresmodjam/models/ModelTrap2.java +++ b/YWD/src/main/java/fyresmodjam/models/ModelTrap2.java @@ -12,11 +12,11 @@ import net.minecraft.entity.Entity; public class ModelTrap2 extends ModelBase { // fields - ModelRenderer Shape1; - ModelRenderer Shape22; - ModelRenderer Shape26; - ModelRenderer Shape30; - ModelRenderer Shape27; + ModelRenderer Shape1; + ModelRenderer Shape22; + ModelRenderer Shape26; + ModelRenderer Shape30; + ModelRenderer Shape27; public ModelTrap2() { textureWidth = 64; @@ -55,8 +55,7 @@ public class ModelTrap2 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, entity); Shape1.render(f5); @@ -66,16 +65,14 @@ public class ModelTrap2 extends ModelBase { Shape27.render(f5); } - 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; } @Override - public void setRotationAngles(float f, float f1, float f2, - float f3, float f4, float f5, Entity entity) { + public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) { super.setRotationAngles(f, f1, f2, f3, f4, f5, entity); } diff --git a/YWD/src/main/java/fyresmodjam/tileentities/TileEntityCrystal.java b/YWD/src/main/java/fyresmodjam/tileentities/TileEntityCrystal.java index 3960f45..e5d2cbd 100755 --- a/YWD/src/main/java/fyresmodjam/tileentities/TileEntityCrystal.java +++ b/YWD/src/main/java/fyresmodjam/tileentities/TileEntityCrystal.java @@ -20,13 +20,9 @@ public class TileEntityCrystal extends TileEntity { super.updateEntity();
if (random.nextInt(4) == 0) {
- worldObj.spawnParticle(
- ItemCrystal.particleNames[getBlockMetadata()
- % ItemCrystal.particleNames.length],
- xCoord + random.nextFloat(),
- yCoord + random.nextFloat(),
- zCoord + random.nextFloat(), 0.0f,
- 0.0f, 0.0f);
+ worldObj.spawnParticle(ItemCrystal.particleNames[getBlockMetadata() % ItemCrystal.particleNames.length],
+ xCoord + random.nextFloat(), yCoord + random.nextFloat(), zCoord + random.nextFloat(), 0.0f, 0.0f,
+ 0.0f);
}
}
@@ -44,13 +40,11 @@ public class TileEntityCrystal extends TileEntity { public Packet getDescriptionPacket() {
NBTTagCompound tag = new NBTTagCompound();
writeToNBT(tag);
- return new S35PacketUpdateTileEntity(xCoord, yCoord,
- zCoord, 1, tag);
+ return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, tag);
}
@Override
- public void onDataPacket(NetworkManager net,
- S35PacketUpdateTileEntity pkt) {
+ public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
readFromNBT(pkt.func_148857_g());
}
}
diff --git a/YWD/src/main/java/fyresmodjam/tileentities/TileEntityCrystalStand.java b/YWD/src/main/java/fyresmodjam/tileentities/TileEntityCrystalStand.java index e0ce64e..d32d0f3 100755 --- a/YWD/src/main/java/fyresmodjam/tileentities/TileEntityCrystalStand.java +++ b/YWD/src/main/java/fyresmodjam/tileentities/TileEntityCrystalStand.java @@ -29,13 +29,11 @@ public class TileEntityCrystalStand extends TileEntity { public Packet getDescriptionPacket() {
NBTTagCompound tag = new NBTTagCompound();
writeToNBT(tag);
- return new S35PacketUpdateTileEntity(xCoord, yCoord,
- zCoord, 1, tag);
+ return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, tag);
}
@Override
- public void onDataPacket(NetworkManager net,
- S35PacketUpdateTileEntity pkt) {
+ public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
readFromNBT(pkt.func_148857_g());
}
}
diff --git a/YWD/src/main/java/fyresmodjam/tileentities/TileEntityPillar.java b/YWD/src/main/java/fyresmodjam/tileentities/TileEntityPillar.java index bf36e06..530731b 100755 --- a/YWD/src/main/java/fyresmodjam/tileentities/TileEntityPillar.java +++ b/YWD/src/main/java/fyresmodjam/tileentities/TileEntityPillar.java @@ -18,79 +18,45 @@ import net.minecraft.world.EnumSkyBlock; public class TileEntityPillar extends TileEntity {
/*
* @formatter:off
-
- public static String[] validBlessings = {
- "Miner",
- "Lumberjack",
- "Warrior",
- "Hunter",
- "Swamp",
- "Thief",
- "Ninja",
- "Mechanic",
- "Alchemist",
- "Scout",
- "Guardian",
- "Vampire",
- "Inferno",
- "Diver",
- "Berserker",
- "Loner",
- "Paratrooper",
- "Porcupine",
- "Looter",
- "Scholar",
- "Thick-Skinned"
- };
-
- public static String[] validMobBlessings = {
- "Warrior",
- "Hunter",
- "Swamp",
- "Guardian",
- "Vampire",
- "Inferno",
- "Loner",
- "Paratrooper",
- "Porcupine",
- "Thick-Skinned"
- };
-
- public static String[] blessingDescriptions = {
- "+25% breaking speed on stone and iron blocks, and +20% damage with pickaxes",
- "+25% breaking speed on wooden blocks, and +15% damage with axes",
- "+20% melee damage",
- "+20% projectile damage",
- "Attacks will slow enemies",
- "Enemies have a chance to drop gold nuggets",
- "While sneaking, you are invisble, and attacks on enemies with full health"
- + " do double damage",
- "@@\u00A7ePASSIVE - \u00A7oYou disarm traps 3x as often and have"
- + " 2x the chance to salvage disarmed traps"
- + ".@@\u00A7eACTIVE - \u00A7oOnce per day, you may disarm and"
- + " salvage target trap for free",
- "All potions act like wildcard potions",
- "You can see traps without sneaking, but take 25% more damage from traps",
- "Take 20% less damage from all sources",
- "Heal 7% of damage dealt to enemies and, in direct sunlight,"
- + " you take 20% more damage and deal 20% less damage",
- "You don't take fire damage and do +35% damage while on fire,"
- + " but take damage when wet",
- "You can breathe underwater",
- "@@\u00A7ePASSIVE - \u00A7oKills are added as berserk charges. (10 max)"
- + "@@\u00A7eACTIVE - \u00A7o"
- + "Turn on/off berserk mode. While berserk mode is active,"
- + " you do 30% more damage,"
- + " and expend a counter every 2 seconds",
- "The lower your health, the higher your damage, to a maximum of +35%",
- "You don't take fall damage",
- "Melee attackers take received damage",
- "Enemies have a chance to drop dungeon loot",
- "Do bonus damage with weapons you are familiar with, and"
- + " against enemies you are familiar with",
- "Reduce damage taken by 2 points (1 heart)" };
-
-
+ *
+ * public static String[] validBlessings = { "Miner", "Lumberjack", "Warrior",
+ * "Hunter", "Swamp", "Thief", "Ninja", "Mechanic", "Alchemist", "Scout",
+ * "Guardian", "Vampire", "Inferno", "Diver", "Berserker", "Loner",
+ * "Paratrooper", "Porcupine", "Looter", "Scholar", "Thick-Skinned" };
+ *
+ * public static String[] validMobBlessings = { "Warrior", "Hunter", "Swamp",
+ * "Guardian", "Vampire", "Inferno", "Loner", "Paratrooper", "Porcupine",
+ * "Thick-Skinned" };
+ *
+ * public static String[] blessingDescriptions = {
+ * "+25% breaking speed on stone and iron blocks, and +20% damage with pickaxes"
+ * , "+25% breaking speed on wooden blocks, and +15% damage with axes",
+ * "+20% melee damage", "+20% projectile damage", "Attacks will slow enemies",
+ * "Enemies have a chance to drop gold nuggets",
+ * "While sneaking, you are invisble, and attacks on enemies with full health" +
+ * " do double damage",
+ * "@@\u00A7ePASSIVE - \u00A7oYou disarm traps 3x as often and have" +
+ * " 2x the chance to salvage disarmed traps" +
+ * ".@@\u00A7eACTIVE - \u00A7oOnce per day, you may disarm and" +
+ * " salvage target trap for free", "All potions act like wildcard potions",
+ * "You can see traps without sneaking, but take 25% more damage from traps",
+ * "Take 20% less damage from all sources",
+ * "Heal 7% of damage dealt to enemies and, in direct sunlight," +
+ * " you take 20% more damage and deal 20% less damage",
+ * "You don't take fire damage and do +35% damage while on fire," +
+ * " but take damage when wet", "You can breathe underwater",
+ * "@@\u00A7ePASSIVE - \u00A7oKills are added as berserk charges. (10 max)" +
+ * "@@\u00A7eACTIVE - \u00A7o" +
+ * "Turn on/off berserk mode. While berserk mode is active," +
+ * " you do 30% more damage," + " and expend a counter every 2 seconds",
+ * "The lower your health, the higher your damage, to a maximum of +35%",
+ * "You don't take fall damage", "Melee attackers take received damage",
+ * "Enemies have a chance to drop dungeon loot",
+ * "Do bonus damage with weapons you are familiar with, and" +
+ * " against enemies you are familiar with",
+ * "Reduce damage taken by 2 points (1 heart)" };
+ *
+ *
* @formatter:on
*/
@@ -107,9 +73,7 @@ public class TileEntityPillar extends TileEntity { spawnParticles();
if (ConfigData.pillarGlow) {
- worldObj.updateLightByType(
- EnumSkyBlock.Block, xCoord,
- yCoord, zCoord);
+ worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord, zCoord);
}
}
}
@@ -118,24 +82,12 @@ public class TileEntityPillar extends TileEntity { public void spawnParticles() {
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
- if (player != null && BlessingUtils.hasBlessing(player)
- && BlessingUtils.hasBlessing(player,
- blessing)) {
+ if (player != null && BlessingUtils.hasBlessing(player) && BlessingUtils.hasBlessing(player, blessing)) {
for (int i = 0; i < 2; i++) {
- worldObj.spawnParticle("portal", xCoord
- + ModjamMod.r.nextDouble(),
- yCoord + ModjamMod.r
- .nextDouble()
- * 2,
- zCoord + ModjamMod.r
- .nextDouble(),
- (ModjamMod.r.nextDouble()
- - 0.5D)
- * 2.0D,
- -ModjamMod.r.nextDouble(),
- (ModjamMod.r.nextDouble()
- - 0.5D)
- * 2.0D);
+ worldObj.spawnParticle("portal", xCoord + ModjamMod.r.nextDouble(),
+ yCoord + ModjamMod.r.nextDouble() * 2, zCoord + ModjamMod.r.nextDouble(),
+ (ModjamMod.r.nextDouble() - 0.5D) * 2.0D, -ModjamMod.r.nextDouble(),
+ (ModjamMod.r.nextDouble() - 0.5D) * 2.0D);
}
}
}
@@ -152,8 +104,7 @@ public class TileEntityPillar extends TileEntity { @Override
public void readFromNBT(NBTTagCompound par1NBTTagCompound) {
super.readFromNBT(par1NBTTagCompound);
- blessing = par1NBTTagCompound.hasKey("Blessing")
- ? par1NBTTagCompound.getString("Blessing")
+ blessing = par1NBTTagCompound.hasKey("Blessing") ? par1NBTTagCompound.getString("Blessing")
: BlessingUtils.getPlayerBlessing();
}
@@ -161,13 +112,11 @@ public class TileEntityPillar extends TileEntity { public Packet getDescriptionPacket() {
NBTTagCompound tag = new NBTTagCompound();
writeToNBT(tag);
- return new S35PacketUpdateTileEntity(xCoord, yCoord,
- zCoord, 1, tag);
+ return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, tag);
}
@Override
- public void onDataPacket(NetworkManager net,
- S35PacketUpdateTileEntity pkt) {
+ public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
readFromNBT(pkt.func_148857_g());
}
diff --git a/YWD/src/main/java/fyresmodjam/tileentities/TileEntityTrap.java b/YWD/src/main/java/fyresmodjam/tileentities/TileEntityTrap.java index 2353adb..9122f38 100755 --- a/YWD/src/main/java/fyresmodjam/tileentities/TileEntityTrap.java +++ b/YWD/src/main/java/fyresmodjam/tileentities/TileEntityTrap.java @@ -17,15 +17,11 @@ import net.minecraft.util.AxisAlignedBB; public class TileEntityTrap extends TileEntity {
- public static String[] settings = {
- "invisible to and damages all but player",
- "visible to all and damages all but player",
- "visible to all and only damages mobs",
- "decorative"
- };
+ public static String[] settings = { "invisible to and damages all but player",
+ "visible to all and damages all but player", "visible to all and only damages mobs", "decorative" };
- public String placedBy = null;
- public int setting = 0;
+ public String placedBy = null;
+ public int setting = 0;
public TileEntityTrap() {
}
@@ -46,8 +42,7 @@ public class TileEntityTrap extends TileEntity { if (placedBy != null) {
par1NBTTagCompound.setString("PlacedBy", placedBy);
}
- par1NBTTagCompound.setInteger("Setting",
- setting % settings.length);
+ par1NBTTagCompound.setInteger("Setting", setting % settings.length);
}
@Override
@@ -55,15 +50,13 @@ public class TileEntityTrap extends TileEntity { super.readFromNBT(par1NBTTagCompound);
if (par1NBTTagCompound.hasKey("PlacedBy")) {
- placedBy = par1NBTTagCompound
- .getString("PlacedBy");
+ placedBy = par1NBTTagCompound.getString("PlacedBy");
} else {
placedBy = null;
}
if (par1NBTTagCompound.hasKey("Setting")) {
- setting = par1NBTTagCompound.getInteger("Setting")
- % settings.length;
+ setting = par1NBTTagCompound.getInteger("Setting") % settings.length;
}
}
@@ -71,13 +64,11 @@ public class TileEntityTrap extends TileEntity { public Packet getDescriptionPacket() {
NBTTagCompound tag = new NBTTagCompound();
writeToNBT(tag);
- return new S35PacketUpdateTileEntity(xCoord, yCoord,
- zCoord, 1, tag);
+ return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, tag);
}
@Override
- public void onDataPacket(NetworkManager net,
- S35PacketUpdateTileEntity pkt) {
+ public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
readFromNBT(pkt.func_148857_g());
}
@@ -91,70 +82,34 @@ public class TileEntityTrap extends TileEntity { @SideOnly(Side.CLIENT)
public double getMaxRenderDistanceSquared() {
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
- return (player != null && (player.getCommandSenderName()
- .equals(placedBy) || setting != 0))
- ? 4096.0F
- : 36.0F;
+ return (player != null && (player.getCommandSenderName().equals(placedBy) || setting != 0)) ? 4096.0F : 36.0F;
}
@SideOnly(Side.CLIENT)
public void spawnParticles() {
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
- int type = worldObj.getBlockMetadata(xCoord, yCoord,
- zCoord);
-
- if (player != null
- && (!NewPacketHandler.trapsDisabled
- || placedBy != null)
- && (player.getCommandSenderName()
- .equals(placedBy)
- || player.isSneaking()
- || setting != 0
- || (BlessingUtils
- .hasBlessing(player,
- "MarkScouting")))
- && getDistanceFrom(
- TileEntityRendererDispatcher.staticPlayerX,
+ int type = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
+
+ if (player != null && (!NewPacketHandler.trapsDisabled || placedBy != null)
+ && (player.getCommandSenderName().equals(placedBy) || player.isSneaking() || setting != 0
+ || (BlessingUtils.hasBlessing(player, "MarkScouting")))
+ && getDistanceFrom(TileEntityRendererDispatcher.staticPlayerX,
TileEntityRendererDispatcher.staticPlayerY,
- TileEntityRendererDispatcher.staticPlayerZ) < (player
- .getCommandSenderName()
- .equals(placedBy)
- ? 4096
- : 36.0F)) {
+ TileEntityRendererDispatcher.staticPlayerZ) < (player.getCommandSenderName().equals(placedBy)
+ ? 4096
+ : 36.0F)) {
if (type == 1) {
if (ModjamMod.r.nextInt(5) == 0) {
- worldObj.spawnParticle("smoke",
- xCoord + 0.5F,
- yCoord + 0.175F,
- zCoord + 0.5F,
- (ModjamMod.r.nextFloat()
- - 0.5F)
- / 16,
- ModjamMod.r.nextFloat()
- / 16,
- (ModjamMod.r.nextFloat()
- - 0.5F)
- / 16);
+ worldObj.spawnParticle("smoke", xCoord + 0.5F, yCoord + 0.175F, zCoord + 0.5F,
+ (ModjamMod.r.nextFloat() - 0.5F) / 16, ModjamMod.r.nextFloat() / 16,
+ (ModjamMod.r.nextFloat() - 0.5F) / 16);
}
- worldObj.spawnParticle("flame",
- xCoord + 0.5F,
- yCoord + 0.175F,
- zCoord + 0.5F, 0.0F, 0.0F,
- 0.0F);
+ worldObj.spawnParticle("flame", xCoord + 0.5F, yCoord + 0.175F, zCoord + 0.5F, 0.0F, 0.0F, 0.0F);
} else if (type == 2) {
for (int i = 0; i < 3; i++) {
- worldObj.spawnParticle("smoke",
- xCoord + 0.5F,
- yCoord + 0.175F,
- zCoord + 0.5F,
- (ModjamMod.r.nextFloat()
- - 0.5F)
- / 16,
- ModjamMod.r.nextFloat()
- / 16,
- (ModjamMod.r.nextFloat()
- - 0.5F)
- / 16);
+ worldObj.spawnParticle("smoke", xCoord + 0.5F, yCoord + 0.175F, zCoord + 0.5F,
+ (ModjamMod.r.nextFloat() - 0.5F) / 16, ModjamMod.r.nextFloat() / 16,
+ (ModjamMod.r.nextFloat() - 0.5F) / 16);
}
}
}
diff --git a/YWD/src/main/java/fyresmodjam/tileentities/renderers/TileEntityCrystalRenderer.java b/YWD/src/main/java/fyresmodjam/tileentities/renderers/TileEntityCrystalRenderer.java index 7d64e51..91ecb23 100755 --- a/YWD/src/main/java/fyresmodjam/tileentities/renderers/TileEntityCrystalRenderer.java +++ b/YWD/src/main/java/fyresmodjam/tileentities/renderers/TileEntityCrystalRenderer.java @@ -20,12 +20,10 @@ public class TileEntityCrystalRenderer extends TileEntitySpecialRenderer { private ModelCrystal modelCrystal = new ModelCrystal();
- public static ResourceLocation texture = new ResourceLocation(
- "fyresmodjam", "textures/blocks/crystal.png");
+ public static ResourceLocation texture = new ResourceLocation("fyresmodjam", "textures/blocks/crystal.png");
@Override
- public void renderTileEntityAt(TileEntity tileentity, double d0,
- double d1, double d2, float f) {
+ public void renderTileEntityAt(TileEntity tileentity, double d0, double d1, double d2, float f) {
GL11.glPushMatrix();
GL11.glTranslatef((float) d0, (float) d1, (float) d2);
@@ -34,37 +32,23 @@ public class TileEntityCrystalRenderer extends TileEntitySpecialRenderer { World world = crystal.getWorldObj();
Tessellator tessellator = Tessellator.instance;
- float f2 = block.getMixedBrightnessForBlock(world,
- crystal.xCoord, crystal.yCoord,
- crystal.zCoord);
- int l = world.getLightBrightnessForSkyBlocks(
- crystal.xCoord, crystal.yCoord,
- crystal.zCoord, 0);
+ float f2 = block.getMixedBrightnessForBlock(world, crystal.xCoord, crystal.yCoord, crystal.zCoord);
+ int l = world.getLightBrightnessForSkyBlocks(crystal.xCoord, crystal.yCoord, crystal.zCoord, 0);
int l1 = l % 65536;
int l2 = l / 65536;
tessellator.setColorOpaque_F(f2, f2, f2);
- OpenGlHelper.setLightmapTextureCoords(
- OpenGlHelper.lightmapTexUnit, l1, l2);
+ OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, l1, l2);
- float f3 = world.getWorldInfo().getWorldTime() % 20
- / 20.0F;
- GL11.glTranslatef(0.5F,
- -0.4F + (f3 > 0.5F ? 0.25F - 0.25F * f3
- : 0.25F * f3),
- 0.5F);
+ float f3 = world.getWorldInfo().getWorldTime() % 20 / 20.0F;
+ GL11.glTranslatef(0.5F, -0.4F + (f3 > 0.5F ? 0.25F - 0.25F * f3 : 0.25F * f3), 0.5F);
- GL11.glRotatef((float) world.getWorldInfo().getWorldTime()
- % 360, 0.0F, 1.0F, 0.0F);
+ GL11.glRotatef((float) world.getWorldInfo().getWorldTime() % 360, 0.0F, 1.0F, 0.0F);
- Color color = ItemCrystal.colors[crystal.getBlockMetadata()
- % ItemCrystal.colors.length];
- GL11.glColor3f(color.getRed() / 255.0F,
- color.getGreen() / 255.0F,
- color.getBlue() / 255.0F);
+ Color color = ItemCrystal.colors[crystal.getBlockMetadata() % ItemCrystal.colors.length];
+ GL11.glColor3f(color.getRed() / 255.0F, color.getGreen() / 255.0F, color.getBlue() / 255.0F);
bindTexture(texture);
- modelCrystal.render(null, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F,
- 0.0625F);
+ modelCrystal.render(null, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F);
GL11.glPopMatrix();
}
diff --git a/YWD/src/main/java/fyresmodjam/tileentities/renderers/TileEntityCrystalStandRenderer.java b/YWD/src/main/java/fyresmodjam/tileentities/renderers/TileEntityCrystalStandRenderer.java index 55873f9..cacafee 100755 --- a/YWD/src/main/java/fyresmodjam/tileentities/renderers/TileEntityCrystalStandRenderer.java +++ b/YWD/src/main/java/fyresmodjam/tileentities/renderers/TileEntityCrystalStandRenderer.java @@ -13,18 +13,14 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
-public class TileEntityCrystalStandRenderer
- extends TileEntitySpecialRenderer {
+public class TileEntityCrystalStandRenderer extends TileEntitySpecialRenderer {
private ModelCrystalStand model = new ModelCrystalStand();
- public static ResourceLocation texture = new ResourceLocation(
- "fyresmodjam",
- "textures/blocks/crystal_stand.png");
+ public static ResourceLocation texture = new ResourceLocation("fyresmodjam", "textures/blocks/crystal_stand.png");
@Override
- public void renderTileEntityAt(TileEntity tileentity, double d0,
- double d1, double d2, float f) {
+ public void renderTileEntityAt(TileEntity tileentity, double d0, double d1, double d2, float f) {
GL11.glPushMatrix();
GL11.glTranslatef((float) d0, (float) d1, (float) d2);
@@ -33,17 +29,13 @@ public class TileEntityCrystalStandRenderer World world = crystalStand.getWorldObj();
Tessellator tessellator = Tessellator.instance;
- float f2 = block.getMixedBrightnessForBlock(world,
- crystalStand.xCoord, crystalStand.yCoord,
+ float f2 = block.getMixedBrightnessForBlock(world, crystalStand.xCoord, crystalStand.yCoord,
crystalStand.zCoord);
- int l = world.getLightBrightnessForSkyBlocks(
- crystalStand.xCoord, crystalStand.yCoord,
- crystalStand.zCoord, 0);
+ int l = world.getLightBrightnessForSkyBlocks(crystalStand.xCoord, crystalStand.yCoord, crystalStand.zCoord, 0);
int l1 = l % 65536;
int l2 = l / 65536;
tessellator.setColorOpaque_F(f2, f2, f2);
- OpenGlHelper.setLightmapTextureCoords(
- OpenGlHelper.lightmapTexUnit, l1, l2);
+ OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, l1, l2);
GL11.glTranslatef(0.5F, 1.5F, 0.5F);
GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F);
diff --git a/YWD/src/main/java/fyresmodjam/tileentities/renderers/TileEntityPillarRenderer.java b/YWD/src/main/java/fyresmodjam/tileentities/renderers/TileEntityPillarRenderer.java index 7d38d20..38826df 100755 --- a/YWD/src/main/java/fyresmodjam/tileentities/renderers/TileEntityPillarRenderer.java +++ b/YWD/src/main/java/fyresmodjam/tileentities/renderers/TileEntityPillarRenderer.java @@ -19,43 +19,31 @@ import net.minecraft.world.World; public class TileEntityPillarRenderer extends TileEntitySpecialRenderer {
private ModelPillar modelPillar = new ModelPillar();
- public static ResourceLocation[] textures = {
- new ResourceLocation("fyresmodjam",
- "textures/blocks/pillar.png"),
- new ResourceLocation("fyresmodjam",
- "textures/blocks/pillarActive.png")
- };
+ public static ResourceLocation[] textures = { new ResourceLocation("fyresmodjam", "textures/blocks/pillar.png"),
+ new ResourceLocation("fyresmodjam", "textures/blocks/pillarActive.png") };
@Override
- public void renderTileEntityAt(TileEntity tileEntity, double d,
- double d1, double d2, float f) {
+ public void renderTileEntityAt(TileEntity tileEntity, double d, double d1, double d2, float f) {
GL11.glPushMatrix();
GL11.glTranslatef((float) d, (float) d1, (float) d2);
TileEntityPillar tileEntityYour = (TileEntityPillar) tileEntity;
- renderBlockYour(tileEntityYour, tileEntity.getWorldObj(),
- tileEntity.xCoord, tileEntity.yCoord,
+ renderBlockYour(tileEntityYour, tileEntity.getWorldObj(), tileEntity.xCoord, tileEntity.yCoord,
tileEntity.zCoord, ModjamMod.blockPillar);
GL11.glPopMatrix();
}
- public void renderBlockYour(TileEntityPillar tl, World world,
- int i, int j, int k, Block block) {
+ public void renderBlockYour(TileEntityPillar tl, World world, int i, int j, int k, Block block) {
Tessellator tessellator = Tessellator.instance;
float f = block.getMixedBrightnessForBlock(world, i, j, k);
int l = world.getLightBrightnessForSkyBlocks(i, j, k, 0);
int l1 = l % 65536;
int l2 = l / 65536;
tessellator.setColorOpaque_F(f, f, f);
- OpenGlHelper.setLightmapTextureCoords(
- OpenGlHelper.lightmapTexUnit, l1, l2);
+ OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, l1, l2);
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
- boolean active = player != null
- && player.getEntityData()
- .hasKey("Blessing")
- && player.getEntityData()
- .getString("Blessing")
- .equals(tl.blessing);
+ boolean active = player != null && player.getEntityData().hasKey("Blessing")
+ && player.getEntityData().getString("Blessing").equals(tl.blessing);
GL11.glPushMatrix();
@@ -63,8 +51,7 @@ public class TileEntityPillarRenderer extends TileEntitySpecialRenderer { GL11.glTranslatef(0.5F, -1.5F, -0.5F);
bindTexture(!active ? textures[0] : textures[1]);
- modelPillar.render((Entity) null, 0.0F, 0.0F, 0.0F, 0.0F,
- 0.0F, 0.0625F);
+ modelPillar.render((Entity) null, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F);
GL11.glPopMatrix();
}
}
\ No newline at end of file diff --git a/YWD/src/main/java/fyresmodjam/tileentities/renderers/TileEntityTrapRenderer.java b/YWD/src/main/java/fyresmodjam/tileentities/renderers/TileEntityTrapRenderer.java index c66f06a..7ffe43d 100755 --- a/YWD/src/main/java/fyresmodjam/tileentities/renderers/TileEntityTrapRenderer.java +++ b/YWD/src/main/java/fyresmodjam/tileentities/renderers/TileEntityTrapRenderer.java @@ -22,56 +22,36 @@ import net.minecraft.world.World; public class TileEntityTrapRenderer extends TileEntitySpecialRenderer {
- private ModelBase[] models = {
- new ModelSpikes(), new ModelTrap2(),
- new ModelTrap2()
- };
+ private ModelBase[] models = { new ModelSpikes(), new ModelTrap2(), new ModelTrap2() };
- public static ResourceLocation[] textures = {
- new ResourceLocation("fyresmodjam",
- "textures/blocks/spikes.png"),
- new ResourceLocation("fyresmodjam",
- "textures/blocks/trap2.png"),
- new ResourceLocation("fyresmodjam",
- "textures/blocks/trap3.png")
- };
+ public static ResourceLocation[] textures = { new ResourceLocation("fyresmodjam", "textures/blocks/spikes.png"),
+ new ResourceLocation("fyresmodjam", "textures/blocks/trap2.png"),
+ new ResourceLocation("fyresmodjam", "textures/blocks/trap3.png") };
@Override
- public void renderTileEntityAt(TileEntity tileEntity, double d,
- double d1, double d2, float f) {
+ public void renderTileEntityAt(TileEntity tileEntity, double d, double d1, double d2, float f) {
GL11.glPushMatrix();
GL11.glTranslatef((float) d, (float) d1, (float) d2);
TileEntityTrap tileEntityYour = (TileEntityTrap) tileEntity;
- renderBlockYour(tileEntityYour, tileEntity.getWorldObj(),
- tileEntity.xCoord, tileEntity.yCoord,
+ renderBlockYour(tileEntityYour, tileEntity.getWorldObj(), tileEntity.xCoord, tileEntity.yCoord,
tileEntity.zCoord, ModjamMod.blockTrap);
GL11.glPopMatrix();
}
- public void renderBlockYour(TileEntityTrap tl, World world, int i,
- int j, int k, Block block) {
+ public void renderBlockYour(TileEntityTrap tl, World world, int i, int j, int k, Block block) {
Tessellator tessellator = Tessellator.instance;
float f = block.getMixedBrightnessForBlock(world, i, j, k);
int l = world.getLightBrightnessForSkyBlocks(i, j, k, 0);
int l1 = l % 65536;
int l2 = l / 65536;
tessellator.setColorOpaque_F(f, f, f);
- OpenGlHelper.setLightmapTextureCoords(
- OpenGlHelper.lightmapTexUnit, l1, l2);
+ OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, l1, l2);
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
- boolean active = player != null
- && (!NewPacketHandler.trapsDisabled
- || tl.placedBy != null)
- && (player.getCommandSenderName()
- .equals(tl.placedBy)
- || tl.setting != 0
- || player.isSneaking()
- || (player.getEntityData()
- .hasKey("Blessing")
- && player.getEntityData()
- .getString("Blessing")
- .equals("Scout")));
+ boolean active = player != null && (!NewPacketHandler.trapsDisabled || tl.placedBy != null)
+ && (player.getCommandSenderName().equals(tl.placedBy) || tl.setting != 0 || player.isSneaking()
+ || (player.getEntityData().hasKey("Blessing")
+ && player.getEntityData().getString("Blessing").equals("Scout")));
int type = world.getBlockMetadata(i, j, k);
@@ -82,9 +62,7 @@ public class TileEntityTrapRenderer extends TileEntitySpecialRenderer { GL11.glTranslatef(0.5F, -1.5F, -0.5F);
bindTexture(textures[type % BlockTrap.trapTypes]);
- models[type % BlockTrap.trapTypes].render(
- (Entity) null, 0.0F, 0.0F, 0.0F,
- 0.0F, 0.0F, 0.0625F);
+ models[type % BlockTrap.trapTypes].render((Entity) null, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F);
GL11.glPopMatrix();
}
diff --git a/YWD/src/main/java/fyresmodjam/worldgen/FyresWorldData.java b/YWD/src/main/java/fyresmodjam/worldgen/FyresWorldData.java index 07cbd84..bcc5372 100755 --- a/YWD/src/main/java/fyresmodjam/worldgen/FyresWorldData.java +++ b/YWD/src/main/java/fyresmodjam/worldgen/FyresWorldData.java @@ -25,36 +25,20 @@ public class FyresWorldData extends WorldSavedData { /*
* @formatter:off
*/
- public static String[] validDisadvantages = {
- "Tougher Mobs",
- "Weak",
- "Explosive Traps",
- "Increased Mob Spawn",
- //"Neverending Rain",
- //"Neverending Night",
- "Permadeath",
- "Trigger-happy",
- "Diabolic",
- "Organized Foes"
- };
-
- public static String[] disadvantageDescriptions = {
- "Hostile enemies takes 25% less damage",
- "-25% melee damage",
- "Traps also trigger explosions when set off",
- "+33% hostile mob spawn rate",
- //"Constantly rains",
- //"Constant night",
- "Items dropped upon death are permanently lost",
- "Mobs have a chance to explode on death",
+ public static String[] validDisadvantages = { "Tougher Mobs", "Weak", "Explosive Traps", "Increased Mob Spawn",
+ // "Neverending Rain",
+ // "Neverending Night",
+ "Permadeath", "Trigger-happy", "Diabolic", "Organized Foes" };
+
+ public static String[] disadvantageDescriptions = { "Hostile enemies takes 25% less damage", "-25% melee damage",
+ "Traps also trigger explosions when set off", "+33% hostile mob spawn rate",
+ // "Constantly rains",
+ // "Constant night",
+ "Items dropped upon death are permanently lost", "Mobs have a chance to explode on death",
"All mobs have a chance to recieve a random blessing",
- "Mobs spawn with armor and weapons, increasing with level"
- };
+ "Mobs spawn with armor and weapons, increasing with level" };
- public static String[] validTasks = {
- "Kill",
- "Burn"
- };
+ public static String[] validTasks = { "Kill", "Burn" };
/*
* @formatter:on
@@ -62,59 +46,39 @@ public class FyresWorldData extends WorldSavedData { public static String key = "FyresWorldData";
- public int[] potionValues = null;
- public int[] potionDurations = null;
+ public int[] potionValues = null;
+ public int[] potionDurations = null;
public int[][] mushroomColors = null;
public String currentDisadvantage = null;
- public String currentTask = null;
- public int currentTaskID = -1;
- public int currentTaskAmount = 0;
- public int progress = 0;
- public int tasksCompleted = 0;
- public int rewardLevels = -1;
+ public String currentTask = null;
+ public int currentTaskID = -1;
+ public int currentTaskAmount = 0;
+ public int progress = 0;
+ public int tasksCompleted = 0;
+ public int rewardLevels = -1;
public boolean enderDragonKilled = false;
// TODO pull these into a class instead of using parallel arrays
@SuppressWarnings("rawtypes")
- public static Class[] validMobs = {
- EntityDragon.class, EntityGhast.class,
- EntityWither.class
- };
- public static String[] validMobNames = {
- "Ender Dragon", "Ghast", "Wither"
- };
- public static int[][] mobNumbers = {
- new int[] {
- 1, 1
- }, new int[] {
- 5, 15
- }, new int[] {
- 1, 1
- }
- };
-
- public HashMap<String, String> blessingByPlayer = new HashMap<String, String>();
- public HashMap<String, int[]> potionKnowledgeByPlayer = new HashMap<String, int[]>();
-
- public HashMap<String, NBTTagCompound> killStatsByPlayer = new HashMap<String, NBTTagCompound>();
- public HashMap<String, NBTTagCompound> weaponStatsByPlayer = new HashMap<String, NBTTagCompound>();
- public HashMap<String, NBTTagCompound> craftingStatsByPlayer = new HashMap<String, NBTTagCompound>();
-
- public static ItemStack[] validItems = {
- new ItemStack(Blocks.diamond_block),
- new ItemStack(Blocks.gold_block),
- new ItemStack(Blocks.emerald_block),
- new ItemStack(Blocks.lapis_block),
- new ItemStack(Items.diamond),
- new ItemStack(Items.emerald),
- new ItemStack(Items.gold_ingot),
- new ItemStack(Items.nether_star),
- new ItemStack(Items.ghast_tear)
- };
+ public static Class[] validMobs = { EntityDragon.class, EntityGhast.class, EntityWither.class };
+ public static String[] validMobNames = { "Ender Dragon", "Ghast", "Wither" };
+ public static int[][] mobNumbers = { new int[] { 1, 1 }, new int[] { 5, 15 }, new int[] { 1, 1 } };
+
+ public HashMap<String, String> blessingByPlayer = new HashMap<String, String>();
+ public HashMap<String, int[]> potionKnowledgeByPlayer = new HashMap<String, int[]>();
+
+ public HashMap<String, NBTTagCompound> killStatsByPlayer = new HashMap<String, NBTTagCompound>();
+ public HashMap<String, NBTTagCompound> weaponStatsByPlayer = new HashMap<String, NBTTagCompound>();
+ public HashMap<String, NBTTagCompound> craftingStatsByPlayer = new HashMap<String, NBTTagCompound>();
+
+ public static ItemStack[] validItems = { new ItemStack(Blocks.diamond_block), new ItemStack(Blocks.gold_block),
+ new ItemStack(Blocks.emerald_block), new ItemStack(Blocks.lapis_block), new ItemStack(Items.diamond),
+ new ItemStack(Items.emerald), new ItemStack(Items.gold_ingot), new ItemStack(Items.nether_star),
+ new ItemStack(Items.ghast_tear) };
public FyresWorldData() {
super(key);
@@ -127,8 +91,7 @@ public class FyresWorldData extends WorldSavedData { public static FyresWorldData forWorld(World world) {
MapStorage storage = world.perWorldStorage;
- FyresWorldData result = (FyresWorldData) storage
- .loadData(FyresWorldData.class, key);
+ FyresWorldData result = (FyresWorldData) storage.loadData(FyresWorldData.class, key);
if (result == null) {
result = new FyresWorldData();
@@ -144,61 +107,48 @@ public class FyresWorldData extends WorldSavedData { @Override
public void readFromNBT(NBTTagCompound nbttagcompound) {
if (nbttagcompound.hasKey("values")) {
- potionValues = nbttagcompound
- .getIntArray("values");
+ potionValues = nbttagcompound.getIntArray("values");
}
if (nbttagcompound.hasKey("durations")) {
- potionDurations = nbttagcompound
- .getIntArray("durations");
+ potionDurations = nbttagcompound.getIntArray("durations");
}
if (nbttagcompound.hasKey("currentDisadvantage")) {
- currentDisadvantage = nbttagcompound
- .getString("currentDisadvantage");
+ currentDisadvantage = nbttagcompound.getString("currentDisadvantage");
}
if (nbttagcompound.hasKey("currentTask")) {
- currentTask = nbttagcompound
- .getString("currentTask");
+ currentTask = nbttagcompound.getString("currentTask");
}
if (nbttagcompound.hasKey("currentTaskID")) {
- currentTaskID = nbttagcompound
- .getInteger("currentTaskID");
+ currentTaskID = nbttagcompound.getInteger("currentTaskID");
}
if (nbttagcompound.hasKey("currentTaskAmount")) {
- currentTaskAmount = nbttagcompound
- .getInteger("currentTaskAmount");
+ currentTaskAmount = nbttagcompound.getInteger("currentTaskAmount");
}
if (nbttagcompound.hasKey("progress")) {
progress = nbttagcompound.getInteger("progress");
}
if (nbttagcompound.hasKey("tasksCompleted")) {
- tasksCompleted = nbttagcompound
- .getInteger("tasksCompleted");
+ tasksCompleted = nbttagcompound.getInteger("tasksCompleted");
}
if (nbttagcompound.hasKey("enderDragonKilled")) {
- enderDragonKilled = nbttagcompound
- .getBoolean("enderDragonKilled");
+ enderDragonKilled = nbttagcompound.getBoolean("enderDragonKilled");
}
if (nbttagcompound.hasKey("rewardLevels")) {
- rewardLevels = nbttagcompound
- .getInteger("rewardLevels");
+ rewardLevels = nbttagcompound.getInteger("rewardLevels");
}
mushroomColors = new int[13][];
for (int i = 0; i < 13; i++) {
- if (nbttagcompound.hasKey(
- "mushroomColors_" + (i + 1))) {
- mushroomColors[i] = nbttagcompound
- .getIntArray("mushroomColors_"
- + (i + 1));
+ if (nbttagcompound.hasKey("mushroomColors_" + (i + 1))) {
+ mushroomColors[i] = nbttagcompound.getIntArray("mushroomColors_" + (i + 1));
}
}
if (nbttagcompound.hasKey("TempPlayerStats")) {
- NBTTagCompound tempStats = nbttagcompound
- .getCompoundTag("TempPlayerStats");
+ NBTTagCompound tempStats = nbttagcompound.getCompoundTag("TempPlayerStats");
for (Object o : tempStats.func_150296_c()) {
if (o == null || !(o instanceof NBTTagCompound)) {
@@ -206,32 +156,17 @@ public class FyresWorldData extends WorldSavedData { }
NBTTagCompound player = (NBTTagCompound) o;
- blessingByPlayer.put(
- player.getString("Name"),
- player.getString(
- "Blessing"));
- potionKnowledgeByPlayer.put(
- player.getString("Name"),
- player.getIntArray(
- "PotionKnowledge"));
+ blessingByPlayer.put(player.getString("Name"), player.getString("Blessing"));
+ potionKnowledgeByPlayer.put(player.getString("Name"), player.getIntArray("PotionKnowledge"));
if (player.hasKey("KillStats")) {
- killStatsByPlayer.put(player
- .getString("Name"),
- player.getCompoundTag(
- "KillStats"));
+ killStatsByPlayer.put(player.getString("Name"), player.getCompoundTag("KillStats"));
}
if (player.hasKey("WeaponStats")) {
- weaponStatsByPlayer.put(player
- .getString("Name"),
- player.getCompoundTag(
- "WeaponStats"));
+ weaponStatsByPlayer.put(player.getString("Name"), player.getCompoundTag("WeaponStats"));
}
if (player.hasKey("CraftingStats")) {
- craftingStatsByPlayer.put(player
- .getString("Name"),
- player.getCompoundTag(
- "CraftingStats"));
+ craftingStatsByPlayer.put(player.getString("Name"), player.getCompoundTag("CraftingStats"));
}
}
}
@@ -245,26 +180,20 @@ public class FyresWorldData extends WorldSavedData { nbttagcompound.setIntArray("values", potionValues);
nbttagcompound.setIntArray("durations", potionDurations);
- nbttagcompound.setString("currentDisadvantage",
- currentDisadvantage);
+ nbttagcompound.setString("currentDisadvantage", currentDisadvantage);
nbttagcompound.setString("currentTask", currentTask);
nbttagcompound.setInteger("currentTaskID", currentTaskID);
- nbttagcompound.setInteger("currentTaskAmount",
- currentTaskAmount);
+ nbttagcompound.setInteger("currentTaskAmount", currentTaskAmount);
nbttagcompound.setInteger("progress", progress);
- nbttagcompound.setInteger("tasksCompleted",
- tasksCompleted);
+ nbttagcompound.setInteger("tasksCompleted", tasksCompleted);
- nbttagcompound.setBoolean("enderDragonKilled",
- enderDragonKilled);
+ nbttagcompound.setBoolean("enderDragonKilled", enderDragonKilled);
nbttagcompound.setInteger("rewardLevels", rewardLevels);
for (int i = 0; i < 13; i++) {
- nbttagcompound.setIntArray(
- "mushroomColors_" + (i + 1),
- mushroomColors[i]);
+ nbttagcompound.setIntArray("mushroomColors_" + (i + 1), mushroomColors[i]);
}
fillBlessingsByPlayer(nbttagcompound);
@@ -282,33 +211,23 @@ public class FyresWorldData extends WorldSavedData { NBTTagCompound player = new NBTTagCompound();
player.setString("Name", s);
- player.setString("Blessing",
- blessingByPlayer.get(s));
- player.setIntArray("PotionKnowledge",
- potionKnowledgeByPlayer
- .get(s));
+ player.setString("Blessing", blessingByPlayer.get(s));
+ player.setIntArray("PotionKnowledge", potionKnowledgeByPlayer.get(s));
if (killStatsByPlayer.containsKey(s)) {
- player.setTag("KillStats",
- killStatsByPlayer
- .get(s));
+ player.setTag("KillStats", killStatsByPlayer.get(s));
}
if (weaponStatsByPlayer.containsKey(s)) {
- player.setTag("WeaponStats",
- weaponStatsByPlayer
- .get(s));
+ player.setTag("WeaponStats", weaponStatsByPlayer.get(s));
}
if (craftingStatsByPlayer.containsKey(s)) {
- player.setTag("CraftingStats",
- craftingStatsByPlayer
- .get(s));
+ player.setTag("CraftingStats", craftingStatsByPlayer.get(s));
}
tempPlayerStats.setTag(s, player);
}
- nbttagcompound.setTag("TempPlayerStats",
- tempPlayerStats);
+ nbttagcompound.setTag("TempPlayerStats", tempPlayerStats);
}
}
@@ -347,9 +266,7 @@ public class FyresWorldData extends WorldSavedData { }
}
- boolean alreadyKilledDragon = currentTask != null
- && currentTask.equals("Kill")
- && currentTaskID == 0
+ boolean alreadyKilledDragon = currentTask != null && currentTask.equals("Kill") && currentTaskID == 0
&& enderDragonKilled;
if (changeTask || alreadyKilledDragon) {
@@ -369,20 +286,15 @@ public class FyresWorldData extends WorldSavedData { if (currentDisadvantage != null) {
boolean valid = validateDisadvantage();
- changeDisadvantage = !valid && !currentDisadvantage
- .equals("None");
+ changeDisadvantage = !valid && !currentDisadvantage.equals("None");
}
if (changeDisadvantage) {
currentDisadvantage = chooseDisadvantage();
- MinecraftServer server = FMLCommonHandler
- .instance()
- .getMinecraftServerInstance();
+ MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
- boolean permadeathOnHardcore = server.isHardcore()
- && currentDisadvantage.equals(
- "Permadeath");
+ boolean permadeathOnHardcore = server.isHardcore() && currentDisadvantage.equals("Permadeath");
while (server != null && permadeathOnHardcore) {
currentDisadvantage = chooseDisadvantage();
@@ -392,17 +304,13 @@ public class FyresWorldData extends WorldSavedData { private void checkPotionValues() {
if (potionValues == null) {
- potionValues = new int[] {
- -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1
- };
+ potionValues = new int[] { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 };
for (int i = 0; i < 13 - 1; i++) {
int randPotionID = getRandomPotionID();
boolean stop = false;
- while (potionIDIsValid(randPotionID)
- || !stop) {
+ while (potionIDIsValid(randPotionID) || !stop) {
stop = true;
randPotionID = getRandomPotionID();
@@ -421,8 +329,7 @@ public class FyresWorldData extends WorldSavedData { if (Potion.potionTypes[potionValues[i]] == null) {
int randPotionID = getRandomPotionID();
- while (potionIDIsValid(
- randPotionID)) {
+ while (potionIDIsValid(randPotionID)) {
randPotionID = getRandomPotionID();
}
@@ -456,9 +363,7 @@ public class FyresWorldData extends WorldSavedData { }
private int randomRGBColor() {
- return Color.HSBtoRGB(ModjamMod.r.nextFloat(),
- ModjamMod.r.nextFloat(),
- ModjamMod.r.nextFloat());
+ return Color.HSBtoRGB(ModjamMod.r.nextFloat(), ModjamMod.r.nextFloat(), ModjamMod.r.nextFloat());
}
private boolean validateDisadvantage() {
@@ -474,8 +379,7 @@ public class FyresWorldData extends WorldSavedData { }
private String chooseDisadvantage() {
- return validDisadvantages[ModjamMod.r
- .nextInt(validDisadvantages.length)];
+ return validDisadvantages[ModjamMod.r.nextInt(validDisadvantages.length)];
}
public void giveNewTask() {
@@ -488,8 +392,7 @@ public class FyresWorldData extends WorldSavedData { int baseMobNumber = mobNumbers[currentTaskID][0];
- currentTaskAmount = baseMobNumber
- + getMobNumberAdjuster();
+ currentTaskAmount = baseMobNumber + getMobNumberAdjuster();
} else if (currentTask.equals("Burn")) {
currentTaskID = getTaskItem();
@@ -506,11 +409,9 @@ public class FyresWorldData extends WorldSavedData { }
private int setTaskItemCount() {
- boolean isNetherStar = validItems[currentTaskID]
- .getItem() == Items.nether_star;
+ boolean isNetherStar = validItems[currentTaskID].getItem() == Items.nether_star;
- boolean isBlock = validItems[currentTaskID]
- .getItem() instanceof ItemBlock;
+ boolean isBlock = validItems[currentTaskID].getItem() instanceof ItemBlock;
int taskAmount;
@@ -543,13 +444,11 @@ public class FyresWorldData extends WorldSavedData { if (!dragonKilled) {
return ModjamMod.r.nextInt(validMobs.length);
} else {
- return 1 + ModjamMod.r
- .nextInt(validMobs.length - 1);
+ return 1 + ModjamMod.r.nextInt(validMobs.length - 1);
}
}
public String getDisadvantage() {
- return ConfigData.disableDisadvantages ? "None"
- : currentDisadvantage;
+ return ConfigData.disableDisadvantages ? "None" : currentDisadvantage;
}
}
diff --git a/YWD/src/main/java/fyresmodjam/worldgen/PillarGen.java b/YWD/src/main/java/fyresmodjam/worldgen/PillarGen.java index d76af7c..8b08825 100755 --- a/YWD/src/main/java/fyresmodjam/worldgen/PillarGen.java +++ b/YWD/src/main/java/fyresmodjam/worldgen/PillarGen.java @@ -12,79 +12,32 @@ import net.minecraft.world.chunk.IChunkProvider; public class PillarGen implements IWorldGenerator {
@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) {
- if (ConfigData.spawnRandomPillars
- && world.provider.dimensionId == 0
- && random.nextInt(
- ConfigData.pillarGenChance) == 0) {
+ if (ConfigData.spawnRandomPillars && world.provider.dimensionId == 0
+ && random.nextInt(ConfigData.pillarGenChance) == 0) {
boolean placed = false;
- int max = random.nextInt(
- ConfigData.maxPillarsPerChunk) + 1;
+ int max = random.nextInt(ConfigData.maxPillarsPerChunk) + 1;
- for (int y = 127, added = 0; y > 30 && !placed
- && added < max; y--) {
- for (int x = chunkX * 16; x < chunkX * 16
- + 16 && !placed
- && added < max; x++) {
- for (int z = chunkZ
- * 16; z < chunkZ * 16
- + 16
- && !placed
- && added < max; z++) {
- if (random.nextInt(15) != 0
- || world.isAirBlock(
- x,
- y,
- z)
- || world.getBlock(
- x,
- y,
- z)
- .isReplaceable(world,
- x,
- y,
- z)
- || world.getBlock(
- x,
- y,
- z) == ModjamMod.blockTrap
- || world.getBlock(
- x,
- y,
- z) == Blocks.leaves) {
+ for (int y = 127, added = 0; y > 30 && !placed && added < max; y--) {
+ for (int x = chunkX * 16; x < chunkX * 16 + 16 && !placed && added < max; x++) {
+ for (int z = chunkZ * 16; z < chunkZ * 16 + 16 && !placed && added < max; z++) {
+ if (random.nextInt(15) != 0 || world.isAirBlock(x, y, z)
+ || world.getBlock(x, y, z).isReplaceable(world, x, y, z)
+ || world.getBlock(x, y, z) == ModjamMod.blockTrap
+ || world.getBlock(x, y, z) == Blocks.leaves) {
continue;
}
Block block = ModjamMod.blockPillar;
- if (block.canPlaceBlockAt(
- world, x,
- y + 1,
- z)) {
- world.setBlock(x, y
- + 1,
- z,
- block);
- world.setBlockMetadataWithNotify(
- x,
- y + 1,
- z,
- 0,
- 0);
+ if (block.canPlaceBlockAt(world, x, y + 1, z)) {
+ world.setBlock(x, y + 1, z, block);
+ world.setBlockMetadataWithNotify(x, y + 1, z, 0, 0);
- world.setBlock(x, y
- + 2,
- z,
- block);
- world.setBlockMetadataWithNotify(
- x,
- y + 2,
- z,
- 1,
- 0);
+ world.setBlock(x, y + 2, z, block);
+ world.setBlockMetadataWithNotify(x, y + 2, z, 1, 0);
placed = random.nextBoolean();
diff --git a/YWD/src/main/java/fyresmodjam/worldgen/WorldGenMoreDungeons.java b/YWD/src/main/java/fyresmodjam/worldgen/WorldGenMoreDungeons.java index 79a4378..ebd6838 100755 --- a/YWD/src/main/java/fyresmodjam/worldgen/WorldGenMoreDungeons.java +++ b/YWD/src/main/java/fyresmodjam/worldgen/WorldGenMoreDungeons.java @@ -7,12 +7,10 @@ import net.minecraft.world.World; import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.feature.WorldGenDungeons;
-public class WorldGenMoreDungeons extends WorldGenDungeons
- implements IWorldGenerator {
+public class WorldGenMoreDungeons extends WorldGenDungeons implements IWorldGenerator {
@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) {
for (int k1 = 0; k1 < 24; ++k1) {
int l1 = chunkX * 16 + random.nextInt(16) + 8;
diff --git a/YWD/src/main/java/fyresmodjam/worldgen/WorldGenTrapsTowersAndMore.java b/YWD/src/main/java/fyresmodjam/worldgen/WorldGenTrapsTowersAndMore.java index d2a5a54..acff5bd 100755 --- a/YWD/src/main/java/fyresmodjam/worldgen/WorldGenTrapsTowersAndMore.java +++ b/YWD/src/main/java/fyresmodjam/worldgen/WorldGenTrapsTowersAndMore.java @@ -19,417 +19,151 @@ import net.minecraftforge.common.DungeonHooks; public class WorldGenTrapsTowersAndMore implements IWorldGenerator {
public static final WeightedRandomChestContent[] field_111189_a = new WeightedRandomChestContent[] {
- new WeightedRandomChestContent(Items.iron_ingot, 0,
- 1, 4, 10),
- new WeightedRandomChestContent(Items.bread, 0, 1,
- 1, 10),
- new WeightedRandomChestContent(Items.wheat, 0, 1,
- 4, 10),
- new WeightedRandomChestContent(Items.gunpowder, 0,
- 1, 4, 10),
- new WeightedRandomChestContent(Items.string, 0, 1,
- 4, 10),
- new WeightedRandomChestContent(Items.bucket, 0, 1,
- 1, 10),
- new WeightedRandomChestContent(Items.redstone, 0,
- 1, 4, 10),
- new WeightedRandomChestContent(Items.name_tag, 0,
- 1, 1, 10),
- };
+ new WeightedRandomChestContent(Items.iron_ingot, 0, 1, 4, 10),
+ new WeightedRandomChestContent(Items.bread, 0, 1, 1, 10),
+ new WeightedRandomChestContent(Items.wheat, 0, 1, 4, 10),
+ new WeightedRandomChestContent(Items.gunpowder, 0, 1, 4, 10),
+ new WeightedRandomChestContent(Items.string, 0, 1, 4, 10),
+ new WeightedRandomChestContent(Items.bucket, 0, 1, 1, 10),
+ new WeightedRandomChestContent(Items.redstone, 0, 1, 4, 10),
+ new WeightedRandomChestContent(Items.name_tag, 0, 1, 1, 10), };
public static boolean genning = false;
public static final String TOWER_CHESTS = "towerChests";
- public static ChestGenHooks chestGenInfo = new ChestGenHooks(
- TOWER_CHESTS, field_111189_a, 8, 8);
+ public static ChestGenHooks chestGenInfo = new ChestGenHooks(TOWER_CHESTS, field_111189_a, 8, 8);
@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) {
genning = true;
- boolean addedDungeon = !ConfigData.spawnTowers || random
- .nextInt(ConfigData.towerGenChance) != 0;
+ boolean addedDungeon = !ConfigData.spawnTowers || random.nextInt(ConfigData.towerGenChance) != 0;
for (int y = 1; y < 127; y++) {
- for (int x = chunkX * 16; x < chunkX * 16
- + 16; x++) {
- for (int z = chunkZ * 16; z < chunkZ * 16
- + 16; z++) {
- if ((world.isAirBlock(x, y, z)
- || (world.getBlock(
- x,
- y,
- z)
- .isReplaceable(world,
- x,
- y,
- z)
- && world.getBlock(
- x,
- y,
- z) != Blocks.water
- && world.getBlock(
- x,
- y,
- z) != Blocks.flowing_water
- && world.getBlock(
- x,
- y,
- z) != Blocks.lava
- && world.getBlock(
- x,
- y,
- z) != Blocks.flowing_lava))
- && (!world.isAirBlock(
- x,
- y - 1,
- z)
- && world.getBlock(
- x,
- y - 1,
- z) != ModjamMod.blockTrap
- && !world.getBlock(
- x,
- y - 1,
- z)
- .isReplaceable(world,
- x,
- y - 1,
- z))
- && random.nextInt(
- ConfigData.trapGenChance) == 0) {
- boolean skip = ConfigData.trapsBelowGroundOnly
- && (world.getBlock(
- x,
- y - 1,
- z) == Blocks.grass
- || world.getBlock(
- x,
- y - 1,
- z) == Blocks.sand
- || world.getBlock(
- x,
- y - 1,
- z) == Blocks.log
- || world.getBlock(
- x,
- y - 1,
- z) == Blocks.log2
- || world.canBlockSeeTheSky(
- x,
- y,
- z));
- if (!skip && ModjamMod.blockTrap
- .canPlaceBlockAt(
- world,
- x,
- y,
- z)) {
- world.setBlock(x,
- y,
- z,
- ModjamMod.blockTrap,
- random.nextInt(BlockTrap.trapTypes),
- 0);
+ for (int x = chunkX * 16; x < chunkX * 16 + 16; x++) {
+ for (int z = chunkZ * 16; z < chunkZ * 16 + 16; z++) {
+ if ((world.isAirBlock(x, y, z) || (world.getBlock(x, y, z).isReplaceable(world, x, y, z)
+ && world.getBlock(x, y, z) != Blocks.water
+ && world.getBlock(x, y, z) != Blocks.flowing_water && world.getBlock(x, y, z) != Blocks.lava
+ && world.getBlock(x, y, z) != Blocks.flowing_lava))
+ && (!world.isAirBlock(x, y - 1, z) && world.getBlock(x, y - 1, z) != ModjamMod.blockTrap
+ && !world.getBlock(x, y - 1, z).isReplaceable(world, x, y - 1, z))
+ && random.nextInt(ConfigData.trapGenChance) == 0) {
+ boolean skip = ConfigData.trapsBelowGroundOnly && (world.getBlock(x, y - 1, z) == Blocks.grass
+ || world.getBlock(x, y - 1, z) == Blocks.sand
+ || world.getBlock(x, y - 1, z) == Blocks.log
+ || world.getBlock(x, y - 1, z) == Blocks.log2 || world.canBlockSeeTheSky(x, y, z));
+ if (!skip && ModjamMod.blockTrap.canPlaceBlockAt(world, x, y, z)) {
+ world.setBlock(x, y, z, ModjamMod.blockTrap, random.nextInt(BlockTrap.trapTypes), 0);
}
}
- if ((world.getBlock(x, y,
- z) == Blocks.brown_mushroom
- || world.getBlock(
- x,
- y,
- z) == Blocks.red_mushroom)
- && random.nextInt(
- ConfigData.mushroomReplaceChance) == 0) {
- world.setBlock(x, y, z,
- ModjamMod.mysteryMushroomBlock,
- random.nextInt(13),
- 0);
+ if ((world.getBlock(x, y, z) == Blocks.brown_mushroom
+ || world.getBlock(x, y, z) == Blocks.red_mushroom)
+ && random.nextInt(ConfigData.mushroomReplaceChance) == 0) {
+ world.setBlock(x, y, z, ModjamMod.mysteryMushroomBlock, random.nextInt(13), 0);
}
- if (!addedDungeon && ((world
- .getBlock(x, y, z) == Blocks.grass
- || ((world.getBlock(
- x,
- y,
- z) == Blocks.sand
- || world.getBlock(
- x,
- y,
- z) == Blocks.netherrack
- || world.getBlock(
- x,
- y,
- z) == Blocks.soul_sand
- || world.getBlock(
- x,
- y,
- z) == Blocks.gravel)
- && world.isAirBlock(
- x,
- y + 1,
- z))))
- && world.getBlock(
- x,
- y + 1,
- z) != Blocks.water
- && world.getBlock(
- x,
- y + 1,
- z) != Blocks.flowing_water
- && world.getBlock(
- x,
- y + 1,
- z) != Blocks.lava
- && world.getBlock(
- x,
- y + 1,
- z) != Blocks.flowing_lava
- && ModjamMod.r.nextInt(
- 100) == 0) {
-
- boolean obsidian = !world.provider.isHellWorld
- && ModjamMod.r.nextInt(
- 100) == 0;
+ if (!addedDungeon
+ && ((world.getBlock(x, y, z) == Blocks.grass || ((world.getBlock(x, y, z) == Blocks.sand
+ || world.getBlock(x, y, z) == Blocks.netherrack
+ || world.getBlock(x, y, z) == Blocks.soul_sand
+ || world.getBlock(x, y, z) == Blocks.gravel) && world.isAirBlock(x, y + 1, z))))
+ && world.getBlock(x, y + 1, z) != Blocks.water
+ && world.getBlock(x, y + 1, z) != Blocks.flowing_water
+ && world.getBlock(x, y + 1, z) != Blocks.lava
+ && world.getBlock(x, y + 1, z) != Blocks.flowing_lava && ModjamMod.r.nextInt(100) == 0) {
+
+ boolean obsidian = !world.provider.isHellWorld && ModjamMod.r.nextInt(100) == 0;
y--;
- int floors = 3 + random
- .nextInt(6);
+ int floors = 3 + random.nextInt(6);
- for (int y2 = 0; y2 <= floors
- * 6; y2++) {
+ for (int y2 = 0; y2 <= floors * 6; y2++) {
for (int x2 = -5; x2 <= 5; x2++) {
for (int z2 = -5; z2 <= 5; z2++) {
- if (((y2 / 6) % 2 == 0
- ^ y2 % 6 < 2)
- && x2 == -2
- && z2 == -5
- && y2 > 1
- && y2 <= floors * 6
- - 5) {
- world.setBlock(x + x2,
- y + y2,
- z + z2 + 2,
- Blocks.ladder,
- 3,
- 0);
+ if (((y2 / 6) % 2 == 0 ^ y2 % 6 < 2) && x2 == -2 && z2 == -5 && y2 > 1
+ && y2 <= floors * 6 - 5) {
+ world.setBlock(x + x2, y + y2, z + z2 + 2, Blocks.ladder, 3, 0);
}
- if (((y2 / 6) % 2 == 1
- ^ y2 % 6 < 2)
- && x2 == 2
- && z2 == 5
- && y2 > 1
- && y2 <= floors * 6
- - 5) {
- world.setBlock(x + x2,
- y + y2,
- z + z2 - 2,
- Blocks.ladder,
- 2,
- 0);
+ if (((y2 / 6) % 2 == 1 ^ y2 % 6 < 2) && x2 == 2 && z2 == 5 && y2 > 1
+ && y2 <= floors * 6 - 5) {
+ world.setBlock(x + x2, y + y2, z + z2 - 2, Blocks.ladder, 2, 0);
}
- if ((x2 * x2 + z2
- * z2 <= 25)
- && ((y2 % 6 == 0 || y2
- % 6 == 1)
- || z2 > 3 + (y2 < 6
- ? 1
- : 0)
- || z2 < -3
- || Math.abs(x2) > 3
- + (y2 < 5 ? 1
- : 0))) {
- if (world.getBlock(
- x + x2,
- y + y2,
- z + z2) != Blocks.ladder
- && world.getBlock(
- x + x2,
- y + y2,
- z + z2) != Blocks.obsidian) {
- if (!obsidian && Math
- .abs(x2) <= 1
- && Math.abs(z2) <= 1
- && y2 != floors * 6
- && y2 != 1
- && y2 % 6 == 1) {
- world.setBlock(x + x2,
- y + y2,
- z + z2,
- Blocks.obsidian);
+ if ((x2 * x2 + z2 * z2 <= 25)
+ && ((y2 % 6 == 0 || y2 % 6 == 1) || z2 > 3 + (y2 < 6 ? 1 : 0) || z2 < -3
+ || Math.abs(x2) > 3 + (y2 < 5 ? 1 : 0))) {
+ if (world.getBlock(x + x2, y + y2, z + z2) != Blocks.ladder
+ && world.getBlock(x + x2, y + y2, z + z2) != Blocks.obsidian) {
+ if (!obsidian && Math.abs(x2) <= 1 && Math.abs(z2) <= 1 && y2 != floors * 6
+ && y2 != 1 && y2 % 6 == 1) {
+ world.setBlock(x + x2, y + y2, z + z2, Blocks.obsidian);
} else {
- world.setBlock(x + x2,
- y + y2,
- z + z2,
- !world.provider.isHellWorld
- ? (!obsidian ? (random
- .nextBoolean() ? Blocks.mossy_cobblestone
- : Blocks.cobblestone)
- : Blocks.obsidian)
- : Blocks.nether_brick);
+ world.setBlock(x + x2, y + y2, z + z2, !world.provider.isHellWorld
+ ? (!obsidian ? (random.nextBoolean() ? Blocks.mossy_cobblestone
+ : Blocks.cobblestone) : Blocks.obsidian)
+ : Blocks.nether_brick);
}
}
- } else if (y2 % 6 == 2
- && x2 == 0
- && z2 == ((y2 / 6)
- % 2 == 1 ? 3
- : -3)
- && (y2 / 6 >= floors
- - 1
- || random.nextInt(
- 3) == 0)
- && y2 >= 5) {
- world.setBlock(x + x2,
- y + y2,
- z + z2,
- Blocks.chest,
- 0,
- 2);
-
- boolean b = (y2 / 6)
- % 2 == 1;
-
- TileEntityChest tileentitychest = (TileEntityChest) world
- .getTileEntity(x + x2,
- y + y2,
- z + z2);
+ } else if (y2 % 6 == 2 && x2 == 0 && z2 == ((y2 / 6) % 2 == 1 ? 3 : -3)
+ && (y2 / 6 >= floors - 1 || random.nextInt(3) == 0) && y2 >= 5) {
+ world.setBlock(x + x2, y + y2, z + z2, Blocks.chest, 0, 2);
+
+ boolean b = (y2 / 6) % 2 == 1;
+
+ TileEntityChest tileentitychest = (TileEntityChest) world.getTileEntity(x + x2,
+ y + y2, z + z2);
if (tileentitychest != null) {
- WeightedRandomChestContent
- .generateChestContents(
- random,
- ((y2 / 6 >= floors
- - 1
- || obsidian) ? ChestGenHooks
- .getInfo(ChestGenHooks.DUNGEON_CHEST)
- : chestGenInfo).getItems(
- random),
- tileentitychest,
- chestGenInfo.getCount(
- random));
+ WeightedRandomChestContent.generateChestContents(random,
+ ((y2 / 6 >= floors - 1 || obsidian)
+ ? ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST)
+ : chestGenInfo).getItems(random),
+ tileentitychest, chestGenInfo.getCount(random));
}
if (!obsidian) {
- world.setBlock(x + x2,
- y + y2 - 1,
- z + z2,
- Blocks.obsidian);
- world.setBlock(x + x2,
- y + y2 + 2,
- z + z2,
- Blocks.obsidian);
- world.setBlock(x + x2,
- y + y2,
- z + z2 + (b ? 1
- : -1),
- Blocks.obsidian);
- world.setBlock(x + x2,
- y + y2 + 1,
- z + z2 + (b ? 1
- : -1),
- Blocks.obsidian);
- world.setBlock(x + x2
- + 1,
- y + y2,
- z + z2,
- Blocks.obsidian);
- world.setBlock(x + x2
- - 1,
- y + y2,
- z + z2,
- Blocks.obsidian);
- world.setBlock(x + x2
- + 1,
- y + y2 + 1,
- z + z2,
- Blocks.obsidian);
- world.setBlock(x + x2
- - 1,
- y + y2 + 1,
- z + z2,
- Blocks.obsidian);
+ world.setBlock(x + x2, y + y2 - 1, z + z2, Blocks.obsidian);
+ world.setBlock(x + x2, y + y2 + 2, z + z2, Blocks.obsidian);
+ world.setBlock(x + x2, y + y2, z + z2 + (b ? 1 : -1), Blocks.obsidian);
+ world.setBlock(x + x2, y + y2 + 1, z + z2 + (b ? 1 : -1), Blocks.obsidian);
+ world.setBlock(x + x2 + 1, y + y2, z + z2, Blocks.obsidian);
+ world.setBlock(x + x2 - 1, y + y2, z + z2, Blocks.obsidian);
+ world.setBlock(x + x2 + 1, y + y2 + 1, z + z2, Blocks.obsidian);
+ world.setBlock(x + x2 - 1, y + y2 + 1, z + z2, Blocks.obsidian);
}
- } else if (y2 % 6 == 2
- && x2 == 0
- && z2 == 0) {
+ } else if (y2 % 6 == 2 && x2 == 0 && z2 == 0) {
if (y2 != 2) {
- world.setBlock(x + x2,
- y + y2,
- z + z2,
- Blocks.mob_spawner,
- 0,
- 2);
+ world.setBlock(x + x2, y + y2, z + z2, Blocks.mob_spawner, 0, 2);
TileEntityMobSpawner tileentitymobspawner = (TileEntityMobSpawner) world
- .getTileEntity(x + x2,
- y + y2,
- z + z2);
+ .getTileEntity(x + x2, y + y2, z + z2);
if (tileentitymobspawner != null) {
- tileentitymobspawner
- .func_145881_a()
- .setEntityName(DungeonHooks
- .getRandomDungeonMob(
- ModjamMod.r));
+ tileentitymobspawner.func_145881_a()
+ .setEntityName(DungeonHooks.getRandomDungeonMob(ModjamMod.r));
;
}
} else {
- world.setBlock(x + x2,
- y + y2,
- z + z2,
- ModjamMod.blockPillar);
- world.setBlockMetadataWithNotify(
- x + x2,
- y + y2,
- z + z2,
- 0,
- 0);
-
- world.setBlock(x + x2,
- y + y2 + 1,
- z + z2,
- ModjamMod.blockPillar);
- world.setBlockMetadataWithNotify(
- x + x2,
- y + y2 + 1,
- z + z2,
- 1,
- 0);
+ world.setBlock(x + x2, y + y2, z + z2, ModjamMod.blockPillar);
+ world.setBlockMetadataWithNotify(x + x2, y + y2, z + z2, 0, 0);
+
+ world.setBlock(x + x2, y + y2 + 1, z + z2, ModjamMod.blockPillar);
+ world.setBlockMetadataWithNotify(x + x2, y + y2 + 1, z + z2, 1, 0);
}
- } else if ((x2 * x2
- + z2 * z2 <= 25)
- && world.getBlock(
- x + x2,
- y + y2,
- z + z2) != ModjamMod.blockPillar
- && world.getBlock(
- x + x2,
- y + y2,
- z + z2) != Blocks.mob_spawner
- && world.getBlock(
- x + x2,
- y + y2,
- z + z2) != Blocks.ladder
- && world.getBlock(
- x + x2,
- y + y2,
- z + z2) != Blocks.chest
- && world.getBlock(
- x + x2,
- y + y2,
- z + z2) != Blocks.obsidian) {
- world.setBlockToAir(
- x + x2,
- y + y2,
- z + z2);
+ } else if ((x2 * x2 + z2 * z2 <= 25)
+ && world.getBlock(x + x2, y + y2, z + z2) != ModjamMod.blockPillar
+ && world.getBlock(x + x2, y + y2, z + z2) != Blocks.mob_spawner
+ && world.getBlock(x + x2, y + y2, z + z2) != Blocks.ladder
+ && world.getBlock(x + x2, y + y2, z + z2) != Blocks.chest
+ && world.getBlock(x + x2, y + y2, z + z2) != Blocks.obsidian) {
+ world.setBlockToAir(x + x2, y + y2, z + z2);
}
}
@@ -443,26 +177,17 @@ public class WorldGenTrapsTowersAndMore implements IWorldGenerator { for (int x2 = -5; x2 <= 5; x2++) {
for (int z2 = -5; z2 <= 5; z2++) {
- if (x2 * x2 + z2 * z2 <= 25
- && world.isAirBlock(
- x + x2,
- y + y2,
- z + z2)) {
- world.setBlock(x + x2,
- y + y2,
- z + z2,
- !obsidian ? (random
- .nextBoolean() ? Blocks.mossy_cobblestone
- : Blocks.cobblestone)
- : Blocks.obsidian);
+ if (x2 * x2 + z2 * z2 <= 25 && world.isAirBlock(x + x2, y + y2, z + z2)) {
+ world.setBlock(x + x2, y + y2, z + z2, !obsidian
+ ? (random.nextBoolean() ? Blocks.mossy_cobblestone : Blocks.cobblestone)
+ : Blocks.obsidian);
changes++;
}
}
}
y2--;
- } while (changes != 0 && y
- + y2 >= 0);
+ } while (changes != 0 && y + y2 >= 0);
addedDungeon = true;
diff --git a/YWD/src/main/resources/assets/fyresmodjam/lang/en_US.lang b/YWD/src/main/resources/assets/fyresmodjam/lang/en_US.lang index a8631dc..50f8423 100755 --- a/YWD/src/main/resources/assets/fyresmodjam/lang/en_US.lang +++ b/YWD/src/main/resources/assets/fyresmodjam/lang/en_US.lang @@ -16,4 +16,5 @@ commands.craftingKnowledge.usage=/craftingKnowledge [page] - used to check your fyresmodjam.newVersion=\u00A7bA newer version of the "You Will Die" Mod has been found death.attack.inferno=%s had their fire doused -death.attack.retaliation=%s was killed for their crimes
\ No newline at end of file +death.attack.retaliation=%s was killed for their crimes +death.attack.ywdtrap=%s fell afoul of a trap
\ No newline at end of file |
