Merge branch 'bloodmagic1.8' of https://github.com/WayofTime/BloodMagic
This commit is contained in:
commit
e812118b2e
712 changed files with 6501 additions and 27332 deletions
|
@ -11,7 +11,6 @@ import java.util.List;
|
|||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipInputStream;
|
||||
|
||||
import WayofTime.alchemicalWizardry.common.thread.CommandDownloadGAPI;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
|
@ -28,6 +27,21 @@ import net.minecraftforge.common.util.EnumHelper;
|
|||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
import net.minecraftforge.fml.common.Loader;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.Mod.EventHandler;
|
||||
import net.minecraftforge.fml.common.Mod.Instance;
|
||||
import net.minecraftforge.fml.common.ModContainer;
|
||||
import net.minecraftforge.fml.common.Optional;
|
||||
import net.minecraftforge.fml.common.SidedProxy;
|
||||
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLInterModComms;
|
||||
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||
import net.minecraftforge.fml.common.network.NetworkRegistry;
|
||||
import net.minecraftforge.fml.common.registry.EntityRegistry;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import net.minecraftforge.oredict.RecipeSorter;
|
||||
import net.minecraftforge.oredict.RecipeSorter.Category;
|
||||
|
@ -52,7 +66,6 @@ import WayofTime.alchemicalWizardry.api.harvest.HarvestRegistry;
|
|||
import WayofTime.alchemicalWizardry.api.items.ShapedBloodOrbRecipe;
|
||||
import WayofTime.alchemicalWizardry.api.items.ShapelessBloodOrbRecipe;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.Rituals;
|
||||
import WayofTime.alchemicalWizardry.api.sacrifice.PlayerSacrificeHandler;
|
||||
import WayofTime.alchemicalWizardry.api.soulNetwork.ComplexNetworkHandler;
|
||||
import WayofTime.alchemicalWizardry.api.spell.SpellEffectRegistry;
|
||||
import WayofTime.alchemicalWizardry.api.spell.SpellParadigmMelee;
|
||||
|
@ -72,10 +85,6 @@ import WayofTime.alchemicalWizardry.common.achievements.ModAchievements;
|
|||
import WayofTime.alchemicalWizardry.common.alchemy.CombinedPotionRegistry;
|
||||
import WayofTime.alchemicalWizardry.common.block.ArmourForge;
|
||||
import WayofTime.alchemicalWizardry.common.bloodAltarUpgrade.UpgradedAltars;
|
||||
import WayofTime.alchemicalWizardry.common.book.BloodMagicGuide;
|
||||
import WayofTime.alchemicalWizardry.common.commands.CommandBind;
|
||||
import WayofTime.alchemicalWizardry.common.commands.CommandSN;
|
||||
import WayofTime.alchemicalWizardry.common.commands.CommandUnbind;
|
||||
import WayofTime.alchemicalWizardry.common.compress.AdvancedCompressionHandler;
|
||||
import WayofTime.alchemicalWizardry.common.compress.BaseCompressionHandler;
|
||||
import WayofTime.alchemicalWizardry.common.compress.StorageBlockCraftingManager;
|
||||
|
@ -109,7 +118,6 @@ import WayofTime.alchemicalWizardry.common.entity.mob.EntitySmallEarthGolem;
|
|||
import WayofTime.alchemicalWizardry.common.entity.mob.EntityWaterElemental;
|
||||
import WayofTime.alchemicalWizardry.common.entity.mob.EntityWingedFireDemon;
|
||||
import WayofTime.alchemicalWizardry.common.guide.RecipeHolder;
|
||||
import WayofTime.alchemicalWizardry.common.harvest.AgriCraftCropHarvestHandler;
|
||||
import WayofTime.alchemicalWizardry.common.harvest.BloodMagicHarvestHandler;
|
||||
import WayofTime.alchemicalWizardry.common.harvest.CactusReedHarvestHandler;
|
||||
import WayofTime.alchemicalWizardry.common.harvest.GourdHarvestHandler;
|
||||
|
@ -280,22 +288,7 @@ import WayofTime.alchemicalWizardry.common.tileEntity.TETeleposer;
|
|||
import WayofTime.alchemicalWizardry.common.tileEntity.TEWritingTable;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.gui.GuiHandler;
|
||||
import WayofTime.alchemicalWizardry.common.tweaker.MineTweakerIntegration;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.Mod.EventHandler;
|
||||
import cpw.mods.fml.common.Mod.Instance;
|
||||
import cpw.mods.fml.common.ModContainer;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.common.SidedProxy;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLInterModComms;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLServerStartingEvent;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import cpw.mods.fml.common.registry.EntityRegistry;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
|
||||
@Mod(modid = "AWWayofTime", name = "AlchemicalWizardry", version = "v1.3.3", guiFactory = "WayofTime.alchemicalWizardry.client.gui.ConfigGuiFactory")
|
||||
public class AlchemicalWizardry
|
||||
|
@ -387,8 +380,6 @@ public class AlchemicalWizardry
|
|||
public static boolean ritualDisabledPhantomHands;
|
||||
public static boolean ritualDisabledSphereIsland;
|
||||
|
||||
public static boolean displayRitualAnimation;
|
||||
|
||||
public static boolean potionDisableRegen;
|
||||
public static boolean potionDisableNightVision;
|
||||
public static boolean potionDisableFireResistance;
|
||||
|
@ -427,7 +418,6 @@ public class AlchemicalWizardry
|
|||
public static boolean lockdownAltar;
|
||||
public static boolean causeHungerWithRegen;
|
||||
public static boolean causeHungerChatMessage = true;
|
||||
public static boolean disableBoundToolsRightClick;
|
||||
|
||||
public static List<Class> wellBlacklist;
|
||||
|
||||
|
@ -448,7 +438,7 @@ public class AlchemicalWizardry
|
|||
};
|
||||
|
||||
public static ToolMaterial bloodBoundToolMaterial = EnumHelper.addToolMaterial("BoundBlood", 4, 1000, 12.0f, 8.0f, 50);
|
||||
public static ArmorMaterial sanguineArmourArmourMaterial = EnumHelper.addArmorMaterial("SanguineArmour", 33, new int[]{3, 8, 6, 3}, 30);
|
||||
public static ArmorMaterial sanguineArmourArmourMaterial = EnumHelper.addArmorMaterial("SanguineArmour", "test", 33, new int[]{3, 8, 6, 3}, 30);
|
||||
|
||||
//Dungeon loot chances
|
||||
public static int standardBindingAgentDungeonChance;
|
||||
|
@ -758,7 +748,6 @@ public class AlchemicalWizardry
|
|||
customPotionFireFuse = (new PotionFireFuse(customPotionFireFuseID, true, 0).setIconIndex(0, 0).setPotionName("Fire Fuse"));
|
||||
customPotionPlanarBinding = (new PotionPlanarBinding(customPotionPlanarBindingID, true, 0).setIconIndex(0, 0).setPotionName("Planar Binding"));
|
||||
customPotionSoulFray = (new PotionSoulFray(customPotionSoulFrayID, true, 0).setIconIndex(0, 0).setPotionName("Soul Fray"));
|
||||
PlayerSacrificeHandler.soulFrayId = customPotionSoulFray;
|
||||
customPotionSoulHarden = (new PotionSoulHarden(customPotionSoulHardenID, false, 0).setIconIndex(0, 0).setPotionName("Soul Harden"));
|
||||
customPotionDeaf = (new PotionDeaf(customPotionDeafID, true, 0).setIconIndex(0, 0).setPotionName("Deafness"));
|
||||
customPotionFeatherFall = (new PotionFeatherFall(customPotionFeatherFallID, false, 0).setIconIndex(0, 0).setPotionName("Feather Fall"));
|
||||
|
@ -1225,11 +1214,11 @@ public class AlchemicalWizardry
|
|||
|
||||
ModItems.itemBloodFrame = new ItemBloodFrame().setUnlocalizedName("bloodFrame");
|
||||
|
||||
ItemStack provenFrame = GameRegistry.findItemStack("Forestry", "frameImpregnated", 1);
|
||||
Item provenFrame = GameRegistry.findItem("Forestry", "frameImpregnated");
|
||||
|
||||
if(provenFrame !=null)
|
||||
{
|
||||
AltarRecipeRegistry.registerAltarRecipe(new ItemStack(ModItems.itemBloodFrame), provenFrame, 3, 30000, 20, 20, false);
|
||||
AltarRecipeRegistry.registerAltarRecipe(new ItemStack(ModItems.itemBloodFrame), new ItemStack(provenFrame, 1), 3, 30000, 20, 20, false);
|
||||
}
|
||||
} else
|
||||
{
|
||||
|
@ -1248,11 +1237,11 @@ public class AlchemicalWizardry
|
|||
AlchemicalWizardry.logger.info("Loaded MineTweaker 3 Integration");
|
||||
}
|
||||
|
||||
if(Loader.isModLoaded("AgriCraft"))
|
||||
{
|
||||
HarvestRegistry.registerHarvestHandler(new AgriCraftCropHarvestHandler());
|
||||
AlchemicalWizardry.logger.info("Loaded AgriCraft Handlers!");
|
||||
}
|
||||
// if(Loader.isModLoaded("AgriCraft"))
|
||||
// {
|
||||
// HarvestRegistry.registerHarvestHandler(new AgriCraftCropHarvestHandler());
|
||||
// AlchemicalWizardry.logger.info("Loaded AgriCraft Handlers!");
|
||||
// }
|
||||
|
||||
isBotaniaLoaded = Loader.isModLoaded("Botania");
|
||||
isPneumaticCraftLoaded = Loader.isModLoaded("PneumaticCraft");
|
||||
|
@ -1401,13 +1390,13 @@ public class AlchemicalWizardry
|
|||
AlchemicalPotionCreationHandler.addPotion(new ItemStack(Items.diamond), Potion.resistance.id, 2 * 60 * 20);
|
||||
|
||||
if(!AlchemicalWizardry.potionDisableSaturation)
|
||||
AlchemicalPotionCreationHandler.addPotion(new ItemStack(Items.poisonous_potato), Potion.field_76443_y.id, 2); //saturation
|
||||
AlchemicalPotionCreationHandler.addPotion(new ItemStack(Items.poisonous_potato), Potion.saturation.id, 2); //saturation
|
||||
|
||||
if(!AlchemicalWizardry.potionDisableHealthBoost)
|
||||
AlchemicalPotionCreationHandler.addPotion(new ItemStack(ModItems.demonBloodShard), Potion.field_76434_w.id, 4 * 60 * 20); //health boost
|
||||
AlchemicalPotionCreationHandler.addPotion(new ItemStack(ModItems.demonBloodShard), Potion.field_180152_w.id, 4 * 60 * 20); //health boost
|
||||
|
||||
if(!AlchemicalWizardry.potionDisableAbsorption)
|
||||
AlchemicalPotionCreationHandler.addPotion(new ItemStack(ModItems.weakBloodShard), Potion.field_76444_x.id, 4 * 60 * 20); //Absorption
|
||||
AlchemicalPotionCreationHandler.addPotion(new ItemStack(ModItems.weakBloodShard), Potion.absorption.id, 4 * 60 * 20); //Absorption
|
||||
|
||||
if(!AlchemicalWizardry.potionDisableBoost)
|
||||
AlchemicalPotionCreationHandler.addPotion(new ItemStack(ModItems.terrae), AlchemicalWizardry.customPotionBoost.id, 60 * 20);
|
||||
|
@ -1730,7 +1719,7 @@ public class AlchemicalWizardry
|
|||
//
|
||||
// InputStream input = AlchemicalWizardry.class.getResourceAsStream("/assets/alchemicalwizardryBooks/books/book.txt");
|
||||
//
|
||||
// Minecraft.getMinecraft().fontRenderer.setUnicodeFlag(true);
|
||||
// Minecraft.getMinecraft().fontRendererObj.setUnicodeFlag(true);
|
||||
//
|
||||
// if(input != null)
|
||||
// {
|
||||
|
@ -1806,9 +1795,9 @@ public class AlchemicalWizardry
|
|||
//
|
||||
// strLine = strLine.replace('', '"').replace('','"').replace("
", "...").replace('', '\'').replace('', '-');
|
||||
//
|
||||
// if(Minecraft.getMinecraft() != null && Minecraft.getMinecraft().fontRenderer != null)
|
||||
// if(Minecraft.getMinecraft() != null && Minecraft.getMinecraft().fontRendererObj != null)
|
||||
// {
|
||||
// List list = Minecraft.getMinecraft().fontRenderer.listFormattedStringToWidth(strLine, 110);
|
||||
// List list = Minecraft.getMinecraft().fontRendererObj.listFormattedStringToWidth(strLine, 110);
|
||||
// if(list != null)
|
||||
// {
|
||||
// System.out.println("Number of lines: " + list.size());
|
||||
|
@ -1822,7 +1811,7 @@ public class AlchemicalWizardry
|
|||
// boolean changePage = false;
|
||||
// int length = word.length();
|
||||
// word = word.replace('\t', ' ');
|
||||
// List list = Minecraft.getMinecraft().fontRenderer.listFormattedStringToWidth(strings[currentPage] + " " + word, 110);
|
||||
// List list = Minecraft.getMinecraft().fontRendererObj.listFormattedStringToWidth(strings[currentPage] + " " + word, 110);
|
||||
//
|
||||
// if(list.size() > maxLines)
|
||||
// {
|
||||
|
@ -1853,8 +1842,8 @@ public class AlchemicalWizardry
|
|||
// }
|
||||
// }
|
||||
//
|
||||
// int currentLines = Minecraft.getMinecraft().fontRenderer.listFormattedStringToWidth(strings[currentPage], 110).size();
|
||||
// while(Minecraft.getMinecraft().fontRenderer.listFormattedStringToWidth(strings[currentPage] + " ", 110).size() <= currentLines)
|
||||
// int currentLines = Minecraft.getMinecraft().fontRendererObj.listFormattedStringToWidth(strings[currentPage], 110).size();
|
||||
// while(Minecraft.getMinecraft().fontRendererObj.listFormattedStringToWidth(strings[currentPage] + " ", 110).size() <= currentLines)
|
||||
// {
|
||||
// {
|
||||
// strings[currentPage] = strings[currentPage] + " ";
|
||||
|
@ -1889,7 +1878,7 @@ public class AlchemicalWizardry
|
|||
////
|
||||
// }
|
||||
//
|
||||
// Minecraft.getMinecraft().fontRenderer.setUnicodeFlag(false);
|
||||
// Minecraft.getMinecraft().fontRendererObj.setUnicodeFlag(false);
|
||||
//
|
||||
// } catch (FileNotFoundException e) {
|
||||
// // TODO Auto-generated catch block
|
||||
|
@ -1901,12 +1890,12 @@ public class AlchemicalWizardry
|
|||
// }
|
||||
// }
|
||||
|
||||
@Mod.EventHandler
|
||||
public void initCommands(FMLServerStartingEvent event)
|
||||
{
|
||||
event.registerServerCommand(new CommandBind());
|
||||
event.registerServerCommand(new CommandUnbind());
|
||||
event.registerServerCommand(new CommandSN());
|
||||
event.registerServerCommand(new CommandDownloadGAPI());
|
||||
}
|
||||
// @Mod.EventHandler
|
||||
// public void initCommands(FMLServerStartingEvent event)
|
||||
// {
|
||||
// event.registerServerCommand(new CommandBind());
|
||||
// event.registerServerCommand(new CommandUnbind());
|
||||
// event.registerServerCommand(new CommandSN());
|
||||
// event.registerServerCommand(new CommandDownloadGAPI());
|
||||
// }
|
||||
}
|
||||
|
|
|
@ -106,7 +106,6 @@ public class BloodMagicConfiguration
|
|||
AlchemicalWizardry.causeHungerChatMessage = config.get("WimpySettings", "causeHungerChatMessage", true).getBoolean();
|
||||
// AlchemicalWizardry.lockdownAltar = config.get("WimpySettings", "LockdownAltarWithRegen", true).getBoolean();
|
||||
AlchemicalWizardry.lockdownAltar = false;
|
||||
AlchemicalWizardry.disableBoundToolsRightClick = config.get("WimpySettings", "disableBoundToolsRightClick", false).getBoolean(false);
|
||||
|
||||
AlchemicalWizardry.ritualDisabledWater = config.get("Ritual Blacklist", "Ritual of the Full Spring", false).getBoolean(false);
|
||||
AlchemicalWizardry.ritualDisabledLava = config.get("Ritual Blacklist", "Serenade of the Nether", false).getBoolean(false);
|
||||
|
@ -144,7 +143,7 @@ public class BloodMagicConfiguration
|
|||
AlchemicalWizardry.ritualDisabledCrafting = config.get("Ritual Blacklist", "Rhythm of the Beating Anvil", false).getBoolean(false);
|
||||
AlchemicalWizardry.ritualDisabledPhantomHands = config.get("Ritual Blacklist", "Orchestra of the Phantom Hands", false).getBoolean(false);
|
||||
AlchemicalWizardry.ritualDisabledSphereIsland = config.get("Ritual Blacklist", "Birth of the Bastion", false).getBoolean(false);
|
||||
|
||||
|
||||
AlchemicalWizardry.potionDisableRegen = config.get("Alchemy Potion Blacklist", "Regeneration", false).getBoolean(false);
|
||||
AlchemicalWizardry.potionDisableNightVision = config.get("Alchemy Potion Blacklist", "Night Vision", false).getBoolean(false);
|
||||
AlchemicalWizardry.potionDisableFireResistance = config.get("Alchemy Potion Blacklist", "Fire Resistance", false).getBoolean(false);
|
||||
|
@ -201,6 +200,7 @@ public class BloodMagicConfiguration
|
|||
// PlayerSacrificeHandler.scalingOfSacrifice = (float) config.get("TestIncenseSettings", "ScalingFactor", 0.0025f).getDouble();
|
||||
// PlayerSacrificeHandler.soulFrayDuration = config.get("TestIncenseSettings", "SoulFrayDuration", 400).getInt();
|
||||
|
||||
|
||||
Side side = FMLCommonHandler.instance().getSide();
|
||||
if (side == Side.CLIENT)
|
||||
{
|
||||
|
@ -208,7 +208,6 @@ public class BloodMagicConfiguration
|
|||
RenderHelper.yOffset = config.get("ClientSettings", "AlchemyHUDyOffset", 2).getInt();
|
||||
RenderHelper.lpBarX = config.get("ClientSettings", "LPHUDxOffset", 12).getInt();
|
||||
RenderHelper.lpBarY = config.get("ClientSettings", "LPHUDyOffset", 75).getInt();
|
||||
AlchemicalWizardry.displayRitualAnimation = config.get("ClientSettings", "Display Ritual Animation", true).getBoolean(true);
|
||||
}
|
||||
|
||||
config.save();
|
||||
|
@ -216,6 +215,7 @@ public class BloodMagicConfiguration
|
|||
|
||||
public static void set(String categoryName, String propertyName, String newValue)
|
||||
{
|
||||
|
||||
config.load();
|
||||
if (config.getCategoryNames().contains(categoryName))
|
||||
{
|
||||
|
@ -225,6 +225,8 @@ public class BloodMagicConfiguration
|
|||
}
|
||||
}
|
||||
config.save();
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static void loadBlacklist()
|
||||
|
@ -248,47 +250,185 @@ public class BloodMagicConfiguration
|
|||
|
||||
public static void blacklistRituals()
|
||||
{
|
||||
if (AlchemicalWizardry.ritualDisabledWater) r("AW001Water");
|
||||
if (AlchemicalWizardry.ritualDisabledLava) r("AW002Lava");
|
||||
if (AlchemicalWizardry.ritualDisabledGreenGrove) r("AW003GreenGrove");
|
||||
if (AlchemicalWizardry.ritualDisabledInterdiction) r("AW004Interdiction");
|
||||
if (AlchemicalWizardry.ritualDisabledContainment) r("AW005Containment");
|
||||
if (AlchemicalWizardry.ritualDisabledBinding) r("AW006Binding");
|
||||
if (AlchemicalWizardry.ritualDisabledUnbinding) r("AW007Unbinding"); // "A medium dry martini, lemon peel. Shaken, not stirred."
|
||||
if (AlchemicalWizardry.ritualDisabledHighJump) r("AW008HighJump");
|
||||
if (AlchemicalWizardry.ritualDisabledMagnetism) r("AW009Magnetism");
|
||||
if (AlchemicalWizardry.ritualDisabledCrusher) r("AW010Crusher");
|
||||
if (AlchemicalWizardry.ritualDisabledSpeed) r("AW011Speed");
|
||||
if (AlchemicalWizardry.ritualDisabledAnimalGrowth) r("AW012AnimalGrowth");
|
||||
if (AlchemicalWizardry.ritualDisabledSuffering) r("AW013Suffering");
|
||||
if (AlchemicalWizardry.ritualDisabledRegen) r("AW014Regen");
|
||||
if (AlchemicalWizardry.ritualDisabledFeatheredKnife) r("AW015FeatheredKnife");
|
||||
if (AlchemicalWizardry.ritualDisabledFeatheredEarth) r("AW016FeatheredEarth");
|
||||
if (AlchemicalWizardry.ritualDisabledGaia) r("AW017Gaia");
|
||||
if (AlchemicalWizardry.ritualDisabledCondor) r("AW018Condor");
|
||||
if (AlchemicalWizardry.ritualDisabledFallingTower) r("AW019FallingTower");
|
||||
if (AlchemicalWizardry.ritualDisabledBalladOfAlchemy) r("AW020BalladOfAlchemy");
|
||||
if (AlchemicalWizardry.ritualDisabledExpulsion) r("AW021Expulsion");
|
||||
if (AlchemicalWizardry.ritualDisabledSuppression) r("AW022Suppression");
|
||||
if (AlchemicalWizardry.ritualDisabledZephyr) r("AW023Zephyr");
|
||||
if (AlchemicalWizardry.ritualDisabledHarvest) r("AW024Harvest");
|
||||
if (AlchemicalWizardry.ritualDisabledConduit) r("AW025Conduit");
|
||||
if (AlchemicalWizardry.ritualDisabledEllipsoid) r("AW026Ellipsoid");
|
||||
if (AlchemicalWizardry.ritualDisabledEvaporation) r("AW027Evaporation");
|
||||
if (AlchemicalWizardry.ritualDisabledSpawnWard) r("AW028SpawnWard");
|
||||
if (AlchemicalWizardry.ritualDisabledVeilOfEvil) r("AW029VeilOfEvil");
|
||||
if (AlchemicalWizardry.ritualDisabledFullStomach) r("AW030FullStomach");
|
||||
if (AlchemicalWizardry.ritualDisabledConvocation) r("AW031Convocation");
|
||||
if (AlchemicalWizardry.ritualDisabledSymmetry) r("AW032Symmetry");
|
||||
if (AlchemicalWizardry.ritualDisabledStalling) r("AW033Stalling");
|
||||
if (AlchemicalWizardry.ritualDisabledCrafting) r("AW034Crafting");
|
||||
if (AlchemicalWizardry.ritualDisabledPhantomHands) r("AW035PhantomHands");
|
||||
if (AlchemicalWizardry.ritualDisabledSphereIsland) r("AW036SphereIsland");
|
||||
}
|
||||
|
||||
private static void r(String ritualID)
|
||||
{
|
||||
Rituals.ritualMap.remove(ritualID);
|
||||
Rituals.keyList.remove(ritualID);
|
||||
if (AlchemicalWizardry.ritualDisabledWater)
|
||||
{
|
||||
Rituals.ritualMap.remove("AW001Water");
|
||||
Rituals.keyList.remove("AW001Water");
|
||||
}
|
||||
if (AlchemicalWizardry.ritualDisabledLava)
|
||||
{
|
||||
Rituals.ritualMap.remove("AW002Lava");
|
||||
Rituals.keyList.remove("AW002Lava");
|
||||
}
|
||||
if (AlchemicalWizardry.ritualDisabledGreenGrove)
|
||||
{
|
||||
Rituals.ritualMap.remove("AW003GreenGrove");
|
||||
Rituals.keyList.remove("AW003GreenGrove");
|
||||
}
|
||||
if (AlchemicalWizardry.ritualDisabledInterdiction)
|
||||
{
|
||||
Rituals.ritualMap.remove("AW004Interdiction");
|
||||
Rituals.keyList.remove("AW004Interdiction");
|
||||
}
|
||||
if (AlchemicalWizardry.ritualDisabledContainment)
|
||||
{
|
||||
Rituals.ritualMap.remove("AW005Containment");
|
||||
Rituals.keyList.remove("AW005Containment");
|
||||
}
|
||||
if (AlchemicalWizardry.ritualDisabledBinding)
|
||||
{
|
||||
Rituals.ritualMap.remove("AW006Binding");
|
||||
Rituals.keyList.remove("AW006Binding");
|
||||
}
|
||||
if (AlchemicalWizardry.ritualDisabledUnbinding)
|
||||
{
|
||||
Rituals.ritualMap.remove("AW007Unbinding");//007 reporting for duty
|
||||
Rituals.keyList.remove("AW007Unbinding");
|
||||
}
|
||||
if (AlchemicalWizardry.ritualDisabledHighJump)
|
||||
{
|
||||
Rituals.ritualMap.remove("AW008HighJump");
|
||||
Rituals.keyList.remove("AW008HighJump");
|
||||
}
|
||||
if (AlchemicalWizardry.ritualDisabledMagnetism)
|
||||
{
|
||||
Rituals.ritualMap.remove("AW009Magnetism");
|
||||
Rituals.keyList.remove("AW009Magnetism");
|
||||
}
|
||||
if (AlchemicalWizardry.ritualDisabledCrusher)
|
||||
{
|
||||
Rituals.ritualMap.remove("AW010Crusher");
|
||||
Rituals.keyList.remove("AW010Crusher");
|
||||
}
|
||||
if (AlchemicalWizardry.ritualDisabledSpeed)
|
||||
{
|
||||
Rituals.ritualMap.remove("AW011Speed");
|
||||
Rituals.keyList.remove("AW011Speed");
|
||||
}
|
||||
if (AlchemicalWizardry.ritualDisabledAnimalGrowth)
|
||||
{
|
||||
Rituals.ritualMap.remove("AW012AnimalGrowth");
|
||||
Rituals.keyList.remove("AW012AnimalGrowth");
|
||||
}
|
||||
if (AlchemicalWizardry.ritualDisabledSuffering)
|
||||
{
|
||||
Rituals.ritualMap.remove("AW013Suffering");
|
||||
Rituals.keyList.remove("AW013Suffering");
|
||||
}
|
||||
if (AlchemicalWizardry.ritualDisabledRegen)
|
||||
{
|
||||
Rituals.ritualMap.remove("AW014Regen");
|
||||
Rituals.keyList.remove("AW014Regen");
|
||||
}
|
||||
if (AlchemicalWizardry.ritualDisabledFeatheredKnife)
|
||||
{
|
||||
Rituals.ritualMap.remove("AW015FeatheredKnife");
|
||||
Rituals.keyList.remove("AW015FeatheredKnife");
|
||||
}
|
||||
if (AlchemicalWizardry.ritualDisabledFeatheredEarth)
|
||||
{
|
||||
Rituals.ritualMap.remove("AW016FeatheredEarth");
|
||||
Rituals.keyList.remove("AW016FeatheredEarth");
|
||||
}
|
||||
if (AlchemicalWizardry.ritualDisabledGaia)
|
||||
{
|
||||
Rituals.ritualMap.remove("AW017Gaia");
|
||||
Rituals.keyList.remove("AW017Gaia");
|
||||
}
|
||||
if (AlchemicalWizardry.ritualDisabledCondor)
|
||||
{
|
||||
Rituals.ritualMap.remove("AW018Condor");
|
||||
Rituals.keyList.remove("AW018Condor");
|
||||
}
|
||||
if (AlchemicalWizardry.ritualDisabledFallingTower)
|
||||
{
|
||||
Rituals.ritualMap.remove("AW019FallingTower");
|
||||
Rituals.keyList.remove("AW019FallingTower");
|
||||
}
|
||||
if (AlchemicalWizardry.ritualDisabledBalladOfAlchemy)
|
||||
{
|
||||
Rituals.ritualMap.remove("AW020BalladOfAlchemy");
|
||||
Rituals.keyList.remove("AW020BalladOfAlchemy");
|
||||
}
|
||||
if (AlchemicalWizardry.ritualDisabledExpulsion)
|
||||
{
|
||||
Rituals.ritualMap.remove("AW021Expulsion");
|
||||
Rituals.keyList.remove("AW021Expulsion");
|
||||
}
|
||||
if (AlchemicalWizardry.ritualDisabledSuppression)
|
||||
{
|
||||
Rituals.ritualMap.remove("AW022Suppression");
|
||||
Rituals.keyList.remove("AW022Suppression");
|
||||
}
|
||||
if (AlchemicalWizardry.ritualDisabledZephyr)
|
||||
{
|
||||
Rituals.ritualMap.remove("AW023Zephyr");
|
||||
Rituals.keyList.remove("AW023Zephyr");
|
||||
}
|
||||
if (AlchemicalWizardry.ritualDisabledHarvest)
|
||||
{
|
||||
Rituals.ritualMap.remove("AW024Harvest");
|
||||
Rituals.keyList.remove("AW024Harvest");
|
||||
}
|
||||
if (AlchemicalWizardry.ritualDisabledConduit)
|
||||
{
|
||||
Rituals.ritualMap.remove("AW025Conduit");
|
||||
Rituals.keyList.remove("AW025Conduit");
|
||||
}
|
||||
if (AlchemicalWizardry.ritualDisabledEllipsoid)
|
||||
{
|
||||
Rituals.ritualMap.remove("AW026Ellipsoid");
|
||||
Rituals.keyList.remove("AW026Ellipsoid");
|
||||
}
|
||||
if (AlchemicalWizardry.ritualDisabledEvaporation)
|
||||
{
|
||||
Rituals.ritualMap.remove("AW027Evaporation");
|
||||
Rituals.keyList.remove("AW027Evaporation");
|
||||
}
|
||||
if (AlchemicalWizardry.ritualDisabledSpawnWard)
|
||||
{
|
||||
Rituals.ritualMap.remove("AW028SpawnWard");
|
||||
Rituals.keyList.remove("AW028SpawnWard");
|
||||
}
|
||||
if (AlchemicalWizardry.ritualDisabledVeilOfEvil)
|
||||
{
|
||||
Rituals.ritualMap.remove("AW029VeilOfEvil");
|
||||
Rituals.keyList.remove("AW029VeilOfEvil");
|
||||
}
|
||||
if (AlchemicalWizardry.ritualDisabledFullStomach)
|
||||
{
|
||||
Rituals.ritualMap.remove("AW030FullStomach");
|
||||
Rituals.keyList.remove("AW030FullStomach");
|
||||
}
|
||||
if (AlchemicalWizardry.ritualDisabledConvocation)
|
||||
{
|
||||
Rituals.ritualMap.remove("AW031Convocation");
|
||||
Rituals.keyList.remove("AW031Convocation");
|
||||
}
|
||||
if (AlchemicalWizardry.ritualDisabledSymmetry)
|
||||
{
|
||||
Rituals.ritualMap.remove("AW032Symmetry");
|
||||
Rituals.keyList.remove("AW032Symmetry");
|
||||
}
|
||||
if (AlchemicalWizardry.ritualDisabledStalling)
|
||||
{
|
||||
Rituals.ritualMap.remove("AW033Stalling");
|
||||
Rituals.keyList.remove("AW033Stalling");
|
||||
}
|
||||
if (AlchemicalWizardry.ritualDisabledCrafting)
|
||||
{
|
||||
Rituals.ritualMap.remove("AW034Crafting");
|
||||
Rituals.keyList.remove("AW034Crafting");
|
||||
}
|
||||
if (AlchemicalWizardry.ritualDisabledPhantomHands)
|
||||
{
|
||||
Rituals.ritualMap.remove("AW035PhantomHands");
|
||||
Rituals.keyList.remove("AW035PhantomHands");
|
||||
}
|
||||
if (AlchemicalWizardry.ritualDisabledSphereIsland)
|
||||
{
|
||||
Rituals.ritualMap.remove("AW036SphereIsland");
|
||||
Rituals.keyList.remove("AW036SphereIsland");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package WayofTime.alchemicalWizardry;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import WayofTime.alchemicalWizardry.common.block.ArmourForge;
|
||||
import WayofTime.alchemicalWizardry.common.block.BlockAlchemicCalcinator;
|
||||
import WayofTime.alchemicalWizardry.common.block.BlockAltar;
|
||||
|
@ -49,7 +50,6 @@ import WayofTime.alchemicalWizardry.common.items.ItemSpellEnhancementBlock;
|
|||
import WayofTime.alchemicalWizardry.common.items.ItemSpellModifierBlock;
|
||||
import WayofTime.alchemicalWizardry.common.items.ItemSpellParadigmBlock;
|
||||
import WayofTime.alchemicalWizardry.common.items.ItemStabilityGlyphBlock;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
|
|
|
@ -158,7 +158,7 @@ public class ModItems
|
|||
public static Item itemSeerSigil;
|
||||
public static Item itemCombinationalCatalyst;
|
||||
|
||||
public static Item customTool;
|
||||
public static ItemSpellMultiTool customTool;
|
||||
|
||||
public static Item itemAttunedCrystal;
|
||||
public static Item itemTankSegmenter;
|
||||
|
@ -284,14 +284,14 @@ public class ModItems
|
|||
energyBazooka = new EnergyBazooka().setUnlocalizedName("energyBazooka");
|
||||
itemBloodLightSigil = new SigilBloodLight().setUnlocalizedName("bloodLightSigil");
|
||||
itemComplexSpellCrystal = new ItemComplexSpellCrystal().setUnlocalizedName("itemComplexSpellCrystal");
|
||||
bucketLife = new LifeBucket(ModBlocks.blockLifeEssence).setUnlocalizedName("bucketLife").setContainerItem(Items.bucket).setCreativeTab(CreativeTabs.tabMisc);
|
||||
bucketLife = (new LifeBucket(ModBlocks.blockLifeEssence)).setUnlocalizedName("bucketLife").setContainerItem(Items.bucket).setCreativeTab(CreativeTabs.tabMisc);
|
||||
itemSigilOfEnderSeverance = (new SigilOfEnderSeverance()).setUnlocalizedName("itemSigilOfEnderSeverance");
|
||||
baseItems = new ItemComponents().setUnlocalizedName("baseItems");
|
||||
baseAlchemyItems = new ItemAlchemyBase().setUnlocalizedName("baseAlchemyItems");
|
||||
itemSigilOfSupression = new SigilOfSupression().setUnlocalizedName("itemSigilOfSupression");
|
||||
itemFluidSigil = new SigilFluid().setUnlocalizedName("itemFluidSigil");
|
||||
itemSeerSigil = new SigilSeer().setUnlocalizedName("itemSeerSigil");
|
||||
customTool = new ItemSpellMultiTool().setUnlocalizedName("multiTool");
|
||||
customTool = (ItemSpellMultiTool)(new ItemSpellMultiTool().setUnlocalizedName("multiTool"));
|
||||
|
||||
SpellParadigmTool.customTool = customTool;
|
||||
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
package WayofTime.alchemicalWizardry.api.alchemy.energy;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
public interface IReagentHandler
|
||||
{
|
||||
int fill(ForgeDirection from, ReagentStack resource, boolean doFill);
|
||||
int fill(EnumFacing from, ReagentStack resource, boolean doFill);
|
||||
|
||||
ReagentStack drain(ForgeDirection from, ReagentStack resource, boolean doDrain);
|
||||
ReagentStack drain(EnumFacing from, ReagentStack resource, boolean doDrain);
|
||||
|
||||
ReagentStack drain(ForgeDirection from, int maxDrain, boolean doDrain);
|
||||
ReagentStack drain(EnumFacing from, int maxDrain, boolean doDrain);
|
||||
|
||||
boolean canFill(ForgeDirection from, Reagent reagent);
|
||||
boolean canFill(EnumFacing from, Reagent reagent);
|
||||
|
||||
boolean canDrain(ForgeDirection from, Reagent reagent);
|
||||
boolean canDrain(EnumFacing from, Reagent reagent);
|
||||
|
||||
ReagentContainerInfo[] getContainerInfo(ForgeDirection from);
|
||||
ReagentContainerInfo[] getContainerInfo(EnumFacing from);
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ package WayofTime.alchemicalWizardry.api.alchemy.energy;
|
|||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
public class TileReagentHandler extends TileEntity implements IReagentHandler
|
||||
{
|
||||
|
@ -25,13 +25,13 @@ public class TileReagentHandler extends TileEntity implements IReagentHandler
|
|||
|
||||
/* IReagentHandler */
|
||||
@Override
|
||||
public int fill(ForgeDirection from, ReagentStack resource, boolean doFill)
|
||||
public int fill(EnumFacing from, ReagentStack resource, boolean doFill)
|
||||
{
|
||||
return tank.fill(resource, doFill);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReagentStack drain(ForgeDirection from, ReagentStack resource, boolean doDrain)
|
||||
public ReagentStack drain(EnumFacing from, ReagentStack resource, boolean doDrain)
|
||||
{
|
||||
if (resource == null || !resource.isReagentEqual(tank.getReagent()))
|
||||
{
|
||||
|
@ -41,25 +41,25 @@ public class TileReagentHandler extends TileEntity implements IReagentHandler
|
|||
}
|
||||
|
||||
@Override
|
||||
public ReagentStack drain(ForgeDirection from, int maxDrain, boolean doDrain)
|
||||
public ReagentStack drain(EnumFacing from, int maxDrain, boolean doDrain)
|
||||
{
|
||||
return tank.drain(maxDrain, doDrain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFill(ForgeDirection from, Reagent reagent)
|
||||
public boolean canFill(EnumFacing from, Reagent reagent)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDrain(ForgeDirection from, Reagent reagent)
|
||||
public boolean canDrain(EnumFacing from, Reagent reagent)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReagentContainerInfo[] getContainerInfo(ForgeDirection from)
|
||||
public ReagentContainerInfo[] getContainerInfo(EnumFacing from)
|
||||
{
|
||||
return new ReagentContainerInfo[]{tank.getInfo()};
|
||||
}
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
|
||||
package WayofTime.alchemicalWizardry.api.alchemy.energy;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.Constants;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.common.util.Constants;
|
||||
|
||||
public class TileSegmentedReagentHandler extends TileEntity implements ISegmentedReagentHandler
|
||||
{
|
||||
protected ReagentContainer[] tanks;
|
||||
|
@ -98,7 +98,7 @@ public class TileSegmentedReagentHandler extends TileEntity implements ISegmente
|
|||
|
||||
/* ISegmentedReagentHandler */
|
||||
@Override
|
||||
public int fill(ForgeDirection from, ReagentStack resource, boolean doFill)
|
||||
public int fill(EnumFacing from, ReagentStack resource, boolean doFill)
|
||||
{
|
||||
int totalFill = 0;
|
||||
|
||||
|
@ -164,7 +164,7 @@ public class TileSegmentedReagentHandler extends TileEntity implements ISegmente
|
|||
}
|
||||
|
||||
@Override
|
||||
public ReagentStack drain(ForgeDirection from, ReagentStack resource, boolean doDrain)
|
||||
public ReagentStack drain(EnumFacing from, ReagentStack resource, boolean doDrain)
|
||||
{
|
||||
if (resource == null)
|
||||
{
|
||||
|
@ -197,7 +197,7 @@ public class TileSegmentedReagentHandler extends TileEntity implements ISegmente
|
|||
|
||||
/* Only returns the amount from the first available tank */
|
||||
@Override
|
||||
public ReagentStack drain(ForgeDirection from, int maxDrain, boolean doDrain)
|
||||
public ReagentStack drain(EnumFacing from, int maxDrain, boolean doDrain)
|
||||
{
|
||||
for (int i = 0; i < tanks.length; i++)
|
||||
{
|
||||
|
@ -212,19 +212,19 @@ public class TileSegmentedReagentHandler extends TileEntity implements ISegmente
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canFill(ForgeDirection from, Reagent reagent)
|
||||
public boolean canFill(EnumFacing from, Reagent reagent)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDrain(ForgeDirection from, Reagent reagent)
|
||||
public boolean canDrain(EnumFacing from, Reagent reagent)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReagentContainerInfo[] getContainerInfo(ForgeDirection from)
|
||||
public ReagentContainerInfo[] getContainerInfo(EnumFacing from)
|
||||
{
|
||||
ReagentContainerInfo[] info = new ReagentContainerInfo[this.getNumberOfTanks()];
|
||||
for (int i = 0; i < this.getNumberOfTanks(); i++)
|
||||
|
|
|
@ -76,7 +76,7 @@ public class AltarRecipe
|
|||
|
||||
protected boolean areTagsEqual(NBTTagCompound tag, NBTTagCompound comparedTag)
|
||||
{
|
||||
Set set = tag.func_150296_c();
|
||||
Set set = tag.getKeySet();
|
||||
|
||||
for(Object obj : set)
|
||||
{
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
package WayofTime.alchemicalWizardry.api.event;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
|
||||
|
||||
@Cancelable
|
||||
public class AddToNetworkEvent extends Event
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package WayofTime.alchemicalWizardry.api.event;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
|
||||
@Cancelable
|
||||
public class ItemBindEvent extends Event
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package WayofTime.alchemicalWizardry.api.event;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
||||
|
||||
@Cancelable
|
||||
public class ItemDrainInContainerEvent extends SoulNetworkEvent
|
||||
|
|
|
@ -2,8 +2,8 @@ package WayofTime.alchemicalWizardry.api.event;
|
|||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
|
||||
@Cancelable
|
||||
public class RitualActivatedEvent extends RitualEvent
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package WayofTime.alchemicalWizardry.api.event;
|
||||
|
||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
|
||||
public class RitualEvent extends Event
|
||||
{
|
||||
|
|
|
@ -1,16 +1,13 @@
|
|||
package WayofTime.alchemicalWizardry.api.event;
|
||||
|
||||
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
|
||||
@Cancelable
|
||||
public class RitualRunEvent extends RitualEvent
|
||||
{
|
||||
|
||||
|
||||
public RitualRunEvent(IMasterRitualStone mrs, String ownerKey, String ritualKey)
|
||||
{
|
||||
super(mrs, ownerKey, ritualKey);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package WayofTime.alchemicalWizardry.api.event;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
|
||||
|
||||
public class SoulNetworkEvent extends Event
|
||||
{
|
||||
|
|
|
@ -1,56 +1,52 @@
|
|||
package WayofTime.alchemicalWizardry.api.event;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
|
||||
|
||||
/** Fired when a teleposer attempts to transpose two blocks. Use this to perform special cleanup or compensation,
|
||||
or cancel it entirely to prevent the transposition. */
|
||||
@Cancelable
|
||||
public class TeleposeEvent extends Event {
|
||||
public class TeleposeEvent extends Event
|
||||
{
|
||||
|
||||
public final World initialWorld;
|
||||
public final int initialX;
|
||||
public final int initialY;
|
||||
public final int initialZ;
|
||||
public final BlockPos initialPos;
|
||||
|
||||
public final Block initialBlock;
|
||||
public final int initialMetadata;
|
||||
public final IBlockState initialState;
|
||||
|
||||
public final World finalWorld;
|
||||
public final int finalX;
|
||||
public final int finalY;
|
||||
public final int finalZ;
|
||||
public final BlockPos finalPos;
|
||||
|
||||
public final Block finalBlock;
|
||||
public final int finalMetadata;
|
||||
public final IBlockState finalState;
|
||||
|
||||
public TeleposeEvent(World wi, int xi, int yi, int zi, Block bi, int mi, World wf, int xf, int yf, int zf, Block bf, int mf) {
|
||||
public TeleposeEvent(World wi, BlockPos posi, IBlockState statei, World wf, BlockPos posf, IBlockState statef) {
|
||||
initialWorld = wi;
|
||||
initialX = xi;
|
||||
initialY = yi;
|
||||
initialZ = zi;
|
||||
|
||||
initialBlock = bi;
|
||||
initialMetadata = mi;
|
||||
initialPos = posi;
|
||||
|
||||
initialState = statei;
|
||||
initialBlock = initialState.getBlock();
|
||||
|
||||
finalWorld = wf;
|
||||
finalX = xf;
|
||||
finalY = yf;
|
||||
finalZ = zf;
|
||||
finalPos = posf;
|
||||
|
||||
finalBlock = bf;
|
||||
finalMetadata = mf;
|
||||
finalState = statef;
|
||||
finalBlock = finalState.getBlock();
|
||||
}
|
||||
|
||||
public TileEntity getInitialTile() {
|
||||
return initialWorld.getTileEntity(initialX, initialY, initialZ);
|
||||
return initialWorld.getTileEntity(initialPos);
|
||||
}
|
||||
|
||||
public TileEntity getFinalTile() {
|
||||
return finalWorld.getTileEntity(finalX, finalY, finalZ);
|
||||
return finalWorld.getTileEntity(finalPos);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,135 +1,135 @@
|
|||
package WayofTime.alchemicalWizardry.api.guide;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import WayofTime.alchemicalWizardry.api.items.ShapedBloodOrbRecipe;
|
||||
import WayofTime.alchemicalWizardry.api.items.ShapelessBloodOrbRecipe;
|
||||
import WayofTime.alchemicalWizardry.api.spell.APISpellHelper;
|
||||
import amerifrance.guideapi.ModInformation;
|
||||
import amerifrance.guideapi.api.abstraction.CategoryAbstract;
|
||||
import amerifrance.guideapi.api.abstraction.EntryAbstract;
|
||||
import amerifrance.guideapi.api.abstraction.IRecipeRenderer;
|
||||
import amerifrance.guideapi.api.base.Book;
|
||||
import amerifrance.guideapi.api.util.GuiHelper;
|
||||
import amerifrance.guideapi.gui.GuiBase;
|
||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
|
||||
public class OrbRecipeRenderer implements IRecipeRenderer
|
||||
{
|
||||
public IRecipe recipe;
|
||||
|
||||
public OrbRecipeRenderer(IRecipe recipe)
|
||||
{
|
||||
this.recipe = recipe;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Book book, CategoryAbstract category, EntryAbstract entry,
|
||||
int guiLeft, int guiTop, int mouseX, int mouseY, GuiBase guiBase,
|
||||
FontRenderer fontRenderer) {
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation(ModInformation.GUITEXLOC + "recipe_elements.png"));
|
||||
guiBase.drawTexturedModalRect(guiLeft + 42, guiTop + 53, 0, 0, 105, 65);
|
||||
|
||||
guiBase.drawCenteredString(fontRenderer, StatCollector.translateToLocal("text.recipe.shapedOrb"), guiLeft + guiBase.xSize / 2, guiTop + 12, 0);
|
||||
if(recipe instanceof ShapelessBloodOrbRecipe)
|
||||
{
|
||||
ShapelessBloodOrbRecipe shapelessBloodOrbRecipe = (ShapelessBloodOrbRecipe) recipe;
|
||||
List<Object> list = shapelessBloodOrbRecipe.getInput();
|
||||
|
||||
int width = 3;
|
||||
int height = 3;
|
||||
for (int y = 0; y < height; y++) {
|
||||
for (int x = 0; x < width; x++) {
|
||||
if(list.size() - 1 < y * width + x)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
int stackX = (x + 1) * 18 + (guiLeft + guiBase.xSize / 7);
|
||||
int stackY = (y + 1) * 18 + (guiTop + guiBase.ySize / 5);
|
||||
|
||||
Object component = list.get(y * width + x);
|
||||
if (component != null) {
|
||||
if (component instanceof ItemStack) {
|
||||
GuiHelper.drawItemStack((ItemStack) component, stackX, stackY);
|
||||
if (GuiHelper.isMouseBetween(mouseX, mouseY, stackX, stackY, 15, 15)) {
|
||||
guiBase.renderToolTip((ItemStack) component, stackX, stackY);
|
||||
}
|
||||
} else if (component instanceof Integer) {
|
||||
GuiHelper.drawItemStack(APISpellHelper.getOrbForLevel((Integer) component), stackX, stackY);
|
||||
if (GuiHelper.isMouseBetween(mouseX, mouseY, stackX, stackY, 15, 15)) {
|
||||
guiBase.renderToolTip(APISpellHelper.getOrbForLevel((Integer) component), stackX, stackY);
|
||||
}
|
||||
} else {
|
||||
if (((ArrayList<ItemStack>) component).isEmpty()) return;
|
||||
GuiHelper.drawItemStack(((ArrayList<ItemStack>) component).get(0), stackX, stackY);
|
||||
if (GuiHelper.isMouseBetween(mouseX, mouseY, stackX, stackY, 15, 15)) {
|
||||
guiBase.renderToolTip(((ArrayList<ItemStack>) component).get(0), stackX, stackY);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
int outputX = (5 * 18) + (guiLeft + guiBase.xSize / 7);
|
||||
int outputY = (2 * 18) + (guiTop + guiBase.xSize / 5);
|
||||
GuiHelper.drawItemStack(shapelessBloodOrbRecipe.getRecipeOutput(), outputX, outputY);
|
||||
if (GuiHelper.isMouseBetween(mouseX, mouseY, outputX, outputY, 15, 15)) {
|
||||
guiBase.renderToolTip(shapelessBloodOrbRecipe.getRecipeOutput(), outputX, outputY);
|
||||
}
|
||||
}else
|
||||
{
|
||||
ShapedBloodOrbRecipe shapedBloodOrbRecipe = (ShapedBloodOrbRecipe) recipe;
|
||||
int width = ReflectionHelper.getPrivateValue(ShapedBloodOrbRecipe.class, shapedBloodOrbRecipe, 4);
|
||||
int height = ReflectionHelper.getPrivateValue(ShapedBloodOrbRecipe.class, shapedBloodOrbRecipe, 5);
|
||||
for (int y = 0; y < height; y++) {
|
||||
for (int x = 0; x < width; x++) {
|
||||
int stackX = (x + 1) * 18 + (guiLeft + guiBase.xSize / 7);
|
||||
int stackY = (y + 1) * 18 + (guiTop + guiBase.ySize / 5);
|
||||
Object component = shapedBloodOrbRecipe.getInput()[y * width + x];
|
||||
if (component != null) {
|
||||
if (component instanceof ItemStack) {
|
||||
GuiHelper.drawItemStack((ItemStack) component, stackX, stackY);
|
||||
if (GuiHelper.isMouseBetween(mouseX, mouseY, stackX, stackY, 15, 15)) {
|
||||
guiBase.renderToolTip((ItemStack) component, stackX, stackY);
|
||||
}
|
||||
} else if (component instanceof Integer) {
|
||||
GuiHelper.drawItemStack(APISpellHelper.getOrbForLevel((Integer) component), stackX, stackY);
|
||||
if (GuiHelper.isMouseBetween(mouseX, mouseY, stackX, stackY, 15, 15)) {
|
||||
guiBase.renderToolTip(APISpellHelper.getOrbForLevel((Integer) component), stackX, stackY);
|
||||
}
|
||||
} else {
|
||||
if (((ArrayList<ItemStack>) component).isEmpty()) return;
|
||||
GuiHelper.drawItemStack(((ArrayList<ItemStack>) component).get(0), stackX, stackY);
|
||||
if (GuiHelper.isMouseBetween(mouseX, mouseY, stackX, stackY, 15, 15)) {
|
||||
guiBase.renderToolTip(((ArrayList<ItemStack>) component).get(0), stackX, stackY);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
int outputX = (5 * 18) + (guiLeft + guiBase.xSize / 7);
|
||||
int outputY = (2 * 18) + (guiTop + guiBase.xSize / 5);
|
||||
GuiHelper.drawItemStack(shapedBloodOrbRecipe.getRecipeOutput(), outputX, outputY);
|
||||
if (GuiHelper.isMouseBetween(mouseX, mouseY, outputX, outputY, 15, 15)) {
|
||||
guiBase.renderToolTip(shapedBloodOrbRecipe.getRecipeOutput(), outputX, outputY);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(Book book, CategoryAbstract category,
|
||||
EntryAbstract entry, int guiLeft, int guiTop, int mouseX,
|
||||
int mouseY, GuiBase guiBase, FontRenderer fontRenderer) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
//package WayofTime.alchemicalWizardry.api.guide;
|
||||
//
|
||||
//import java.util.ArrayList;
|
||||
//import java.util.List;
|
||||
//
|
||||
//import net.minecraft.client.Minecraft;
|
||||
//import net.minecraft.client.gui.FontRenderer;
|
||||
//import net.minecraft.item.ItemStack;
|
||||
//import net.minecraft.item.crafting.IRecipe;
|
||||
//import net.minecraft.util.ResourceLocation;
|
||||
//import net.minecraft.util.StatCollector;
|
||||
//import WayofTime.alchemicalWizardry.api.items.ShapedBloodOrbRecipe;
|
||||
//import WayofTime.alchemicalWizardry.api.items.ShapelessBloodOrbRecipe;
|
||||
//import WayofTime.alchemicalWizardry.api.spell.APISpellHelper;
|
||||
//import amerifrance.guideapi.ModInformation;
|
||||
//import amerifrance.guideapi.api.abstraction.CategoryAbstract;
|
||||
//import amerifrance.guideapi.api.abstraction.EntryAbstract;
|
||||
//import amerifrance.guideapi.api.abstraction.IRecipeRenderer;
|
||||
//import amerifrance.guideapi.api.base.Book;
|
||||
//import amerifrance.guideapi.api.util.GuiHelper;
|
||||
//import amerifrance.guideapi.gui.GuiBase;
|
||||
//import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
//
|
||||
//public class OrbRecipeRenderer implements IRecipeRenderer
|
||||
//{
|
||||
// public IRecipe recipe;
|
||||
//
|
||||
// public OrbRecipeRenderer(IRecipe recipe)
|
||||
// {
|
||||
// this.recipe = recipe;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void draw(Book book, CategoryAbstract category, EntryAbstract entry,
|
||||
// int guiLeft, int guiTop, int mouseX, int mouseY, GuiBase guiBase,
|
||||
// FontRenderer fontRenderer) {
|
||||
// Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation(ModInformation.GUITEXLOC + "recipe_elements.png"));
|
||||
// guiBase.drawTexturedModalRect(guiLeft + 42, guiTop + 53, 0, 0, 105, 65);
|
||||
//
|
||||
// guiBase.drawCenteredString(fontRenderer, StatCollector.translateToLocal("text.recipe.shapedOrb"), guiLeft + guiBase.xSize / 2, guiTop + 12, 0);
|
||||
// if(recipe instanceof ShapelessBloodOrbRecipe)
|
||||
// {
|
||||
// ShapelessBloodOrbRecipe shapelessBloodOrbRecipe = (ShapelessBloodOrbRecipe) recipe;
|
||||
// List<Object> list = shapelessBloodOrbRecipe.getInput();
|
||||
//
|
||||
// int width = 3;
|
||||
// int height = 3;
|
||||
// for (int y = 0; y < height; y++) {
|
||||
// for (int x = 0; x < width; x++) {
|
||||
// if(list.size() - 1 < y * width + x)
|
||||
// {
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
// int stackX = (x + 1) * 18 + (guiLeft + guiBase.xSize / 7);
|
||||
// int stackY = (y + 1) * 18 + (guiTop + guiBase.ySize / 5);
|
||||
//
|
||||
// Object component = list.get(y * width + x);
|
||||
// if (component != null) {
|
||||
// if (component instanceof ItemStack) {
|
||||
// GuiHelper.drawItemStack((ItemStack) component, stackX, stackY);
|
||||
// if (GuiHelper.isMouseBetween(mouseX, mouseY, stackX, stackY, 15, 15)) {
|
||||
// guiBase.renderToolTip((ItemStack) component, stackX, stackY);
|
||||
// }
|
||||
// } else if (component instanceof Integer) {
|
||||
// GuiHelper.drawItemStack(APISpellHelper.getOrbForLevel((Integer) component), stackX, stackY);
|
||||
// if (GuiHelper.isMouseBetween(mouseX, mouseY, stackX, stackY, 15, 15)) {
|
||||
// guiBase.renderToolTip(APISpellHelper.getOrbForLevel((Integer) component), stackX, stackY);
|
||||
// }
|
||||
// } else {
|
||||
// if (((ArrayList<ItemStack>) component).isEmpty()) return;
|
||||
// GuiHelper.drawItemStack(((ArrayList<ItemStack>) component).get(0), stackX, stackY);
|
||||
// if (GuiHelper.isMouseBetween(mouseX, mouseY, stackX, stackY, 15, 15)) {
|
||||
// guiBase.renderToolTip(((ArrayList<ItemStack>) component).get(0), stackX, stackY);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// int outputX = (5 * 18) + (guiLeft + guiBase.xSize / 7);
|
||||
// int outputY = (2 * 18) + (guiTop + guiBase.xSize / 5);
|
||||
// GuiHelper.drawItemStack(shapelessBloodOrbRecipe.getRecipeOutput(), outputX, outputY);
|
||||
// if (GuiHelper.isMouseBetween(mouseX, mouseY, outputX, outputY, 15, 15)) {
|
||||
// guiBase.renderToolTip(shapelessBloodOrbRecipe.getRecipeOutput(), outputX, outputY);
|
||||
// }
|
||||
// }else
|
||||
// {
|
||||
// ShapedBloodOrbRecipe shapedBloodOrbRecipe = (ShapedBloodOrbRecipe) recipe;
|
||||
// int width = ReflectionHelper.getPrivateValue(ShapedBloodOrbRecipe.class, shapedBloodOrbRecipe, 4);
|
||||
// int height = ReflectionHelper.getPrivateValue(ShapedBloodOrbRecipe.class, shapedBloodOrbRecipe, 5);
|
||||
// for (int y = 0; y < height; y++) {
|
||||
// for (int x = 0; x < width; x++) {
|
||||
// int stackX = (x + 1) * 18 + (guiLeft + guiBase.xSize / 7);
|
||||
// int stackY = (y + 1) * 18 + (guiTop + guiBase.ySize / 5);
|
||||
// Object component = shapedBloodOrbRecipe.getInput()[y * width + x];
|
||||
// if (component != null) {
|
||||
// if (component instanceof ItemStack) {
|
||||
// GuiHelper.drawItemStack((ItemStack) component, stackX, stackY);
|
||||
// if (GuiHelper.isMouseBetween(mouseX, mouseY, stackX, stackY, 15, 15)) {
|
||||
// guiBase.renderToolTip((ItemStack) component, stackX, stackY);
|
||||
// }
|
||||
// } else if (component instanceof Integer) {
|
||||
// GuiHelper.drawItemStack(APISpellHelper.getOrbForLevel((Integer) component), stackX, stackY);
|
||||
// if (GuiHelper.isMouseBetween(mouseX, mouseY, stackX, stackY, 15, 15)) {
|
||||
// guiBase.renderToolTip(APISpellHelper.getOrbForLevel((Integer) component), stackX, stackY);
|
||||
// }
|
||||
// } else {
|
||||
// if (((ArrayList<ItemStack>) component).isEmpty()) return;
|
||||
// GuiHelper.drawItemStack(((ArrayList<ItemStack>) component).get(0), stackX, stackY);
|
||||
// if (GuiHelper.isMouseBetween(mouseX, mouseY, stackX, stackY, 15, 15)) {
|
||||
// guiBase.renderToolTip(((ArrayList<ItemStack>) component).get(0), stackX, stackY);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// int outputX = (5 * 18) + (guiLeft + guiBase.xSize / 7);
|
||||
// int outputY = (2 * 18) + (guiTop + guiBase.xSize / 5);
|
||||
// GuiHelper.drawItemStack(shapedBloodOrbRecipe.getRecipeOutput(), outputX, outputY);
|
||||
// if (GuiHelper.isMouseBetween(mouseX, mouseY, outputX, outputY, 15, 15)) {
|
||||
// guiBase.renderToolTip(shapedBloodOrbRecipe.getRecipeOutput(), outputX, outputY);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void drawExtras(Book book, CategoryAbstract category,
|
||||
// EntryAbstract entry, int guiLeft, int guiTop, int mouseX,
|
||||
// int mouseY, GuiBase guiBase, FontRenderer fontRenderer) {
|
||||
// // TODO Auto-generated method stub
|
||||
//
|
||||
// }
|
||||
//
|
||||
//}
|
||||
|
|
|
@ -1,69 +1,69 @@
|
|||
package WayofTime.alchemicalWizardry.api.guide;
|
||||
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import WayofTime.alchemicalWizardry.api.altarRecipeRegistry.AltarRecipe;
|
||||
import amerifrance.guideapi.api.abstraction.CategoryAbstract;
|
||||
import amerifrance.guideapi.api.abstraction.EntryAbstract;
|
||||
import amerifrance.guideapi.api.base.Book;
|
||||
import amerifrance.guideapi.api.base.PageBase;
|
||||
import amerifrance.guideapi.api.util.GuiHelper;
|
||||
import amerifrance.guideapi.gui.GuiBase;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class PageAltarRecipe extends PageBase {
|
||||
|
||||
public ItemStack input;
|
||||
public ItemStack output;
|
||||
public int tier;
|
||||
public int bloodRequired;
|
||||
|
||||
public PageAltarRecipe(AltarRecipe recipe) {
|
||||
this.input = recipe.getRequiredItem();
|
||||
this.output = recipe.getResult();
|
||||
this.tier = recipe.getMinTier();
|
||||
this.bloodRequired = recipe.getLiquidRequired();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void draw(Book book, CategoryAbstract category, EntryAbstract entry, int guiLeft, int guiTop, int mouseX, int mouseY, GuiBase guiBase, FontRenderer fontRenderer) {
|
||||
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("alchemicalwizardry" + ":textures/gui/guide/altar.png"));
|
||||
guiBase.drawTexturedModalRect(guiLeft + 42, guiTop + 53, 0, 87, 146, 104);
|
||||
|
||||
guiBase.drawCenteredString(fontRenderer, StatCollector.translateToLocal("text.recipe.altar"), guiLeft + guiBase.xSize / 2, guiTop + 12, 0);
|
||||
|
||||
int inputX = (1 + 1) * 20 + (guiLeft + guiBase.xSize / 7) + 1;
|
||||
int inputY = (20) + (guiTop + guiBase.ySize / 5) - 1; //1 * 20
|
||||
GuiHelper.drawItemStack(input, inputX, inputY);
|
||||
if (GuiHelper.isMouseBetween(mouseX, mouseY, inputX, inputY, 15, 15)) {
|
||||
guiBase.renderToolTip(input, mouseX, mouseY);
|
||||
}
|
||||
|
||||
if (output == null) {
|
||||
output = new ItemStack(Blocks.fire);
|
||||
}
|
||||
int outputX = (5 * 20) + (guiLeft + guiBase.xSize / 7) + 1;
|
||||
int outputY = (20) + (guiTop + guiBase.xSize / 5) - 1; // 1 * 20
|
||||
GuiHelper.drawItemStack(output, outputX, outputY);
|
||||
if (GuiHelper.isMouseBetween(mouseX, mouseY, outputX, outputY, 15, 15)) {
|
||||
guiBase.renderToolTip(output, outputX, outputY);
|
||||
}
|
||||
|
||||
if (output.getItem() == Item.getItemFromBlock(Blocks.fire)) {
|
||||
guiBase.drawCenteredString(fontRenderer, StatCollector.translateToLocal("text.furnace.error"), guiLeft + guiBase.xSize / 2, guiTop + 4 * guiBase.ySize / 6, 0xED073D);
|
||||
guiBase.drawCenteredString(fontRenderer, StatCollector.translateToLocal("bm.string.tier") + ": " + String.valueOf(tier), guiLeft + guiBase.xSize / 2, guiTop + 4 * guiBase.ySize / 6 + 15, 0);
|
||||
guiBase.drawCenteredString(fontRenderer, "LP: " + String.valueOf(bloodRequired), guiLeft + guiBase.xSize / 2, guiTop + 4 * guiBase.ySize / 6 + 30, 0);
|
||||
}
|
||||
guiBase.drawCenteredString(fontRenderer, String.format(StatCollector.translateToLocal("text.recipe.altar.tier"), String.valueOf(tier)), guiLeft + guiBase.xSize / 2, guiTop + 4 * guiBase.ySize / 6, 0);
|
||||
guiBase.drawCenteredString(fontRenderer, String.format(StatCollector.translateToLocal("text.recipe.altar.bloodRequired"), String.valueOf(bloodRequired)), guiLeft + guiBase.xSize / 2, guiTop + 4 * guiBase.ySize / 6 + 15, 0);
|
||||
}
|
||||
}
|
||||
//package WayofTime.alchemicalWizardry.api.guide;
|
||||
//
|
||||
//
|
||||
//import net.minecraft.client.Minecraft;
|
||||
//import net.minecraft.client.gui.FontRenderer;
|
||||
//import net.minecraft.init.Blocks;
|
||||
//import net.minecraft.item.Item;
|
||||
//import net.minecraft.item.ItemStack;
|
||||
//import net.minecraft.util.ResourceLocation;
|
||||
//import net.minecraft.util.StatCollector;
|
||||
//import WayofTime.alchemicalWizardry.api.altarRecipeRegistry.AltarRecipe;
|
||||
//import amerifrance.guideapi.api.abstraction.CategoryAbstract;
|
||||
//import amerifrance.guideapi.api.abstraction.EntryAbstract;
|
||||
//import amerifrance.guideapi.api.base.Book;
|
||||
//import amerifrance.guideapi.api.base.PageBase;
|
||||
//import amerifrance.guideapi.api.util.GuiHelper;
|
||||
//import amerifrance.guideapi.gui.GuiBase;
|
||||
//import cpw.mods.fml.relauncher.Side;
|
||||
//import cpw.mods.fml.relauncher.SideOnly;
|
||||
//
|
||||
//public class PageAltarRecipe extends PageBase {
|
||||
//
|
||||
// public ItemStack input;
|
||||
// public ItemStack output;
|
||||
// public int tier;
|
||||
// public int bloodRequired;
|
||||
//
|
||||
// public PageAltarRecipe(AltarRecipe recipe) {
|
||||
// this.input = recipe.getRequiredItem();
|
||||
// this.output = recipe.getResult();
|
||||
// this.tier = recipe.getMinTier();
|
||||
// this.bloodRequired = recipe.getLiquidRequired();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// @SideOnly(Side.CLIENT)
|
||||
// public void draw(Book book, CategoryAbstract category, EntryAbstract entry, int guiLeft, int guiTop, int mouseX, int mouseY, GuiBase guiBase, FontRenderer fontRenderer) {
|
||||
//
|
||||
// Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("alchemicalwizardry" + ":textures/gui/guide/altar.png"));
|
||||
// guiBase.drawTexturedModalRect(guiLeft + 42, guiTop + 53, 0, 87, 146, 104);
|
||||
//
|
||||
// guiBase.drawCenteredString(fontRenderer, StatCollector.translateToLocal("text.recipe.altar"), guiLeft + guiBase.xSize / 2, guiTop + 12, 0);
|
||||
//
|
||||
// int inputX = (1 + 1) * 20 + (guiLeft + guiBase.xSize / 7);
|
||||
// int inputY = (20) + (guiTop + guiBase.ySize / 5); //1 * 20
|
||||
// GuiHelper.drawItemStack(input, inputX, inputY);
|
||||
// if (GuiHelper.isMouseBetween(mouseX, mouseY, inputX, inputY, 15, 15)) {
|
||||
// guiBase.renderToolTip(input, mouseX, mouseY);
|
||||
// }
|
||||
//
|
||||
// if (output == null) {
|
||||
// output = new ItemStack(Blocks.fire);
|
||||
// }
|
||||
// int outputX = (5 * 20) + (guiLeft + guiBase.xSize / 7);
|
||||
// int outputY = (20) + (guiTop + guiBase.xSize / 5); // 1 * 20
|
||||
// GuiHelper.drawItemStack(output, outputX, outputY);
|
||||
// if (GuiHelper.isMouseBetween(mouseX, mouseY, outputX, outputY, 15, 15)) {
|
||||
// guiBase.renderToolTip(output, outputX, outputY);
|
||||
// }
|
||||
//
|
||||
// if (output.getItem() == Item.getItemFromBlock(Blocks.fire)) {
|
||||
// guiBase.drawCenteredString(fontRenderer, StatCollector.translateToLocal("text.furnace.error"), guiLeft + guiBase.xSize / 2, guiTop + 4 * guiBase.ySize / 6, 0xED073D);
|
||||
// guiBase.drawCenteredString(fontRenderer, StatCollector.translateToLocal("bm.string.tier") + ": " + String.valueOf(tier), guiLeft + guiBase.xSize / 2, guiTop + 4 * guiBase.ySize / 6 + 15, 0);
|
||||
// guiBase.drawCenteredString(fontRenderer, "LP: " + String.valueOf(bloodRequired), guiLeft + guiBase.xSize / 2, guiTop + 4 * guiBase.ySize / 6 + 30, 0);
|
||||
// }
|
||||
// guiBase.drawCenteredString(fontRenderer, String.format(StatCollector.translateToLocal("text.recipe.altar.tier"), String.valueOf(tier)), guiLeft + guiBase.xSize / 2, guiTop + 4 * guiBase.ySize / 6, 0);
|
||||
// guiBase.drawCenteredString(fontRenderer, String.format(StatCollector.translateToLocal("text.recipe.altar.bloodRequired"), String.valueOf(bloodRequired)), guiLeft + guiBase.xSize / 2, guiTop + 4 * guiBase.ySize / 6 + 15, 0);
|
||||
// }
|
||||
//}
|
||||
|
|
|
@ -1,145 +1,145 @@
|
|||
package WayofTime.alchemicalWizardry.api.guide;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import amerifrance.guideapi.api.abstraction.CategoryAbstract;
|
||||
import amerifrance.guideapi.api.abstraction.EntryAbstract;
|
||||
import amerifrance.guideapi.api.base.Book;
|
||||
import amerifrance.guideapi.api.base.PageBase;
|
||||
import amerifrance.guideapi.gui.GuiBase;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class PageMultiBlock extends PageBase
|
||||
{
|
||||
ItemStack[][][] structure;
|
||||
boolean canTick = false;
|
||||
int tick = 0;
|
||||
int showLayer = -1;
|
||||
float scaleFactor = 1;
|
||||
|
||||
boolean renderMouseOver = true;
|
||||
|
||||
public PageMultiBlock(ItemStack[][][] structure)
|
||||
{
|
||||
this.structure = structure;
|
||||
initPage(structure);
|
||||
}
|
||||
|
||||
int blockCount=0;
|
||||
int[] countPerLevel;
|
||||
int structureHeight = 0;
|
||||
int structureLength = 0;
|
||||
int structureWidth = 0;
|
||||
|
||||
public void initPage(ItemStack[][][] structure)
|
||||
{
|
||||
structureHeight = structure.length;
|
||||
structureWidth=0;
|
||||
structureLength=0;
|
||||
countPerLevel = new int[structureHeight];
|
||||
blockCount=0;
|
||||
for(int h=0; h<structure.length; h++)
|
||||
{
|
||||
if(structure[h].length-1>structureLength)
|
||||
structureLength = structure[h].length-1;
|
||||
int perLvl=0;
|
||||
for(int l=0; l<structure[h].length; l++)
|
||||
{
|
||||
if(structure[h][l].length-1>structureWidth)
|
||||
structureWidth = structure[h][l].length-1;
|
||||
for(ItemStack ss : structure[h][l])
|
||||
if(ss!=null)
|
||||
perLvl++;
|
||||
}
|
||||
countPerLevel[h] = perLvl;
|
||||
blockCount += perLvl;
|
||||
}
|
||||
tick= (showLayer==-1?blockCount:countPerLevel[showLayer])*40;
|
||||
// int yOff = (structureHeight-1)*12+structureWidth*5+structureLength*5+16;
|
||||
// pageButtons.add(new GuiButtonManualNavigation(gui, 100, x+4,y+yOff/2-5, 10,10, 4));
|
||||
// pageButtons.add(new GuiButtonManualNavigation(gui, 101, x+4,y+yOff/2-8-16, 10,16, 3));
|
||||
// pageButtons.add(new GuiButtonManualNavigation(gui, 102, x+4,y+yOff/2+8, 10,16, 2));
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void draw(Book book, CategoryAbstract category, EntryAbstract entry, int guiLeft, int guiTop, int mouseX, int mouseY, GuiBase guiBase, FontRenderer fontRenderer)
|
||||
{
|
||||
// if(multiblock.getStructureManual()!=null)
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
|
||||
int x = guiLeft + 32;
|
||||
int y = guiTop + 30;
|
||||
{
|
||||
if(canTick)
|
||||
tick++;
|
||||
|
||||
int prevLayers = 0;
|
||||
if(showLayer!=-1)
|
||||
for(int ll=0; ll<showLayer; ll++)
|
||||
prevLayers+=countPerLevel[ll];
|
||||
int limiter = prevLayers+ (tick/40)% ((showLayer==-1?blockCount:countPerLevel[showLayer])+4);
|
||||
|
||||
int xHalf = (structureWidth*5 - structureLength*5);
|
||||
int yOffPartial = (structureHeight-1)*12+structureWidth*5+structureLength*5;
|
||||
// int yOffTotal = yOffPartial+16;
|
||||
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((1-scaleFactor)*(guiLeft + 64), (1-scaleFactor)*(guiTop+60), 0);
|
||||
GL11.glScalef(scaleFactor, scaleFactor, scaleFactor);
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
RenderItem.getInstance().renderWithColor=true;
|
||||
int i=0;
|
||||
ItemStack highlighted = null;
|
||||
for(int h=0; h<structure.length; h++)
|
||||
if(showLayer==-1 || h<=showLayer)
|
||||
{
|
||||
ItemStack[][] level = structure[h];
|
||||
for(int l=level.length-1; l>=0; l--)
|
||||
{
|
||||
ItemStack[] row = level[l];
|
||||
for(int w=row.length-1; w>=0; w--)
|
||||
{
|
||||
int xx = 60 +xHalf -10*w +10*l -7;
|
||||
int yy = yOffPartial - 5*w - 5*l -12*h;
|
||||
GL11.glTranslated(0, 0, 1);
|
||||
if(row[w]!=null && i<=limiter)
|
||||
{
|
||||
i++;
|
||||
RenderItem.getInstance().renderItemIntoGUI(mc.fontRenderer, mc.renderEngine, row[w], x+xx, y+yy);
|
||||
if(mouseX>=x+xx&&mouseX<x+xx+16 && mouseY>=y+yy&&mouseY<y+yy+16)
|
||||
highlighted = row[w];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
GL11.glTranslated(0, 0, -i);
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glPopMatrix();
|
||||
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
|
||||
mc.fontRenderer.setUnicodeFlag(false);
|
||||
if(highlighted!=null && renderMouseOver)
|
||||
guiBase.renderToolTip(highlighted, mouseX, mouseY);
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
|
||||
// mc.fontRenderer.setUnicodeFlag(true);
|
||||
// if(localizedText!=null&&!localizedText.isEmpty())
|
||||
// manual.fontRenderer.drawSplitString(localizedText, x,y+yOffTotal, 120, manual.getTextColour());
|
||||
}
|
||||
}
|
||||
}
|
||||
//package WayofTime.alchemicalWizardry.api.guide;
|
||||
//
|
||||
//import net.minecraft.client.Minecraft;
|
||||
//import net.minecraft.client.gui.FontRenderer;
|
||||
//import net.minecraft.client.renderer.RenderHelper;
|
||||
//import net.minecraft.client.renderer.entity.RenderItem;
|
||||
//import net.minecraft.item.ItemStack;
|
||||
//
|
||||
//import org.lwjgl.opengl.GL11;
|
||||
//import org.lwjgl.opengl.GL12;
|
||||
//
|
||||
//import amerifrance.guideapi.api.abstraction.CategoryAbstract;
|
||||
//import amerifrance.guideapi.api.abstraction.EntryAbstract;
|
||||
//import amerifrance.guideapi.api.base.Book;
|
||||
//import amerifrance.guideapi.api.base.PageBase;
|
||||
//import amerifrance.guideapi.gui.GuiBase;
|
||||
//import cpw.mods.fml.relauncher.Side;
|
||||
//import cpw.mods.fml.relauncher.SideOnly;
|
||||
//
|
||||
//public class PageMultiBlock extends PageBase
|
||||
//{
|
||||
// ItemStack[][][] structure;
|
||||
// boolean canTick = false;
|
||||
// int tick = 0;
|
||||
// int showLayer = -1;
|
||||
// float scaleFactor = 1;
|
||||
//
|
||||
// boolean renderMouseOver = true;
|
||||
//
|
||||
// public PageMultiBlock(ItemStack[][][] structure)
|
||||
// {
|
||||
// this.structure = structure;
|
||||
// initPage(structure);
|
||||
// }
|
||||
//
|
||||
// int blockCount=0;
|
||||
// int[] countPerLevel;
|
||||
// int structureHeight = 0;
|
||||
// int structureLength = 0;
|
||||
// int structureWidth = 0;
|
||||
//
|
||||
// public void initPage(ItemStack[][][] structure)
|
||||
// {
|
||||
// structureHeight = structure.length;
|
||||
// structureWidth=0;
|
||||
// structureLength=0;
|
||||
// countPerLevel = new int[structureHeight];
|
||||
// blockCount=0;
|
||||
// for(int h=0; h<structure.length; h++)
|
||||
// {
|
||||
// if(structure[h].length-1>structureLength)
|
||||
// structureLength = structure[h].length-1;
|
||||
// int perLvl=0;
|
||||
// for(int l=0; l<structure[h].length; l++)
|
||||
// {
|
||||
// if(structure[h][l].length-1>structureWidth)
|
||||
// structureWidth = structure[h][l].length-1;
|
||||
// for(ItemStack ss : structure[h][l])
|
||||
// if(ss!=null)
|
||||
// perLvl++;
|
||||
// }
|
||||
// countPerLevel[h] = perLvl;
|
||||
// blockCount += perLvl;
|
||||
// }
|
||||
// tick= (showLayer==-1?blockCount:countPerLevel[showLayer])*40;
|
||||
//// int yOff = (structureHeight-1)*12+structureWidth*5+structureLength*5+16;
|
||||
//// pageButtons.add(new GuiButtonManualNavigation(gui, 100, x+4,y+yOff/2-5, 10,10, 4));
|
||||
//// pageButtons.add(new GuiButtonManualNavigation(gui, 101, x+4,y+yOff/2-8-16, 10,16, 3));
|
||||
//// pageButtons.add(new GuiButtonManualNavigation(gui, 102, x+4,y+yOff/2+8, 10,16, 2));
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// @SideOnly(Side.CLIENT)
|
||||
// public void draw(Book book, CategoryAbstract category, EntryAbstract entry, int guiLeft, int guiTop, int mouseX, int mouseY, GuiBase guiBase, FontRenderer fontRenderer)
|
||||
// {
|
||||
//// if(multiblock.getStructureManual()!=null)
|
||||
// Minecraft mc = Minecraft.getMinecraft();
|
||||
//
|
||||
// int x = guiLeft + 32;
|
||||
// int y = guiTop + 30;
|
||||
// {
|
||||
// if(canTick)
|
||||
// tick++;
|
||||
//
|
||||
// int prevLayers = 0;
|
||||
// if(showLayer!=-1)
|
||||
// for(int ll=0; ll<showLayer; ll++)
|
||||
// prevLayers+=countPerLevel[ll];
|
||||
// int limiter = prevLayers+ (tick/40)% ((showLayer==-1?blockCount:countPerLevel[showLayer])+4);
|
||||
//
|
||||
// int xHalf = (structureWidth*5 - structureLength*5);
|
||||
// int yOffPartial = (structureHeight-1)*12+structureWidth*5+structureLength*5;
|
||||
//// int yOffTotal = yOffPartial+16;
|
||||
//
|
||||
// GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
//
|
||||
// GL11.glPushMatrix();
|
||||
// GL11.glTranslatef((1-scaleFactor)*(guiLeft + 64), (1-scaleFactor)*(guiTop+60), 0);
|
||||
// GL11.glScalef(scaleFactor, scaleFactor, scaleFactor);
|
||||
// GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
// RenderHelper.enableGUIStandardItemLighting();
|
||||
// RenderItem.getInstance().renderWithColor=true;
|
||||
// int i=0;
|
||||
// ItemStack highlighted = null;
|
||||
// for(int h=0; h<structure.length; h++)
|
||||
// if(showLayer==-1 || h<=showLayer)
|
||||
// {
|
||||
// ItemStack[][] level = structure[h];
|
||||
// for(int l=level.length-1; l>=0; l--)
|
||||
// {
|
||||
// ItemStack[] row = level[l];
|
||||
// for(int w=row.length-1; w>=0; w--)
|
||||
// {
|
||||
// int xx = 60 +xHalf -10*w +10*l -7;
|
||||
// int yy = yOffPartial - 5*w - 5*l -12*h;
|
||||
// GL11.glTranslated(0, 0, 1);
|
||||
// if(row[w]!=null && i<=limiter)
|
||||
// {
|
||||
// i++;
|
||||
// RenderItem.getInstance().renderItemIntoGUI(mc.fontRendererObj, mc.renderEngine, row[w], x+xx, y+yy);
|
||||
// if(mouseX>=x+xx&&mouseX<x+xx+16 && mouseY>=y+yy&&mouseY<y+yy+16)
|
||||
// highlighted = row[w];
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// GL11.glTranslated(0, 0, -i);
|
||||
// RenderHelper.disableStandardItemLighting();
|
||||
// GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
// GL11.glPopMatrix();
|
||||
//
|
||||
// GL11.glEnable(GL11.GL_BLEND);
|
||||
// GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
//
|
||||
// mc.fontRendererObj.setUnicodeFlag(false);
|
||||
// if(highlighted!=null && renderMouseOver)
|
||||
// guiBase.renderToolTip(highlighted, mouseX, mouseY);
|
||||
// RenderHelper.disableStandardItemLighting();
|
||||
//
|
||||
//// mc.fontRendererObj.setUnicodeFlag(true);
|
||||
//// if(localizedText!=null&&!localizedText.isEmpty())
|
||||
//// manual.fontRendererObj.drawSplitString(localizedText, x,y+yOffTotal, 120, manual.getTextColour());
|
||||
// }
|
||||
// }
|
||||
//}
|
|
@ -1,22 +1,23 @@
|
|||
package WayofTime.alchemicalWizardry.api.guide;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.Rituals;
|
||||
|
||||
public class PageRitualMultiBlock extends PageMultiBlock
|
||||
{
|
||||
private static ItemStack blankStone;
|
||||
private static ItemStack waterStone;
|
||||
private static ItemStack fireStone;
|
||||
private static ItemStack earthStone;
|
||||
private static ItemStack airStone;
|
||||
private static ItemStack duskStone;
|
||||
private static ItemStack dawnStone;
|
||||
static
|
||||
{
|
||||
//package WayofTime.alchemicalWizardry.api.guide;
|
||||
//
|
||||
//import java.util.List;
|
||||
//
|
||||
//import net.minecraft.item.ItemStack;
|
||||
//import WayofTime.alchemicalWizardry.ModBlocks;
|
||||
//import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
|
||||
//import WayofTime.alchemicalWizardry.api.rituals.Rituals;
|
||||
//
|
||||
//public class PageRitualMultiBlock extends PageMultiBlock
|
||||
//{
|
||||
// private static ItemStack blankStone;
|
||||
// private static ItemStack waterStone;
|
||||
// private static ItemStack fireStone;
|
||||
// private static ItemStack earthStone;
|
||||
// private static ItemStack airStone;
|
||||
// private static ItemStack duskStone;
|
||||
// private static ItemStack dawnStone;
|
||||
// static
|
||||
// {
|
||||
// blankStone = new ItemStack(ModBlocks.ritualStone, 1, RitualComponent.BLANK);
|
||||
// waterStone = new ItemStack(ModBlocks.ritualStone, 1, RitualComponent.WATER);
|
||||
// fireStone = new ItemStack(ModBlocks.ritualStone, 1, RitualComponent.FIRE);
|
||||
|
@ -24,72 +25,72 @@ public class PageRitualMultiBlock extends PageMultiBlock
|
|||
// airStone = new ItemStack(ModBlocks.ritualStone, 1, RitualComponent.AIR);
|
||||
// duskStone = new ItemStack(ModBlocks.ritualStone, 1, RitualComponent.DUSK);
|
||||
// dawnStone = new ItemStack(ModBlocks.ritualStone, 1, RitualComponent.DAWN);
|
||||
}
|
||||
|
||||
private PageRitualMultiBlock(ItemStack[][][] structure)
|
||||
{
|
||||
super(structure);
|
||||
}
|
||||
|
||||
public static PageRitualMultiBlock getPageForRitual(String ritualID)
|
||||
{
|
||||
return getPageForRitual(Rituals.getRitualList(ritualID));
|
||||
}
|
||||
|
||||
public static PageRitualMultiBlock getPageForRitual(List<RitualComponent> ritualComponents)
|
||||
{
|
||||
int minX = 0;
|
||||
int minY = 0;
|
||||
int minZ = 0;
|
||||
|
||||
int maxX = 0;
|
||||
int maxY = 0;
|
||||
int maxZ = 0;
|
||||
|
||||
for(RitualComponent comp : ritualComponents)
|
||||
{
|
||||
minX = Math.min(comp.getX(), minX);
|
||||
minY = Math.min(comp.getY(), minY);
|
||||
minZ = Math.min(comp.getZ(), minZ);
|
||||
|
||||
maxX = Math.max(comp.getX(), maxX);
|
||||
maxY = Math.max(comp.getY(), maxY);
|
||||
maxZ = Math.max(comp.getZ(), maxZ);
|
||||
}
|
||||
|
||||
System.out.println("Min: (" + minX + ", " + minY + ", " + minZ + "), Max: (" + maxX + ", " + maxY + ", " + maxZ + ")");
|
||||
|
||||
ItemStack[][][] tempStructure = new ItemStack[maxY-minY+1][maxX-minX+1][maxZ-minZ+1]; //First value is vertical, second is down to the left, third is down to the right
|
||||
|
||||
for(RitualComponent comp : ritualComponents)
|
||||
{
|
||||
tempStructure[comp.getY() - minY][comp.getX() - minX][comp.getZ() - minZ] = getStackForRitualStone(comp.getStoneType());
|
||||
}
|
||||
|
||||
// }
|
||||
//
|
||||
// private PageRitualMultiBlock(ItemStack[][][] structure)
|
||||
// {
|
||||
// super(structure);
|
||||
// }
|
||||
//
|
||||
// public static PageRitualMultiBlock getPageForRitual(String ritualID)
|
||||
// {
|
||||
// return getPageForRitual(Rituals.getRitualList(ritualID));
|
||||
// }
|
||||
//
|
||||
// public static PageRitualMultiBlock getPageForRitual(List<RitualComponent> ritualComponents)
|
||||
// {
|
||||
// int minX = 0;
|
||||
// int minY = 0;
|
||||
// int minZ = 0;
|
||||
//
|
||||
// int maxX = 0;
|
||||
// int maxY = 0;
|
||||
// int maxZ = 0;
|
||||
//
|
||||
// for(RitualComponent comp : ritualComponents)
|
||||
// {
|
||||
// minX = Math.min(comp.getX(), minX);
|
||||
// minY = Math.min(comp.getY(), minY);
|
||||
// minZ = Math.min(comp.getZ(), minZ);
|
||||
//
|
||||
// maxX = Math.max(comp.getX(), maxX);
|
||||
// maxY = Math.max(comp.getY(), maxY);
|
||||
// maxZ = Math.max(comp.getZ(), maxZ);
|
||||
// }
|
||||
//
|
||||
// System.out.println("Min: (" + minX + ", " + minY + ", " + minZ + "), Max: (" + maxX + ", " + maxY + ", " + maxZ + ")");
|
||||
//
|
||||
// ItemStack[][][] tempStructure = new ItemStack[maxY-minY+1][maxX-minX+1][maxZ-minZ+1]; //First value is vertical, second is down to the left, third is down to the right
|
||||
//
|
||||
// for(RitualComponent comp : ritualComponents)
|
||||
// {
|
||||
// tempStructure[comp.getY() - minY][comp.getX() - minX][comp.getZ() - minZ] = getStackForRitualStone(comp.getStoneType());
|
||||
// }
|
||||
//
|
||||
// tempStructure[-minY][-minX][-minZ] = new ItemStack(ModBlocks.blockMasterStone);
|
||||
|
||||
return new PageRitualMultiBlock(tempStructure);
|
||||
}
|
||||
|
||||
private static ItemStack getStackForRitualStone(int type)
|
||||
{
|
||||
switch(type)
|
||||
{
|
||||
case RitualComponent.BLANK:
|
||||
return blankStone;
|
||||
case RitualComponent.WATER:
|
||||
return waterStone;
|
||||
case RitualComponent.FIRE:
|
||||
return fireStone;
|
||||
case RitualComponent.EARTH:
|
||||
return earthStone;
|
||||
case RitualComponent.AIR:
|
||||
return airStone;
|
||||
case RitualComponent.DUSK:
|
||||
return duskStone;
|
||||
case RitualComponent.DAWN:
|
||||
return dawnStone;
|
||||
}
|
||||
return blankStone;
|
||||
}
|
||||
}
|
||||
//
|
||||
// return new PageRitualMultiBlock(tempStructure);
|
||||
// }
|
||||
//
|
||||
// private static ItemStack getStackForRitualStone(int type)
|
||||
// {
|
||||
// switch(type)
|
||||
// {
|
||||
// case RitualComponent.BLANK:
|
||||
// return blankStone;
|
||||
// case RitualComponent.WATER:
|
||||
// return waterStone;
|
||||
// case RitualComponent.FIRE:
|
||||
// return fireStone;
|
||||
// case RitualComponent.EARTH:
|
||||
// return earthStone;
|
||||
// case RitualComponent.AIR:
|
||||
// return airStone;
|
||||
// case RitualComponent.DUSK:
|
||||
// return duskStone;
|
||||
// case RitualComponent.DAWN:
|
||||
// return dawnStone;
|
||||
// }
|
||||
// return blankStone;
|
||||
// }
|
||||
//}
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
package WayofTime.alchemicalWizardry.api.harvest;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class HarvestRegistry
|
||||
{
|
||||
public static List<IHarvestHandler> handlerList = new ArrayList();
|
||||
|
@ -15,14 +17,14 @@ public class HarvestRegistry
|
|||
handlerList.add(handler);
|
||||
}
|
||||
|
||||
public static boolean harvestBlock(World world, int xCoord, int yCoord, int zCoord)
|
||||
public static boolean harvestBlock(World world, BlockPos pos)
|
||||
{
|
||||
Block block = world.getBlock(xCoord, yCoord, zCoord);
|
||||
int meta = world.getBlockMetadata(xCoord, yCoord, zCoord);
|
||||
IBlockState state = world.getBlockState(pos);
|
||||
Block block = state.getBlock();
|
||||
|
||||
for (IHarvestHandler handler : handlerList)
|
||||
{
|
||||
if (handler.harvestAndPlant(world, xCoord, yCoord, zCoord, block, meta))
|
||||
if (handler.harvestAndPlant(world, pos, block, state))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package WayofTime.alchemicalWizardry.api.harvest;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IHarvestHandler
|
||||
|
@ -9,12 +11,8 @@ public interface IHarvestHandler
|
|||
* A handler that is used to harvest and replant the block at the specified location
|
||||
*
|
||||
* @param world
|
||||
* @param xCoord
|
||||
* @param yCoord
|
||||
* @param zCoord
|
||||
* @param block block at this given location
|
||||
* @param meta meta at this given location
|
||||
* @return true if successfully harvested, false if not
|
||||
*/
|
||||
boolean harvestAndPlant(World world, int xCoord, int yCoord, int zCoord, Block block, int meta);
|
||||
boolean harvestAndPlant(World world, BlockPos pos, Block block, IBlockState state);
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ import java.util.Set;
|
|||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
|
@ -18,6 +19,7 @@ import net.minecraft.item.Item;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
|
@ -98,7 +100,7 @@ public class ItemSpellMultiTool extends Item
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockStartBreak(ItemStack stack, int x, int y, int z, EntityPlayer player)
|
||||
public boolean onBlockStartBreak(ItemStack stack, BlockPos pos, EntityPlayer player)
|
||||
{
|
||||
if (player.worldObj.isRemote)
|
||||
{
|
||||
|
@ -109,23 +111,23 @@ public class ItemSpellMultiTool extends Item
|
|||
return false;
|
||||
|
||||
World world = player.worldObj;
|
||||
Block block = player.worldObj.getBlock(x, y, z);
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
IBlockState state = world.getBlockState(pos);
|
||||
Block block = state.getBlock();
|
||||
if (block == null || block == Blocks.air)
|
||||
return false;
|
||||
int hlvl = -1;
|
||||
float blockHardness = block.getBlockHardness(world, x, y, z);
|
||||
float blockHardness = block.getBlockHardness(world, pos);
|
||||
|
||||
MovingObjectPosition mop = APISpellHelper.raytraceFromEntity(world, player, true, 5.0D);
|
||||
|
||||
Block localBlock = world.getBlock(x, y, z);
|
||||
int localMeta = world.getBlockMetadata(x, y, z);
|
||||
String toolClass = block.getHarvestTool(meta);
|
||||
IBlockState localState = world.getBlockState(pos);
|
||||
Block localBlock = state.getBlock();
|
||||
String toolClass = block.getHarvestTool(state);
|
||||
if (toolClass != null && this.getHarvestLevel(stack, toolClass) != -1)
|
||||
hlvl = block.getHarvestLevel(meta);
|
||||
hlvl = block.getHarvestLevel(state);
|
||||
int toolLevel = this.getHarvestLevel(stack, toolClass);
|
||||
|
||||
float localHardness = localBlock == null ? Float.MAX_VALUE : localBlock.getBlockHardness(world, x, y, z);
|
||||
float localHardness = localBlock == null ? Float.MAX_VALUE : localBlock.getBlockHardness(world, pos);
|
||||
|
||||
if (hlvl <= toolLevel && localHardness - 1.5 <= blockHardness)
|
||||
{
|
||||
|
@ -139,7 +141,7 @@ public class ItemSpellMultiTool extends Item
|
|||
|
||||
String localToolClass = this.getToolClassForMaterial(localBlock.getMaterial());
|
||||
|
||||
if (localToolClass != null && this.getHarvestLevel(stack, toolClass) >= localBlock.getHarvestLevel(localMeta))
|
||||
if (localToolClass != null && this.getHarvestLevel(stack, toolClass) >= localBlock.getHarvestLevel(localState))
|
||||
{
|
||||
isEffective = true;
|
||||
}
|
||||
|
@ -154,31 +156,31 @@ public class ItemSpellMultiTool extends Item
|
|||
{
|
||||
if (isEffective)
|
||||
{
|
||||
if (localBlock.removedByPlayer(world, player, x, y, z, true))
|
||||
if (localBlock.removedByPlayer(world, pos, player, true))
|
||||
{
|
||||
localBlock.onBlockDestroyedByPlayer(world, x, y, z, localMeta);
|
||||
localBlock.onBlockDestroyedByPlayer(world, pos, localState);
|
||||
}
|
||||
localBlock.onBlockHarvested(world, x, y, z, localMeta, player);
|
||||
localBlock.onBlockHarvested(world, pos, localState, player);
|
||||
if (blockHardness > 0f)
|
||||
onBlockDestroyed(stack, world, localBlock, x, y, z, player);
|
||||
onBlockDestroyed(stack, world, localBlock, pos, player);
|
||||
|
||||
List<ItemStack> items = APISpellHelper.getItemsFromBlock(world, localBlock, x, y, z, localMeta, this.getSilkTouch(stack), this.getFortuneLevel(stack));
|
||||
List<ItemStack> items = APISpellHelper.getItemsFromBlock(world, pos, localBlock, localState, this.getSilkTouch(stack), this.getFortuneLevel(stack));
|
||||
|
||||
SpellParadigmTool parad = this.loadParadigmFromStack(stack);
|
||||
List<ItemStack> newItems = parad.handleItemList(stack, items);
|
||||
|
||||
if (!world.isRemote)
|
||||
{
|
||||
APISpellHelper.spawnItemListInWorld(newItems, world, x + 0.5f, y + 0.5f, z + 0.5f);
|
||||
APISpellHelper.spawnItemListInWorld(newItems, world, pos.getX() + 0.5f, pos.getY() + 0.5f, pos.getZ() + 0.5f);
|
||||
}
|
||||
|
||||
world.func_147479_m(x, y, z);
|
||||
world.markBlockForUpdate(pos);
|
||||
|
||||
int cost = 0;
|
||||
|
||||
cost += parad.digSurroundingArea(stack, world, player, mop, localToolClass, localHardness, toolLevel, this);
|
||||
|
||||
cost += parad.onBreakBlock(stack, world, player, localBlock, localMeta, x, y, z, ForgeDirection.getOrientation(mop.sideHit));
|
||||
cost += parad.onBreakBlock(stack, world, player, localBlock, localState, pos, mop.field_178784_b);
|
||||
|
||||
if (cost > 0)
|
||||
{
|
||||
|
@ -186,14 +188,14 @@ public class ItemSpellMultiTool extends Item
|
|||
}
|
||||
} else
|
||||
{
|
||||
world.setBlockToAir(x, y, z);
|
||||
world.func_147479_m(x, y, z);
|
||||
world.setBlockToAir(pos);
|
||||
world.markBlockForUpdate(pos);
|
||||
}
|
||||
|
||||
} else
|
||||
{
|
||||
world.setBlockToAir(x, y, z);
|
||||
world.func_147479_m(x, y, z);
|
||||
world.setBlockToAir(pos);
|
||||
world.markBlockForUpdate(pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -279,18 +281,14 @@ public class ItemSpellMultiTool extends Item
|
|||
}
|
||||
|
||||
@Override
|
||||
public float getDigSpeed(ItemStack stack, Block block, int meta)
|
||||
public float getDigSpeed(ItemStack stack, IBlockState state)
|
||||
{
|
||||
String toolClass = block.getHarvestTool(meta);
|
||||
Block block = state.getBlock();
|
||||
String toolClass = block.getHarvestTool(state);
|
||||
|
||||
if (toolClass == null || toolClass.equals(""))
|
||||
{
|
||||
toolClass = getToolClassOfMaterial(block.getMaterial());
|
||||
|
||||
if(toolClass == "")
|
||||
{
|
||||
return 1.0f;
|
||||
}
|
||||
return 1.0f;
|
||||
}
|
||||
{
|
||||
if (stack.hasTagCompound())
|
||||
|
@ -306,26 +304,6 @@ public class ItemSpellMultiTool extends Item
|
|||
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
public String getToolClassOfMaterial(Material mat)
|
||||
{
|
||||
if(mat == Material.iron || mat == Material.anvil || mat == Material.rock)
|
||||
{
|
||||
return "pickaxe";
|
||||
}
|
||||
|
||||
if(mat == Material.wood || mat == Material.plants || mat == Material.vine)
|
||||
{
|
||||
return "axe";
|
||||
}
|
||||
|
||||
if(mat == Material.ground || mat == Material.grass)
|
||||
{
|
||||
return "shovel";
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHarvestLevel(ItemStack stack, String toolClass)
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
package WayofTime.alchemicalWizardry.api.items;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.Item;
|
||||
|
@ -9,12 +14,7 @@ import net.minecraft.item.crafting.IRecipe;
|
|||
import net.minecraft.item.crafting.ShapedRecipes;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb;
|
||||
|
||||
/**
|
||||
* Shaped Blood Orb Recipe Handler by joshie *
|
||||
|
@ -278,4 +278,10 @@ public class ShapedBloodOrbRecipe implements IRecipe
|
|||
{
|
||||
return this.input;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack[] func_179532_b(InventoryCrafting inventory)
|
||||
{
|
||||
return new ItemStack[1];
|
||||
}
|
||||
}
|
|
@ -177,4 +177,10 @@ public class ShapelessBloodOrbRecipe implements IRecipe
|
|||
{
|
||||
return this.input;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack[] func_179532_b(InventoryCrafting inventory)
|
||||
{
|
||||
return new ItemStack[1];
|
||||
}
|
||||
}
|
|
@ -1,7 +1,6 @@
|
|||
package WayofTime.alchemicalWizardry.api.renderer;
|
||||
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
|
||||
|
||||
|
@ -9,13 +8,8 @@ public abstract class MRSRenderer
|
|||
{
|
||||
public abstract void renderAt(IMasterRitualStone tile, double x, double y, double z);
|
||||
|
||||
protected void bindTexture(ResourceLocation p_147499_1_)
|
||||
protected void bindTexture(ResourceLocation location)
|
||||
{
|
||||
TextureManager texturemanager = TileEntityRendererDispatcher.instance.field_147553_e;
|
||||
|
||||
if (texturemanager != null)
|
||||
{
|
||||
texturemanager.bindTexture(p_147499_1_);
|
||||
}
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(location);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
package WayofTime.alchemicalWizardry.api.rituals;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.alchemy.energy.ISegmentedReagentHandler;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.api.alchemy.energy.ISegmentedReagentHandler;
|
||||
|
||||
public interface IMasterRitualStone extends ISegmentedReagentHandler
|
||||
{
|
||||
void performRitual(World world, int x, int y, int z, String ritualID);
|
||||
void performRitual(World world, BlockPos pos, String ritualID);
|
||||
|
||||
String getOwner();
|
||||
|
||||
|
@ -22,13 +23,9 @@ public interface IMasterRitualStone extends ISegmentedReagentHandler
|
|||
|
||||
int getDirection();
|
||||
|
||||
World getWorld();
|
||||
World getWorldObj();
|
||||
|
||||
int getXCoord();
|
||||
|
||||
int getYCoord();
|
||||
|
||||
int getZCoord();
|
||||
BlockPos getPosition();
|
||||
|
||||
NBTTagCompound getCustomRitualTag();
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package WayofTime.alchemicalWizardry.api.rituals;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IRitualStone
|
||||
|
@ -7,12 +9,10 @@ public interface IRitualStone
|
|||
/**
|
||||
* x, y, and z give the position of the Ritual Stone
|
||||
* @param world
|
||||
* @param x
|
||||
* @param y
|
||||
* @param z
|
||||
* @param meta
|
||||
* @param pos
|
||||
* @param state
|
||||
* @param runeType
|
||||
* @return
|
||||
*/
|
||||
boolean isRuneType(World world, int x, int y, int z, int meta, int runeType);
|
||||
boolean isRuneType(World world, BlockPos pos, IBlockState state, int runeType);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package WayofTime.alchemicalWizardry.api.rituals;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import WayofTime.alchemicalWizardry.api.Int3;
|
||||
import net.minecraft.util.BlockPos;
|
||||
|
||||
/**
|
||||
* This class is used to pass ritual-specific data into the RitualEffect from the containing Master Ritual Stone. This is basically used as auxillarary storage,
|
||||
|
@ -10,33 +10,27 @@ import WayofTime.alchemicalWizardry.api.Int3;
|
|||
*/
|
||||
public class LocalRitualStorage
|
||||
{
|
||||
public int xCoord;
|
||||
public int yCoord;
|
||||
public int zCoord;
|
||||
public BlockPos coords;
|
||||
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
tag.setInteger("xCoord", xCoord);
|
||||
tag.setInteger("yCoord", yCoord);
|
||||
tag.setInteger("zCoord", zCoord);
|
||||
tag.setInteger("xCoord", coords.getX());
|
||||
tag.setInteger("yCoord", coords.getY());
|
||||
tag.setInteger("zCoord", coords.getZ());
|
||||
}
|
||||
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
this.xCoord = tag.getInteger("xCoord");
|
||||
this.yCoord = tag.getInteger("yCoord");
|
||||
this.zCoord = tag.getInteger("zCoord");
|
||||
this.coords = new BlockPos(tag.getInteger("xCoord"), tag.getInteger("yCoord"), tag.getInteger("zCoord"));
|
||||
}
|
||||
|
||||
public Int3 getLocation()
|
||||
public BlockPos getLocation()
|
||||
{
|
||||
return new Int3(xCoord, yCoord, zCoord);
|
||||
return coords;
|
||||
}
|
||||
|
||||
public void setLocation(Int3 location)
|
||||
public void setLocation(BlockPos location)
|
||||
{
|
||||
this.xCoord = location.xCoord;
|
||||
this.yCoord = location.yCoord;
|
||||
this.zCoord = location.zCoord;
|
||||
this.coords = location;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent;
|
||||
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentStack;
|
||||
|
||||
|
@ -40,13 +40,13 @@ public abstract class RitualEffect
|
|||
|
||||
ReagentStack reagentStack = new ReagentStack(reagent, amount);
|
||||
|
||||
ReagentStack stack = ritualStone.drain(ForgeDirection.UNKNOWN, reagentStack, false);
|
||||
ReagentStack stack = ritualStone.drain(EnumFacing.UP, reagentStack, false);
|
||||
|
||||
if (stack != null && stack.amount >= amount)
|
||||
{
|
||||
if (doDrain)
|
||||
{
|
||||
ritualStone.drain(ForgeDirection.UNKNOWN, reagentStack, true);
|
||||
ritualStone.drain(EnumFacing.UP, reagentStack, true);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -6,14 +6,16 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
import WayofTime.alchemicalWizardry.api.event.RitualRunEvent;
|
||||
import WayofTime.alchemicalWizardry.api.event.RitualStopEvent;
|
||||
import WayofTime.alchemicalWizardry.api.renderer.MRSRenderer;
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
|
||||
public class Rituals
|
||||
{
|
||||
|
@ -95,11 +97,11 @@ public class Rituals
|
|||
}
|
||||
}
|
||||
|
||||
public static String checkValidRitual(World world, int x, int y, int z)
|
||||
public static String checkValidRitual(World world, BlockPos pos)
|
||||
{
|
||||
for (String key : ritualMap.keySet())
|
||||
{
|
||||
if (checkRitualIsValid(world, x, y, z, key))
|
||||
if (checkRitualIsValid(world, pos, key))
|
||||
{
|
||||
return key;
|
||||
}
|
||||
|
@ -122,9 +124,9 @@ public class Rituals
|
|||
return false;
|
||||
}
|
||||
|
||||
public static boolean checkRitualIsValid(World world, int x, int y, int z, String ritualID)
|
||||
public static boolean checkRitualIsValid(World world, BlockPos pos, String ritualID)
|
||||
{
|
||||
int direction = Rituals.getDirectionOfRitual(world, x, y, z, ritualID);
|
||||
int direction = Rituals.getDirectionOfRitual(world, pos, ritualID);
|
||||
|
||||
return direction != -1;
|
||||
}
|
||||
|
@ -135,7 +137,7 @@ public class Rituals
|
|||
* 3 - SOUTH
|
||||
* 4 - WEST
|
||||
*/
|
||||
public static boolean checkDirectionOfRitualValid(World world, int x, int y, int z, String ritualID, int direction)
|
||||
public static boolean checkDirectionOfRitualValid(World world, BlockPos pos, String ritualID, int direction)
|
||||
{
|
||||
List<RitualComponent> ritual = Rituals.getRitualList(ritualID);
|
||||
|
||||
|
@ -144,15 +146,18 @@ public class Rituals
|
|||
return false;
|
||||
}
|
||||
|
||||
IBlockState testState;
|
||||
Block test;
|
||||
TileEntity te;
|
||||
|
||||
for (RitualComponent rc : ritual)
|
||||
{
|
||||
test = world.getBlock(x + rc.getX(direction), y + rc.getY(), z + rc.getZ(direction));
|
||||
te = world.getTileEntity(x + rc.getX(direction), y + rc.getY(), z + rc.getZ(direction));
|
||||
BlockPos newPos = pos.add(rc.getX(direction), rc.getY(), rc.getZ(direction));
|
||||
testState = world.getBlockState(newPos);
|
||||
test = testState.getBlock();
|
||||
te = world.getTileEntity(newPos);
|
||||
|
||||
if (!(test instanceof IRitualStone && ((IRitualStone)test).isRuneType(world, x + rc.getX(direction), y, z+ rc.getZ(direction), world.getBlockMetadata(x + rc.getX(direction), y + rc.getY(), z + rc.getZ(direction)), rc.getStoneType()))
|
||||
if (!(test instanceof IRitualStone && ((IRitualStone)test).isRuneType(world, newPos, testState, rc.getStoneType()))
|
||||
&& !(te instanceof ITileRitualStone && ((ITileRitualStone)te).isRuneType(rc.getStoneType())))
|
||||
{
|
||||
return false;
|
||||
|
@ -162,11 +167,11 @@ public class Rituals
|
|||
return true;
|
||||
}
|
||||
|
||||
public static int getDirectionOfRitual(World world, int x, int y, int z, String ritualID)
|
||||
public static int getDirectionOfRitual(World world, BlockPos pos, String ritualID)
|
||||
{
|
||||
for (int i = 1; i <= 4; i++)
|
||||
{
|
||||
if (Rituals.checkDirectionOfRitualValid(world, x, y, z, ritualID, i))
|
||||
if (Rituals.checkDirectionOfRitualValid(world, pos, ritualID, i))
|
||||
{
|
||||
return i;
|
||||
}
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
package WayofTime.alchemicalWizardry.api.sacrifice;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.api.spell.APISpellHelper;
|
||||
import WayofTime.alchemicalWizardry.api.tile.IBloodAltar;
|
||||
|
||||
|
@ -12,7 +13,6 @@ public class PlayerSacrificeHandler
|
|||
{
|
||||
public static float scalingOfSacrifice = 0.001f;
|
||||
public static int soulFrayDuration = 400;
|
||||
public static Potion soulFrayId;
|
||||
public static float getPlayerIncense(EntityPlayer player)
|
||||
{
|
||||
return APISpellHelper.getCurrentIncense(player);
|
||||
|
@ -41,7 +41,7 @@ public class PlayerSacrificeHandler
|
|||
|
||||
public static boolean sacrificePlayerHealth(EntityPlayer player)
|
||||
{
|
||||
if(player.isPotionActive(soulFrayId))
|
||||
if(player.isPotionActive(AlchemicalWizardry.customPotionSoulFray))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ public class PlayerSacrificeHandler
|
|||
{
|
||||
player.setHealth(maxHealth/10.0f);
|
||||
setPlayerIncense(player, 0);
|
||||
player.addPotionEffect(new PotionEffect(soulFrayId.id, soulFrayDuration));
|
||||
player.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionSoulFray.id, soulFrayDuration));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -78,10 +78,7 @@ public class PlayerSacrificeHandler
|
|||
|
||||
public static boolean findAndFillAltar(World world, EntityPlayer player, int amount)
|
||||
{
|
||||
int posX = (int) Math.round(player.posX - 0.5f);
|
||||
int posY = (int) player.posY;
|
||||
int posZ = (int) Math.round(player.posZ - 0.5f);
|
||||
IBloodAltar altarEntity = getAltar(world, posX, posY, posZ);
|
||||
IBloodAltar altarEntity = getAltar(world, player.getPosition());
|
||||
|
||||
if (altarEntity == null)
|
||||
{
|
||||
|
@ -94,7 +91,7 @@ public class PlayerSacrificeHandler
|
|||
return true;
|
||||
}
|
||||
|
||||
public static IBloodAltar getAltar(World world, int x, int y, int z)
|
||||
public static IBloodAltar getAltar(World world, BlockPos pos)
|
||||
{
|
||||
TileEntity tileEntity;
|
||||
|
||||
|
@ -104,7 +101,7 @@ public class PlayerSacrificeHandler
|
|||
{
|
||||
for (int k = -2; k <= 1; k++)
|
||||
{
|
||||
tileEntity = world.getTileEntity(i + x, k + y, j + z);
|
||||
tileEntity = world.getTileEntity(pos.add(i, j, k));
|
||||
|
||||
if(tileEntity instanceof IBloodAltar)
|
||||
{
|
||||
|
|
|
@ -12,11 +12,9 @@ import java.util.Map.Entry;
|
|||
import java.util.UUID;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -30,41 +28,12 @@ public class ComplexNetworkHandler
|
|||
{
|
||||
return player.getPersistentID();
|
||||
}
|
||||
|
||||
public static EntityPlayer getPlayerFromUUID(UUID uuid)
|
||||
{
|
||||
MinecraftServer server = MinecraftServer.getServer();
|
||||
GameProfile gameProfile;
|
||||
gameProfile = server.func_152358_ax().func_152652_a(uuid);
|
||||
String str = uuid.toString();
|
||||
//TODO ServerConfigurationManager d.createPlayerForUser
|
||||
UUID.fromString(str);
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String getKeyForPlayer(EntityPlayer player)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
public static UUID getUUIDForKey(String key)
|
||||
{
|
||||
// if (MinecraftServer.getServer() == null)
|
||||
// {
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// World world = MinecraftServer.getServer().worldServers[0];
|
||||
// UUIDKeyMap data = (UUIDKeyMap) world.loadItemData(UUIDKeyMap.class, key);
|
||||
//
|
||||
// if (data == null)
|
||||
// {
|
||||
// data = new UUIDKeyMap(key);
|
||||
// world.setItemData(key, data);
|
||||
// }
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String assignKeyToPlayer(EntityPlayer player)
|
||||
{
|
||||
return "";
|
||||
|
|
|
@ -9,13 +9,13 @@ import net.minecraft.server.MinecraftServer;
|
|||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event.Result;
|
||||
import WayofTime.alchemicalWizardry.api.event.AddToNetworkEvent;
|
||||
import WayofTime.alchemicalWizardry.api.event.ItemBindEvent;
|
||||
import WayofTime.alchemicalWizardry.api.event.ItemDrainInContainerEvent;
|
||||
import WayofTime.alchemicalWizardry.api.event.ItemDrainNetworkEvent;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
import cpw.mods.fml.common.eventhandler.Event.Result;
|
||||
|
||||
public class SoulNetworkHandler
|
||||
{
|
||||
|
@ -396,7 +396,7 @@ public class SoulNetworkHandler
|
|||
|
||||
public static String getUsername(EntityPlayer player)
|
||||
{
|
||||
return player.getCommandSenderName();
|
||||
return player.getName();
|
||||
}
|
||||
|
||||
public static EntityPlayer getPlayerForUsername(String str)
|
||||
|
@ -405,7 +405,7 @@ public class SoulNetworkHandler
|
|||
{
|
||||
return null;
|
||||
}
|
||||
return MinecraftServer.getServer().getConfigurationManager().func_152612_a(str);
|
||||
return MinecraftServer.getServer().getConfigurationManager().getPlayerByUsername(str);
|
||||
}
|
||||
|
||||
public static void causeNauseaToPlayer(ItemStack stack)
|
||||
|
|
|
@ -4,6 +4,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
@ -13,6 +14,7 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
|
@ -230,7 +232,7 @@ public class APISpellHelper
|
|||
if (!world.isRemote && player instanceof EntityPlayer)
|
||||
d1 += 1.62D;
|
||||
double d2 = player.prevPosZ + (player.posZ - player.prevPosZ) * (double) f;
|
||||
Vec3 vec3 = APISpellHelper.createVec3(d0, d1, d2);
|
||||
Vec3 vec3 = new Vec3(d0, d1, d2);
|
||||
float f3 = MathHelper.cos(-f2 * 0.017453292F - (float) Math.PI);
|
||||
float f4 = MathHelper.sin(-f2 * 0.017453292F - (float) Math.PI);
|
||||
float f5 = -MathHelper.cos(-f1 * 0.017453292F);
|
||||
|
@ -242,56 +244,33 @@ public class APISpellHelper
|
|||
// d3 = ((EntityPlayerMP) player).theItemInWorldManager.getBlockReachDistance();
|
||||
}
|
||||
Vec3 vec31 = vec3.addVector((double) f7 * range, (double) f6 * range, (double) f8 * range);
|
||||
return world.func_147447_a(vec3, vec31, par3, !par3, par3);
|
||||
return world.rayTraceBlocks(vec3, vec31, par3, !par3, par3);
|
||||
}
|
||||
|
||||
public static Vec3 createVec3(double x, double y, double z)
|
||||
{
|
||||
return Vec3.createVectorHelper(x, y, z);
|
||||
}
|
||||
|
||||
public static List<ItemStack> getItemsFromBlock(World world, Block block, int x, int y, int z, int meta, boolean silkTouch, int fortune)
|
||||
public static List<ItemStack> getItemsFromBlock(World world, BlockPos pos, Block block, IBlockState state, boolean silkTouch, int fortune)
|
||||
{
|
||||
boolean canSilk = block.canSilkHarvest(world, null, x, y, z, meta);
|
||||
boolean canSilk = block.canSilkHarvest(world, pos, state, null); //Null player
|
||||
|
||||
if (canSilk && silkTouch)
|
||||
{
|
||||
ArrayList<ItemStack> items = new ArrayList<ItemStack>();
|
||||
ItemStack item = createStackedBlock(block, meta);
|
||||
|
||||
ItemStack item = new ItemStack(block, 1, block.getMetaFromState(state));
|
||||
|
||||
items.add(item);
|
||||
|
||||
return items;
|
||||
} else
|
||||
{
|
||||
return block.getDrops(world, x, y, z, meta, fortune);
|
||||
return block.getDrops(world, pos, state, fortune);
|
||||
}
|
||||
}
|
||||
|
||||
public static ItemStack createStackedBlock(Block block, int meta)
|
||||
{
|
||||
int j = 0;
|
||||
if(block == Blocks.lit_redstone_ore)
|
||||
{
|
||||
block = Blocks.redstone_ore;
|
||||
}
|
||||
|
||||
Item item = Item.getItemFromBlock(block);
|
||||
|
||||
if (item != null && item.getHasSubtypes())
|
||||
{
|
||||
j = meta;
|
||||
}
|
||||
|
||||
return new ItemStack(item, 1, j);
|
||||
}
|
||||
|
||||
public static void spawnItemListInWorld(List<ItemStack> items, World world, float x, float y, float z)
|
||||
{
|
||||
for (ItemStack stack : items)
|
||||
{
|
||||
EntityItem itemEntity = new EntityItem(world, x, y, z, stack);
|
||||
itemEntity.delayBeforeCanPickup = 10;
|
||||
itemEntity.setDefaultPickupDelay();
|
||||
world.spawnEntityInWorld(itemEntity);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,13 +6,17 @@ import java.util.LinkedList;
|
|||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.IProjectile;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
|
@ -58,7 +62,6 @@ public class EntitySpellProjectile extends Entity implements IProjectile
|
|||
super(par1World);
|
||||
this.setSize(0.5F, 0.5F);
|
||||
this.setPosition(par2, par4, par6);
|
||||
yOffset = 0.0F;
|
||||
}
|
||||
|
||||
public EntitySpellProjectile(World par1World, EntityPlayer par2EntityPlayer)
|
||||
|
@ -72,7 +75,6 @@ public class EntitySpellProjectile extends Entity implements IProjectile
|
|||
posY -= 0.2D;
|
||||
posZ -= MathHelper.sin(rotationYaw / 180.0F * (float) Math.PI) * 0.16F;
|
||||
this.setPosition(posX, posY, posZ);
|
||||
yOffset = 0.0F;
|
||||
motionX = -MathHelper.sin(rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(rotationPitch / 180.0F * (float) Math.PI);
|
||||
motionZ = MathHelper.cos(rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(rotationPitch / 180.0F * (float) Math.PI);
|
||||
motionY = -MathHelper.sin(rotationPitch / 180.0F * (float) Math.PI);
|
||||
|
@ -111,18 +113,6 @@ public class EntitySpellProjectile extends Entity implements IProjectile
|
|||
prevRotationPitch = rotationPitch = (float) (Math.atan2(var3, var10) * 180.0D / Math.PI);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
/**
|
||||
* Sets the position and rotation. Only difference from the other one is no bounding on the rotation. Args: posX,
|
||||
* posY, posZ, yaw, pitch
|
||||
*/
|
||||
public void setPositionAndRotation2(double par1, double par3, double par5, float par7, float par8, int par9)
|
||||
{
|
||||
this.setPosition(par1, par3, par5);
|
||||
this.setRotation(par7, par8);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
/**
|
||||
|
@ -158,7 +148,7 @@ public class EntitySpellProjectile extends Entity implements IProjectile
|
|||
}
|
||||
if (shootingEntity == null)
|
||||
{
|
||||
List players = worldObj.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(posX - 1, posY - 1, posZ - 1, posX + 1, posY + 1, posZ + 1));
|
||||
List players = worldObj.getEntitiesWithinAABB(EntityPlayer.class, new AxisAlignedBB(posX - 1, posY - 1, posZ - 1, posX + 1, posY + 1, posZ + 1));
|
||||
Iterator i = players.iterator();
|
||||
double closestDistance = Double.MAX_VALUE;
|
||||
EntityPlayer closestPlayer = null;
|
||||
|
@ -182,14 +172,15 @@ public class EntitySpellProjectile extends Entity implements IProjectile
|
|||
prevRotationYaw = rotationYaw = (float) (Math.atan2(motionX, motionZ) * 180.0D / Math.PI);
|
||||
prevRotationPitch = rotationPitch = (float) (Math.atan2(motionY, var1) * 180.0D / Math.PI);
|
||||
}
|
||||
Block var16 = worldObj.getBlock(xTile, yTile, zTile);
|
||||
IBlockState state = worldObj.getBlockState(new BlockPos(xTile, yTile, zTile));
|
||||
Block var16 = state.getBlock();
|
||||
|
||||
if (var16 != null)
|
||||
{
|
||||
var16.setBlockBoundsBasedOnState(worldObj, xTile, yTile, zTile);
|
||||
AxisAlignedBB var2 = var16.getCollisionBoundingBoxFromPool(worldObj, xTile, yTile, zTile);
|
||||
var16.setBlockBoundsBasedOnState(worldObj, new BlockPos(xTile, yTile, zTile));
|
||||
AxisAlignedBB var2 = var16.getCollisionBoundingBox(worldObj, new BlockPos(xTile, yTile, zTile), state);
|
||||
|
||||
if (var2 != null && var2.isVecInside(APISpellHelper.createVec3(posX, posY, posZ)))
|
||||
if (var2 != null && var2.isVecInside(new Vec3(posX, posY, posZ)))
|
||||
{
|
||||
inGround = true;
|
||||
}
|
||||
|
@ -197,14 +188,7 @@ public class EntitySpellProjectile extends Entity implements IProjectile
|
|||
|
||||
if (inGround)
|
||||
{
|
||||
Block var18 = worldObj.getBlock(xTile, yTile, zTile);
|
||||
int var19 = worldObj.getBlockMetadata(xTile, yTile, zTile);
|
||||
|
||||
// if (var18.equals(Block.getBlockById(inTile)) && var19 == inData)
|
||||
{
|
||||
// this.groundImpact();
|
||||
// this.setDead();
|
||||
}
|
||||
} else
|
||||
{
|
||||
++ticksInAir;
|
||||
|
@ -218,19 +202,19 @@ public class EntitySpellProjectile extends Entity implements IProjectile
|
|||
}
|
||||
}
|
||||
|
||||
Vec3 var17 = APISpellHelper.createVec3(posX, posY, posZ);
|
||||
Vec3 var3 = APISpellHelper.createVec3(posX + motionX, posY + motionY, posZ + motionZ);
|
||||
MovingObjectPosition var4 = worldObj.func_147447_a(var17, var3, true, false, false);
|
||||
var17 = APISpellHelper.createVec3(posX, posY, posZ);
|
||||
var3 = APISpellHelper.createVec3(posX + motionX, posY + motionY, posZ + motionZ);
|
||||
Vec3 var17 = new Vec3(posX, posY, posZ);
|
||||
Vec3 var3 = new Vec3(posX + motionX, posY + motionY, posZ + motionZ);
|
||||
MovingObjectPosition var4 = worldObj.rayTraceBlocks(var17, var3, true, false, false);
|
||||
var17 = new Vec3(posX, posY, posZ);
|
||||
var3 = new Vec3(posX + motionX, posY + motionY, posZ + motionZ);
|
||||
|
||||
if (var4 != null)
|
||||
{
|
||||
var3 = APISpellHelper.createVec3(var4.hitVec.xCoord, var4.hitVec.yCoord, var4.hitVec.zCoord);
|
||||
var3 = new Vec3(var4.hitVec.xCoord, var4.hitVec.yCoord, var4.hitVec.zCoord);
|
||||
}
|
||||
|
||||
Entity var5 = null;
|
||||
List var6 = worldObj.getEntitiesWithinAABBExcludingEntity(this, boundingBox.addCoord(motionX, motionY, motionZ).expand(1.0D, 1.0D, 1.0D));
|
||||
List var6 = worldObj.getEntitiesWithinAABBExcludingEntity(this, getBoundingBox().addCoord(motionX, motionY, motionZ).expand(1.0D, 1.0D, 1.0D));
|
||||
double var7 = 0.0D;
|
||||
Iterator var9 = var6.iterator();
|
||||
float var11;
|
||||
|
@ -242,7 +226,7 @@ public class EntitySpellProjectile extends Entity implements IProjectile
|
|||
if (var10.canBeCollidedWith() && (var10 != shootingEntity || ticksInAir >= 5))
|
||||
{
|
||||
var11 = 0.3F;
|
||||
AxisAlignedBB var12 = var10.boundingBox.expand(var11, var11, var11);
|
||||
AxisAlignedBB var12 = var10.getBoundingBox().expand(var11, var11, var11);
|
||||
MovingObjectPosition var13 = var12.calculateIntercept(var17, var3);
|
||||
|
||||
if (var13 != null)
|
||||
|
@ -287,14 +271,14 @@ public class EntitySpellProjectile extends Entity implements IProjectile
|
|||
if (ticksInAir % 3 == 0)
|
||||
{
|
||||
double gauss = gaussian(1.0F);
|
||||
worldObj.spawnParticle("mobSpell", posX, posY, posZ, gauss, gauss, 0.0F);
|
||||
worldObj.spawnParticle(EnumParticleTypes.SPELL_MOB, posX, posY, posZ, gauss, gauss, 0.0F);
|
||||
}
|
||||
}
|
||||
|
||||
private void doFiringParticles()
|
||||
{
|
||||
worldObj.spawnParticle("mobSpellAmbient", posX + smallGauss(0.1D), posY + smallGauss(0.1D), posZ + smallGauss(0.1D), 0.5D, 0.5D, 0.5D);
|
||||
worldObj.spawnParticle("flame", posX, posY, posZ, gaussian(motionX), gaussian(motionY), gaussian(motionZ));
|
||||
worldObj.spawnParticle(EnumParticleTypes.SPELL_MOB_AMBIENT, posX + smallGauss(0.1D), posY + smallGauss(0.1D), posZ + smallGauss(0.1D), 0.5D, 0.5D, 0.5D);
|
||||
worldObj.spawnParticle(EnumParticleTypes.FLAME, posX, posY, posZ, gaussian(motionX), gaussian(motionY), gaussian(motionZ));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -317,17 +301,6 @@ public class EntitySpellProjectile extends Entity implements IProjectile
|
|||
effectList.appendTag(eff.getTag());
|
||||
}
|
||||
|
||||
// for (String str : this.effectList)
|
||||
// {
|
||||
// if (str != null)
|
||||
// {
|
||||
// NBTTagCompound tag = new NBTTagCompound();
|
||||
//
|
||||
// tag.setString("Class", str);
|
||||
// effectList.appendTag(tag);
|
||||
// }
|
||||
// }
|
||||
|
||||
par1NBTTagCompound.setTag("Effects", effectList);
|
||||
par1NBTTagCompound.setInteger("blocksBroken", blocksBroken);
|
||||
par1NBTTagCompound.setBoolean("isSilkTouch", isSilkTouch);
|
||||
|
@ -388,13 +361,6 @@ public class EntitySpellProjectile extends Entity implements IProjectile
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float getShadowSize()
|
||||
{
|
||||
return 0.0F;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the amount of knockback the arrow applies when it hits a mob.
|
||||
*/
|
||||
|
@ -448,7 +414,7 @@ public class EntitySpellProjectile extends Entity implements IProjectile
|
|||
{
|
||||
if (!this.penetration)
|
||||
{
|
||||
this.groundImpact(mop.sideHit);
|
||||
this.groundImpact(mop.field_178784_b);
|
||||
this.performTileImpactEffects(mop);
|
||||
}
|
||||
}
|
||||
|
@ -473,7 +439,7 @@ public class EntitySpellProjectile extends Entity implements IProjectile
|
|||
{
|
||||
for (int particles = 0; particles < i; particles++)
|
||||
{
|
||||
worldObj.spawnParticle("mobSpellAmbient", posX + smallGauss(0.1D), posY + smallGauss(0.1D), posZ + smallGauss(0.1D), posGauss(1.0F), posGauss(1.0F), 0.0F);
|
||||
worldObj.spawnParticle(EnumParticleTypes.SPELL_MOB_AMBIENT, posX + smallGauss(0.1D), posY + smallGauss(0.1D), posZ + smallGauss(0.1D), posGauss(1.0F), posGauss(1.0F), 0.0F);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -487,7 +453,7 @@ public class EntitySpellProjectile extends Entity implements IProjectile
|
|||
return DamageSource.causePlayerDamage(shootingEntity);
|
||||
}
|
||||
|
||||
private void groundImpact(int sideHit)
|
||||
private void groundImpact(EnumFacing sideHit)
|
||||
{
|
||||
this.ricochet(sideHit);
|
||||
}
|
||||
|
@ -507,22 +473,22 @@ public class EntitySpellProjectile extends Entity implements IProjectile
|
|||
return d + d * ((rand.nextFloat() - 0.5D) / 4);
|
||||
}
|
||||
|
||||
private void ricochet(int sideHit)
|
||||
private void ricochet(EnumFacing sideHit)
|
||||
{
|
||||
switch (sideHit)
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
case UP:
|
||||
case DOWN:
|
||||
// topHit, bottomHit, reflect Y
|
||||
motionY = motionY * -1;
|
||||
break;
|
||||
case 2:
|
||||
case 3:
|
||||
case WEST:
|
||||
case EAST:
|
||||
// westHit, eastHit, reflect Z
|
||||
motionZ = motionZ * -1;
|
||||
break;
|
||||
case 4:
|
||||
case 5:
|
||||
case SOUTH:
|
||||
case NORTH:
|
||||
// southHit, northHit, reflect X
|
||||
motionX = motionX * -1;
|
||||
break;
|
||||
|
@ -535,23 +501,23 @@ public class EntitySpellProjectile extends Entity implements IProjectile
|
|||
{
|
||||
switch (sideHit)
|
||||
{
|
||||
case 0:
|
||||
worldObj.spawnParticle("smoke", posX, posY, posZ, gaussian(0.1D), -gaussian(0.1D), gaussian(0.1D));
|
||||
case UP:
|
||||
worldObj.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, posX, posY, posZ, gaussian(0.1D), -gaussian(0.1D), gaussian(0.1D));
|
||||
break;
|
||||
case 1:
|
||||
worldObj.spawnParticle("smoke", posX, posY, posZ, gaussian(0.1D), gaussian(0.1D), gaussian(0.1D));
|
||||
case DOWN:
|
||||
worldObj.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, posX, posY, posZ, gaussian(0.1D), gaussian(0.1D), gaussian(0.1D));
|
||||
break;
|
||||
case 2:
|
||||
worldObj.spawnParticle("smoke", posX, posY, posZ, gaussian(0.1D), gaussian(0.1D), -gaussian(0.1D));
|
||||
case NORTH:
|
||||
worldObj.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, posX, posY, posZ, gaussian(0.1D), gaussian(0.1D), -gaussian(0.1D));
|
||||
break;
|
||||
case 3:
|
||||
worldObj.spawnParticle("smoke", posX, posY, posZ, gaussian(0.1D), gaussian(0.1D), gaussian(0.1D));
|
||||
case SOUTH:
|
||||
worldObj.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, posX, posY, posZ, gaussian(0.1D), gaussian(0.1D), gaussian(0.1D));
|
||||
break;
|
||||
case 4:
|
||||
worldObj.spawnParticle("smoke", posX, posY, posZ, -gaussian(0.1D), gaussian(0.1D), gaussian(0.1D));
|
||||
case WEST:
|
||||
worldObj.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, posX, posY, posZ, -gaussian(0.1D), gaussian(0.1D), gaussian(0.1D));
|
||||
break;
|
||||
case 5:
|
||||
worldObj.spawnParticle("smoke", posX, posY, posZ, gaussian(0.1D), gaussian(0.1D), gaussian(0.1D));
|
||||
case EAST:
|
||||
worldObj.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, posX, posY, posZ, gaussian(0.1D), gaussian(0.1D), gaussian(0.1D));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ public abstract class ExtrapolatedMeleeEntityEffect implements IMeleeSpellEntity
|
|||
double y = entityPlayer.posY + entityPlayer.getEyeHeight() + lookVec.yCoord;
|
||||
double z = entityPlayer.posZ + lookVec.zCoord;
|
||||
|
||||
List<Entity> entities = world.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(x - 0.5f, y - 0.5f, z - 0.5f, x + 0.5f, y + 0.5f, z + 0.5f).expand(radius, radius, radius));
|
||||
List<Entity> entities = world.getEntitiesWithinAABB(Entity.class, new AxisAlignedBB(x - 0.5f, y - 0.5f, z - 0.5f, x + 0.5f, y + 0.5f, z + 0.5f).expand(radius, radius, radius));
|
||||
int hit = 0;
|
||||
|
||||
if (entities != null)
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
package WayofTime.alchemicalWizardry.api.spell;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public interface IOnBreakBlock
|
||||
{
|
||||
int onBlockBroken(ItemStack container, World world, EntityPlayer player, Block block, int meta, int x, int y, int z, ForgeDirection sideBroken);
|
||||
int onBlockBroken(ItemStack container, World world, EntityPlayer player, Block block, IBlockState state, BlockPos pos, EnumFacing sideBroken);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package WayofTime.alchemicalWizardry.api.spell;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
|
@ -17,11 +19,12 @@ public abstract class MeleeSpellCenteredWorldEffect extends MeleeSpellWorldEffec
|
|||
public void onWorldEffect(World world, EntityPlayer entityPlayer)
|
||||
{
|
||||
Vec3 lookVec = entityPlayer.getLook(range).normalize();
|
||||
int x = (int) (entityPlayer.posX + lookVec.xCoord * range);
|
||||
int y = (int) (entityPlayer.posY + entityPlayer.getEyeHeight() + lookVec.yCoord * range);
|
||||
int z = (int) (entityPlayer.posZ + lookVec.zCoord * range);
|
||||
|
||||
int x = MathHelper.floor_double(entityPlayer.posX + lookVec.xCoord * range);
|
||||
int y = MathHelper.floor_double(entityPlayer.posY + entityPlayer.getEyeHeight() + lookVec.yCoord * range);
|
||||
int z = MathHelper.floor_double(entityPlayer.posZ + lookVec.zCoord * range);
|
||||
|
||||
this.onCenteredWorldEffect(entityPlayer, world, x, y, z);
|
||||
this.onCenteredWorldEffect(entityPlayer, world, new BlockPos(x, y, z));
|
||||
}
|
||||
|
||||
public void setRange(float range)
|
||||
|
@ -29,5 +32,5 @@ public abstract class MeleeSpellCenteredWorldEffect extends MeleeSpellWorldEffec
|
|||
this.range = range;
|
||||
}
|
||||
|
||||
public abstract void onCenteredWorldEffect(EntityPlayer player, World world, int posX, int posY, int posZ);
|
||||
public abstract void onCenteredWorldEffect(EntityPlayer player, World world, BlockPos pos);
|
||||
}
|
||||
|
|
|
@ -7,14 +7,16 @@ import java.util.Map.Entry;
|
|||
import java.util.Set;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import WayofTime.alchemicalWizardry.api.items.ItemSpellMultiTool;
|
||||
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
|
||||
|
||||
|
@ -337,12 +339,12 @@ public class SpellParadigmTool extends SpellParadigm
|
|||
return total;
|
||||
}
|
||||
|
||||
public int onBreakBlock(ItemStack container, World world, EntityPlayer player, Block block, int meta, int x, int y, int z, ForgeDirection sideBroken)
|
||||
public int onBreakBlock(ItemStack container, World world, EntityPlayer player, Block block, IBlockState state, BlockPos pos, EnumFacing sideBroken)
|
||||
{
|
||||
int total = 0;
|
||||
for (IOnBreakBlock effect : this.breakBlockEffectList)
|
||||
{
|
||||
total += effect.onBlockBroken(container, world, player, block, meta, x, y, z, sideBroken);
|
||||
total += effect.onBlockBroken(container, world, player, block, state, pos, sideBroken);
|
||||
}
|
||||
|
||||
return total;
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
package WayofTime.alchemicalWizardry.api.tile;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import WayofTime.alchemicalWizardry.api.spell.SpellParadigm;
|
||||
|
||||
public interface ISpellTile
|
||||
{
|
||||
void modifySpellParadigm(SpellParadigm parad);
|
||||
|
||||
boolean canInputRecieveOutput(ForgeDirection output);
|
||||
boolean canInputRecieveOutput(EnumFacing output);
|
||||
}
|
||||
|
|
|
@ -1,55 +1,23 @@
|
|||
package WayofTime.alchemicalWizardry.client;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.entity.AbstractClientPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.event.RenderBlockOverlayEvent;
|
||||
import net.minecraftforge.client.event.RenderHandEvent;
|
||||
import net.minecraftforge.client.event.sound.SoundEvent;
|
||||
import net.minecraftforge.fml.client.FMLClientHandler;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event.Result;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.gameevent.InputEvent;
|
||||
import net.minecraftforge.fml.common.gameevent.TickEvent.Phase;
|
||||
import net.minecraftforge.fml.common.gameevent.TickEvent.RenderTickEvent;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.ModBlocks;
|
||||
import WayofTime.alchemicalWizardry.client.renderer.RenderHelper;
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import cpw.mods.fml.common.eventhandler.Event.Result;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.InputEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent.Phase;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent.RenderTickEvent;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
|
||||
public class ClientEventHandler
|
||||
{
|
||||
private Minecraft mc = FMLClientHandler.instance().getClient();
|
||||
|
||||
public static ResourceLocation currentPlayerTexture = null;
|
||||
private Minecraft mcClient = FMLClientHandler.instance().getClient();
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SubscribeEvent
|
||||
public void renderPOVArmour(RenderHandEvent event)
|
||||
{
|
||||
if (this.mc.thePlayer.worldObj.isRemote && this.mc.gameSettings.thirdPersonView == 0 && !this.mc.renderViewEntity.isPlayerSleeping() && !this.mc.gameSettings.hideGUI && !this.mc.playerController.enableEverythingIsScrewedUpMode())
|
||||
{
|
||||
currentPlayerTexture = ((AbstractClientPlayer) mc.thePlayer).getLocationSkin();
|
||||
|
||||
ClientUtils.renderPlayerArmourInPOV(mc.thePlayer, event.partialTicks);
|
||||
event.setCanceled(true);
|
||||
}
|
||||
}
|
||||
|
||||
// @SubscribeEvent(priority = EventPriority.LOWEST)
|
||||
// public void onPlayerRenderTick(RenderPlayerEvent.Pre event)
|
||||
// {
|
||||
// ModelBiped model = ((BoundArmour)ModItems.boundPlate).getArmorModel(event.entityPlayer, new ItemStack(ModItems.boundPlate), 2);
|
||||
// String texture = ((BoundArmour)ModItems.boundPlate).getArmorTexture(new ItemStack(ModItems.boundPlate), event.entityPlayer, 2, "");
|
||||
//
|
||||
// ResourceLocation resourcelocation = new ResourceLocation(texture);
|
||||
// event.renderer.modelBipedMain.bipedBody.addChild(model.bipedBody);
|
||||
// Minecraft.getMinecraft().renderEngine.bindTexture(resourcelocation);
|
||||
//
|
||||
// }
|
||||
|
||||
@SubscribeEvent
|
||||
public void onKeyInput(InputEvent.KeyInputEvent event)
|
||||
{
|
||||
|
@ -98,7 +66,7 @@ public class ClientEventHandler
|
|||
if (event.phase.equals(Phase.START))
|
||||
return;
|
||||
|
||||
if (!RenderHelper.onTickInGame(mc))
|
||||
// if (!RenderHelper.onTickInGame(mcClient))
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
package WayofTime.alchemicalWizardry.client;
|
||||
|
||||
import WayofTime.alchemicalWizardry.common.thread.GAPIChecker;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.MinecraftForgeClient;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.ModBlocks;
|
||||
import WayofTime.alchemicalWizardry.api.spell.EntitySpellProjectile;
|
||||
import WayofTime.alchemicalWizardry.client.renderer.RitualDivinerRender;
|
||||
|
@ -50,6 +50,7 @@ import WayofTime.alchemicalWizardry.common.renderer.block.RenderSpellEnhancement
|
|||
import WayofTime.alchemicalWizardry.common.renderer.block.RenderSpellModifierBlock;
|
||||
import WayofTime.alchemicalWizardry.common.renderer.block.RenderSpellParadigmBlock;
|
||||
import WayofTime.alchemicalWizardry.common.renderer.block.RenderWritingTable;
|
||||
import WayofTime.alchemicalWizardry.common.renderer.block.ShaderHelper;
|
||||
import WayofTime.alchemicalWizardry.common.renderer.block.TEAltarRenderer;
|
||||
import WayofTime.alchemicalWizardry.common.renderer.block.itemRender.TEAlchemicalCalcinatorItemRenderer;
|
||||
import WayofTime.alchemicalWizardry.common.renderer.block.itemRender.TEAltarItemRenderer;
|
||||
|
@ -84,7 +85,6 @@ import WayofTime.alchemicalWizardry.common.renderer.model.ModelWingedFireDemon;
|
|||
import WayofTime.alchemicalWizardry.common.renderer.projectile.RenderEnergyBazookaMainProjectile;
|
||||
import WayofTime.alchemicalWizardry.common.renderer.projectile.RenderEnergyBlastProjectile;
|
||||
import WayofTime.alchemicalWizardry.common.renderer.projectile.RenderMeteor;
|
||||
import WayofTime.alchemicalWizardry.common.thread.GAPIChecker;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEAlchemicCalcinator;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEBellJar;
|
||||
|
@ -159,10 +159,7 @@ public class ClientProxy extends CommonProxy
|
|||
ClientRegistry.bindTileEntitySpecialRenderer(TESpellParadigmBlock.class, new RenderSpellParadigmBlock());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TESpellModifierBlock.class, new RenderSpellModifierBlock());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TEReagentConduit.class, new RenderReagentConduit());
|
||||
if (AlchemicalWizardry.displayRitualAnimation)
|
||||
{
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TEMasterStone.class, new RenderMasterStone());
|
||||
}
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TEMasterStone.class, new RenderMasterStone());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TEAlchemicCalcinator.class, new RenderAlchemicCalcinator());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TEBellJar.class, new RenderCrystalBelljar());
|
||||
|
||||
|
@ -174,6 +171,7 @@ public class ClientProxy extends CommonProxy
|
|||
MinecraftForgeClient.registerItemRenderer(ItemBlock.getItemFromBlock(ModBlocks.blockSpellModifier), new TESpellModifierBlockItemRenderer());
|
||||
MinecraftForgeClient.registerItemRenderer(ItemBlock.getItemFromBlock(ModBlocks.blockAlchemicCalcinator), new TEAlchemicalCalcinatorItemRenderer());
|
||||
MinecraftForgeClient.registerItemRenderer(ItemBlock.getItemFromBlock(ModBlocks.blockCrystalBelljar), new TEBellJarItemRenderer());
|
||||
ShaderHelper.initShaders();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,348 +0,0 @@
|
|||
package WayofTime.alchemicalWizardry.client;
|
||||
|
||||
import static net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED_FIRST_PERSON;
|
||||
import static net.minecraftforge.client.IItemRenderer.ItemRenderType.FIRST_PERSON_MAP;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.entity.EntityClientPlayerMP;
|
||||
import net.minecraft.client.entity.EntityPlayerSP;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.entity.Render;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.renderer.entity.RenderPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumAction;
|
||||
import net.minecraft.item.ItemCloth;
|
||||
import net.minecraft.item.ItemMap;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.storage.MapData;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
import net.minecraftforge.client.MinecraftForgeClient;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
public class ClientUtils
|
||||
{
|
||||
public static Minecraft mc = Minecraft.getMinecraft();
|
||||
|
||||
private static final ResourceLocation RES_MAP_BACKGROUND = new ResourceLocation("textures/map/map_background.png");
|
||||
|
||||
public static void renderPlayerArmourInPOV(EntityPlayer player, float partialTickTime)
|
||||
{
|
||||
GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT);
|
||||
float f1 = 1.0f;//this.prevEquippedProgress + (this.equippedProgress - this.prevEquippedProgress) * partialTickTime;
|
||||
EntityClientPlayerMP entityclientplayermp = mc.thePlayer;
|
||||
float f2 = entityclientplayermp.prevRotationPitch + (entityclientplayermp.rotationPitch - entityclientplayermp.prevRotationPitch) * partialTickTime;
|
||||
// GL11.glPushMatrix();
|
||||
GL11.glRotatef(180 - (entityclientplayermp.prevRotationYaw + (entityclientplayermp.rotationYaw - entityclientplayermp.prevRotationYaw) * partialTickTime), 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(-f2, 1.0F, 0.0F, 0.0F);
|
||||
RenderHelper.enableStandardItemLighting();
|
||||
// GL11.glPopMatrix();
|
||||
EntityPlayerSP entityplayersp = (EntityPlayerSP)entityclientplayermp;
|
||||
float f3 = entityplayersp.prevRenderArmPitch + (entityplayersp.renderArmPitch - entityplayersp.prevRenderArmPitch) * partialTickTime;
|
||||
float f4 = entityplayersp.prevRenderArmYaw + (entityplayersp.renderArmYaw - entityplayersp.prevRenderArmYaw) * partialTickTime;
|
||||
GL11.glRotatef((entityclientplayermp.rotationPitch - f3) * 0.1F, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef((entityclientplayermp.rotationYaw - f4) * 0.1F, 0.0F, 1.0F, 0.0F);
|
||||
ItemStack itemstack = player.getCurrentEquippedItem();
|
||||
|
||||
if (itemstack != null && itemstack.getItem() instanceof ItemCloth)
|
||||
{
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
|
||||
}
|
||||
|
||||
int i = mc.theWorld.getLightBrightnessForSkyBlocks(MathHelper.floor_double(entityclientplayermp.posX), MathHelper.floor_double(entityclientplayermp.posY), MathHelper.floor_double(entityclientplayermp.posZ), 0);
|
||||
int j = i % 65536;
|
||||
int k = i / 65536;
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)j / 1.0F, (float)k / 1.0F);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
float f5;
|
||||
float f6;
|
||||
float f7;
|
||||
|
||||
if (itemstack != null)
|
||||
{
|
||||
int l = itemstack.getItem().getColorFromItemStack(itemstack, 0);
|
||||
f5 = (float)(l >> 16 & 255) / 255.0F;
|
||||
f6 = (float)(l >> 8 & 255) / 255.0F;
|
||||
f7 = (float)(l & 255) / 255.0F;
|
||||
GL11.glColor4f(f5, f6, f7, 1.0F);
|
||||
}
|
||||
else
|
||||
{
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
float f8;
|
||||
float f9;
|
||||
float f10;
|
||||
float f13;
|
||||
Render render;
|
||||
RenderPlayer renderplayer;
|
||||
|
||||
|
||||
if (itemstack != null && itemstack.getItem() instanceof ItemMap)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
f13 = 0.8F;
|
||||
f5 = entityclientplayermp.getSwingProgress(partialTickTime);
|
||||
f6 = MathHelper.sin(f5 * (float)Math.PI);
|
||||
f7 = MathHelper.sin(MathHelper.sqrt_float(f5) * (float)Math.PI);
|
||||
GL11.glTranslatef(-f7 * 0.4F, MathHelper.sin(MathHelper.sqrt_float(f5) * (float)Math.PI * 2.0F) * 0.2F, -f6 * 0.2F);
|
||||
f5 = 1.0F - f2 / 45.0F + 0.1F;
|
||||
|
||||
if (f5 < 0.0F)
|
||||
{
|
||||
f5 = 0.0F;
|
||||
}
|
||||
|
||||
if (f5 > 1.0F)
|
||||
{
|
||||
f5 = 1.0F;
|
||||
}
|
||||
|
||||
f5 = -MathHelper.cos(f5 * (float)Math.PI) * 0.5F + 0.5F;
|
||||
GL11.glTranslatef(0.0F, 0.0F * f13 - (1.0F - f1) * 1.2F - f5 * 0.5F + 0.04F, -0.9F * f13);
|
||||
GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(f5 * -85.0F, 0.0F, 0.0F, 1.0F);
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
mc.getTextureManager().bindTexture(entityclientplayermp.getLocationSkin());
|
||||
|
||||
for (int i1 = 0; i1 < 2; ++i1)
|
||||
{
|
||||
int j1 = i1 * 2 - 1;
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(-0.0F, -0.6F, 1.1F * (float)j1);
|
||||
GL11.glRotatef((float)(-45 * j1), 1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef(-90.0F, 0.0F, 0.0F, 1.0F);
|
||||
GL11.glRotatef(59.0F, 0.0F, 0.0F, 1.0F);
|
||||
GL11.glRotatef((float)(-65 * j1), 0.0F, 1.0F, 0.0F);
|
||||
render = RenderManager.instance.getEntityRenderObject(mc.thePlayer);
|
||||
renderplayer = (RenderPlayer)render;
|
||||
f10 = 1.0F;
|
||||
GL11.glScalef(f10, f10, f10);
|
||||
renderFirstPersonArm(renderplayer, mc.thePlayer);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
f6 = entityclientplayermp.getSwingProgress(partialTickTime);
|
||||
f7 = MathHelper.sin(f6 * f6 * (float)Math.PI);
|
||||
f8 = MathHelper.sin(MathHelper.sqrt_float(f6) * (float)Math.PI);
|
||||
GL11.glRotatef(-f7 * 20.0F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(-f8 * 20.0F, 0.0F, 0.0F, 1.0F);
|
||||
GL11.glRotatef(-f8 * 80.0F, 1.0F, 0.0F, 0.0F);
|
||||
f9 = 0.38F;
|
||||
GL11.glScalef(f9, f9, f9);
|
||||
GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
|
||||
GL11.glTranslatef(-1.0F, -1.0F, 0.0F);
|
||||
f10 = 0.015625F;
|
||||
GL11.glScalef(f10, f10, f10);
|
||||
mc.getTextureManager().bindTexture(RES_MAP_BACKGROUND);
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
GL11.glNormal3f(0.0F, 0.0F, -1.0F);
|
||||
tessellator.startDrawingQuads();
|
||||
byte b0 = 7;
|
||||
tessellator.addVertexWithUV((double)(0 - b0), (double)(128 + b0), 0.0D, 0.0D, 1.0D);
|
||||
tessellator.addVertexWithUV((double)(128 + b0), (double)(128 + b0), 0.0D, 1.0D, 1.0D);
|
||||
tessellator.addVertexWithUV((double)(128 + b0), (double)(0 - b0), 0.0D, 1.0D, 0.0D);
|
||||
tessellator.addVertexWithUV((double)(0 - b0), (double)(0 - b0), 0.0D, 0.0D, 0.0D);
|
||||
tessellator.draw();
|
||||
|
||||
IItemRenderer custom = MinecraftForgeClient.getItemRenderer(itemstack, FIRST_PERSON_MAP);
|
||||
MapData mapdata = ((ItemMap)itemstack.getItem()).getMapData(itemstack, mc.theWorld);
|
||||
|
||||
if (custom == null)
|
||||
{
|
||||
if (mapdata != null)
|
||||
{
|
||||
mc.entityRenderer.getMapItemRenderer().func_148250_a(mapdata, false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
custom.renderItem(FIRST_PERSON_MAP, itemstack, mc.thePlayer, mc.getTextureManager(), mapdata);
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
else if (itemstack != null)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
f13 = 0.8F;
|
||||
|
||||
if (entityclientplayermp.getItemInUseCount() > 0)
|
||||
{
|
||||
EnumAction enumaction = itemstack.getItemUseAction();
|
||||
|
||||
if (enumaction == EnumAction.eat || enumaction == EnumAction.drink)
|
||||
{
|
||||
f6 = (float)entityclientplayermp.getItemInUseCount() - partialTickTime + 1.0F;
|
||||
f7 = 1.0F - f6 / (float)itemstack.getMaxItemUseDuration();
|
||||
f8 = 1.0F - f7;
|
||||
f8 = f8 * f8 * f8;
|
||||
f8 = f8 * f8 * f8;
|
||||
f8 = f8 * f8 * f8;
|
||||
f9 = 1.0F - f8;
|
||||
GL11.glTranslatef(0.0F, MathHelper.abs(MathHelper.cos(f6 / 4.0F * (float)Math.PI) * 0.1F) * (float)((double)f7 > 0.2D ? 1 : 0), 0.0F);
|
||||
GL11.glTranslatef(f9 * 0.6F, -f9 * 0.5F, 0.0F);
|
||||
GL11.glRotatef(f9 * 90.0F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(f9 * 10.0F, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef(f9 * 30.0F, 0.0F, 0.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
f5 = entityclientplayermp.getSwingProgress(partialTickTime);
|
||||
f6 = MathHelper.sin(f5 * (float)Math.PI);
|
||||
f7 = MathHelper.sin(MathHelper.sqrt_float(f5) * (float)Math.PI);
|
||||
GL11.glTranslatef(-f7 * 0.4F, MathHelper.sin(MathHelper.sqrt_float(f5) * (float)Math.PI * 2.0F) * 0.2F, -f6 * 0.2F);
|
||||
}
|
||||
|
||||
GL11.glTranslatef(0.7F * f13, -0.65F * f13 - (1.0F - f1) * 0.6F, -0.9F * f13);
|
||||
GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
f5 = entityclientplayermp.getSwingProgress(partialTickTime);
|
||||
f6 = MathHelper.sin(f5 * f5 * (float)Math.PI);
|
||||
f7 = MathHelper.sin(MathHelper.sqrt_float(f5) * (float)Math.PI);
|
||||
GL11.glRotatef(-f6 * 20.0F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(-f7 * 20.0F, 0.0F, 0.0F, 1.0F);
|
||||
GL11.glRotatef(-f7 * 80.0F, 1.0F, 0.0F, 0.0F);
|
||||
f8 = 0.4F;
|
||||
GL11.glScalef(f8, f8, f8);
|
||||
float f11;
|
||||
float f12;
|
||||
|
||||
if (entityclientplayermp.getItemInUseCount() > 0)
|
||||
{
|
||||
EnumAction enumaction1 = itemstack.getItemUseAction();
|
||||
|
||||
if (enumaction1 == EnumAction.block)
|
||||
{
|
||||
GL11.glTranslatef(-0.5F, 0.2F, 0.0F);
|
||||
GL11.glRotatef(30.0F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(-80.0F, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef(60.0F, 0.0F, 1.0F, 0.0F);
|
||||
}
|
||||
else if (enumaction1 == EnumAction.bow)
|
||||
{
|
||||
GL11.glRotatef(-18.0F, 0.0F, 0.0F, 1.0F);
|
||||
GL11.glRotatef(-12.0F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(-8.0F, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glTranslatef(-0.9F, 0.2F, 0.0F);
|
||||
f10 = (float)itemstack.getMaxItemUseDuration() - ((float)entityclientplayermp.getItemInUseCount() - partialTickTime + 1.0F);
|
||||
f11 = f10 / 20.0F;
|
||||
f11 = (f11 * f11 + f11 * 2.0F) / 3.0F;
|
||||
|
||||
if (f11 > 1.0F)
|
||||
{
|
||||
f11 = 1.0F;
|
||||
}
|
||||
|
||||
if (f11 > 0.1F)
|
||||
{
|
||||
GL11.glTranslatef(0.0F, MathHelper.sin((f10 - 0.1F) * 1.3F) * 0.01F * (f11 - 0.1F), 0.0F);
|
||||
}
|
||||
|
||||
GL11.glTranslatef(0.0F, 0.0F, f11 * 0.1F);
|
||||
GL11.glRotatef(-335.0F, 0.0F, 0.0F, 1.0F);
|
||||
GL11.glRotatef(-50.0F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glTranslatef(0.0F, 0.5F, 0.0F);
|
||||
f12 = 1.0F + f11 * 0.2F;
|
||||
GL11.glScalef(1.0F, 1.0F, f12);
|
||||
GL11.glTranslatef(0.0F, -0.5F, 0.0F);
|
||||
GL11.glRotatef(50.0F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(335.0F, 0.0F, 0.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
|
||||
if (itemstack.getItem().shouldRotateAroundWhenRendering())
|
||||
{
|
||||
GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);
|
||||
}
|
||||
|
||||
if (itemstack.getItem().requiresMultipleRenderPasses())
|
||||
{
|
||||
RenderManager.instance.itemRenderer.renderItem(entityclientplayermp, itemstack, 0, EQUIPPED_FIRST_PERSON);
|
||||
for (int x = 1; x < itemstack.getItem().getRenderPasses(itemstack.getItemDamage()); x++)
|
||||
{
|
||||
int k1 = itemstack.getItem().getColorFromItemStack(itemstack, x);
|
||||
f10 = (float)(k1 >> 16 & 255) / 255.0F;
|
||||
f11 = (float)(k1 >> 8 & 255) / 255.0F;
|
||||
f12 = (float)(k1 & 255) / 255.0F;
|
||||
GL11.glColor4f(1.0F * f10, 1.0F * f11, 1.0F * f12, 1.0F);
|
||||
RenderManager.instance.itemRenderer.renderItem(entityclientplayermp, itemstack, x, EQUIPPED_FIRST_PERSON);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RenderManager.instance.itemRenderer.renderItem(entityclientplayermp, itemstack, 0, EQUIPPED_FIRST_PERSON);
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
else if (!entityclientplayermp.isInvisible())
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
f13 = 0.8F;
|
||||
f5 = entityclientplayermp.getSwingProgress(partialTickTime);
|
||||
f6 = MathHelper.sin(f5 * (float)Math.PI);
|
||||
f7 = MathHelper.sin(MathHelper.sqrt_float(f5) * (float)Math.PI);
|
||||
GL11.glTranslatef(-f7 * 0.3F, MathHelper.sin(MathHelper.sqrt_float(f5) * (float)Math.PI * 2.0F) * 0.4F, -f6 * 0.4F);
|
||||
GL11.glTranslatef(0.8F * f13, -0.75F * f13 - (1.0F - f1) * 0.6F, -0.9F * f13);
|
||||
GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
f5 = entityclientplayermp.getSwingProgress(partialTickTime);
|
||||
f6 = MathHelper.sin(f5 * f5 * (float)Math.PI);
|
||||
f7 = MathHelper.sin(MathHelper.sqrt_float(f5) * (float)Math.PI);
|
||||
GL11.glRotatef(f7 * 70.0F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(-f6 * 20.0F, 0.0F, 0.0F, 1.0F);
|
||||
mc.getTextureManager().bindTexture(entityclientplayermp.getLocationSkin());
|
||||
GL11.glTranslatef(-1.0F, 3.6F, 3.5F);
|
||||
GL11.glRotatef(120.0F, 0.0F, 0.0F, 1.0F);
|
||||
GL11.glRotatef(200.0F, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef(-135.0F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glScalef(1.0F, 1.0F, 1.0F);
|
||||
GL11.glTranslatef(5.6F, 0.0F, 0.0F);
|
||||
render = RenderManager.instance.getEntityRenderObject(mc.thePlayer);
|
||||
renderplayer = (RenderPlayer)render;
|
||||
f10 = 1.0F;
|
||||
GL11.glScalef(f10, f10, f10);
|
||||
renderFirstPersonArm(renderplayer, mc.thePlayer);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
if (itemstack != null && itemstack.getItem() instanceof ItemCloth)
|
||||
{
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
}
|
||||
|
||||
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
}
|
||||
|
||||
public static void renderFirstPersonArm(RenderPlayer renderer, EntityPlayer player)
|
||||
{
|
||||
float f = 1.0F;
|
||||
GL11.glColor3f(f, f, f);
|
||||
|
||||
GL11.glPushMatrix();
|
||||
ModelRenderer mRenderer = new POVArmourModelWrapper(renderer.modelBipedMain);
|
||||
renderer.modelBipedMain.onGround = 0.0F;
|
||||
renderer.modelBipedMain.setRotationAngles(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, player);
|
||||
renderer.modelBipedMain.bipedRightArm.render(0.0625F);
|
||||
|
||||
GL11.glPushMatrix();
|
||||
mRenderer.rotateAngleX = renderer.modelBipedMain.bipedRightArm.rotateAngleX;
|
||||
mRenderer.rotateAngleY = renderer.modelBipedMain.bipedRightArm.rotateAngleY;
|
||||
mRenderer.rotateAngleZ = renderer.modelBipedMain.bipedRightArm.rotateAngleZ;
|
||||
mRenderer.render(0.0625F);
|
||||
GL11.glPopMatrix();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
|
@ -1,47 +0,0 @@
|
|||
package WayofTime.alchemicalWizardry.client;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelBiped;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import WayofTime.alchemicalWizardry.ModItems;
|
||||
import WayofTime.alchemicalWizardry.common.items.armour.BoundArmour;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class POVArmourModelWrapper extends ModelRenderer
|
||||
{
|
||||
private final ModelRenderer armModel;
|
||||
private final ResourceLocation resource;
|
||||
|
||||
public POVArmourModelWrapper(ModelBase model)
|
||||
{
|
||||
super(model);
|
||||
ItemStack plateStack = new ItemStack(ModItems.boundPlateFire);
|
||||
ModelBiped bipedModel = ((BoundArmour)ModItems.boundPlateFire).getArmorModel(Minecraft.getMinecraft().thePlayer, plateStack, 1);
|
||||
armModel = bipedModel.bipedRightArm;
|
||||
resource = new ResourceLocation(((BoundArmour)ModItems.boundPlateFire).getArmorTexture(plateStack, Minecraft.getMinecraft().thePlayer, 1, "POV"));
|
||||
addBox(0, 0, 0, 0, 0, 0); //Adds in a blank box as it's required in certain cases such as rendering arrows in entities
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(float partialTicks)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
// GL11.glTranslated(0.3, -.1, 0);
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(resource);
|
||||
armModel.rotateAngleX = this.rotateAngleX;
|
||||
armModel.rotateAngleY = this.rotateAngleY;
|
||||
armModel.rotateAngleZ = this.rotateAngleZ;
|
||||
armModel.render(partialTicks);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(ClientEventHandler.currentPlayerTexture);
|
||||
|
||||
}
|
||||
}
|
|
@ -1,15 +1,15 @@
|
|||
package WayofTime.alchemicalWizardry.client.gui;
|
||||
|
||||
import cpw.mods.fml.client.config.GuiConfig;
|
||||
import cpw.mods.fml.client.config.IConfigElement;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraftforge.common.config.ConfigCategory;
|
||||
import net.minecraftforge.common.config.ConfigElement;
|
||||
|
||||
import static WayofTime.alchemicalWizardry.BloodMagicConfiguration.config;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static WayofTime.alchemicalWizardry.BloodMagicConfiguration.config;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraftforge.common.config.ConfigElement;
|
||||
import net.minecraftforge.fml.client.config.GuiConfig;
|
||||
import net.minecraftforge.fml.client.config.IConfigElement;
|
||||
|
||||
public class ConfigGui extends GuiConfig {
|
||||
|
||||
|
@ -22,16 +22,16 @@ public class ConfigGui extends GuiConfig {
|
|||
List<IConfigElement> list = new ArrayList<IConfigElement>();
|
||||
|
||||
// adds sections declared in ConfigHandler. toLowerCase() is used because the configuration class automatically does this, so must we.
|
||||
list.add(new ConfigElement<ConfigCategory>(config.getCategory("clientsettings".toLowerCase())));
|
||||
list.add(new ConfigElement<ConfigCategory>(config.getCategory("dungeon loot chances".toLowerCase())));
|
||||
list.add(new ConfigElement<ConfigCategory>(config.getCategory("meteor".toLowerCase())));
|
||||
list.add(new ConfigElement<ConfigCategory>(config.getCategory("orecrushing".toLowerCase())));
|
||||
list.add(new ConfigElement<ConfigCategory>(config.getCategory("potion id".toLowerCase())));
|
||||
list.add(new ConfigElement<ConfigCategory>(config.getCategory("wellofsufferingblacklist".toLowerCase())));
|
||||
list.add(new ConfigElement<ConfigCategory>(config.getCategory("wimpysettings".toLowerCase())));
|
||||
list.add(new ConfigElement<ConfigCategory>(config.getCategory("ritual blacklist".toLowerCase())));
|
||||
list.add(new ConfigElement<ConfigCategory>(config.getCategory("teleposer blacklist".toLowerCase())));
|
||||
list.add(new ConfigElement<ConfigCategory>(config.getCategory("demon configs".toLowerCase())));
|
||||
list.add(new ConfigElement(config.getCategory("clientsettings".toLowerCase())));
|
||||
list.add(new ConfigElement(config.getCategory("dungeon loot chances".toLowerCase())));
|
||||
list.add(new ConfigElement(config.getCategory("meteor".toLowerCase())));
|
||||
list.add(new ConfigElement(config.getCategory("orecrushing".toLowerCase())));
|
||||
list.add(new ConfigElement(config.getCategory("potion id".toLowerCase())));
|
||||
list.add(new ConfigElement(config.getCategory("wellofsufferingblacklist".toLowerCase())));
|
||||
list.add(new ConfigElement(config.getCategory("wimpysettings".toLowerCase())));
|
||||
list.add(new ConfigElement(config.getCategory("ritual blacklist".toLowerCase())));
|
||||
list.add(new ConfigElement(config.getCategory("teleposer blacklist".toLowerCase())));
|
||||
list.add(new ConfigElement(config.getCategory("demon configs".toLowerCase())));
|
||||
|
||||
return list;
|
||||
}
|
||||
|
|
|
@ -1,178 +1,178 @@
|
|||
package WayofTime.alchemicalWizardry.client.nei;
|
||||
|
||||
import static WayofTime.alchemicalWizardry.client.nei.NEIConfig.bloodOrbs;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import WayofTime.alchemicalWizardry.api.alchemy.AlchemyRecipe;
|
||||
import WayofTime.alchemicalWizardry.api.alchemy.AlchemyRecipeRegistry;
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.gui.GuiWritingTable;
|
||||
import codechicken.nei.ItemList;
|
||||
import codechicken.nei.NEIServerUtils;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
|
||||
/**
|
||||
* NEI Alchemy Recipe Handler by joshie *
|
||||
*/
|
||||
public class NEIAlchemyRecipeHandler extends TemplateRecipeHandler {
|
||||
public class CachedAlchemyRecipe extends CachedRecipe {
|
||||
public class BloodOrbs {
|
||||
public PositionedStack stack;
|
||||
|
||||
public BloodOrbs(ItemStack orb) {
|
||||
this.stack = new PositionedStack(orb, 136, 47, false);
|
||||
}
|
||||
}
|
||||
|
||||
ArrayList<BloodOrbs> orbs;
|
||||
PositionedStack output;
|
||||
List<PositionedStack> inputs;
|
||||
int lp;
|
||||
|
||||
public CachedAlchemyRecipe(AlchemyRecipe recipe, ItemStack orb) {
|
||||
this(recipe);
|
||||
this.orbs = new ArrayList<BloodOrbs>();
|
||||
orbs.add(new BloodOrbs(orb));
|
||||
}
|
||||
|
||||
public CachedAlchemyRecipe(AlchemyRecipe recipe) {
|
||||
List<PositionedStack> inputs = new ArrayList<PositionedStack>();
|
||||
ItemStack[] stacks = recipe.getRecipe();
|
||||
if (stacks.length > 0) inputs.add(new PositionedStack(stacks[0], 76, 3));
|
||||
if (stacks.length > 1) inputs.add(new PositionedStack(stacks[1], 51, 19));
|
||||
if (stacks.length > 2) inputs.add(new PositionedStack(stacks[2], 101, 19));
|
||||
if (stacks.length > 3) inputs.add(new PositionedStack(stacks[3], 64, 47));
|
||||
if (stacks.length > 4) inputs.add(new PositionedStack(stacks[4], 88, 47));
|
||||
this.inputs = inputs;
|
||||
this.output = new PositionedStack(recipe.getResult(), 76, 25);
|
||||
this.lp = recipe.getAmountNeeded() * 100;
|
||||
this.orbs = new ArrayList<BloodOrbs>();
|
||||
for (Item orb : bloodOrbs) {
|
||||
if (((IBloodOrb) orb).getOrbLevel() >= recipe.getOrbLevel()) {
|
||||
orbs.add(new BloodOrbs(new ItemStack(orb)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getIngredients() {
|
||||
return inputs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getResult() {
|
||||
return output;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getOtherStack() {
|
||||
if (orbs == null || orbs.size() <= 0) return null;
|
||||
return orbs.get((cycleticks / 48) % orbs.size()).stack;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TemplateRecipeHandler newInstance() {
|
||||
for (ItemStack item : ItemList.items) {
|
||||
if (item != null && item.getItem() instanceof IBloodOrb) {
|
||||
bloodOrbs.add(item.getItem());
|
||||
}
|
||||
}
|
||||
|
||||
return super.newInstance();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOverlayIdentifier() {
|
||||
return "alchemicalwizardry.alchemy";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadTransferRects() {
|
||||
transferRects.add(new RecipeTransferRect(new Rectangle(134, 22, 16, 24), "alchemicalwizardry.alchemy"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends GuiContainer> getGuiClass() {
|
||||
return GuiWritingTable.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(String outputId, Object... results) {
|
||||
if (outputId.equals("alchemicalwizardry.alchemy") && getClass() == NEIAlchemyRecipeHandler.class) {
|
||||
for (AlchemyRecipe recipe : AlchemyRecipeRegistry.recipes) {
|
||||
if (recipe.getResult() != null) arecipes.add(new CachedAlchemyRecipe(recipe));
|
||||
}
|
||||
} else {
|
||||
super.loadCraftingRecipes(outputId, results);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(ItemStack result) {
|
||||
for (AlchemyRecipe recipe : AlchemyRecipeRegistry.recipes) {
|
||||
if (recipe == null) continue;
|
||||
if (NEIServerUtils.areStacksSameTypeCrafting(result, recipe.getResult())) {
|
||||
arecipes.add(new CachedAlchemyRecipe(recipe));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(ItemStack ingredient) {
|
||||
if (ingredient.getItem() instanceof IBloodOrb) {
|
||||
for (AlchemyRecipe recipe : AlchemyRecipeRegistry.recipes) {
|
||||
if (recipe == null) continue;
|
||||
if (((IBloodOrb) ingredient.getItem()).getOrbLevel() >= recipe.getOrbLevel()) {
|
||||
arecipes.add(new CachedAlchemyRecipe(recipe, ingredient));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (AlchemyRecipe recipe : AlchemyRecipeRegistry.recipes) {
|
||||
if (recipe == null) continue;
|
||||
ItemStack[] stacks = recipe.getRecipe();
|
||||
for (ItemStack stack : stacks) {
|
||||
if (NEIServerUtils.areStacksSameTypeCrafting(stack, ingredient)) {
|
||||
arecipes.add(new CachedAlchemyRecipe(recipe));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(int id) {
|
||||
CachedAlchemyRecipe cache = (CachedAlchemyRecipe) arecipes.get(id);
|
||||
Minecraft.getMinecraft().fontRenderer.drawString("\u00a77" + cache.lp + "LP", getLPX(cache.lp), 34, 0);
|
||||
}
|
||||
|
||||
public int getLPX(int lp) {
|
||||
if (lp < 10) return 122;
|
||||
else if (lp < 100) return 122;
|
||||
else if (lp < 1000) return 130;
|
||||
else if (lp < 10000) return 127;
|
||||
else if (lp < 100000) return 124;
|
||||
return 122;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeName() {
|
||||
return StatCollector.translateToLocal("tile.blockWritingTable.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGuiTexture() {
|
||||
return new ResourceLocation("alchemicalwizardry", "gui/nei/alchemy.png").toString();
|
||||
}
|
||||
}
|
||||
//package WayofTime.alchemicalWizardry.client.nei;
|
||||
//
|
||||
//import static WayofTime.alchemicalWizardry.client.nei.NEIConfig.bloodOrbs;
|
||||
//
|
||||
//import java.awt.Rectangle;
|
||||
//import java.util.ArrayList;
|
||||
//import java.util.List;
|
||||
//
|
||||
//import net.minecraft.client.Minecraft;
|
||||
//import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
//import net.minecraft.item.Item;
|
||||
//import net.minecraft.item.ItemStack;
|
||||
//import net.minecraft.util.ResourceLocation;
|
||||
//import net.minecraft.util.StatCollector;
|
||||
//import WayofTime.alchemicalWizardry.api.alchemy.AlchemyRecipe;
|
||||
//import WayofTime.alchemicalWizardry.api.alchemy.AlchemyRecipeRegistry;
|
||||
//import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb;
|
||||
//import WayofTime.alchemicalWizardry.common.tileEntity.gui.GuiWritingTable;
|
||||
//import codechicken.nei.ItemList;
|
||||
//import codechicken.nei.NEIServerUtils;
|
||||
//import codechicken.nei.PositionedStack;
|
||||
//import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
//
|
||||
///**
|
||||
// * NEI Alchemy Recipe Handler by joshie *
|
||||
// */
|
||||
//public class NEIAlchemyRecipeHandler extends TemplateRecipeHandler {
|
||||
// public class CachedAlchemyRecipe extends CachedRecipe {
|
||||
// public class BloodOrbs {
|
||||
// public PositionedStack stack;
|
||||
//
|
||||
// public BloodOrbs(ItemStack orb) {
|
||||
// this.stack = new PositionedStack(orb, 136, 47, false);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// ArrayList<BloodOrbs> orbs;
|
||||
// PositionedStack output;
|
||||
// List<PositionedStack> inputs;
|
||||
// int lp;
|
||||
//
|
||||
// public CachedAlchemyRecipe(AlchemyRecipe recipe, ItemStack orb) {
|
||||
// this(recipe);
|
||||
// this.orbs = new ArrayList<BloodOrbs>();
|
||||
// orbs.add(new BloodOrbs(orb));
|
||||
// }
|
||||
//
|
||||
// public CachedAlchemyRecipe(AlchemyRecipe recipe) {
|
||||
// List<PositionedStack> inputs = new ArrayList<PositionedStack>();
|
||||
// ItemStack[] stacks = recipe.getRecipe();
|
||||
// if (stacks.length > 0) inputs.add(new PositionedStack(stacks[0], 76, 3));
|
||||
// if (stacks.length > 1) inputs.add(new PositionedStack(stacks[1], 51, 19));
|
||||
// if (stacks.length > 2) inputs.add(new PositionedStack(stacks[2], 101, 19));
|
||||
// if (stacks.length > 3) inputs.add(new PositionedStack(stacks[3], 64, 47));
|
||||
// if (stacks.length > 4) inputs.add(new PositionedStack(stacks[4], 88, 47));
|
||||
// this.inputs = inputs;
|
||||
// this.output = new PositionedStack(recipe.getResult(), 76, 25);
|
||||
// this.lp = recipe.getAmountNeeded() * 100;
|
||||
// this.orbs = new ArrayList<BloodOrbs>();
|
||||
// for (Item orb : bloodOrbs) {
|
||||
// if (((IBloodOrb) orb).getOrbLevel() >= recipe.getOrbLevel()) {
|
||||
// orbs.add(new BloodOrbs(new ItemStack(orb)));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public List<PositionedStack> getIngredients() {
|
||||
// return inputs;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public PositionedStack getResult() {
|
||||
// return output;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public PositionedStack getOtherStack() {
|
||||
// if (orbs == null || orbs.size() <= 0) return null;
|
||||
// return orbs.get((cycleticks / 48) % orbs.size()).stack;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public TemplateRecipeHandler newInstance() {
|
||||
// for (ItemStack item : ItemList.items) {
|
||||
// if (item != null && item.getItem() instanceof IBloodOrb) {
|
||||
// bloodOrbs.add(item.getItem());
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return super.newInstance();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String getOverlayIdentifier() {
|
||||
// return "alchemicalwizardry.alchemy";
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void loadTransferRects() {
|
||||
// transferRects.add(new RecipeTransferRect(new Rectangle(134, 22, 16, 24), "alchemicalwizardry.alchemy"));
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public Class<? extends GuiContainer> getGuiClass() {
|
||||
// return GuiWritingTable.class;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void loadCraftingRecipes(String outputId, Object... results) {
|
||||
// if (outputId.equals("alchemicalwizardry.alchemy") && getClass() == NEIAlchemyRecipeHandler.class) {
|
||||
// for (AlchemyRecipe recipe : AlchemyRecipeRegistry.recipes) {
|
||||
// if (recipe.getResult() != null) arecipes.add(new CachedAlchemyRecipe(recipe));
|
||||
// }
|
||||
// } else {
|
||||
// super.loadCraftingRecipes(outputId, results);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void loadCraftingRecipes(ItemStack result) {
|
||||
// for (AlchemyRecipe recipe : AlchemyRecipeRegistry.recipes) {
|
||||
// if (recipe == null) continue;
|
||||
// if (NEIServerUtils.areStacksSameTypeCrafting(result, recipe.getResult())) {
|
||||
// arecipes.add(new CachedAlchemyRecipe(recipe));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void loadUsageRecipes(ItemStack ingredient) {
|
||||
// if (ingredient.getItem() instanceof IBloodOrb) {
|
||||
// for (AlchemyRecipe recipe : AlchemyRecipeRegistry.recipes) {
|
||||
// if (recipe == null) continue;
|
||||
// if (((IBloodOrb) ingredient.getItem()).getOrbLevel() >= recipe.getOrbLevel()) {
|
||||
// arecipes.add(new CachedAlchemyRecipe(recipe, ingredient));
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// for (AlchemyRecipe recipe : AlchemyRecipeRegistry.recipes) {
|
||||
// if (recipe == null) continue;
|
||||
// ItemStack[] stacks = recipe.getRecipe();
|
||||
// for (ItemStack stack : stacks) {
|
||||
// if (NEIServerUtils.areStacksSameTypeCrafting(stack, ingredient)) {
|
||||
// arecipes.add(new CachedAlchemyRecipe(recipe));
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void drawExtras(int id) {
|
||||
// CachedAlchemyRecipe cache = (CachedAlchemyRecipe) arecipes.get(id);
|
||||
// Minecraft.getMinecraft().fontRendererObj.drawString("\u00a77" + cache.lp + "LP", getLPX(cache.lp), 34, 0);
|
||||
// }
|
||||
//
|
||||
// public int getLPX(int lp) {
|
||||
// if (lp < 10) return 122;
|
||||
// else if (lp < 100) return 122;
|
||||
// else if (lp < 1000) return 130;
|
||||
// else if (lp < 10000) return 127;
|
||||
// else if (lp < 100000) return 124;
|
||||
// return 122;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String getRecipeName() {
|
||||
// return StatCollector.translateToLocal("tile.blockWritingTable.name");
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String getGuiTexture() {
|
||||
// return new ResourceLocation("alchemicalwizardry", "gui/nei/alchemy.png").toString();
|
||||
// }
|
||||
//}
|
||||
|
|
|
@ -1,187 +1,187 @@
|
|||
package WayofTime.alchemicalWizardry.client.nei;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Point;
|
||||
import java.awt.Rectangle;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import org.lwjgl.input.Mouse;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.altarRecipeRegistry.AltarRecipe;
|
||||
import WayofTime.alchemicalWizardry.api.altarRecipeRegistry.AltarRecipeRegistry;
|
||||
import codechicken.nei.NEIServerUtils;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.GuiRecipe;
|
||||
import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
|
||||
/**
|
||||
* NEI Altar Recipe Handler by joshie *
|
||||
*/
|
||||
public class NEIAltarRecipeHandler extends TemplateRecipeHandler {
|
||||
public class CachedAltarRecipe extends CachedRecipe {
|
||||
PositionedStack input;
|
||||
// PositionedStack inputItems;
|
||||
PositionedStack output;
|
||||
int tier, lp_amount, consumption, drain;
|
||||
|
||||
public CachedAltarRecipe(AltarRecipe recipe) {
|
||||
// inputItems = new PositionedStack(recipe.input, 38, 2, false);
|
||||
input = new PositionedStack(recipe.requiredItem, 38, 2, false);
|
||||
output = new PositionedStack(recipe.result, 132, 32, false);
|
||||
tier = recipe.minTier;
|
||||
lp_amount = recipe.liquidRequired;
|
||||
consumption = recipe.consumptionRate;
|
||||
drain = recipe.drainRate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getIngredient() {
|
||||
return input;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getResult() {
|
||||
return output;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(String outputId, Object... results) {
|
||||
if (outputId.equals("alchemicalwizardry.altar") && getClass() == NEIAltarRecipeHandler.class) {
|
||||
for(AltarRecipe recipe: AltarRecipeRegistry.altarRecipes) {
|
||||
if(recipe != null && recipe.result != null) arecipes.add(new CachedAltarRecipe(recipe));
|
||||
}
|
||||
} else {
|
||||
super.loadCraftingRecipes(outputId, results);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(ItemStack result) {
|
||||
for(AltarRecipe recipe: AltarRecipeRegistry.altarRecipes) {
|
||||
if(NEIServerUtils.areStacksSameTypeCrafting(recipe.result, result)) {
|
||||
if(recipe != null && recipe.result != null) arecipes.add(new CachedAltarRecipe(recipe));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(ItemStack ingredient) {
|
||||
for(AltarRecipe recipe: AltarRecipeRegistry.altarRecipes) {
|
||||
if(NEIServerUtils.areStacksSameTypeCrafting(recipe.requiredItem, ingredient)) {
|
||||
if(recipe != null && recipe.result != null) arecipes.add(new CachedAltarRecipe(recipe));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Mouse Position helper
|
||||
public Point getMouse(int width, int height) {
|
||||
Point mousepos = getMousePosition();
|
||||
int guiLeft = (width - 176) / 2;
|
||||
int guiTop = (height - 166) / 2;
|
||||
Point relMouse = new Point(mousepos.x - guiLeft, mousepos.y - guiTop);
|
||||
return relMouse;
|
||||
}
|
||||
|
||||
//width helper, getting width normal way hates me on compile
|
||||
public int getGuiWidth(GuiRecipe gui) {
|
||||
try {
|
||||
Field f = gui.getClass().getField("width");
|
||||
return (Integer) f.get(gui);
|
||||
} catch (NoSuchFieldException e) {
|
||||
try {
|
||||
Field f = gui.getClass().getField("field_146294_l");
|
||||
return (Integer) f.get(gui);
|
||||
} catch (Exception e2) {
|
||||
return 0;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
//height helper, getting height normal way hates me on compile
|
||||
public int getGuiHeight(GuiRecipe gui) {
|
||||
try {
|
||||
Field f = gui.getClass().getField("height");
|
||||
return (Integer) f.get(gui);
|
||||
} catch (NoSuchFieldException e) {
|
||||
try {
|
||||
Field f = gui.getClass().getField("field_146295_m");
|
||||
return (Integer) f.get(gui);
|
||||
} catch (Exception e2) {
|
||||
return 0;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(int id) {
|
||||
CachedAltarRecipe recipe = (CachedAltarRecipe) arecipes.get(id);
|
||||
Minecraft.getMinecraft().fontRenderer.drawString("\u00a77" + StatCollector.translateToLocal("bm.string.tier") + ": " + recipe.tier, 78, 5, 0);
|
||||
Minecraft.getMinecraft().fontRenderer.drawString("\u00a77" + "LP: " + recipe.lp_amount, 78, 15, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> handleTooltip(GuiRecipe gui, List<String> currenttip, int id) {
|
||||
currenttip = super.handleTooltip(gui, currenttip, id);
|
||||
Point mouse = getMouse(getGuiWidth(gui), getGuiHeight(gui));
|
||||
CachedAltarRecipe recipe = (CachedAltarRecipe) arecipes.get(id);
|
||||
int yLow = id % 2 == 0 ? 38 : 102;
|
||||
int yHigh = id % 2 == 0 ? 72 : 136;
|
||||
if(mouse.x >= 19 && mouse.x <= 80 && mouse.y >= yLow && mouse.y <= yHigh) {
|
||||
currenttip.add(StatCollector.translateToLocal("bm.string.consume") + ": " + recipe.consumption + "LP/t");
|
||||
currenttip.add(StatCollector.translateToLocal("bm.string.drain") + ": " + recipe.drain + "LP/t");
|
||||
}
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOverlayIdentifier() {
|
||||
return "altarrecipes";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadTransferRects() {
|
||||
transferRects.add(new RecipeTransferRect(new Rectangle(90, 32, 22, 16), "alchemicalwizardry.altar"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeName() {
|
||||
return " " + StatCollector.translateToLocal("tile.bloodAltar.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGuiTexture() {
|
||||
return new ResourceLocation("alchemicalwizardry", "gui/nei/altar.png").toString();
|
||||
}
|
||||
|
||||
public static Point getMousePosition() {
|
||||
Dimension size = displaySize();
|
||||
Dimension res = displayRes();
|
||||
return new Point(Mouse.getX() * size.width / res.width, size.height - Mouse.getY() * size.height / res.height - 1);
|
||||
}
|
||||
|
||||
public static Dimension displaySize() {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
ScaledResolution res = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
|
||||
return new Dimension(res.getScaledWidth(), res.getScaledHeight());
|
||||
}
|
||||
|
||||
public static Dimension displayRes() {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
return new Dimension(mc.displayWidth, mc.displayHeight);
|
||||
}
|
||||
}
|
||||
//package WayofTime.alchemicalWizardry.client.nei;
|
||||
//
|
||||
//import java.awt.Dimension;
|
||||
//import java.awt.Point;
|
||||
//import java.awt.Rectangle;
|
||||
//import java.lang.reflect.Field;
|
||||
//import java.util.List;
|
||||
//
|
||||
//import net.minecraft.client.Minecraft;
|
||||
//import net.minecraft.client.gui.ScaledResolution;
|
||||
//import net.minecraft.item.ItemStack;
|
||||
//import net.minecraft.util.ResourceLocation;
|
||||
//import net.minecraft.util.StatCollector;
|
||||
//
|
||||
//import org.lwjgl.input.Mouse;
|
||||
//
|
||||
//import WayofTime.alchemicalWizardry.api.altarRecipeRegistry.AltarRecipe;
|
||||
//import WayofTime.alchemicalWizardry.api.altarRecipeRegistry.AltarRecipeRegistry;
|
||||
//import codechicken.nei.NEIServerUtils;
|
||||
//import codechicken.nei.PositionedStack;
|
||||
//import codechicken.nei.recipe.GuiRecipe;
|
||||
//import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
//
|
||||
///**
|
||||
// * NEI Altar Recipe Handler by joshie *
|
||||
// */
|
||||
//public class NEIAltarRecipeHandler extends TemplateRecipeHandler {
|
||||
// public class CachedAltarRecipe extends CachedRecipe {
|
||||
// PositionedStack input;
|
||||
//// PositionedStack inputItems;
|
||||
// PositionedStack output;
|
||||
// int tier, lp_amount, consumption, drain;
|
||||
//
|
||||
// public CachedAltarRecipe(AltarRecipe recipe) {
|
||||
//// inputItems = new PositionedStack(recipe.input, 38, 2, false);
|
||||
// input = new PositionedStack(recipe.requiredItem, 38, 2, false);
|
||||
// output = new PositionedStack(recipe.result, 132, 32, false);
|
||||
// tier = recipe.minTier;
|
||||
// lp_amount = recipe.liquidRequired;
|
||||
// consumption = recipe.consumptionRate;
|
||||
// drain = recipe.drainRate;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public PositionedStack getIngredient() {
|
||||
// return input;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public PositionedStack getResult() {
|
||||
// return output;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void loadCraftingRecipes(String outputId, Object... results) {
|
||||
// if (outputId.equals("alchemicalwizardry.altar") && getClass() == NEIAltarRecipeHandler.class) {
|
||||
// for(AltarRecipe recipe: AltarRecipeRegistry.altarRecipes) {
|
||||
// if(recipe != null && recipe.result != null) arecipes.add(new CachedAltarRecipe(recipe));
|
||||
// }
|
||||
// } else {
|
||||
// super.loadCraftingRecipes(outputId, results);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void loadCraftingRecipes(ItemStack result) {
|
||||
// for(AltarRecipe recipe: AltarRecipeRegistry.altarRecipes) {
|
||||
// if(NEIServerUtils.areStacksSameTypeCrafting(recipe.result, result)) {
|
||||
// if(recipe != null && recipe.result != null) arecipes.add(new CachedAltarRecipe(recipe));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void loadUsageRecipes(ItemStack ingredient) {
|
||||
// for(AltarRecipe recipe: AltarRecipeRegistry.altarRecipes) {
|
||||
// if(NEIServerUtils.areStacksSameTypeCrafting(recipe.requiredItem, ingredient)) {
|
||||
// if(recipe != null && recipe.result != null) arecipes.add(new CachedAltarRecipe(recipe));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// //Mouse Position helper
|
||||
// public Point getMouse(int width, int height) {
|
||||
// Point mousepos = getMousePosition();
|
||||
// int guiLeft = (width - 176) / 2;
|
||||
// int guiTop = (height - 166) / 2;
|
||||
// Point relMouse = new Point(mousepos.x - guiLeft, mousepos.y - guiTop);
|
||||
// return relMouse;
|
||||
// }
|
||||
//
|
||||
// //width helper, getting width normal way hates me on compile
|
||||
// public int getGuiWidth(GuiRecipe gui) {
|
||||
// try {
|
||||
// Field f = gui.getClass().getField("width");
|
||||
// return (Integer) f.get(gui);
|
||||
// } catch (NoSuchFieldException e) {
|
||||
// try {
|
||||
// Field f = gui.getClass().getField("field_146294_l");
|
||||
// return (Integer) f.get(gui);
|
||||
// } catch (Exception e2) {
|
||||
// return 0;
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// return 0;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// //height helper, getting height normal way hates me on compile
|
||||
// public int getGuiHeight(GuiRecipe gui) {
|
||||
// try {
|
||||
// Field f = gui.getClass().getField("height");
|
||||
// return (Integer) f.get(gui);
|
||||
// } catch (NoSuchFieldException e) {
|
||||
// try {
|
||||
// Field f = gui.getClass().getField("field_146295_m");
|
||||
// return (Integer) f.get(gui);
|
||||
// } catch (Exception e2) {
|
||||
// return 0;
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// return 0;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void drawExtras(int id) {
|
||||
// CachedAltarRecipe recipe = (CachedAltarRecipe) arecipes.get(id);
|
||||
// Minecraft.getMinecraft().fontRendererObj.drawString("\u00a77" + StatCollector.translateToLocal("bm.string.tier") + ": " + recipe.tier, 78, 5, 0);
|
||||
// Minecraft.getMinecraft().fontRendererObj.drawString("\u00a77" + "LP: " + recipe.lp_amount, 78, 15, 0);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public List<String> handleTooltip(GuiRecipe gui, List<String> currenttip, int id) {
|
||||
// currenttip = super.handleTooltip(gui, currenttip, id);
|
||||
// Point mouse = getMouse(getGuiWidth(gui), getGuiHeight(gui));
|
||||
// CachedAltarRecipe recipe = (CachedAltarRecipe) arecipes.get(id);
|
||||
// int yLow = id % 2 == 0 ? 38 : 102;
|
||||
// int yHigh = id % 2 == 0 ? 72 : 136;
|
||||
// if(mouse.x >= 19 && mouse.x <= 80 && mouse.y >= yLow && mouse.y <= yHigh) {
|
||||
// currenttip.add(StatCollector.translateToLocal("bm.string.consume") + ": " + recipe.consumption + "LP/t");
|
||||
// currenttip.add(StatCollector.translateToLocal("bm.string.drain") + ": " + recipe.drain + "LP/t");
|
||||
// }
|
||||
//
|
||||
// return currenttip;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String getOverlayIdentifier() {
|
||||
// return "altarrecipes";
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void loadTransferRects() {
|
||||
// transferRects.add(new RecipeTransferRect(new Rectangle(90, 32, 22, 16), "alchemicalwizardry.altar"));
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String getRecipeName() {
|
||||
// return " " + StatCollector.translateToLocal("tile.bloodAltar.name");
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String getGuiTexture() {
|
||||
// return new ResourceLocation("alchemicalwizardry", "gui/nei/altar.png").toString();
|
||||
// }
|
||||
//
|
||||
// public static Point getMousePosition() {
|
||||
// Dimension size = displaySize();
|
||||
// Dimension res = displayRes();
|
||||
// return new Point(Mouse.getX() * size.width / res.width, size.height - Mouse.getY() * size.height / res.height - 1);
|
||||
// }
|
||||
//
|
||||
// public static Dimension displaySize() {
|
||||
// Minecraft mc = Minecraft.getMinecraft();
|
||||
// ScaledResolution res = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
|
||||
// return new Dimension(res.getScaledWidth(), res.getScaledHeight());
|
||||
// }
|
||||
//
|
||||
// public static Dimension displayRes() {
|
||||
// Minecraft mc = Minecraft.getMinecraft();
|
||||
// return new Dimension(mc.displayWidth, mc.displayHeight);
|
||||
// }
|
||||
//}
|
||||
|
|
|
@ -1,136 +1,136 @@
|
|||
package WayofTime.alchemicalWizardry.client.nei;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.bindingRegistry.BindingRecipe;
|
||||
import WayofTime.alchemicalWizardry.api.bindingRegistry.BindingRegistry;
|
||||
import codechicken.nei.NEIServerUtils;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import org.lwjgl.input.Mouse;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
/**
|
||||
* Binding Ritual Handler by Arcaratus
|
||||
*/
|
||||
public class NEIBindingRitualHandler extends TemplateRecipeHandler
|
||||
{
|
||||
public class CachedBindingRecipe extends CachedRecipe
|
||||
{
|
||||
PositionedStack input, output;
|
||||
|
||||
public CachedBindingRecipe(BindingRecipe recipe)
|
||||
{
|
||||
input = new PositionedStack(recipe.requiredItem, 37, 21, false);
|
||||
output = new PositionedStack(recipe.outputItem, 110, 21, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getIngredient()
|
||||
{
|
||||
return input;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getResult()
|
||||
{
|
||||
return output;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(String outputId, Object... results)
|
||||
{
|
||||
if (outputId.equals("alchemicalwizardry.bindingritual") && getClass() == NEIBindingRitualHandler.class)
|
||||
{
|
||||
for (BindingRecipe recipe : BindingRegistry.bindingRecipes)
|
||||
{
|
||||
if (recipe != null && recipe.outputItem != null)
|
||||
{
|
||||
arecipes.add(new CachedBindingRecipe(recipe));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
super.loadCraftingRecipes(outputId, results);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(ItemStack result)
|
||||
{
|
||||
for (BindingRecipe recipe: BindingRegistry.bindingRecipes)
|
||||
{
|
||||
if (NEIServerUtils.areStacksSameTypeCrafting(recipe.outputItem, result))
|
||||
{
|
||||
if (recipe != null && recipe.outputItem != null)
|
||||
{
|
||||
arecipes.add(new CachedBindingRecipe(recipe));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(ItemStack ingredient)
|
||||
{
|
||||
for (BindingRecipe recipe: BindingRegistry.bindingRecipes)
|
||||
{
|
||||
if (NEIServerUtils.areStacksSameTypeCrafting(recipe.requiredItem, ingredient))
|
||||
{
|
||||
if (recipe != null && recipe.outputItem != null)
|
||||
{
|
||||
arecipes.add(new CachedBindingRecipe(recipe));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOverlayIdentifier()
|
||||
{
|
||||
return "alchemicalwizardry.bindingritual";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadTransferRects()
|
||||
{
|
||||
transferRects.add(new RecipeTransferRect(new Rectangle(68, 20, 22, 16), "alchemicalwizardry.bindingritual"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeName()
|
||||
{
|
||||
return "Binding Ritual";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGuiTexture()
|
||||
{
|
||||
return new ResourceLocation("alchemicalwizardry", "gui/nei/bindingRitual.png").toString();
|
||||
}
|
||||
|
||||
public static Point getMousePosition()
|
||||
{
|
||||
Dimension size = displaySize();
|
||||
Dimension res = displayRes();
|
||||
return new Point(Mouse.getX() * size.width / res.width, size.height - Mouse.getY() * size.height / res.height - 1);
|
||||
}
|
||||
|
||||
public static Dimension displaySize()
|
||||
{
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
ScaledResolution res = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
|
||||
return new Dimension(res.getScaledWidth(), res.getScaledHeight());
|
||||
}
|
||||
|
||||
public static Dimension displayRes()
|
||||
{
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
return new Dimension(mc.displayWidth, mc.displayHeight);
|
||||
}
|
||||
}
|
||||
//package WayofTime.alchemicalWizardry.client.nei;
|
||||
//
|
||||
//import WayofTime.alchemicalWizardry.api.bindingRegistry.BindingRecipe;
|
||||
//import WayofTime.alchemicalWizardry.api.bindingRegistry.BindingRegistry;
|
||||
//import codechicken.nei.NEIServerUtils;
|
||||
//import codechicken.nei.PositionedStack;
|
||||
//import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
//import net.minecraft.client.Minecraft;
|
||||
//import net.minecraft.client.gui.ScaledResolution;
|
||||
//import net.minecraft.item.ItemStack;
|
||||
//import net.minecraft.util.ResourceLocation;
|
||||
//import org.lwjgl.input.Mouse;
|
||||
//
|
||||
//import java.awt.*;
|
||||
//
|
||||
///**
|
||||
// * Binding Ritual Handler by Arcaratus
|
||||
// */
|
||||
//public class NEIBindingRitualHandler extends TemplateRecipeHandler
|
||||
//{
|
||||
// public class CachedBindingRecipe extends CachedRecipe
|
||||
// {
|
||||
// PositionedStack input, output;
|
||||
//
|
||||
// public CachedBindingRecipe(BindingRecipe recipe)
|
||||
// {
|
||||
// input = new PositionedStack(recipe.requiredItem, 37, 21, false);
|
||||
// output = new PositionedStack(recipe.outputItem, 110, 21, false);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public PositionedStack getIngredient()
|
||||
// {
|
||||
// return input;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public PositionedStack getResult()
|
||||
// {
|
||||
// return output;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void loadCraftingRecipes(String outputId, Object... results)
|
||||
// {
|
||||
// if (outputId.equals("alchemicalwizardry.bindingritual") && getClass() == NEIBindingRitualHandler.class)
|
||||
// {
|
||||
// for (BindingRecipe recipe : BindingRegistry.bindingRecipes)
|
||||
// {
|
||||
// if (recipe != null && recipe.outputItem != null)
|
||||
// {
|
||||
// arecipes.add(new CachedBindingRecipe(recipe));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// super.loadCraftingRecipes(outputId, results);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void loadCraftingRecipes(ItemStack result)
|
||||
// {
|
||||
// for (BindingRecipe recipe: BindingRegistry.bindingRecipes)
|
||||
// {
|
||||
// if (NEIServerUtils.areStacksSameTypeCrafting(recipe.outputItem, result))
|
||||
// {
|
||||
// if (recipe != null && recipe.outputItem != null)
|
||||
// {
|
||||
// arecipes.add(new CachedBindingRecipe(recipe));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void loadUsageRecipes(ItemStack ingredient)
|
||||
// {
|
||||
// for (BindingRecipe recipe: BindingRegistry.bindingRecipes)
|
||||
// {
|
||||
// if (NEIServerUtils.areStacksSameTypeCrafting(recipe.requiredItem, ingredient))
|
||||
// {
|
||||
// if (recipe != null && recipe.outputItem != null)
|
||||
// {
|
||||
// arecipes.add(new CachedBindingRecipe(recipe));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String getOverlayIdentifier()
|
||||
// {
|
||||
// return "alchemicalwizardry.bindingritual";
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void loadTransferRects()
|
||||
// {
|
||||
// transferRects.add(new RecipeTransferRect(new Rectangle(68, 20, 22, 16), "alchemicalwizardry.bindingritual"));
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String getRecipeName()
|
||||
// {
|
||||
// return "Binding Ritual";
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String getGuiTexture()
|
||||
// {
|
||||
// return new ResourceLocation("alchemicalwizardry", "gui/nei/bindingRitual.png").toString();
|
||||
// }
|
||||
//
|
||||
// public static Point getMousePosition()
|
||||
// {
|
||||
// Dimension size = displaySize();
|
||||
// Dimension res = displayRes();
|
||||
// return new Point(Mouse.getX() * size.width / res.width, size.height - Mouse.getY() * size.height / res.height - 1);
|
||||
// }
|
||||
//
|
||||
// public static Dimension displaySize()
|
||||
// {
|
||||
// Minecraft mc = Minecraft.getMinecraft();
|
||||
// ScaledResolution res = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
|
||||
// return new Dimension(res.getScaledWidth(), res.getScaledHeight());
|
||||
// }
|
||||
//
|
||||
// public static Dimension displayRes()
|
||||
// {
|
||||
// Minecraft mc = Minecraft.getMinecraft();
|
||||
// return new Dimension(mc.displayWidth, mc.displayHeight);
|
||||
// }
|
||||
//}
|
|
@ -1,142 +1,142 @@
|
|||
package WayofTime.alchemicalWizardry.client.nei;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import WayofTime.alchemicalWizardry.api.items.ShapedBloodOrbRecipe;
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb;
|
||||
import codechicken.nei.NEIServerUtils;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.ShapedRecipeHandler;
|
||||
|
||||
/**
|
||||
* NEI Blood Orb Shaped Recipe Handler by joshie *
|
||||
*/
|
||||
public class NEIBloodOrbShapedHandler extends ShapedRecipeHandler {
|
||||
public class CachedBloodOrbRecipe extends CachedShapedRecipe {
|
||||
public CachedBloodOrbRecipe(int width, int height, Object[] items, ItemStack out) {
|
||||
super(width, height, items, out);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setIngredients(int width, int height, Object[] items) {
|
||||
for (int x = 0; x < width; x++) {
|
||||
for (int y = 0; y < height; y++) {
|
||||
if (items[y * width + x] == null)
|
||||
continue;
|
||||
|
||||
Object o = items[y * width + x];
|
||||
if (o instanceof ItemStack) {
|
||||
PositionedStack stack = new PositionedStack(items[y * width + x], 25 + x * 18, 6 + y * 18, false);
|
||||
stack.setMaxSize(1);
|
||||
ingredients.add(stack);
|
||||
} else if (o instanceof Integer) {
|
||||
ArrayList<ItemStack> orbs = new ArrayList();
|
||||
for (Item item : NEIConfig.bloodOrbs) {
|
||||
if (((IBloodOrb) item).getOrbLevel() >= (Integer) o) {
|
||||
orbs.add(new ItemStack(item));
|
||||
}
|
||||
}
|
||||
|
||||
PositionedStack stack = new PositionedStack(orbs, 25 + x * 18, 6 + y * 18, false);
|
||||
stack.setMaxSize(1);
|
||||
ingredients.add(stack);
|
||||
}else if(o instanceof List)
|
||||
{
|
||||
PositionedStack stack = new PositionedStack(o, 25 + x * 18, 6 + y * 18, false);
|
||||
stack.setMaxSize(1);
|
||||
ingredients.add(stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(String outputId, Object... results) {
|
||||
if (outputId.equals("crafting") && getClass() == NEIBloodOrbShapedHandler.class) {
|
||||
for (IRecipe irecipe : (List<IRecipe>) CraftingManager.getInstance().getRecipeList()) {
|
||||
if (irecipe instanceof ShapedBloodOrbRecipe) {
|
||||
CachedBloodOrbRecipe recipe = forgeShapedRecipe((ShapedBloodOrbRecipe) irecipe);
|
||||
if (recipe == null)
|
||||
continue;
|
||||
|
||||
recipe.computeVisuals();
|
||||
arecipes.add(recipe);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
super.loadCraftingRecipes(outputId, results);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(ItemStack result) {
|
||||
for (IRecipe irecipe : (List<IRecipe>) CraftingManager.getInstance().getRecipeList()) {
|
||||
if (irecipe instanceof ShapedBloodOrbRecipe) {
|
||||
CachedBloodOrbRecipe recipe = forgeShapedRecipe((ShapedBloodOrbRecipe) irecipe);
|
||||
if (recipe == null || !NEIServerUtils.areStacksSameTypeCrafting(recipe.result.item, result))
|
||||
continue;
|
||||
|
||||
recipe.computeVisuals();
|
||||
arecipes.add(recipe);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(ItemStack ingredient) {
|
||||
for (IRecipe irecipe : (List<IRecipe>) CraftingManager.getInstance().getRecipeList()) {
|
||||
CachedShapedRecipe recipe = null;
|
||||
if (irecipe instanceof ShapedBloodOrbRecipe)
|
||||
recipe = forgeShapedRecipe((ShapedBloodOrbRecipe) irecipe);
|
||||
|
||||
if (recipe == null || !recipe.contains(recipe.ingredients, ingredient.getItem()))
|
||||
continue;
|
||||
|
||||
recipe.computeVisuals();
|
||||
if (recipe.contains(recipe.ingredients, ingredient)) {
|
||||
recipe.setIngredientPermutation(recipe.ingredients, ingredient);
|
||||
arecipes.add(recipe);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private CachedBloodOrbRecipe forgeShapedRecipe(ShapedBloodOrbRecipe recipe) {
|
||||
int width;
|
||||
int height;
|
||||
try {
|
||||
width = recipe.width;
|
||||
height = recipe.height;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
|
||||
Object[] items = recipe.getInput();
|
||||
for (Object item : items)
|
||||
if (item instanceof List && ((List<?>) item).isEmpty())// ore
|
||||
// handler,
|
||||
// no ores
|
||||
return null;
|
||||
|
||||
return new CachedBloodOrbRecipe(width, height, items, recipe.getRecipeOutput());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadTransferRects() {
|
||||
transferRects.add(new RecipeTransferRect(new Rectangle(84, 23, 24, 18), "crafting"));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getRecipeName() {
|
||||
return StatCollector.translateToLocal("bm.string.crafting.orb.shaped");
|
||||
}
|
||||
}
|
||||
//package WayofTime.alchemicalWizardry.client.nei;
|
||||
//
|
||||
//import java.awt.Rectangle;
|
||||
//import java.util.ArrayList;
|
||||
//import java.util.List;
|
||||
//
|
||||
//import net.minecraft.item.Item;
|
||||
//import net.minecraft.item.ItemStack;
|
||||
//import net.minecraft.item.crafting.CraftingManager;
|
||||
//import net.minecraft.item.crafting.IRecipe;
|
||||
//import net.minecraft.util.StatCollector;
|
||||
//import WayofTime.alchemicalWizardry.api.items.ShapedBloodOrbRecipe;
|
||||
//import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb;
|
||||
//import codechicken.nei.NEIServerUtils;
|
||||
//import codechicken.nei.PositionedStack;
|
||||
//import codechicken.nei.recipe.ShapedRecipeHandler;
|
||||
//
|
||||
///**
|
||||
// * NEI Blood Orb Shaped Recipe Handler by joshie *
|
||||
// */
|
||||
//public class NEIBloodOrbShapedHandler extends ShapedRecipeHandler {
|
||||
// public class CachedBloodOrbRecipe extends CachedShapedRecipe {
|
||||
// public CachedBloodOrbRecipe(int width, int height, Object[] items, ItemStack out) {
|
||||
// super(width, height, items, out);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void setIngredients(int width, int height, Object[] items) {
|
||||
// for (int x = 0; x < width; x++) {
|
||||
// for (int y = 0; y < height; y++) {
|
||||
// if (items[y * width + x] == null)
|
||||
// continue;
|
||||
//
|
||||
// Object o = items[y * width + x];
|
||||
// if (o instanceof ItemStack) {
|
||||
// PositionedStack stack = new PositionedStack(items[y * width + x], 25 + x * 18, 6 + y * 18, false);
|
||||
// stack.setMaxSize(1);
|
||||
// ingredients.add(stack);
|
||||
// } else if (o instanceof Integer) {
|
||||
// ArrayList<ItemStack> orbs = new ArrayList();
|
||||
// for (Item item : NEIConfig.bloodOrbs) {
|
||||
// if (((IBloodOrb) item).getOrbLevel() >= (Integer) o) {
|
||||
// orbs.add(new ItemStack(item));
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// PositionedStack stack = new PositionedStack(orbs, 25 + x * 18, 6 + y * 18, false);
|
||||
// stack.setMaxSize(1);
|
||||
// ingredients.add(stack);
|
||||
// }else if(o instanceof List)
|
||||
// {
|
||||
// PositionedStack stack = new PositionedStack(o, 25 + x * 18, 6 + y * 18, false);
|
||||
// stack.setMaxSize(1);
|
||||
// ingredients.add(stack);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void loadCraftingRecipes(String outputId, Object... results) {
|
||||
// if (outputId.equals("crafting") && getClass() == NEIBloodOrbShapedHandler.class) {
|
||||
// for (IRecipe irecipe : (List<IRecipe>) CraftingManager.getInstance().getRecipeList()) {
|
||||
// if (irecipe instanceof ShapedBloodOrbRecipe) {
|
||||
// CachedBloodOrbRecipe recipe = forgeShapedRecipe((ShapedBloodOrbRecipe) irecipe);
|
||||
// if (recipe == null)
|
||||
// continue;
|
||||
//
|
||||
// recipe.computeVisuals();
|
||||
// arecipes.add(recipe);
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// super.loadCraftingRecipes(outputId, results);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void loadCraftingRecipes(ItemStack result) {
|
||||
// for (IRecipe irecipe : (List<IRecipe>) CraftingManager.getInstance().getRecipeList()) {
|
||||
// if (irecipe instanceof ShapedBloodOrbRecipe) {
|
||||
// CachedBloodOrbRecipe recipe = forgeShapedRecipe((ShapedBloodOrbRecipe) irecipe);
|
||||
// if (recipe == null || !NEIServerUtils.areStacksSameTypeCrafting(recipe.result.item, result))
|
||||
// continue;
|
||||
//
|
||||
// recipe.computeVisuals();
|
||||
// arecipes.add(recipe);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void loadUsageRecipes(ItemStack ingredient) {
|
||||
// for (IRecipe irecipe : (List<IRecipe>) CraftingManager.getInstance().getRecipeList()) {
|
||||
// CachedShapedRecipe recipe = null;
|
||||
// if (irecipe instanceof ShapedBloodOrbRecipe)
|
||||
// recipe = forgeShapedRecipe((ShapedBloodOrbRecipe) irecipe);
|
||||
//
|
||||
// if (recipe == null || !recipe.contains(recipe.ingredients, ingredient.getItem()))
|
||||
// continue;
|
||||
//
|
||||
// recipe.computeVisuals();
|
||||
// if (recipe.contains(recipe.ingredients, ingredient)) {
|
||||
// recipe.setIngredientPermutation(recipe.ingredients, ingredient);
|
||||
// arecipes.add(recipe);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private CachedBloodOrbRecipe forgeShapedRecipe(ShapedBloodOrbRecipe recipe) {
|
||||
// int width;
|
||||
// int height;
|
||||
// try {
|
||||
// width = recipe.width;
|
||||
// height = recipe.height;
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// Object[] items = recipe.getInput();
|
||||
// for (Object item : items)
|
||||
// if (item instanceof List && ((List<?>) item).isEmpty())// ore
|
||||
// // handler,
|
||||
// // no ores
|
||||
// return null;
|
||||
//
|
||||
// return new CachedBloodOrbRecipe(width, height, items, recipe.getRecipeOutput());
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void loadTransferRects() {
|
||||
// transferRects.add(new RecipeTransferRect(new Rectangle(84, 23, 24, 18), "crafting"));
|
||||
// }
|
||||
//
|
||||
//
|
||||
// @Override
|
||||
// public String getRecipeName() {
|
||||
// return StatCollector.translateToLocal("bm.string.crafting.orb.shaped");
|
||||
// }
|
||||
//}
|
||||
|
|
|
@ -1,135 +1,135 @@
|
|||
package WayofTime.alchemicalWizardry.client.nei;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import WayofTime.alchemicalWizardry.api.items.ShapelessBloodOrbRecipe;
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb;
|
||||
import codechicken.nei.NEIServerUtils;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.ShapelessRecipeHandler;
|
||||
|
||||
/**
|
||||
* NEI Blood Orb Shapeless Recipe Handler by joshie *
|
||||
*/
|
||||
public class NEIBloodOrbShapelessHandler extends ShapelessRecipeHandler {
|
||||
public class CachedBloodOrbRecipe extends CachedShapelessRecipe {
|
||||
public CachedBloodOrbRecipe(ArrayList<Object> items, ItemStack recipeOutput) {
|
||||
super(items, recipeOutput);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setIngredients(List<?> items) {
|
||||
ingredients.clear();
|
||||
for (int ingred = 0; ingred < items.size(); ingred++) {
|
||||
Object o = items.get(ingred);
|
||||
if (o instanceof ItemStack) {
|
||||
PositionedStack stack = new PositionedStack(items.get(ingred), 25 + stackorder[ingred][0] * 18, 6 + stackorder[ingred][1] * 18);
|
||||
stack.setMaxSize(1);
|
||||
ingredients.add(stack);
|
||||
} else if (o instanceof Integer) {
|
||||
ArrayList<ItemStack> orbs = new ArrayList();
|
||||
for (Item item : NEIConfig.bloodOrbs) {
|
||||
if (((IBloodOrb) item).getOrbLevel() >= (Integer) o) {
|
||||
orbs.add(new ItemStack(item));
|
||||
}
|
||||
}
|
||||
|
||||
PositionedStack stack = new PositionedStack(orbs, 25 + stackorder[ingred][0] * 18, 6 + stackorder[ingred][1] * 18);
|
||||
stack.setMaxSize(1);
|
||||
ingredients.add(stack);
|
||||
}else if(o instanceof List)
|
||||
{
|
||||
PositionedStack stack = new PositionedStack(o, 25 + stackorder[ingred][0] * 18, 6 + stackorder[ingred][1] * 18);
|
||||
stack.setMaxSize(1);
|
||||
ingredients.add(stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(String outputId, Object... results) {
|
||||
if (outputId.equals("crafting") && getClass() == NEIBloodOrbShapelessHandler.class) {
|
||||
List<IRecipe> allrecipes = CraftingManager.getInstance().getRecipeList();
|
||||
for (IRecipe irecipe : allrecipes) {
|
||||
CachedBloodOrbRecipe recipe = null;
|
||||
if (irecipe instanceof ShapelessBloodOrbRecipe)
|
||||
recipe = forgeShapelessRecipe((ShapelessBloodOrbRecipe) irecipe);
|
||||
|
||||
if (recipe == null)
|
||||
continue;
|
||||
|
||||
arecipes.add(recipe);
|
||||
}
|
||||
} else {
|
||||
super.loadCraftingRecipes(outputId, results);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(ItemStack result) {
|
||||
List<IRecipe> allrecipes = CraftingManager.getInstance().getRecipeList();
|
||||
for (IRecipe irecipe : allrecipes) {
|
||||
if (NEIServerUtils.areStacksSameTypeCrafting(irecipe.getRecipeOutput(), result)) {
|
||||
CachedBloodOrbRecipe recipe = null;
|
||||
if (irecipe instanceof ShapelessBloodOrbRecipe)
|
||||
recipe = forgeShapelessRecipe((ShapelessBloodOrbRecipe) irecipe);
|
||||
|
||||
if (recipe == null)
|
||||
continue;
|
||||
|
||||
arecipes.add(recipe);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(ItemStack ingredient) {
|
||||
List<IRecipe> allrecipes = CraftingManager.getInstance().getRecipeList();
|
||||
for (IRecipe irecipe : allrecipes) {
|
||||
CachedBloodOrbRecipe recipe = null;
|
||||
if (irecipe instanceof ShapelessBloodOrbRecipe)
|
||||
recipe = forgeShapelessRecipe((ShapelessBloodOrbRecipe) irecipe);
|
||||
|
||||
if (recipe == null)
|
||||
continue;
|
||||
|
||||
if (recipe.contains(recipe.ingredients, ingredient)) {
|
||||
recipe.setIngredientPermutation(recipe.ingredients, ingredient);
|
||||
arecipes.add(recipe);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public CachedBloodOrbRecipe forgeShapelessRecipe(ShapelessBloodOrbRecipe recipe) {
|
||||
ArrayList<Object> items = recipe.getInput();
|
||||
|
||||
for (Object item : items)
|
||||
if (item instanceof List && ((List<?>) item).isEmpty())//ore handler, no ores
|
||||
return null;
|
||||
|
||||
return new CachedBloodOrbRecipe(items, recipe.getRecipeOutput());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadTransferRects() {
|
||||
transferRects.add(new RecipeTransferRect(new Rectangle(84, 23, 24, 18), "crafting"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOverlayIdentifier() {
|
||||
return "crafting";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeName() {
|
||||
return StatCollector.translateToLocal("bm.string.crafting.orb.shapeless");
|
||||
}
|
||||
}
|
||||
//package WayofTime.alchemicalWizardry.client.nei;
|
||||
//
|
||||
//import java.awt.Rectangle;
|
||||
//import java.util.ArrayList;
|
||||
//import java.util.List;
|
||||
//
|
||||
//import net.minecraft.item.Item;
|
||||
//import net.minecraft.item.ItemStack;
|
||||
//import net.minecraft.item.crafting.CraftingManager;
|
||||
//import net.minecraft.item.crafting.IRecipe;
|
||||
//import net.minecraft.util.StatCollector;
|
||||
//import WayofTime.alchemicalWizardry.api.items.ShapelessBloodOrbRecipe;
|
||||
//import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb;
|
||||
//import codechicken.nei.NEIServerUtils;
|
||||
//import codechicken.nei.PositionedStack;
|
||||
//import codechicken.nei.recipe.ShapelessRecipeHandler;
|
||||
//
|
||||
///**
|
||||
// * NEI Blood Orb Shapeless Recipe Handler by joshie *
|
||||
// */
|
||||
//public class NEIBloodOrbShapelessHandler extends ShapelessRecipeHandler {
|
||||
// public class CachedBloodOrbRecipe extends CachedShapelessRecipe {
|
||||
// public CachedBloodOrbRecipe(ArrayList<Object> items, ItemStack recipeOutput) {
|
||||
// super(items, recipeOutput);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void setIngredients(List<?> items) {
|
||||
// ingredients.clear();
|
||||
// for (int ingred = 0; ingred < items.size(); ingred++) {
|
||||
// Object o = items.get(ingred);
|
||||
// if (o instanceof ItemStack) {
|
||||
// PositionedStack stack = new PositionedStack(items.get(ingred), 25 + stackorder[ingred][0] * 18, 6 + stackorder[ingred][1] * 18);
|
||||
// stack.setMaxSize(1);
|
||||
// ingredients.add(stack);
|
||||
// } else if (o instanceof Integer) {
|
||||
// ArrayList<ItemStack> orbs = new ArrayList();
|
||||
// for (Item item : NEIConfig.bloodOrbs) {
|
||||
// if (((IBloodOrb) item).getOrbLevel() >= (Integer) o) {
|
||||
// orbs.add(new ItemStack(item));
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// PositionedStack stack = new PositionedStack(orbs, 25 + stackorder[ingred][0] * 18, 6 + stackorder[ingred][1] * 18);
|
||||
// stack.setMaxSize(1);
|
||||
// ingredients.add(stack);
|
||||
// }else if(o instanceof List)
|
||||
// {
|
||||
// PositionedStack stack = new PositionedStack(o, 25 + stackorder[ingred][0] * 18, 6 + stackorder[ingred][1] * 18);
|
||||
// stack.setMaxSize(1);
|
||||
// ingredients.add(stack);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void loadCraftingRecipes(String outputId, Object... results) {
|
||||
// if (outputId.equals("crafting") && getClass() == NEIBloodOrbShapelessHandler.class) {
|
||||
// List<IRecipe> allrecipes = CraftingManager.getInstance().getRecipeList();
|
||||
// for (IRecipe irecipe : allrecipes) {
|
||||
// CachedBloodOrbRecipe recipe = null;
|
||||
// if (irecipe instanceof ShapelessBloodOrbRecipe)
|
||||
// recipe = forgeShapelessRecipe((ShapelessBloodOrbRecipe) irecipe);
|
||||
//
|
||||
// if (recipe == null)
|
||||
// continue;
|
||||
//
|
||||
// arecipes.add(recipe);
|
||||
// }
|
||||
// } else {
|
||||
// super.loadCraftingRecipes(outputId, results);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void loadCraftingRecipes(ItemStack result) {
|
||||
// List<IRecipe> allrecipes = CraftingManager.getInstance().getRecipeList();
|
||||
// for (IRecipe irecipe : allrecipes) {
|
||||
// if (NEIServerUtils.areStacksSameTypeCrafting(irecipe.getRecipeOutput(), result)) {
|
||||
// CachedBloodOrbRecipe recipe = null;
|
||||
// if (irecipe instanceof ShapelessBloodOrbRecipe)
|
||||
// recipe = forgeShapelessRecipe((ShapelessBloodOrbRecipe) irecipe);
|
||||
//
|
||||
// if (recipe == null)
|
||||
// continue;
|
||||
//
|
||||
// arecipes.add(recipe);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void loadUsageRecipes(ItemStack ingredient) {
|
||||
// List<IRecipe> allrecipes = CraftingManager.getInstance().getRecipeList();
|
||||
// for (IRecipe irecipe : allrecipes) {
|
||||
// CachedBloodOrbRecipe recipe = null;
|
||||
// if (irecipe instanceof ShapelessBloodOrbRecipe)
|
||||
// recipe = forgeShapelessRecipe((ShapelessBloodOrbRecipe) irecipe);
|
||||
//
|
||||
// if (recipe == null)
|
||||
// continue;
|
||||
//
|
||||
// if (recipe.contains(recipe.ingredients, ingredient)) {
|
||||
// recipe.setIngredientPermutation(recipe.ingredients, ingredient);
|
||||
// arecipes.add(recipe);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public CachedBloodOrbRecipe forgeShapelessRecipe(ShapelessBloodOrbRecipe recipe) {
|
||||
// ArrayList<Object> items = recipe.getInput();
|
||||
//
|
||||
// for (Object item : items)
|
||||
// if (item instanceof List && ((List<?>) item).isEmpty())//ore handler, no ores
|
||||
// return null;
|
||||
//
|
||||
// return new CachedBloodOrbRecipe(items, recipe.getRecipeOutput());
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void loadTransferRects() {
|
||||
// transferRects.add(new RecipeTransferRect(new Rectangle(84, 23, 24, 18), "crafting"));
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String getOverlayIdentifier() {
|
||||
// return "crafting";
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String getRecipeName() {
|
||||
// return StatCollector.translateToLocal("bm.string.crafting.orb.shapeless");
|
||||
// }
|
||||
//}
|
||||
|
|
|
@ -1,35 +1,35 @@
|
|||
package WayofTime.alchemicalWizardry.client.nei;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import codechicken.nei.api.API;
|
||||
import codechicken.nei.api.IConfigureNEI;
|
||||
|
||||
public class NEIConfig implements IConfigureNEI {
|
||||
public static ArrayList<Item> bloodOrbs = new ArrayList<Item>();
|
||||
|
||||
@Override
|
||||
public void loadConfig() {
|
||||
API.registerRecipeHandler(new NEIAlchemyRecipeHandler());
|
||||
API.registerUsageHandler(new NEIAlchemyRecipeHandler());
|
||||
API.registerRecipeHandler(new NEIAltarRecipeHandler());
|
||||
API.registerUsageHandler(new NEIAltarRecipeHandler());
|
||||
API.registerRecipeHandler(new NEIBloodOrbShapedHandler());
|
||||
API.registerUsageHandler(new NEIBloodOrbShapedHandler());
|
||||
API.registerRecipeHandler(new NEIBloodOrbShapelessHandler());
|
||||
API.registerUsageHandler(new NEIBloodOrbShapelessHandler());
|
||||
API.registerRecipeHandler(new NEIBindingRitualHandler());
|
||||
API.registerUsageHandler(new NEIBindingRitualHandler());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "Blood Magic NEI";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getVersion() {
|
||||
return "1.3";
|
||||
}
|
||||
}
|
||||
//package WayofTime.alchemicalWizardry.client.nei;
|
||||
//
|
||||
//import java.util.ArrayList;
|
||||
//
|
||||
//import net.minecraft.item.Item;
|
||||
//import codechicken.nei.api.API;
|
||||
//import codechicken.nei.api.IConfigureNEI;
|
||||
//
|
||||
//public class NEIConfig implements IConfigureNEI {
|
||||
// public static ArrayList<Item> bloodOrbs = new ArrayList<Item>();
|
||||
//
|
||||
// @Override
|
||||
// public void loadConfig() {
|
||||
// API.registerRecipeHandler(new NEIAlchemyRecipeHandler());
|
||||
// API.registerUsageHandler(new NEIAlchemyRecipeHandler());
|
||||
// API.registerRecipeHandler(new NEIAltarRecipeHandler());
|
||||
// API.registerUsageHandler(new NEIAltarRecipeHandler());
|
||||
// API.registerRecipeHandler(new NEIBloodOrbShapedHandler());
|
||||
// API.registerUsageHandler(new NEIBloodOrbShapedHandler());
|
||||
// API.registerRecipeHandler(new NEIBloodOrbShapelessHandler());
|
||||
// API.registerUsageHandler(new NEIBloodOrbShapelessHandler());
|
||||
// API.registerRecipeHandler(new NEIBindingRitualHandler());
|
||||
// API.registerUsageHandler(new NEIBindingRitualHandler());
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String getName() {
|
||||
// return "Blood Magic NEI";
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String getVersion() {
|
||||
// return "1.3";
|
||||
// }
|
||||
//}
|
||||
|
|
|
@ -29,7 +29,7 @@ public class HUDElement
|
|||
public boolean showDamageOverlay = false;
|
||||
public boolean showItemCount = false;
|
||||
|
||||
static RenderItem itemRenderer = new RenderItem();
|
||||
static RenderItem itemRenderer = Minecraft.getMinecraft().getRenderItem();
|
||||
|
||||
public HUDElement(ItemStack itemStack, int iconW, int iconH, int padW, int value)
|
||||
{
|
||||
|
@ -54,8 +54,8 @@ public class HUDElement
|
|||
|
||||
private void initSize()
|
||||
{
|
||||
elementH = enableItemName ? Math.max(Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT * 2, iconH) :
|
||||
Math.max(mc.fontRenderer.FONT_HEIGHT, iconH);
|
||||
elementH = enableItemName ? Math.max(Minecraft.getMinecraft().fontRendererObj.FONT_HEIGHT * 2, iconH) :
|
||||
Math.max(mc.fontRendererObj.FONT_HEIGHT, iconH);
|
||||
|
||||
if (itemStack != null)
|
||||
{
|
||||
|
@ -65,7 +65,7 @@ public class HUDElement
|
|||
if (showValue)
|
||||
{
|
||||
maxDamage = itemStack.getMaxDamage() + 1;
|
||||
damage = maxDamage - itemStack.getItemDamageForDisplay();
|
||||
damage = maxDamage - itemStack.getItemDamage();
|
||||
|
||||
boolean showSpecialValue = true;
|
||||
boolean showValue = false;
|
||||
|
@ -88,17 +88,17 @@ public class HUDElement
|
|||
(damage * 100 / maxDamage) + "%";
|
||||
}
|
||||
|
||||
itemDamageW = mc.fontRenderer.getStringWidth(HUDUtils.stripCtrl(itemDamage));
|
||||
itemDamageW = mc.fontRendererObj.getStringWidth(HUDUtils.stripCtrl(itemDamage));
|
||||
elementW = padW + iconW + padW + itemDamageW + offset;
|
||||
|
||||
if (enableItemName)
|
||||
{
|
||||
itemName = itemStack.getDisplayName();
|
||||
elementW = padW + iconW + padW +
|
||||
Math.max(mc.fontRenderer.getStringWidth(HUDUtils.stripCtrl(itemName)), itemDamageW);
|
||||
Math.max(mc.fontRendererObj.getStringWidth(HUDUtils.stripCtrl(itemName)), itemDamageW);
|
||||
}
|
||||
|
||||
itemNameW = mc.fontRenderer.getStringWidth(HUDUtils.stripCtrl(itemName));
|
||||
itemNameW = mc.fontRendererObj.getStringWidth(HUDUtils.stripCtrl(itemName));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -114,27 +114,27 @@ public class HUDElement
|
|||
boolean toRight = true;
|
||||
if (toRight)
|
||||
{
|
||||
itemRenderer.renderItemAndEffectIntoGUI(mc.fontRenderer, mc.getTextureManager(), itemStack, x - (iconW + padW), y);
|
||||
HUDUtils.renderItemOverlayIntoGUI(mc.fontRenderer, itemStack, x - (iconW + padW), y, showDamageOverlay, showItemCount);
|
||||
itemRenderer.func_180450_b(itemStack, x - (iconW + padW), y);
|
||||
HUDUtils.renderItemOverlayIntoGUI(mc.fontRendererObj, itemStack, x - (iconW + padW), y, showDamageOverlay, showItemCount);
|
||||
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GL11.glDisable(32826 /* GL_RESCALE_NORMAL_EXT */);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
|
||||
mc.fontRenderer.drawStringWithShadow(itemName + "\247r", x - (padW + iconW + padW) - itemNameW, y, 0xffffff);
|
||||
mc.fontRenderer.drawStringWithShadow(itemDamage + "\247r", x - (padW + iconW + padW) - itemDamageW,
|
||||
mc.fontRendererObj.drawString(itemName + "\247r", x - (padW + iconW + padW) - itemNameW, y, 0xffffff);
|
||||
mc.fontRendererObj.drawString(itemDamage + "\247r", x - (padW + iconW + padW) - itemDamageW,
|
||||
y + (enableItemName ? elementH / 2 : elementH / 4), 0xffffff);
|
||||
} else
|
||||
{
|
||||
itemRenderer.renderItemAndEffectIntoGUI(mc.fontRenderer, mc.getTextureManager(), itemStack, x, y);
|
||||
HUDUtils.renderItemOverlayIntoGUI(mc.fontRenderer, itemStack, x, y, showDamageOverlay, showItemCount);
|
||||
itemRenderer.func_180450_b(itemStack, x, y);
|
||||
HUDUtils.renderItemOverlayIntoGUI(mc.fontRendererObj, itemStack, x, y, showDamageOverlay, showItemCount);
|
||||
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GL11.glDisable(32826 /* GL_RESCALE_NORMAL_EXT */);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
|
||||
mc.fontRenderer.drawStringWithShadow(itemName + "\247r", x + iconW + padW, y, 0xffffff);
|
||||
mc.fontRenderer.drawStringWithShadow(itemDamage + "\247r", x + iconW + padW,
|
||||
mc.fontRendererObj.drawString(itemName + "\247r", x + iconW + padW, y, 0xffffff);
|
||||
mc.fontRendererObj.drawString(itemDamage + "\247r", x + iconW + padW,
|
||||
y + (enableItemName ? elementH / 2 : elementH / 4), 0xffffff);
|
||||
}
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
|
|
@ -4,11 +4,13 @@ import net.minecraft.client.Minecraft;
|
|||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.WorldRenderer;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
/**
|
||||
|
@ -169,12 +171,13 @@ public final class HUDUtils
|
|||
{
|
||||
float var7 = 0.00390625F;
|
||||
float var8 = 0.00390625F;
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.addVertexWithUV((x + 0), (y + height), zLevel, ((u + 0) * var7), ((v + height) * var8));
|
||||
tessellator.addVertexWithUV((x + width), (y + height), zLevel, ((u + width) * var7), ((v + height) * var8));
|
||||
tessellator.addVertexWithUV((x + width), (y + 0), zLevel, ((u + width) * var7), ((v + 0) * var8));
|
||||
tessellator.addVertexWithUV((x + 0), (y + 0), zLevel, ((u + 0) * var7), ((v + 0) * var8));
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
WorldRenderer wr = tessellator.getWorldRenderer();
|
||||
wr.startDrawingQuads();
|
||||
wr.addVertexWithUV((x + 0), (y + height), zLevel, ((u + 0) * var7), ((v + height) * var8));
|
||||
wr.addVertexWithUV((x + width), (y + height), zLevel, ((u + width) * var7), ((v + height) * var8));
|
||||
wr.addVertexWithUV((x + width), (y + 0), zLevel, ((u + width) * var7), ((v + 0) * var8));
|
||||
wr.addVertexWithUV((x + 0), (y + 0), zLevel, ((u + 0) * var7), ((v + 0) * var8));
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
|
@ -195,12 +198,12 @@ public final class HUDUtils
|
|||
{
|
||||
if (itemStack.isItemDamaged() && showDamageBar)
|
||||
{
|
||||
int var11 = (int) Math.round(13.0D - itemStack.getItemDamageForDisplay() * 13.0D / itemStack.getMaxDamage());
|
||||
int var7 = (int) Math.round(255.0D - itemStack.getItemDamageForDisplay() * 255.0D / itemStack.getMaxDamage());
|
||||
int var11 = (int) Math.round(13.0D - itemStack.getItemDamage() * 13.0D / itemStack.getMaxDamage());
|
||||
int var7 = (int) Math.round(255.0D - itemStack.getItemDamage() * 255.0D / itemStack.getMaxDamage());
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
Tessellator var8 = Tessellator.instance;
|
||||
Tessellator var8 = Tessellator.getInstance();
|
||||
int var9 = 255 - var7 << 16 | var7 << 8;
|
||||
int var10 = (255 - var7) / 4 << 16 | 16128;
|
||||
renderQuad(var8, x + 2, y + 13, 13, 2, 0);
|
||||
|
@ -226,7 +229,7 @@ public final class HUDUtils
|
|||
String var6 = "" + count;
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
fontRenderer.drawStringWithShadow(var6, x + 19 - 2 - fontRenderer.getStringWidth(var6), y + 6 + 3, 16777215);
|
||||
fontRenderer.drawString(var6, x + 19 - 2 - fontRenderer.getStringWidth(var6), y + 6 + 3, 16777215);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
}
|
||||
|
@ -240,12 +243,13 @@ public final class HUDUtils
|
|||
*/
|
||||
public static void renderQuad(Tessellator tessellator, int x, int y, int width, int height, int color)
|
||||
{
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setColorOpaque_I(color);
|
||||
tessellator.addVertex((x + 0), (y + 0), 0.0D);
|
||||
tessellator.addVertex((x + 0), (y + height), 0.0D);
|
||||
tessellator.addVertex((x + width), (y + height), 0.0D);
|
||||
tessellator.addVertex((x + width), (y + 0), 0.0D);
|
||||
WorldRenderer wr = tessellator.getWorldRenderer();
|
||||
wr.startDrawingQuads();
|
||||
// wr.setColorOpaque_I(color);
|
||||
wr.addVertex((x + 0), (y + 0), 0.0D);
|
||||
wr.addVertex((x + 0), (y + height), 0.0D);
|
||||
wr.addVertex((x + width), (y + height), 0.0D);
|
||||
wr.addVertex((x + width), (y + 0), 0.0D);
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ package WayofTime.alchemicalWizardry.client.renderer;
|
|||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.client.renderer.WorldRenderer;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/*
|
||||
|
@ -16,10 +16,11 @@ public class RenderFakeBlocks
|
|||
double maxX = minX + 1;
|
||||
double maxY = minY + 1;
|
||||
double maxZ = minZ + 1;
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
WorldRenderer wr = tessellator.getWorldRenderer();
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setColorRGBA(255, 255, 255, 200);
|
||||
wr.startDrawingQuads();
|
||||
// wr.setColorRGBA(255, 255, 255, 200);
|
||||
|
||||
float texMinU, texMaxU, texMinV, texMaxV;
|
||||
|
||||
|
@ -27,80 +28,76 @@ public class RenderFakeBlocks
|
|||
texMaxU = getMaxU(block, meta, 0);
|
||||
texMinV = getMinV(block, meta, 0);
|
||||
texMaxV = getMaxV(block, meta, 0);
|
||||
tessellator.addVertexWithUV(minX, minY, minZ, texMinU, texMinV);
|
||||
tessellator.addVertexWithUV(maxX, minY, minZ, texMaxU, texMinV);
|
||||
tessellator.addVertexWithUV(maxX, minY, maxZ, texMaxU, texMaxV);
|
||||
tessellator.addVertexWithUV(minX, minY, maxZ, texMinU, texMaxV);
|
||||
wr.addVertexWithUV(minX, minY, minZ, texMinU, texMinV);
|
||||
wr.addVertexWithUV(maxX, minY, minZ, texMaxU, texMinV);
|
||||
wr.addVertexWithUV(maxX, minY, maxZ, texMaxU, texMaxV);
|
||||
wr.addVertexWithUV(minX, minY, maxZ, texMinU, texMaxV);
|
||||
|
||||
texMinU = getMinU(block, meta, 1);
|
||||
texMaxU = getMaxU(block, meta, 1);
|
||||
texMinV = getMinV(block, meta, 1);
|
||||
texMaxV = getMaxV(block, meta, 1);
|
||||
tessellator.addVertexWithUV(minX, maxY, maxZ, texMinU, texMaxV);
|
||||
tessellator.addVertexWithUV(maxX, maxY, maxZ, texMaxU, texMaxV);
|
||||
tessellator.addVertexWithUV(maxX, maxY, minZ, texMaxU, texMinV);
|
||||
tessellator.addVertexWithUV(minX, maxY, minZ, texMinU, texMinV);
|
||||
wr.addVertexWithUV(minX, maxY, maxZ, texMinU, texMaxV);
|
||||
wr.addVertexWithUV(maxX, maxY, maxZ, texMaxU, texMaxV);
|
||||
wr.addVertexWithUV(maxX, maxY, minZ, texMaxU, texMinV);
|
||||
wr.addVertexWithUV(minX, maxY, minZ, texMinU, texMinV);
|
||||
|
||||
texMinU = getMinU(block, meta, 2);
|
||||
texMaxU = getMaxU(block, meta, 2);
|
||||
texMinV = getMinV(block, meta, 2);
|
||||
texMaxV = getMaxV(block, meta, 2);
|
||||
tessellator.addVertexWithUV(maxX, minY, minZ, texMinU, texMaxV);
|
||||
tessellator.addVertexWithUV(minX, minY, minZ, texMaxU, texMaxV);
|
||||
tessellator.addVertexWithUV(minX, maxY, minZ, texMaxU, texMinV);
|
||||
tessellator.addVertexWithUV(maxX, maxY, minZ, texMinU, texMinV);
|
||||
wr.addVertexWithUV(maxX, minY, minZ, texMinU, texMaxV);
|
||||
wr.addVertexWithUV(minX, minY, minZ, texMaxU, texMaxV);
|
||||
wr.addVertexWithUV(minX, maxY, minZ, texMaxU, texMinV);
|
||||
wr.addVertexWithUV(maxX, maxY, minZ, texMinU, texMinV);
|
||||
|
||||
texMinU = getMinU(block, meta, 3);
|
||||
texMaxU = getMaxU(block, meta, 3);
|
||||
texMinV = getMinV(block, meta, 3);
|
||||
texMaxV = getMaxV(block, meta, 3);
|
||||
tessellator.addVertexWithUV(minX, minY, maxZ, texMinU, texMaxV);
|
||||
tessellator.addVertexWithUV(maxX, minY, maxZ, texMaxU, texMaxV);
|
||||
tessellator.addVertexWithUV(maxX, maxY, maxZ, texMaxU, texMinV);
|
||||
tessellator.addVertexWithUV(minX, maxY, maxZ, texMinU, texMinV);
|
||||
wr.addVertexWithUV(minX, minY, maxZ, texMinU, texMaxV);
|
||||
wr.addVertexWithUV(maxX, minY, maxZ, texMaxU, texMaxV);
|
||||
wr.addVertexWithUV(maxX, maxY, maxZ, texMaxU, texMinV);
|
||||
wr.addVertexWithUV(minX, maxY, maxZ, texMinU, texMinV);
|
||||
|
||||
texMinU = getMinU(block, meta, 4);
|
||||
texMaxU = getMaxU(block, meta, 4);
|
||||
texMinV = getMinV(block, meta, 4);
|
||||
texMaxV = getMaxV(block, meta, 4);
|
||||
tessellator.addVertexWithUV(minX, minY, minZ, texMinU, texMaxV);
|
||||
tessellator.addVertexWithUV(minX, minY, maxZ, texMaxU, texMaxV);
|
||||
tessellator.addVertexWithUV(minX, maxY, maxZ, texMaxU, texMinV);
|
||||
tessellator.addVertexWithUV(minX, maxY, minZ, texMinU, texMinV);
|
||||
wr.addVertexWithUV(minX, minY, minZ, texMinU, texMaxV);
|
||||
wr.addVertexWithUV(minX, minY, maxZ, texMaxU, texMaxV);
|
||||
wr.addVertexWithUV(minX, maxY, maxZ, texMaxU, texMinV);
|
||||
wr.addVertexWithUV(minX, maxY, minZ, texMinU, texMinV);
|
||||
|
||||
texMinU = getMinU(block, meta, 5);
|
||||
texMaxU = getMaxU(block, meta, 5);
|
||||
texMinV = getMinV(block, meta, 5);
|
||||
texMaxV = getMaxV(block, meta, 5);
|
||||
tessellator.addVertexWithUV(maxX, minY, maxZ, texMinU, texMaxV);
|
||||
tessellator.addVertexWithUV(maxX, minY, minZ, texMaxU, texMaxV);
|
||||
tessellator.addVertexWithUV(maxX, maxY, minZ, texMaxU, texMinV);
|
||||
tessellator.addVertexWithUV(maxX, maxY, maxZ, texMinU, texMinV);
|
||||
wr.addVertexWithUV(maxX, minY, maxZ, texMinU, texMaxV);
|
||||
wr.addVertexWithUV(maxX, minY, minZ, texMaxU, texMaxV);
|
||||
wr.addVertexWithUV(maxX, maxY, minZ, texMaxU, texMinV);
|
||||
wr.addVertexWithUV(maxX, maxY, maxZ, texMinU, texMinV);
|
||||
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
private static float getMinU(Block block, int meta, int side)
|
||||
{
|
||||
IIcon icon = block.getIcon(side, meta);
|
||||
return icon.getMinU();
|
||||
return 0;
|
||||
}
|
||||
|
||||
private static float getMaxU(Block block, int meta, int side)
|
||||
{
|
||||
IIcon icon = block.getIcon(side, meta);
|
||||
return icon.getMaxU();
|
||||
return 256;
|
||||
}
|
||||
|
||||
private static float getMinV(Block block, int meta, int side)
|
||||
{
|
||||
IIcon icon = block.getIcon(side, meta);
|
||||
return icon.getMinV();
|
||||
return 0;
|
||||
}
|
||||
|
||||
private static float getMaxV(Block block, int meta, int side)
|
||||
{
|
||||
IIcon icon = block.getIcon(side, meta);
|
||||
return icon.getMaxV();
|
||||
return 256;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,14 +7,14 @@ import net.minecraft.client.Minecraft;
|
|||
import net.minecraft.client.gui.GuiChat;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.WorldRenderer;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
|
@ -179,11 +179,9 @@ public class RenderHelper
|
|||
{
|
||||
if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
|
||||
{
|
||||
int x = movingobjectposition.blockX;
|
||||
int y = movingobjectposition.blockY;
|
||||
int z = movingobjectposition.blockZ;
|
||||
BlockPos pos = movingobjectposition.func_178782_a();
|
||||
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
|
||||
if (!(tile instanceof IReagentHandler))
|
||||
{
|
||||
|
@ -192,7 +190,7 @@ public class RenderHelper
|
|||
|
||||
IReagentHandler relay = (IReagentHandler) tile;
|
||||
|
||||
ReagentContainerInfo[] infos = relay.getContainerInfo(ForgeDirection.getOrientation(movingobjectposition.sideHit));
|
||||
ReagentContainerInfo[] infos = relay.getContainerInfo(movingobjectposition.field_178784_b);
|
||||
|
||||
if (infos != null)
|
||||
{
|
||||
|
@ -250,12 +248,13 @@ public class RenderHelper
|
|||
{
|
||||
float f = 0.00390625F;
|
||||
float f1 = 0.00390625F;
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.addVertexWithUV((double)p_73729_1_, p_73729_2_ + p_73729_6_, (double)zLevel, (p_73729_3_ * f), (p_73729_4_ + p_73729_6_) * f1);
|
||||
tessellator.addVertexWithUV(p_73729_1_ + p_73729_5_, p_73729_2_ + p_73729_6_, (double)zLevel, (p_73729_3_ + p_73729_5_) * f, (p_73729_4_ + p_73729_6_) * f1);
|
||||
tessellator.addVertexWithUV(p_73729_1_ + p_73729_5_, (double)p_73729_2_, (double)zLevel, (p_73729_3_ + p_73729_5_) * f, p_73729_4_ * f1);
|
||||
tessellator.addVertexWithUV((double)p_73729_1_, (double)p_73729_2_, (double)zLevel, (double)(p_73729_3_ * f), p_73729_4_ * f1);
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
WorldRenderer wr = tessellator.getWorldRenderer();
|
||||
wr.startDrawingQuads();
|
||||
wr.addVertexWithUV((double)p_73729_1_, p_73729_2_ + p_73729_6_, (double)zLevel, (p_73729_3_ * f), (p_73729_4_ + p_73729_6_) * f1);
|
||||
wr.addVertexWithUV(p_73729_1_ + p_73729_5_, p_73729_2_ + p_73729_6_, (double)zLevel, (p_73729_3_ + p_73729_5_) * f, (p_73729_4_ + p_73729_6_) * f1);
|
||||
wr.addVertexWithUV(p_73729_1_ + p_73729_5_, (double)p_73729_2_, (double)zLevel, (p_73729_3_ + p_73729_5_) * f, p_73729_4_ * f1);
|
||||
wr.addVertexWithUV((double)p_73729_1_, (double)p_73729_2_, (double)zLevel, (double)(p_73729_3_ * f), p_73729_4_ * f1);
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
|
@ -288,17 +287,6 @@ public class RenderHelper
|
|||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
public static void renderIcon(int p_94149_1_, int p_94149_2_, IIcon p_94149_3_, int p_94149_4_, int p_94149_5_)
|
||||
{
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.addVertexWithUV((double)p_94149_1_, (double)(p_94149_2_ + p_94149_5_), (double)zLevel, (double)p_94149_3_.getMinU(), (double)p_94149_3_.getMaxV());
|
||||
tessellator.addVertexWithUV((double)(p_94149_1_ + p_94149_4_), (double)(p_94149_2_ + p_94149_5_), (double)zLevel, (double)p_94149_3_.getMaxU(), (double)p_94149_3_.getMaxV());
|
||||
tessellator.addVertexWithUV((double)(p_94149_1_ + p_94149_4_), (double)p_94149_2_, (double)zLevel, (double)p_94149_3_.getMaxU(), (double)p_94149_3_.getMinV());
|
||||
tessellator.addVertexWithUV((double)p_94149_1_, (double)p_94149_2_, (double)zLevel, (double)p_94149_3_.getMinU(), (double)p_94149_3_.getMinV());
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
private static void displayArmorStatus(Minecraft mc)
|
||||
{
|
||||
|
|
|
@ -1,7 +1,16 @@
|
|||
package WayofTime.alchemicalWizardry.client.renderer;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.event.RenderWorldLastEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import WayofTime.alchemicalWizardry.ModBlocks;
|
||||
|
@ -11,13 +20,7 @@ import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
|
|||
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.Rituals;
|
||||
import WayofTime.alchemicalWizardry.common.items.ItemRitualDiviner;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.entity.EntityClientPlayerMP;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.event.RenderWorldLastEvent;
|
||||
|
||||
|
||||
/*
|
||||
* Created in Scala by Alex-Hawks
|
||||
|
@ -30,22 +33,24 @@ public class RitualDivinerRender
|
|||
public void render(RenderWorldLastEvent event)
|
||||
{
|
||||
Minecraft minecraft = Minecraft.getMinecraft();
|
||||
EntityClientPlayerMP player = minecraft.thePlayer;
|
||||
EntityPlayer player = minecraft.thePlayer;
|
||||
World world = player.worldObj;
|
||||
|
||||
if (minecraft.objectMouseOver == null || minecraft.objectMouseOver.typeOfHit != MovingObjectPosition.MovingObjectType.BLOCK)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
BlockPos pos = minecraft.objectMouseOver.func_178782_a();
|
||||
|
||||
TileEntity tileEntity = world.getTileEntity(minecraft.objectMouseOver.blockX, minecraft.objectMouseOver.blockY, minecraft.objectMouseOver.blockZ);
|
||||
TileEntity tileEntity = world.getTileEntity(pos);
|
||||
|
||||
if (!(tileEntity instanceof IMasterRitualStone))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Vector3 vec3 = new Vector3(minecraft.objectMouseOver.blockX, minecraft.objectMouseOver.blockY, minecraft.objectMouseOver.blockZ);
|
||||
Vector3 vec3 = new Vector3(pos.getX(), pos.getY(), pos.getZ());
|
||||
double posX = player.lastTickPosX + (player.posX - player.lastTickPosX) * event.partialTicks;
|
||||
double posY = player.lastTickPosY + (player.posY - player.lastTickPosY) * event.partialTicks;
|
||||
double posZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * event.partialTicks;
|
||||
|
@ -71,7 +76,7 @@ public class RitualDivinerRender
|
|||
double minY = vX.y - posY;
|
||||
double minZ = vX.z - posZ;
|
||||
|
||||
if (!world.getBlock(vX.x, vX.y, vX.z).isOpaqueCube())
|
||||
if (!world.getBlockState(new BlockPos(vX.x, vX.y, vX.z)).getBlock().isOpaqueCube())
|
||||
{
|
||||
RenderFakeBlocks.drawFakeBlock(vX, ModBlocks.ritualStone, ritualComponent.getStoneType(), minX, minY, minZ, world);
|
||||
}
|
||||
|
|
|
@ -7,8 +7,6 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
import WayofTime.alchemicalWizardry.common.achievements.ModAchievements;
|
||||
import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.IHoardDemon;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
|
@ -24,18 +22,25 @@ import net.minecraft.potion.Potion;
|
|||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraftforge.common.ISpecialArmor.ArmorProperties;
|
||||
import net.minecraftforge.event.AnvilUpdateEvent;
|
||||
import net.minecraftforge.event.entity.living.EnderTeleportEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingAttackEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingDeathEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent.LivingJumpEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingHurtEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingSpawnEvent.CheckSpawn;
|
||||
import net.minecraftforge.event.entity.player.EntityInteractEvent;
|
||||
import net.minecraftforge.fml.client.event.ConfigChangedEvent;
|
||||
import net.minecraftforge.fml.common.Optional;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event.Result;
|
||||
import net.minecraftforge.fml.common.eventhandler.EventPriority;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.gameevent.PlayerEvent.PlayerRespawnEvent;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import vazkii.botania.api.internal.IManaBurst;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
|
@ -53,13 +58,7 @@ import WayofTime.alchemicalWizardry.common.omega.OmegaRegistry;
|
|||
import WayofTime.alchemicalWizardry.common.omega.ReagentRegenConfiguration;
|
||||
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone;
|
||||
import cpw.mods.fml.client.event.ConfigChangedEvent;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.common.eventhandler.Event.Result;
|
||||
import cpw.mods.fml.common.eventhandler.EventPriority;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.PlayerEvent.PlayerRespawnEvent;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
|
||||
public class AlchemicalWizardryEventHooks
|
||||
{
|
||||
|
@ -117,7 +116,7 @@ public class AlchemicalWizardryEventHooks
|
|||
float prevHp = APISpellHelper.getCurrentAdditionalHP((EntityPlayer)event.entityLiving);
|
||||
if(prevHp > 0)
|
||||
{
|
||||
float recalculatedAmount = ArmorProperties.ApplyArmor(player, player.inventory.armorInventory, event.source, event.ammount);
|
||||
float recalculatedAmount = ArmorProperties.applyArmor(player, player.inventory.armorInventory, event.source, event.ammount);
|
||||
if (recalculatedAmount <= 0) return;
|
||||
recalculatedAmount = SpellHelper.applyPotionDamageCalculations(player, event.source, recalculatedAmount); //Recalculated damage
|
||||
|
||||
|
@ -335,7 +334,7 @@ public class AlchemicalWizardryEventHooks
|
|||
|
||||
String respawnRitual = "AW028SpawnWard";
|
||||
|
||||
int dimension = event.world.provider.dimensionId;
|
||||
int dimension = event.world.provider.getDimensionId();
|
||||
if (respawnMap.containsKey(dimension))
|
||||
{
|
||||
List<CoordAndRange> list = respawnMap.get(dimension);
|
||||
|
@ -344,7 +343,7 @@ public class AlchemicalWizardryEventHooks
|
|||
{
|
||||
for (CoordAndRange coords : list)
|
||||
{
|
||||
TileEntity tile = event.world.getTileEntity(coords.xCoord, coords.yCoord, coords.zCoord);
|
||||
TileEntity tile = event.world.getTileEntity(coords.getPos());
|
||||
|
||||
if (tile instanceof TEMasterStone && ((TEMasterStone) tile).isRunning && ((TEMasterStone) tile).getCurrentRitual().equals(respawnRitual))
|
||||
{
|
||||
|
@ -388,7 +387,7 @@ public class AlchemicalWizardryEventHooks
|
|||
{
|
||||
for (CoordAndRange coords : list)
|
||||
{
|
||||
TileEntity tile = event.world.getTileEntity(coords.xCoord, coords.yCoord, coords.zCoord);
|
||||
TileEntity tile = event.world.getTileEntity(coords.getPos());
|
||||
|
||||
if (tile instanceof TEMasterStone && ((TEMasterStone) tile).isRunning && ((TEMasterStone) tile).getCurrentRitual().equals(forceSpawnRitual))
|
||||
{
|
||||
|
@ -508,10 +507,10 @@ public class AlchemicalWizardryEventHooks
|
|||
double y = entityLiving.posY;
|
||||
double z = entityLiving.posZ;
|
||||
|
||||
Vec3 blockVector = SpellHelper.getEntityBlockVector(entityLiving);
|
||||
int xPos = (int) (blockVector.xCoord);
|
||||
int yPos = (int) (blockVector.yCoord);
|
||||
int zPos = (int) (blockVector.zCoord);
|
||||
BlockPos blockVector = entityLiving.getPosition();
|
||||
int xPos = blockVector.getX();
|
||||
int yPos = blockVector.getY();
|
||||
int zPos = blockVector.getZ();
|
||||
|
||||
if (entityLiving instanceof EntityPlayer)
|
||||
{
|
||||
|
@ -592,7 +591,7 @@ public class AlchemicalWizardryEventHooks
|
|||
int posY = (int) Math.round(entity.posY);
|
||||
int posZ = (int) Math.round(entity.posZ - 0.5f);
|
||||
int d0 = (int) ((i + 1) * 2.5);
|
||||
AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox(posX - 0.5, posY - 0.5, posZ - 0.5, posX + 0.5, posY + 0.5, posZ + 0.5).expand(d0, d0, d0);
|
||||
AxisAlignedBB axisalignedbb = new AxisAlignedBB(posX - 0.5, posY - 0.5, posZ - 0.5, posX + 0.5, posY + 0.5, posZ + 0.5).expand(d0, d0, d0);
|
||||
List list = event.entityLiving.worldObj.getEntitiesWithinAABB(Entity.class, axisalignedbb);
|
||||
Iterator iterator = list.iterator();
|
||||
|
||||
|
@ -697,7 +696,7 @@ public class AlchemicalWizardryEventHooks
|
|||
|
||||
if (entityLiving.isPotionActive(AlchemicalWizardry.customPotionFlameCloak))
|
||||
{
|
||||
entityLiving.worldObj.spawnParticle("flame", x + SpellHelper.gaussian(1), y - 1.3 + SpellHelper.gaussian(0.3), z + SpellHelper.gaussian(1), 0, 0.06d, 0);
|
||||
entityLiving.worldObj.spawnParticle(EnumParticleTypes.FLAME, x + SpellHelper.gaussian(1), y - 1.3 + SpellHelper.gaussian(0.3), z + SpellHelper.gaussian(1), 0, 0.06d, 0);
|
||||
|
||||
int i = event.entityLiving.getActivePotionEffect(AlchemicalWizardry.customPotionFlameCloak).getAmplifier();
|
||||
double range = i * 0.5;
|
||||
|
@ -718,7 +717,7 @@ public class AlchemicalWizardryEventHooks
|
|||
if (entityLiving.isPotionActive(AlchemicalWizardry.customPotionIceCloak))
|
||||
{
|
||||
if (entityLiving.worldObj.getWorldTime() % 2 == 0)
|
||||
entityLiving.worldObj.spawnParticle("reddust", x + SpellHelper.gaussian(1), y - 1.3 + SpellHelper.gaussian(0.3), z + SpellHelper.gaussian(1), 0x74, 0xbb, 0xfb);
|
||||
entityLiving.worldObj.spawnParticle(EnumParticleTypes.REDSTONE, x + SpellHelper.gaussian(1), y - 1.3 + SpellHelper.gaussian(0.3), z + SpellHelper.gaussian(1), 0x74, 0xbb, 0xfb);
|
||||
|
||||
int r = event.entityLiving.getActivePotionEffect(AlchemicalWizardry.customPotionIceCloak).getAmplifier();
|
||||
int horizRange = r + 1;
|
||||
|
@ -732,7 +731,7 @@ public class AlchemicalWizardryEventHooks
|
|||
{
|
||||
for (int j = -vertRange - 1; j <= vertRange - 1; j++)
|
||||
{
|
||||
SpellHelper.freezeWaterBlock(entityLiving.worldObj, xPos + i, yPos + j, zPos + k);
|
||||
SpellHelper.freezeWaterBlock(entityLiving.worldObj, new BlockPos(xPos + i, yPos + j, zPos + k));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -741,7 +740,7 @@ public class AlchemicalWizardryEventHooks
|
|||
|
||||
if (entityLiving.isPotionActive(AlchemicalWizardry.customPotionHeavyHeart))
|
||||
{
|
||||
entityLiving.worldObj.spawnParticle("flame", x + SpellHelper.gaussian(1), y - 1.3 + SpellHelper.gaussian(0.3), z + SpellHelper.gaussian(1), 0, 0.06d, 0);
|
||||
entityLiving.worldObj.spawnParticle(EnumParticleTypes.FLAME, x + SpellHelper.gaussian(1), y - 1.3 + SpellHelper.gaussian(0.3), z + SpellHelper.gaussian(1), 0, 0.06d, 0);
|
||||
|
||||
int i = event.entityLiving.getActivePotionEffect(AlchemicalWizardry.customPotionHeavyHeart).getAmplifier();
|
||||
double decrease = 0.025 * (i + 1);
|
||||
|
@ -759,7 +758,7 @@ public class AlchemicalWizardryEventHooks
|
|||
|
||||
if (entityLiving.isPotionActive(AlchemicalWizardry.customPotionFireFuse))
|
||||
{
|
||||
entityLiving.worldObj.spawnParticle("flame", x + SpellHelper.gaussian(1), y - 1.3 + SpellHelper.gaussian(0.3), z + SpellHelper.gaussian(1), 0, 0.06d, 0);
|
||||
entityLiving.worldObj.spawnParticle(EnumParticleTypes.FLAME, x + SpellHelper.gaussian(1), y - 1.3 + SpellHelper.gaussian(0.3), z + SpellHelper.gaussian(1), 0, 0.06d, 0);
|
||||
|
||||
int r = event.entityLiving.getActivePotionEffect(AlchemicalWizardry.customPotionFireFuse).getAmplifier();
|
||||
int radius = r + 1;
|
||||
|
@ -791,7 +790,7 @@ public class AlchemicalWizardryEventHooks
|
|||
meta = 0;
|
||||
|
||||
if (block != null)
|
||||
if (( block == event.initialBlock || block == event.finalBlock) && (meta == event.initialMetadata || meta == event.finalMetadata || meta == OreDictionary.WILDCARD_VALUE))
|
||||
if ((block == event.initialBlock || block == event.finalBlock) && (meta == event.initialBlock.getMetaFromState(event.initialState) || meta == event.finalBlock.getMetaFromState(event.finalState) || meta == OreDictionary.WILDCARD_VALUE))
|
||||
event.setCanceled(true);
|
||||
|
||||
// If the block uses shorthand syntax: modid:blockname
|
||||
|
@ -801,31 +800,12 @@ public class AlchemicalWizardryEventHooks
|
|||
int meta = 0;
|
||||
|
||||
if (block != null)
|
||||
if (( block == event.initialBlock || block == event.finalBlock) && (meta == event.initialMetadata || meta == event.finalMetadata || meta == OreDictionary.WILDCARD_VALUE))
|
||||
if (( block == event.initialBlock || block == event.finalBlock) && (meta == event.initialBlock.getMetaFromState(event.initialState) || meta == event.finalBlock.getMetaFromState(event.finalState) || meta == OreDictionary.WILDCARD_VALUE))
|
||||
event.setCanceled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onEntityDeath(LivingDeathEvent event)
|
||||
{
|
||||
EntityLivingBase entityLiving = event.entityLiving;
|
||||
|
||||
if (entityLiving instanceof IDemon && event.source.getEntity() instanceof EntityPlayer)
|
||||
{
|
||||
EntityPlayer player = (EntityPlayer) event.source.getEntity();
|
||||
|
||||
player.addStat(ModAchievements.demonSpawn, 1);
|
||||
}
|
||||
if (entityLiving instanceof IHoardDemon && event.source.getEntity() instanceof EntityPlayer)
|
||||
{
|
||||
EntityPlayer player = (EntityPlayer) event.source.getEntity();
|
||||
|
||||
player.addStat(ModAchievements.demons, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent event) {
|
||||
if (event.modID.equals("AWWayofTime")) {
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
package WayofTime.alchemicalWizardry.common;
|
||||
|
||||
import WayofTime.alchemicalWizardry.ModItems;
|
||||
import WayofTime.alchemicalWizardry.common.items.LavaCrystal;
|
||||
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
|
||||
import cpw.mods.fml.common.IFuelHandler;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -11,6 +7,10 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraftforge.fml.common.IFuelHandler;
|
||||
import WayofTime.alchemicalWizardry.ModItems;
|
||||
import WayofTime.alchemicalWizardry.common.items.LavaCrystal;
|
||||
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
|
||||
|
||||
public class AlchemicalWizardryFuelHandler implements IFuelHandler
|
||||
{
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package WayofTime.alchemicalWizardry.common;
|
||||
|
||||
import net.minecraft.util.BlockPos;
|
||||
|
||||
public class CoordAndRange
|
||||
{
|
||||
public int xCoord;
|
||||
|
@ -8,6 +10,11 @@ public class CoordAndRange
|
|||
public int horizRadius;
|
||||
public int vertRadius;
|
||||
|
||||
public CoordAndRange(BlockPos pos, int horiz, int vert)
|
||||
{
|
||||
this(pos.getX(), pos.getY(), pos.getZ(), horiz, vert);
|
||||
}
|
||||
|
||||
public CoordAndRange(int x, int y, int z, int horiz, int vert)
|
||||
{
|
||||
this.xCoord = x;
|
||||
|
@ -16,6 +23,11 @@ public class CoordAndRange
|
|||
this.horizRadius = horiz;
|
||||
this.vertRadius = vert;
|
||||
}
|
||||
|
||||
public BlockPos getPos()
|
||||
{
|
||||
return new BlockPos(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o)
|
||||
|
|
|
@ -9,7 +9,7 @@ public class EntityAITargetAggro extends EntityAINearestAttackableTarget
|
|||
|
||||
public EntityAITargetAggro(EntityDemon par1EntityDemon, Class par2Class, int par3, boolean par4)
|
||||
{
|
||||
super(par1EntityDemon, par2Class, par3, par4);
|
||||
super(par1EntityDemon, par2Class, par4);
|
||||
this.theCreature = par1EntityDemon;
|
||||
}
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ public class ItemType
|
|||
public ItemStack createStack(int count)
|
||||
{
|
||||
ItemStack result = new ItemStack(item, count, meta);
|
||||
result.stackTagCompound = nbtTag;
|
||||
result.setTagCompound(nbtTag);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -87,7 +87,7 @@ public class ItemType
|
|||
|
||||
public static ItemType fromStack(ItemStack stack)
|
||||
{
|
||||
return new ItemType(stack.getItem(), stack.getItemDamage(), stack.stackTagCompound);
|
||||
return new ItemType(stack.getItem(), stack.getItemDamage(), stack.getTagCompound());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,14 +1,15 @@
|
|||
package WayofTime.alchemicalWizardry.common;
|
||||
|
||||
import WayofTime.alchemicalWizardry.ModBlocks;
|
||||
import WayofTime.alchemicalWizardry.ModItems;
|
||||
import cpw.mods.fml.common.eventhandler.Event.Result;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.event.entity.player.FillBucketEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event.Result;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import WayofTime.alchemicalWizardry.ModBlocks;
|
||||
import WayofTime.alchemicalWizardry.ModItems;
|
||||
|
||||
public class LifeBucketHandler
|
||||
{
|
||||
|
@ -28,11 +29,12 @@ public class LifeBucketHandler
|
|||
|
||||
public ItemStack fillCustomBucket(World world, MovingObjectPosition pos)
|
||||
{
|
||||
Block block = world.getBlock(pos.blockX, pos.blockY, pos.blockZ);
|
||||
IBlockState state = world.getBlockState(pos.func_178782_a());
|
||||
Block block = state.getBlock();
|
||||
|
||||
if (block != null && (block.equals(ModBlocks.blockLifeEssence)) && world.getBlockMetadata(pos.blockX, pos.blockY, pos.blockZ) == 0)
|
||||
if (block != null && (block.equals(ModBlocks.blockLifeEssence)) && block.getMetaFromState(state) == 0)
|
||||
{
|
||||
world.setBlockToAir(pos.blockX, pos.blockY, pos.blockZ);
|
||||
world.setBlockToAir(pos.func_178782_a());
|
||||
return new ItemStack(ModItems.bucketLife);
|
||||
} else
|
||||
{
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package WayofTime.alchemicalWizardry.common;
|
||||
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public class LifeEssence extends Fluid
|
||||
{
|
||||
|
@ -19,7 +18,7 @@ public class LifeEssence extends Fluid
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getLocalizedName(FluidStack fluidStack)
|
||||
public String getLocalizedName()
|
||||
{
|
||||
return "Life Essence";
|
||||
}
|
||||
|
|
|
@ -13,9 +13,12 @@ import net.minecraft.client.Minecraft;
|
|||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.api.ColourAndCoords;
|
||||
import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent;
|
||||
|
@ -95,7 +98,7 @@ public enum NewPacketHandler
|
|||
protected void channelRead0(ChannelHandlerContext ctx, TEAltarMessage msg) throws Exception
|
||||
{
|
||||
World world = AlchemicalWizardry.proxy.getClientWorld();
|
||||
TileEntity te = world.getTileEntity(msg.x, msg.y, msg.z);
|
||||
TileEntity te = world.getTileEntity(msg.pos);
|
||||
if (te instanceof TEAltar)
|
||||
{
|
||||
TEAltar altar = (TEAltar) te;
|
||||
|
@ -111,11 +114,11 @@ public enum NewPacketHandler
|
|||
protected void channelRead0(ChannelHandlerContext ctx, TEOrientableMessage msg) throws Exception
|
||||
{
|
||||
World world = AlchemicalWizardry.proxy.getClientWorld();
|
||||
TileEntity te = world.getTileEntity(msg.x, msg.y, msg.z);
|
||||
TileEntity te = world.getTileEntity(msg.pos);
|
||||
if (te instanceof TEOrientable)
|
||||
{
|
||||
((TEOrientable) te).setInputDirection(ForgeDirection.getOrientation(msg.input));
|
||||
((TEOrientable) te).setOutputDirection(ForgeDirection.getOrientation(msg.output));
|
||||
((TEOrientable) te).setInputDirection(EnumFacing.getFront(msg.input));
|
||||
((TEOrientable) te).setOutputDirection(EnumFacing.getFront(msg.output));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -126,7 +129,7 @@ public enum NewPacketHandler
|
|||
protected void channelRead0(ChannelHandlerContext ctx, TEPedestalMessage msg) throws Exception
|
||||
{
|
||||
World world = AlchemicalWizardry.proxy.getClientWorld();
|
||||
TileEntity te = world.getTileEntity(msg.x, msg.y, msg.z);
|
||||
TileEntity te = world.getTileEntity(msg.pos);
|
||||
if (te instanceof TEPedestal)
|
||||
{
|
||||
TEPedestal pedestal = (TEPedestal) te;
|
||||
|
@ -142,7 +145,7 @@ public enum NewPacketHandler
|
|||
protected void channelRead0(ChannelHandlerContext ctx, TEPlinthMessage msg) throws Exception
|
||||
{
|
||||
World world = AlchemicalWizardry.proxy.getClientWorld();
|
||||
TileEntity te = world.getTileEntity(msg.x, msg.y, msg.z);
|
||||
TileEntity te = world.getTileEntity(msg.pos);
|
||||
if (te instanceof TEPlinth)
|
||||
{
|
||||
TEPlinth Plinth = (TEPlinth) te;
|
||||
|
@ -158,7 +161,7 @@ public enum NewPacketHandler
|
|||
protected void channelRead0(ChannelHandlerContext ctx, TESocketMessage msg) throws Exception
|
||||
{
|
||||
World world = AlchemicalWizardry.proxy.getClientWorld();
|
||||
TileEntity te = world.getTileEntity(msg.x, msg.y, msg.z);
|
||||
TileEntity te = world.getTileEntity(msg.pos);
|
||||
if (te instanceof TESocket)
|
||||
{
|
||||
TESocket Socket = (TESocket) te;
|
||||
|
@ -174,7 +177,7 @@ public enum NewPacketHandler
|
|||
protected void channelRead0(ChannelHandlerContext ctx, TETeleposerMessage msg) throws Exception
|
||||
{
|
||||
World world = AlchemicalWizardry.proxy.getClientWorld();
|
||||
TileEntity te = world.getTileEntity(msg.x, msg.y, msg.z);
|
||||
TileEntity te = world.getTileEntity(msg.pos);
|
||||
if (te instanceof TETeleposer)
|
||||
{
|
||||
TETeleposer Teleposer = (TETeleposer) te;
|
||||
|
@ -190,7 +193,7 @@ public enum NewPacketHandler
|
|||
protected void channelRead0(ChannelHandlerContext ctx, TEWritingTableMessage msg) throws Exception
|
||||
{
|
||||
World world = AlchemicalWizardry.proxy.getClientWorld();
|
||||
TileEntity te = world.getTileEntity(msg.x, msg.y, msg.z);
|
||||
TileEntity te = world.getTileEntity(msg.pos);
|
||||
if (te instanceof TEWritingTable)
|
||||
{
|
||||
TEWritingTable WritingTable = (TEWritingTable) te;
|
||||
|
@ -207,7 +210,7 @@ public enum NewPacketHandler
|
|||
{
|
||||
World world = AlchemicalWizardry.proxy.getClientWorld();
|
||||
|
||||
world.spawnParticle(msg.particle, msg.xCoord, msg.yCoord, msg.zCoord, msg.xVel, msg.yVel, msg.zVel);
|
||||
world.spawnParticle(EnumParticleTypes.func_179342_a(msg.particle), msg.xCoord, msg.yCoord, msg.zCoord, msg.xVel, msg.yVel, msg.zVel);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -233,7 +236,7 @@ public enum NewPacketHandler
|
|||
protected void channelRead0(ChannelHandlerContext ctx, TEMasterStoneMessage msg) throws Exception
|
||||
{
|
||||
World world = AlchemicalWizardry.proxy.getClientWorld();
|
||||
TileEntity te = world.getTileEntity(msg.x, msg.y, msg.z);
|
||||
TileEntity te = world.getTileEntity(msg.pos);
|
||||
if (te instanceof TEMasterStone)
|
||||
{
|
||||
TEMasterStone masterStone = (TEMasterStone) te;
|
||||
|
@ -250,7 +253,7 @@ public enum NewPacketHandler
|
|||
protected void channelRead0(ChannelHandlerContext ctx, TEReagentConduitMessage msg) throws Exception
|
||||
{
|
||||
World world = AlchemicalWizardry.proxy.getClientWorld();
|
||||
TileEntity te = world.getTileEntity(msg.x, msg.y, msg.z);
|
||||
TileEntity te = world.getTileEntity(msg.pos);
|
||||
if (te instanceof TEReagentConduit)
|
||||
{
|
||||
TEReagentConduit reagentConduit = (TEReagentConduit) te;
|
||||
|
@ -318,9 +321,7 @@ public enum NewPacketHandler
|
|||
|
||||
public static class TEAltarMessage extends BMMessage
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
int z;
|
||||
BlockPos pos;
|
||||
|
||||
int[] items;
|
||||
int[] fluids;
|
||||
|
@ -329,9 +330,7 @@ public enum NewPacketHandler
|
|||
|
||||
public static class TEOrientableMessage extends BMMessage
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
int z;
|
||||
BlockPos pos;
|
||||
|
||||
int input;
|
||||
int output;
|
||||
|
@ -339,52 +338,42 @@ public enum NewPacketHandler
|
|||
|
||||
public static class TEPedestalMessage extends BMMessage
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
int z;
|
||||
BlockPos pos;
|
||||
|
||||
int[] items;
|
||||
}
|
||||
|
||||
public static class TEPlinthMessage extends BMMessage
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
int z;
|
||||
BlockPos pos;
|
||||
|
||||
int[] items;
|
||||
}
|
||||
|
||||
public static class TESocketMessage extends BMMessage
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
int z;
|
||||
BlockPos pos;
|
||||
|
||||
int[] items;
|
||||
}
|
||||
|
||||
public static class TETeleposerMessage extends BMMessage
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
int z;
|
||||
BlockPos pos;
|
||||
|
||||
int[] items;
|
||||
}
|
||||
|
||||
public static class TEWritingTableMessage extends BMMessage
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
int z;
|
||||
BlockPos pos;
|
||||
|
||||
int[] items;
|
||||
}
|
||||
|
||||
public static class ParticleMessage extends BMMessage
|
||||
{
|
||||
String particle;
|
||||
int particle;
|
||||
|
||||
double xCoord;
|
||||
double yCoord;
|
||||
|
@ -404,9 +393,7 @@ public enum NewPacketHandler
|
|||
|
||||
public static class TEMasterStoneMessage extends BMMessage
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
int z;
|
||||
BlockPos pos;
|
||||
|
||||
String ritual;
|
||||
boolean isRunning;
|
||||
|
@ -414,9 +401,7 @@ public enum NewPacketHandler
|
|||
|
||||
public static class TEReagentConduitMessage extends BMMessage
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
int z;
|
||||
BlockPos pos;
|
||||
|
||||
List<ColourAndCoords> destinationList;
|
||||
}
|
||||
|
@ -501,231 +486,209 @@ public enum NewPacketHandler
|
|||
@Override
|
||||
public void encodeInto(ChannelHandlerContext ctx, BMMessage msg, ByteBuf target) throws Exception
|
||||
{
|
||||
target.writeInt(msg.index);
|
||||
PacketBuffer newBuffer = new PacketBuffer(target);
|
||||
newBuffer.writeInt(msg.index);
|
||||
|
||||
switch (msg.index)
|
||||
{
|
||||
case 0:
|
||||
target.writeInt(((TEAltarMessage) msg).x);
|
||||
target.writeInt(((TEAltarMessage) msg).y);
|
||||
target.writeInt(((TEAltarMessage) msg).z);
|
||||
newBuffer.writeBlockPos(((TEAltarMessage) msg).pos);
|
||||
|
||||
target.writeBoolean(((TEAltarMessage) msg).items != null);
|
||||
newBuffer.writeBoolean(((TEAltarMessage) msg).items != null);
|
||||
if (((TEAltarMessage) msg).items != null)
|
||||
{
|
||||
int[] items = ((TEAltarMessage) msg).items;
|
||||
for (int j = 0; j < items.length; j++)
|
||||
{
|
||||
int i = items[j];
|
||||
target.writeInt(i);
|
||||
newBuffer.writeInt(i);
|
||||
}
|
||||
}
|
||||
|
||||
target.writeBoolean(((TEAltarMessage) msg).fluids != null);
|
||||
newBuffer.writeBoolean(((TEAltarMessage) msg).fluids != null);
|
||||
if (((TEAltarMessage) msg).fluids != null)
|
||||
{
|
||||
int[] fluids = ((TEAltarMessage) msg).fluids;
|
||||
for (int j = 0; j < fluids.length; j++)
|
||||
{
|
||||
int i = fluids[j];
|
||||
target.writeInt(i);
|
||||
newBuffer.writeInt(i);
|
||||
}
|
||||
}
|
||||
|
||||
target.writeInt(((TEAltarMessage) msg).capacity);
|
||||
newBuffer.writeInt(((TEAltarMessage) msg).capacity);
|
||||
|
||||
break;
|
||||
|
||||
case 1:
|
||||
target.writeInt(((TEOrientableMessage) msg).x);
|
||||
target.writeInt(((TEOrientableMessage) msg).y);
|
||||
target.writeInt(((TEOrientableMessage) msg).z);
|
||||
newBuffer.writeBlockPos(((TEOrientableMessage) msg).pos);
|
||||
|
||||
target.writeInt(((TEOrientableMessage) msg).input);
|
||||
target.writeInt(((TEOrientableMessage) msg).output);
|
||||
newBuffer.writeInt(((TEOrientableMessage) msg).input);
|
||||
newBuffer.writeInt(((TEOrientableMessage) msg).output);
|
||||
|
||||
break;
|
||||
|
||||
case 2:
|
||||
target.writeInt(((TEPedestalMessage) msg).x);
|
||||
target.writeInt(((TEPedestalMessage) msg).y);
|
||||
target.writeInt(((TEPedestalMessage) msg).z);
|
||||
newBuffer.writeBlockPos(((TEPedestalMessage) msg).pos);
|
||||
|
||||
target.writeBoolean(((TEPedestalMessage) msg).items != null);
|
||||
newBuffer.writeBoolean(((TEPedestalMessage) msg).items != null);
|
||||
if (((TEPedestalMessage) msg).items != null)
|
||||
{
|
||||
int[] items = ((TEPedestalMessage) msg).items;
|
||||
for (int j = 0; j < items.length; j++)
|
||||
{
|
||||
int i = items[j];
|
||||
target.writeInt(i);
|
||||
newBuffer.writeInt(i);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 3:
|
||||
target.writeInt(((TEPlinthMessage) msg).x);
|
||||
target.writeInt(((TEPlinthMessage) msg).y);
|
||||
target.writeInt(((TEPlinthMessage) msg).z);
|
||||
newBuffer.writeBlockPos(((TEPlinthMessage) msg).pos);
|
||||
|
||||
target.writeBoolean(((TEPlinthMessage) msg).items != null);
|
||||
newBuffer.writeBoolean(((TEPlinthMessage) msg).items != null);
|
||||
if (((TEPlinthMessage) msg).items != null)
|
||||
{
|
||||
int[] items = ((TEPlinthMessage) msg).items;
|
||||
for (int j = 0; j < items.length; j++)
|
||||
{
|
||||
int i = items[j];
|
||||
target.writeInt(i);
|
||||
newBuffer.writeInt(i);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 4:
|
||||
target.writeInt(((TESocketMessage) msg).x);
|
||||
target.writeInt(((TESocketMessage) msg).y);
|
||||
target.writeInt(((TESocketMessage) msg).z);
|
||||
newBuffer.writeBlockPos(((TESocketMessage) msg).pos);
|
||||
|
||||
target.writeBoolean(((TESocketMessage) msg).items != null);
|
||||
newBuffer.writeBoolean(((TESocketMessage) msg).items != null);
|
||||
if (((TESocketMessage) msg).items != null)
|
||||
{
|
||||
int[] items = ((TESocketMessage) msg).items;
|
||||
for (int j = 0; j < items.length; j++)
|
||||
{
|
||||
int i = items[j];
|
||||
target.writeInt(i);
|
||||
newBuffer.writeInt(i);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 5:
|
||||
target.writeInt(((TETeleposerMessage) msg).x);
|
||||
target.writeInt(((TETeleposerMessage) msg).y);
|
||||
target.writeInt(((TETeleposerMessage) msg).z);
|
||||
newBuffer.writeBlockPos(((TETeleposerMessage) msg).pos);
|
||||
|
||||
target.writeBoolean(((TETeleposerMessage) msg).items != null);
|
||||
newBuffer.writeBoolean(((TETeleposerMessage) msg).items != null);
|
||||
if (((TETeleposerMessage) msg).items != null)
|
||||
{
|
||||
int[] items = ((TETeleposerMessage) msg).items;
|
||||
for (int j = 0; j < items.length; j++)
|
||||
{
|
||||
int i = items[j];
|
||||
target.writeInt(i);
|
||||
newBuffer.writeInt(i);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 6:
|
||||
target.writeInt(((TEWritingTableMessage) msg).x);
|
||||
target.writeInt(((TEWritingTableMessage) msg).y);
|
||||
target.writeInt(((TEWritingTableMessage) msg).z);
|
||||
newBuffer.writeBlockPos(((TEWritingTableMessage) msg).pos);
|
||||
|
||||
target.writeBoolean(((TEWritingTableMessage) msg).items != null);
|
||||
newBuffer.writeBoolean(((TEWritingTableMessage) msg).items != null);
|
||||
if (((TEWritingTableMessage) msg).items != null)
|
||||
{
|
||||
int[] items = ((TEWritingTableMessage) msg).items;
|
||||
for (int j = 0; j < items.length; j++)
|
||||
{
|
||||
int i = items[j];
|
||||
target.writeInt(i);
|
||||
newBuffer.writeInt(i);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 7:
|
||||
String str = ((ParticleMessage) msg).particle;
|
||||
target.writeInt(str.length());
|
||||
for (int i = 0; i < str.length(); i++)
|
||||
{
|
||||
target.writeChar(str.charAt(i));
|
||||
}
|
||||
newBuffer.writeInt(((ParticleMessage) msg).particle);
|
||||
|
||||
target.writeDouble(((ParticleMessage) msg).xCoord);
|
||||
target.writeDouble(((ParticleMessage) msg).yCoord);
|
||||
target.writeDouble(((ParticleMessage) msg).zCoord);
|
||||
newBuffer.writeDouble(((ParticleMessage) msg).xCoord);
|
||||
newBuffer.writeDouble(((ParticleMessage) msg).yCoord);
|
||||
newBuffer.writeDouble(((ParticleMessage) msg).zCoord);
|
||||
|
||||
target.writeDouble(((ParticleMessage) msg).xVel);
|
||||
target.writeDouble(((ParticleMessage) msg).yVel);
|
||||
target.writeDouble(((ParticleMessage) msg).zVel);
|
||||
newBuffer.writeDouble(((ParticleMessage) msg).xVel);
|
||||
newBuffer.writeDouble(((ParticleMessage) msg).yVel);
|
||||
newBuffer.writeDouble(((ParticleMessage) msg).zVel);
|
||||
|
||||
break;
|
||||
|
||||
case 8:
|
||||
target.writeDouble(((VelocityMessage) msg).xVel);
|
||||
target.writeDouble(((VelocityMessage) msg).yVel);
|
||||
target.writeDouble(((VelocityMessage) msg).zVel);
|
||||
newBuffer.writeDouble(((VelocityMessage) msg).xVel);
|
||||
newBuffer.writeDouble(((VelocityMessage) msg).yVel);
|
||||
newBuffer.writeDouble(((VelocityMessage) msg).zVel);
|
||||
|
||||
break;
|
||||
|
||||
case 9:
|
||||
target.writeInt(((TEMasterStoneMessage) msg).x);
|
||||
target.writeInt(((TEMasterStoneMessage) msg).y);
|
||||
target.writeInt(((TEMasterStoneMessage) msg).z);
|
||||
newBuffer.writeBlockPos(((TEMasterStoneMessage) msg).pos);
|
||||
|
||||
String ritual = ((TEMasterStoneMessage) msg).ritual;
|
||||
target.writeInt(ritual.length());
|
||||
newBuffer.writeInt(ritual.length());
|
||||
for (int i = 0; i < ritual.length(); i++)
|
||||
{
|
||||
target.writeChar(ritual.charAt(i));
|
||||
newBuffer.writeChar(ritual.charAt(i));
|
||||
}
|
||||
|
||||
target.writeBoolean(((TEMasterStoneMessage) msg).isRunning);
|
||||
newBuffer.writeBoolean(((TEMasterStoneMessage) msg).isRunning);
|
||||
|
||||
break;
|
||||
|
||||
case 10:
|
||||
target.writeInt(((TEReagentConduitMessage) msg).x);
|
||||
target.writeInt(((TEReagentConduitMessage) msg).y);
|
||||
target.writeInt(((TEReagentConduitMessage) msg).z);
|
||||
newBuffer.writeBlockPos(((TEReagentConduitMessage) msg).pos);
|
||||
|
||||
List<ColourAndCoords> list = ((TEReagentConduitMessage) msg).destinationList;
|
||||
target.writeInt(list.size());
|
||||
newBuffer.writeInt(list.size());
|
||||
|
||||
for (ColourAndCoords colourSet : list)
|
||||
{
|
||||
target.writeInt(colourSet.colourRed);
|
||||
target.writeInt(colourSet.colourGreen);
|
||||
target.writeInt(colourSet.colourBlue);
|
||||
target.writeInt(colourSet.colourIntensity);
|
||||
target.writeInt(colourSet.xCoord);
|
||||
target.writeInt(colourSet.yCoord);
|
||||
target.writeInt(colourSet.zCoord);
|
||||
newBuffer.writeInt(colourSet.colourRed);
|
||||
newBuffer.writeInt(colourSet.colourGreen);
|
||||
newBuffer.writeInt(colourSet.colourBlue);
|
||||
newBuffer.writeInt(colourSet.colourIntensity);
|
||||
newBuffer.writeInt(colourSet.xCoord);
|
||||
newBuffer.writeInt(colourSet.yCoord);
|
||||
newBuffer.writeInt(colourSet.zCoord);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 11:
|
||||
target.writeInt(((CurrentLPMessage) msg).currentLP);
|
||||
target.writeInt(((CurrentLPMessage) msg).maxLP);
|
||||
newBuffer.writeInt(((CurrentLPMessage) msg).currentLP);
|
||||
newBuffer.writeInt(((CurrentLPMessage) msg).maxLP);
|
||||
|
||||
break;
|
||||
|
||||
case 12:
|
||||
char[] charSet = ((CurrentReagentBarMessage)msg).reagent.toCharArray();
|
||||
target.writeInt(charSet.length);
|
||||
newBuffer.writeInt(charSet.length);
|
||||
for(char cha : charSet)
|
||||
{
|
||||
target.writeChar(cha);
|
||||
newBuffer.writeChar(cha);
|
||||
}
|
||||
target.writeFloat(((CurrentReagentBarMessage)msg).currentAR);
|
||||
target.writeFloat(((CurrentReagentBarMessage)msg).maxAR);
|
||||
newBuffer.writeFloat(((CurrentReagentBarMessage)msg).currentAR);
|
||||
newBuffer.writeFloat(((CurrentReagentBarMessage)msg).maxAR);
|
||||
|
||||
break;
|
||||
|
||||
case 13:
|
||||
target.writeFloat(((CurrentAddedHPMessage) msg).currentHP);
|
||||
target.writeFloat(((CurrentAddedHPMessage) msg).maxHP);
|
||||
newBuffer.writeFloat(((CurrentAddedHPMessage) msg).currentHP);
|
||||
newBuffer.writeFloat(((CurrentAddedHPMessage) msg).maxHP);
|
||||
|
||||
break;
|
||||
|
||||
case 14:
|
||||
System.out.println("Packet is being encoded");
|
||||
|
||||
target.writeByte(((KeyboardMessage)msg).keyPressed);
|
||||
newBuffer.writeByte(((KeyboardMessage)msg).keyPressed);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -734,15 +697,14 @@ public enum NewPacketHandler
|
|||
@Override
|
||||
public void decodeInto(ChannelHandlerContext ctx, ByteBuf dat, BMMessage msg)
|
||||
{
|
||||
int index = dat.readInt();
|
||||
PacketBuffer newBuffer = new PacketBuffer(dat);
|
||||
int index = newBuffer.readInt();
|
||||
|
||||
switch (index)
|
||||
{
|
||||
case 0:
|
||||
((TEAltarMessage) msg).x = dat.readInt();
|
||||
((TEAltarMessage) msg).y = dat.readInt();
|
||||
((TEAltarMessage) msg).z = dat.readInt();
|
||||
boolean hasStacks = dat.readBoolean();
|
||||
((TEAltarMessage) msg).pos = newBuffer.readBlockPos();
|
||||
boolean hasStacks = newBuffer.readBoolean();
|
||||
|
||||
((TEAltarMessage) msg).items = new int[TEAltar.sizeInv * 3];
|
||||
if (hasStacks)
|
||||
|
@ -750,38 +712,34 @@ public enum NewPacketHandler
|
|||
((TEAltarMessage) msg).items = new int[TEAltar.sizeInv * 3];
|
||||
for (int i = 0; i < ((TEAltarMessage) msg).items.length; i++)
|
||||
{
|
||||
((TEAltarMessage) msg).items[i] = dat.readInt();
|
||||
((TEAltarMessage) msg).items[i] = newBuffer.readInt();
|
||||
}
|
||||
}
|
||||
|
||||
boolean hasFluids = dat.readBoolean();
|
||||
boolean hasFluids = newBuffer.readBoolean();
|
||||
((TEAltarMessage) msg).fluids = new int[6];
|
||||
if (hasFluids)
|
||||
for (int i = 0; i < ((TEAltarMessage) msg).fluids.length; i++)
|
||||
{
|
||||
((TEAltarMessage) msg).fluids[i] = dat.readInt();
|
||||
((TEAltarMessage) msg).fluids[i] = newBuffer.readInt();
|
||||
}
|
||||
|
||||
((TEAltarMessage) msg).capacity = dat.readInt();
|
||||
((TEAltarMessage) msg).capacity = newBuffer.readInt();
|
||||
|
||||
break;
|
||||
|
||||
case 1:
|
||||
((TEOrientableMessage) msg).x = dat.readInt();
|
||||
((TEOrientableMessage) msg).y = dat.readInt();
|
||||
((TEOrientableMessage) msg).z = dat.readInt();
|
||||
((TEOrientableMessage) msg).pos = newBuffer.readBlockPos();
|
||||
|
||||
((TEOrientableMessage) msg).input = dat.readInt();
|
||||
((TEOrientableMessage) msg).output = dat.readInt();
|
||||
((TEOrientableMessage) msg).input = newBuffer.readInt();
|
||||
((TEOrientableMessage) msg).output = newBuffer.readInt();
|
||||
|
||||
break;
|
||||
|
||||
case 2:
|
||||
((TEPedestalMessage) msg).x = dat.readInt();
|
||||
((TEPedestalMessage) msg).y = dat.readInt();
|
||||
((TEPedestalMessage) msg).z = dat.readInt();
|
||||
((TEPedestalMessage) msg).pos = newBuffer.readBlockPos();
|
||||
|
||||
boolean hasStacks1 = dat.readBoolean();
|
||||
boolean hasStacks1 = newBuffer.readBoolean();
|
||||
|
||||
((TEPedestalMessage) msg).items = new int[TEPedestal.sizeInv * 3];
|
||||
if (hasStacks1)
|
||||
|
@ -789,18 +747,16 @@ public enum NewPacketHandler
|
|||
((TEPedestalMessage) msg).items = new int[TEPedestal.sizeInv * 3];
|
||||
for (int i = 0; i < ((TEPedestalMessage) msg).items.length; i++)
|
||||
{
|
||||
((TEPedestalMessage) msg).items[i] = dat.readInt();
|
||||
((TEPedestalMessage) msg).items[i] = newBuffer.readInt();
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 3:
|
||||
((TEPlinthMessage) msg).x = dat.readInt();
|
||||
((TEPlinthMessage) msg).y = dat.readInt();
|
||||
((TEPlinthMessage) msg).z = dat.readInt();
|
||||
((TEPlinthMessage) msg).pos = newBuffer.readBlockPos();
|
||||
|
||||
boolean hasStacks2 = dat.readBoolean();
|
||||
boolean hasStacks2 = newBuffer.readBoolean();
|
||||
|
||||
((TEPlinthMessage) msg).items = new int[TEPlinth.sizeInv * 3];
|
||||
if (hasStacks2)
|
||||
|
@ -808,18 +764,16 @@ public enum NewPacketHandler
|
|||
((TEPlinthMessage) msg).items = new int[TEPlinth.sizeInv * 3];
|
||||
for (int i = 0; i < ((TEPlinthMessage) msg).items.length; i++)
|
||||
{
|
||||
((TEPlinthMessage) msg).items[i] = dat.readInt();
|
||||
((TEPlinthMessage) msg).items[i] = newBuffer.readInt();
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 4:
|
||||
((TESocketMessage) msg).x = dat.readInt();
|
||||
((TESocketMessage) msg).y = dat.readInt();
|
||||
((TESocketMessage) msg).z = dat.readInt();
|
||||
((TESocketMessage) msg).pos = newBuffer.readBlockPos();
|
||||
|
||||
boolean hasStacks3 = dat.readBoolean();
|
||||
boolean hasStacks3 = newBuffer.readBoolean();
|
||||
|
||||
((TESocketMessage) msg).items = new int[TESocket.sizeInv * 3];
|
||||
if (hasStacks3)
|
||||
|
@ -827,18 +781,16 @@ public enum NewPacketHandler
|
|||
((TESocketMessage) msg).items = new int[TESocket.sizeInv * 3];
|
||||
for (int i = 0; i < ((TESocketMessage) msg).items.length; i++)
|
||||
{
|
||||
((TESocketMessage) msg).items[i] = dat.readInt();
|
||||
((TESocketMessage) msg).items[i] = newBuffer.readInt();
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 5:
|
||||
((TETeleposerMessage) msg).x = dat.readInt();
|
||||
((TETeleposerMessage) msg).y = dat.readInt();
|
||||
((TETeleposerMessage) msg).z = dat.readInt();
|
||||
((TETeleposerMessage) msg).pos = newBuffer.readBlockPos();
|
||||
|
||||
boolean hasStacks4 = dat.readBoolean();
|
||||
boolean hasStacks4 = newBuffer.readBoolean();
|
||||
|
||||
((TETeleposerMessage) msg).items = new int[TETeleposer.sizeInv * 3];
|
||||
if (hasStacks4)
|
||||
|
@ -846,18 +798,16 @@ public enum NewPacketHandler
|
|||
((TETeleposerMessage) msg).items = new int[TETeleposer.sizeInv * 3];
|
||||
for (int i = 0; i < ((TETeleposerMessage) msg).items.length; i++)
|
||||
{
|
||||
((TETeleposerMessage) msg).items[i] = dat.readInt();
|
||||
((TETeleposerMessage) msg).items[i] = newBuffer.readInt();
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 6:
|
||||
((TEWritingTableMessage) msg).x = dat.readInt();
|
||||
((TEWritingTableMessage) msg).y = dat.readInt();
|
||||
((TEWritingTableMessage) msg).z = dat.readInt();
|
||||
((TEWritingTableMessage) msg).pos = newBuffer.readBlockPos();
|
||||
|
||||
boolean hasStacks5 = dat.readBoolean();
|
||||
boolean hasStacks5 = newBuffer.readBoolean();
|
||||
|
||||
((TEWritingTableMessage) msg).items = new int[TEWritingTable.sizeInv * 3];
|
||||
if (hasStacks5)
|
||||
|
@ -865,70 +815,58 @@ public enum NewPacketHandler
|
|||
((TEWritingTableMessage) msg).items = new int[TEWritingTable.sizeInv * 3];
|
||||
for (int i = 0; i < ((TEWritingTableMessage) msg).items.length; i++)
|
||||
{
|
||||
((TEWritingTableMessage) msg).items[i] = dat.readInt();
|
||||
((TEWritingTableMessage) msg).items[i] = newBuffer.readInt();
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 7:
|
||||
int size = dat.readInt();
|
||||
String str = "";
|
||||
((ParticleMessage) msg).particle = newBuffer.readInt();
|
||||
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
str = str + dat.readChar();
|
||||
}
|
||||
((ParticleMessage) msg).xCoord = newBuffer.readDouble();
|
||||
((ParticleMessage) msg).yCoord = newBuffer.readDouble();
|
||||
((ParticleMessage) msg).zCoord = newBuffer.readDouble();
|
||||
|
||||
((ParticleMessage) msg).particle = str;
|
||||
|
||||
((ParticleMessage) msg).xCoord = dat.readDouble();
|
||||
((ParticleMessage) msg).yCoord = dat.readDouble();
|
||||
((ParticleMessage) msg).zCoord = dat.readDouble();
|
||||
|
||||
((ParticleMessage) msg).xVel = dat.readDouble();
|
||||
((ParticleMessage) msg).yVel = dat.readDouble();
|
||||
((ParticleMessage) msg).zVel = dat.readDouble();
|
||||
((ParticleMessage) msg).xVel = newBuffer.readDouble();
|
||||
((ParticleMessage) msg).yVel = newBuffer.readDouble();
|
||||
((ParticleMessage) msg).zVel = newBuffer.readDouble();
|
||||
|
||||
break;
|
||||
|
||||
case 8:
|
||||
((VelocityMessage) msg).xVel = dat.readDouble();
|
||||
((VelocityMessage) msg).yVel = dat.readDouble();
|
||||
((VelocityMessage) msg).zVel = dat.readDouble();
|
||||
((VelocityMessage) msg).xVel = newBuffer.readDouble();
|
||||
((VelocityMessage) msg).yVel = newBuffer.readDouble();
|
||||
((VelocityMessage) msg).zVel = newBuffer.readDouble();
|
||||
|
||||
break;
|
||||
|
||||
case 9:
|
||||
((TEMasterStoneMessage) msg).x = dat.readInt();
|
||||
((TEMasterStoneMessage) msg).y = dat.readInt();
|
||||
((TEMasterStoneMessage) msg).z = dat.readInt();
|
||||
((TEMasterStoneMessage) msg).pos = newBuffer.readBlockPos();
|
||||
|
||||
int ritualStrSize = dat.readInt();
|
||||
int ritualStrSize = newBuffer.readInt();
|
||||
String ritual = "";
|
||||
|
||||
for (int i = 0; i < ritualStrSize; i++)
|
||||
{
|
||||
ritual = ritual + dat.readChar();
|
||||
ritual = ritual + newBuffer.readChar();
|
||||
}
|
||||
|
||||
((TEMasterStoneMessage) msg).ritual = ritual;
|
||||
((TEMasterStoneMessage) msg).isRunning = dat.readBoolean();
|
||||
((TEMasterStoneMessage) msg).isRunning = newBuffer.readBoolean();
|
||||
|
||||
break;
|
||||
|
||||
case 10:
|
||||
((TEReagentConduitMessage) msg).x = dat.readInt();
|
||||
((TEReagentConduitMessage) msg).y = dat.readInt();
|
||||
((TEReagentConduitMessage) msg).z = dat.readInt();
|
||||
|
||||
int listSize = dat.readInt();
|
||||
((TEReagentConduitMessage) msg).pos = newBuffer.readBlockPos();
|
||||
|
||||
int listSize = newBuffer.readInt();
|
||||
|
||||
List<ColourAndCoords> list = new LinkedList();
|
||||
|
||||
for (int i = 0; i < listSize; i++)
|
||||
{
|
||||
list.add(new ColourAndCoords(dat.readInt(), dat.readInt(), dat.readInt(), dat.readInt(), dat.readInt(), dat.readInt(), dat.readInt()));
|
||||
list.add(new ColourAndCoords(newBuffer.readInt(), newBuffer.readInt(), newBuffer.readInt(), newBuffer.readInt(), newBuffer.readInt(), newBuffer.readInt(), newBuffer.readInt()));
|
||||
}
|
||||
|
||||
((TEReagentConduitMessage) msg).destinationList = list;
|
||||
|
@ -936,34 +874,34 @@ public enum NewPacketHandler
|
|||
break;
|
||||
|
||||
case 11:
|
||||
((CurrentLPMessage) msg).currentLP = dat.readInt();
|
||||
((CurrentLPMessage) msg).maxLP = dat.readInt();
|
||||
((CurrentLPMessage) msg).currentLP = newBuffer.readInt();
|
||||
((CurrentLPMessage) msg).maxLP = newBuffer.readInt();
|
||||
|
||||
break;
|
||||
|
||||
case 12:
|
||||
int size1 = dat.readInt();
|
||||
int size1 = newBuffer.readInt();
|
||||
String str1 = "";
|
||||
for(int i=0; i<size1; i++)
|
||||
{
|
||||
str1 = str1 + dat.readChar();
|
||||
str1 = str1 + newBuffer.readChar();
|
||||
}
|
||||
|
||||
((CurrentReagentBarMessage) msg).reagent = str1;
|
||||
((CurrentReagentBarMessage) msg).currentAR = dat.readFloat();
|
||||
((CurrentReagentBarMessage) msg).maxAR = dat.readFloat();
|
||||
((CurrentReagentBarMessage) msg).currentAR = newBuffer.readFloat();
|
||||
((CurrentReagentBarMessage) msg).maxAR = newBuffer.readFloat();
|
||||
|
||||
break;
|
||||
|
||||
case 13:
|
||||
((CurrentAddedHPMessage) msg).currentHP = dat.readFloat();
|
||||
((CurrentAddedHPMessage) msg).maxHP = dat.readFloat();
|
||||
((CurrentAddedHPMessage) msg).currentHP = newBuffer.readFloat();
|
||||
((CurrentAddedHPMessage) msg).maxHP = newBuffer.readFloat();
|
||||
|
||||
break;
|
||||
|
||||
case 14:
|
||||
System.out.println("Packet recieved: being decoded");
|
||||
((KeyboardMessage)msg).keyPressed = dat.readByte();
|
||||
((KeyboardMessage)msg).keyPressed = newBuffer.readByte();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -974,9 +912,7 @@ public enum NewPacketHandler
|
|||
{
|
||||
TEAltarMessage msg = new TEAltarMessage();
|
||||
msg.index = 0;
|
||||
msg.x = tileAltar.xCoord;
|
||||
msg.y = tileAltar.yCoord;
|
||||
msg.z = tileAltar.zCoord;
|
||||
msg.pos = tileAltar.getPos();
|
||||
msg.items = tileAltar.buildIntDataList();
|
||||
msg.fluids = tileAltar.buildFluidList();
|
||||
msg.capacity = tileAltar.getCapacity();
|
||||
|
@ -988,11 +924,9 @@ public enum NewPacketHandler
|
|||
{
|
||||
TEOrientableMessage msg = new TEOrientableMessage();
|
||||
msg.index = 1;
|
||||
msg.x = tileOrientable.xCoord;
|
||||
msg.y = tileOrientable.yCoord;
|
||||
msg.z = tileOrientable.zCoord;
|
||||
msg.input = tileOrientable.getIntForForgeDirection(tileOrientable.getInputDirection());
|
||||
msg.output = tileOrientable.getIntForForgeDirection(tileOrientable.getOutputDirection());
|
||||
msg.pos = tileOrientable.getPos();
|
||||
msg.input = tileOrientable.getIntForEnumFacing(tileOrientable.getInputDirection());
|
||||
msg.output = tileOrientable.getIntForEnumFacing(tileOrientable.getOutputDirection());
|
||||
|
||||
return INSTANCE.channels.get(Side.SERVER).generatePacketFrom(msg);
|
||||
}
|
||||
|
@ -1001,9 +935,7 @@ public enum NewPacketHandler
|
|||
{
|
||||
TEPedestalMessage msg = new TEPedestalMessage();
|
||||
msg.index = 2;
|
||||
msg.x = tilePedestal.xCoord;
|
||||
msg.y = tilePedestal.yCoord;
|
||||
msg.z = tilePedestal.zCoord;
|
||||
msg.pos = tilePedestal.getPos();
|
||||
msg.items = tilePedestal.buildIntDataList();
|
||||
|
||||
return INSTANCE.channels.get(Side.SERVER).generatePacketFrom(msg);
|
||||
|
@ -1013,9 +945,7 @@ public enum NewPacketHandler
|
|||
{
|
||||
TEPlinthMessage msg = new TEPlinthMessage();
|
||||
msg.index = 3;
|
||||
msg.x = tilePlinth.xCoord;
|
||||
msg.y = tilePlinth.yCoord;
|
||||
msg.z = tilePlinth.zCoord;
|
||||
msg.pos = tilePlinth.getPos();
|
||||
msg.items = tilePlinth.buildIntDataList();
|
||||
|
||||
return INSTANCE.channels.get(Side.SERVER).generatePacketFrom(msg);
|
||||
|
@ -1025,9 +955,7 @@ public enum NewPacketHandler
|
|||
{
|
||||
TESocketMessage msg = new TESocketMessage();
|
||||
msg.index = 4;
|
||||
msg.x = tileSocket.xCoord;
|
||||
msg.y = tileSocket.yCoord;
|
||||
msg.z = tileSocket.zCoord;
|
||||
msg.pos = tileSocket.getPos();
|
||||
msg.items = tileSocket.buildIntDataList();
|
||||
|
||||
return INSTANCE.channels.get(Side.SERVER).generatePacketFrom(msg);
|
||||
|
@ -1037,9 +965,7 @@ public enum NewPacketHandler
|
|||
{
|
||||
TETeleposerMessage msg = new TETeleposerMessage();
|
||||
msg.index = 5;
|
||||
msg.x = tileTeleposer.xCoord;
|
||||
msg.y = tileTeleposer.yCoord;
|
||||
msg.z = tileTeleposer.zCoord;
|
||||
msg.pos = tileTeleposer.getPos();
|
||||
msg.items = tileTeleposer.buildIntDataList();
|
||||
|
||||
return INSTANCE.channels.get(Side.SERVER).generatePacketFrom(msg);
|
||||
|
@ -1049,19 +975,17 @@ public enum NewPacketHandler
|
|||
{
|
||||
TEWritingTableMessage msg = new TEWritingTableMessage();
|
||||
msg.index = 6;
|
||||
msg.x = tileWritingTable.xCoord;
|
||||
msg.y = tileWritingTable.yCoord;
|
||||
msg.z = tileWritingTable.zCoord;
|
||||
msg.pos = tileWritingTable.getPos();
|
||||
msg.items = tileWritingTable.buildIntDataList();
|
||||
|
||||
return INSTANCE.channels.get(Side.SERVER).generatePacketFrom(msg);
|
||||
}
|
||||
|
||||
public static Packet getParticlePacket(String str, double xCoord, double yCoord, double zCoord, double xVel, double yVel, double zVel)
|
||||
public static Packet getParticlePacket(EnumParticleTypes type, double xCoord, double yCoord, double zCoord, double xVel, double yVel, double zVel)
|
||||
{
|
||||
ParticleMessage msg = new ParticleMessage();
|
||||
msg.index = 7;
|
||||
msg.particle = str;
|
||||
msg.particle = type.ordinal();
|
||||
msg.xCoord = xCoord;
|
||||
msg.yCoord = yCoord;
|
||||
msg.zCoord = zCoord;
|
||||
|
@ -1087,9 +1011,7 @@ public enum NewPacketHandler
|
|||
{
|
||||
TEMasterStoneMessage msg = new TEMasterStoneMessage();
|
||||
msg.index = 9;
|
||||
msg.x = tile.xCoord;
|
||||
msg.y = tile.yCoord;
|
||||
msg.z = tile.zCoord;
|
||||
msg.pos = tile.getPos();
|
||||
|
||||
msg.ritual = tile.getCurrentRitual();
|
||||
msg.isRunning = tile.isRunning;
|
||||
|
@ -1101,9 +1023,7 @@ public enum NewPacketHandler
|
|||
{
|
||||
TEReagentConduitMessage msg = new TEReagentConduitMessage();
|
||||
msg.index = 10;
|
||||
msg.x = tile.xCoord;
|
||||
msg.y = tile.yCoord;
|
||||
msg.z = tile.zCoord;
|
||||
msg.pos = tile.getPos();
|
||||
|
||||
msg.destinationList = tile.destinationList;
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@ package WayofTime.alchemicalWizardry.common.achievements;
|
|||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.PlayerEvent;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.stats.Achievement;
|
||||
|
||||
|
@ -33,25 +32,13 @@ public class AchievementTrigger
|
|||
{
|
||||
for (Item item : AchievementsRegistry.craftinglist)
|
||||
{
|
||||
if (event.crafting != null)
|
||||
if (event.crafting != null && event.crafting.getItem() == item)
|
||||
{
|
||||
if (event.crafting.getItem() == item)
|
||||
{
|
||||
Achievement achievement = AchievementsRegistry.getAchievementForItem(event.crafting.getItem());
|
||||
Achievement achievement = AchievementsRegistry.getAchievementForItem(event.crafting.getItem());
|
||||
|
||||
if (achievement != null)
|
||||
{
|
||||
event.player.addStat(achievement, 1);
|
||||
}
|
||||
}
|
||||
if (event.crafting.getItem() instanceof ItemBlock)
|
||||
if (achievement != null)
|
||||
{
|
||||
Achievement achievement = AchievementsRegistry.getAchievementForBlock(((ItemBlock) event.crafting.getItem()).field_150939_a);
|
||||
|
||||
if (achievement != null)
|
||||
{
|
||||
event.player.addStat(achievement, 1);
|
||||
}
|
||||
event.player.addStat(achievement, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
package WayofTime.alchemicalWizardry.common.achievements;
|
||||
|
||||
import WayofTime.alchemicalWizardry.ModBlocks;
|
||||
import WayofTime.alchemicalWizardry.ModItems;
|
||||
import WayofTime.alchemicalWizardry.common.items.ItemRitualDiviner;
|
||||
import WayofTime.alchemicalWizardry.common.items.armour.BoundArmour;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.stats.Achievement;
|
||||
|
@ -13,92 +10,40 @@ import java.util.List;
|
|||
|
||||
public class AchievementsRegistry
|
||||
{
|
||||
public final static List<Item> craftinglist = new ArrayList<Item>();
|
||||
public final static List<Item> pickupList = new ArrayList<Item>();
|
||||
public final static List<Block> blockCraftingList = new ArrayList<Block>();
|
||||
// public final static List<Block> blockPickupList = new ArrayList<Block>();
|
||||
public final static List<Item> craftinglist = new ArrayList();
|
||||
public final static List<Item> pickupList = new ArrayList();
|
||||
|
||||
public static void init()
|
||||
{
|
||||
addItemsToCraftingList();
|
||||
addBlocksToCraftingList();
|
||||
addItemsToPickupList();
|
||||
// addBlocksToPickupList();
|
||||
}
|
||||
|
||||
public static void addItemsToCraftingList()
|
||||
{
|
||||
craftinglist.add(ModItems.sacrificialDagger);
|
||||
craftinglist.add(ModItems.itemBloodPack);
|
||||
craftinglist.add(ModItems.waterSigil);
|
||||
craftinglist.add(ModItems.airSigil);
|
||||
craftinglist.add(ModItems.sigilOfHolding);
|
||||
craftinglist.add(ModItems.itemRitualDiviner);
|
||||
craftinglist.add(ModItems.sigilOfTheBridge);
|
||||
craftinglist.add(ModItems.itemSigilOfSupression);
|
||||
craftinglist.add(ModItems.energyBazooka);
|
||||
}
|
||||
|
||||
public static void addBlocksToCraftingList()
|
||||
{
|
||||
blockCraftingList.add(ModBlocks.bloodRune);
|
||||
blockCraftingList.add(ModBlocks.blockWritingTable);
|
||||
blockCraftingList.add(ModBlocks.blockTeleposer);
|
||||
}
|
||||
|
||||
public static void addItemsToPickupList()
|
||||
{
|
||||
pickupList.add(ModItems.weakBloodOrb);
|
||||
pickupList.add(ModItems.apprenticeBloodOrb);
|
||||
pickupList.add(ModItems.daggerOfSacrifice);
|
||||
pickupList.add(ModItems.magicianBloodOrb);
|
||||
pickupList.add(ModItems.energySword);
|
||||
pickupList.add(ModItems.boundHelmet);
|
||||
pickupList.add(ModItems.boundPlate);
|
||||
pickupList.add(ModItems.boundLeggings);
|
||||
pickupList.add(ModItems.boundBoots);
|
||||
pickupList.add(ModItems.itemComplexSpellCrystal);
|
||||
pickupList.add(ModItems.masterBloodOrb);
|
||||
pickupList.add(ModItems.archmageBloodOrb);
|
||||
pickupList.add(ModItems.transcendentBloodOrb);
|
||||
}
|
||||
|
||||
public static void addBlocksToPickupList()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public static Achievement getAchievementForItem(Item item)
|
||||
{
|
||||
if (item == ModItems.sacrificialDagger) return ModAchievements.firstPrick;
|
||||
if (item == ModItems.weakBloodOrb) return ModAchievements.weakOrb;
|
||||
if (item == ModItems.itemBloodPack) return ModAchievements.bloodLettersPack;
|
||||
if (item == ModItems.waterSigil) return ModAchievements.waterSigil;
|
||||
if (item == ModItems.apprenticeBloodOrb) return ModAchievements.apprenticeOrb;
|
||||
if (item == ModItems.airSigil) return ModAchievements.airSigil;
|
||||
if (item == ModItems.daggerOfSacrifice) return ModAchievements.daggerOfSacrifice;
|
||||
if (item == ModItems.magicianBloodOrb) return ModAchievements.magicianOrb;
|
||||
if (item == ModItems.sigilOfHolding) return ModAchievements.sigilHolding;
|
||||
if (item == ModItems.energySword) return ModAchievements.boundBlade;
|
||||
if (item instanceof BoundArmour) return ModAchievements.boundArmor;
|
||||
if (item == ModItems.itemComplexSpellCrystal) return ModAchievements.complexSpells;
|
||||
if (item instanceof ItemRitualDiviner) return ModAchievements.ritualDiviner;
|
||||
if (item == ModItems.masterBloodOrb) return ModAchievements.masterOrb;
|
||||
if (item == ModItems.sigilOfTheBridge) return ModAchievements.phantomBridgeSigil;
|
||||
if (item == ModItems.itemSigilOfSupression) return ModAchievements.suppressionSigil;
|
||||
if (item == ModItems.archmageBloodOrb) return ModAchievements.archmageOrb;
|
||||
if (item == ModItems.energyBazooka) return ModAchievements.energyBazooka;
|
||||
if (item == ModItems.transcendentBloodOrb) return ModAchievements.transcendentOrb;
|
||||
|
||||
if (item == ModItems.sacrificialDagger)
|
||||
{
|
||||
return ModAchievements.firstPrick;
|
||||
}
|
||||
if (item == ModItems.weakBloodOrb)
|
||||
{
|
||||
return ModAchievements.weakOrb;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static Achievement getAchievementForBlock(Block block)
|
||||
{
|
||||
if (block == ModBlocks.bloodRune) return ModAchievements.blankRunes;
|
||||
if (block == ModBlocks.blockWritingTable) return ModAchievements.brewingPotions;
|
||||
if (block == ModBlocks.blockTeleposer) return ModAchievements.teleposer;
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
package WayofTime.alchemicalWizardry.common.achievements;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.stats.Achievement;
|
||||
|
||||
public interface ICraftAchievement
|
||||
{
|
||||
Achievement getAchievementOnCraft(ItemStack stack, EntityPlayer player, IInventory matrix);
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package WayofTime.alchemicalWizardry.common.achievements;
|
||||
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.stats.Achievement;
|
||||
|
||||
public interface IPickupAchievement
|
||||
{
|
||||
Achievement getAchievementOnPickup(ItemStack stack, EntityPlayer player, EntityItem item);
|
||||
}
|
|
@ -1,8 +1,7 @@
|
|||
package WayofTime.alchemicalWizardry.common.achievements;
|
||||
|
||||
import WayofTime.alchemicalWizardry.ModBlocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.stats.Achievement;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraftforge.common.AchievementPage;
|
||||
import WayofTime.alchemicalWizardry.ModItems;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
|
@ -13,57 +12,13 @@ public class ModAchievements
|
|||
|
||||
public static Achievement firstPrick;
|
||||
public static Achievement weakOrb;
|
||||
public static Achievement bloodLettersPack;
|
||||
public static Achievement waterSigil;
|
||||
public static Achievement blankRunes;
|
||||
public static Achievement apprenticeOrb;
|
||||
public static Achievement airSigil;
|
||||
public static Achievement daggerOfSacrifice;
|
||||
public static Achievement brewingPotions;
|
||||
public static Achievement magicianOrb;
|
||||
public static Achievement sigilHolding;
|
||||
public static Achievement boundBlade;
|
||||
public static Achievement boundArmor;
|
||||
public static Achievement complexSpells;
|
||||
public static Achievement ritualDiviner;
|
||||
public static Achievement masterOrb;
|
||||
public static Achievement demonSpawn;
|
||||
public static Achievement phantomBridgeSigil;
|
||||
public static Achievement teleposer;
|
||||
public static Achievement suppressionSigil;
|
||||
public static Achievement archmageOrb;
|
||||
public static Achievement energyBazooka;
|
||||
public static Achievement demons;
|
||||
public static Achievement transcendentOrb;
|
||||
|
||||
public static void init()
|
||||
{
|
||||
firstPrick = new AchievementsMod("firstPrick", 0, 0, ModItems.sacrificialDagger, null).setSpecial();
|
||||
weakOrb = new AchievementsMod("weakOrb", 3, 0, ModItems.weakBloodOrb, firstPrick);
|
||||
bloodLettersPack = new AchievementsMod("bloodLettersPack", 3, 2, ModItems.itemBloodPack, weakOrb);
|
||||
waterSigil = new AchievementsMod("waterSigil", 6, 2, ModItems.waterSigil, weakOrb);
|
||||
blankRunes = new AchievementsMod("blankRunes", 4, -2, ModBlocks.bloodRune, weakOrb);
|
||||
apprenticeOrb = new AchievementsMod("apprenticeOrb", 4, -4, ModItems.apprenticeBloodOrb, blankRunes);
|
||||
airSigil = new AchievementsMod("airSigil", 6, 1, ModItems.airSigil, apprenticeOrb);
|
||||
daggerOfSacrifice = new AchievementsMod("daggerSacrifice", 4, -5, ModItems.daggerOfSacrifice, apprenticeOrb);
|
||||
brewingPotions = new AchievementsMod("brewingPotions", 6, -3, ModBlocks.blockWritingTable, apprenticeOrb);
|
||||
magicianOrb = new AchievementsMod("magicianOrb", 2, -2, ModItems.magicianBloodOrb, apprenticeOrb);
|
||||
sigilHolding = new AchievementsMod("sigilHolding", 6, 0, ModItems.sigilOfHolding, magicianOrb);
|
||||
boundBlade = new AchievementsMod("boundBlade", 0, -2, ModItems.energySword, magicianOrb);
|
||||
boundArmor = new AchievementsMod("boundArmor", 1, -1, ModItems.boundPlate, magicianOrb);
|
||||
complexSpells = new AchievementsMod("complexSpells", 1, -4, ModItems.itemComplexSpellCrystal, magicianOrb);
|
||||
ritualDiviner = new AchievementsMod("ritualDiviner", 1, -3, ModItems.itemRitualDiviner, magicianOrb);
|
||||
masterOrb = new AchievementsMod("masterOrb", -2, -1, ModItems.masterBloodOrb, boundBlade);
|
||||
demonSpawn = new AchievementsMod("demonSpawn", -3, -2, ModItems.demonPlacer, masterOrb);
|
||||
phantomBridgeSigil = new AchievementsMod("phantomBridgeSigil", 6, -1, ModItems.sigilOfTheBridge, masterOrb);
|
||||
teleposer = new AchievementsMod("teleposer", -4, -1, ModBlocks.blockTeleposer, masterOrb);
|
||||
suppressionSigil = new AchievementsMod("suppressionSigil", 6, -2, ModItems.itemSigilOfSupression, masterOrb);
|
||||
archmageOrb = new AchievementsMod("archmageOrb", -1, 2, ModItems.archmageBloodOrb, masterOrb);
|
||||
energyBazooka = new AchievementsMod("energyBazooka", -3, 2, ModItems.energyBazooka, archmageOrb);
|
||||
demons = new AchievementsMod("demons", 0, 3, new ItemStack(ModItems.baseItems, 1, 29), archmageOrb).setSpecial();
|
||||
transcendentOrb = new AchievementsMod("trancsendentOrb", 0, 5, ModItems.transcendentBloodOrb, demons);
|
||||
firstPrick = new AchievementsMod(StatCollector.translateToLocal("firstPrick"), 0, 0, ModItems.sacrificialDagger, null);
|
||||
weakOrb = new AchievementsMod(StatCollector.translateToLocal("weakOrb"), 3, 0, ModItems.weakBloodOrb, firstPrick);
|
||||
|
||||
alchemicalWizardryPage = new AchievementPage("Blood Magic", AchievementsMod.achievements.toArray(new Achievement[AchievementsMod.achievements.size()]));
|
||||
alchemicalWizardryPage = new AchievementPage("AlchemicalWizardry", AchievementsMod.achievements.toArray(new Achievement[AchievementsMod.achievements.size()]));
|
||||
AchievementPage.registerAchievementPage(alchemicalWizardryPage);
|
||||
AchievementsRegistry.init();
|
||||
FMLCommonHandler.instance().bus().register(new AchievementTrigger());
|
||||
|
|
|
@ -157,7 +157,7 @@ public class ArmourForge extends Block
|
|||
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
SpellHelper.sendIndexedParticleToAllAround(world, xCoord, yCoord, zCoord, 20, world.provider.dimensionId, 1, xCoord, yCoord, zCoord);
|
||||
SpellHelper.sendIndexedParticleToAllAround(world, xCoord, yCoord, zCoord, 20, world.provider.getDimensionId(), 1, xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
if (itemStack != null)
|
||||
|
|
|
@ -82,7 +82,7 @@ public class BlockHomHeart extends BlockContainer
|
|||
itemTag.setInteger("xCoord", x);
|
||||
itemTag.setInteger("yCoord", y);
|
||||
itemTag.setInteger("zCoord", z);
|
||||
itemTag.setInteger("dimensionId", world.provider.dimensionId);
|
||||
itemTag.setInteger("dimensionId", world.provider.getDimensionId());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ public class BlockSpellParadigm extends BlockOrientable
|
|||
itemTag.setInteger("xCoord", x);
|
||||
itemTag.setInteger("yCoord", y);
|
||||
itemTag.setInteger("zCoord", z);
|
||||
itemTag.setInteger("dimensionId", world.provider.dimensionId);
|
||||
itemTag.setInteger("dimensionId", world.provider.getDimensionId());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ import net.minecraft.block.BlockContainer;
|
|||
import net.minecraft.block.BlockMobSpawner;
|
||||
import net.minecraft.block.BlockPortal;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
|
@ -15,9 +15,14 @@ import net.minecraft.inventory.IInventory;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.common.Optional;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.api.event.TeleposeEvent;
|
||||
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
|
||||
|
@ -26,9 +31,7 @@ import WayofTime.alchemicalWizardry.common.items.TelepositionFocus;
|
|||
import WayofTime.alchemicalWizardry.common.tileEntity.TETeleposer;
|
||||
import codechicken.multipart.MultipartHelper;
|
||||
import codechicken.multipart.TileMultipart;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
|
||||
public class BlockTeleposer extends BlockContainer
|
||||
{
|
||||
|
@ -45,35 +48,35 @@ public class BlockTeleposer extends BlockContainer
|
|||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
this.setBlockName("bloodTeleposer");
|
||||
this.setUnlocalizedName("bloodTeleposer");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.topIcon = iconRegister.registerIcon("AlchemicalWizardry:Teleposer_Top");
|
||||
this.sideIcon2 = iconRegister.registerIcon("AlchemicalWizardry:Teleposer_Side");
|
||||
this.bottomIcon = iconRegister.registerIcon("AlchemicalWizardry:Teleposer_Side");
|
||||
}
|
||||
// @Override
|
||||
// @SideOnly(Side.CLIENT)
|
||||
// public void registerBlockIcons(IIconRegister iconRegister)
|
||||
// {
|
||||
// this.topIcon = iconRegister.registerIcon("AlchemicalWizardry:Teleposer_Top");
|
||||
// this.sideIcon2 = iconRegister.registerIcon("AlchemicalWizardry:Teleposer_Side");
|
||||
// this.bottomIcon = iconRegister.registerIcon("AlchemicalWizardry:Teleposer_Side");
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// @SideOnly(Side.CLIENT)
|
||||
// public IIcon getIcon(int side, int meta)
|
||||
// {
|
||||
// switch (side)
|
||||
// {
|
||||
// case 0:
|
||||
// return bottomIcon;
|
||||
// case 1:
|
||||
// return topIcon;
|
||||
// default:
|
||||
// return sideIcon2;
|
||||
// }
|
||||
// }
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta)
|
||||
{
|
||||
switch (side)
|
||||
{
|
||||
case 0:
|
||||
return bottomIcon;
|
||||
case 1:
|
||||
return topIcon;
|
||||
default:
|
||||
return sideIcon2;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are)
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
ItemStack playerItem = player.getCurrentEquippedItem();
|
||||
|
||||
|
@ -89,28 +92,28 @@ public class BlockTeleposer extends BlockContainer
|
|||
}
|
||||
|
||||
NBTTagCompound itemTag = playerItem.getTagCompound();
|
||||
itemTag.setInteger("xCoord", x);
|
||||
itemTag.setInteger("yCoord", y);
|
||||
itemTag.setInteger("zCoord", z);
|
||||
itemTag.setInteger("dimensionId", world.provider.dimensionId);
|
||||
itemTag.setInteger("xCoord", pos.getX());
|
||||
itemTag.setInteger("yCoord", pos.getY());
|
||||
itemTag.setInteger("zCoord", pos.getZ());
|
||||
itemTag.setInteger("dimensionId", world.provider.getDimensionId());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
player.openGui(AlchemicalWizardry.instance, 1, world, x, y, z);
|
||||
player.openGui(AlchemicalWizardry.instance, 1, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block par5, int par6)
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState state)
|
||||
{
|
||||
dropItems(world, x, y, z);
|
||||
super.breakBlock(world, x, y, z, par5, par6);
|
||||
dropItems(world, pos);
|
||||
super.breakBlock(world, pos, state);
|
||||
}
|
||||
|
||||
private void dropItems(World world, int x, int y, int z)
|
||||
private void dropItems(World world, BlockPos pos)
|
||||
{
|
||||
Random rand = new Random();
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
TileEntity tileEntity = world.getTileEntity(pos);
|
||||
|
||||
if (!(tileEntity instanceof IInventory))
|
||||
{
|
||||
|
@ -128,7 +131,7 @@ public class BlockTeleposer extends BlockContainer
|
|||
float rx = rand.nextFloat() * 0.8F + 0.1F;
|
||||
float ry = rand.nextFloat() * 0.8F + 0.1F;
|
||||
float rz = rand.nextFloat() * 0.8F + 0.1F;
|
||||
EntityItem entityItem = new EntityItem(world, x + rx, y + ry, z + rz, new ItemStack(item.getItem(), item.stackSize, item.getItemDamage()));
|
||||
EntityItem entityItem = new EntityItem(world, pos.getX() + rx, pos.getY() + ry, pos.getZ() + rz, new ItemStack(item.getItem(), item.stackSize, item.getItemDamage()));
|
||||
|
||||
if (item.hasTagCompound())
|
||||
{
|
||||
|
@ -151,20 +154,20 @@ public class BlockTeleposer extends BlockContainer
|
|||
return new TETeleposer();
|
||||
}
|
||||
|
||||
public static boolean swapBlocks(Object caller, World worldI, World worldF, int xi, int yi, int zi, int xf, int yf, int zf)
|
||||
public static boolean swapBlocks(Object caller, World worldI, World worldF, BlockPos posi, BlockPos posf)
|
||||
{
|
||||
return swapBlocks(caller, worldI, worldF, xi, yi, zi, xf, yf, zf, true, 3);
|
||||
return swapBlocks(caller, worldI, worldF, posi, posf, true, 3);
|
||||
}
|
||||
|
||||
public static boolean swapBlocksWithoutSound(Object caller, World worldI, World worldF, int xi, int yi, int zi, int xf, int yf, int zf)
|
||||
public static boolean swapBlocksWithoutSound(Object caller, World worldI, World worldF, BlockPos posi, BlockPos posf)
|
||||
{
|
||||
return swapBlocks(caller, worldI, worldF, xi, yi, zi, xf, yf, zf, false, 3);
|
||||
return swapBlocks(caller, worldI, worldF, posi, posf, false, 3);
|
||||
}
|
||||
|
||||
public static boolean swapBlocks(Object caller, World worldI, World worldF, int xi, int yi, int zi, int xf, int yf, int zf, boolean doSound, int flag)
|
||||
public static boolean swapBlocks(Object caller, World worldI, World worldF, BlockPos posi, BlockPos posf, boolean doSound, int flag)
|
||||
{
|
||||
TileEntity tileEntityI = worldI.getTileEntity(xi, yi, zi);
|
||||
TileEntity tileEntityF = worldF.getTileEntity(xf, yf, zf);
|
||||
TileEntity tileEntityI = worldI.getTileEntity(posi);
|
||||
TileEntity tileEntityF = worldF.getTileEntity(posf);
|
||||
|
||||
NBTTagCompound nbttag1 = new NBTTagCompound();
|
||||
NBTTagCompound nbttag2 = new NBTTagCompound();
|
||||
|
@ -179,8 +182,10 @@ public class BlockTeleposer extends BlockContainer
|
|||
tileEntityF.writeToNBT(nbttag2);
|
||||
}
|
||||
|
||||
Block blockI = worldI.getBlock(xi, yi, zi);
|
||||
Block blockF = worldF.getBlock(xf, yf, zf);
|
||||
IBlockState stateI = worldI.getBlockState(posi);
|
||||
Block blockI = stateI.getBlock();
|
||||
IBlockState stateF = worldF.getBlockState(posf);
|
||||
Block blockF = stateF.getBlock();
|
||||
|
||||
|
||||
if (blockI.equals(Blocks.air) && blockF.equals(Blocks.air))
|
||||
|
@ -192,18 +197,15 @@ public class BlockTeleposer extends BlockContainer
|
|||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int metaI = worldI.getBlockMetadata(xi, yi, zi);
|
||||
int metaF = worldF.getBlockMetadata(xf, yf, zf);
|
||||
|
||||
TeleposeEvent evt = new TeleposeEvent(worldI, xi, yi, zi, blockI, metaI, worldF, xf, yf, zf, blockF, metaF);
|
||||
TeleposeEvent evt = new TeleposeEvent(worldI, posi, stateI, worldF, posf, stateF);
|
||||
if (MinecraftForge.EVENT_BUS.post(evt))
|
||||
return false;
|
||||
|
||||
if(doSound)
|
||||
{
|
||||
worldI.playSoundEffect(xi, yi, zi, "mob.endermen.portal", 1.0F, 1.0F);
|
||||
worldF.playSoundEffect(xf, yf, zf, "mob.endermen.portal", 1.0F, 1.0F);
|
||||
worldI.playSoundEffect(posi.getX(), posi.getY(), posi.getZ(), "mob.endermen.portal", 1.0F, 1.0F);
|
||||
worldF.playSoundEffect(posf.getX(), posf.getY(), posf.getZ(), "mob.endermen.portal", 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
//CLEAR TILES
|
||||
|
@ -211,20 +213,20 @@ public class BlockTeleposer extends BlockContainer
|
|||
|
||||
if (finalBlock != null)
|
||||
{
|
||||
TileEntity tileToSet = finalBlock.createTileEntity(worldF, metaF);
|
||||
TileEntity tileToSet = finalBlock.createTileEntity(worldF, stateF);
|
||||
|
||||
worldF.setTileEntity(xf, yf, zf, tileToSet);
|
||||
worldF.setTileEntity(posf, tileToSet);
|
||||
}
|
||||
|
||||
if (blockI != null)
|
||||
{
|
||||
TileEntity tileToSet = blockI.createTileEntity(worldI, metaI);
|
||||
TileEntity tileToSet = blockI.createTileEntity(worldI, stateI);
|
||||
|
||||
worldI.setTileEntity(xi, yi, zi, tileToSet);
|
||||
worldI.setTileEntity(posi, tileToSet);
|
||||
}
|
||||
|
||||
//TILES CLEARED
|
||||
worldF.setBlock(xf, yf, zf, blockI, metaI, flag);
|
||||
worldF.setBlockState(posf, stateI, flag);
|
||||
|
||||
if (tileEntityI != null)
|
||||
{
|
||||
|
@ -235,19 +237,16 @@ public class BlockTeleposer extends BlockContainer
|
|||
newTileEntityI = createMultipartFromNBT(worldF, nbttag1);
|
||||
}
|
||||
|
||||
worldF.setTileEntity(xf, yf, zf, newTileEntityI);
|
||||
|
||||
newTileEntityI.xCoord = xf;
|
||||
newTileEntityI.yCoord = yf;
|
||||
newTileEntityI.zCoord = zf;
|
||||
worldF.setTileEntity(posf, newTileEntityI);
|
||||
|
||||
newTileEntityI.setPos(posf);
|
||||
if(AlchemicalWizardry.isFMPLoaded && isMultipart(tileEntityI))
|
||||
{
|
||||
sendDescriptorOfTile(worldF, newTileEntityI);
|
||||
}
|
||||
}
|
||||
|
||||
worldI.setBlock(xi, yi, zi, finalBlock, metaF, flag);
|
||||
worldI.setBlockState(posi, stateF, flag);
|
||||
|
||||
if (tileEntityF != null)
|
||||
{
|
||||
|
@ -257,11 +256,9 @@ public class BlockTeleposer extends BlockContainer
|
|||
newTileEntityF = createMultipartFromNBT(worldI, nbttag2);
|
||||
}
|
||||
|
||||
worldI.setTileEntity(xi, yi, zi, newTileEntityF);
|
||||
worldI.setTileEntity(posi, newTileEntityF);
|
||||
|
||||
newTileEntityF.xCoord = xi;
|
||||
newTileEntityF.yCoord = yi;
|
||||
newTileEntityF.zCoord = zi;
|
||||
newTileEntityF.setPos(posi);
|
||||
|
||||
if(AlchemicalWizardry.isFMPLoaded && isMultipart(tileEntityF))
|
||||
{
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
public interface IOrientable
|
||||
{
|
||||
ForgeDirection getInputDirection();
|
||||
EnumFacing getInputDirection();
|
||||
|
||||
ForgeDirection getOutputDirection();
|
||||
EnumFacing getOutputDirection();
|
||||
|
||||
void setInputDirection(ForgeDirection direction);
|
||||
void setInputDirection(EnumFacing direction);
|
||||
|
||||
void setOutputDirection(ForgeDirection direction);
|
||||
void setOutputDirection(EnumFacing direction);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package WayofTime.alchemicalWizardry.common.bloodAltarUpgrade;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
|
||||
public class AltarComponent
|
||||
{
|
||||
|
@ -47,6 +48,11 @@ public class AltarComponent
|
|||
{
|
||||
return metadata;
|
||||
}
|
||||
|
||||
public IBlockState getBlockState()
|
||||
{
|
||||
return block.getStateFromMeta(getMetadata());
|
||||
}
|
||||
|
||||
public boolean isBloodRune()
|
||||
{
|
||||
|
|
|
@ -4,7 +4,9 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.ModBlocks;
|
||||
import WayofTime.alchemicalWizardry.api.altarRecipeRegistry.IFadedRune;
|
||||
|
@ -19,11 +21,11 @@ public class UpgradedAltars
|
|||
public static List<AltarComponent> sixthTierAltar = new ArrayList();
|
||||
public static int highestAltar = 6;
|
||||
|
||||
public static int isAltarValid(World world, int x, int y, int z)
|
||||
public static int isAltarValid(World world, BlockPos pos)
|
||||
{
|
||||
for (int i = highestAltar; i >= 2; i--)
|
||||
{
|
||||
if (checkAltarIsValid(world, x, y, z, i))
|
||||
if (checkAltarIsValid(world, pos, i))
|
||||
{
|
||||
return i;
|
||||
}
|
||||
|
@ -32,144 +34,37 @@ public class UpgradedAltars
|
|||
return 1;
|
||||
}
|
||||
|
||||
public static boolean checkAltarIsValid(World world, int x, int y, int z, int altarTier)
|
||||
public static boolean checkAltarIsValid(World world, BlockPos pos, int altarTier)
|
||||
{
|
||||
switch (altarTier)
|
||||
List<AltarComponent> list = UpgradedAltars.getAltarUpgradeListForTier(altarTier);
|
||||
|
||||
for (AltarComponent ac : list)
|
||||
{
|
||||
case 1:
|
||||
return true;
|
||||
|
||||
case 2:
|
||||
for (AltarComponent ac : secondTierAltar)
|
||||
BlockPos newPos = pos.add(ac.getX(), ac.getY(), ac.getZ());
|
||||
IBlockState state = world.getBlockState(newPos);
|
||||
Block block = state.getBlock();
|
||||
|
||||
if (ac.isBloodRune())
|
||||
{
|
||||
if (!(block instanceof BloodRune))
|
||||
{
|
||||
if (ac.isBloodRune())
|
||||
{
|
||||
Block testBlock = world.getBlock(x + ac.getX(), y + ac.getY(), z + ac.getZ());
|
||||
|
||||
if (!(testBlock instanceof BloodRune))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
} else
|
||||
{
|
||||
Block block = world.getBlock(x + ac.getX(), y + ac.getY(), z + ac.getZ());
|
||||
int metadata = world.getBlockMetadata(x + ac.getX(), y + ac.getY(), z + ac.getZ());
|
||||
|
||||
if (((ac.getBlock() != block) || (ac.getMetadata() != metadata)) && !(ac.getBlock() == Blocks.stonebrick && !world.isAirBlock(x + ac.getX(), y + ac.getY(), z + ac.getZ())))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
} else
|
||||
{
|
||||
int metadata = block.getMetaFromState(state);
|
||||
|
||||
return true;
|
||||
|
||||
case 3:
|
||||
for (AltarComponent ac : thirdTierAltar)
|
||||
if (((ac.getBlock() != block) || (ac.getMetadata() != metadata)) && !(ac.getBlock() == Blocks.stonebrick && !world.isAirBlock(newPos)))
|
||||
{
|
||||
if (ac.isBloodRune())
|
||||
{
|
||||
Block testBlock = world.getBlock(x + ac.getX(), y + ac.getY(), z + ac.getZ());
|
||||
|
||||
if (!(testBlock instanceof BloodRune))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
} else
|
||||
{
|
||||
Block block = world.getBlock(x + ac.getX(), y + ac.getY(), z + ac.getZ());
|
||||
int metadata = world.getBlockMetadata(x + ac.getX(), y + ac.getY(), z + ac.getZ());
|
||||
|
||||
if (((ac.getBlock() != block) || (ac.getMetadata() != metadata)) && !(ac.getBlock() == Blocks.stonebrick && !world.isAirBlock(x + ac.getX(), y + ac.getY(), z + ac.getZ())))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
case 4:
|
||||
for (AltarComponent ac : fourthTierAltar)
|
||||
{
|
||||
if (ac.isBloodRune())
|
||||
{
|
||||
Block testBlock = world.getBlock(x + ac.getX(), y + ac.getY(), z + ac.getZ());
|
||||
|
||||
if (!(testBlock instanceof BloodRune))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
} else
|
||||
{
|
||||
Block block = world.getBlock(x + ac.getX(), y + ac.getY(), z + ac.getZ());
|
||||
int metadata = world.getBlockMetadata(x + ac.getX(), y + ac.getY(), z + ac.getZ());
|
||||
|
||||
if (((ac.getBlock() != block) || (ac.getMetadata() != metadata)) && !(ac.getBlock() == Blocks.stonebrick && !world.isAirBlock(x + ac.getX(), y + ac.getY(), z + ac.getZ())))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
case 5:
|
||||
for (AltarComponent ac : fifthTierAltar)
|
||||
{
|
||||
if (ac.isBloodRune())
|
||||
{
|
||||
Block testBlock = world.getBlock(x + ac.getX(), y + ac.getY(), z + ac.getZ());
|
||||
|
||||
if (!(testBlock instanceof BloodRune))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
} else
|
||||
{
|
||||
Block block = world.getBlock(x + ac.getX(), y + ac.getY(), z + ac.getZ());
|
||||
int metadata = world.getBlockMetadata(x + ac.getX(), y + ac.getY(), z + ac.getZ());
|
||||
|
||||
if (((ac.getBlock() != block) || (ac.getMetadata() != metadata)) && !(ac.getBlock() == Blocks.stonebrick && !world.isAirBlock(x + ac.getX(), y + ac.getY(), z + ac.getZ())))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
case 6:
|
||||
for (AltarComponent ac : sixthTierAltar)
|
||||
{
|
||||
if (ac.isBloodRune())
|
||||
{
|
||||
Block testBlock = world.getBlock(x + ac.getX(), y + ac.getY(), z + ac.getZ());
|
||||
|
||||
if (!(testBlock instanceof BloodRune))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
} else
|
||||
{
|
||||
Block block = world.getBlock(x + ac.getX(), y + ac.getY(), z + ac.getZ());
|
||||
int metadata = world.getBlockMetadata(x + ac.getX(), y + ac.getY(), z + ac.getZ());
|
||||
|
||||
if (((ac.getBlock() != block) || (ac.getMetadata() != metadata)) && !(ac.getBlock() == Blocks.stonebrick && !world.isAirBlock(x + ac.getX(), y + ac.getY(), z + ac.getZ())))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static AltarUpgradeComponent getUpgrades(World world, int x, int y, int z, int altarTier)
|
||||
public static AltarUpgradeComponent getUpgrades(World world, BlockPos pos, int altarTier)
|
||||
{
|
||||
if(world.isRemote)
|
||||
{
|
||||
|
@ -180,18 +75,21 @@ public class UpgradedAltars
|
|||
|
||||
for (AltarComponent ac : list)
|
||||
{
|
||||
BlockPos newPos = pos.add(ac.getX(), ac.getY(), ac.getZ());
|
||||
|
||||
if (ac.isUpgradeSlot())
|
||||
{
|
||||
//Currently checks the getRuneEffect.
|
||||
//TODO Change so that it uses the metadata instead, with the BlockID.
|
||||
Block testBlock = world.getBlock(x + ac.getX(), y + ac.getY(), z + ac.getZ());
|
||||
int meta = world.getBlockMetadata(x + ac.getX(), y + ac.getY(), z + ac.getZ());
|
||||
IBlockState state = world.getBlockState(newPos);
|
||||
Block testBlock = state.getBlock();
|
||||
int meta = testBlock.getMetaFromState(state);
|
||||
|
||||
if (testBlock instanceof BloodRune)
|
||||
{
|
||||
if (testBlock instanceof IFadedRune && altarTier > ((IFadedRune)testBlock).getAltarTierLimit(meta))
|
||||
{
|
||||
return UpgradedAltars.getUpgrades(world, x, y, z, ((IFadedRune)testBlock).getAltarTierLimit(meta));
|
||||
return UpgradedAltars.getUpgrades(world, pos, ((IFadedRune)testBlock).getAltarTierLimit(meta));
|
||||
}
|
||||
|
||||
switch (((BloodRune) testBlock).getRuneEffect(meta))
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,76 +0,0 @@
|
|||
package WayofTime.alchemicalWizardry.common.commands;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.command.CommandBase;
|
||||
import net.minecraft.command.CommandException;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
|
||||
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
|
||||
|
||||
public class CommandBind extends CommandBase
|
||||
{
|
||||
public CommandBind() {}
|
||||
|
||||
public String getCommandName()
|
||||
{
|
||||
return "bind";
|
||||
}
|
||||
|
||||
public int getRequiredPermissionLevel()
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
public String getCommandUsage(ICommandSender icommandsender)
|
||||
{
|
||||
return "commands.bind.usage";
|
||||
}
|
||||
|
||||
public void processCommand(ICommandSender iCommandSender, String[] astring)
|
||||
{
|
||||
EntityPlayerMP entityplayermp = getCommandSenderAsPlayer(iCommandSender);
|
||||
ItemStack item = entityplayermp.getCurrentEquippedItem();
|
||||
EntityPlayerMP targetPlayer = getPlayer(iCommandSender, astring[0]);
|
||||
|
||||
if (targetPlayer == null)
|
||||
{
|
||||
throw new CommandException("commands.bind.failed.noPlayer");
|
||||
}
|
||||
|
||||
if (item != null && item.getItem() instanceof IBindable)
|
||||
{
|
||||
if (EnergyItems.getOwnerName(item).isEmpty())
|
||||
{
|
||||
EnergyItems.checkAndSetItemOwner(item, targetPlayer);
|
||||
func_152373_a(iCommandSender, this, "commands.bind.success");
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new CommandException("commands.bind.failed.alreadyBound");
|
||||
}
|
||||
}
|
||||
else if (!(item.getItem() instanceof IBindable))
|
||||
{
|
||||
throw new CommandException("commands.bind.failed.notBindable");
|
||||
}
|
||||
}
|
||||
|
||||
public List addTabCompletionOptions(ICommandSender iCommandSender, String[] astring)
|
||||
{
|
||||
return getListOfStringsMatchingLastWord(astring, this.getPlayer());
|
||||
}
|
||||
|
||||
protected String[] getPlayer()
|
||||
{
|
||||
return MinecraftServer.getServer().getAllUsernames();
|
||||
}
|
||||
|
||||
public boolean isUsernameIndex(String[] astring, int par2)
|
||||
{
|
||||
return par2 == 0;
|
||||
}
|
||||
}
|
|
@ -1,137 +0,0 @@
|
|||
package WayofTime.alchemicalWizardry.common.commands;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
|
||||
import net.minecraft.command.CommandBase;
|
||||
import net.minecraft.command.CommandException;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class CommandSN extends CommandBase
|
||||
{
|
||||
public CommandSN() {}
|
||||
|
||||
@Override
|
||||
public String getCommandName()
|
||||
{
|
||||
return "soulnetwork";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRequiredPermissionLevel()
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandUsage(ICommandSender icommandsender)
|
||||
{
|
||||
return "commands.soulnetwork.usage";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processCommand(ICommandSender icommandsender, String[] astring)
|
||||
{
|
||||
EntityPlayerMP targetPlayer = getPlayer(icommandsender, astring[0]);
|
||||
String owner = targetPlayer.getDisplayName();
|
||||
EntityPlayerMP proxyPlayerName = getPlayer(icommandsender, astring[0]);
|
||||
|
||||
if (astring.length >= 2 && astring.length <= 3)
|
||||
{
|
||||
if ("add".equalsIgnoreCase(astring[1]))
|
||||
{
|
||||
int amount = parseIntBounded(icommandsender, astring[2], Integer.MIN_VALUE, Integer.MAX_VALUE);
|
||||
|
||||
SoulNetworkHandler.addCurrentEssenceToMaximum(owner, amount, Integer.MAX_VALUE);
|
||||
func_152373_a(icommandsender, this, "commands.soulnetwork.add.success", amount, owner);
|
||||
}
|
||||
else if ("subtract".equalsIgnoreCase(astring[1]))
|
||||
{
|
||||
int amount = parseIntBounded(icommandsender, astring[2], Integer.MIN_VALUE, Integer.MAX_VALUE);
|
||||
|
||||
if (amount > SoulNetworkHandler.getCurrentEssence(owner))
|
||||
{
|
||||
int lp = SoulNetworkHandler.getCurrentEssence(owner);
|
||||
SoulNetworkHandler.syphonFromNetwork(owner, lp);
|
||||
func_152373_a(icommandsender, this, "commands.soulnetwork.subtract.success", SoulNetworkHandler.getCurrentEssence(owner), owner);
|
||||
}
|
||||
else
|
||||
{
|
||||
SoulNetworkHandler.syphonFromNetwork(owner, amount);
|
||||
func_152373_a(icommandsender, this, "commands.soulnetwork.subtract.success", amount, owner);
|
||||
}
|
||||
}
|
||||
else if ("fill".equalsIgnoreCase(astring[1]))
|
||||
{
|
||||
int amount = Integer.MAX_VALUE - SoulNetworkHandler.getCurrentEssence(owner);
|
||||
SoulNetworkHandler.addCurrentEssenceToMaximum(owner, amount, Integer.MAX_VALUE);
|
||||
func_152373_a(icommandsender, this, "commands.soulnetwork.fill.success", owner);
|
||||
}
|
||||
else if ("empty".equalsIgnoreCase(astring[1]))
|
||||
{
|
||||
SoulNetworkHandler.syphonFromNetwork(owner, SoulNetworkHandler.getCurrentEssence(owner));
|
||||
func_152373_a(icommandsender, this, "commands.soulnetwork.empty.success", owner);
|
||||
}
|
||||
else if ("get".equalsIgnoreCase(astring[1]))
|
||||
{
|
||||
int currentEssence = SoulNetworkHandler.getCurrentEssence(owner);
|
||||
func_152373_a(icommandsender, this, "commands.soulnetwork.get.success", currentEssence, owner);
|
||||
}
|
||||
else if ("fillMax".equalsIgnoreCase(astring[1]))
|
||||
{
|
||||
int currentEssence = SoulNetworkHandler.getCurrentEssence(owner);
|
||||
int orbTier = SoulNetworkHandler.getCurrentMaxOrb(owner);
|
||||
int maxForOrb = SoulNetworkHandler.getMaximumForOrbTier(orbTier);
|
||||
int fillAmount = maxForOrb - currentEssence;
|
||||
SoulNetworkHandler.addCurrentEssenceToMaximum(owner, fillAmount, fillAmount);
|
||||
func_152373_a(icommandsender, this, "commands.soulnetwork.fillMax.success", owner);
|
||||
}
|
||||
else if ("create".equalsIgnoreCase(astring[1]))
|
||||
{
|
||||
int orbTier = parseIntBounded(icommandsender, astring[2], 1, 6);
|
||||
SoulNetworkHandler.setMaxOrbToMax(proxyPlayerName.getDisplayName(), orbTier);
|
||||
func_152373_a(icommandsender, this, "commands.soulnetwork.create.success", owner, orbTier);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new CommandException("commands.soulnetwork.notACommand");
|
||||
}
|
||||
}
|
||||
else if (astring.length == 0)
|
||||
{
|
||||
throw new CommandException("commands.soulnetwork.noPlayer");
|
||||
}
|
||||
else if (astring.length == 1)
|
||||
{
|
||||
throw new CommandException("commands.soulnetwork.noCommand");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List addTabCompletionOptions(ICommandSender iCommandSender, String[] astring)
|
||||
{
|
||||
if (astring.length == 1)
|
||||
{
|
||||
return getListOfStringsMatchingLastWord(astring, this.getPlayer());
|
||||
}
|
||||
else if (astring.length == 2)
|
||||
{
|
||||
return getListOfStringsMatchingLastWord(astring, "add", "subtract", "fill", "empty", "get", "fillMax", "create");
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
protected String[] getPlayer()
|
||||
{
|
||||
return MinecraftServer.getServer().getAllUsernames();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUsernameIndex(String[] astring, int par2)
|
||||
{
|
||||
return par2 == 0;
|
||||
}
|
||||
}
|
|
@ -1,52 +0,0 @@
|
|||
package WayofTime.alchemicalWizardry.common.commands;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
|
||||
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
|
||||
import net.minecraft.command.CommandBase;
|
||||
import net.minecraft.command.CommandException;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class CommandUnbind extends CommandBase
|
||||
{
|
||||
public CommandUnbind() {}
|
||||
|
||||
public String getCommandName()
|
||||
{
|
||||
return "unbind";
|
||||
}
|
||||
|
||||
public int getRequiredPermissionLevel()
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
public String getCommandUsage(ICommandSender icommandsender)
|
||||
{
|
||||
return "commands.unbind.usage";
|
||||
}
|
||||
|
||||
public void processCommand(ICommandSender iCommandSender, String[] astring)
|
||||
{
|
||||
EntityPlayerMP entityplayermp = getCommandSenderAsPlayer(iCommandSender);
|
||||
ItemStack item = entityplayermp.getCurrentEquippedItem();
|
||||
|
||||
if (item != null && item.getItem() instanceof IBindable)
|
||||
{
|
||||
if (!EnergyItems.getOwnerName(item).isEmpty())
|
||||
{
|
||||
item.getTagCompound().removeTag("ownerName");
|
||||
func_152373_a(iCommandSender, this, "commands.unbind.success");
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new CommandException("commands.unbind.failed.notBindable");
|
||||
}
|
||||
}
|
||||
else if (!(item.getItem() instanceof IBindable))
|
||||
{
|
||||
throw new CommandException("commands.unbind.failed.notBindable");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -231,8 +231,8 @@ public class StorageBlockCraftingManager
|
|||
if (i == 2 && itemstack.getItem() == itemstack1.getItem() && itemstack.stackSize == 1 && itemstack1.stackSize == 1 && itemstack.getItem().isRepairable())
|
||||
{
|
||||
Item item = itemstack.getItem();
|
||||
int j1 = item.getMaxDamage() - itemstack.getItemDamageForDisplay();
|
||||
int k = item.getMaxDamage() - itemstack1.getItemDamageForDisplay();
|
||||
int j1 = item.getMaxDamage() - itemstack.getItemDamage();
|
||||
int k = item.getMaxDamage() - itemstack1.getItemDamage();
|
||||
int l = j1 + k + item.getMaxDamage() * 5 / 100;
|
||||
int i1 = item.getMaxDamage() - l;
|
||||
|
||||
|
|
|
@ -14,8 +14,9 @@ import net.minecraft.block.BlockTrapDoor;
|
|||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import WayofTime.alchemicalWizardry.api.Int3;
|
||||
import WayofTime.alchemicalWizardry.common.demonVillage.loot.DemonVillageLootRegistry;
|
||||
import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.IBlockPortalNode;
|
||||
|
@ -276,7 +277,7 @@ public class BlockSet
|
|||
return GameRegistry.findBlock(modId, name);
|
||||
}
|
||||
|
||||
public int getMetaForDirection(ForgeDirection dir)
|
||||
public int getMetaForDirection(EnumFacing dir)
|
||||
{
|
||||
if (metadata.length < 4)
|
||||
{
|
||||
|
@ -298,7 +299,7 @@ public class BlockSet
|
|||
}
|
||||
}
|
||||
|
||||
public void buildAtIndex(TEDemonPortal teDemonPortal, World world, int xCoord, int yCoord, int zCoord, ForgeDirection dir, int index, boolean populateInventories, int tier)
|
||||
public void buildAtIndex(TEDemonPortal teDemonPortal, World world, int xCoord, int yCoord, int zCoord, EnumFacing dir, int index, boolean populateInventories, int tier)
|
||||
{
|
||||
Block block = this.getBlock();
|
||||
if (index >= positions.size() || block == null)
|
||||
|
@ -333,14 +334,15 @@ public class BlockSet
|
|||
default:
|
||||
}
|
||||
|
||||
world.setBlock(xCoord + xOff, yCoord + yOff, zCoord + zOff, block, meta, 3);
|
||||
BlockPos newPos = new BlockPos(xCoord + xOff, yCoord + yOff, zCoord + zOff);
|
||||
world.setBlockState(newPos, block.getStateFromMeta(meta), 3);
|
||||
if(populateInventories)
|
||||
{
|
||||
this.populateIfIInventory(world, xCoord + xOff, yCoord + yOff, zCoord + zOff, tier);
|
||||
this.populateIfIInventory(world, newPos, tier);
|
||||
}
|
||||
if(block instanceof IBlockPortalNode)
|
||||
{
|
||||
TileEntity tile = world.getTileEntity(xCoord + xOff, yCoord + yOff, zCoord + zOff);
|
||||
TileEntity tile = world.getTileEntity(newPos);
|
||||
if(tile instanceof ITilePortalNode)
|
||||
{
|
||||
((ITilePortalNode) tile).setPortalLocation(teDemonPortal);
|
||||
|
@ -348,16 +350,16 @@ public class BlockSet
|
|||
}
|
||||
}
|
||||
|
||||
public void populateIfIInventory(World world, int x, int y, int z, int tier)
|
||||
public void populateIfIInventory(World world, BlockPos pos, int tier)
|
||||
{
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if(tile instanceof IInventory)
|
||||
{
|
||||
DemonVillageLootRegistry.populateChest((IInventory)tile, tier);
|
||||
}
|
||||
}
|
||||
|
||||
public void buildAll(TEDemonPortal teDemonPortal, World world, int xCoord, int yCoord, int zCoord, ForgeDirection dir, boolean populateInventories, int tier)
|
||||
public void buildAll(TEDemonPortal teDemonPortal, World world, int xCoord, int yCoord, int zCoord, EnumFacing dir, boolean populateInventories, int tier)
|
||||
{
|
||||
for (int i = 0; i < positions.size(); i++)
|
||||
{
|
||||
|
|
|
@ -4,8 +4,10 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import WayofTime.alchemicalWizardry.ModBlocks;
|
||||
import WayofTime.alchemicalWizardry.api.Int3;
|
||||
import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal;
|
||||
|
@ -52,7 +54,7 @@ public class BuildingSchematic
|
|||
blockList.add(set);
|
||||
}
|
||||
|
||||
public void buildAll(TEDemonPortal teDemonPortal, World world, int xCoord, int yCoord, int zCoord, ForgeDirection dir, boolean populateInventories)
|
||||
public void buildAll(TEDemonPortal teDemonPortal, World world, int xCoord, int yCoord, int zCoord, EnumFacing dir, boolean populateInventories)
|
||||
{
|
||||
for (BlockSet set : blockList)
|
||||
{
|
||||
|
@ -86,7 +88,7 @@ public class BuildingSchematic
|
|||
return new Int3(gridX, doorY, gridZ);
|
||||
}
|
||||
|
||||
public List<Int3> getGriddedPositions(ForgeDirection dir)
|
||||
public List<Int3> getGriddedPositions(EnumFacing dir)
|
||||
{
|
||||
List<Int3> positionList = new ArrayList();
|
||||
|
||||
|
@ -127,7 +129,7 @@ public class BuildingSchematic
|
|||
return positionList;
|
||||
}
|
||||
|
||||
public void destroyAllInField(World world, int xCoord, int yCoord, int zCoord, ForgeDirection dir)
|
||||
public void destroyAllInField(World world, int xCoord, int yCoord, int zCoord, EnumFacing dir)
|
||||
{
|
||||
// GridSpaceHolder grid = this.createGSH(); //GridSpaceHolder is not aware of the buildings - need to use the schematic
|
||||
|
||||
|
@ -137,10 +139,12 @@ public class BuildingSchematic
|
|||
{
|
||||
for (Int3 pos : positionList)
|
||||
{
|
||||
Block block = world.getBlock(xCoord + pos.xCoord, yCoord + i, zCoord + pos.zCoord);
|
||||
BlockPos newPos = new BlockPos(xCoord + pos.xCoord, yCoord + i, zCoord + pos.zCoord);
|
||||
IBlockState state = world.getBlockState(newPos);
|
||||
Block block = state.getBlock();
|
||||
if (block != ModBlocks.blockDemonPortal)
|
||||
{
|
||||
world.setBlockToAir(xCoord + pos.xCoord, yCoord + i, zCoord + pos.zCoord);
|
||||
world.setBlockToAir(newPos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package WayofTime.alchemicalWizardry.common.demonVillage;
|
||||
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import WayofTime.alchemicalWizardry.api.Int3;
|
||||
import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal;
|
||||
|
||||
|
@ -30,17 +30,17 @@ public class DemonBuilding
|
|||
return schematic.getName();
|
||||
}
|
||||
|
||||
public boolean isValid(GridSpaceHolder master, int gridX, int gridZ, ForgeDirection dir)
|
||||
public boolean isValid(GridSpaceHolder master, int gridX, int gridZ, EnumFacing dir)
|
||||
{
|
||||
return area.doesContainAll(master, gridX, gridZ, dir);
|
||||
}
|
||||
|
||||
public void buildAll(TEDemonPortal teDemonPortal, World world, int xCoord, int yCoord, int zCoord, ForgeDirection dir, boolean populateInventories)
|
||||
public void buildAll(TEDemonPortal teDemonPortal, World world, int xCoord, int yCoord, int zCoord, EnumFacing dir, boolean populateInventories)
|
||||
{
|
||||
schematic.buildAll(teDemonPortal, world, xCoord, yCoord, zCoord, dir, populateInventories);
|
||||
}
|
||||
|
||||
public void setAllGridSpaces(int xInit, int zInit, int yLevel, ForgeDirection dir, int type, GridSpaceHolder master)
|
||||
public void setAllGridSpaces(int xInit, int zInit, int yLevel, EnumFacing dir, int type, GridSpaceHolder master)
|
||||
{
|
||||
area.setAllGridSpaces(xInit, zInit, yLevel, dir, type, master);
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ public class DemonBuilding
|
|||
return scheme.createGSH();
|
||||
}
|
||||
|
||||
public Int3 getDoorSpace(ForgeDirection dir)
|
||||
public Int3 getDoorSpace(EnumFacing dir)
|
||||
{
|
||||
int x;
|
||||
int z;
|
||||
|
@ -84,7 +84,7 @@ public class DemonBuilding
|
|||
return new Int3(x, doorGridSpace.yCoord, z);
|
||||
}
|
||||
|
||||
public Int3 getGridOffsetFromRoad(ForgeDirection sideOfRoad, int yLevel)
|
||||
public Int3 getGridOffsetFromRoad(EnumFacing sideOfRoad, int yLevel)
|
||||
{
|
||||
Int3 doorSpace = this.getDoorSpace(sideOfRoad);
|
||||
int x = doorSpace.xCoord;
|
||||
|
@ -109,7 +109,7 @@ public class DemonBuilding
|
|||
return new Int3(x, yLevel, z);
|
||||
}
|
||||
|
||||
public void destroyAllInField(World world, int xCoord, int yCoord, int zCoord, ForgeDirection dir)
|
||||
public void destroyAllInField(World world, int xCoord, int yCoord, int zCoord, EnumFacing dir)
|
||||
{
|
||||
schematic.destroyAllInField(world, xCoord, yCoord, zCoord, dir);
|
||||
}
|
||||
|
|
|
@ -3,9 +3,11 @@ package WayofTime.alchemicalWizardry.common.demonVillage;
|
|||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockFlower;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import WayofTime.alchemicalWizardry.ModBlocks;
|
||||
import WayofTime.alchemicalWizardry.api.Int3;
|
||||
import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.IRoadWard;
|
||||
|
@ -16,19 +18,19 @@ public class DemonVillagePath
|
|||
public int xPos;
|
||||
public int yPos;
|
||||
public int zPos;
|
||||
public ForgeDirection dir;
|
||||
public EnumFacing dir;
|
||||
public int length;
|
||||
|
||||
public static boolean canGoDown = true;
|
||||
public static boolean tunnelIfObstructed = false;
|
||||
public static boolean createBridgeInAirIfObstructed = false;
|
||||
|
||||
public DemonVillagePath(int xi, int yi, int zi, ForgeDirection dir, int length)
|
||||
public DemonVillagePath(int xi, int yi, int zi, EnumFacing dir2, int length)
|
||||
{
|
||||
this.xPos = xi;
|
||||
this.yPos = yi;
|
||||
this.zPos = zi;
|
||||
this.dir = dir;
|
||||
this.dir = dir2;
|
||||
this.length = length;
|
||||
}
|
||||
|
||||
|
@ -40,11 +42,11 @@ public class DemonVillagePath
|
|||
int rad = this.getRoadRadius();
|
||||
int value = 0;
|
||||
|
||||
int finalYPos = this.constructPartialPath(portal, world, clearance, xi - rad * dir.offsetX, yi, zi - rad * dir.offsetZ, dir, length + rad, false);
|
||||
int finalYPos = this.constructPartialPath(portal, world, clearance, xi - rad * dir.getFrontOffsetX(), yi, zi - rad * dir.getFrontOffsetZ(), dir, length + rad, false);
|
||||
|
||||
for (int i = -rad; i <= rad; i++)
|
||||
{
|
||||
value = Math.max(this.constructPartialPath(portal, world, clearance, xi - rad * dir.offsetX + i * dir.offsetZ, yi, zi - rad * dir.offsetZ + i * dir.offsetX, dir, length + 2 * rad, true), value);
|
||||
value = Math.max(this.constructPartialPath(portal, world, clearance, xi - rad * dir.getFrontOffsetX() + i * dir.getFrontOffsetZ(), yi, zi - rad * dir.getFrontOffsetZ() + i * dir.getFrontOffsetX(), dir, length + 2 * rad, true), value);
|
||||
if(TEDemonPortal.printDebug)
|
||||
System.out.println("" + (length + 2 * rad) + ", " + value + "");
|
||||
}
|
||||
|
@ -80,12 +82,12 @@ public class DemonVillagePath
|
|||
* @param doConstruct
|
||||
* @return length if doConstruct, yi if !doConstruct
|
||||
*/
|
||||
public int constructPartialPath(TEDemonPortal portal, World world, int clearance, int xi, int yi, int zi, ForgeDirection dir, int length, boolean doConstruct)
|
||||
public int constructPartialPath(TEDemonPortal portal, World world, int clearance, int xi, int yi, int zi, EnumFacing dir, int length, boolean doConstruct)
|
||||
{
|
||||
for (int i = 0; i < length; i++)
|
||||
{
|
||||
int xOffset = i * dir.offsetX;
|
||||
int zOffset = i * dir.offsetZ;
|
||||
int xOffset = i * dir.getFrontOffsetX();
|
||||
int zOffset = i * dir.getFrontOffsetZ();
|
||||
|
||||
boolean completed = false;
|
||||
|
||||
|
@ -93,14 +95,19 @@ public class DemonVillagePath
|
|||
{
|
||||
int sign = 1;
|
||||
|
||||
Block block1 = world.getBlock(xi + xOffset, yi + sign * yOffset, zi + zOffset);
|
||||
Block highBlock1 = world.getBlock(xi + xOffset, yi + sign * yOffset + 1, zi + zOffset);
|
||||
BlockPos pos1 = new BlockPos(xi + xOffset, yi + sign * yOffset, zi + zOffset);
|
||||
BlockPos highPos1 = pos1.offsetUp();
|
||||
|
||||
IBlockState state1 = world.getBlockState(pos1);
|
||||
IBlockState highState1 = world.getBlockState(highPos1);
|
||||
Block block1 = state1.getBlock();
|
||||
Block highBlock1 = highState1.getBlock();
|
||||
|
||||
if ((this.forceReplaceBlock(block1))||(!block1.isReplaceable(world, xi + xOffset, yi + sign * yOffset, zi + zOffset) && this.isBlockReplaceable(block1) ) && (this.forceCanTunnelUnder(highBlock1) || highBlock1.isReplaceable(world, xi + xOffset, yi + sign * yOffset + 1, zi + zOffset)))
|
||||
if ((this.forceReplaceBlock(block1))||(!block1.isReplaceable(world, pos1) && this.isBlockReplaceable(block1) ) && (this.forceCanTunnelUnder(highBlock1) || highBlock1.isReplaceable(world, highPos1)))
|
||||
{
|
||||
if(doConstruct)
|
||||
{
|
||||
world.setBlock(xi + xOffset, yi + sign * yOffset, zi + zOffset, portal.getRoadBlock(), portal.getRoadMeta(), 3);
|
||||
world.setBlockState(pos1, portal.getRoadState(), 3);
|
||||
}
|
||||
yi += sign * yOffset;
|
||||
completed = true;
|
||||
|
@ -108,14 +115,19 @@ public class DemonVillagePath
|
|||
} else if(canGoDown)
|
||||
{
|
||||
sign = -1;
|
||||
Block block2 = world.getBlock(xi + xOffset, yi + sign * yOffset, zi + zOffset);
|
||||
Block highBlock2 = world.getBlock(xi + xOffset, yi + sign * yOffset + 1, zi + zOffset);
|
||||
pos1 = new BlockPos(xi + xOffset, yi + sign * yOffset, zi + zOffset);
|
||||
highPos1 = pos1.offsetUp();
|
||||
|
||||
state1 = world.getBlockState(pos1);
|
||||
highState1 = world.getBlockState(highPos1);
|
||||
block1 = state1.getBlock();
|
||||
highBlock1 = highState1.getBlock();
|
||||
|
||||
if ((this.forceReplaceBlock(block2))||(!block2.isReplaceable(world, xi + xOffset, yi + sign * yOffset, zi + zOffset) && this.isBlockReplaceable(block2)) && (this.forceCanTunnelUnder(highBlock2) || highBlock2.isReplaceable(world, xi + xOffset, yi + sign * yOffset + 1, zi + zOffset)))
|
||||
if ((this.forceReplaceBlock(block1))||(!block1.isReplaceable(world, pos1) && this.isBlockReplaceable(block1) ) && (this.forceCanTunnelUnder(highBlock1) || highBlock1.isReplaceable(world, highPos1)))
|
||||
{
|
||||
if(doConstruct)
|
||||
if(doConstruct)
|
||||
{
|
||||
world.setBlock(xi + xOffset, yi + sign * yOffset, zi + zOffset, portal.getRoadBlock(), portal.getRoadMeta(), 3);
|
||||
world.setBlockState(pos1, portal.getRoadState(), 3);
|
||||
}
|
||||
yi += sign * yOffset;
|
||||
completed = true;
|
||||
|
@ -129,15 +141,17 @@ public class DemonVillagePath
|
|||
boolean returnAmount = true;
|
||||
if(createBridgeInAirIfObstructed)
|
||||
{
|
||||
Block block1 = world.getBlock(xi + xOffset, yi, zi + zOffset);
|
||||
BlockPos pos1 = new BlockPos(xi + xOffset, yi, zi + zOffset);
|
||||
IBlockState state1 = world.getBlockState(pos1);
|
||||
Block block1 = state1.getBlock();
|
||||
|
||||
if (block1.isReplaceable(world, xi + xOffset, yi, zi + zOffset) || !this.isBlockReplaceable(block1) || !this.forceReplaceBlock(block1))
|
||||
if (block1.isReplaceable(world, pos1) || !this.isBlockReplaceable(block1) || !this.forceReplaceBlock(block1))
|
||||
{
|
||||
returnAmount = false;
|
||||
|
||||
if(doConstruct)
|
||||
{
|
||||
world.setBlock(xi + xOffset, yi, zi + zOffset, portal.getRoadBlock(), portal.getRoadMeta(), 3);
|
||||
world.setBlockState(pos1, portal.getRoadState(), 3);
|
||||
}
|
||||
}else
|
||||
{
|
||||
|
@ -146,18 +160,20 @@ public class DemonVillagePath
|
|||
|
||||
}else if(tunnelIfObstructed)
|
||||
{
|
||||
Block block1 = world.getBlock(xi + xOffset, yi, zi + zOffset);
|
||||
BlockPos pos1 = new BlockPos(xi + xOffset, yi, zi + zOffset);
|
||||
IBlockState state1 = world.getBlockState(pos1);
|
||||
Block block1 = state1.getBlock();
|
||||
|
||||
if (!block1.isReplaceable(world, xi + xOffset, yi, zi + zOffset) || this.isBlockReplaceable(block1) || !this.forceReplaceBlock(block1))
|
||||
if (!block1.isReplaceable(world, pos1) || this.isBlockReplaceable(block1) || !this.forceReplaceBlock(block1))
|
||||
{
|
||||
returnAmount = false;
|
||||
|
||||
if(doConstruct)
|
||||
{
|
||||
world.setBlock(xi + xOffset, yi, zi + zOffset, portal.getRoadBlock(), portal.getRoadMeta(), 3);
|
||||
world.setBlockToAir(xi + xOffset, yi + 1, zi + zOffset);
|
||||
world.setBlockToAir(xi + xOffset, yi + 2, zi + zOffset);
|
||||
world.setBlockToAir(xi + xOffset, yi + 3, zi + zOffset);
|
||||
world.setBlockState(pos1, portal.getRoadState(), 3);
|
||||
world.setBlockToAir(pos1.offsetUp(1));
|
||||
world.setBlockToAir(pos1.offsetUp(2));
|
||||
world.setBlockToAir(pos1.offsetUp(3));
|
||||
}
|
||||
}else
|
||||
{
|
||||
|
@ -183,27 +199,37 @@ public class DemonVillagePath
|
|||
|
||||
for (int i = 0; i < length; i++)
|
||||
{
|
||||
int xOffset = i * dir.offsetX;
|
||||
int zOffset = i * dir.offsetZ;
|
||||
int xOffset = i * dir.getFrontOffsetX();
|
||||
int zOffset = i * dir.getFrontOffsetZ();
|
||||
|
||||
for (int yOffset = 0; yOffset <= clearance; yOffset++)
|
||||
{
|
||||
int sign = 1;
|
||||
|
||||
Block block1 = world.getBlock(xi + xOffset, yi + sign * yOffset, zi + zOffset);
|
||||
Block highBlock1 = world.getBlock(xi + xOffset, yi + sign * yOffset + 1, zi + zOffset);
|
||||
BlockPos pos1 = new BlockPos(xi + xOffset, yi + sign * yOffset, zi + zOffset);
|
||||
BlockPos highPos1 = pos1.offsetUp();
|
||||
|
||||
IBlockState state1 = world.getBlockState(pos1);
|
||||
IBlockState highState1 = world.getBlockState(highPos1);
|
||||
Block block1 = state1.getBlock();
|
||||
Block highBlock1 = highState1.getBlock();
|
||||
|
||||
if ((this.forceReplaceBlock(block1))||(!block1.isReplaceable(world, xi + xOffset, yi + sign * yOffset, zi + zOffset) && this.isBlockReplaceable(block1) ) && (this.forceCanTunnelUnder(highBlock1) || highBlock1.isReplaceable(world, xi + xOffset, yi + sign * yOffset + 1, zi + zOffset)))
|
||||
if ((this.forceReplaceBlock(block1))||(!block1.isReplaceable(world, pos1) && this.isBlockReplaceable(block1) ) && (this.forceCanTunnelUnder(highBlock1) || highBlock1.isReplaceable(world, highPos1)))
|
||||
{
|
||||
yi += sign * yOffset;
|
||||
break;
|
||||
} else
|
||||
{
|
||||
sign = -1;
|
||||
Block block2 = world.getBlock(xi + xOffset, yi + sign * yOffset, zi + zOffset);
|
||||
Block highBlock2 = world.getBlock(xi + xOffset, yi + sign * yOffset + 1, zi + zOffset);
|
||||
BlockPos pos2 = new BlockPos(xi + xOffset, yi + sign * yOffset, zi + zOffset);
|
||||
BlockPos highPos2 = pos2.offsetUp();
|
||||
|
||||
IBlockState state2 = world.getBlockState(pos2);
|
||||
IBlockState highState2 = world.getBlockState(highPos2);
|
||||
Block block2 = state2.getBlock();
|
||||
Block highBlock2 = highState2.getBlock();
|
||||
|
||||
if ((this.forceReplaceBlock(block2))||(!block2.isReplaceable(world, xi + xOffset, yi + sign * yOffset, zi + zOffset) && this.isBlockReplaceable(block2) ) && (this.forceCanTunnelUnder(highBlock2) || highBlock2.isReplaceable(world, xi + xOffset, yi + sign * yOffset + 1, zi + zOffset)))
|
||||
if ((this.forceReplaceBlock(block2))||(!block2.isReplaceable(world, pos2) && this.isBlockReplaceable(block2) ) && (this.forceCanTunnelUnder(highBlock2) || highBlock2.isReplaceable(world, highPos2)))
|
||||
{
|
||||
yi += sign * yOffset;
|
||||
break;
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
package WayofTime.alchemicalWizardry.common.demonVillage;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.ModBlocks;
|
||||
import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class GridSpaceHolder
|
||||
{
|
||||
|
@ -139,7 +141,7 @@ public class GridSpaceHolder
|
|||
}
|
||||
}
|
||||
|
||||
public boolean doesContainAll(GridSpaceHolder master, int xInit, int zInit, ForgeDirection dir)
|
||||
public boolean doesContainAll(GridSpaceHolder master, int xInit, int zInit, EnumFacing dir)
|
||||
{
|
||||
if (master != null)
|
||||
{
|
||||
|
@ -191,7 +193,7 @@ public class GridSpaceHolder
|
|||
return false;
|
||||
}
|
||||
|
||||
public void setAllGridSpaces(int xInit, int zInit, int yLevel, ForgeDirection dir, int type, GridSpaceHolder master)
|
||||
public void setAllGridSpaces(int xInit, int zInit, int yLevel, EnumFacing dir, int type, GridSpaceHolder master)
|
||||
{
|
||||
if(TEDemonPortal.printDebug)
|
||||
AlchemicalWizardry.logger.info("Grid space selected: (" + xInit + "," + zInit + ")");
|
||||
|
@ -239,7 +241,7 @@ public class GridSpaceHolder
|
|||
}
|
||||
}
|
||||
|
||||
public void destroyAllInGridSpaces(World world, int xCoord, int yCoord, int zCoord, ForgeDirection dir)
|
||||
public void destroyAllInGridSpaces(World world, int xCoord, int yCoord, int zCoord, EnumFacing dir)
|
||||
{
|
||||
for (int i = -negXRadius; i <= posXRadius; i++)
|
||||
{
|
||||
|
@ -278,12 +280,14 @@ public class GridSpaceHolder
|
|||
{
|
||||
for (int m = -2; m <= 2; m++)
|
||||
{
|
||||
Block block = world.getBlock(xCoord + xOff * 5 + l, yCoord, zCoord + zOff * 5 + m);
|
||||
BlockPos newPos = new BlockPos(xCoord + xOff * 5 + l, yCoord, zCoord + zOff * 5 + m);
|
||||
IBlockState state = world.getBlockState(newPos);
|
||||
Block block = state.getBlock();
|
||||
if (block == ModBlocks.blockDemonPortal)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
world.setBlockToAir(xCoord + xOff * 5 + l, yCoord, zCoord + zOff * 5 + m);
|
||||
world.setBlockToAir(newPos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,6 @@ public class EntityAIOccasionalRangedAttack extends EntityAIBase
|
|||
private int maxRangedAttackTime;
|
||||
private float field_96562_i;
|
||||
private float field_82642_h;
|
||||
private static final String __OBFID = "CL_00001609";
|
||||
private double range;
|
||||
|
||||
public EntityAIOccasionalRangedAttack(IOccasionalRangedAttackMob p_i1649_1_, double p_i1649_2_, int p_i1649_4_, float p_i1649_5_, double range)
|
||||
|
@ -110,7 +109,7 @@ public class EntityAIOccasionalRangedAttack extends EntityAIBase
|
|||
*/
|
||||
public void updateTask()
|
||||
{
|
||||
double d0 = this.entityHost.getDistanceSq(this.attackTarget.posX, this.attackTarget.boundingBox.minY, this.attackTarget.posZ);
|
||||
double d0 = this.entityHost.getDistanceSq(this.attackTarget.posX, this.attackTarget.getBoundingBox().minY, this.attackTarget.posZ);
|
||||
boolean flag = this.entityHost.getEntitySenses().canSee(this.attackTarget);
|
||||
|
||||
if (flag)
|
||||
|
|
|
@ -3,7 +3,7 @@ package WayofTime.alchemicalWizardry.common.demonVillage.ai;
|
|||
import net.minecraft.entity.EntityCreature;
|
||||
import net.minecraft.entity.ai.EntityAIHurtByTarget;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import WayofTime.alchemicalWizardry.api.Int3;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.IHoardDemon;
|
||||
import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal;
|
||||
|
||||
|
@ -20,14 +20,14 @@ public class EntityDemonAIHurtByTarget extends EntityAIHurtByTarget
|
|||
@Override
|
||||
public void startExecuting()
|
||||
{
|
||||
Int3 portalPosition = ((IHoardDemon)this.taskOwner).getPortalLocation();
|
||||
BlockPos portalPosition = ((IHoardDemon)this.taskOwner).getPortalLocation();
|
||||
if(portalPosition == null)
|
||||
{
|
||||
super.startExecuting();
|
||||
return;
|
||||
}
|
||||
|
||||
TileEntity portal = this.taskOwner.worldObj.getTileEntity(portalPosition.xCoord, portalPosition.yCoord, portalPosition.zCoord);
|
||||
TileEntity portal = this.taskOwner.worldObj.getTileEntity(portalPosition);
|
||||
|
||||
if((this.taskOwner.getAITarget() instanceof IHoardDemon && portalPosition.equals(((IHoardDemon)this.taskOwner.getAITarget()).getPortalLocation())))
|
||||
{
|
||||
|
@ -45,7 +45,7 @@ public class EntityDemonAIHurtByTarget extends EntityAIHurtByTarget
|
|||
}
|
||||
|
||||
// double d0 = this.getTargetDistance();
|
||||
// List list = this.taskOwner.worldObj.getEntitiesWithinAABB(this.taskOwner.getClass(), AxisAlignedBB.getBoundingBox(this.taskOwner.posX, this.taskOwner.posY, this.taskOwner.posZ, this.taskOwner.posX + 1.0D, this.taskOwner.posY + 1.0D, this.taskOwner.posZ + 1.0D).expand(d0, 10.0D, d0));
|
||||
// List list = this.taskOwner.worldObj.getEntitiesWithinAABB(this.taskOwner.getClass(), new AxisAlignedBB(this.taskOwner.posX, this.taskOwner.posY, this.taskOwner.posZ, this.taskOwner.posX + 1.0D, this.taskOwner.posY + 1.0D, this.taskOwner.posZ + 1.0D).expand(d0, 10.0D, d0));
|
||||
// Iterator iterator = list.iterator();
|
||||
//
|
||||
// while (iterator.hasNext())
|
||||
|
|
|
@ -20,11 +20,11 @@ import net.minecraft.item.ItemFood;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.ModItems;
|
||||
import WayofTime.alchemicalWizardry.api.Int3;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.LocalRitualStorage;
|
||||
import WayofTime.alchemicalWizardry.common.EntityAITargetAggroCloaking;
|
||||
|
@ -34,7 +34,6 @@ import WayofTime.alchemicalWizardry.common.demonVillage.ai.IOccasionalRangedAtta
|
|||
import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal;
|
||||
import WayofTime.alchemicalWizardry.common.entity.mob.EntityDemon;
|
||||
import WayofTime.alchemicalWizardry.common.entity.projectile.HolyProjectile;
|
||||
import WayofTime.alchemicalWizardry.common.rituals.LocalStorageAlphaPact;
|
||||
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
|
||||
|
||||
public class EntityMinorDemonGrunt extends EntityDemon implements IOccasionalRangedAttackMob, IHoardDemon
|
||||
|
@ -43,7 +42,7 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IOccasionalRan
|
|||
private EntityAIAttackOnCollide aiAttackOnCollide = new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.2D, false);
|
||||
|
||||
private boolean isAngry = true;
|
||||
private Int3 demonPortal;
|
||||
private BlockPos demonPortal;
|
||||
|
||||
private static float maxTamedHealth = 200.0F;
|
||||
private static float maxUntamedHealth = 200.0F;
|
||||
|
@ -54,7 +53,7 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IOccasionalRan
|
|||
{
|
||||
super(par1World, AlchemicalWizardry.entityMinorDemonGruntID);
|
||||
this.setSize(0.7F, 1.8F);
|
||||
this.getNavigator().setAvoidsWater(true);
|
||||
// this.getNavigator().setAvoidsWater(true);
|
||||
this.tasks.addTask(1, new EntityAISwimming(this));
|
||||
this.tasks.addTask(2, this.aiSit);
|
||||
this.tasks.addTask(3, new EntityAIFollowOwner(this, 1.0D, 10.0F, 2.0F));
|
||||
|
@ -68,7 +67,7 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IOccasionalRan
|
|||
this.setAggro(false);
|
||||
this.setTamed(false);
|
||||
|
||||
demonPortal = new Int3(0,0,0);
|
||||
demonPortal = new BlockPos(0,0,0);
|
||||
|
||||
if (par1World != null && !par1World.isRemote)
|
||||
{
|
||||
|
@ -128,13 +127,13 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IOccasionalRan
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setPortalLocation(Int3 position)
|
||||
public void setPortalLocation(BlockPos position)
|
||||
{
|
||||
this.demonPortal = position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Int3 getPortalLocation()
|
||||
public BlockPos getPortalLocation()
|
||||
{
|
||||
return this.demonPortal;
|
||||
}
|
||||
|
@ -176,23 +175,25 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IOccasionalRan
|
|||
* (abstract) Protected helper method to write subclass entity data to NBT.
|
||||
*/
|
||||
@Override
|
||||
public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound)
|
||||
public void writeEntityToNBT(NBTTagCompound tag)
|
||||
{
|
||||
super.writeEntityToNBT(par1NBTTagCompound);
|
||||
par1NBTTagCompound.setBoolean("Angry", this.isAngry());
|
||||
super.writeEntityToNBT(tag);
|
||||
tag.setBoolean("Angry", this.isAngry());
|
||||
|
||||
this.demonPortal.writeToNBT(par1NBTTagCompound);
|
||||
tag.setInteger("xCoord", this.demonPortal.getX());
|
||||
tag.setInteger("yCoord", this.demonPortal.getY());
|
||||
tag.setInteger("zCoord", this.demonPortal.getZ());
|
||||
}
|
||||
|
||||
/**
|
||||
* (abstract) Protected helper method to read subclass entity data from NBT.
|
||||
*/
|
||||
@Override
|
||||
public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound)
|
||||
public void readEntityFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
super.readEntityFromNBT(par1NBTTagCompound);
|
||||
this.setAngry(par1NBTTagCompound.getBoolean("Angry"));
|
||||
this.demonPortal = Int3.readFromNBT(par1NBTTagCompound);
|
||||
super.readEntityFromNBT(tag);
|
||||
this.setAngry(tag.getBoolean("Angry"));
|
||||
this.demonPortal = new BlockPos(tag.getInteger("xCoord"), tag.getInteger("yCoord"), tag.getInteger("zCoord"));
|
||||
|
||||
this.setCombatTask();
|
||||
}
|
||||
|
@ -252,7 +253,7 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IOccasionalRan
|
|||
{
|
||||
if(!this.enthralled)
|
||||
{
|
||||
TileEntity tile = this.worldObj.getTileEntity(this.demonPortal.xCoord, this.demonPortal.yCoord, this.demonPortal.zCoord);
|
||||
TileEntity tile = this.worldObj.getTileEntity(this.demonPortal);
|
||||
if(tile instanceof TEDemonPortal)
|
||||
{
|
||||
((TEDemonPortal) tile).enthrallDemon(this);
|
||||
|
@ -261,12 +262,12 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IOccasionalRan
|
|||
{
|
||||
IMasterRitualStone stone = (IMasterRitualStone)tile;
|
||||
LocalRitualStorage stor = stone.getLocalStorage();
|
||||
if(stor instanceof LocalStorageAlphaPact)
|
||||
{
|
||||
LocalStorageAlphaPact storage = (LocalStorageAlphaPact)stor;
|
||||
|
||||
storage.thrallDemon(this);
|
||||
}
|
||||
// if(stor instanceof LocalStorageAlphaPact)
|
||||
// {
|
||||
// LocalStorageAlphaPact storage = (LocalStorageAlphaPact)stor;
|
||||
//
|
||||
// storage.thrallDemon(this);
|
||||
// }
|
||||
}
|
||||
}
|
||||
super.onUpdate();
|
||||
|
@ -325,7 +326,7 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IOccasionalRan
|
|||
--itemstack.stackSize;
|
||||
}
|
||||
|
||||
this.heal((float) itemfood.func_150905_g(itemstack));
|
||||
this.heal((float) itemfood.getHealAmount(itemstack));
|
||||
|
||||
if (itemstack.stackSize <= 0)
|
||||
{
|
||||
|
@ -343,8 +344,8 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IOccasionalRan
|
|||
{
|
||||
this.aiSit.setSitting(!this.isSitting());
|
||||
this.isJumping = false;
|
||||
this.setPathToEntity(null);
|
||||
this.setTarget(null);
|
||||
// this.setPathToEntity(null);
|
||||
// this.setTarget(null);
|
||||
this.setAttackTarget(null);
|
||||
}
|
||||
|
||||
|
@ -367,7 +368,7 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IOccasionalRan
|
|||
if (this.rand.nextInt(1) == 0)
|
||||
{
|
||||
this.setTamed(true);
|
||||
this.setPathToEntity(null);
|
||||
// this.setPathToEntity(null);
|
||||
this.setAttackTarget(null);
|
||||
this.aiSit.setSitting(true);
|
||||
this.setHealth(maxTamedHealth);
|
||||
|
@ -500,7 +501,7 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IOccasionalRan
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean thrallDemon(Int3 location)
|
||||
public boolean thrallDemon(BlockPos location)
|
||||
{
|
||||
this.setPortalLocation(location);
|
||||
return true;
|
||||
|
@ -509,9 +510,9 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IOccasionalRan
|
|||
@Override
|
||||
public boolean isSamePortal(IHoardDemon demon)
|
||||
{
|
||||
Int3 position = demon.getPortalLocation();
|
||||
TileEntity portal = worldObj.getTileEntity(this.demonPortal.xCoord, this.demonPortal.yCoord, this.demonPortal.zCoord);
|
||||
BlockPos position = demon.getPortalLocation();
|
||||
TileEntity portal = worldObj.getTileEntity(this.demonPortal);
|
||||
|
||||
return portal instanceof TEDemonPortal ? portal == worldObj.getTileEntity(position.xCoord, position.yCoord, position.zCoord) : false;
|
||||
return portal instanceof TEDemonPortal ? portal == worldObj.getTileEntity(position) : false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
package WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.Int3;
|
||||
import net.minecraft.util.BlockPos;
|
||||
|
||||
public interface IHoardDemon
|
||||
{
|
||||
void setPortalLocation(Int3 position);
|
||||
Int3 getPortalLocation();
|
||||
boolean thrallDemon(Int3 location);
|
||||
void setPortalLocation(BlockPos position);
|
||||
BlockPos getPortalLocation();
|
||||
boolean thrallDemon(BlockPos location);
|
||||
boolean isSamePortal(IHoardDemon demon);
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ public class DemonVillageLootRegistry
|
|||
String[] tier1Strings = new String[]{ChestGenHooks.DUNGEON_CHEST, ChestGenHooks.PYRAMID_DESERT_CHEST};
|
||||
for(String str : tier1Strings)
|
||||
{
|
||||
WeightedRandomChestContent[] contents = ChestGenHooks.getItems(str, new Random());
|
||||
List<WeightedRandomChestContent> contents = ChestGenHooks.getItems(str, new Random());
|
||||
if(contents != null)
|
||||
{
|
||||
for(WeightedRandomChestContent content : contents)
|
||||
|
@ -34,16 +34,6 @@ public class DemonVillageLootRegistry
|
|||
|
||||
public static void populateChest(IInventory tile, int tier)
|
||||
{
|
||||
WeightedRandomChestContent.generateChestContents(new Random(), toArray(list1), tile, tile.getSizeInventory() / 3);
|
||||
}
|
||||
|
||||
public static WeightedRandomChestContent[] toArray(List<WeightedRandomChestContent> aList)
|
||||
{
|
||||
int size = aList.size();
|
||||
WeightedRandomChestContent[] contents = new WeightedRandomChestContent[size];
|
||||
|
||||
contents = aList.toArray(contents);
|
||||
|
||||
return contents;
|
||||
WeightedRandomChestContent.generateChestContents(new Random(), list1, tile, tile.getSizeInventory() / 3);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package WayofTime.alchemicalWizardry.common.demonVillage.tileEntity;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockChest;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
|
||||
|
@ -12,15 +12,10 @@ public class BlockDemonChest extends BlockChest implements IBlockPortalNode
|
|||
public BlockDemonChest()
|
||||
{
|
||||
super(0);
|
||||
this.setHardness(2.5F).setStepSound(soundTypeWood).setBlockName("demonChest");
|
||||
this.setHardness(2.5F).setStepSound(soundTypeWood).setUnlocalizedName("demonChest");
|
||||
this.setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
}
|
||||
|
||||
public IInventory func_149951_m(World world, int x, int y, int z)
|
||||
{
|
||||
return (IInventory)world.getTileEntity(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World var1, int var2)
|
||||
{
|
||||
|
@ -28,18 +23,18 @@ public class BlockDemonChest extends BlockChest implements IBlockPortalNode
|
|||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int meta)
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState state)
|
||||
{
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if(tile instanceof TEDemonChest)
|
||||
{
|
||||
((TEDemonChest) tile).notifyPortalOfInteraction();
|
||||
}
|
||||
super.breakBlock(world, x, y, z, block, meta);
|
||||
super.breakBlock(world, pos, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlaceBlockAt(World p_149742_1_, int p_149742_2_, int p_149742_3_, int p_149742_4_)
|
||||
public boolean canPlaceBlockAt(World world, BlockPos pos)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1,16 +1,17 @@
|
|||
package WayofTime.alchemicalWizardry.common.demonVillage.tileEntity;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntityChest;
|
||||
import WayofTime.alchemicalWizardry.api.Int3;
|
||||
import net.minecraft.util.BlockPos;
|
||||
|
||||
public class TEDemonChest extends TileEntityChest implements ITilePortalNode
|
||||
{
|
||||
public Int3 portalLocation = new Int3(0,0,0);
|
||||
public BlockPos portalLocation = BlockPos.ORIGIN;
|
||||
|
||||
@Override
|
||||
public String getInventoryName()
|
||||
public String getName()
|
||||
{
|
||||
return "Demon's Chest";
|
||||
}
|
||||
|
@ -20,21 +21,24 @@ public class TEDemonChest extends TileEntityChest implements ITilePortalNode
|
|||
{
|
||||
super.readFromNBT(tag);
|
||||
NBTTagCompound portalTag = tag.getCompoundTag("portalLocation");
|
||||
portalLocation = Int3.readFromNBT(portalTag);
|
||||
portalLocation = new BlockPos(portalTag.getInteger("xCoord"), portalTag.getInteger("yCoord"), portalTag.getInteger("zCoord"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
super.writeToNBT(tag);
|
||||
NBTTagCompound portalTag = portalLocation.writeToNBT(new NBTTagCompound());
|
||||
NBTTagCompound portalTag = new NBTTagCompound();
|
||||
portalTag.setInteger("xCoord", portalLocation.getX());
|
||||
portalTag.setInteger("yCoord", portalLocation.getY());
|
||||
portalTag.setInteger("zCoord", portalLocation.getZ());
|
||||
tag.setTag("portalLocation", portalTag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory()
|
||||
public void openInventory(EntityPlayer player)
|
||||
{
|
||||
super.openInventory();
|
||||
super.openInventory(player);
|
||||
this.notifyPortalOfInteraction();
|
||||
}
|
||||
|
||||
|
@ -49,13 +53,13 @@ public class TEDemonChest extends TileEntityChest implements ITilePortalNode
|
|||
{
|
||||
if(teDemonPortal != null)
|
||||
{
|
||||
portalLocation = new Int3(teDemonPortal.xCoord, teDemonPortal.yCoord, teDemonPortal.zCoord);
|
||||
portalLocation = teDemonPortal.getPos();
|
||||
}
|
||||
}
|
||||
|
||||
public TEDemonPortal getDemonPortal()
|
||||
{
|
||||
TileEntity tile = worldObj.getTileEntity(portalLocation.xCoord, portalLocation.yCoord, portalLocation.zCoord);
|
||||
TileEntity tile = worldObj.getTileEntity(portalLocation);
|
||||
if(tile instanceof TEDemonPortal)
|
||||
{
|
||||
return (TEDemonPortal)tile;
|
||||
|
@ -71,6 +75,6 @@ public class TEDemonChest extends TileEntityChest implements ITilePortalNode
|
|||
return;
|
||||
}
|
||||
|
||||
portal.notifyDemons(xCoord, yCoord, zCoord, 50);
|
||||
portal.notifyDemons(pos.getX(), pos.getY(), pos.getZ(), 50);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ import java.util.Random;
|
|||
import java.util.Set;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityCreature;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
|
@ -22,9 +23,11 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.server.gui.IUpdatePlayerListBox;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.common.util.Constants;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.api.Int3;
|
||||
import WayofTime.alchemicalWizardry.common.block.BlockTeleposer;
|
||||
|
@ -42,7 +45,7 @@ import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.IHoardD
|
|||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
|
||||
public class TEDemonPortal extends TileEntity
|
||||
public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
|
||||
{
|
||||
public DemonType type = DemonType.FIRE;
|
||||
|
||||
|
@ -85,7 +88,7 @@ public class TEDemonPortal extends TileEntity
|
|||
public float pointPool;
|
||||
|
||||
public String nextDemonPortalName = "";
|
||||
public ForgeDirection nextDemonPortalDirection = ForgeDirection.DOWN;
|
||||
public EnumFacing nextDemonPortalDirection = EnumFacing.DOWN;
|
||||
|
||||
public int buildingStage = -1;
|
||||
|
||||
|
@ -116,7 +119,7 @@ public class TEDemonPortal extends TileEntity
|
|||
|
||||
isInitialized = false;
|
||||
|
||||
this.setGridSpace(0, 0, new GridSpace(GridSpace.MAIN_PORTAL, yCoord));
|
||||
this.setGridSpace(0, 0, new GridSpace(GridSpace.MAIN_PORTAL, pos.getY()));
|
||||
|
||||
this.houseCooldown = 0;
|
||||
this.roadCooldown = 0;
|
||||
|
@ -282,7 +285,7 @@ public class TEDemonPortal extends TileEntity
|
|||
{
|
||||
if(demon instanceof IHoardDemon)
|
||||
{
|
||||
boolean enthrall = ((IHoardDemon) demon).thrallDemon(new Int3(this.xCoord, this.yCoord, this.zCoord));
|
||||
boolean enthrall = ((IHoardDemon) demon).thrallDemon(pos);
|
||||
if(enthrall)
|
||||
{
|
||||
this.hoardList.add((IHoardDemon)demon);
|
||||
|
@ -306,10 +309,10 @@ public class TEDemonPortal extends TileEntity
|
|||
{
|
||||
if (Math.abs(xIndex) == 1 || Math.abs(zIndex) == 1)
|
||||
{
|
||||
this.setGridSpace(xIndex, zIndex, new GridSpace(GridSpace.ROAD, yCoord));
|
||||
this.setGridSpace(xIndex, zIndex, new GridSpace(GridSpace.ROAD, pos.getY()));
|
||||
} else if (xIndex == 0 && zIndex == 0)
|
||||
{
|
||||
this.setGridSpace(0, 0, new GridSpace(GridSpace.MAIN_PORTAL, yCoord));
|
||||
this.setGridSpace(0, 0, new GridSpace(GridSpace.MAIN_PORTAL, pos.getY()));
|
||||
} else
|
||||
{
|
||||
this.setGridSpace(xIndex, zIndex, new GridSpace());
|
||||
|
@ -334,7 +337,7 @@ public class TEDemonPortal extends TileEntity
|
|||
|
||||
public void createParty()
|
||||
{
|
||||
worldObj.createExplosion(null, xCoord + rand.nextInt(10) - rand.nextInt(10), yCoord, zCoord + rand.nextInt(10) - rand.nextInt(10), 5*rand.nextFloat(), false);
|
||||
worldObj.createExplosion(null, pos.getX() + rand.nextInt(10) - rand.nextInt(10), pos.getY(), pos.getZ() + rand.nextInt(10) - rand.nextInt(10), 5*rand.nextFloat(), false);
|
||||
}
|
||||
|
||||
public void start()
|
||||
|
@ -346,7 +349,7 @@ public class TEDemonPortal extends TileEntity
|
|||
* Randomly increase one of the cooldowns such that a road, house, or a demon portal tier is caused. Demons are also randomly spawned via this mechanic.
|
||||
*/
|
||||
@Override
|
||||
public void updateEntity()
|
||||
public void update()
|
||||
{
|
||||
if(worldObj.isRemote)
|
||||
{
|
||||
|
@ -364,7 +367,7 @@ public class TEDemonPortal extends TileEntity
|
|||
|
||||
if(delayBeforeParty <= 0)
|
||||
{
|
||||
worldObj.createExplosion(null, xCoord, yCoord, zCoord, 15, false);
|
||||
worldObj.createExplosion(null, pos.getX(), pos.getY(), pos.getZ(), 15, false);
|
||||
this.initialize();
|
||||
}
|
||||
|
||||
|
@ -493,7 +496,7 @@ public class TEDemonPortal extends TileEntity
|
|||
|
||||
this.nextDemonPortalName = par1NBTTagCompound.getString("nextDemonPortalName");
|
||||
this.buildingStage = par1NBTTagCompound.getInteger("buildingStage");
|
||||
this.nextDemonPortalDirection = ForgeDirection.getOrientation(par1NBTTagCompound.getInteger("nextDemonPortalDirection"));
|
||||
this.nextDemonPortalDirection = EnumFacing.getFront(par1NBTTagCompound.getInteger("nextDemonPortalDirection"));
|
||||
|
||||
this.pointPool = par1NBTTagCompound.getFloat("pointPool");
|
||||
this.lockdownTimer = par1NBTTagCompound.getInteger("lockdownTimer");
|
||||
|
@ -553,24 +556,24 @@ public class TEDemonPortal extends TileEntity
|
|||
public int createRandomDemonHoard(TEDemonPortal teDemonPortal, int tier, DemonType type, boolean spawnGuardian)
|
||||
{
|
||||
int next = rand.nextInt(4);
|
||||
ForgeDirection dir;
|
||||
EnumFacing dir;
|
||||
|
||||
switch (next)
|
||||
{
|
||||
case 0:
|
||||
dir = ForgeDirection.NORTH;
|
||||
dir = EnumFacing.NORTH;
|
||||
break;
|
||||
case 1:
|
||||
dir = ForgeDirection.SOUTH;
|
||||
dir = EnumFacing.SOUTH;
|
||||
break;
|
||||
case 2:
|
||||
dir = ForgeDirection.EAST;
|
||||
dir = EnumFacing.EAST;
|
||||
break;
|
||||
case 3:
|
||||
dir = ForgeDirection.WEST;
|
||||
dir = EnumFacing.WEST;
|
||||
break;
|
||||
default:
|
||||
dir = ForgeDirection.NORTH;
|
||||
dir = EnumFacing.NORTH;
|
||||
}
|
||||
|
||||
Int3 road = findRoadSpaceFromDirection(dir, (rand.nextInt(negXRadius + negZRadius + posXRadius + posZRadius)) + 1);
|
||||
|
@ -582,30 +585,30 @@ public class TEDemonPortal extends TileEntity
|
|||
if(TEDemonPortal.printDebug)
|
||||
System.out.println("Spawning Demons");
|
||||
|
||||
return DemonPacketRegistry.spawnDemons(teDemonPortal, worldObj, xCoord + road.xCoord * 5, road.yCoord + 1, zCoord + road.zCoord * 5, type, tier, spawnGuardian);
|
||||
return DemonPacketRegistry.spawnDemons(teDemonPortal, worldObj, pos.getX() + road.xCoord * 5, road.yCoord + 1, pos.getZ() + road.zCoord * 5, type, tier, spawnGuardian);
|
||||
}
|
||||
|
||||
public int createRandomRoad() //Return the number of road spaces
|
||||
{
|
||||
int next = rand.nextInt(4);
|
||||
ForgeDirection dir;
|
||||
EnumFacing dir;
|
||||
|
||||
switch (next)
|
||||
{
|
||||
case 0:
|
||||
dir = ForgeDirection.NORTH;
|
||||
dir = EnumFacing.NORTH;
|
||||
break;
|
||||
case 1:
|
||||
dir = ForgeDirection.SOUTH;
|
||||
dir = EnumFacing.SOUTH;
|
||||
break;
|
||||
case 2:
|
||||
dir = ForgeDirection.EAST;
|
||||
dir = EnumFacing.EAST;
|
||||
break;
|
||||
case 3:
|
||||
dir = ForgeDirection.WEST;
|
||||
dir = EnumFacing.WEST;
|
||||
break;
|
||||
default:
|
||||
dir = ForgeDirection.NORTH;
|
||||
dir = EnumFacing.NORTH;
|
||||
}
|
||||
|
||||
Int3 road = findRoadSpaceFromDirection(dir, (rand.nextInt(negXRadius + negZRadius + posXRadius + posZRadius)) + 1);
|
||||
|
@ -617,7 +620,7 @@ public class TEDemonPortal extends TileEntity
|
|||
if(printDebug)
|
||||
AlchemicalWizardry.logger.info("X: " + x + " Z: " + z + " Direction: " + dir.toString());
|
||||
|
||||
List<ForgeDirection> directions = this.findValidExtentionDirection(x, z);
|
||||
List<EnumFacing> directions = this.findValidExtentionDirection(x, z);
|
||||
|
||||
if (directions.size() <= 0)
|
||||
{
|
||||
|
@ -627,9 +630,9 @@ public class TEDemonPortal extends TileEntity
|
|||
int maxDistance = 5;
|
||||
|
||||
int distance = 0;
|
||||
ForgeDirection dominantDirection = null;
|
||||
EnumFacing dominantDirection = null;
|
||||
|
||||
for (ForgeDirection direction : directions)
|
||||
for (EnumFacing direction : directions)
|
||||
{
|
||||
int amt = this.getLength(direction, maxDistance, x, z);
|
||||
if (amt > distance)
|
||||
|
@ -656,9 +659,9 @@ public class TEDemonPortal extends TileEntity
|
|||
return distance;
|
||||
}
|
||||
|
||||
public List<ForgeDirection> findValidExtentionDirection(int x, int z)
|
||||
public List<EnumFacing> findValidExtentionDirection(int x, int z)
|
||||
{
|
||||
List<ForgeDirection> directions = new LinkedList();
|
||||
List<EnumFacing> directions = new LinkedList();
|
||||
|
||||
if (this.getGridSpace(x, z) == null || !this.getGridSpace(x, z).isRoadSegment())
|
||||
{
|
||||
|
@ -668,41 +671,41 @@ public class TEDemonPortal extends TileEntity
|
|||
GridSpace nextGrid = this.getGridSpace(x + 1, z);
|
||||
if (nextGrid.isEmpty())
|
||||
{
|
||||
directions.add(ForgeDirection.EAST);
|
||||
directions.add(EnumFacing.EAST);
|
||||
}
|
||||
|
||||
nextGrid = this.getGridSpace(x - 1, z);
|
||||
if (nextGrid.isEmpty())
|
||||
{
|
||||
directions.add(ForgeDirection.WEST);
|
||||
directions.add(EnumFacing.WEST);
|
||||
}
|
||||
|
||||
nextGrid = this.getGridSpace(x, z + 1);
|
||||
if (nextGrid.isEmpty())
|
||||
{
|
||||
directions.add(ForgeDirection.SOUTH);
|
||||
directions.add(EnumFacing.SOUTH);
|
||||
}
|
||||
|
||||
nextGrid = this.getGridSpace(x, z - 1);
|
||||
if (nextGrid.isEmpty())
|
||||
{
|
||||
directions.add(ForgeDirection.NORTH);
|
||||
directions.add(EnumFacing.NORTH);
|
||||
}
|
||||
|
||||
return directions;
|
||||
}
|
||||
|
||||
public int getLength(ForgeDirection dir, int maxLength, int x, int z) //Number of spaces forward
|
||||
public int getLength(EnumFacing dir, int maxLength, int x, int z) //Number of spaces forward
|
||||
{
|
||||
for (int i = 1; i <= maxLength; i++)
|
||||
{
|
||||
GridSpace space = this.getGridSpace(x + i * dir.offsetX, z + i * dir.offsetZ);
|
||||
GridSpace space = this.getGridSpace(x + i * dir.getFrontOffsetX(), z + i * dir.getFrontOffsetZ());
|
||||
if (space.isEmpty())
|
||||
{
|
||||
for (int k = 1; k <= this.getRoadSpacer(); k++)
|
||||
{
|
||||
GridSpace space1 = this.getGridSpace(x + i * dir.offsetX + dir.offsetZ * k, z + i * dir.offsetZ + dir.offsetX * k);
|
||||
GridSpace space2 = this.getGridSpace(x + i * dir.offsetX - dir.offsetZ * k, z + i * dir.offsetZ - dir.offsetX * k);
|
||||
GridSpace space1 = this.getGridSpace(x + i * dir.getFrontOffsetX() + dir.getFrontOffsetZ() * k, z + i * dir.getFrontOffsetZ() + dir.getFrontOffsetX() * k);
|
||||
GridSpace space2 = this.getGridSpace(x + i * dir.getFrontOffsetX() - dir.getFrontOffsetZ() * k, z + i * dir.getFrontOffsetZ() - dir.getFrontOffsetX() * k);
|
||||
|
||||
if (space1.isRoadSegment() || space2.isRoadSegment())
|
||||
{
|
||||
|
@ -723,10 +726,10 @@ public class TEDemonPortal extends TileEntity
|
|||
return maxLength;
|
||||
}
|
||||
|
||||
public Int3 findRoadSpaceFromDirection(ForgeDirection dir, int amount) //TODO
|
||||
public Int3 findRoadSpaceFromDirection(EnumFacing dir, int amount) //TODO
|
||||
{
|
||||
int index = 0;
|
||||
if (dir == ForgeDirection.NORTH)
|
||||
if (dir == EnumFacing.NORTH)
|
||||
{
|
||||
if(printDebug)
|
||||
System.out.print("NORTH!");
|
||||
|
@ -745,7 +748,7 @@ public class TEDemonPortal extends TileEntity
|
|||
}
|
||||
}
|
||||
}
|
||||
} else if (dir == ForgeDirection.SOUTH)
|
||||
} else if (dir == EnumFacing.SOUTH)
|
||||
{
|
||||
for (int i = negZRadius + Math.min(posZRadius, limit); i >= Math.max(0, -limit + negZRadius); i--)
|
||||
{
|
||||
|
@ -762,7 +765,7 @@ public class TEDemonPortal extends TileEntity
|
|||
}
|
||||
}
|
||||
}
|
||||
} else if (dir == ForgeDirection.EAST)
|
||||
} else if (dir == EnumFacing.EAST)
|
||||
{
|
||||
for (int i = negXRadius + Math.min(posXRadius, limit); i >= Math.max(0, -limit + negXRadius); i--)
|
||||
{
|
||||
|
@ -779,7 +782,7 @@ public class TEDemonPortal extends TileEntity
|
|||
}
|
||||
}
|
||||
}
|
||||
} else if (dir == ForgeDirection.WEST)
|
||||
} else if (dir == EnumFacing.WEST)
|
||||
{
|
||||
for (int i = Math.max(0, -limit + negXRadius); i <= negXRadius + Math.min(posXRadius, limit); i++)
|
||||
{
|
||||
|
@ -801,10 +804,10 @@ public class TEDemonPortal extends TileEntity
|
|||
return new Int3(0, 0, 0);
|
||||
}
|
||||
|
||||
public Int3 findEmptySpaceNearRoad(ForgeDirection dir, int amount, int closeness)
|
||||
public Int3 findEmptySpaceNearRoad(EnumFacing dir, int amount, int closeness)
|
||||
{
|
||||
int index = 0;
|
||||
if (dir == ForgeDirection.NORTH)
|
||||
if (dir == EnumFacing.NORTH)
|
||||
{
|
||||
if(printDebug)
|
||||
System.out.print("NORTH!");
|
||||
|
@ -828,7 +831,7 @@ public class TEDemonPortal extends TileEntity
|
|||
}
|
||||
}
|
||||
}
|
||||
} else if (dir == ForgeDirection.SOUTH)
|
||||
} else if (dir == EnumFacing.SOUTH)
|
||||
{
|
||||
for (int i = negZRadius + posZRadius; i >= 0; i--)
|
||||
{
|
||||
|
@ -850,7 +853,7 @@ public class TEDemonPortal extends TileEntity
|
|||
}
|
||||
}
|
||||
}
|
||||
} else if (dir == ForgeDirection.EAST)
|
||||
} else if (dir == EnumFacing.EAST)
|
||||
{
|
||||
for (int i = negXRadius + posXRadius; i >= 0; i--)
|
||||
{
|
||||
|
@ -872,7 +875,7 @@ public class TEDemonPortal extends TileEntity
|
|||
}
|
||||
}
|
||||
}
|
||||
} else if (dir == ForgeDirection.WEST)
|
||||
} else if (dir == EnumFacing.WEST)
|
||||
{
|
||||
for (int i = 0; i <= negXRadius + posXRadius; i++)
|
||||
{
|
||||
|
@ -899,10 +902,10 @@ public class TEDemonPortal extends TileEntity
|
|||
return new Int3(0, 0, 0);
|
||||
}
|
||||
|
||||
public Int3 findEmptySpaceFromDirection(ForgeDirection dir, int amount)
|
||||
public Int3 findEmptySpaceFromDirection(EnumFacing dir, int amount)
|
||||
{
|
||||
int index = 0;
|
||||
if (dir == ForgeDirection.NORTH)
|
||||
if (dir == EnumFacing.NORTH)
|
||||
{
|
||||
if(printDebug)
|
||||
System.out.print("NORTH!");
|
||||
|
@ -921,7 +924,7 @@ public class TEDemonPortal extends TileEntity
|
|||
}
|
||||
}
|
||||
}
|
||||
} else if (dir == ForgeDirection.SOUTH)
|
||||
} else if (dir == EnumFacing.SOUTH)
|
||||
{
|
||||
for (int i = negZRadius + posZRadius; i >= 0; i--)
|
||||
{
|
||||
|
@ -938,7 +941,7 @@ public class TEDemonPortal extends TileEntity
|
|||
}
|
||||
}
|
||||
}
|
||||
} else if (dir == ForgeDirection.EAST)
|
||||
} else if (dir == EnumFacing.EAST)
|
||||
{
|
||||
for (int i = negXRadius + posXRadius; i >= 0; i--)
|
||||
{
|
||||
|
@ -955,7 +958,7 @@ public class TEDemonPortal extends TileEntity
|
|||
}
|
||||
}
|
||||
}
|
||||
} else if (dir == ForgeDirection.WEST)
|
||||
} else if (dir == EnumFacing.WEST)
|
||||
{
|
||||
for (int i = 0; i <= negXRadius + posXRadius; i++)
|
||||
{
|
||||
|
@ -977,7 +980,7 @@ public class TEDemonPortal extends TileEntity
|
|||
return new Int3(0, 0, 0);
|
||||
}
|
||||
|
||||
public int createGriddedRoad(int gridXi, int yi, int gridZi, ForgeDirection dir, int gridLength, boolean convertStarter) //Total grid length
|
||||
public int createGriddedRoad(int gridXi, int yi, int gridZi, EnumFacing dir, int gridLength, boolean convertStarter) //Total grid length
|
||||
{
|
||||
if (gridLength == 0 || gridLength == 1)
|
||||
{
|
||||
|
@ -992,13 +995,13 @@ public class TEDemonPortal extends TileEntity
|
|||
{
|
||||
this.setGridSpace(initGridX, initGridZ, new GridSpace(GridSpace.CROSSROAD, initY));
|
||||
|
||||
DemonCrosspath crosspath = new DemonCrosspath(xCoord + initGridX * 5, initY, zCoord + initGridZ * 5);
|
||||
DemonCrosspath crosspath = new DemonCrosspath(pos.getX() + initGridX * 5, initY, pos.getZ() + initGridZ * 5);
|
||||
crosspath.createCrosspath(worldObj);
|
||||
}
|
||||
|
||||
for (int index = 0; index < gridLength - 1; index++)
|
||||
{
|
||||
DemonVillagePath path = new DemonVillagePath(xCoord + initGridX * 5, initY, zCoord + initGridZ * 5, dir, 6);
|
||||
DemonVillagePath path = new DemonVillagePath(pos.getX() + initGridX * 5, initY, pos.getZ() + initGridZ * 5, dir, 6);
|
||||
|
||||
Int3AndBool temp = path.constructFullPath(this, worldObj, this.getRoadStepClearance());
|
||||
Int3 next = temp.coords;
|
||||
|
@ -1015,8 +1018,8 @@ public class TEDemonPortal extends TileEntity
|
|||
return index;
|
||||
}
|
||||
|
||||
initGridX += dir.offsetX;
|
||||
initGridZ += dir.offsetZ;
|
||||
initGridX += dir.getFrontOffsetX();
|
||||
initGridZ += dir.getFrontOffsetZ();
|
||||
|
||||
if (!this.getGridSpace(initGridX, initGridZ).isRoadSegment())
|
||||
{
|
||||
|
@ -1157,10 +1160,10 @@ public class TEDemonPortal extends TileEntity
|
|||
//
|
||||
// this.initialize();
|
||||
//
|
||||
// if (ForgeDirection.getOrientation(side) == ForgeDirection.UP)
|
||||
// if (EnumFacing.getOrientation(side) == EnumFacing.UP)
|
||||
// {
|
||||
// this.createRandomBuilding(DemonBuilding.BUILDING_HOUSE, 0);
|
||||
// } else if (ForgeDirection.getOrientation(side) == ForgeDirection.DOWN)
|
||||
// } else if (EnumFacing.getOrientation(side) == EnumFacing.DOWN)
|
||||
// {
|
||||
// this.createRandomBuilding(DemonBuilding.BUILDING_PORTAL, 0);
|
||||
// } else
|
||||
|
@ -1194,11 +1197,11 @@ public class TEDemonPortal extends TileEntity
|
|||
|
||||
// GridSpaceHolder grid = this.createGSH();
|
||||
|
||||
List<ForgeDirection> directions = new ArrayList();
|
||||
List<EnumFacing> directions = new ArrayList();
|
||||
|
||||
for (int i = 2; i < 6; i++)
|
||||
{
|
||||
ForgeDirection testDir = ForgeDirection.getOrientation(i);
|
||||
EnumFacing testDir = EnumFacing.getFront(i);
|
||||
directions.add(testDir);
|
||||
}
|
||||
|
||||
|
@ -1207,9 +1210,9 @@ public class TEDemonPortal extends TileEntity
|
|||
return 0;
|
||||
}
|
||||
|
||||
HashMap<ForgeDirection, List<DemonBuilding>> schemMap = new HashMap();
|
||||
HashMap<EnumFacing, List<DemonBuilding>> schemMap = new HashMap();
|
||||
|
||||
for (ForgeDirection nextDir : directions)
|
||||
for (EnumFacing nextDir : directions)
|
||||
{
|
||||
for (DemonBuilding build : TEDemonPortal.buildingList)
|
||||
{
|
||||
|
@ -1234,7 +1237,7 @@ public class TEDemonPortal extends TileEntity
|
|||
return 0;
|
||||
}
|
||||
|
||||
ForgeDirection chosenDirection = (ForgeDirection) schemMap.keySet().toArray()[new Random().nextInt(schemMap.keySet().size())];
|
||||
EnumFacing chosenDirection = (EnumFacing) schemMap.keySet().toArray()[new Random().nextInt(schemMap.keySet().size())];
|
||||
DemonBuilding build = schemMap.get(chosenDirection).get(new Random().nextInt(schemMap.get(chosenDirection).size()));
|
||||
// Int3 portalSpace = build.getDoorSpace(chosenDirection);
|
||||
|
||||
|
@ -1276,7 +1279,7 @@ public class TEDemonPortal extends TileEntity
|
|||
|
||||
GridSpaceHolder grid = this.createGSH();
|
||||
|
||||
ForgeDirection chosenDirection = this.nextDemonPortalDirection;
|
||||
EnumFacing chosenDirection = this.nextDemonPortalDirection;
|
||||
Int3 portalSpace = build.getDoorSpace(chosenDirection);
|
||||
int yOffset = portalSpace.yCoord;
|
||||
|
||||
|
@ -1288,9 +1291,9 @@ public class TEDemonPortal extends TileEntity
|
|||
|
||||
case 1:
|
||||
int yDestination = yLevel + yOffset;
|
||||
if(yCoord != yDestination)
|
||||
if(pos.getY() != yDestination)
|
||||
{
|
||||
BlockTeleposer.swapBlocks(this, worldObj, worldObj, xCoord, yCoord, zCoord, xCoord, yDestination, zCoord);
|
||||
BlockTeleposer.swapBlocks(this, worldObj, worldObj, pos, new BlockPos(pos.getX(), yDestination, pos.getZ()));
|
||||
}else
|
||||
{
|
||||
//Nuthin - just as a reminder that we can now increment properly
|
||||
|
@ -1298,9 +1301,9 @@ public class TEDemonPortal extends TileEntity
|
|||
break;
|
||||
|
||||
case 2:
|
||||
build.destroyAllInField(worldObj, xCoord + (x) * 5, yLevel, zCoord + (z) * 5, chosenDirection.getOpposite());
|
||||
build.destroyAllInField(worldObj, pos.getX() + (x) * 5, yLevel, pos.getZ() + (z) * 5, chosenDirection.getOpposite());
|
||||
|
||||
build.buildAll(this, worldObj, xCoord + (x) * 5, yLevel, zCoord + (z) * 5, chosenDirection.getOpposite(), true);
|
||||
build.buildAll(this, worldObj, pos.getX() + (x) * 5, yLevel, pos.getZ() + (z) * 5, chosenDirection.getOpposite(), true);
|
||||
build.setAllGridSpaces(x, z, yLevel, chosenDirection.getOpposite(), GridSpace.MAIN_PORTAL, grid);
|
||||
this.loadGSH(grid);
|
||||
break;
|
||||
|
@ -1314,24 +1317,24 @@ public class TEDemonPortal extends TileEntity
|
|||
public int createRandomHouse(int buildingTier)
|
||||
{
|
||||
int next = rand.nextInt(4);
|
||||
ForgeDirection dir;
|
||||
EnumFacing dir;
|
||||
|
||||
switch (next)
|
||||
{
|
||||
case 0:
|
||||
dir = ForgeDirection.NORTH;
|
||||
dir = EnumFacing.NORTH;
|
||||
break;
|
||||
case 1:
|
||||
dir = ForgeDirection.SOUTH;
|
||||
dir = EnumFacing.SOUTH;
|
||||
break;
|
||||
case 2:
|
||||
dir = ForgeDirection.EAST;
|
||||
dir = EnumFacing.EAST;
|
||||
break;
|
||||
case 3:
|
||||
dir = ForgeDirection.WEST;
|
||||
dir = EnumFacing.WEST;
|
||||
break;
|
||||
default:
|
||||
dir = ForgeDirection.NORTH;
|
||||
dir = EnumFacing.NORTH;
|
||||
}
|
||||
|
||||
Int3 space = this.findRoadSpaceFromDirection(dir, (rand.nextInt(negXRadius + negZRadius + posXRadius + posZRadius)) + 1); // Second: 1 *
|
||||
|
@ -1350,12 +1353,12 @@ public class TEDemonPortal extends TileEntity
|
|||
return 0;
|
||||
}
|
||||
|
||||
List<ForgeDirection> directions = new ArrayList();
|
||||
List<EnumFacing> directions = new ArrayList();
|
||||
|
||||
for (int i = 2; i < 6; i++)
|
||||
{
|
||||
ForgeDirection testDir = ForgeDirection.getOrientation(i);
|
||||
if (this.getGridSpace(x + testDir.offsetX, z + testDir.offsetZ).isEmpty())
|
||||
EnumFacing testDir = EnumFacing.getFront(i);
|
||||
if (this.getGridSpace(x + testDir.getFrontOffsetX(), z + testDir.getFrontOffsetZ()).isEmpty())
|
||||
{
|
||||
directions.add(testDir);
|
||||
}
|
||||
|
@ -1366,9 +1369,9 @@ public class TEDemonPortal extends TileEntity
|
|||
return 0;
|
||||
}
|
||||
|
||||
HashMap<ForgeDirection, List<DemonBuilding>> schemMap = new HashMap();
|
||||
HashMap<EnumFacing, List<DemonBuilding>> schemMap = new HashMap();
|
||||
|
||||
for (ForgeDirection nextDir : directions)
|
||||
for (EnumFacing nextDir : directions)
|
||||
{
|
||||
for (DemonBuilding build : TEDemonPortal.buildingList)
|
||||
{
|
||||
|
@ -1403,19 +1406,19 @@ public class TEDemonPortal extends TileEntity
|
|||
return 0;
|
||||
}
|
||||
|
||||
ForgeDirection chosenDirection = (ForgeDirection) schemMap.keySet().toArray()[new Random().nextInt(schemMap.keySet().size())];
|
||||
EnumFacing chosenDirection = (EnumFacing) schemMap.keySet().toArray()[new Random().nextInt(schemMap.keySet().size())];
|
||||
DemonBuilding build = schemMap.get(chosenDirection).get(new Random().nextInt(schemMap.get(chosenDirection).size()));
|
||||
|
||||
Int3 offsetSpace = build.getGridOffsetFromRoad(chosenDirection, yLevel);
|
||||
int xOff = offsetSpace.xCoord;
|
||||
int zOff = offsetSpace.zCoord;
|
||||
|
||||
build.destroyAllInField(worldObj, xCoord + (x + xOff) * 5, yLevel, zCoord + (z + zOff) * 5, chosenDirection.getOpposite());
|
||||
build.buildAll(this, worldObj, xCoord + (x + xOff) * 5, yLevel, zCoord + (z + zOff) * 5, chosenDirection.getOpposite(), true);
|
||||
build.destroyAllInField(worldObj, pos.getX() + (x + xOff) * 5, yLevel, pos.getZ() + (z + zOff) * 5, chosenDirection.getOpposite());
|
||||
build.buildAll(this, worldObj, pos.getX() + (x + xOff) * 5, yLevel, pos.getZ() + (z + zOff) * 5, chosenDirection.getOpposite(), true);
|
||||
build.setAllGridSpaces(x + xOff, z + zOff, yLevel, chosenDirection.getOpposite(), GridSpace.HOUSE, grid);
|
||||
this.loadGSH(grid);
|
||||
|
||||
DemonVillagePath path = new DemonVillagePath(xCoord + (x) * 5, yLevel, zCoord + (z) * 5, chosenDirection, 2);
|
||||
DemonVillagePath path = new DemonVillagePath(pos.getX() + (x) * 5, yLevel, pos.getZ() + (z) * 5, chosenDirection, 2);
|
||||
|
||||
Int3AndBool temp = path.constructFullPath(this, worldObj, this.getRoadStepClearance());
|
||||
|
||||
|
@ -1446,14 +1449,14 @@ public class TEDemonPortal extends TileEntity
|
|||
return -1;
|
||||
}
|
||||
|
||||
public void createRoad(int xi, int yi, int zi, ForgeDirection dir, int length, boolean doesNotDrop)
|
||||
public void createRoad(int xi, int yi, int zi, EnumFacing dir, int length, boolean doesNotDrop)
|
||||
{
|
||||
int curX = xi;
|
||||
int curY = yi;
|
||||
int curZ = zi;
|
||||
int roadRadius = this.getRoadRadius();
|
||||
|
||||
if (dir.offsetY != 0)
|
||||
if (dir.getFrontOffsetY() != 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -1495,6 +1498,11 @@ public class TEDemonPortal extends TileEntity
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public IBlockState getRoadState()
|
||||
{
|
||||
return getRoadBlock().getStateFromMeta(getRoadMeta());
|
||||
}
|
||||
|
||||
public int getRoadStepClearance()
|
||||
{
|
||||
|
|
|
@ -26,7 +26,7 @@ public class BookEntityItem extends EntityItem
|
|||
public BookEntityItem(World world, Entity original, ItemStack stack)
|
||||
{
|
||||
this(world, original.posX, original.posY, original.posZ);
|
||||
this.delayBeforeCanPickup = 20;
|
||||
this.setDefaultPickupDelay();
|
||||
this.motionX = original.motionX;
|
||||
this.motionY = original.motionY;
|
||||
this.motionZ = original.motionZ;
|
||||
|
|
|
@ -1,34 +1,31 @@
|
|||
package WayofTime.alchemicalWizardry.common.entity.mob;
|
||||
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.ModItems;
|
||||
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.ai.*;
|
||||
import net.minecraft.entity.monster.EntityCreeper;
|
||||
import net.minecraft.entity.monster.EntityGhast;
|
||||
import net.minecraft.entity.passive.EntityHorse;
|
||||
import net.minecraft.entity.ai.EntityAIAttackOnCollide;
|
||||
import net.minecraft.entity.ai.EntityAIFollowOwner;
|
||||
import net.minecraft.entity.ai.EntityAIHurtByTarget;
|
||||
import net.minecraft.entity.ai.EntityAILookIdle;
|
||||
import net.minecraft.entity.ai.EntityAIOwnerHurtByTarget;
|
||||
import net.minecraft.entity.ai.EntityAIOwnerHurtTarget;
|
||||
import net.minecraft.entity.ai.EntityAISwimming;
|
||||
import net.minecraft.entity.ai.EntityAIWander;
|
||||
import net.minecraft.entity.ai.EntityAIWatchClosest;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.projectile.EntityArrow;
|
||||
import net.minecraft.item.ItemFood;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.pathfinding.PathNavigateGround;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
|
||||
public class EntityBileDemon extends EntityDemon
|
||||
{
|
||||
private static float maxTamedHealth = 100.0F;
|
||||
private static float maxUntamedHealth = 200.0F;
|
||||
private int attackTimer;
|
||||
|
||||
|
||||
public EntityBileDemon(World par1World)
|
||||
{
|
||||
super(par1World, AlchemicalWizardry.entityBileDemonID);
|
||||
maxTamedHealth = 100.0F;
|
||||
maxUntamedHealth = 200.0F;
|
||||
this.setSize(1.3F, 2.0F);
|
||||
this.getNavigator().setAvoidsWater(true);
|
||||
((PathNavigateGround)this.getNavigator()).func_179690_a(true);
|
||||
this.tasks.addTask(1, new EntityAISwimming(this));
|
||||
this.tasks.addTask(2, new EntityAIAttackOnCollide(this, 1.0D, true));
|
||||
this.tasks.addTask(3, this.aiSit);
|
||||
|
@ -41,6 +38,7 @@ public class EntityBileDemon extends EntityDemon
|
|||
this.targetTasks.addTask(3, new EntityAIHurtByTarget(this, true));
|
||||
this.setTamed(false);
|
||||
attackTimer = 0;
|
||||
this.applyEntityAttributes();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -61,338 +59,4 @@ public class EntityBileDemon extends EntityDemon
|
|||
|
||||
//this.func_110148_a(SharedMonsterAttributes.field_111267_a).func_111128_a(10.0D);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the newer Entity AI code should be run
|
||||
*/
|
||||
public boolean isAIEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the active target the Task system uses for tracking
|
||||
*/
|
||||
public void setAttackTarget(EntityLivingBase par1EntityLivingBase)
|
||||
{
|
||||
super.setAttackTarget(par1EntityLivingBase);
|
||||
|
||||
if (par1EntityLivingBase == null)
|
||||
{
|
||||
this.setAngry(false);
|
||||
} else if (!this.isTamed())
|
||||
{
|
||||
this.setAngry(true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* main AI tick function, replaces updateEntityActionState
|
||||
*/
|
||||
protected void updateAITick()
|
||||
{
|
||||
this.dataWatcher.updateObject(18, this.getHealth());
|
||||
}
|
||||
|
||||
protected void entityInit()
|
||||
{
|
||||
super.entityInit();
|
||||
this.dataWatcher.addObject(18, this.getHealth());
|
||||
//this.dataWatcher.addObject(20, new Byte((byte) BlockColored.getBlockFromDye(1)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Plays step sound at given x, y, z for the entity
|
||||
*/
|
||||
protected void playStepSound(int par1, int par2, int par3, int par4)
|
||||
{
|
||||
this.playSound("mob.zombie.step", 0.15F, 1.0F);
|
||||
}
|
||||
|
||||
/**
|
||||
* (abstract) Protected helper method to write subclass entity data to NBT.
|
||||
*/
|
||||
public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound)
|
||||
{
|
||||
super.writeEntityToNBT(par1NBTTagCompound);
|
||||
par1NBTTagCompound.setBoolean("Angry", this.isAngry());
|
||||
par1NBTTagCompound.setByte("attackTimer", (byte) attackTimer);
|
||||
}
|
||||
|
||||
/**
|
||||
* (abstract) Protected helper method to read subclass entity data from NBT.
|
||||
*/
|
||||
public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound)
|
||||
{
|
||||
super.readEntityFromNBT(par1NBTTagCompound);
|
||||
this.setAngry(par1NBTTagCompound.getBoolean("Angry"));
|
||||
|
||||
attackTimer = par1NBTTagCompound.getByte("attackTimer");
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the sound this mob makes while it's alive.
|
||||
*/
|
||||
protected String getLivingSound()
|
||||
{
|
||||
return "none";
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the sound this mob makes when it is hurt.
|
||||
*/
|
||||
protected String getHurtSound()
|
||||
{
|
||||
return "mob.irongolem.hit";
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the sound this mob makes on death.
|
||||
*/
|
||||
protected String getDeathSound()
|
||||
{
|
||||
return "mob.irongolem.death";
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the volume for the sounds this mob makes.
|
||||
*/
|
||||
protected float getSoundVolume()
|
||||
{
|
||||
return 1.0F;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons
|
||||
* use this to react to sunlight and start to burn.
|
||||
*/
|
||||
public void onLivingUpdate()
|
||||
{
|
||||
super.onLivingUpdate();
|
||||
|
||||
if (attackTimer > 0)
|
||||
{
|
||||
attackTimer--;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called to update the entity's position/logic.
|
||||
*/
|
||||
public void onUpdate()
|
||||
{
|
||||
super.onUpdate();
|
||||
}
|
||||
|
||||
public float getEyeHeight()
|
||||
{
|
||||
return this.height * 0.8F;
|
||||
}
|
||||
|
||||
/**
|
||||
* The speed it takes to move the entityliving's rotationPitch through the faceEntity method. This is only currently
|
||||
* use in wolves.
|
||||
*/
|
||||
public int getVerticalFaceSpeed()
|
||||
{
|
||||
return this.isSitting() ? 20 : super.getVerticalFaceSpeed();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the entity is attacked.
|
||||
*/
|
||||
public boolean attackEntityFrom(DamageSource par1DamageSource, float par2)
|
||||
{
|
||||
if (this.isEntityInvulnerable())
|
||||
{
|
||||
return false;
|
||||
} else
|
||||
{
|
||||
Entity entity = par1DamageSource.getEntity();
|
||||
this.aiSit.setSitting(false);
|
||||
|
||||
if (entity != null && !(entity instanceof EntityPlayer) && !(entity instanceof EntityArrow))
|
||||
{
|
||||
par2 = (par2 + 1.0F) / 2.0F;
|
||||
}
|
||||
|
||||
return super.attackEntityFrom(par1DamageSource, par2);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean attackEntityAsMob(Entity par1Entity)
|
||||
{
|
||||
this.attackTimer = 10;
|
||||
this.worldObj.setEntityState(this, (byte) 4);
|
||||
boolean flag = par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float) (7 + this.rand.nextInt(15)));
|
||||
|
||||
if (flag)
|
||||
{
|
||||
par1Entity.motionY += 0.4000000059604645D;
|
||||
}
|
||||
|
||||
this.playSound("mob.irongolem.throw", 1.0F, 1.0F);
|
||||
return flag;
|
||||
}
|
||||
|
||||
public void setTamed(boolean par1)
|
||||
{
|
||||
super.setTamed(par1);
|
||||
|
||||
if (par1)
|
||||
{
|
||||
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(maxTamedHealth);
|
||||
} else
|
||||
{
|
||||
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(maxUntamedHealth);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig.
|
||||
*/
|
||||
@Override
|
||||
public boolean interact(EntityPlayer par1EntityPlayer)
|
||||
{
|
||||
ItemStack itemstack = par1EntityPlayer.inventory.getCurrentItem();
|
||||
|
||||
if (this.isTamed())
|
||||
{
|
||||
if (itemstack != null)
|
||||
{
|
||||
if (itemstack.getItem() instanceof ItemFood)
|
||||
{
|
||||
ItemFood itemfood = (ItemFood) itemstack.getItem();
|
||||
|
||||
if (itemfood.isWolfsFavoriteMeat() && this.dataWatcher.getWatchableObjectFloat(18) < maxTamedHealth)
|
||||
{
|
||||
if (!par1EntityPlayer.capabilities.isCreativeMode)
|
||||
{
|
||||
--itemstack.stackSize;
|
||||
}
|
||||
|
||||
this.heal((float) itemfood.func_150905_g(itemstack));
|
||||
|
||||
if (itemstack.stackSize <= 0)
|
||||
{
|
||||
par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, null);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.getOwner() instanceof EntityPlayer && SpellHelper.getUsername(par1EntityPlayer).equalsIgnoreCase(SpellHelper.getUsername((EntityPlayer) this.getOwner())) && !this.isBreedingItem(itemstack))
|
||||
{
|
||||
if (!this.worldObj.isRemote)
|
||||
{
|
||||
this.aiSit.setSitting(!this.isSitting());
|
||||
this.isJumping = false;
|
||||
this.setPathToEntity(null);
|
||||
this.setTarget(null);
|
||||
this.setAttackTarget(null);
|
||||
}
|
||||
|
||||
this.sendSittingMessageToPlayer(par1EntityPlayer, !this.isSitting());
|
||||
}
|
||||
} else if (itemstack != null && itemstack.getItem().equals(ModItems.weakBloodOrb) && !this.isAngry())
|
||||
{
|
||||
if (!par1EntityPlayer.capabilities.isCreativeMode)
|
||||
{
|
||||
--itemstack.stackSize;
|
||||
}
|
||||
|
||||
if (itemstack.stackSize <= 0)
|
||||
{
|
||||
par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, null);
|
||||
}
|
||||
|
||||
if (!this.worldObj.isRemote)
|
||||
{
|
||||
if (this.rand.nextInt(1) == 0)
|
||||
{
|
||||
this.setTamed(true);
|
||||
this.setPathToEntity(null);
|
||||
this.setAttackTarget(null);
|
||||
this.aiSit.setSitting(true);
|
||||
this.setHealth(maxTamedHealth);
|
||||
this.func_152115_b(par1EntityPlayer.getUniqueID().toString());
|
||||
this.playTameEffect(true);
|
||||
this.worldObj.setEntityState(this, (byte) 7);
|
||||
} else
|
||||
{
|
||||
this.playTameEffect(false);
|
||||
this.worldObj.setEntityState(this, (byte) 6);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return super.interact(par1EntityPlayer);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the parameter is an item which this animal can be fed to breed it (wheat, carrots or seeds depending on
|
||||
* the animal type)
|
||||
*/
|
||||
public boolean isBreedingItem(ItemStack par1ItemStack)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether this wolf is angry or not.
|
||||
*/
|
||||
public boolean isAngry()
|
||||
{
|
||||
return (this.dataWatcher.getWatchableObjectByte(16) & 2) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether this wolf is angry or not.
|
||||
*/
|
||||
public void setAngry(boolean par1)
|
||||
{
|
||||
byte b0 = this.dataWatcher.getWatchableObjectByte(16);
|
||||
|
||||
if (par1)
|
||||
{
|
||||
this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 | 2)));
|
||||
} else
|
||||
{
|
||||
this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 & -3)));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if an entity can be despawned, used on idle far away entities
|
||||
*/
|
||||
protected boolean canDespawn()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean func_142018_a(EntityLivingBase par1EntityLivingBase, EntityLivingBase par2EntityLivingBase)
|
||||
{
|
||||
if (!(par1EntityLivingBase instanceof EntityCreeper) && !(par1EntityLivingBase instanceof EntityGhast))
|
||||
{
|
||||
if (par1EntityLivingBase instanceof EntityBileDemon)
|
||||
{
|
||||
EntityBileDemon entitywolf = (EntityBileDemon) par1EntityLivingBase;
|
||||
|
||||
if (entitywolf.isTamed() && entitywolf.getOwner() == par2EntityLivingBase)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return par1EntityLivingBase instanceof EntityPlayer && par2EntityLivingBase instanceof EntityPlayer && !((EntityPlayer) par2EntityLivingBase).canAttackPlayer((EntityPlayer) par1EntityLivingBase) ? false : !(par1EntityLivingBase instanceof EntityHorse) || !((EntityHorse) par1EntityLivingBase).isTame();
|
||||
} else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,24 +1,21 @@
|
|||
package WayofTime.alchemicalWizardry.common.entity.mob;
|
||||
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.ModItems;
|
||||
import WayofTime.alchemicalWizardry.common.EntityAITargetAggro;
|
||||
import WayofTime.alchemicalWizardry.common.entity.projectile.HolyProjectile;
|
||||
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.ai.*;
|
||||
import net.minecraft.entity.monster.EntityCreeper;
|
||||
import net.minecraft.entity.monster.EntityGhast;
|
||||
import net.minecraft.entity.passive.EntityHorse;
|
||||
import net.minecraft.entity.ai.EntityAIAttackOnCollide;
|
||||
import net.minecraft.entity.ai.EntityAIFollowOwner;
|
||||
import net.minecraft.entity.ai.EntityAIHurtByTarget;
|
||||
import net.minecraft.entity.ai.EntityAILeapAtTarget;
|
||||
import net.minecraft.entity.ai.EntityAILookIdle;
|
||||
import net.minecraft.entity.ai.EntityAIOwnerHurtByTarget;
|
||||
import net.minecraft.entity.ai.EntityAIOwnerHurtTarget;
|
||||
import net.minecraft.entity.ai.EntityAISwimming;
|
||||
import net.minecraft.entity.ai.EntityAIWander;
|
||||
import net.minecraft.entity.ai.EntityAIWatchClosest;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.projectile.EntityArrow;
|
||||
import net.minecraft.item.ItemFood;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.pathfinding.PathNavigateGround;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.common.EntityAITargetAggro;
|
||||
|
||||
public class EntityBoulderFist extends EntityDemon
|
||||
{
|
||||
|
@ -31,7 +28,7 @@ public class EntityBoulderFist extends EntityDemon
|
|||
{
|
||||
super(par1World, AlchemicalWizardry.entityBoulderFistID);
|
||||
this.setSize(0.8F, 1.2F);
|
||||
this.getNavigator().setAvoidsWater(true);
|
||||
((PathNavigateGround)this.getNavigator()).func_179690_a(true);
|
||||
this.tasks.addTask(1, new EntityAISwimming(this));
|
||||
this.tasks.addTask(2, this.aiSit);
|
||||
this.tasks.addTask(3, new EntityAILeapAtTarget(this, 0.4F));
|
||||
|
@ -70,334 +67,6 @@ public class EntityBoulderFist extends EntityDemon
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the newer Entity AI code should be run
|
||||
*/
|
||||
public boolean isAIEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the active target the Task system uses for tracking
|
||||
*/
|
||||
public void setAttackTarget(EntityLivingBase par1EntityLivingBase)
|
||||
{
|
||||
super.setAttackTarget(par1EntityLivingBase);
|
||||
|
||||
if (par1EntityLivingBase == null)
|
||||
{
|
||||
this.setAngry(false);
|
||||
} else if (!this.isTamed())
|
||||
{
|
||||
this.setAngry(true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* main AI tick function, replaces updateEntityActionState
|
||||
*/
|
||||
protected void updateAITick()
|
||||
{
|
||||
this.dataWatcher.updateObject(18, this.getHealth());
|
||||
}
|
||||
|
||||
protected void entityInit()
|
||||
{
|
||||
super.entityInit();
|
||||
this.dataWatcher.addObject(18, this.getHealth());
|
||||
}
|
||||
|
||||
/**
|
||||
* Plays step sound at given x, y, z for the entity
|
||||
*/
|
||||
protected void playStepSound(int par1, int par2, int par3, int par4)
|
||||
{
|
||||
this.playSound("mob.zombie.step", 0.15F, 1.0F);
|
||||
}
|
||||
|
||||
/**
|
||||
* (abstract) Protected helper method to write subclass entity data to NBT.
|
||||
*/
|
||||
public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound)
|
||||
{
|
||||
super.writeEntityToNBT(par1NBTTagCompound);
|
||||
}
|
||||
|
||||
/**
|
||||
* (abstract) Protected helper method to read subclass entity data from NBT.
|
||||
*/
|
||||
public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound)
|
||||
{
|
||||
super.readEntityFromNBT(par1NBTTagCompound);
|
||||
this.setAngry(par1NBTTagCompound.getBoolean("Angry"));
|
||||
|
||||
this.setCombatTask();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the sound this mob makes while it's alive.
|
||||
*/
|
||||
protected String getLivingSound()
|
||||
{
|
||||
//TODO change sounds
|
||||
return this.isAngry() ? "mob.wolf.growl" : (this.rand.nextInt(3) == 0 ? (this.isTamed() && this.dataWatcher.getWatchableObjectFloat(18) < 10.0F ? "mob.wolf.whine" : "mob.wolf.panting") : "mob.wolf.bark");
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the sound this mob makes when it is hurt.
|
||||
*/
|
||||
protected String getHurtSound()
|
||||
{
|
||||
return "mob.wolf.hurt";
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the sound this mob makes on death.
|
||||
*/
|
||||
protected String getDeathSound()
|
||||
{
|
||||
return "mob.wolf.death";
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the volume for the sounds this mob makes.
|
||||
*/
|
||||
protected float getSoundVolume()
|
||||
{
|
||||
return 0.4F;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons
|
||||
* use this to react to sunlight and start to burn.
|
||||
*/
|
||||
public void onLivingUpdate()
|
||||
{
|
||||
super.onLivingUpdate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called to update the entity's position/logic.
|
||||
*/
|
||||
public void onUpdate()
|
||||
{
|
||||
super.onUpdate();
|
||||
}
|
||||
|
||||
public float getEyeHeight()
|
||||
{
|
||||
return this.height * 0.8F;
|
||||
}
|
||||
|
||||
/**
|
||||
* The speed it takes to move the entityliving's rotationPitch through the faceEntity method. This is only currently
|
||||
* use in wolves.
|
||||
*/
|
||||
public int getVerticalFaceSpeed()
|
||||
{
|
||||
return this.isSitting() ? 20 : super.getVerticalFaceSpeed();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the entity is attacked.
|
||||
*/
|
||||
public boolean attackEntityFrom(DamageSource par1DamageSource, float par2)
|
||||
{
|
||||
if (this.isEntityInvulnerable())
|
||||
{
|
||||
return false;
|
||||
} else
|
||||
{
|
||||
Entity entity = par1DamageSource.getEntity();
|
||||
this.aiSit.setSitting(false);
|
||||
|
||||
if (entity != null && !(entity instanceof EntityPlayer) && !(entity instanceof EntityArrow))
|
||||
{
|
||||
par2 = (par2 + 1.0F) / 2.0F;
|
||||
}
|
||||
|
||||
return super.attackEntityFrom(par1DamageSource, par2);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean attackEntityAsMob(Entity par1Entity)
|
||||
{
|
||||
int i = this.isTamed() ? 6 : 7;
|
||||
return par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float) i);
|
||||
}
|
||||
|
||||
public void setTamed(boolean par1)
|
||||
{
|
||||
super.setTamed(par1);
|
||||
|
||||
if (par1)
|
||||
{
|
||||
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(maxTamedHealth);
|
||||
} else
|
||||
{
|
||||
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(maxUntamedHealth);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig.
|
||||
*/
|
||||
@Override
|
||||
public boolean interact(EntityPlayer par1EntityPlayer)
|
||||
{
|
||||
ItemStack itemstack = par1EntityPlayer.inventory.getCurrentItem();
|
||||
|
||||
if (this.isTamed())
|
||||
{
|
||||
if (itemstack != null)
|
||||
{
|
||||
if (itemstack.getItem() instanceof ItemFood)
|
||||
{
|
||||
ItemFood itemfood = (ItemFood) itemstack.getItem();
|
||||
|
||||
if (itemfood.isWolfsFavoriteMeat() && this.dataWatcher.getWatchableObjectFloat(18) < maxTamedHealth)
|
||||
{
|
||||
if (!par1EntityPlayer.capabilities.isCreativeMode)
|
||||
{
|
||||
--itemstack.stackSize;
|
||||
}
|
||||
|
||||
this.heal((float) itemfood.func_150905_g(itemstack));
|
||||
|
||||
if (itemstack.stackSize <= 0)
|
||||
{
|
||||
par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, null);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.getOwner() instanceof EntityPlayer && SpellHelper.getUsername(par1EntityPlayer).equalsIgnoreCase(SpellHelper.getUsername((EntityPlayer) this.getOwner())) && !this.isBreedingItem(itemstack))
|
||||
{
|
||||
if (!this.worldObj.isRemote)
|
||||
{
|
||||
this.aiSit.setSitting(!this.isSitting());
|
||||
this.isJumping = false;
|
||||
this.setPathToEntity(null);
|
||||
this.setTarget(null);
|
||||
this.setAttackTarget(null);
|
||||
}
|
||||
|
||||
this.sendSittingMessageToPlayer(par1EntityPlayer, !this.isSitting());
|
||||
}
|
||||
} else if (itemstack != null && itemstack.getItem().equals(ModItems.weakBloodOrb) && !this.isAngry())
|
||||
{
|
||||
if (!par1EntityPlayer.capabilities.isCreativeMode)
|
||||
{
|
||||
--itemstack.stackSize;
|
||||
}
|
||||
|
||||
if (itemstack.stackSize <= 0)
|
||||
{
|
||||
par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, null);
|
||||
}
|
||||
|
||||
if (!this.worldObj.isRemote)
|
||||
{
|
||||
if (this.rand.nextInt(1) == 0)
|
||||
{
|
||||
this.setTamed(true);
|
||||
this.setPathToEntity(null);
|
||||
this.setAttackTarget(null);
|
||||
this.aiSit.setSitting(true);
|
||||
this.setHealth(maxTamedHealth);
|
||||
this.func_152115_b(par1EntityPlayer.getUniqueID().toString());
|
||||
this.playTameEffect(true);
|
||||
this.worldObj.setEntityState(this, (byte) 7);
|
||||
} else
|
||||
{
|
||||
this.playTameEffect(false);
|
||||
this.worldObj.setEntityState(this, (byte) 6);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return super.interact(par1EntityPlayer);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks if the parameter is an item which this animal can be fed to breed it (wheat, carrots or seeds depending on
|
||||
* the animal type)
|
||||
*/
|
||||
public boolean isBreedingItem(ItemStack par1ItemStack)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether this wolf is angry or not.
|
||||
*/
|
||||
public boolean isAngry()
|
||||
{
|
||||
return (this.dataWatcher.getWatchableObjectByte(16) & 2) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether this wolf is angry or not.
|
||||
*/
|
||||
public void setAngry(boolean par1)
|
||||
{
|
||||
byte b0 = this.dataWatcher.getWatchableObjectByte(16);
|
||||
|
||||
if (par1)
|
||||
{
|
||||
this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 | 2)));
|
||||
} else
|
||||
{
|
||||
this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 & -3)));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if an entity can be despawned, used on idle far away entities
|
||||
*/
|
||||
protected boolean canDespawn()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean func_142018_a(EntityLivingBase par1EntityLivingBase, EntityLivingBase par2EntityLivingBase)
|
||||
{
|
||||
if (!(par1EntityLivingBase instanceof EntityCreeper) && !(par1EntityLivingBase instanceof EntityGhast))
|
||||
{
|
||||
if (par1EntityLivingBase instanceof EntityBoulderFist)
|
||||
{
|
||||
EntityBoulderFist entitywolf = (EntityBoulderFist) par1EntityLivingBase;
|
||||
|
||||
if (entitywolf.isTamed() && entitywolf.getOwner() == par2EntityLivingBase)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return par1EntityLivingBase instanceof EntityPlayer && par2EntityLivingBase instanceof EntityPlayer && !((EntityPlayer) par2EntityLivingBase).canAttackPlayer((EntityPlayer) par1EntityLivingBase) ? false : !(par1EntityLivingBase instanceof EntityHorse) || !((EntityHorse) par1EntityLivingBase).isTame();
|
||||
} else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Attack the specified entity using a ranged attack.
|
||||
*/
|
||||
public void attackEntityWithRangedAttack(EntityLivingBase par1EntityLivingBase, float par2)
|
||||
{
|
||||
HolyProjectile hol = new HolyProjectile(worldObj, this, par1EntityLivingBase, 1.8f, 0f, 5, 600);
|
||||
this.worldObj.spawnEntityInWorld(hol);
|
||||
}
|
||||
|
||||
/**
|
||||
* sets this entity's combat AI.
|
||||
*/
|
||||
|
|
|
@ -1,11 +1,22 @@
|
|||
package WayofTime.alchemicalWizardry.common.entity.mob;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityAgeable;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.monster.EntityCreeper;
|
||||
import net.minecraft.entity.monster.EntityGhast;
|
||||
import net.minecraft.entity.passive.EntityAnimal;
|
||||
import net.minecraft.entity.passive.EntityHorse;
|
||||
import net.minecraft.entity.passive.EntityTameable;
|
||||
import net.minecraft.entity.passive.EntityWolf;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.projectile.EntityArrow;
|
||||
import net.minecraft.item.ItemFood;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ChatComponentTranslation;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.ModItems;
|
||||
import WayofTime.alchemicalWizardry.common.IDemon;
|
||||
|
@ -14,8 +25,12 @@ import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
|
|||
|
||||
public class EntityDemon extends EntityTameable implements IDemon
|
||||
{
|
||||
private boolean isAggro;
|
||||
private String demonID;
|
||||
protected boolean isAggro;
|
||||
protected String demonID;
|
||||
|
||||
protected float maxTamedHealth = 100.0F;
|
||||
protected float maxUntamedHealth = 200.0F;
|
||||
protected int attackTimer;
|
||||
|
||||
protected boolean dropCrystal = true;
|
||||
|
||||
|
@ -61,13 +76,15 @@ public class EntityDemon extends EntityTameable implements IDemon
|
|||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
super.writeToNBT(tag);
|
||||
|
||||
tag.setBoolean("dropCrystal", this.getDoesDropCrystal());
|
||||
tag.setBoolean("isAggro", isAggro);
|
||||
tag.setString("demonID", demonID);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -76,6 +93,8 @@ public class EntityDemon extends EntityTameable implements IDemon
|
|||
super.readFromNBT(tag);
|
||||
|
||||
this.setDropCrystal(tag.getBoolean("dropCrystal"));
|
||||
isAggro = tag.getBoolean("isAggro");
|
||||
demonID = tag.getString("demonID");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -92,7 +111,7 @@ public class EntityDemon extends EntityTameable implements IDemon
|
|||
DemonPlacer.setOwnerName(drop, SpellHelper.getUsername((EntityPlayer) this.getOwner()));
|
||||
}
|
||||
|
||||
if (this.hasCustomNameTag())
|
||||
if (this.hasCustomName())
|
||||
{
|
||||
drop.setStackDisplayName(this.getCustomNameTag());
|
||||
}
|
||||
|
@ -138,4 +157,387 @@ public class EntityDemon extends EntityTameable implements IDemon
|
|||
{
|
||||
this.demonID = id;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns true if the newer Entity AI code should be run
|
||||
*/
|
||||
public boolean isAIEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the active target the Task system uses for tracking
|
||||
*/
|
||||
public void setAttackTarget(EntityLivingBase par1EntityLivingBase)
|
||||
{
|
||||
super.setAttackTarget(par1EntityLivingBase);
|
||||
|
||||
if (par1EntityLivingBase == null)
|
||||
{
|
||||
this.setAngry(false);
|
||||
} else if (!this.isTamed())
|
||||
{
|
||||
this.setAngry(true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* main AI tick function, replaces updateEntityActionState
|
||||
*/
|
||||
protected void updateAITick()
|
||||
{
|
||||
this.dataWatcher.updateObject(18, this.getHealth());
|
||||
}
|
||||
|
||||
protected void entityInit()
|
||||
{
|
||||
super.entityInit();
|
||||
this.dataWatcher.addObject(18, this.getHealth());
|
||||
this.dataWatcher.addObject(19, 0);
|
||||
//this.dataWatcher.addObject(20, new Byte((byte) BlockColored.getBlockFromDye(1)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Plays step sound at given x, y, z for the entity
|
||||
*/
|
||||
protected void playStepSound(int par1, int par2, int par3, int par4)
|
||||
{
|
||||
this.playSound("mob.zombie.step", 0.15F, 1.0F);
|
||||
}
|
||||
|
||||
/**
|
||||
* (abstract) Protected helper method to write subclass entity data to NBT.
|
||||
*/
|
||||
public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound)
|
||||
{
|
||||
super.writeEntityToNBT(par1NBTTagCompound);
|
||||
par1NBTTagCompound.setBoolean("Angry", this.isAngry());
|
||||
par1NBTTagCompound.setByte("attackTimer", (byte) attackTimer);
|
||||
}
|
||||
|
||||
/**
|
||||
* (abstract) Protected helper method to read subclass entity data from NBT.
|
||||
*/
|
||||
public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound)
|
||||
{
|
||||
super.readEntityFromNBT(par1NBTTagCompound);
|
||||
this.setAngry(par1NBTTagCompound.getBoolean("Angry"));
|
||||
|
||||
attackTimer = par1NBTTagCompound.getByte("attackTimer");
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the sound this mob makes while it's alive.
|
||||
*/
|
||||
protected String getLivingSound()
|
||||
{
|
||||
return "none";
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the sound this mob makes when it is hurt.
|
||||
*/
|
||||
protected String getHurtSound()
|
||||
{
|
||||
return "mob.irongolem.hit";
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the sound this mob makes on death.
|
||||
*/
|
||||
protected String getDeathSound()
|
||||
{
|
||||
return "mob.irongolem.death";
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the volume for the sounds this mob makes.
|
||||
*/
|
||||
protected float getSoundVolume()
|
||||
{
|
||||
return 1.0F;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the item ID for the item the mob drops on death.
|
||||
*/
|
||||
protected int getDropItemId()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
public int getAttackTimer()
|
||||
{
|
||||
return attackTimer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called to update the entity's position/logic.
|
||||
*/
|
||||
public void onUpdate()
|
||||
{
|
||||
super.onUpdate();
|
||||
}
|
||||
|
||||
public float getEyeHeight()
|
||||
{
|
||||
return this.height * 0.8F;
|
||||
}
|
||||
|
||||
/**
|
||||
* The speed it takes to move the entityliving's rotationPitch through the faceEntity method. This is only currently
|
||||
* use in wolves.
|
||||
*/
|
||||
public int getVerticalFaceSpeed()
|
||||
{
|
||||
return this.isSitting() ? 20 : super.getVerticalFaceSpeed();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the entity is attacked.
|
||||
*/
|
||||
public boolean attackEntityFrom(DamageSource par1DamageSource, float par2)
|
||||
{
|
||||
// if (this.isEntityInvulnerable())
|
||||
// {
|
||||
// return false;
|
||||
// } else
|
||||
{
|
||||
Entity entity = par1DamageSource.getEntity();
|
||||
this.aiSit.setSitting(false);
|
||||
|
||||
if (entity != null && !(entity instanceof EntityPlayer) && !(entity instanceof EntityArrow))
|
||||
{
|
||||
par2 = (par2 + 1.0F) / 2.0F;
|
||||
}
|
||||
|
||||
return super.attackEntityFrom(par1DamageSource, par2);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean attackEntityAsMob(Entity par1Entity)
|
||||
{
|
||||
this.attackTimer = 10;
|
||||
this.worldObj.setEntityState(this, (byte) 4);
|
||||
boolean flag = par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float) (7 + this.rand.nextInt(15)));
|
||||
|
||||
if (flag)
|
||||
{
|
||||
par1Entity.motionY += 0.4000000059604645D;
|
||||
}
|
||||
|
||||
this.playSound("mob.irongolem.throw", 1.0F, 1.0F);
|
||||
return flag;
|
||||
}
|
||||
|
||||
public void setTamed(boolean par1)
|
||||
{
|
||||
super.setTamed(par1);
|
||||
|
||||
if (par1)
|
||||
{
|
||||
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(maxTamedHealth);
|
||||
} else
|
||||
{
|
||||
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(maxUntamedHealth);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig.
|
||||
*/
|
||||
@Override
|
||||
public boolean interact(EntityPlayer par1EntityPlayer)
|
||||
{
|
||||
ItemStack itemstack = par1EntityPlayer.inventory.getCurrentItem();
|
||||
|
||||
if (this.isTamed())
|
||||
{
|
||||
if (itemstack != null)
|
||||
{
|
||||
if (itemstack.getItem() instanceof ItemFood)
|
||||
{
|
||||
ItemFood itemfood = (ItemFood) itemstack.getItem();
|
||||
|
||||
if (itemfood.isWolfsFavoriteMeat() && this.dataWatcher.getWatchableObjectFloat(18) < maxTamedHealth)
|
||||
{
|
||||
if (!par1EntityPlayer.capabilities.isCreativeMode)
|
||||
{
|
||||
--itemstack.stackSize;
|
||||
}
|
||||
|
||||
this.heal((float) itemfood.getHealAmount(itemstack));
|
||||
|
||||
if (itemstack.stackSize <= 0)
|
||||
{
|
||||
par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, null);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.getOwner() instanceof EntityPlayer && SpellHelper.getUsername(par1EntityPlayer).equalsIgnoreCase(SpellHelper.getUsername((EntityPlayer) this.getOwner())) && !this.isBreedingItem(itemstack))
|
||||
{
|
||||
if (!this.worldObj.isRemote)
|
||||
{
|
||||
this.aiSit.setSitting(!this.isSitting());
|
||||
this.isJumping = false;
|
||||
// this.setPathToEntity(null);
|
||||
// this.setTarget(null);
|
||||
this.setAttackTarget(null);
|
||||
}
|
||||
|
||||
this.sendSittingMessageToPlayer(par1EntityPlayer, !this.isSitting());
|
||||
}
|
||||
} else if (itemstack != null && itemstack.getItem().equals(ModItems.weakBloodOrb) && !this.isAngry())
|
||||
{
|
||||
if (!par1EntityPlayer.capabilities.isCreativeMode)
|
||||
{
|
||||
--itemstack.stackSize;
|
||||
}
|
||||
|
||||
if (itemstack.stackSize <= 0)
|
||||
{
|
||||
par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, (ItemStack) null);
|
||||
}
|
||||
|
||||
if (!this.worldObj.isRemote)
|
||||
{
|
||||
if (this.rand.nextInt(1) == 0)
|
||||
{
|
||||
this.setTamed(true);
|
||||
// this.setPathToEntity(null);
|
||||
this.setAttackTarget(null);
|
||||
this.aiSit.setSitting(true);
|
||||
this.setHealth(maxTamedHealth);
|
||||
this.func_152115_b(par1EntityPlayer.getUniqueID().toString());
|
||||
this.playTameEffect(true);
|
||||
this.worldObj.setEntityState(this, (byte) 7);
|
||||
} else
|
||||
{
|
||||
this.playTameEffect(false);
|
||||
this.worldObj.setEntityState(this, (byte) 6);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return super.interact(par1EntityPlayer);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the parameter is an item which this animal can be fed to breed it (wheat, carrots or seeds depending on
|
||||
* the animal type)
|
||||
*/
|
||||
public boolean isBreedingItem(ItemStack par1ItemStack)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether this wolf is angry or not.
|
||||
*/
|
||||
public boolean isAngry()
|
||||
{
|
||||
return (this.dataWatcher.getWatchableObjectByte(16) & 2) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether this wolf is angry or not.
|
||||
*/
|
||||
public void setAngry(boolean par1)
|
||||
{
|
||||
byte b0 = this.dataWatcher.getWatchableObjectByte(16);
|
||||
|
||||
if (par1)
|
||||
{
|
||||
this.dataWatcher.updateObject(16, b0 | 2);
|
||||
} else
|
||||
{
|
||||
this.dataWatcher.updateObject(16, b0 & -3);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return this wolf's collar color.
|
||||
*/
|
||||
public int getCollarColor()
|
||||
{
|
||||
return this.dataWatcher.getWatchableObjectByte(20) & 15;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set this wolf's collar color.
|
||||
*/
|
||||
public void setCollarColor(int par1)
|
||||
{
|
||||
this.dataWatcher.updateObject(20, par1 & 15);
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is used when two same-species animals in 'love mode' breed to generate the new baby animal.
|
||||
*/
|
||||
public EntityWolf spawnBabyAnimal(EntityAgeable par1EntityAgeable)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public void func_70918_i(boolean par1)
|
||||
{
|
||||
if (par1)
|
||||
{
|
||||
this.dataWatcher.updateObject(19, 1);
|
||||
} else
|
||||
{
|
||||
this.dataWatcher.updateObject(19, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the mob is currently able to mate with the specified mob.
|
||||
*/
|
||||
public boolean canMateWith(EntityAnimal par1EntityAnimal)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean func_70922_bv()
|
||||
{
|
||||
return this.dataWatcher.getWatchableObjectByte(19) == 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if an entity can be despawned, used on idle far away entities
|
||||
*/
|
||||
protected boolean canDespawn()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean func_142018_a(EntityLivingBase par1EntityLivingBase, EntityLivingBase par2EntityLivingBase)
|
||||
{
|
||||
if (!(par1EntityLivingBase instanceof EntityCreeper) && !(par1EntityLivingBase instanceof EntityGhast))
|
||||
{
|
||||
if (par1EntityLivingBase instanceof EntityBileDemon)
|
||||
{
|
||||
EntityBileDemon entitywolf = (EntityBileDemon) par1EntityLivingBase;
|
||||
|
||||
if (entitywolf.isTamed() && entitywolf.getOwner() == par2EntityLivingBase)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return par1EntityLivingBase instanceof EntityPlayer && par2EntityLivingBase instanceof EntityPlayer && !((EntityPlayer) par2EntityLivingBase).canAttackPlayer((EntityPlayer) par1EntityLivingBase) ? false : !(par1EntityLivingBase instanceof EntityHorse) || !((EntityHorse) par1EntityLivingBase).isTame();
|
||||
} else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,13 +2,13 @@ package WayofTime.alchemicalWizardry.common.entity.mob;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.ai.EntityAIAttackOnCollide;
|
||||
import net.minecraft.entity.monster.EntityCreeper;
|
||||
import net.minecraft.entity.monster.EntityGhast;
|
||||
import net.minecraft.entity.passive.EntityAnimal;
|
||||
import net.minecraft.entity.passive.EntityHorse;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.projectile.EntityArrow;
|
||||
|
@ -16,11 +16,14 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.ModItems;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class EntityElemental extends EntityDemon
|
||||
{
|
||||
|
@ -81,57 +84,60 @@ public class EntityElemental extends EntityDemon
|
|||
/**
|
||||
* Moves the entity based on the specified heading. Args: strafe, forward
|
||||
*/
|
||||
public void moveEntityWithHeading(float par1, float par2)
|
||||
public void moveEntityWithHeading(float p_70612_1_, float p_70612_2_)
|
||||
{
|
||||
if (this.isInWater())
|
||||
{
|
||||
this.moveFlying(par1, par2, 0.02F);
|
||||
this.moveFlying(p_70612_1_, p_70612_2_, 0.02F);
|
||||
this.moveEntity(this.motionX, this.motionY, this.motionZ);
|
||||
this.motionX *= 0.800000011920929D;
|
||||
this.motionY *= 0.800000011920929D;
|
||||
this.motionZ *= 0.800000011920929D;
|
||||
} else if (this.handleLavaMovement())
|
||||
}
|
||||
else if (this.isInLava())
|
||||
{
|
||||
this.moveFlying(par1, par2, 0.02F);
|
||||
this.moveFlying(p_70612_1_, p_70612_2_, 0.02F);
|
||||
this.moveEntity(this.motionX, this.motionY, this.motionZ);
|
||||
this.motionX *= 0.5D;
|
||||
this.motionY *= 0.5D;
|
||||
this.motionZ *= 0.5D;
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
float f2 = 0.91F;
|
||||
|
||||
if (this.onGround)
|
||||
{
|
||||
f2 = 0.54600006F;
|
||||
Block i = this.worldObj.getBlock(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.boundingBox.minY) - 1, MathHelper.floor_double(this.posZ));
|
||||
|
||||
if (i != null)
|
||||
{
|
||||
f2 = i.slipperiness * 0.91F;
|
||||
}
|
||||
f2 = this.worldObj.getBlockState(new BlockPos(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.getEntityBoundingBox().minY) - 1, MathHelper.floor_double(this.posZ))).getBlock().slipperiness * 0.91F;
|
||||
}
|
||||
|
||||
float f3 = 0.16277136F / (f2 * f2 * f2);
|
||||
this.moveFlying(par1, par2, this.onGround ? 0.1F * f3 : 0.02F);
|
||||
this.moveFlying(p_70612_1_, p_70612_2_, this.onGround ? 0.1F * f3 : 0.02F);
|
||||
f2 = 0.91F;
|
||||
|
||||
if (this.onGround)
|
||||
{
|
||||
f2 = 0.54600006F;
|
||||
Block j = this.worldObj.getBlock(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.boundingBox.minY) - 1, MathHelper.floor_double(this.posZ));
|
||||
|
||||
if (j != null)
|
||||
{
|
||||
f2 = j.slipperiness * 0.91F;
|
||||
}
|
||||
f2 = this.worldObj.getBlockState(new BlockPos(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.getEntityBoundingBox().minY) - 1, MathHelper.floor_double(this.posZ))).getBlock().slipperiness * 0.91F;
|
||||
}
|
||||
|
||||
this.moveEntity(this.motionX, this.motionY, this.motionZ);
|
||||
this.motionX *= (double) f2;
|
||||
this.motionY *= (double) f2;
|
||||
this.motionZ *= (double) f2;
|
||||
this.motionX *= (double)f2;
|
||||
this.motionY *= (double)f2;
|
||||
this.motionZ *= (double)f2;
|
||||
}
|
||||
|
||||
this.prevLimbSwingAmount = this.limbSwingAmount;
|
||||
double d1 = this.posX - this.prevPosX;
|
||||
double d0 = this.posZ - this.prevPosZ;
|
||||
float f4 = MathHelper.sqrt_double(d1 * d1 + d0 * d0) * 4.0F;
|
||||
|
||||
if (f4 > 1.0F)
|
||||
{
|
||||
f4 = 1.0F;
|
||||
}
|
||||
|
||||
this.limbSwingAmount += (f4 - this.limbSwingAmount) * 0.4F;
|
||||
this.limbSwing += this.limbSwingAmount;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -142,115 +148,10 @@ public class EntityElemental extends EntityDemon
|
|||
return false;
|
||||
}
|
||||
|
||||
protected void updateEntityActionState()
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean func_110182_bF()
|
||||
{
|
||||
if (this.getHealth() <= this.getMaxHealth() / 2.0f && worldObj.rand.nextInt(200) == 0)
|
||||
{
|
||||
this.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionReciprocation.id, 100, 1));
|
||||
}
|
||||
|
||||
this.prevAttackCounter = this.attackCounter;
|
||||
double d0 = this.waypointX - this.posX;
|
||||
double d1 = this.waypointY - this.posY;
|
||||
double d2 = this.waypointZ - this.posZ;
|
||||
double d3 = d0 * d0 + d1 * d1 + d2 * d2;
|
||||
|
||||
if (d3 < 1.0D || d3 > 3600.0D)
|
||||
{
|
||||
this.waypointX = this.posX + (double) ((this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F);
|
||||
this.waypointY = this.posY + (double) ((this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F);
|
||||
this.waypointZ = this.posZ + (double) ((this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F);
|
||||
}
|
||||
|
||||
if (this.courseChangeCooldown-- <= 0)
|
||||
{
|
||||
this.courseChangeCooldown += this.rand.nextInt(5) + 2;
|
||||
d3 = (double) MathHelper.sqrt_double(d3);
|
||||
|
||||
if (this.isCourseTraversable(this.waypointX, this.waypointY, this.waypointZ, d3))
|
||||
{
|
||||
this.motionX += d0 / d3 * 0.1D;
|
||||
this.motionY += d1 / d3 * 0.1D;
|
||||
this.motionZ += d2 / d3 * 0.1D;
|
||||
} else
|
||||
{
|
||||
this.waypointX = this.posX + (double) ((this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F);
|
||||
this.waypointY = this.posY + (double) ((this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F);
|
||||
this.waypointZ = this.posZ + (double) ((this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.targetedEntity != null && this.targetedEntity.isDead)
|
||||
{
|
||||
this.targetedEntity = null;
|
||||
}
|
||||
|
||||
if (this.targetedEntity == null || this.aggroCooldown-- <= 0)
|
||||
{
|
||||
this.targetedEntity = getClosestVulnerableMonsterToEntity(this, 100.0D);
|
||||
|
||||
if (this.targetedEntity != null)
|
||||
{
|
||||
this.aggroCooldown = 20;
|
||||
}
|
||||
}
|
||||
|
||||
double d4 = 64.0D;
|
||||
|
||||
if (this.targetedEntity != null && this.targetedEntity.getDistanceSqToEntity(this) < d4 * d4)
|
||||
{
|
||||
double d5 = this.targetedEntity.posX - this.posX;
|
||||
double d6 = this.targetedEntity.boundingBox.minY + (double) (this.targetedEntity.height / 2.0F) - (this.posY + (double) (this.height / 2.0F));
|
||||
double d7 = this.targetedEntity.posZ - this.posZ;
|
||||
this.renderYawOffset = this.rotationYaw = -((float) Math.atan2(d5, d7)) * 180.0F / (float) Math.PI;
|
||||
|
||||
if (this.courseChangeCooldown <= 0)
|
||||
{
|
||||
if (isCourseTraversable(this.targetedEntity.posX, this.targetedEntity.posY, this.targetedEntity.posZ, Math.sqrt(d5 * d5 + d6 * d6 + d7 * d7)))
|
||||
{
|
||||
this.waypointX = this.targetedEntity.posX;
|
||||
this.waypointY = this.targetedEntity.posY;
|
||||
this.waypointZ = this.targetedEntity.posZ;
|
||||
this.motionX += d5 / d3 * 0.1D;
|
||||
this.motionY += d6 / d3 * 0.1D;
|
||||
this.motionZ += d7 / d3 * 0.1D;
|
||||
} else
|
||||
{
|
||||
this.waypointX = this.posX + (double) ((this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F);
|
||||
this.waypointY = this.posY + (double) ((this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F);
|
||||
this.waypointZ = this.posZ + (double) ((this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F);
|
||||
this.motionX += d5 / d3 * 0.1D;
|
||||
this.motionY += d6 / d3 * 0.1D;
|
||||
this.motionZ += d7 / d3 * 0.1D;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.canEntityBeSeen(this.targetedEntity))
|
||||
{
|
||||
if (Math.sqrt(d5 * d5 + d6 * d6 + d7 * d7) < 4)
|
||||
{
|
||||
++this.attackCounter;
|
||||
|
||||
if (this.attackCounter >= 10)
|
||||
{
|
||||
this.worldObj.playAuxSFXAtEntity(null, 1008, (int) this.posX, (int) this.posY, (int) this.posZ, 0);
|
||||
this.inflictEffectOnEntity(this.targetedEntity);
|
||||
this.attackCounter = -40;
|
||||
}
|
||||
}
|
||||
} else if (this.attackCounter > 0)
|
||||
{
|
||||
--this.attackCounter;
|
||||
}
|
||||
} else
|
||||
{
|
||||
this.renderYawOffset = this.rotationYaw = -((float) Math.atan2(motionX, this.motionZ)) * 180.0F / (float) Math.PI;
|
||||
|
||||
if (this.attackCounter > 0)
|
||||
{
|
||||
--this.attackCounter;
|
||||
}
|
||||
}
|
||||
return this.dataWatcher.getWatchableObjectByte(25) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -261,7 +162,7 @@ public class EntityElemental extends EntityDemon
|
|||
double d4 = (this.waypointX - this.posX) / par7;
|
||||
double d5 = (this.waypointY - this.posY) / par7;
|
||||
double d6 = (this.waypointZ - this.posZ) / par7;
|
||||
AxisAlignedBB axisalignedbb = this.boundingBox.copy();
|
||||
AxisAlignedBB axisalignedbb = this.getBoundingBox();
|
||||
|
||||
for (int i = 1; (double) i < par7; ++i)
|
||||
{
|
||||
|
@ -298,6 +199,7 @@ public class EntityElemental extends EntityDemon
|
|||
public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound)
|
||||
{
|
||||
super.readEntityFromNBT(par1NBTTagCompound);
|
||||
this.setAngry(par1NBTTagCompound.getBoolean("Angry"));
|
||||
|
||||
this.setCombatTask();
|
||||
}
|
||||
|
@ -333,6 +235,14 @@ public class EntityElemental extends EntityDemon
|
|||
public void setAttackTarget(EntityLivingBase par1EntityLivingBase)
|
||||
{
|
||||
super.setAttackTarget(par1EntityLivingBase);
|
||||
|
||||
if (par1EntityLivingBase == null)
|
||||
{
|
||||
this.setAngry(false);
|
||||
} else if (!this.isTamed())
|
||||
{
|
||||
this.setAngry(true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -348,6 +258,7 @@ public class EntityElemental extends EntityDemon
|
|||
super.entityInit();
|
||||
this.dataWatcher.addObject(18, this.getHealth());
|
||||
this.dataWatcher.addObject(19, 0);
|
||||
this.dataWatcher.addObject(25, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -392,12 +303,11 @@ public class EntityElemental extends EntityDemon
|
|||
}
|
||||
|
||||
/**
|
||||
* Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons
|
||||
* use this to react to sunlight and start to burn.
|
||||
* Returns the item ID for the item the mob drops on death.
|
||||
*/
|
||||
public void onLivingUpdate()
|
||||
protected int getDropItemId()
|
||||
{
|
||||
super.onLivingUpdate();
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -406,6 +316,11 @@ public class EntityElemental extends EntityDemon
|
|||
public void onUpdate()
|
||||
{
|
||||
super.onUpdate();
|
||||
|
||||
if (this.getHealth() <= this.getMaxHealth() / 2.0f && worldObj.rand.nextInt(200) == 0)
|
||||
{
|
||||
this.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionReciprocation.id, 100, 1));
|
||||
}
|
||||
}
|
||||
|
||||
public float getEyeHeight()
|
||||
|
@ -425,14 +340,14 @@ public class EntityElemental extends EntityDemon
|
|||
/**
|
||||
* Called when the entity is attacked.
|
||||
*/
|
||||
public boolean attackEntityFrom(DamageSource par1DamageSource, float par2)
|
||||
public boolean attackEntityFrom(DamageSource source, float par2)
|
||||
{
|
||||
if (this.isEntityInvulnerable())
|
||||
if (this.func_180431_b(source))
|
||||
{
|
||||
return false;
|
||||
} else
|
||||
{
|
||||
Entity entity = par1DamageSource.getEntity();
|
||||
Entity entity = source.getEntity();
|
||||
this.aiSit.setSitting(false);
|
||||
|
||||
if (entity != null && !(entity instanceof EntityPlayer) && !(entity instanceof EntityArrow))
|
||||
|
@ -440,7 +355,7 @@ public class EntityElemental extends EntityDemon
|
|||
par2 = (par2 + 1.0F) / 2.0F;
|
||||
}
|
||||
|
||||
return super.attackEntityFrom(par1DamageSource, par2);
|
||||
return super.attackEntityFrom(source, par2);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -476,6 +391,54 @@ public class EntityElemental extends EntityDemon
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether this wolf is angry or not.
|
||||
*/
|
||||
public boolean isAngry()
|
||||
{
|
||||
return (this.dataWatcher.getWatchableObjectByte(16) & 2) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether this wolf is angry or not.
|
||||
*/
|
||||
public void setAngry(boolean par1)
|
||||
{
|
||||
byte b0 = this.dataWatcher.getWatchableObjectByte(16);
|
||||
|
||||
if (par1)
|
||||
{
|
||||
this.dataWatcher.updateObject(16, b0 | 2);
|
||||
} else
|
||||
{
|
||||
this.dataWatcher.updateObject(16, b0 & -3);
|
||||
}
|
||||
}
|
||||
|
||||
public void func_70918_i(boolean par1)
|
||||
{
|
||||
if (par1)
|
||||
{
|
||||
this.dataWatcher.updateObject(19, 1);
|
||||
} else
|
||||
{
|
||||
this.dataWatcher.updateObject(19, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the mob is currently able to mate with the specified mob.
|
||||
*/
|
||||
public boolean canMateWith(EntityAnimal par1EntityAnimal)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean func_70922_bv()
|
||||
{
|
||||
return this.dataWatcher.getWatchableObjectByte(19) == 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if an entity can be despawned, used on idle far away entities
|
||||
*/
|
||||
|
@ -536,7 +499,7 @@ public class EntityElemental extends EntityDemon
|
|||
|
||||
double range = Math.sqrt(par2);
|
||||
double verticalRange = Math.sqrt(par2);
|
||||
List<EntityLivingBase> entities = world.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(par1 - 0.5f, par3 - 0.5f, par5 - 0.5f, par1 + 0.5f, par3 + 0.5f, par5 + 0.5f).expand(range, verticalRange, range));
|
||||
List<EntityLivingBase> entities = world.getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(par1 - 0.5f, par3 - 0.5f, par5 - 0.5f, par1 + 0.5f, par3 + 0.5f, par5 + 0.5f).expand(range, verticalRange, range));
|
||||
if (entities == null)
|
||||
{
|
||||
return null;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue