Initial stab at 1.11

About halfway.
This commit is contained in:
Nicholas Ignoffo 2016-12-12 19:56:36 -08:00
parent ce52aea512
commit 00d6f8eb46
157 changed files with 1036 additions and 1554 deletions

View file

@ -45,7 +45,6 @@ if (new File(projectDir, '.git').exists())
repositories { repositories {
maven { url "http://dvs1.progwml6.com/files/maven" } maven { url "http://dvs1.progwml6.com/files/maven" }
maven { url "http://mobiusstrip.eu/maven" }
maven { url "http://tehnut.info/maven" } maven { url "http://tehnut.info/maven" }
ivy { ivy {
@ -60,9 +59,8 @@ repositories {
dependencies { dependencies {
deobfCompile "mezz.jei:jei_${mc_version}:${jei_version}" deobfCompile "mezz.jei:jei_${mc_version}:${jei_version}"
deobfCompile "mcp.mobius.waila:Waila:${waila_version}_${mc_version}:dev" deobfCompile "mcp.mobius.waila:Hwyla:${waila_version}_${mc_version}"
deobfCompile "info.amerifrance.guideapi:Guide-API:${mc_version}-${guideapi_version}" deobfCompile "info.amerifrance.guideapi:Guide-API:${mc_version}-${guideapi_version}"
deobfCompile "info.tehnut.buttons:Buttons:${buttons_version}:api"
// compile name: "Thaumcraft", version: "${mc_version}-${thaumcraft_version}", ext: "jar" // compile name: "Thaumcraft", version: "${mc_version}-${thaumcraft_version}", ext: "jar"
// compile name: 'Baubles', version: "${baubles_version}", ext: 'jar' // compile name: 'Baubles', version: "${baubles_version}", ext: 'jar'

View file

@ -1,15 +1,12 @@
mod_name=BloodMagic mod_name=BloodMagic
package_group=com.wayoftime.bloodmagic package_group=com.wayoftime.bloodmagic
mod_version=2.1.0 mod_version=2.1.0
mc_version=1.9.4 mc_version=1.11
forge_version=12.17.0.1957 forge_version=13.19.1.2189
curse_id=224791 curse_id=224791
mappings_version=snapshot_20160518 mappings_version=snapshot_20161212
jei_version=3.6.8.225 jei_version=4.0.5.203
waila_version=1.7.0-B3 waila_version=1.8.5-B19
thaumcraft_version=5.1.5 guideapi_version=2.1.0-47
baubles_version=1.1.3.0
guideapi_version=2.0.0-37
buttons_version=1.10.2-0.0.3-3

View file

@ -1,15 +1,13 @@
package WayofTime.bloodmagic; package WayofTime.bloodmagic;
import java.io.File; import java.io.File;
import java.util.Map;
import WayofTime.bloodmagic.meteor.MeteorConfigHandler; import WayofTime.bloodmagic.meteor.MeteorConfigHandler;
import lombok.Getter; import lombok.Getter;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item; import net.minecraft.item.ItemStack;
import net.minecraft.launchwrapper.Launch; import net.minecraft.launchwrapper.Launch;
import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.SidedProxy; import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLInitializationEvent;
@ -25,7 +23,6 @@ import WayofTime.bloodmagic.api.util.helper.LogHelper;
import WayofTime.bloodmagic.client.gui.GuiHandler; import WayofTime.bloodmagic.client.gui.GuiHandler;
import WayofTime.bloodmagic.command.CommandBloodMagic; import WayofTime.bloodmagic.command.CommandBloodMagic;
import WayofTime.bloodmagic.compat.ICompatibility; import WayofTime.bloodmagic.compat.ICompatibility;
import WayofTime.bloodmagic.compat.minecraft.ICrossVersionProxy;
import WayofTime.bloodmagic.network.BloodMagicPacketHandler; import WayofTime.bloodmagic.network.BloodMagicPacketHandler;
import WayofTime.bloodmagic.proxy.CommonProxy; import WayofTime.bloodmagic.proxy.CommonProxy;
import WayofTime.bloodmagic.registry.ModArmourTrackers; import WayofTime.bloodmagic.registry.ModArmourTrackers;
@ -42,8 +39,6 @@ import WayofTime.bloodmagic.structures.ModDungeons;
import WayofTime.bloodmagic.util.Utils; import WayofTime.bloodmagic.util.Utils;
import WayofTime.bloodmagic.util.handler.IMCHandler; import WayofTime.bloodmagic.util.handler.IMCHandler;
import com.google.common.collect.ImmutableMap;
@Mod(modid = Constants.Mod.MODID, name = Constants.Mod.NAME, version = Constants.Mod.VERSION, dependencies = Constants.Mod.DEPEND, guiFactory = "WayofTime.bloodmagic.client.gui.config.ConfigGuiFactory") @Mod(modid = Constants.Mod.MODID, name = Constants.Mod.NAME, version = Constants.Mod.VERSION, dependencies = Constants.Mod.DEPEND, guiFactory = "WayofTime.bloodmagic.client.gui.config.ConfigGuiFactory")
@Getter @Getter
public class BloodMagic public class BloodMagic
@ -57,18 +52,18 @@ public class BloodMagic
public static CreativeTabs tabBloodMagic = new CreativeTabs(Constants.Mod.MODID + ".creativeTab") public static CreativeTabs tabBloodMagic = new CreativeTabs(Constants.Mod.MODID + ".creativeTab")
{ {
@Override @Override
public Item getTabIconItem() public ItemStack getTabIconItem()
{ {
return ModItems.BLOOD_ORB; return new ItemStack(ModItems.BLOOD_ORB);
} }
}; };
public static CreativeTabs tabUpgradeTome = new CreativeTabs(Constants.Mod.MODID + ".creativeTabTome") public static CreativeTabs tabUpgradeTome = new CreativeTabs(Constants.Mod.MODID + ".creativeTabTome")
{ {
@Override @Override
public Item getTabIconItem() public ItemStack getTabIconItem()
{ {
return ModItems.UPGRADE_TOME; return new ItemStack(ModItems.UPGRADE_TOME);
} }
@Override @Override
@ -76,32 +71,13 @@ public class BloodMagic
{ {
return true; return true;
} }
}; }.setNoTitle().setBackgroundImageName("upgrade_tomes.png");
@Getter @Getter
private static boolean isDev = (Boolean) Launch.blackboard.get("fml.deobfuscatedEnvironment"); private static boolean isDev = (Boolean) Launch.blackboard.get("fml.deobfuscatedEnvironment");
@Getter
private static ICrossVersionProxy crossVersionProxy;
private static final Map<String, String> PROXY_MAP = ImmutableMap.of("1.9.4", "WayofTime.bloodmagic.compat.minecraft.CrossVersionProxy19", "1.10", "WayofTime.bloodmagic.compat.minecraft.CrossVersionProxy110", "1.10.2", "WayofTime.bloodmagic.compat.minecraft.CrossVersionProxy110");
static static
{ {
try
{
String mcVersion = (String) Loader.class.getDeclaredField("MC_VERSION").get(null);
if (!PROXY_MAP.containsKey(mcVersion))
throw new IllegalStateException("Blood Magic couldn't find a cross version proxy!");
Class proxyClass = Class.forName(PROXY_MAP.get(mcVersion));
crossVersionProxy = (ICrossVersionProxy) proxyClass.newInstance();
}
catch (Exception e)
{
throw new IllegalArgumentException("Blood Magic could not find a cross version proxy!", e);
}
tabUpgradeTome.setNoTitle().setBackgroundImageName("upgrade_tomes.png"); tabUpgradeTome.setNoTitle().setBackgroundImageName("upgrade_tomes.png");
FluidRegistry.enableUniversalBucket(); FluidRegistry.enableUniversalBucket();

View file

@ -15,7 +15,7 @@ import net.minecraftforge.oredict.OreDictionary;
public class AlchemyTableRecipe public class AlchemyTableRecipe
{ {
protected ItemStack output = null; protected ItemStack output = null;
protected ArrayList<Object> input = new ArrayList<Object>(); protected ArrayList<ItemStack> input = new ArrayList<ItemStack>();
@Getter @Getter
protected int lpDrained; protected int lpDrained;
@Getter @Getter
@ -148,7 +148,7 @@ public class AlchemyTableRecipe
* *
* @return The recipes input vales. * @return The recipes input vales.
*/ */
public ArrayList<Object> getInput() public ArrayList<ItemStack> getInput()
{ {
return this.input; return this.input;
} }

View file

@ -5,6 +5,7 @@ import WayofTime.bloodmagic.api.ritual.Ritual;
import com.google.common.collect.BiMap; import com.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap; import com.google.common.collect.HashBiMap;
import javax.annotation.Nullable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@ -57,6 +58,7 @@ public class RitualRegistry
registerRitual(ritual, ritual.getName()); registerRitual(ritual, ritual.getName());
} }
@Nullable
public static Ritual getRitualForId(String id) public static Ritual getRitualForId(String id)
{ {
Ritual ritual = registry.get(id); Ritual ritual = registry.get(id);

View file

@ -33,6 +33,6 @@ public class TeleporterBloodMagic extends Teleporter
@Override @Override
public void placeInPortal(Entity entity, float rotationYaw) public void placeInPortal(Entity entity, float rotationYaw)
{ {
entity.setLocationAndAngles(MathHelper.floor_double(entity.posX), MathHelper.floor_double(entity.posY) + 2, MathHelper.floor_double(entity.posZ), entity.rotationYaw, entity.rotationPitch); entity.setLocationAndAngles(MathHelper.floor(entity.posX), MathHelper.floor(entity.posY) + 2, MathHelper.floor(entity.posZ), entity.rotationYaw, entity.rotationPitch);
} }
} }

View file

@ -27,6 +27,7 @@ import net.minecraft.util.math.Vec3d;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.ForgeModContainer;
import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ArrayUtils;
import WayofTime.bloodmagic.BloodMagic; import WayofTime.bloodmagic.BloodMagic;
@ -368,7 +369,7 @@ public class BlockEnumStairs<E extends Enum<E> & IStringSerializable> extends Bl
@Override @Override
public boolean doesSideBlockRendering(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing face) public boolean doesSideBlockRendering(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing face)
{ {
if (BloodMagic.getCrossVersionProxy().disableStairSlabCulling()) if (ForgeModContainer.disableStairSlabCulling)
return super.doesSideBlockRendering(state, world, pos, face); return super.doesSideBlockRendering(state, world, pos, face);
if (state.isOpaqueCube()) if (state.isOpaqueCube())

View file

@ -1,25 +0,0 @@
package WayofTime.bloodmagic.compat.buttons;
import WayofTime.bloodmagic.compat.buttons.button.ButtonFillNetwork;
import net.minecraft.util.ResourceLocation;
import tehnut.buttons.api.ButtonsPlugin;
import tehnut.buttons.api.IWidgetPlugin;
import tehnut.buttons.api.IWidgetRegistry;
import tehnut.buttons.api.WidgetTexture;
@ButtonsPlugin
public class BloodMagicPlugin extends IWidgetPlugin.Base {
public static final WidgetTexture FILL_BUTTON = new WidgetTexture(
new ResourceLocation("bloodmagic", "textures/gui/buttons_compat.png"),
0,
0,
20,
20
);
@Override
public void register(IWidgetRegistry widgetRegistry) {
widgetRegistry.addUtilityButton(new ButtonFillNetwork());
}
}

View file

@ -1,41 +0,0 @@
package WayofTime.bloodmagic.compat.buttons.button;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.saving.SoulNetwork;
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
import WayofTime.bloodmagic.compat.buttons.BloodMagicPlugin;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentTranslation;
import tehnut.buttons.api.button.utility.Button;
import javax.annotation.Nullable;
import java.util.Collections;
import java.util.List;
public class ButtonFillNetwork extends Button {
public ButtonFillNetwork() {
super(BloodMagicPlugin.FILL_BUTTON);
setServerRequired();
}
@Nullable
@Override
public List<? extends ITextComponent> getTooltip() {
return Collections.singletonList(new TextComponentTranslation("button.bloodmagic.tooltip.fill"));
}
@Override
public void onServerClick(EntityPlayerMP player) {
SoulNetwork network = NetworkHelper.getSoulNetwork(player);
network.setCurrentEssence(Integer.MAX_VALUE);
}
@Override
public ResourceLocation getButtonId() {
return new ResourceLocation(Constants.Mod.MODID, "button_fillnetwork");
}
}

View file

@ -1,70 +0,0 @@
package WayofTime.bloodmagic.compat.guideapi;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.item.crafting.IRecipe;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.relauncher.Side;
import WayofTime.bloodmagic.compat.ICompatibility;
import amerifrance.guideapi.api.GuideAPI;
import net.minecraftforge.oredict.ShapelessOreRecipe;
public class CompatibilityGuideAPI implements ICompatibility
{
private static IRecipe guideRecipe = null;
private static boolean worldFlag;
@Override
public void loadCompatibility(InitializationPhase phase)
{
switch (phase)
{
case PRE_INIT:
{
GuideBloodMagic.initBook();
GameRegistry.register(GuideBloodMagic.guideBook);
if (FMLCommonHandler.instance().getSide() == Side.CLIENT)
GuideAPI.setModel(GuideBloodMagic.guideBook);
break;
}
case INIT:
{
guideRecipe = new ShapelessOreRecipe(GuideAPI.getStackFromBook(GuideBloodMagic.guideBook), new ItemStack(Items.BOOK), Blocks.GLASS, Items.FEATHER);
break;
}
case POST_INIT:
{
if (FMLCommonHandler.instance().getSide() == Side.CLIENT)
GuideBloodMagic.initCategories();
break;
}
case MAPPING:
{
if (!worldFlag) {
GameRegistry.addRecipe(guideRecipe);
worldFlag = true;
} else {
CraftingManager.getInstance().getRecipeList().remove(guideRecipe);
worldFlag = false;
}
break;
}
}
}
@Override
public String getModId()
{
return "guideapi";
}
@Override
public boolean enableCompat()
{
return true;
}
}

View file

@ -1,50 +1,56 @@
package WayofTime.bloodmagic.compat.guideapi; package WayofTime.bloodmagic.compat.guideapi;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.compat.guideapi.book.*; import WayofTime.bloodmagic.compat.guideapi.book.*;
import WayofTime.bloodmagic.compat.jei.BloodMagicPlugin;
import WayofTime.bloodmagic.registry.ModBlocks; import WayofTime.bloodmagic.registry.ModBlocks;
import WayofTime.bloodmagic.registry.ModItems; import WayofTime.bloodmagic.registry.ModItems;
import amerifrance.guideapi.api.GuideAPI; import amerifrance.guideapi.api.GuideAPI;
import amerifrance.guideapi.api.GuideBook;
import amerifrance.guideapi.api.IGuideBook;
import amerifrance.guideapi.api.impl.Book; import amerifrance.guideapi.api.impl.Book;
import amerifrance.guideapi.api.util.NBTBookTags;
import amerifrance.guideapi.category.CategoryItemStack; import amerifrance.guideapi.category.CategoryItemStack;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.oredict.ShapelessOreRecipe;
import javax.annotation.Nullable;
import java.awt.Color; import java.awt.Color;
public class GuideBloodMagic @GuideBook
public class GuideBloodMagic implements IGuideBook
{ {
public static Book guideBook; public static Book guideBook;
public static void initBook() @Nullable
{ @Override
public Book buildBook() {
guideBook = new Book(); guideBook = new Book();
guideBook.setTitle("guide.BloodMagic.title"); guideBook.setTitle("guide.BloodMagic.title");
guideBook.setDisplayName("guide.BloodMagic.display"); guideBook.setDisplayName("guide.BloodMagic.display");
guideBook.setWelcomeMessage("guide.BloodMagic.welcome"); guideBook.setWelcomeMessage("guide.BloodMagic.welcome");
guideBook.setAuthor("guide.BloodMagic.author"); guideBook.setAuthor("guide.BloodMagic.author");
guideBook.setRegistryName("BloodMagic"); guideBook.setRegistryName(new ResourceLocation(Constants.Mod.MODID, "guide"));
guideBook.setColor(Color.RED); guideBook.setColor(Color.RED);
if (FMLCommonHandler.instance().getSide() == Side.CLIENT) return guideBook;
}
@Override
public void handleModel(ItemStack bookStack) {
GuideAPI.setModel(guideBook); GuideAPI.setModel(guideBook);
} }
public static void initCategories() @Override
{ public void handlePost(ItemStack bookStack) {
guideBook.addCategory(new CategoryItemStack(CategoryAlchemy.buildCategory(), "guide.BloodMagic.category.alchemy", new ItemStack(ModItems.ARCANE_ASHES))); guideBook.addCategory(new CategoryItemStack(CategoryAlchemy.buildCategory(), "guide.BloodMagic.category.alchemy", new ItemStack(ModItems.ARCANE_ASHES)));
guideBook.addCategory(new CategoryItemStack(CategoryArchitect.buildCategory(), "guide.BloodMagic.category.architect", new ItemStack(ModItems.SIGIL_DIVINATION))); guideBook.addCategory(new CategoryItemStack(CategoryArchitect.buildCategory(), "guide.BloodMagic.category.architect", new ItemStack(ModItems.SIGIL_DIVINATION)));
guideBook.addCategory(new CategoryItemStack(CategoryDemon.buildCategory(), "guide.BloodMagic.category.demon", new ItemStack(ModItems.BLOOD_SHARD))); guideBook.addCategory(new CategoryItemStack(CategoryDemon.buildCategory(), "guide.BloodMagic.category.demon", new ItemStack(ModItems.BLOOD_SHARD)));
guideBook.addCategory(new CategoryItemStack(CategoryRitual.buildCategory(), "guide.BloodMagic.category.ritual", new ItemStack(ModBlocks.RITUAL_CONTROLLER))); guideBook.addCategory(new CategoryItemStack(CategoryRitual.buildCategory(), "guide.BloodMagic.category.ritual", new ItemStack(ModBlocks.RITUAL_CONTROLLER)));
// guideBook.addCategory(new CategoryItemStack(CategorySpell.buildCategory(), "guide.BloodMagic.category.spell", new ItemStack(ModItems.ritualDiviner))); // guideBook.addCategory(new CategoryItemStack(CategorySpell.buildCategory(), "guide.BloodMagic.category.spell", new ItemStack(ModItems.ritualDiviner)));
}
public static void initJEIBlacklist() GameRegistry.addRecipe(new ShapelessOreRecipe(GuideAPI.getStackFromBook(GuideBloodMagic.guideBook), new ItemStack(Items.BOOK), Blocks.GLASS, Items.FEATHER));
{
if (Loader.isModLoaded("JEI"))
BloodMagicPlugin.jeiHelper.getNbtIgnoreList().ignoreNbtTagNames(GuideAPI.guideBook, NBTBookTags.BOOK_TAG, NBTBookTags.CATEGORY_PAGE_TAG, NBTBookTags.CATEGORY_TAG, NBTBookTags.ENTRY_PAGE_TAG, NBTBookTags.ENTRY_TAG, NBTBookTags.KEY_TAG, NBTBookTags.PAGE_TAG);
} }
} }

View file

@ -2,6 +2,7 @@ package WayofTime.bloodmagic.compat.guideapi.page;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections;
import java.util.List; import java.util.List;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
@ -32,17 +33,17 @@ public class PageAlchemyArray extends Page
public PageAlchemyArray(List<ResourceLocation> resources, ItemStack inputStack, ItemStack catalystStack) public PageAlchemyArray(List<ResourceLocation> resources, ItemStack inputStack, ItemStack catalystStack)
{ {
this(resources, inputStack, catalystStack, null); this(resources, inputStack, catalystStack, ItemStack.EMPTY);
} }
public PageAlchemyArray(ResourceLocation resource, ItemStack inputStack, ItemStack catalystStack, ItemStack outputStack) public PageAlchemyArray(ResourceLocation resource, ItemStack inputStack, ItemStack catalystStack, ItemStack outputStack)
{ {
this(Arrays.asList(resource), inputStack, catalystStack, outputStack); this(Collections.singletonList(resource), inputStack, catalystStack, outputStack);
} }
public PageAlchemyArray(ResourceLocation resource, ItemStack inputStack, ItemStack catalystStack) public PageAlchemyArray(ResourceLocation resource, ItemStack inputStack, ItemStack catalystStack)
{ {
this(Arrays.asList(resource), inputStack, catalystStack); this(Collections.singletonList(resource), inputStack, catalystStack);
} }
@Override @Override
@ -53,7 +54,7 @@ public class PageAlchemyArray extends Page
int y = guiTop + 30; int y = guiTop + 30;
Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("bloodmagicguide" + ":textures/gui/alchemyArrayCrafting.png")); Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("bloodmagicguide" + ":textures/gui/alchemyArrayCrafting.png"));
guiBase.drawTexturedModalRect(x, y, 0, 0, 62, 88 + (outputStack == null ? 0 : 26)); guiBase.drawTexturedModalRect(x, y, 0, 0, 62, 88 + (outputStack.isEmpty() ? 0 : 26));
guiBase.drawCenteredString(fontRenderer, TextHelper.localize("guide.BloodMagic.page.alchemyArray"), guiLeft + guiBase.xSize / 2, guiTop + 12, 0); guiBase.drawCenteredString(fontRenderer, TextHelper.localize("guide.BloodMagic.page.alchemyArray"), guiLeft + guiBase.xSize / 2, guiTop + 12, 0);
@ -85,7 +86,7 @@ public class PageAlchemyArray extends Page
guiBase.renderToolTip(catalystStack, mouseX, mouseY); guiBase.renderToolTip(catalystStack, mouseX, mouseY);
} }
if (outputStack != null) if (!outputStack.isEmpty())
{ {
int outputX = x + 43; int outputX = x + 43;
int outputY = y + 95; int outputY = y + 95;

View file

@ -53,7 +53,7 @@ public class PageAltarRecipe extends Page
guiBase.renderToolTip(input.get(0), mouseX, mouseY); guiBase.renderToolTip(input.get(0), mouseX, mouseY);
} }
if (output == null) if (output.isEmpty())
{ {
output = new ItemStack(Blocks.BARRIER); output = new ItemStack(Blocks.BARRIER);
} }

View file

@ -1,12 +1,15 @@
package WayofTime.bloodmagic.compat.jei.alchemyArray; package WayofTime.bloodmagic.compat.jei.alchemyArray;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import mezz.jei.api.gui.IDrawable; import mezz.jei.api.gui.IDrawable;
import mezz.jei.api.gui.IRecipeLayout; import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.IRecipeCategory; import mezz.jei.api.recipe.IRecipeCategory;
import mezz.jei.api.recipe.IRecipeWrapper; import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import WayofTime.bloodmagic.api.Constants; import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.compat.jei.BloodMagicPlugin; import WayofTime.bloodmagic.compat.jei.BloodMagicPlugin;
@ -50,14 +53,15 @@ public class AlchemyArrayCraftingCategory implements IRecipeCategory
} }
@Nullable
@Override @Override
public void drawAnimations(Minecraft minecraft) public IDrawable getIcon()
{ {
return null;
} }
@Override @Override
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper, IIngredients ingredients)
{ {
recipeLayout.getItemStacks().init(INPUT_SLOT, true, 0, 5); recipeLayout.getItemStacks().init(INPUT_SLOT, true, 0, 5);
recipeLayout.getItemStacks().init(CATALYST_SLOT, true, 29, 3); recipeLayout.getItemStacks().init(CATALYST_SLOT, true, 29, 3);
@ -66,9 +70,9 @@ public class AlchemyArrayCraftingCategory implements IRecipeCategory
if (recipeWrapper instanceof AlchemyArrayCraftingRecipeJEI) if (recipeWrapper instanceof AlchemyArrayCraftingRecipeJEI)
{ {
AlchemyArrayCraftingRecipeJEI alchemyArrayWrapper = (AlchemyArrayCraftingRecipeJEI) recipeWrapper; AlchemyArrayCraftingRecipeJEI alchemyArrayWrapper = (AlchemyArrayCraftingRecipeJEI) recipeWrapper;
recipeLayout.getItemStacks().set(INPUT_SLOT, alchemyArrayWrapper.getInputs()); recipeLayout.getItemStacks().set(INPUT_SLOT, ingredients.getInputs(ItemStack.class).get(0));
recipeLayout.getItemStacks().set(CATALYST_SLOT, alchemyArrayWrapper.getCatalyst()); recipeLayout.getItemStacks().set(CATALYST_SLOT, alchemyArrayWrapper.getCatalyst());
recipeLayout.getItemStacks().set(OUTPUT_SLOT, alchemyArrayWrapper.getOutputs()); recipeLayout.getItemStacks().set(OUTPUT_SLOT, ingredients.getOutputs(ItemStack.class).get(0).get(0));
} }
} }
} }

View file

@ -15,14 +15,6 @@ public class AlchemyArrayCraftingRecipeHandler implements IRecipeHandler<Alchemy
return AlchemyArrayCraftingRecipeJEI.class; return AlchemyArrayCraftingRecipeJEI.class;
} }
@Deprecated
@Nonnull
@Override
public String getRecipeCategoryUid()
{
return Constants.Compat.JEI_CATEGORY_ALCHEMYARRAY;
}
@Override @Override
public String getRecipeCategoryUid(@Nonnull AlchemyArrayCraftingRecipeJEI recipe) public String getRecipeCategoryUid(@Nonnull AlchemyArrayCraftingRecipeJEI recipe)
{ {

View file

@ -6,6 +6,7 @@ import java.util.List;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.BlankRecipeWrapper; import mezz.jei.api.recipe.BlankRecipeWrapper;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -27,22 +28,14 @@ public class AlchemyArrayCraftingRecipeJEI extends BlankRecipeWrapper
this.output = output; this.output = output;
} }
@Override
@Nonnull
public List<ItemStack> getInputs()
{
return inputs;
}
public ItemStack getCatalyst() public ItemStack getCatalyst()
{ {
return catalyst; return catalyst;
} }
@Override @Override
@Nonnull public void getIngredients(IIngredients ingredients) {
public List<ItemStack> getOutputs() ingredients.setOutputs(ItemStack.class, Collections.singletonList(output));
{ ingredients.setInputs(ItemStack.class, inputs);
return Collections.singletonList(output);
} }
} }

View file

@ -1,14 +1,13 @@
package WayofTime.bloodmagic.compat.jei.alchemyTable; package WayofTime.bloodmagic.compat.jei.alchemyTable;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import mezz.jei.api.gui.ICraftingGridHelper; import mezz.jei.api.gui.ICraftingGridHelper;
import mezz.jei.api.gui.IDrawable; import mezz.jei.api.gui.IDrawable;
import mezz.jei.api.gui.IGuiItemStackGroup; import mezz.jei.api.gui.IGuiItemStackGroup;
import mezz.jei.api.gui.IRecipeLayout; import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.IRecipeCategory; import mezz.jei.api.recipe.IRecipeCategory;
import mezz.jei.api.recipe.IRecipeWrapper; import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
@ -63,15 +62,16 @@ public class AlchemyTableRecipeCategory implements IRecipeCategory
} }
@Nullable
@Override @Override
public void drawAnimations(Minecraft minecraft) public IDrawable getIcon()
{ {
return null;
} }
@Override
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) @Override
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper, IIngredients ingredients)
{ {
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks(); IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
@ -90,9 +90,9 @@ public class AlchemyTableRecipeCategory implements IRecipeCategory
if (recipeWrapper instanceof AlchemyTableRecipeJEI) if (recipeWrapper instanceof AlchemyTableRecipeJEI)
{ {
AlchemyTableRecipeJEI recipe = (AlchemyTableRecipeJEI) recipeWrapper; AlchemyTableRecipeJEI recipe = (AlchemyTableRecipeJEI) recipeWrapper;
guiItemStacks.set(ORB_SLOT, (ArrayList<ItemStack>) recipe.getInputs().get(1)); guiItemStacks.set(ORB_SLOT, ingredients.getInputs(ItemStack.class).get(1));
craftingGridHelper.setOutput(guiItemStacks, recipe.getOutputs()); craftingGridHelper.setOutput(guiItemStacks, ingredients.getOutputs(ItemStack.class).get(0));
craftingGridHelper.setInput(guiItemStacks, (List) recipe.getInputs().get(0), 3, 2); craftingGridHelper.setInputs(guiItemStacks, ingredients.getInputs(ItemStack.class), 3, 2);
} }
} }
} }

View file

@ -15,14 +15,6 @@ public class AlchemyTableRecipeHandler implements IRecipeHandler<AlchemyTableRec
return AlchemyTableRecipeJEI.class; return AlchemyTableRecipeJEI.class;
} }
@Deprecated
@Nonnull
@Override
public String getRecipeCategoryUid()
{
return Constants.Compat.JEI_CATEGORY_ALCHEMYTABLE;
}
@Override @Override
public String getRecipeCategoryUid(@Nonnull AlchemyTableRecipeJEI recipe) public String getRecipeCategoryUid(@Nonnull AlchemyTableRecipeJEI recipe)
{ {

View file

@ -1,18 +1,13 @@
package WayofTime.bloodmagic.compat.jei.alchemyTable; package WayofTime.bloodmagic.compat.jei.alchemyTable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List; import java.util.List;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import lombok.Getter; import lombok.Getter;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.BlankRecipeWrapper; import mezz.jei.api.recipe.BlankRecipeWrapper;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import WayofTime.bloodmagic.api.recipe.AlchemyTableRecipe; import WayofTime.bloodmagic.api.recipe.AlchemyTableRecipe;
import WayofTime.bloodmagic.api.registry.OrbRegistry;
import WayofTime.bloodmagic.util.helper.TextHelper; import WayofTime.bloodmagic.util.helper.TextHelper;
public class AlchemyTableRecipeJEI extends BlankRecipeWrapper public class AlchemyTableRecipeJEI extends BlankRecipeWrapper
@ -20,32 +15,17 @@ public class AlchemyTableRecipeJEI extends BlankRecipeWrapper
@Getter @Getter
private AlchemyTableRecipe recipe; private AlchemyTableRecipe recipe;
// @Getter
// private ArrayList<ItemStack> validGems = new ArrayList<ItemStack>();
public AlchemyTableRecipeJEI(AlchemyTableRecipe recipe) public AlchemyTableRecipeJEI(AlchemyTableRecipe recipe)
{ {
this.recipe = recipe; this.recipe = recipe;
} }
@Override @Override
@Nonnull public void getIngredients(IIngredients ingredients) {
public List<Collection> getInputs() // ingredients.setInputLists(ItemStack.class, Lists.<ItemStack>newArrayList(recipe.getInput(), OrbRegistry.getOrbsDownToTier(recipe.getTierRequired())));
{ ingredients.setOutput(ItemStack.class, recipe.getRecipeOutput(new ArrayList<ItemStack>()));
ArrayList<Collection> ret = new ArrayList<Collection>();
ret.add(recipe.getInput());
ret.add(OrbRegistry.getOrbsDownToTier(recipe.getTierRequired()));
return ret;
} }
@Override
@Nonnull
public List<ItemStack> getOutputs()
{
return Collections.singletonList(recipe.getRecipeOutput(new ArrayList<ItemStack>()));
}
@Nullable
@Override @Override
public List<String> getTooltipStrings(int mouseX, int mouseY) public List<String> getTooltipStrings(int mouseX, int mouseY)
{ {
@ -54,8 +34,7 @@ public class AlchemyTableRecipeJEI extends BlankRecipeWrapper
{ {
ret.add(TextHelper.localize("jei.BloodMagic.recipe.lpDrained", recipe.getLpDrained())); ret.add(TextHelper.localize("jei.BloodMagic.recipe.lpDrained", recipe.getLpDrained()));
ret.add(TextHelper.localize("jei.BloodMagic.recipe.ticksRequired", recipe.getTicksRequired())); ret.add(TextHelper.localize("jei.BloodMagic.recipe.ticksRequired", recipe.getTicksRequired()));
}
return ret; return ret;
} }
return null;
}
} }

View file

@ -1,11 +1,13 @@
package WayofTime.bloodmagic.compat.jei.altar; package WayofTime.bloodmagic.compat.jei.altar;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.List; import java.util.List;
import mezz.jei.api.gui.IDrawable; import mezz.jei.api.gui.IDrawable;
import mezz.jei.api.gui.IRecipeLayout; import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.IRecipeCategory; import mezz.jei.api.recipe.IRecipeCategory;
import mezz.jei.api.recipe.IRecipeWrapper; import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
@ -52,14 +54,14 @@ public class AltarRecipeCategory implements IRecipeCategory
} }
@Nullable
@Override @Override
public void drawAnimations(Minecraft minecraft) public IDrawable getIcon() {
{ return null;
} }
@Override @Override
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper, IIngredients ingredients)
{ {
recipeLayout.getItemStacks().init(INPUT_SLOT, true, 31, 0); recipeLayout.getItemStacks().init(INPUT_SLOT, true, 31, 0);
recipeLayout.getItemStacks().init(OUTPUT_SLOT, false, 125, 30); recipeLayout.getItemStacks().init(OUTPUT_SLOT, false, 125, 30);
@ -67,9 +69,9 @@ public class AltarRecipeCategory implements IRecipeCategory
if (recipeWrapper instanceof AltarRecipeJEI) if (recipeWrapper instanceof AltarRecipeJEI)
{ {
AltarRecipeJEI altarRecipeWrapper = (AltarRecipeJEI) recipeWrapper; AltarRecipeJEI altarRecipeWrapper = (AltarRecipeJEI) recipeWrapper;
List<List<ItemStack>> inputs = altarRecipeWrapper.getInputs(); List<List<ItemStack>> inputs = ingredients.getInputs(ItemStack.class);
recipeLayout.getItemStacks().set(INPUT_SLOT, inputs.get(0)); recipeLayout.getItemStacks().set(INPUT_SLOT, inputs.get(0));
recipeLayout.getItemStacks().set(OUTPUT_SLOT, altarRecipeWrapper.getOutputs()); recipeLayout.getItemStacks().set(OUTPUT_SLOT, ingredients.getOutputs(ItemStack.class).get(0));
} }
} }
} }

View file

@ -15,14 +15,6 @@ public class AltarRecipeHandler implements IRecipeHandler<AltarRecipeJEI>
return AltarRecipeJEI.class; return AltarRecipeJEI.class;
} }
@Deprecated
@Nonnull
@Override
public String getRecipeCategoryUid()
{
return Constants.Compat.JEI_CATEGORY_ALTAR;
}
@Override @Override
public String getRecipeCategoryUid(@Nonnull AltarRecipeJEI recipe) public String getRecipeCategoryUid(@Nonnull AltarRecipeJEI recipe)
{ {

View file

@ -2,13 +2,12 @@ package WayofTime.bloodmagic.compat.jei.altar;
import java.awt.Color; import java.awt.Color;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.List; import java.util.List;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import WayofTime.bloodmagic.util.helper.NumeralHelper; import WayofTime.bloodmagic.util.helper.NumeralHelper;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.BlankRecipeWrapper; import mezz.jei.api.recipe.BlankRecipeWrapper;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -37,18 +36,11 @@ public class AltarRecipeJEI extends BlankRecipeWrapper
} }
@Override @Override
public List<List<ItemStack>> getInputs() public void getIngredients(IIngredients ingredients) {
{ ingredients.setInputs(ItemStack.class, input);
return Collections.singletonList(input); ingredients.setOutput(ItemStack.class, output);
} }
@Override
public List<ItemStack> getOutputs()
{
return Collections.singletonList(output);
}
@Nullable
@Override @Override
public List<String> getTooltipStrings(int mouseX, int mouseY) public List<String> getTooltipStrings(int mouseX, int mouseY)
{ {
@ -57,9 +49,8 @@ public class AltarRecipeJEI extends BlankRecipeWrapper
{ {
ret.add(TextHelper.localize("jei.BloodMagic.recipe.consumptionRate", consumptionRate)); ret.add(TextHelper.localize("jei.BloodMagic.recipe.consumptionRate", consumptionRate));
ret.add(TextHelper.localize("jei.BloodMagic.recipe.drainRate", drainRate)); ret.add(TextHelper.localize("jei.BloodMagic.recipe.drainRate", drainRate));
return ret;
} }
return null; return ret;
} }
@Override @Override

View file

@ -1,14 +1,13 @@
package WayofTime.bloodmagic.compat.jei.armourDowngrade; package WayofTime.bloodmagic.compat.jei.armourDowngrade;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import mezz.jei.api.gui.ICraftingGridHelper; import mezz.jei.api.gui.ICraftingGridHelper;
import mezz.jei.api.gui.IDrawable; import mezz.jei.api.gui.IDrawable;
import mezz.jei.api.gui.IGuiItemStackGroup; import mezz.jei.api.gui.IGuiItemStackGroup;
import mezz.jei.api.gui.IRecipeLayout; import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.IRecipeCategory; import mezz.jei.api.recipe.IRecipeCategory;
import mezz.jei.api.recipe.IRecipeWrapper; import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
@ -63,15 +62,15 @@ public class ArmourDowngradeRecipeCategory implements IRecipeCategory
} }
@Nullable
@Override @Override
public void drawAnimations(Minecraft minecraft) public IDrawable getIcon() {
{ return null;
} }
@Override @Override
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper, IIngredients ingredients)
{ {
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks(); IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
@ -89,10 +88,9 @@ public class ArmourDowngradeRecipeCategory implements IRecipeCategory
if (recipeWrapper instanceof ArmourDowngradeRecipeJEI) if (recipeWrapper instanceof ArmourDowngradeRecipeJEI)
{ {
ArmourDowngradeRecipeJEI recipe = (ArmourDowngradeRecipeJEI) recipeWrapper; guiItemStacks.set(KEY_SLOT, ingredients.getInputs(ItemStack.class).get(1));
guiItemStacks.set(KEY_SLOT, (ArrayList<ItemStack>) recipe.getInputs().get(1)); craftingGridHelper.setOutput(guiItemStacks, ingredients.getOutputs(ItemStack.class).get(0));
craftingGridHelper.setOutput(guiItemStacks, recipe.getOutputs()); craftingGridHelper.setInputs(guiItemStacks, ingredients.getInputs(ItemStack.class), 3, 2);
craftingGridHelper.setInput(guiItemStacks, (List) recipe.getInputs().get(0), 3, 2);
} }
} }
} }

View file

@ -15,14 +15,6 @@ public class ArmourDowngradeRecipeHandler implements IRecipeHandler<ArmourDowngr
return ArmourDowngradeRecipeJEI.class; return ArmourDowngradeRecipeJEI.class;
} }
@Deprecated
@Nonnull
@Override
public String getRecipeCategoryUid()
{
return Constants.Compat.JEI_CATEGORY_ARMOURDOWNGRADE;
}
@Nonnull @Nonnull
@Override @Override
public String getRecipeCategoryUid(ArmourDowngradeRecipeJEI recipe) public String getRecipeCategoryUid(ArmourDowngradeRecipeJEI recipe)
@ -40,6 +32,6 @@ public class ArmourDowngradeRecipeHandler implements IRecipeHandler<ArmourDowngr
@Override @Override
public boolean isRecipeValid(@Nonnull ArmourDowngradeRecipeJEI recipe) public boolean isRecipeValid(@Nonnull ArmourDowngradeRecipeJEI recipe)
{ {
return recipe.getInputs().get(0).size() > 0 && recipe.getOutputs().size() > 0; return true;
} }
} }

View file

@ -1,65 +1,28 @@
package WayofTime.bloodmagic.compat.jei.armourDowngrade; package WayofTime.bloodmagic.compat.jei.armourDowngrade;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import lombok.Getter; import lombok.Getter;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.BlankRecipeWrapper; import mezz.jei.api.recipe.BlankRecipeWrapper;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import WayofTime.bloodmagic.api.recipe.LivingArmourDowngradeRecipe; import WayofTime.bloodmagic.api.recipe.LivingArmourDowngradeRecipe;
import WayofTime.bloodmagic.api.util.helper.ItemHelper.LivingUpgrades; import WayofTime.bloodmagic.api.util.helper.ItemHelper.LivingUpgrades;
import WayofTime.bloodmagic.registry.ModItems; import WayofTime.bloodmagic.registry.ModItems;
import com.google.common.collect.Lists;
public class ArmourDowngradeRecipeJEI extends BlankRecipeWrapper public class ArmourDowngradeRecipeJEI extends BlankRecipeWrapper
{ {
@Getter @Getter
private LivingArmourDowngradeRecipe recipe; private LivingArmourDowngradeRecipe recipe;
// @Getter
// private ArrayList<ItemStack> validGems = new ArrayList<ItemStack>();
public ArmourDowngradeRecipeJEI(LivingArmourDowngradeRecipe recipe) public ArmourDowngradeRecipeJEI(LivingArmourDowngradeRecipe recipe)
{ {
this.recipe = recipe; this.recipe = recipe;
} }
@Override @Override
@Nonnull public void getIngredients(IIngredients ingredients) {
public List<Collection> getInputs() // TODO - inputs
{
ArrayList<Collection> ret = new ArrayList<Collection>();
ret.add(recipe.getInput());
ret.add(Lists.newArrayList(recipe.getKey()));
return ret;
}
@Override
@Nonnull
public List<ItemStack> getOutputs()
{
ItemStack upgradeStack = new ItemStack(ModItems.UPGRADE_TOME); ItemStack upgradeStack = new ItemStack(ModItems.UPGRADE_TOME);
LivingUpgrades.setUpgrade(upgradeStack, recipe.getRecipeOutput()); LivingUpgrades.setUpgrade(upgradeStack, recipe.getRecipeOutput());
return Collections.singletonList(upgradeStack); ingredients.setOutput(ItemStack.class, upgradeStack);
}
@Nullable
@Override
public List<String> getTooltipStrings(int mouseX, int mouseY)
{
// ArrayList<String> ret = new ArrayList<String>();
// if (mouseX >= 58 && mouseX <= 78 && mouseY >= 21 && mouseY <= 34)
// {
// ret.add(TextHelper.localize("jei.BloodMagic.recipe.lpDrained", recipe.getLpDrained()));
// ret.add(TextHelper.localize("jei.BloodMagic.recipe.ticksRequired", recipe.getTicksRequired()));
// return ret;
// }
return null;
} }
} }

View file

@ -1,39 +0,0 @@
package WayofTime.bloodmagic.compat.minecraft;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeModContainer;
import net.minecraftforge.fml.relauncher.ReflectionHelper;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
public class CrossVersionProxy110 implements ICrossVersionProxy {
@Override
public TileEntity createTileFromData(World world, NBTTagCompound tagCompound)
{
Method m = ReflectionHelper.findMethod(TileEntity.class, null, new String[] { "create", "func_190200_a", "a" }, World.class, NBTTagCompound.class);
try
{
return (TileEntity) m.invoke(null, world, tagCompound);
} catch (Exception e)
{
return null;
}
}
@Override
public boolean disableStairSlabCulling()
{
Field disableStairSlabCulling = ReflectionHelper.findField(ForgeModContainer.class, "disableStairSlabCulling");
try
{
return (Boolean) disableStairSlabCulling.get(null);
} catch (Exception e)
{
return false;
}
}
}

View file

@ -1,31 +0,0 @@
package WayofTime.bloodmagic.compat.minecraft;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.ReflectionHelper;
import java.lang.reflect.Method;
public class CrossVersionProxy19 implements ICrossVersionProxy
{
@Override
public TileEntity createTileFromData(World world, NBTTagCompound tagCompound)
{
Method m = ReflectionHelper.findMethod(TileEntity.class, null, new String[] { "create", "func_189514_c", "c" }, NBTTagCompound.class);
try
{
return (TileEntity) m.invoke(null, tagCompound);
} catch (Exception e)
{
return null;
}
}
@Override
public boolean disableStairSlabCulling()
{
return false;
}
}

View file

@ -1,17 +0,0 @@
package WayofTime.bloodmagic.compat.minecraft;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
/**
* Allows for Blood Magic to support multiple MC versions that have only slight changes.
*
* Implementation copied from <a href="https://github.com/williewillus/Botania">Botania</a>.
*/
public interface ICrossVersionProxy
{
TileEntity createTileFromData(World world, NBTTagCompound tagCompound);
boolean disableStairSlabCulling();
}

View file

@ -4,9 +4,6 @@ import WayofTime.bloodmagic.block.*;
import WayofTime.bloodmagic.compat.waila.provider.*; import WayofTime.bloodmagic.compat.waila.provider.*;
import mcp.mobius.waila.api.IWailaRegistrar; import mcp.mobius.waila.api.IWailaRegistrar;
import WayofTime.bloodmagic.api.Constants; import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.block.base.BlockEnumPillar;
import WayofTime.bloodmagic.block.base.BlockEnumPillarCap;
import WayofTime.bloodmagic.block.base.BlockEnumStairs;
public class WailaCallbackHandler public class WailaCallbackHandler
{ {
@ -22,9 +19,6 @@ public class WailaCallbackHandler
registrar.registerStackProvider(new DataProviderAlchemyArray(), BlockAlchemyArray.class); registrar.registerStackProvider(new DataProviderAlchemyArray(), BlockAlchemyArray.class);
registrar.registerStackProvider(new DataProviderMimic(), BlockMimic.class); registrar.registerStackProvider(new DataProviderMimic(), BlockMimic.class);
registrar.registerNBTProvider(new DataProviderMimic(), BlockMimic.class); registrar.registerNBTProvider(new DataProviderMimic(), BlockMimic.class);
registrar.registerStackProvider(DataProviderPillar.INSTANCE, BlockEnumPillarCap.class);
registrar.registerStackProvider(DataProviderPillar.INSTANCE, BlockEnumPillar.class);
registrar.registerStackProvider(DataProviderPillar.INSTANCE, BlockEnumStairs.class);
registrar.addConfig(Constants.Mod.MODID, Constants.Compat.WAILA_CONFIG_BYPASS_SNEAK, false); registrar.addConfig(Constants.Mod.MODID, Constants.Compat.WAILA_CONFIG_BYPASS_SNEAK, false);
registrar.addConfig(Constants.Mod.MODID, Constants.Compat.WAILA_CONFIG_ALTAR, true); registrar.addConfig(Constants.Mod.MODID, Constants.Compat.WAILA_CONFIG_ALTAR, true);

View file

@ -43,10 +43,10 @@ public class DataProviderAlchemyArray implements IWailaDataProvider
if (tile instanceof TileAlchemyArray) if (tile instanceof TileAlchemyArray)
{ {
TileAlchemyArray tileArray = (TileAlchemyArray) tile; TileAlchemyArray tileArray = (TileAlchemyArray) tile;
if (tileArray.getStackInSlot(0) != null) if (!tileArray.getStackInSlot(0).isEmpty())
currenttip.add(TextHelper.localize("waila.BloodMagic.array.reagent", tileArray.getStackInSlot(0).getDisplayName())); currenttip.add(TextHelper.localize("waila.BloodMagic.array.reagent", tileArray.getStackInSlot(0).getDisplayName()));
if (tileArray.getStackInSlot(1) != null) if (!tileArray.getStackInSlot(1).isEmpty())
currenttip.add(TextHelper.localize("waila.BloodMagic.array.catalyst", tileArray.getStackInSlot(1).getDisplayName())); currenttip.add(TextHelper.localize("waila.BloodMagic.array.catalyst", tileArray.getStackInSlot(1).getDisplayName()));
} }
} else } else

View file

@ -129,10 +129,10 @@ public class DataProviderBloodAltar implements IWailaDataProvider
private static boolean holdingSeerSigil(EntityPlayer player) private static boolean holdingSeerSigil(EntityPlayer player)
{ {
if (player.getHeldItemMainhand() != null && player.getHeldItemMainhand().getItem() instanceof ItemSigilSeer) if (player.getHeldItemMainhand().getItem() instanceof ItemSigilSeer)
return true; return true;
if (player.getHeldItemOffhand() != null && player.getHeldItemOffhand().getItem() instanceof ItemSigilSeer) if (player.getHeldItemOffhand().getItem() instanceof ItemSigilSeer)
return true; return true;
return false; return false;
@ -140,10 +140,10 @@ public class DataProviderBloodAltar implements IWailaDataProvider
private static boolean holdingDivinationSigil(EntityPlayer player) private static boolean holdingDivinationSigil(EntityPlayer player)
{ {
if (player.getHeldItemMainhand() != null && player.getHeldItemMainhand().getItem() instanceof ItemSigilDivination) if (player.getHeldItemMainhand().getItem() instanceof ItemSigilDivination)
return true; return true;
if (player.getHeldItemOffhand() != null && player.getHeldItemOffhand().getItem() instanceof ItemSigilDivination) if (player.getHeldItemOffhand().getItem() instanceof ItemSigilDivination)
return true; return true;
return false; return false;

View file

@ -35,7 +35,7 @@ public class DataProviderBloodTank implements IWailaDataProvider
@Override @Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config)
{ {
if (!config.getConfig(Constants.Compat.WAILA_CONFIG_BLOOD_TANK)) if (!config.getConfig(Constants.Compat.WAILA_CONFIG_BLOOD_TANK) && !config.getConfig("capability.tankinfo"))
return currenttip; return currenttip;
if (accessor.getPlayer().isSneaking() || config.getConfig(Constants.Compat.WAILA_CONFIG_BYPASS_SNEAK)) if (accessor.getPlayer().isSneaking() || config.getConfig(Constants.Compat.WAILA_CONFIG_BYPASS_SNEAK))

View file

@ -20,7 +20,7 @@ public class DataProviderMimic implements IWailaDataProvider
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config)
{ {
if (accessor.getNBTData().getBoolean("hasItem")) if (accessor.getNBTData().getBoolean("hasItem"))
return ItemStack.loadItemStackFromNBT(accessor.getNBTData()); return new ItemStack(accessor.getNBTData());
return new ItemStack(accessor.getBlock(), 1, accessor.getMetadata()); return new ItemStack(accessor.getBlock(), 1, accessor.getMetadata());
} }

View file

@ -1,43 +0,0 @@
package WayofTime.bloodmagic.compat.waila.provider;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import java.util.List;
public class DataProviderPillar implements IWailaDataProvider {
public static final DataProviderPillar INSTANCE = new DataProviderPillar();
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
return new ItemStack(accessor.getBlock(), 1, accessor.getBlock().damageDropped(accessor.getBlockState()));
}
@Override
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return null;
}
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return null;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return null;
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, BlockPos pos) {
return null;
}
}

View file

@ -65,7 +65,7 @@ public class DataProviderRitualController implements IWailaDataProvider
if (accessor.getBlock().getMetaFromState(accessor.getBlockState()) == 1 && accessor.getTileEntity() instanceof TileImperfectRitualStone) if (accessor.getBlock().getMetaFromState(accessor.getBlockState()) == 1 && accessor.getTileEntity() instanceof TileImperfectRitualStone)
{ {
if (accessor.getWorld().getBlockState(accessor.getPosition().up()).getBlock() != null) if (accessor.getWorld().isAirBlock(accessor.getPosition().up()))
{ {
Block up = accessor.getWorld().getBlockState(accessor.getPosition().up()).getBlock(); Block up = accessor.getWorld().getBlockState(accessor.getPosition().up()).getBlock();
int meta = up.getMetaFromState(accessor.getWorld().getBlockState(accessor.getPosition().up())); int meta = up.getMetaFromState(accessor.getWorld().getBlockState(accessor.getPosition().up()));

View file

@ -42,7 +42,7 @@ public class DataProviderTeleposer implements IWailaDataProvider
if (accessor.getBlock() instanceof BlockTeleposer && accessor.getTileEntity() instanceof TileTeleposer) if (accessor.getBlock() instanceof BlockTeleposer && accessor.getTileEntity() instanceof TileTeleposer)
{ {
TileTeleposer teleposer = (TileTeleposer) accessor.getTileEntity(); TileTeleposer teleposer = (TileTeleposer) accessor.getTileEntity();
if (teleposer.getStackInSlot(0) != null) if (!teleposer.getStackInSlot(0).isEmpty())
{ {
ItemStack contained = teleposer.getStackInSlot(0); ItemStack contained = teleposer.getStackInSlot(0);
BlockPos toPos = ((ItemTelepositionFocus) contained.getItem()).getBlockPos(contained); BlockPos toPos = ((ItemTelepositionFocus) contained.getItem()).getBlockPos(contained);

View file

@ -20,15 +20,15 @@ public class AdvancedCompressionHandler extends CompressionHandler
{ {
for (ItemStack invStack : inv) for (ItemStack invStack : inv)
{ {
if (invStack == null) if (invStack.isEmpty())
{ {
continue; continue;
} }
for (int i = 2; i <= 3; i++) for (int i = 2; i <= 3; i++)
{ {
ItemStack stacky = getRecipe(invStack, world, i); ItemStack stack = getRecipe(invStack, world, i);
if (stacky != null) if (!stack.isEmpty())
{ {
int threshold = CompressionRegistry.getItemThreshold(invStack); int threshold = CompressionRegistry.getItemThreshold(invStack);
@ -37,13 +37,13 @@ public class AdvancedCompressionHandler extends CompressionHandler
if (neededLeft <= 0) if (neededLeft <= 0)
{ {
iterateThroughInventory(invStack, 0, inv, needed, true); iterateThroughInventory(invStack, 0, inv, needed, true);
return stacky; return stack;
} }
} }
} }
} }
return null; return ItemStack.EMPTY;
} }
public int iterateThroughInventory(ItemStack required, int kept, ItemStack[] inv, int needed, boolean doDrain) public int iterateThroughInventory(ItemStack required, int kept, ItemStack[] inv, int needed, boolean doDrain)
@ -54,14 +54,14 @@ public class AdvancedCompressionHandler extends CompressionHandler
{ {
i++; i++;
if (invStack == null) if (invStack.isEmpty())
{ {
continue; continue;
} }
if (invStack.isItemEqual(required) && (invStack.getTagCompound() == null ? required.getTagCompound() == null : invStack.getTagCompound().equals(required.getTagCompound()))) if (invStack.isItemEqual(required) && (invStack.getTagCompound() == null ? required.getTagCompound() == null : invStack.getTagCompound().equals(required.getTagCompound())))
{ {
int stackSize = invStack.stackSize; int stackSize = invStack.getCount();
int used = 0; int used = 0;
if (kept > 0) if (kept > 0)
{ {
@ -76,10 +76,10 @@ public class AdvancedCompressionHandler extends CompressionHandler
int remainingFromStack = Math.max(stackSize - used - needed, 0); int remainingFromStack = Math.max(stackSize - used - needed, 0);
if (doDrain) if (doDrain)
{ {
invStack.stackSize = remainingFromStack + used; invStack.setCount(remainingFromStack + used);
if (invStack.stackSize <= 0) if (invStack.isEmpty())
{ {
inv[i] = null; inv[i] = ItemStack.EMPTY;
} }
} }
@ -98,7 +98,7 @@ public class AdvancedCompressionHandler extends CompressionHandler
public static boolean isResultStackReversible(ItemStack stack, int gridSize, World world) public static boolean isResultStackReversible(ItemStack stack, int gridSize, World world)
{ {
if (stack == null) if (stack.isEmpty())
{ {
return false; return false;
} }
@ -113,12 +113,12 @@ public class AdvancedCompressionHandler extends CompressionHandler
inventory.setInventorySlotContents(0, stack); inventory.setInventorySlotContents(0, stack);
ItemStack returnStack = StorageBlockCraftingManager.getInstance().findMatchingRecipe(inventory, world); ItemStack returnStack = StorageBlockCraftingManager.getInstance().findMatchingRecipe(inventory, world);
if (returnStack == null) if (returnStack.isEmpty())
{ {
return false; return false;
} }
ItemStack compressedStack = null; ItemStack compressedStack = ItemStack.EMPTY;
switch (gridSize) switch (gridSize)
{ {
case 2: case 2:
@ -129,7 +129,7 @@ public class AdvancedCompressionHandler extends CompressionHandler
break; break;
} }
return compressedStack != null && CompressionRegistry.areItemStacksEqual(stack, compressedStack); return !compressedStack.isEmpty() && CompressionRegistry.areItemStacksEqual(stack, compressedStack);
} }
public static ItemStack getRecipe(ItemStack stack, World world, int gridSize) public static ItemStack getRecipe(ItemStack stack, World world, int gridSize)
@ -151,7 +151,7 @@ public class AdvancedCompressionHandler extends CompressionHandler
public static boolean has22Recipe(ItemStack stack, World world) public static boolean has22Recipe(ItemStack stack, World world)
{ {
return get22Recipe(stack, world) != null; return !get22Recipe(stack, world).isEmpty();
} }
public static ItemStack get22Recipe(ItemStack stack, World world) public static ItemStack get22Recipe(ItemStack stack, World world)
@ -161,7 +161,7 @@ public class AdvancedCompressionHandler extends CompressionHandler
public static boolean has33Recipe(ItemStack stack, World world) public static boolean has33Recipe(ItemStack stack, World world)
{ {
return get33Recipe(stack, world) != null; return !get33Recipe(stack, world).isEmpty();
} }
public static ItemStack get33Recipe(ItemStack stack, World world) public static ItemStack get33Recipe(ItemStack stack, World world)

View file

@ -38,7 +38,7 @@ public class BaseCompressionHandler extends CompressionHandler
return this.getResultStack(); return this.getResultStack();
} }
return null; return ItemStack.EMPTY;
} }
public int getRemainingNeeded(ItemStack[] inv) public int getRemainingNeeded(ItemStack[] inv)
@ -53,7 +53,7 @@ public class BaseCompressionHandler extends CompressionHandler
public int iterateThroughInventory(ItemStack[] inv, boolean doDrain) public int iterateThroughInventory(ItemStack[] inv, boolean doDrain)
{ {
int needed = this.required.stackSize; int needed = this.required.getCount();
int kept = this.getLeftover(); int kept = this.getLeftover();
int i = -1; int i = -1;
@ -68,7 +68,7 @@ public class BaseCompressionHandler extends CompressionHandler
if (invStack.isItemEqual(this.required) && (invStack.getTagCompound() == null ? this.required.getTagCompound() == null : invStack.getTagCompound().equals(this.required.getTagCompound()))) if (invStack.isItemEqual(this.required) && (invStack.getTagCompound() == null ? this.required.getTagCompound() == null : invStack.getTagCompound().equals(this.required.getTagCompound())))
{ {
int stackSize = invStack.stackSize; int stackSize = invStack.getCount();
int used = 0; int used = 0;
if (kept > 0) if (kept > 0)
{ {
@ -83,10 +83,10 @@ public class BaseCompressionHandler extends CompressionHandler
int remainingFromStack = Math.max(stackSize - used - needed, 0); int remainingFromStack = Math.max(stackSize - used - needed, 0);
if (doDrain) if (doDrain)
{ {
invStack.stackSize = remainingFromStack + used; invStack.setCount(remainingFromStack + used);
if (invStack.stackSize <= 0) if (invStack.isEmpty())
{ {
inv[i] = null; inv[i] = ItemStack.EMPTY;
} }
} }

View file

@ -32,7 +32,7 @@ public class StorageBlockCraftingManager
private static boolean isResultStackReversible(ItemStack stack, int gridSize, World world, List list) private static boolean isResultStackReversible(ItemStack stack, int gridSize, World world, List list)
{ {
if (stack == null) if (stack.isEmpty())
{ {
return false; return false;
} }
@ -47,12 +47,12 @@ public class StorageBlockCraftingManager
inventory.setInventorySlotContents(0, stack); inventory.setInventorySlotContents(0, stack);
ItemStack returnStack = StorageBlockCraftingManager.getInstance().findMatchingRecipe(inventory, world, list); ItemStack returnStack = StorageBlockCraftingManager.getInstance().findMatchingRecipe(inventory, world, list);
if (returnStack == null || returnStack.getItem() == null) if (returnStack.isEmpty())
{ {
return false; return false;
} }
ItemStack compressedStack = null; ItemStack compressedStack = ItemStack.EMPTY;
switch (gridSize) switch (gridSize)
{ {
case 2: case 2:
@ -63,7 +63,7 @@ public class StorageBlockCraftingManager
break; break;
} }
return compressedStack != null && CompressionRegistry.areItemStacksEqual(stack, compressedStack); return !compressedStack.isEmpty() && CompressionRegistry.areItemStacksEqual(stack, compressedStack);
} }
private static ItemStack getRecipe(ItemStack stack, World world, int gridSize, List list) private static ItemStack getRecipe(ItemStack stack, World world, int gridSize, List list)
@ -85,7 +85,7 @@ public class StorageBlockCraftingManager
private static boolean has22Recipe(ItemStack stack, World world, List list) private static boolean has22Recipe(ItemStack stack, World world, List list)
{ {
return get22Recipe(stack, world, list) != null; return !get22Recipe(stack, world, list).isEmpty();
} }
private static ItemStack get22Recipe(ItemStack stack, World world, List list) private static ItemStack get22Recipe(ItemStack stack, World world, List list)
@ -95,7 +95,7 @@ public class StorageBlockCraftingManager
private static boolean has33Recipe(ItemStack stack, World world, List list) private static boolean has33Recipe(ItemStack stack, World world, List list)
{ {
return get33Recipe(stack, world, list) != null; return !get33Recipe(stack, world, list).isEmpty();
} }
private static ItemStack get33Recipe(ItemStack stack, World world, List list) private static ItemStack get33Recipe(ItemStack stack, World world, List list)
@ -111,15 +111,15 @@ public class StorageBlockCraftingManager
private ItemStack findMatchingRecipe(InventoryCrafting craftingInventory, World world, List list) private ItemStack findMatchingRecipe(InventoryCrafting craftingInventory, World world, List list)
{ {
int i = 0; int i = 0;
ItemStack itemstack = null; ItemStack itemstack = ItemStack.EMPTY;
ItemStack itemstack1 = null; ItemStack itemstack1 = ItemStack.EMPTY;
int j; int j;
for (j = 0; j < craftingInventory.getSizeInventory(); ++j) for (j = 0; j < craftingInventory.getSizeInventory(); ++j)
{ {
ItemStack itemstack2 = craftingInventory.getStackInSlot(j); ItemStack itemstack2 = craftingInventory.getStackInSlot(j);
if (itemstack2 != null) if (!itemstack2.isEmpty())
{ {
if (i == 0) if (i == 0)
{ {
@ -135,13 +135,13 @@ public class StorageBlockCraftingManager
} }
} }
if (i == 2 && itemstack.getItem() == itemstack1.getItem() && itemstack.stackSize == 1 && itemstack1.stackSize == 1 && itemstack.getItem().isRepairable()) if (i == 2 && itemstack.getItem() == itemstack1.getItem() && itemstack.getCount() == 1 && itemstack1.getCount() == 1 && itemstack.getItem().isRepairable())
{ {
Item item = itemstack.getItem(); Item item = itemstack.getItem();
int j1 = item.getMaxDamage() - itemstack.getItemDamage(); int j1 = item.getMaxDamage(itemstack) - itemstack.getItemDamage();
int k = item.getMaxDamage() - itemstack1.getItemDamage(); int k = item.getMaxDamage(itemstack) - itemstack1.getItemDamage();
int l = j1 + k + item.getMaxDamage() * 5 / 100; int l = j1 + k + item.getMaxDamage(itemstack) * 5 / 100;
int i1 = item.getMaxDamage() - l; int i1 = item.getMaxDamage(itemstack) - l;
if (i1 < 0) if (i1 < 0)
{ {
@ -161,7 +161,7 @@ public class StorageBlockCraftingManager
} }
} }
return null; return ItemStack.EMPTY;
} }
} }
} }

View file

@ -33,10 +33,10 @@ public class StorageBlockCraftingRecipeAssimilator
continue; continue;
ItemStack output = recipe.getRecipeOutput(); ItemStack output = recipe.getRecipeOutput();
if (output == null || output.getItem() == null) if (output.isEmpty())
continue; continue;
if (output.stackSize == 1) if (output.getCount() == 1)
{ {
PackingRecipe packingRecipe = getPackingRecipe(recipe); PackingRecipe packingRecipe = getPackingRecipe(recipe);
@ -44,7 +44,7 @@ public class StorageBlockCraftingRecipeAssimilator
{ {
packingRecipes.add(packingRecipe); packingRecipes.add(packingRecipe);
} }
} else if ((output.stackSize == 4 || output.stackSize == 9) && recipe.getRecipeSize() == 1) } else if ((output.getCount() == 4 || output.getCount() == 9) && recipe.getRecipeSize() == 1)
{ {
unpackingRecipes.add(recipe); unpackingRecipes.add(recipe);
} }
@ -81,7 +81,7 @@ public class StorageBlockCraftingRecipeAssimilator
{ {
// the recipe could be parsed, use its inputs directly since that's faster verify recipe size // the recipe could be parsed, use its inputs directly since that's faster verify recipe size
if (recipePack.inputCount != unpacked.stackSize) if (recipePack.inputCount != unpacked.getCount())
continue; continue;
// check if any of the input options matches the unpacked // check if any of the input options matches the unpacked
@ -99,14 +99,14 @@ public class StorageBlockCraftingRecipeAssimilator
{ {
// unknown IRecipe, check through the recipe conventionally verify recipe size for 3x3 to skip anything smaller quickly // unknown IRecipe, check through the recipe conventionally verify recipe size for 3x3 to skip anything smaller quickly
if (unpacked.stackSize == 9 && recipePack.recipe.getRecipeSize() < 9) if (unpacked.getCount() == 9 && recipePack.recipe.getRecipeSize() < 9)
continue; continue;
// initialize inventory late, but only once per unpack recipe // initialize inventory late, but only once per unpack recipe
if (inventory == null) if (inventory == null)
{ {
if (unpacked.stackSize == 4) if (unpacked.getCount() == 4)
{ {
inventory = inventory2x2; inventory = inventory2x2;
} else } else
@ -114,7 +114,7 @@ public class StorageBlockCraftingRecipeAssimilator
inventory = inventory3x3; inventory = inventory3x3;
} }
for (int i = 0; i < unpacked.stackSize; i++) for (int i = 0; i < unpacked.getCount(); i++)
{ {
inventory.setInventorySlotContents(i, unpacked.copy()); inventory.setInventorySlotContents(i, unpacked.copy());
} }

View file

@ -29,13 +29,7 @@ public class WillChunk
this.currentWill = currentWill; this.currentWill = currentWill;
} }
public boolean isModified() public boolean isModified() {
{ return (this.chunkRef != null) && (this.chunkRef.get() != null) && this.chunkRef.get().needsSaving(false);
if ((this.chunkRef != null) && (this.chunkRef.get() != null))
{
return ((Chunk) this.chunkRef.get()).needsSaving(false);
}
return false;
} }
} }

View file

@ -7,6 +7,7 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.Chunk;
import javax.annotation.Nullable;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.CopyOnWriteArrayList;
@ -15,6 +16,7 @@ public class WorldDemonWillHandler
static ConcurrentHashMap<Integer, WillWorld> containedWills = new ConcurrentHashMap<Integer, WillWorld>(); static ConcurrentHashMap<Integer, WillWorld> containedWills = new ConcurrentHashMap<Integer, WillWorld>();
public static ConcurrentHashMap<Integer, CopyOnWriteArrayList<PosXY>> dirtyChunks = new ConcurrentHashMap<Integer, CopyOnWriteArrayList<PosXY>>(); public static ConcurrentHashMap<Integer, CopyOnWriteArrayList<PosXY>> dirtyChunks = new ConcurrentHashMap<Integer, CopyOnWriteArrayList<PosXY>>();
@Nullable
public static DemonWillHolder getWillHolder(int dim, int x, int y) public static DemonWillHolder getWillHolder(int dim, int x, int y)
{ {
WillChunk chunk = getWillChunk(dim, x, y); WillChunk chunk = getWillChunk(dim, x, y);
@ -36,6 +38,7 @@ public class WorldDemonWillHandler
return containedWills.get(dim); return containedWills.get(dim);
} }
@Nullable
public static WillChunk getWillChunk(int dim, int x, int y) public static WillChunk getWillChunk(int dim, int x, int y)
{ {
if (!containedWills.containsKey(dim)) if (!containedWills.containsKey(dim))

View file

@ -37,12 +37,12 @@ public class EntityAIAttackRangedBow extends EntityAIBase
*/ */
public boolean shouldExecute() public boolean shouldExecute()
{ {
return this.entity.getAttackTarget() == null ? false : this.isBowInMainhand(); return this.entity.getAttackTarget() != null && this.isBowInMainhand();
} }
protected boolean isBowInMainhand() protected boolean isBowInMainhand()
{ {
return this.entity.getHeldItemMainhand() != null && this.entity.getHeldItemMainhand().getItem() instanceof ItemBow; return this.entity.getHeldItemMainhand().getItem() instanceof ItemBow;
} }
/** /**

View file

@ -37,7 +37,7 @@ public class EntityAIAttackStealthMelee extends EntityAIBase
public EntityAIAttackStealthMelee(EntityCorruptedChicken creature, double speedIn, boolean useLongMemory) public EntityAIAttackStealthMelee(EntityCorruptedChicken creature, double speedIn, boolean useLongMemory)
{ {
this.chicken = creature; this.chicken = creature;
this.worldObj = creature.worldObj; this.worldObj = creature.getEntityWorld();
this.speedTowardsTarget = speedIn; this.speedTowardsTarget = speedIn;
this.longMemory = useLongMemory; this.longMemory = useLongMemory;
this.setMutexBits(3); this.setMutexBits(3);

View file

@ -20,7 +20,7 @@ public class EntityAIEatAndCorruptBlock extends EntityAIBase
public EntityAIEatAndCorruptBlock(EntityAspectedDemonBase entity) public EntityAIEatAndCorruptBlock(EntityAspectedDemonBase entity)
{ {
this.grassEaterEntity = entity; this.grassEaterEntity = entity;
this.world = entity.worldObj; this.world = entity.getEntityWorld();
this.setMutexBits(7); this.setMutexBits(7);
} }

View file

@ -29,7 +29,7 @@ public class EntityAIFollowOwner extends EntityAIBase
public EntityAIFollowOwner(EntityDemonBase thePetIn, double followSpeedIn, float minDistIn, float maxDistIn) public EntityAIFollowOwner(EntityDemonBase thePetIn, double followSpeedIn, float minDistIn, float maxDistIn)
{ {
this.thePet = thePetIn; this.thePet = thePetIn;
this.theWorld = thePetIn.worldObj; this.theWorld = thePetIn.getEntityWorld();
this.followSpeed = followSpeedIn; this.followSpeed = followSpeedIn;
this.petPathfinder = thePetIn.getNavigator(); this.petPathfinder = thePetIn.getNavigator();
this.minDist = minDistIn; this.minDist = minDistIn;
@ -100,7 +100,7 @@ public class EntityAIFollowOwner extends EntityAIBase
{ {
IBlockState iblockstate = this.theWorld.getBlockState(pos); IBlockState iblockstate = this.theWorld.getBlockState(pos);
Block block = iblockstate.getBlock(); Block block = iblockstate.getBlock();
return block == Blocks.AIR ? true : !iblockstate.isFullCube(); return block == Blocks.AIR || !iblockstate.isFullCube();
} }
/** /**
@ -122,9 +122,9 @@ public class EntityAIFollowOwner extends EntityAIBase
{ {
if (this.thePet.getDistanceSqToEntity(this.theOwner) >= 144.0D) if (this.thePet.getDistanceSqToEntity(this.theOwner) >= 144.0D)
{ {
int i = MathHelper.floor_double(this.theOwner.posX) - 2; int i = MathHelper.floor(this.theOwner.posX) - 2;
int j = MathHelper.floor_double(this.theOwner.posZ) - 2; int j = MathHelper.floor(this.theOwner.posZ) - 2;
int k = MathHelper.floor_double(this.theOwner.getEntityBoundingBox().minY); int k = MathHelper.floor(this.theOwner.getEntityBoundingBox().minY);
for (int l = 0; l <= 4; ++l) for (int l = 0; l <= 4; ++l)
{ {

View file

@ -32,7 +32,7 @@ public class EntityAIGrabEffectsFromOwner extends EntityAIBase
public EntityAIGrabEffectsFromOwner(EntitySentientSpecter thePetIn, double followSpeedIn, float minDistIn) public EntityAIGrabEffectsFromOwner(EntitySentientSpecter thePetIn, double followSpeedIn, float minDistIn)
{ {
this.thePet = thePetIn; this.thePet = thePetIn;
this.theWorld = thePetIn.worldObj; this.theWorld = thePetIn.getEntityWorld();
this.followSpeed = followSpeedIn; this.followSpeed = followSpeedIn;
this.petPathfinder = thePetIn.getNavigator(); this.petPathfinder = thePetIn.getNavigator();
this.minDist = minDistIn; this.minDist = minDistIn;
@ -105,7 +105,7 @@ public class EntityAIGrabEffectsFromOwner extends EntityAIBase
{ {
IBlockState iblockstate = this.theWorld.getBlockState(pos); IBlockState iblockstate = this.theWorld.getBlockState(pos);
Block block = iblockstate.getBlock(); Block block = iblockstate.getBlock();
return block == Blocks.AIR ? true : !iblockstate.isFullCube(); return block == Blocks.AIR || !iblockstate.isFullCube();
} }
/** /**
@ -135,9 +135,9 @@ public class EntityAIGrabEffectsFromOwner extends EntityAIBase
{ {
if (this.thePet.getDistanceSqToEntity(this.theOwner) >= 144.0D) if (this.thePet.getDistanceSqToEntity(this.theOwner) >= 144.0D)
{ {
int i = MathHelper.floor_double(this.theOwner.posX) - 2; int i = MathHelper.floor(this.theOwner.posX) - 2;
int j = MathHelper.floor_double(this.theOwner.posZ) - 2; int j = MathHelper.floor(this.theOwner.posZ) - 2;
int k = MathHelper.floor_double(this.theOwner.getEntityBoundingBox().minY); int k = MathHelper.floor(this.theOwner.getEntityBoundingBox().minY);
for (int l = 0; l <= 4; ++l) for (int l = 0; l <= 4; ++l)
{ {

View file

@ -40,7 +40,7 @@ public class EntityAIPickUpAlly extends EntityAIBase
public EntityAIPickUpAlly(EntityAspectedDemonBase creature, double speedIn, boolean useLongMemory) public EntityAIPickUpAlly(EntityAspectedDemonBase creature, double speedIn, boolean useLongMemory)
{ {
this.entity = creature; this.entity = creature;
this.worldObj = creature.worldObj; this.worldObj = creature.getEntityWorld();
this.speedTowardsTarget = speedIn; this.speedTowardsTarget = speedIn;
this.longMemory = useLongMemory; this.longMemory = useLongMemory;
this.setMutexBits(3); this.setMutexBits(3);
@ -57,7 +57,7 @@ public class EntityAIPickUpAlly extends EntityAIBase
} }
AxisAlignedBB bb = new AxisAlignedBB(entity.posX - 0.5, entity.posY - 0.5, entity.posZ - 0.5, entity.posX + 0.5, entity.posY + 0.5, entity.posZ + 0.5).expandXyz(5); AxisAlignedBB bb = new AxisAlignedBB(entity.posX - 0.5, entity.posY - 0.5, entity.posZ - 0.5, entity.posX + 0.5, entity.posY + 0.5, entity.posZ + 0.5).expandXyz(5);
List<EntityLivingBase> list = this.entity.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, bb, new EntityAspectedDemonBase.WillTypePredicate(entity.getType())); List<EntityLivingBase> list = this.entity.getEntityWorld().getEntitiesWithinAABB(EntityLivingBase.class, bb, new EntityAspectedDemonBase.WillTypePredicate(entity.getType()));
for (EntityLivingBase testEntity : list) for (EntityLivingBase testEntity : list)
{ {
if (testEntity != this.entity) if (testEntity != this.entity)

View file

@ -21,7 +21,7 @@ public class EntityAIProtectAlly extends EntityAIBase
public EntityAIProtectAlly(EntityCorruptedSheep entity) public EntityAIProtectAlly(EntityCorruptedSheep entity)
{ {
this.entity = entity; this.entity = entity;
this.world = entity.worldObj; this.world = entity.getEntityWorld();
this.setMutexBits(7); this.setMutexBits(7);
} }

View file

@ -69,7 +69,7 @@ public class EntityAIRetreatToHeal<T extends Entity> extends EntityAIBase
} }
//This part almost doesn't matter //This part almost doesn't matter
List<T> list = this.theEntity.worldObj.<T>getEntitiesWithinAABB(this.classToAvoid, this.theEntity.getEntityBoundingBox().expand((double) this.avoidDistance, 3.0D, (double) this.avoidDistance), Predicates.and(new Predicate[] { EntitySelectors.CAN_AI_TARGET, this.canBeSeenSelector, this.avoidTargetSelector })); List<T> list = this.theEntity.getEntityWorld().<T>getEntitiesWithinAABB(this.classToAvoid, this.theEntity.getEntityBoundingBox().expand((double) this.avoidDistance, 3.0D, (double) this.avoidDistance), Predicates.and(new Predicate[] { EntitySelectors.CAN_AI_TARGET, this.canBeSeenSelector, this.avoidTargetSelector }));
if (list.isEmpty()) if (list.isEmpty())
{ {

View file

@ -82,7 +82,7 @@ public class EntityAIStealthRetreat extends EntityAIBase
@Override @Override
public void startExecuting() public void startExecuting()
{ {
ticksLeft = this.entity.worldObj.rand.nextInt(100) + 100; ticksLeft = this.entity.getEntityWorld().rand.nextInt(100) + 100;
this.entityPathNavigate.setPath(this.entityPathEntity, this.farSpeed); this.entityPathNavigate.setPath(this.entityPathEntity, this.farSpeed);
} }

View file

@ -47,7 +47,7 @@ public class EntityAIStealthTowardsTarget extends EntityAIBase
return false; return false;
} else } else
{ {
ticksLeft = this.entity.worldObj.rand.nextInt(200) + 100; ticksLeft = this.entity.getEntityWorld().rand.nextInt(200) + 100;
this.xPosition = vec3d.xCoord; this.xPosition = vec3d.xCoord;
this.yPosition = vec3d.yCoord; this.yPosition = vec3d.yCoord;
this.zPosition = vec3d.zCoord; this.zPosition = vec3d.zCoord;
@ -75,7 +75,7 @@ public class EntityAIStealthTowardsTarget extends EntityAIBase
if (this.entity.getNavigator().noPath()) if (this.entity.getNavigator().noPath())
{ {
EntityLivingBase target = this.entity.getAttackTarget(); EntityLivingBase target = this.entity.getAttackTarget();
Vec3d vec3d = null; Vec3d vec3d;
if (target instanceof EntityCreature) if (target instanceof EntityCreature)
{ {
vec3d = RandomPositionGenerator.findRandomTarget((EntityCreature) target, 10, 7); vec3d = RandomPositionGenerator.findRandomTarget((EntityCreature) target, 10, 7);

View file

@ -180,15 +180,15 @@ public abstract class EntityAspectedDemonBase extends EntityDemonBase
float newAmount = amount; float newAmount = amount;
if (source.isProjectile()) if (source.isProjectile())
{ {
newAmount *= MathHelper.clamp_double(1 - getProjectileResist(), 0, 1); newAmount *= MathHelper.clamp(1 - getProjectileResist(), 0, 1);
} else } else
{ {
newAmount *= MathHelper.clamp_double(1 - getMeleeResist(), 0, 1); newAmount *= MathHelper.clamp(1 - getMeleeResist(), 0, 1);
} }
if (source.isMagicDamage()) if (source.isMagicDamage())
{ {
newAmount *= MathHelper.clamp_double(1 - getMagicResist(), 0, 1); newAmount *= MathHelper.clamp(1 - getMagicResist(), 0, 1);
} }
return super.attackEntityFrom(source, newAmount); return super.attackEntityFrom(source, newAmount);

View file

@ -139,7 +139,7 @@ public class EntityCorruptedChicken extends EntityAspectedDemonBase
this.oFlap = this.wingRotation; this.oFlap = this.wingRotation;
this.oFlapSpeed = this.destPos; this.oFlapSpeed = this.destPos;
this.destPos = (float) ((double) this.destPos + (double) (this.onGround ? -1 : 4) * 0.3D); this.destPos = (float) ((double) this.destPos + (double) (this.onGround ? -1 : 4) * 0.3D);
this.destPos = MathHelper.clamp_float(this.destPos, 0.0F, 1.0F); this.destPos = MathHelper.clamp(this.destPos, 0.0F, 1.0F);
if (!this.onGround && this.wingRotDelta < 1.0F) if (!this.onGround && this.wingRotDelta < 1.0F)
{ {
@ -155,7 +155,7 @@ public class EntityCorruptedChicken extends EntityAspectedDemonBase
this.wingRotation += this.wingRotDelta * 2.0F; this.wingRotation += this.wingRotDelta * 2.0F;
if (!this.worldObj.isRemote && !this.isChild() && --this.timeUntilNextEgg <= 0) if (!this.getEntityWorld().isRemote && !this.isChild() && --this.timeUntilNextEgg <= 0)
{ {
this.playSound(SoundEvents.ENTITY_CHICKEN_EGG, 1.0F, (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F); this.playSound(SoundEvents.ENTITY_CHICKEN_EGG, 1.0F, (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F);
this.dropItem(Items.EGG, 1); this.dropItem(Items.EGG, 1);

View file

@ -121,7 +121,7 @@ public class EntityCorruptedSheep extends EntityAspectedDemonBase implements ISh
@Override @Override
public void onLivingUpdate() public void onLivingUpdate()
{ {
if (this.worldObj.isRemote) if (this.getEntityWorld().isRemote)
{ {
this.sheepTimer = Math.max(0, this.sheepTimer - 1); this.sheepTimer = Math.max(0, this.sheepTimer - 1);
this.castTimer = Math.max(0, castTimer - 1); this.castTimer = Math.max(0, castTimer - 1);
@ -359,7 +359,7 @@ public class EntityCorruptedSheep extends EntityAspectedDemonBase implements ISh
public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, @Nullable IEntityLivingData livingdata) public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, @Nullable IEntityLivingData livingdata)
{ {
livingdata = super.onInitialSpawn(difficulty, livingdata); livingdata = super.onInitialSpawn(difficulty, livingdata);
this.setFleeceColor(getRandomSheepColor(this.worldObj.rand)); this.setFleeceColor(getRandomSheepColor(this.getEntityWorld().rand));
return livingdata; return livingdata;
} }

View file

@ -52,7 +52,7 @@ public class EntityCorruptedSpider extends EntityAspectedDemonBase
this.tasks.addTask(5, new EntityAIWander(this, 0.8D)); this.tasks.addTask(5, new EntityAIWander(this, 0.8D));
this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
this.tasks.addTask(6, new EntityAILookIdle(this)); this.tasks.addTask(6, new EntityAILookIdle(this));
this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false, new Class[0])); this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false));
this.targetTasks.addTask(1, new EntityAINearestAttackableTarget<EntityPlayer>(this, EntityPlayer.class, true)); this.targetTasks.addTask(1, new EntityAINearestAttackableTarget<EntityPlayer>(this, EntityPlayer.class, true));
this.targetTasks.addTask(2, new EntityAINearestAttackableTarget<EntityLivingBase>(this, EntityLivingBase.class, 10, true, false, new EntityAspectedDemonBase.TeamAttackPredicate(this))); this.targetTasks.addTask(2, new EntityAINearestAttackableTarget<EntityLivingBase>(this, EntityLivingBase.class, 10, true, false, new EntityAspectedDemonBase.TeamAttackPredicate(this)));
@ -95,7 +95,7 @@ public class EntityCorruptedSpider extends EntityAspectedDemonBase
} }
@Override @Override
protected PathNavigate getNewNavigator(World worldIn) protected PathNavigate createNavigator(World worldIn)
{ {
return new PathNavigateClimber(this, worldIn); return new PathNavigateClimber(this, worldIn);
} }
@ -104,7 +104,7 @@ public class EntityCorruptedSpider extends EntityAspectedDemonBase
protected void entityInit() protected void entityInit()
{ {
super.entityInit(); super.entityInit();
this.dataManager.register(CLIMBING, Byte.valueOf((byte) 0)); this.dataManager.register(CLIMBING, (byte) 0);
} }
@Override @Override
@ -112,7 +112,7 @@ public class EntityCorruptedSpider extends EntityAspectedDemonBase
{ {
super.onUpdate(); super.onUpdate();
if (!this.worldObj.isRemote) if (!this.getEntityWorld().isRemote)
{ {
this.setBesideClimbableBlock(this.isCollidedHorizontally); this.setBesideClimbableBlock(this.isCollidedHorizontally);
} }
@ -168,17 +168,17 @@ public class EntityCorruptedSpider extends EntityAspectedDemonBase
@Override @Override
public boolean isPotionApplicable(PotionEffect potioneffectIn) public boolean isPotionApplicable(PotionEffect potioneffectIn)
{ {
return potioneffectIn.getPotion() == MobEffects.POISON ? false : super.isPotionApplicable(potioneffectIn); return potioneffectIn.getPotion() != MobEffects.POISON && super.isPotionApplicable(potioneffectIn);
} }
public boolean isBesideClimbableBlock() public boolean isBesideClimbableBlock()
{ {
return (((Byte) this.dataManager.get(CLIMBING)).byteValue() & 1) != 0; return (this.dataManager.get(CLIMBING) & 1) != 0;
} }
public void setBesideClimbableBlock(boolean climbing) public void setBesideClimbableBlock(boolean climbing)
{ {
byte b0 = ((Byte) this.dataManager.get(CLIMBING)).byteValue(); byte b0 = this.dataManager.get(CLIMBING);
if (climbing) if (climbing)
{ {
@ -188,7 +188,7 @@ public class EntityCorruptedSpider extends EntityAspectedDemonBase
b0 = (byte) (b0 & -2); b0 = (byte) (b0 & -2);
} }
this.dataManager.set(CLIMBING, Byte.valueOf(b0)); this.dataManager.set(CLIMBING, b0);
} }
@Override @Override
@ -213,7 +213,7 @@ public class EntityCorruptedSpider extends EntityAspectedDemonBase
if (f >= 0.5F && this.attacker.getRNG().nextInt(100) == 0) if (f >= 0.5F && this.attacker.getRNG().nextInt(100) == 0)
{ {
this.attacker.setAttackTarget((EntityLivingBase) null); this.attacker.setAttackTarget(null);
return false; return false;
} else } else
{ {
@ -240,7 +240,7 @@ public class EntityCorruptedSpider extends EntityAspectedDemonBase
public boolean shouldExecute() public boolean shouldExecute()
{ {
float f = this.taskOwner.getBrightness(1.0F); float f = this.taskOwner.getBrightness(1.0F);
return f >= 0.5F ? false : super.shouldExecute(); return !(f >= 0.5F) && super.shouldExecute();
} }
} }
} }

View file

@ -73,17 +73,17 @@ public class EntityCorruptedZombie extends EntityAspectedDemonBase
@Override @Override
public void setCombatTask() public void setCombatTask()
{ {
if (this.worldObj != null && !this.worldObj.isRemote) if (!this.getEntityWorld().isRemote)
{ {
this.tasks.removeTask(this.aiAttackOnCollide); this.tasks.removeTask(this.aiAttackOnCollide);
this.tasks.removeTask(this.aiArrowAttack); this.tasks.removeTask(this.aiArrowAttack);
ItemStack itemstack = this.getHeldItemMainhand(); ItemStack itemstack = this.getHeldItemMainhand();
if (itemstack != null && itemstack.getItem() instanceof ItemBow) if (!itemstack.isEmpty() && itemstack.getItem() instanceof ItemBow)
{ {
int i = 20; int i = 20;
if (this.worldObj.getDifficulty() != EnumDifficulty.HARD) if (this.getEntityWorld().getDifficulty() != EnumDifficulty.HARD)
{ {
i = 40; i = 40;
} }
@ -100,7 +100,7 @@ public class EntityCorruptedZombie extends EntityAspectedDemonBase
@Override @Override
public boolean attackEntityFrom(DamageSource source, float amount) public boolean attackEntityFrom(DamageSource source, float amount)
{ {
return this.isEntityInvulnerable(source) ? false : super.attackEntityFrom(source, amount); return !this.isEntityInvulnerable(source) && super.attackEntityFrom(source, amount);
} }
/** /**
@ -128,7 +128,7 @@ public class EntityCorruptedZombie extends EntityAspectedDemonBase
*/ */
public double absorbWillFromAuraToHeal(double toHeal) public double absorbWillFromAuraToHeal(double toHeal)
{ {
if (worldObj.isRemote) if (getEntityWorld().isRemote)
{ {
return 0; return 0;
} }
@ -139,13 +139,13 @@ public class EntityCorruptedZombie extends EntityAspectedDemonBase
return 0; return 0;
} }
double will = WorldDemonWillHandler.getCurrentWill(worldObj, getPosition(), getType()); double will = WorldDemonWillHandler.getCurrentWill(getEntityWorld(), getPosition(), getType());
toHeal = Math.min(healthMissing, Math.min(toHeal, will / getWillToHealth())); toHeal = Math.min(healthMissing, Math.min(toHeal, will / getWillToHealth()));
if (toHeal > 0) if (toHeal > 0)
{ {
this.heal((float) toHeal); this.heal((float) toHeal);
return WorldDemonWillHandler.drainWill(worldObj, getPosition(), getType(), toHeal * getWillToHealth(), true); return WorldDemonWillHandler.drainWill(getEntityWorld(), getPosition(), getType(), toHeal * getWillToHealth(), true);
} }
return 0; return 0;
@ -164,7 +164,7 @@ public class EntityCorruptedZombie extends EntityAspectedDemonBase
public void onUpdate() public void onUpdate()
{ {
if (!this.worldObj.isRemote && this.ticksExisted % 20 == 0) if (!this.getEntityWorld().isRemote && this.ticksExisted % 20 == 0)
{ {
absorbWillFromAuraToHeal(2); absorbWillFromAuraToHeal(2);
} }
@ -174,15 +174,8 @@ public class EntityCorruptedZombie extends EntityAspectedDemonBase
//TODO: Change to fit the given AI //TODO: Change to fit the given AI
@Override @Override
public boolean shouldAttackEntity(EntityLivingBase attacker, EntityLivingBase owner) public boolean shouldAttackEntity(EntityLivingBase attacker, EntityLivingBase owner) {
{ return !(attacker instanceof EntityCreeper) && !(attacker instanceof EntityGhast) && super.shouldAttackEntity(attacker, owner);
if (!(attacker instanceof EntityCreeper) && !(attacker instanceof EntityGhast))
{
return super.shouldAttackEntity(attacker, owner);
} else
{
return false;
}
} }
@Override @Override

View file

@ -39,8 +39,8 @@ import com.google.common.base.Predicate;
public class EntityDemonBase extends EntityCreature implements IEntityOwnable public class EntityDemonBase extends EntityCreature implements IEntityOwnable
{ {
protected static final DataParameter<Byte> TAMED = EntityDataManager.<Byte>createKey(EntityDemonBase.class, DataSerializers.BYTE); protected static final DataParameter<Byte> TAMED = EntityDataManager.createKey(EntityDemonBase.class, DataSerializers.BYTE);
protected static final DataParameter<Optional<UUID>> OWNER_UNIQUE_ID = EntityDataManager.<Optional<UUID>>createKey(EntityDemonBase.class, DataSerializers.OPTIONAL_UNIQUE_ID); protected static final DataParameter<Optional<UUID>> OWNER_UNIQUE_ID = EntityDataManager.createKey(EntityDemonBase.class, DataSerializers.OPTIONAL_UNIQUE_ID);
public EntityDemonBase(World worldIn) public EntityDemonBase(World worldIn)
{ {
@ -51,7 +51,7 @@ public class EntityDemonBase extends EntityCreature implements IEntityOwnable
protected void entityInit() protected void entityInit()
{ {
super.entityInit(); super.entityInit();
this.dataManager.register(TAMED, Byte.valueOf((byte) 0)); this.dataManager.register(TAMED, (byte) 0);
this.dataManager.register(OWNER_UNIQUE_ID, Optional.<UUID>absent()); this.dataManager.register(OWNER_UNIQUE_ID, Optional.<UUID>absent());
} }
@ -84,7 +84,7 @@ public class EntityDemonBase extends EntityCreature implements IEntityOwnable
@Override @Override
public boolean attackEntityFrom(DamageSource source, float amount) public boolean attackEntityFrom(DamageSource source, float amount)
{ {
return this.isEntityInvulnerable(source) ? false : super.attackEntityFrom(source, amount); return !this.isEntityInvulnerable(source) && super.attackEntityFrom(source, amount);
} }
/** /**
@ -106,7 +106,7 @@ public class EntityDemonBase extends EntityCreature implements IEntityOwnable
if (flag) if (flag)
{ {
if (i > 0 && attackedEntity instanceof EntityLivingBase) if (i > 0)
{ {
((EntityLivingBase) attackedEntity).knockBack(this, (float) i * 0.5F, (double) MathHelper.sin(this.rotationYaw * 0.017453292F), (double) (-MathHelper.cos(this.rotationYaw * 0.017453292F))); ((EntityLivingBase) attackedEntity).knockBack(this, (float) i * 0.5F, (double) MathHelper.sin(this.rotationYaw * 0.017453292F), (double) (-MathHelper.cos(this.rotationYaw * 0.017453292F)));
this.motionX *= 0.6D; this.motionX *= 0.6D;
@ -124,16 +124,16 @@ public class EntityDemonBase extends EntityCreature implements IEntityOwnable
{ {
EntityPlayer entityplayer = (EntityPlayer) attackedEntity; EntityPlayer entityplayer = (EntityPlayer) attackedEntity;
ItemStack itemstack = this.getHeldItemMainhand(); ItemStack itemstack = this.getHeldItemMainhand();
ItemStack itemstack1 = entityplayer.isHandActive() ? entityplayer.getActiveItemStack() : null; ItemStack itemstack1 = entityplayer.isHandActive() ? entityplayer.getActiveItemStack() : ItemStack.EMPTY;
if (itemstack != null && itemstack1 != null && itemstack.getItem() instanceof ItemAxe && itemstack1.getItem() == Items.SHIELD) if (!itemstack.isEmpty() && !itemstack1.isEmpty() && itemstack.getItem() instanceof ItemAxe && itemstack1.getItem() == Items.SHIELD)
{ {
float f1 = 0.25F + (float) EnchantmentHelper.getEfficiencyModifier(this) * 0.05F; float f1 = 0.25F + (float) EnchantmentHelper.getEfficiencyModifier(this) * 0.05F;
if (this.rand.nextFloat() < f1) if (this.rand.nextFloat() < f1)
{ {
entityplayer.getCooldownTracker().setCooldown(Items.SHIELD, 100); entityplayer.getCooldownTracker().setCooldown(Items.SHIELD, 100);
this.worldObj.setEntityState(entityplayer, (byte) 30); this.getEntityWorld().setEntityState(entityplayer, (byte) 30);
} }
} }
} }
@ -149,7 +149,7 @@ public class EntityDemonBase extends EntityCreature implements IEntityOwnable
{ {
super.setItemStackToSlot(slotIn, stack); super.setItemStackToSlot(slotIn, stack);
if (!this.worldObj.isRemote && slotIn == EntityEquipmentSlot.MAINHAND) if (!this.getEntityWorld().isRemote && slotIn == EntityEquipmentSlot.MAINHAND)
{ {
this.setCombatTask(); this.setCombatTask();
} }
@ -169,10 +169,10 @@ public class EntityDemonBase extends EntityCreature implements IEntityOwnable
{ {
this.heal((float) toHeal); this.heal((float) toHeal);
if (worldObj instanceof WorldServer) if (getEntityWorld() instanceof WorldServer)
{ {
WorldServer server = (WorldServer) worldObj; WorldServer server = (WorldServer) getEntityWorld();
server.spawnParticle(EnumParticleTypes.HEART, this.posX + (double) (this.rand.nextFloat() * this.width * 2.0F) - (double) this.width, this.posY + 0.5D + (double) (this.rand.nextFloat() * this.height), this.posZ + (double) (this.rand.nextFloat() * this.width * 2.0F) - (double) this.width, 7, 0.2, 0.2, 0.2, 0, new int[0]); server.spawnParticle(EnumParticleTypes.HEART, this.posX + (double) (this.rand.nextFloat() * this.width * 2.0F) - (double) this.width, this.posY + 0.5D + (double) (this.rand.nextFloat() * this.height), this.posZ + (double) (this.rand.nextFloat() * this.width * 2.0F) - (double) this.width, 7, 0.2, 0.2, 0.2, 0);
} }
} }
@ -207,7 +207,7 @@ public class EntityDemonBase extends EntityCreature implements IEntityOwnable
{ {
super.readEntityFromNBT(tag); super.readEntityFromNBT(tag);
String s = ""; String s;
if (tag.hasKey("OwnerUUID", 8)) if (tag.hasKey("OwnerUUID", 8))
{ {
@ -248,7 +248,7 @@ public class EntityDemonBase extends EntityCreature implements IEntityOwnable
} }
} }
return attacker instanceof EntityPlayer && owner instanceof EntityPlayer && !((EntityPlayer) owner).canAttackPlayer((EntityPlayer) attacker) ? false : !(attacker instanceof EntityHorse) || !((EntityHorse) attacker).isTame(); return !(attacker instanceof EntityPlayer && owner instanceof EntityPlayer && !((EntityPlayer) owner).canAttackPlayer((EntityPlayer) attacker)) && (!(attacker instanceof EntityHorse) || !((EntityHorse) attacker).isTame());
} else } else
{ {
return false; return false;
@ -262,19 +262,19 @@ public class EntityDemonBase extends EntityCreature implements IEntityOwnable
public boolean isTamed() public boolean isTamed()
{ {
return (((Byte) this.dataManager.get(TAMED)).byteValue() & 4) != 0; return (this.dataManager.get(TAMED) & 4) != 0;
} }
public void setTamed(boolean tamed) public void setTamed(boolean tamed)
{ {
byte b0 = ((Byte) this.dataManager.get(TAMED)).byteValue(); byte b0 = this.dataManager.get(TAMED);
if (tamed) if (tamed)
{ {
this.dataManager.set(TAMED, Byte.valueOf((byte) (b0 | 4))); this.dataManager.set(TAMED, (byte) (b0 | 4));
} else } else
{ {
this.dataManager.set(TAMED, Byte.valueOf((byte) (b0 & -5))); this.dataManager.set(TAMED, (byte) (b0 & -5));
} }
// this.setupTamedAI(); // this.setupTamedAI();
@ -316,7 +316,7 @@ public class EntityDemonBase extends EntityCreature implements IEntityOwnable
@Override @Override
public UUID getOwnerId() public UUID getOwnerId()
{ {
return (UUID) (this.dataManager.get(OWNER_UNIQUE_ID)).orNull(); return (this.dataManager.get(OWNER_UNIQUE_ID)).orNull();
} }
public void setOwnerId(UUID uuid) public void setOwnerId(UUID uuid)
@ -330,7 +330,7 @@ public class EntityDemonBase extends EntityCreature implements IEntityOwnable
try try
{ {
UUID uuid = this.getOwnerId(); UUID uuid = this.getOwnerId();
return uuid == null ? null : this.worldObj.getPlayerEntityByUUID(uuid); return uuid == null ? null : this.getEntityWorld().getPlayerEntityByUUID(uuid);
} catch (IllegalArgumentException var2) } catch (IllegalArgumentException var2)
{ {
return null; return null;

View file

@ -43,7 +43,7 @@ public class EntityMimic extends EntityDemonBase
/** /**
* Copy of EntitySpider's AI (should be pretty evident...) * Copy of EntitySpider's AI (should be pretty evident...)
*/ */
private static final DataParameter<Byte> CLIMBING = EntityDataManager.<Byte>createKey(EntityMimic.class, DataSerializers.BYTE); private static final DataParameter<Byte> CLIMBING = EntityDataManager.createKey(EntityMimic.class, DataSerializers.BYTE);
public boolean dropItemsOnBreak = true; public boolean dropItemsOnBreak = true;
public NBTTagCompound tileTag = new NBTTagCompound(); public NBTTagCompound tileTag = new NBTTagCompound();
@ -64,7 +64,7 @@ public class EntityMimic extends EntityDemonBase
this.tasks.addTask(8, new EntityAILookIdle(this)); this.tasks.addTask(8, new EntityAILookIdle(this));
this.tasks.addTask(7, new EntityAIMimicReform(this)); this.tasks.addTask(7, new EntityAIMimicReform(this));
this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false, new Class[0])); this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false));
this.targetTasks.addTask(2, new EntityMimic.AISpiderTarget(this, EntityPlayer.class)); this.targetTasks.addTask(2, new EntityMimic.AISpiderTarget(this, EntityPlayer.class));
this.targetTasks.addTask(3, new EntityMimic.AISpiderTarget(this, EntityIronGolem.class)); this.targetTasks.addTask(3, new EntityMimic.AISpiderTarget(this, EntityIronGolem.class));
} }
@ -160,7 +160,7 @@ public class EntityMimic extends EntityDemonBase
} }
BlockPos newPos = centerPos.add(i, j, k); BlockPos newPos = centerPos.add(i, j, k);
if (spawnMimicBlockAtPosition(worldObj, newPos)) if (spawnMimicBlockAtPosition(getEntityWorld(), newPos))
{ {
return true; return true;
} }
@ -178,7 +178,7 @@ public class EntityMimic extends EntityDemonBase
{ {
super.onDeath(cause); super.onDeath(cause);
if (!worldObj.isRemote) if (!getEntityWorld().isRemote)
{ {
BlockPos centerPos = this.getPosition(); BlockPos centerPos = this.getPosition();
@ -201,7 +201,7 @@ public class EntityMimic extends EntityDemonBase
} }
BlockPos newPos = centerPos.add(i, j, k); BlockPos newPos = centerPos.add(i, j, k);
if (spawnHeldBlockOnDeath(worldObj, newPos)) if (spawnHeldBlockOnDeath(getEntityWorld(), newPos))
{ {
return; return;
} }
@ -227,7 +227,7 @@ public class EntityMimic extends EntityDemonBase
* Returns new PathNavigateGround instance * Returns new PathNavigateGround instance
*/ */
@Override @Override
protected PathNavigate getNewNavigator(World worldIn) protected PathNavigate createNavigator(World worldIn)
{ {
return new PathNavigateClimber(this, worldIn); return new PathNavigateClimber(this, worldIn);
} }
@ -236,7 +236,7 @@ public class EntityMimic extends EntityDemonBase
protected void entityInit() protected void entityInit()
{ {
super.entityInit(); super.entityInit();
this.dataManager.register(CLIMBING, Byte.valueOf((byte) 0)); this.dataManager.register(CLIMBING, (byte) 0);
// this.dataManager.register(ITEMSTACK, null); // this.dataManager.register(ITEMSTACK, null);
} }
@ -246,7 +246,7 @@ public class EntityMimic extends EntityDemonBase
@Override @Override
public void onUpdate() public void onUpdate()
{ {
if (!this.worldObj.isRemote && this.worldObj.getDifficulty() == EnumDifficulty.PEACEFUL) if (!this.getEntityWorld().isRemote && this.getEntityWorld().getDifficulty() == EnumDifficulty.PEACEFUL)
{ {
if (reformIntoMimicBlock(this.getPosition())) if (reformIntoMimicBlock(this.getPosition()))
{ {
@ -256,7 +256,7 @@ public class EntityMimic extends EntityDemonBase
super.onUpdate(); super.onUpdate();
if (!this.worldObj.isRemote) if (!this.getEntityWorld().isRemote)
{ {
this.setBesideClimbableBlock(this.isCollidedHorizontally); this.setBesideClimbableBlock(this.isCollidedHorizontally);
} }
@ -324,7 +324,7 @@ public class EntityMimic extends EntityDemonBase
@Override @Override
public boolean isPotionApplicable(PotionEffect potioneffectIn) public boolean isPotionApplicable(PotionEffect potioneffectIn)
{ {
return potioneffectIn.getPotion() == MobEffects.POISON ? false : super.isPotionApplicable(potioneffectIn); return potioneffectIn.getPotion() != MobEffects.POISON && super.isPotionApplicable(potioneffectIn);
} }
/** /**
@ -333,7 +333,7 @@ public class EntityMimic extends EntityDemonBase
*/ */
public boolean isBesideClimbableBlock() public boolean isBesideClimbableBlock()
{ {
return (((Byte) this.dataManager.get(CLIMBING)).byteValue() & 1) != 0; return (this.dataManager.get(CLIMBING) & 1) != 0;
} }
/** /**
@ -342,7 +342,7 @@ public class EntityMimic extends EntityDemonBase
*/ */
public void setBesideClimbableBlock(boolean climbing) public void setBesideClimbableBlock(boolean climbing)
{ {
byte b0 = ((Byte) this.dataManager.get(CLIMBING)).byteValue(); byte b0 = this.dataManager.get(CLIMBING);
if (climbing) if (climbing)
{ {
@ -352,7 +352,7 @@ public class EntityMimic extends EntityDemonBase
b0 = (byte) (b0 & -2); b0 = (byte) (b0 & -2);
} }
this.dataManager.set(CLIMBING, Byte.valueOf(b0)); this.dataManager.set(CLIMBING, b0);
} }
public float getEyeHeight() public float getEyeHeight()

View file

@ -107,17 +107,17 @@ public class EntitySentientSpecter extends EntityDemonBase
@Override @Override
public void setCombatTask() public void setCombatTask()
{ {
if (this.worldObj != null && !this.worldObj.isRemote) if (!this.getEntityWorld().isRemote)
{ {
this.tasks.removeTask(this.aiAttackOnCollide); this.tasks.removeTask(this.aiAttackOnCollide);
this.tasks.removeTask(this.aiArrowAttack); this.tasks.removeTask(this.aiArrowAttack);
ItemStack itemstack = this.getHeldItemMainhand(); ItemStack itemstack = this.getHeldItemMainhand();
if (itemstack != null && itemstack.getItem() instanceof ItemBow) if (!itemstack.isEmpty() && itemstack.getItem() instanceof ItemBow)
{ {
int i = 20; int i = 20;
if (this.worldObj.getDifficulty() != EnumDifficulty.HARD) if (this.getEntityWorld().getDifficulty() != EnumDifficulty.HARD)
{ {
i = 40; i = 40;
} }
@ -132,16 +132,11 @@ public class EntitySentientSpecter extends EntityDemonBase
} }
@Override @Override
public boolean isPotionApplicable(PotionEffect effect) public boolean isPotionApplicable(PotionEffect effect) {
{
Potion potion = effect.getPotion(); Potion potion = effect.getPotion();
if (potion == MobEffects.REGENERATION || potion == MobEffects.INSTANT_HEALTH) //Specter cannot be healed by normal means //Specter cannot be healed by normal means
{ return !(potion == MobEffects.REGENERATION || potion == MobEffects.INSTANT_HEALTH) && super.isPotionApplicable(effect);
return false;
}
return super.isPotionApplicable(effect);
} }
public boolean canStealEffectFromOwner(EntityLivingBase owner, PotionEffect effect) public boolean canStealEffectFromOwner(EntityLivingBase owner, PotionEffect effect)
@ -280,7 +275,7 @@ public class EntitySentientSpecter extends EntityDemonBase
@Override @Override
public boolean attackEntityFrom(DamageSource source, float amount) public boolean attackEntityFrom(DamageSource source, float amount)
{ {
return this.isEntityInvulnerable(source) ? false : super.attackEntityFrom(source, amount); return !this.isEntityInvulnerable(source) && super.attackEntityFrom(source, amount);
} }
/** /**
@ -311,7 +306,7 @@ public class EntitySentientSpecter extends EntityDemonBase
{ {
super.onDeath(cause); super.onDeath(cause);
if (!worldObj.isRemote && getHeldItemMainhand() != null) if (!getEntityWorld().isRemote && !getHeldItemMainhand().isEmpty())
{ {
this.entityDropItem(getHeldItemMainhand(), 0); this.entityDropItem(getHeldItemMainhand(), 0);
} }
@ -339,20 +334,21 @@ public class EntitySentientSpecter extends EntityDemonBase
} }
@Override @Override
public boolean processInteract(EntityPlayer player, EnumHand hand, @Nullable ItemStack stack) public boolean processInteract(EntityPlayer player, EnumHand hand)
{ {
ItemStack stack = player.getHeldItem(hand);
if (this.isTamed() && player.equals(this.getOwner()) && hand == EnumHand.MAIN_HAND) if (this.isTamed() && player.equals(this.getOwner()) && hand == EnumHand.MAIN_HAND)
{ {
if (stack == null && player.isSneaking()) //Should return to the entity if (stack.isEmpty() && player.isSneaking()) //Should return to the entity
{ {
if (!worldObj.isRemote) if (!getEntityWorld().isRemote)
{ {
if (getHeldItemMainhand() != null) if (!getHeldItemMainhand().isEmpty())
{ {
this.entityDropItem(getHeldItemMainhand(), 0); this.entityDropItem(getHeldItemMainhand(), 0);
} }
if (getHeldItemOffhand() != null) if (!getHeldItemOffhand().isEmpty())
{ {
this.entityDropItem(getHeldItemOffhand(), 0); this.entityDropItem(getHeldItemOffhand(), 0);
} }
@ -367,7 +363,7 @@ public class EntitySentientSpecter extends EntityDemonBase
} }
} }
return super.processInteract(player, hand, stack); return super.processInteract(player, hand);
} }
public boolean isEntityInvulnerable(DamageSource source) public boolean isEntityInvulnerable(DamageSource source)
@ -380,9 +376,9 @@ public class EntitySentientSpecter extends EntityDemonBase
{ {
this.heal((float) toHeal); this.heal((float) toHeal);
if (worldObj instanceof WorldServer) if (getEntityWorld() instanceof WorldServer)
{ {
WorldServer server = (WorldServer) worldObj; WorldServer server = (WorldServer) getEntityWorld();
server.spawnParticle(EnumParticleTypes.HEART, this.posX + (double) (this.rand.nextFloat() * this.width * 2.0F) - (double) this.width, this.posY + 0.5D + (double) (this.rand.nextFloat() * this.height), this.posZ + (double) (this.rand.nextFloat() * this.width * 2.0F) - (double) this.width, 7, 0.2, 0.2, 0.2, 0, new int[0]); server.spawnParticle(EnumParticleTypes.HEART, this.posX + (double) (this.rand.nextFloat() * this.width * 2.0F) - (double) this.width, this.posY + 0.5D + (double) (this.rand.nextFloat() * this.height), this.posZ + (double) (this.rand.nextFloat() * this.width * 2.0F) - (double) this.width, 7, 0.2, 0.2, 0.2, 0, new int[0]);
} }
} }
@ -394,7 +390,7 @@ public class EntitySentientSpecter extends EntityDemonBase
*/ */
public double absorbWillFromAuraToHeal(double toHeal) public double absorbWillFromAuraToHeal(double toHeal)
{ {
if (worldObj.isRemote) if (getEntityWorld().isRemote)
{ {
return 0; return 0;
} }
@ -405,13 +401,13 @@ public class EntitySentientSpecter extends EntityDemonBase
return 0; return 0;
} }
double will = WorldDemonWillHandler.getCurrentWill(worldObj, getPosition(), getType()); double will = WorldDemonWillHandler.getCurrentWill(getEntityWorld(), getPosition(), getType());
toHeal = Math.min(healthMissing, Math.min(toHeal, will / getWillToHealth())); toHeal = Math.min(healthMissing, Math.min(toHeal, will / getWillToHealth()));
if (toHeal > 0) if (toHeal > 0)
{ {
this.heal((float) toHeal); this.heal((float) toHeal);
return WorldDemonWillHandler.drainWill(worldObj, getPosition(), getType(), toHeal * getWillToHealth(), true); return WorldDemonWillHandler.drainWill(getEntityWorld(), getPosition(), getType(), toHeal * getWillToHealth(), true);
} }
return 0; return 0;
@ -430,7 +426,7 @@ public class EntitySentientSpecter extends EntityDemonBase
public void onUpdate() public void onUpdate()
{ {
if (!this.worldObj.isRemote && this.ticksExisted % 20 == 0) if (!this.getEntityWorld().isRemote && this.ticksExisted % 20 == 0)
{ {
absorbWillFromAuraToHeal(2); absorbWillFromAuraToHeal(2);
} }
@ -485,7 +481,7 @@ public class EntitySentientSpecter extends EntityDemonBase
ItemStack heldStack = this.getItemStackFromSlot(EntityEquipmentSlot.MAINHAND); ItemStack heldStack = this.getItemStackFromSlot(EntityEquipmentSlot.MAINHAND);
if (heldStack != null && heldStack.getItem() == ModItems.SENTIENT_BOW) if (heldStack != null && heldStack.getItem() == ModItems.SENTIENT_BOW)
{ {
EntityTippedArrow arrowEntity = ((ItemSentientBow) heldStack.getItem()).getArrowEntity(worldObj, heldStack, target, this, velocity); EntityTippedArrow arrowEntity = ((ItemSentientBow) heldStack.getItem()).getArrowEntity(getEntityWorld(), heldStack, target, this, velocity);
if (arrowEntity != null) if (arrowEntity != null)
{ {
List<PotionEffect> effects = getPotionEffectsForArrowRemovingDuration(0.2f); List<PotionEffect> effects = getPotionEffectsForArrowRemovingDuration(0.2f);
@ -495,19 +491,19 @@ public class EntitySentientSpecter extends EntityDemonBase
} }
this.playSound(SoundEvents.ENTITY_SKELETON_SHOOT, 1.0F, 1.0F / (this.getRNG().nextFloat() * 0.4F + 0.8F)); this.playSound(SoundEvents.ENTITY_SKELETON_SHOOT, 1.0F, 1.0F / (this.getRNG().nextFloat() * 0.4F + 0.8F));
this.worldObj.spawnEntityInWorld(arrowEntity); this.getEntityWorld().spawnEntity(arrowEntity);
} }
} else } else
{ {
EntityTippedArrow entitytippedarrow = new EntityTippedArrow(this.worldObj, this); //TODO: Change to an arrow created by the Sentient Bow EntityTippedArrow entitytippedarrow = new EntityTippedArrow(this.getEntityWorld(), this); //TODO: Change to an arrow created by the Sentient Bow
double d0 = target.posX - this.posX; double d0 = target.posX - this.posX;
double d1 = target.getEntityBoundingBox().minY + (double) (target.height / 3.0F) - entitytippedarrow.posY; double d1 = target.getEntityBoundingBox().minY + (double) (target.height / 3.0F) - entitytippedarrow.posY;
double d2 = target.posZ - this.posZ; double d2 = target.posZ - this.posZ;
double d3 = (double) MathHelper.sqrt_double(d0 * d0 + d2 * d2); double d3 = (double) MathHelper.sqrt(d0 * d0 + d2 * d2);
entitytippedarrow.setThrowableHeading(d0, d1 + d3 * 0.2, d2, 1.6F, 0); //TODO: Yes, it is an accurate arrow. Don't be hatin' entitytippedarrow.setThrowableHeading(d0, d1 + d3 * 0.2, d2, 1.6F, 0); //TODO: Yes, it is an accurate arrow. Don't be hatin'
int i = EnchantmentHelper.getMaxEnchantmentLevel(Enchantments.POWER, this); int i = EnchantmentHelper.getMaxEnchantmentLevel(Enchantments.POWER, this);
int j = EnchantmentHelper.getMaxEnchantmentLevel(Enchantments.PUNCH, this); int j = EnchantmentHelper.getMaxEnchantmentLevel(Enchantments.PUNCH, this);
entitytippedarrow.setDamage((double) (velocity * 2.0F) + this.rand.nextGaussian() * 0.25D + (double) ((float) this.worldObj.getDifficulty().getDifficultyId() * 0.11F)); entitytippedarrow.setDamage((double) (velocity * 2.0F) + this.rand.nextGaussian() * 0.25D + (double) ((float) this.getEntityWorld().getDifficulty().getDifficultyId() * 0.11F));
if (i > 0) if (i > 0)
{ {
@ -533,7 +529,7 @@ public class EntitySentientSpecter extends EntityDemonBase
} }
this.playSound(SoundEvents.ENTITY_SKELETON_SHOOT, 1.0F, 1.0F / (this.getRNG().nextFloat() * 0.4F + 0.8F)); this.playSound(SoundEvents.ENTITY_SKELETON_SHOOT, 1.0F, 1.0F / (this.getRNG().nextFloat() * 0.4F + 0.8F));
this.worldObj.spawnEntityInWorld(entitytippedarrow); this.getEntityWorld().spawnEntity(entitytippedarrow);
} }
} }

View file

@ -61,7 +61,7 @@ public class EntityBloodLight extends EntityThrowable implements IThrowableEntit
@Override @Override
public void setThrowableHeading(double var1, double var3, double var5, float var7, float var8) public void setThrowableHeading(double var1, double var3, double var5, float var7, float var8)
{ {
float var9 = MathHelper.sqrt_double(var1 * var1 + var3 * var3 + var5 * var5); float var9 = MathHelper.sqrt(var1 * var1 + var3 * var3 + var5 * var5);
var1 /= var9; var1 /= var9;
var3 /= var9; var3 /= var9;
var5 /= var9; var5 /= var9;
@ -74,7 +74,7 @@ public class EntityBloodLight extends EntityThrowable implements IThrowableEntit
motionX = var1; motionX = var1;
motionY = var3; motionY = var3;
motionZ = var5; motionZ = var5;
float var10 = MathHelper.sqrt_double(var1 * var1 + var5 * var5); float var10 = MathHelper.sqrt(var1 * var1 + var5 * var5);
prevRotationYaw = rotationYaw = (float) (Math.atan2(var1, var5) * 180.0D / Math.PI); prevRotationYaw = rotationYaw = (float) (Math.atan2(var1, var5) * 180.0D / Math.PI);
prevRotationPitch = rotationPitch = (float) (Math.atan2(var3, var10) * 180.0D / Math.PI); prevRotationPitch = rotationPitch = (float) (Math.atan2(var3, var10) * 180.0D / Math.PI);
} }
@ -105,9 +105,9 @@ public class EntityBloodLight extends EntityThrowable implements IThrowableEntit
EnumFacing sideHit = mop.sideHit; EnumFacing sideHit = mop.sideHit;
BlockPos blockPos = mop.getBlockPos().offset(sideHit); BlockPos blockPos = mop.getBlockPos().offset(sideHit);
if (worldObj.isAirBlock(blockPos)) if (getEntityWorld().isAirBlock(blockPos))
{ {
worldObj.setBlockState(blockPos, ModBlocks.BLOOD_LIGHT.getDefaultState()); getEntityWorld().setBlockState(blockPos, ModBlocks.BLOOD_LIGHT.getDefaultState());
} }
} }
@ -129,9 +129,9 @@ public class EntityBloodLight extends EntityThrowable implements IThrowableEntit
} }
} }
if (worldObj.isAirBlock(new BlockPos((int) this.posX, (int) this.posY, (int) this.posZ))) if (getEntityWorld().isAirBlock(new BlockPos((int) this.posX, (int) this.posY, (int) this.posZ)))
{ {
worldObj.setBlockState(new BlockPos((int) this.posX, (int) this.posY, (int) this.posZ), Blocks.FIRE.getDefaultState()); getEntityWorld().setBlockState(new BlockPos((int) this.posX, (int) this.posY, (int) this.posZ), Blocks.FIRE.getDefaultState());
} }
// spawnHitParticles("magicCrit", 8); // spawnHitParticles("magicCrit", 8);

View file

@ -95,12 +95,12 @@ public class EntityMeteor extends EntityThrowable implements IThrowableEntity
public void generateMeteor(BlockPos pos) public void generateMeteor(BlockPos pos)
{ {
MeteorRegistry.generateMeteorForItem(meteorStack, worldObj, pos, Blocks.STONE.getDefaultState(), radiusModifier, explosionModifier, fillerChance); MeteorRegistry.generateMeteorForItem(meteorStack, getEntityWorld(), pos, Blocks.STONE.getDefaultState(), radiusModifier, explosionModifier, fillerChance);
} }
public DamageSource getDamageSource() public DamageSource getDamageSource()
{ {
return DamageSource.anvil; return DamageSource.ANVIL;
} }
@Override @Override
@ -127,7 +127,7 @@ public class EntityMeteor extends EntityThrowable implements IThrowableEntity
radiusModifier = nbt.getDouble("radiusModifier"); radiusModifier = nbt.getDouble("radiusModifier");
explosionModifier = nbt.getDouble("explosionModifier"); explosionModifier = nbt.getDouble("explosionModifier");
fillerChance = nbt.getDouble("fillerChance"); fillerChance = nbt.getDouble("fillerChance");
meteorStack = ItemStack.loadItemStackFromNBT(nbt); meteorStack = new ItemStack(nbt);
} }
@Override @Override

View file

@ -41,7 +41,7 @@ public class EntitySentientArrow extends EntityTippedArrow
{ {
if (this.shootingEntity instanceof EntityPlayer) if (this.shootingEntity instanceof EntityPlayer)
{ {
if (hitEntity.worldObj.getDifficulty() != EnumDifficulty.PEACEFUL && !(hitEntity instanceof IMob)) if (hitEntity.getEntityWorld().getDifficulty() != EnumDifficulty.PEACEFUL && !(hitEntity instanceof IMob))
{ {
return; return;
} }

View file

@ -39,7 +39,7 @@ public class EntitySoulSnare extends EntityThrowable
if (result.entityHit != null && result.entityHit != this.getThrower()) if (result.entityHit != null && result.entityHit != this.getThrower())
{ {
if (result.entityHit instanceof EntityLivingBase && result.entityHit.worldObj.rand.nextDouble() < 0.25) if (result.entityHit instanceof EntityLivingBase && result.entityHit.getEntityWorld().rand.nextDouble() < 0.25)
{ {
((EntityLivingBase) result.entityHit).addPotionEffect(new PotionEffect(ModPotions.soulSnare, 300, 0)); ((EntityLivingBase) result.entityHit).addPotionEffect(new PotionEffect(ModPotions.soulSnare, 300, 0));
} }
@ -49,10 +49,10 @@ public class EntitySoulSnare extends EntityThrowable
for (int j = 0; j < 8; ++j) for (int j = 0; j < 8; ++j)
{ {
this.worldObj.spawnParticle(EnumParticleTypes.SNOWBALL, this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D, new int[0]); this.getEntityWorld().spawnParticle(EnumParticleTypes.SNOWBALL, this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D);
} }
if (!this.worldObj.isRemote) if (!this.getEntityWorld().isRemote)
{ {
this.setDead(); this.setDead();
} }

View file

@ -5,31 +5,13 @@ import net.minecraft.network.EnumPacketDirection;
import net.minecraft.network.NetHandlerPlayServer; import net.minecraft.network.NetHandlerPlayServer;
import net.minecraft.network.NetworkManager; import net.minecraft.network.NetworkManager;
import net.minecraft.network.Packet; import net.minecraft.network.Packet;
import net.minecraft.network.play.client.CPacketAnimation; import net.minecraft.network.play.client.*;
import net.minecraft.network.play.client.CPacketChatMessage; import net.minecraft.network.play.server.SPacketPlayerPosLook;
import net.minecraft.network.play.client.CPacketClickWindow;
import net.minecraft.network.play.client.CPacketClientSettings;
import net.minecraft.network.play.client.CPacketClientStatus;
import net.minecraft.network.play.client.CPacketCloseWindow;
import net.minecraft.network.play.client.CPacketConfirmTransaction;
import net.minecraft.network.play.client.CPacketCreativeInventoryAction;
import net.minecraft.network.play.client.CPacketEnchantItem;
import net.minecraft.network.play.client.CPacketEntityAction;
import net.minecraft.network.play.client.CPacketHeldItemChange;
import net.minecraft.network.play.client.CPacketInput;
import net.minecraft.network.play.client.CPacketKeepAlive;
import net.minecraft.network.play.client.CPacketPlayer;
import net.minecraft.network.play.client.CPacketPlayerAbilities;
import net.minecraft.network.play.client.CPacketPlayerDigging;
import net.minecraft.network.play.client.CPacketPlayerTryUseItem;
import net.minecraft.network.play.client.CPacketResourcePackStatus;
import net.minecraft.network.play.client.CPacketSpectate;
import net.minecraft.network.play.client.CPacketTabComplete;
import net.minecraft.network.play.client.CPacketUpdateSign;
import net.minecraft.network.play.client.CPacketUseEntity;
import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.FMLCommonHandler;
import java.util.Set;
/** /**
* All credits for this go to CrazyPants, from EIO * All credits for this go to CrazyPants, from EIO
*/ */
@ -47,7 +29,47 @@ public class FakeNetHandlerPlayServer extends NetHandlerPlayServer
} }
@Override @Override
public void kickPlayerFromServer(String p_147360_1_) public void update()
{
}
@Override
public void disconnect(String reason)
{
}
@Override
public void processVehicleMove(CPacketVehicleMove packetIn)
{
}
@Override
public void processConfirmTeleport(CPacketConfirmTeleport packetIn)
{
}
@Override
public void setPlayerLocation(double x, double y, double z, float yaw, float pitch, Set<SPacketPlayerPosLook.EnumFlags> relativeSet)
{
}
@Override
public void processTryUseItemOnBlock(CPacketPlayerTryUseItemOnBlock packetIn)
{
}
@Override
public void processTryUseItem(CPacketPlayerTryUseItem packetIn)
{
}
@Override
public void processSteerBoat(CPacketSteerBoat packetIn)
{
}
@Override
public void processCustomPayload(CPacketCustomPayload packetIn)
{ {
} }
@ -71,11 +93,6 @@ public class FakeNetHandlerPlayServer extends NetHandlerPlayServer
{ {
} }
@Override
public void processPlayerBlockPlacement(CPacketPlayerTryUseItem packetIn)
{
}
@Override @Override
public void onDisconnect(ITextComponent p_147231_1_) public void onDisconnect(ITextComponent p_147231_1_)
{ {

View file

@ -16,8 +16,6 @@ import com.mojang.authlib.GameProfile;
*/ */
public class FakePlayerBM extends FakePlayer public class FakePlayerBM extends FakePlayer
{ {
ItemStack prevWeapon;
public FakePlayerBM(World world, BlockPos pos, GameProfile profile) public FakePlayerBM(World world, BlockPos pos, GameProfile profile)
{ {
super(FMLCommonHandler.instance().getMinecraftServerInstance().worldServerForDimension(world.provider.getDimension()), profile); super(FMLCommonHandler.instance().getMinecraftServerInstance().worldServerForDimension(world.provider.getDimension()), profile);

View file

@ -34,7 +34,7 @@ public class Serializers
@Override @Override
public EnumDemonWillType read(PacketBuffer buf) public EnumDemonWillType read(PacketBuffer buf)
{ {
return (EnumDemonWillType) buf.readEnumValue(EnumDemonWillType.class); return buf.readEnumValue(EnumDemonWillType.class);
} }
@Override @Override

View file

@ -94,12 +94,8 @@ public class InversionPillarHandler
{ {
List<BlockPos> otherPosList = willMap.get(type); List<BlockPos> otherPosList = willMap.get(type);
Iterator<BlockPos> posIterator = otherPosList.iterator(); for (BlockPos closePos : otherPosList) {
while (posIterator.hasNext()) if (!closePos.equals(pos) && closePos.distanceSq(pos) <= farthestDistanceSquared) {
{
BlockPos closePos = posIterator.next();
if (!closePos.equals(pos) && closePos.distanceSq(pos) <= farthestDistanceSquared)
{
closePosList.add(closePos); closePosList.add(closePos);
} }
} }
@ -113,16 +109,11 @@ public class InversionPillarHandler
{ {
Map<BlockPos, List<BlockPos>> posMap = willMap.get(type); Map<BlockPos, List<BlockPos>> posMap = willMap.get(type);
Iterator<BlockPos> closePosIterator = closePosList.iterator(); for (BlockPos closePos : closePosList) {
while (closePosIterator.hasNext())
{
BlockPos closePos = closePosIterator.next();
List<BlockPos> posList = posMap.get(closePos); List<BlockPos> posList = posMap.get(closePos);
if (posList != null && !posList.contains(pos)) if (posList != null && !posList.contains(pos)) {
{
posList.add(pos); posList.add(pos);
} else } else {
{
posList = new ArrayList<BlockPos>(); posList = new ArrayList<BlockPos>();
posList.add(pos); posList.add(pos);
posMap.put(closePos, posList); posMap.put(closePos, posList);
@ -220,18 +211,12 @@ public class InversionPillarHandler
//Positions that are new this iteration and need to be dumped into uncheckedPosList next iteration. //Positions that are new this iteration and need to be dumped into uncheckedPosList next iteration.
List<BlockPos> newPosList = new ArrayList<BlockPos>(); List<BlockPos> newPosList = new ArrayList<BlockPos>();
Iterator<BlockPos> itr = uncheckedPosList.iterator(); for (BlockPos checkPos : uncheckedPosList) {
while (itr.hasNext())
{
BlockPos checkPos = itr.next();
List<BlockPos> posList = posMap.get(checkPos); List<BlockPos> posList = posMap.get(checkPos);
if (posList != null) if (posList != null) {
{ for (BlockPos testPos : posList) {
for (BlockPos testPos : posList)
{
//Check if the position has already been checked, is scheduled to be checked, or is already found it needs to be checked. //Check if the position has already been checked, is scheduled to be checked, or is already found it needs to be checked.
if (!checkedPosList.contains(testPos) && !uncheckedPosList.contains(testPos) && !newPosList.contains(testPos)) if (!checkedPosList.contains(testPos) && !uncheckedPosList.contains(testPos) && !newPosList.contains(testPos)) {
{
newPosList.add(testPos); newPosList.add(testPos);
} }
} }

View file

@ -52,6 +52,8 @@ import WayofTime.bloodmagic.util.helper.TextHelper;
import com.google.common.collect.HashMultimap; import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap; import com.google.common.collect.Multimap;
import javax.annotation.Nullable;
public class ItemLivingArmour extends ItemArmor implements ISpecialArmor, IMeshProvider public class ItemLivingArmour extends ItemArmor implements ISpecialArmor, IMeshProvider
{ {
private static Field _FLAGS = ReflectionHelper.findField(Entity.class, "FLAGS", "field_184240_ax"); private static Field _FLAGS = ReflectionHelper.findField(Entity.class, "FLAGS", "field_184240_ax");
@ -138,12 +140,12 @@ public class ItemLivingArmour extends ItemArmor implements ISpecialArmor, IMeshP
int maxAbsorption = 100000; int maxAbsorption = 100000;
if (source.equals(DamageSource.drown)) if (source.equals(DamageSource.DROWN))
{ {
return new ArmorProperties(-1, 0, 0); return new ArmorProperties(-1, 0, 0);
} }
if (source.equals(DamageSource.outOfWorld)) if (source.equals(DamageSource.OUT_OF_WORLD))
{ {
return new ArmorProperties(-1, 0, 0); return new ArmorProperties(-1, 0, 0);
} }
@ -243,7 +245,7 @@ public class ItemLivingArmour extends ItemArmor implements ISpecialArmor, IMeshP
if (damage > this.getMaxDamage(stack) - this.getDamage(stack)) if (damage > this.getMaxDamage(stack) - this.getDamage(stack))
{ {
//TODO: Syphon a load of LP. //TODO: Syphon a load of LP.
if (entity.worldObj.isRemote && entity instanceof EntityPlayer) if (entity.getEntityWorld().isRemote && entity instanceof EntityPlayer)
{ {
EntityPlayer player = (EntityPlayer) entity; EntityPlayer player = (EntityPlayer) entity;
SoulNetwork network = NetworkHelper.getSoulNetwork(player); SoulNetwork network = NetworkHelper.getSoulNetwork(player);
@ -307,7 +309,7 @@ public class ItemLivingArmour extends ItemArmor implements ISpecialArmor, IMeshP
if (tracker != null) if (tracker != null)
{ {
double progress = tracker.getProgress(armour, upgrade.getUpgradeLevel()); double progress = tracker.getProgress(armour, upgrade.getUpgradeLevel());
tooltip.add(TextHelper.localize("tooltip.BloodMagic.livingArmour.upgrade.progress", TextHelper.localize(upgrade.getUnlocalizedName()), MathHelper.clamp_int((int) (progress * 100D), 0, 100))); tooltip.add(TextHelper.localize("tooltip.BloodMagic.livingArmour.upgrade.progress", TextHelper.localize(upgrade.getUnlocalizedName()), MathHelper.clamp((int) (progress * 100D), 0, 100)));
} }
} else } else
{ {
@ -458,6 +460,7 @@ public class ItemLivingArmour extends ItemArmor implements ISpecialArmor, IMeshP
return ret; return ret;
} }
@Nullable
public static LivingArmour getLivingArmourFromStack(ItemStack stack) public static LivingArmour getLivingArmourFromStack(ItemStack stack)
{ {
NBTTagCompound livingTag = getArmourTag(stack); NBTTagCompound livingTag = getArmourTag(stack);
@ -549,6 +552,7 @@ public class ItemLivingArmour extends ItemArmor implements ISpecialArmor, IMeshP
return uuid != null && armourMap.containsKey(uuid); return uuid != null && armourMap.containsKey(uuid);
} }
@Nullable
public static LivingArmour getLivingArmour(ItemStack stack) public static LivingArmour getLivingArmour(ItemStack stack)
{ {
UUID uuid = Utils.getUUID(stack); UUID uuid = Utils.getUUID(stack);

View file

@ -197,7 +197,7 @@ public class LivingArmour implements ILivingArmour
continue; continue;
} }
if ((world.isRemote && upgrade.runOnClient()) || !world.isRemote) if (!world.isRemote || upgrade.runOnClient())
{ {
upgrade.onTick(world, player, this); upgrade.onTick(world, player, this);
} }
@ -385,7 +385,7 @@ public class LivingArmour implements ILivingArmour
continue; continue;
} }
ItemStack slotStack = player.getItemStackFromSlot(slot); ItemStack slotStack = player.getItemStackFromSlot(slot);
if (slotStack == null || !(slotStack.getItem() instanceof ItemLivingArmour)) if (slotStack.isEmpty() || !(slotStack.getItem() instanceof ItemLivingArmour))
return false; return false;
} }

View file

@ -22,8 +22,8 @@ public class LivingArmourUpgradeDisoriented extends LivingArmourUpgrade
{ {
if (world.isRemote && player.ticksExisted % 20 == 0 && world.rand.nextDouble() <= chance[this.level]) if (world.isRemote && player.ticksExisted % 20 == 0 && world.rand.nextDouble() <= chance[this.level])
{ {
player.rotationYaw = (float) (world.rand.nextFloat() * 360); player.rotationYaw = world.rand.nextFloat() * 360;
player.rotationPitch = (float) (world.rand.nextFloat() * 180 - 90); player.rotationPitch = world.rand.nextFloat() * 180 - 90;
} }
} }

View file

@ -36,7 +36,7 @@ public class LivingArmourUpgradeMeleeDecrease extends LivingArmourUpgrade
{ {
Multimap<String, AttributeModifier> modifierMap = HashMultimap.<String, AttributeModifier>create(); Multimap<String, AttributeModifier> modifierMap = HashMultimap.<String, AttributeModifier>create();
modifierMap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getAttributeUnlocalizedName(), new AttributeModifier(new UUID(0271023, 5321), "damage modifier" + 2, meleeDamage[this.level], 1)); modifierMap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(), new AttributeModifier(new UUID(271023, 5321), "damage modifier" + 2, meleeDamage[this.level], 1));
return modifierMap; return modifierMap;
} }

View file

@ -29,7 +29,7 @@ public class LivingArmourUpgradeSlowness extends LivingArmourUpgrade
{ {
Multimap<String, AttributeModifier> modifierMap = HashMultimap.<String, AttributeModifier>create(); Multimap<String, AttributeModifier> modifierMap = HashMultimap.<String, AttributeModifier>create();
modifierMap.put(SharedMonsterAttributes.MOVEMENT_SPEED.getAttributeUnlocalizedName(), new AttributeModifier(new UUID(85472, 8502), "speed modifier" + 2, speedModifier[this.level], 1)); modifierMap.put(SharedMonsterAttributes.MOVEMENT_SPEED.getName(), new AttributeModifier(new UUID(85472, 8502), "speed modifier" + 2, speedModifier[this.level], 1));
return modifierMap; return modifierMap;
} }

View file

@ -19,7 +19,7 @@ public class LivingArmourUpgradeFallProtect extends LivingArmourUpgrade
@Override @Override
public double getArmourProtection(EntityLivingBase wearer, DamageSource source) public double getArmourProtection(EntityLivingBase wearer, DamageSource source)
{ {
if (source.equals(DamageSource.fall)) if (source.equals(DamageSource.FALL))
{ {
return protectionLevel[this.level]; return protectionLevel[this.level];
} }

View file

@ -34,7 +34,7 @@ public class LivingArmourUpgradeHealthboost extends LivingArmourUpgrade
{ {
Multimap<String, AttributeModifier> modifierMap = HashMultimap.<String, AttributeModifier>create(); Multimap<String, AttributeModifier> modifierMap = HashMultimap.<String, AttributeModifier>create();
modifierMap.put(SharedMonsterAttributes.MAX_HEALTH.getAttributeUnlocalizedName(), new AttributeModifier(new UUID(9423688, 1), "Health modifier" + 1, healthModifier[this.level], 0)); modifierMap.put(SharedMonsterAttributes.MAX_HEALTH.getName(), new AttributeModifier(new UUID(9423688, 1), "Health modifier" + 1, healthModifier[this.level], 0));
return modifierMap; return modifierMap;
} }

View file

@ -26,11 +26,11 @@ public class LivingArmourUpgradeKnockbackResist extends LivingArmourUpgrade
{ {
Multimap<String, AttributeModifier> modifierMap = HashMultimap.<String, AttributeModifier>create(); Multimap<String, AttributeModifier> modifierMap = HashMultimap.<String, AttributeModifier>create();
modifierMap.put(SharedMonsterAttributes.KNOCKBACK_RESISTANCE.getAttributeUnlocalizedName(), new AttributeModifier(new UUID(895132, 1), "Knockback modifier" + 1, kbModifier[this.level], 0)); modifierMap.put(SharedMonsterAttributes.KNOCKBACK_RESISTANCE.getName(), new AttributeModifier(new UUID(895132, 1), "Knockback modifier" + 1, kbModifier[this.level], 0));
if (healthModifier[this.level] > 0) if (healthModifier[this.level] > 0)
{ {
modifierMap.put(SharedMonsterAttributes.MAX_HEALTH.getAttributeUnlocalizedName(), new AttributeModifier(new UUID(952142, 1), "Health modifier" + 1, healthModifier[this.level], 0)); modifierMap.put(SharedMonsterAttributes.MAX_HEALTH.getName(), new AttributeModifier(new UUID(952142, 1), "Health modifier" + 1, healthModifier[this.level], 0));
} }
return modifierMap; return modifierMap;

View file

@ -34,7 +34,7 @@ public class LivingArmourUpgradeMeleeDamage extends LivingArmourUpgrade
{ {
Multimap<String, AttributeModifier> modifierMap = HashMultimap.<String, AttributeModifier>create(); Multimap<String, AttributeModifier> modifierMap = HashMultimap.<String, AttributeModifier>create();
modifierMap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getAttributeUnlocalizedName(), new AttributeModifier(new UUID(9423688, 1), "damage modifier" + 1, meleeDamage[this.level], 0)); modifierMap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(), new AttributeModifier(new UUID(9423688, 1), "damage modifier" + 1, meleeDamage[this.level], 0));
return modifierMap; return modifierMap;
} }

View file

@ -32,7 +32,7 @@ public class LivingArmourUpgradeRepairing extends LivingArmourUpgrade
EntityEquipmentSlot randomSlot = EntityEquipmentSlot.values()[2 + world.rand.nextInt(4)]; EntityEquipmentSlot randomSlot = EntityEquipmentSlot.values()[2 + world.rand.nextInt(4)];
ItemStack repairStack = player.getItemStackFromSlot(randomSlot); ItemStack repairStack = player.getItemStackFromSlot(randomSlot);
if (repairStack != null) if (!repairStack.isEmpty())
{ {
if (repairStack.isItemStackDamageable() && repairStack.isItemDamaged()) if (repairStack.isItemStackDamageable() && repairStack.isItemDamaged())
{ {

View file

@ -29,7 +29,7 @@ public class LivingArmourUpgradeSolarPowered extends LivingArmourUpgrade
@Override @Override
public double getArmourProtection(EntityLivingBase wearer, DamageSource source) public double getArmourProtection(EntityLivingBase wearer, DamageSource source)
{ {
if (wearer.worldObj.canSeeSky(wearer.getPosition()) || wearer.worldObj.provider.isDaytime()) if (wearer.getEntityWorld().canSeeSky(wearer.getPosition()) || wearer.getEntityWorld().provider.isDaytime())
{ {
return protectionLevel[this.level]; return protectionLevel[this.level];
} }

View file

@ -61,7 +61,7 @@ public class LivingArmourUpgradeSpeed extends LivingArmourUpgrade
if (healthModifier[this.level] > 0) if (healthModifier[this.level] > 0)
{ {
modifierMap.put(SharedMonsterAttributes.MAX_HEALTH.getAttributeUnlocalizedName(), new AttributeModifier(new UUID(952142, 1), "Health modifier" + 1, healthModifier[this.level], 0)); modifierMap.put(SharedMonsterAttributes.MAX_HEALTH.getName(), new AttributeModifier(new UUID(952142, 1), "Health modifier" + 1, healthModifier[this.level], 0));
} }
return modifierMap; return modifierMap;

View file

@ -7,9 +7,11 @@ import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.registry.ForgeRegistries;
import net.minecraftforge.oredict.OreDictionary; import net.minecraftforge.oredict.OreDictionary;
import WayofTime.bloodmagic.util.Utils; import WayofTime.bloodmagic.util.Utils;
@ -34,8 +36,8 @@ public class MeteorComponent
meta = Integer.parseInt(stringList[2]); meta = Integer.parseInt(stringList[2]);
} }
Block ore = Block.REGISTRY.getObject(new ResourceLocation(domain, block)); Block ore = ForgeRegistries.BLOCKS.getValue(new ResourceLocation(domain, block));
if (ore != null) if (ore != Blocks.AIR)
{ {
return ore.getStateFromMeta(meta); return ore.getStateFromMeta(meta);
} }

View file

@ -59,7 +59,7 @@ public class PlayerVelocityPacketProcessor implements IMessage, IMessageHandler<
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void onMessageFromServer() public void onMessageFromServer()
{ {
EntityPlayer player = Minecraft.getMinecraft().thePlayer; EntityPlayer player = Minecraft.getMinecraft().player;
player.motionX = motionX; player.motionX = motionX;
player.motionY = motionY; player.motionY = motionY;
player.motionZ = motionZ; player.motionZ = motionZ;

View file

@ -30,7 +30,7 @@ public class BMPotionUtils
public static double damageMobAndGrowSurroundingPlants(EntityLivingBase entity, int horizontalRadius, int verticalRadius, double damageRatio, int maxPlantsGrown) public static double damageMobAndGrowSurroundingPlants(EntityLivingBase entity, int horizontalRadius, int verticalRadius, double damageRatio, int maxPlantsGrown)
{ {
World world = entity.worldObj; World world = entity.getEntityWorld();
if (world.isRemote) if (world.isRemote)
{ {
return 0; return 0;

View file

@ -59,12 +59,10 @@ public class PotionEventHandlers
{ {
int d0 = 3; int d0 = 3;
AxisAlignedBB axisAlignedBB = new AxisAlignedBB(event.getEntityLiving().posX - 0.5, event.getEntityLiving().posY - 0.5, event.getEntityLiving().posZ - 0.5, event.getEntityLiving().posX + 0.5, event.getEntityLiving().posY + 0.5, event.getEntityLiving().posZ + 0.5).expand(d0, d0, d0); AxisAlignedBB axisAlignedBB = new AxisAlignedBB(event.getEntityLiving().posX - 0.5, event.getEntityLiving().posY - 0.5, event.getEntityLiving().posZ - 0.5, event.getEntityLiving().posX + 0.5, event.getEntityLiving().posY + 0.5, event.getEntityLiving().posZ + 0.5).expand(d0, d0, d0);
List entityList = event.getEntityLiving().worldObj.getEntitiesWithinAABB(Entity.class, axisAlignedBB); List<Entity> entityList = event.getEntityLiving().getEntityWorld().getEntitiesWithinAABB(Entity.class, axisAlignedBB);
for (Object thing : entityList) for (Entity projectile : entityList)
{ {
Entity projectile = (Entity) thing;
if (projectile == null) if (projectile == null)
continue; continue;
if (!(projectile instanceof IProjectile)) if (!(projectile instanceof IProjectile))

View file

@ -76,8 +76,9 @@ public class ItemPotionFlask extends Item implements IVariantProvider
} }
@Override @Override
public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand) public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand)
{ {
ItemStack stack = player.getHeldItem(hand);
int remainingUses = stack.getMaxDamage() - stack.getItemDamage(); int remainingUses = stack.getMaxDamage() - stack.getItemDamage();
if (remainingUses <= 0) if (remainingUses <= 0)
{ {

View file

@ -51,13 +51,11 @@ public class AlchemyTableDyeableRecipe extends AlchemyTableRecipe
if (match) if (match)
{ {
inputItemLocation = x; inputItemLocation = x;
continue;
} else } else
{ {
if (slot.getItem() == Items.NAME_TAG || slot.getItem() == Items.DYE) if (slot.getItem() == Items.NAME_TAG || slot.getItem() == Items.DYE)
{ {
nameTagOrDyeLocation = x; nameTagOrDyeLocation = x;
continue;
} }
} }
} }
@ -108,30 +106,19 @@ public class AlchemyTableDyeableRecipe extends AlchemyTableRecipe
boolean hasNameTagOrDye = false; boolean hasNameTagOrDye = false;
boolean hasInputItem = false; boolean hasInputItem = false;
for (int x = 0; x < checkedList.size(); x++) for (ItemStack slot : checkedList) {
{ if (slot != null) {
ItemStack slot = checkedList.get(x);
if (slot != null)
{
boolean match = OreDictionary.itemMatches(inputItem, slot, false); boolean match = OreDictionary.itemMatches(inputItem, slot, false);
if (match && hasInputItem) if (match && hasInputItem) {
{
return false; return false;
} else if (match) } else if (match) {
{
hasInputItem = true; hasInputItem = true;
continue; } else {
} else if (slot.getItem() == Items.NAME_TAG || slot.getItem() == Items.DYE) {
{ if (hasNameTagOrDye) {
if (slot.getItem() == Items.NAME_TAG || slot.getItem() == Items.DYE)
{
if (hasNameTagOrDye)
{
return false; return false;
} else } else {
{
hasNameTagOrDye = true; hasNameTagOrDye = true;
} }
} }

View file

@ -1,9 +1,6 @@
package WayofTime.bloodmagic.recipe.alchemyTable; package WayofTime.bloodmagic.recipe.alchemyTable;
import java.util.ArrayList; import java.util.*;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion; import net.minecraft.potion.Potion;
@ -38,7 +35,7 @@ public class AlchemyTablePotionAugmentRecipe extends AlchemyTablePotionRecipe
public AlchemyTablePotionAugmentRecipe(int lpDrained, int ticksRequired, int tierRequired, ItemStack inputItem, PotionEffect baseEffect, double lengthAugment, int powerAugment) public AlchemyTablePotionAugmentRecipe(int lpDrained, int ticksRequired, int tierRequired, ItemStack inputItem, PotionEffect baseEffect, double lengthAugment, int powerAugment)
{ {
this(lpDrained, ticksRequired, tierRequired, Arrays.asList(inputItem), baseEffect, lengthAugment, powerAugment); this(lpDrained, ticksRequired, tierRequired, Collections.singletonList(inputItem), baseEffect, lengthAugment, powerAugment);
} }
@Override @Override
@ -79,19 +76,14 @@ public class AlchemyTablePotionAugmentRecipe extends AlchemyTablePotionRecipe
List<PotionEffect> effectList = PotionUtils.getEffectsFromStack(outputStack); List<PotionEffect> effectList = PotionUtils.getEffectsFromStack(outputStack);
List<PotionEffect> newEffectList = new ArrayList<PotionEffect>(); List<PotionEffect> newEffectList = new ArrayList<PotionEffect>();
Iterator<PotionEffect> effectIterator = effectList.iterator(); for (PotionEffect effect : effectList) {
while (effectIterator.hasNext()) if (effect.getPotion() == wantedPotion) {
{
PotionEffect effect = effectIterator.next();
if (effect.getPotion() == wantedPotion)
{
double currentLengthAugment = Math.max(lengthAugment, BMPotionUtils.getLengthAugment(outputStack, wantedPotion)); double currentLengthAugment = Math.max(lengthAugment, BMPotionUtils.getLengthAugment(outputStack, wantedPotion));
int currentPowerAugment = Math.max(powerAugment, effect.getAmplifier()); int currentPowerAugment = Math.max(powerAugment, effect.getAmplifier());
int potionLength = wantedPotion.isInstant() ? 1 : BMPotionUtils.getAugmentedLength(baseEffect.getDuration(), currentLengthAugment, currentPowerAugment); int potionLength = wantedPotion.isInstant() ? 1 : BMPotionUtils.getAugmentedLength(baseEffect.getDuration(), currentLengthAugment, currentPowerAugment);
newEffectList.add(new PotionEffect(wantedPotion, potionLength, currentPowerAugment)); newEffectList.add(new PotionEffect(wantedPotion, potionLength, currentPowerAugment));
BMPotionUtils.setLengthAugment(outputStack, wantedPotion, currentLengthAugment); BMPotionUtils.setLengthAugment(outputStack, wantedPotion, currentLengthAugment);
} else } else {
{
newEffectList.add(effect); newEffectList.add(effect);
} }
} }

View file

@ -1,9 +1,6 @@
package WayofTime.bloodmagic.recipe.alchemyTable; package WayofTime.bloodmagic.recipe.alchemyTable;
import java.util.ArrayList; import java.util.*;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.potion.PotionEffect; import net.minecraft.potion.PotionEffect;
@ -40,7 +37,7 @@ public class AlchemyTablePotionRecipe extends AlchemyTableRecipe
public AlchemyTablePotionRecipe(int lpDrained, int ticksRequired, int tierRequired, ItemStack inputItem, PotionEffect baseEffect) public AlchemyTablePotionRecipe(int lpDrained, int ticksRequired, int tierRequired, ItemStack inputItem, PotionEffect baseEffect)
{ {
this(lpDrained, ticksRequired, tierRequired, Arrays.asList(inputItem), baseEffect); this(lpDrained, ticksRequired, tierRequired, Collections.singletonList(inputItem), baseEffect);
} }
@Override @Override
@ -58,7 +55,6 @@ public class AlchemyTablePotionRecipe extends AlchemyTableRecipe
if (match) if (match)
{ {
flaskLocation = x; flaskLocation = x;
continue;
} }
} }
} }
@ -68,7 +64,7 @@ public class AlchemyTablePotionRecipe extends AlchemyTableRecipe
return getModifiedFlaskForInput(inputList.get(flaskLocation)); return getModifiedFlaskForInput(inputList.get(flaskLocation));
} }
return getModifiedFlaskForInput(null); return getModifiedFlaskForInput(ItemStack.EMPTY);
} }
@Override @Override
@ -76,39 +72,27 @@ public class AlchemyTablePotionRecipe extends AlchemyTableRecipe
{ {
ArrayList<Object> required = new ArrayList<Object>(input); ArrayList<Object> required = new ArrayList<Object>(input);
for (int x = 0; x < checkedList.size(); x++) for (ItemStack slot : checkedList) {
{ if (slot != null) {
ItemStack slot = checkedList.get(x);
if (slot != null)
{
boolean inRecipe = false; boolean inRecipe = false;
Iterator<Object> req = required.iterator();
while (req.hasNext()) for (Object aRequired : required) {
{
boolean match = false; boolean match = false;
Object next = req.next(); Object next = aRequired;
if (next instanceof ItemStack) if (next instanceof ItemStack) {
{
match = OreDictionary.itemMatches((ItemStack) next, slot, false); match = OreDictionary.itemMatches((ItemStack) next, slot, false);
} else if (next instanceof List) } else if (next instanceof List) {
{
Iterator<ItemStack> itr = ((List<ItemStack>) next).iterator(); Iterator<ItemStack> itr = ((List<ItemStack>) next).iterator();
while (itr.hasNext() && !match) while (itr.hasNext() && !match) {
{
match = OreDictionary.itemMatches(itr.next(), slot, false); match = OreDictionary.itemMatches(itr.next(), slot, false);
} }
} }
if (match) if (match) {
{ if (next instanceof ItemStack && ((ItemStack) next).getItem() == ModItems.POTION_FLASK) {
if (next instanceof ItemStack && ((ItemStack) next).getItem() == ModItems.POTION_FLASK) if (!isPotionFlaskValidInput(slot)) {
{
if (!isPotionFlaskValidInput(slot))
{
break; break;
} }
} }
@ -119,8 +103,7 @@ public class AlchemyTablePotionRecipe extends AlchemyTableRecipe
} }
} }
if (!inRecipe) if (!inRecipe) {
{
return false; return false;
} }
} }
@ -150,7 +133,7 @@ public class AlchemyTablePotionRecipe extends AlchemyTableRecipe
public ItemStack getModifiedFlaskForInput(ItemStack inputStack) public ItemStack getModifiedFlaskForInput(ItemStack inputStack)
{ {
if (inputStack == null) if (inputStack.isEmpty())
{ {
ItemStack outputStack = new ItemStack(ModItems.POTION_FLASK); ItemStack outputStack = new ItemStack(ModItems.POTION_FLASK);

View file

@ -1,7 +1,6 @@
package WayofTime.bloodmagic.registry; package WayofTime.bloodmagic.registry;
import WayofTime.bloodmagic.compat.ICompatibility; import WayofTime.bloodmagic.compat.ICompatibility;
import WayofTime.bloodmagic.compat.guideapi.CompatibilityGuideAPI;
import WayofTime.bloodmagic.compat.jei.CompatibilityJustEnoughItems; import WayofTime.bloodmagic.compat.jei.CompatibilityJustEnoughItems;
import WayofTime.bloodmagic.compat.waila.CompatibilityWaila; import WayofTime.bloodmagic.compat.waila.CompatibilityWaila;
import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.Loader;
@ -16,7 +15,6 @@ public class ModCompatibility
{ {
compatibilities.add(new CompatibilityJustEnoughItems()); compatibilities.add(new CompatibilityJustEnoughItems());
compatibilities.add(new CompatibilityWaila()); compatibilities.add(new CompatibilityWaila());
compatibilities.add(new CompatibilityGuideAPI());
// compatibilities.add(new CompatibilityThaumcraft()); // compatibilities.add(new CompatibilityThaumcraft());
} }

View file

@ -1,7 +1,6 @@
package WayofTime.bloodmagic.registry; package WayofTime.bloodmagic.registry;
import net.minecraftforge.fml.common.registry.EntityRegistry; import net.minecraftforge.fml.common.registry.EntityEntry;
import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.entity.mob.EntityCorruptedChicken; import WayofTime.bloodmagic.entity.mob.EntityCorruptedChicken;
import WayofTime.bloodmagic.entity.mob.EntityCorruptedSheep; import WayofTime.bloodmagic.entity.mob.EntityCorruptedSheep;
import WayofTime.bloodmagic.entity.mob.EntityCorruptedSpider; import WayofTime.bloodmagic.entity.mob.EntityCorruptedSpider;
@ -12,22 +11,21 @@ import WayofTime.bloodmagic.entity.projectile.EntityBloodLight;
import WayofTime.bloodmagic.entity.projectile.EntityMeteor; import WayofTime.bloodmagic.entity.projectile.EntityMeteor;
import WayofTime.bloodmagic.entity.projectile.EntitySentientArrow; import WayofTime.bloodmagic.entity.projectile.EntitySentientArrow;
import WayofTime.bloodmagic.entity.projectile.EntitySoulSnare; import WayofTime.bloodmagic.entity.projectile.EntitySoulSnare;
import net.minecraftforge.fml.common.registry.GameRegistry;
public class ModEntities public class ModEntities
{ {
public static void init() public static void init()
{ {
int id = 0; GameRegistry.register(new EntityEntry(EntityBloodLight.class, "BloodLight").setRegistryName("BloodLight"));
GameRegistry.register(new EntityEntry(EntitySoulSnare.class, "SoulSnare").setRegistryName("SoulSnare"));
EntityRegistry.registerModEntity(EntityBloodLight.class, "BloodLight", id++, BloodMagic.instance, 64, 20, true); GameRegistry.register(new EntityEntry(EntitySentientArrow.class, "SoulArrow").setRegistryName("SoulArrow"));
EntityRegistry.registerModEntity(EntitySoulSnare.class, "SoulSnare", id++, BloodMagic.instance, 64, 1, true); GameRegistry.register(new EntityEntry(EntityMeteor.class, "Meteor").setRegistryName("Meteor"));
EntityRegistry.registerModEntity(EntitySentientArrow.class, "SoulArrow", id++, BloodMagic.instance, 64, 1, true); GameRegistry.register(new EntityEntry(EntitySentientSpecter.class, "SentientSpecter").setRegistryName("SentientSpecter"));
EntityRegistry.registerModEntity(EntityMeteor.class, "Meteor", id++, BloodMagic.instance, 64, 1, true); GameRegistry.register(new EntityEntry(EntityMimic.class, "Mimic").setRegistryName("Mimic"));
EntityRegistry.registerModEntity(EntitySentientSpecter.class, "SentientSpecter", id++, BloodMagic.instance, 64, 1, true); GameRegistry.register(new EntityEntry(EntityCorruptedZombie.class, "CorruptedZombie").setRegistryName("CorruptedZombie"));
EntityRegistry.registerModEntity(EntityMimic.class, "Mimic", id++, BloodMagic.instance, 64, 1, true); GameRegistry.register(new EntityEntry(EntityCorruptedSheep.class, "CorruptedSheep").setRegistryName("CorruptedSheep"));
EntityRegistry.registerModEntity(EntityCorruptedZombie.class, "CorruptedZombie", id++, BloodMagic.instance, 64, 1, true); GameRegistry.register(new EntityEntry(EntityCorruptedChicken.class, "CorruptedChicken").setRegistryName("CorruptedChicken"));
EntityRegistry.registerModEntity(EntityCorruptedSheep.class, "CorruptedSheep", id++, BloodMagic.instance, 64, 1, true); GameRegistry.register(new EntityEntry(EntityCorruptedSpider.class, "CorruptedSpider").setRegistryName("CorruptedSpider"));
EntityRegistry.registerModEntity(EntityCorruptedChicken.class, "CorruptedChicken", id++, BloodMagic.instance, 64, 1, true);
EntityRegistry.registerModEntity(EntityCorruptedSpider.class, "CorruptedSpider", id++, BloodMagic.instance, 64, 1, true);
} }
} }

View file

@ -456,7 +456,7 @@ public class ModRecipes
if (dustList != null && dustList.size() > 0) if (dustList != null && dustList.size() > 0)
{ {
ItemStack dustStack = dustList.get(0).copy(); ItemStack dustStack = dustList.get(0).copy();
dustStack.stackSize = 2; dustStack.setCount(2);
AlchemyTableRecipeRegistry.registerRecipe(new AlchemyTableCustomRecipe(dustStack, 400, 200, 1, ore, ItemCuttingFluid.getStack(ItemCuttingFluid.BASIC))); AlchemyTableRecipeRegistry.registerRecipe(new AlchemyTableCustomRecipe(dustStack, 400, 200, 1, ore, ItemCuttingFluid.getStack(ItemCuttingFluid.BASIC)));
addedOreRecipeList.add(ore); addedOreRecipeList.add(ore);
} }

View file

@ -203,16 +203,16 @@ public class RitualAltarBuilder extends Ritual
{ {
if (tileEntity.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.DOWN)) if (tileEntity.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.DOWN))
{ {
IItemHandler iItemHandler = tileEntity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.DOWN); IItemHandler itemHandler = tileEntity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.DOWN);
if (iItemHandler.getSlots() <= 0) if (itemHandler.getSlots() <= 0)
{ {
return false; return false;
} }
for (int i = 0; i < iItemHandler.getSlots(); i++) for (int i = 0; i < itemHandler.getSlots(); i++)
{ {
if (iItemHandler.getStackInSlot(i) != null && iItemHandler.getStackInSlot(i).stackSize > 0 && iItemHandler.getStackInSlot(i).getItem() == item && iItemHandler.getStackInSlot(i).getItemDamage() == damage && iItemHandler.extractItem(i, 1, !consumeItem) != null) if (!itemHandler.getStackInSlot(i).isEmpty() && itemHandler.getStackInSlot(i).getItem() == item && itemHandler.getStackInSlot(i).getItemDamage() == damage && !itemHandler.extractItem(i, 1, !consumeItem).isEmpty())
{ {
return true; return true;
} }
@ -222,7 +222,7 @@ public class RitualAltarBuilder extends Ritual
IInventory inv = (IInventory) tileEntity; IInventory inv = (IInventory) tileEntity;
for (int i = 0; i < inv.getSizeInventory(); i++) for (int i = 0; i < inv.getSizeInventory(); i++)
{ {
if (inv.getStackInSlot(i) != null && inv.getStackInSlot(i).stackSize > 0 && inv.getStackInSlot(i).getItem() == item && inv.getStackInSlot(i).getItemDamage() == damage) if (!inv.getStackInSlot(0).isEmpty() && inv.getStackInSlot(i).getItem() == item && inv.getStackInSlot(i).getItemDamage() == damage)
{ {
if (consumeItem) if (consumeItem)
{ {
@ -242,19 +242,19 @@ public class RitualAltarBuilder extends Ritual
{ {
if (tileEntity.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.DOWN)) if (tileEntity.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.DOWN))
{ {
IItemHandler iItemHandler = tileEntity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.DOWN); IItemHandler itemHandler = tileEntity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.DOWN);
if (iItemHandler.getSlots() <= 0) if (itemHandler.getSlots() <= 0)
{ {
return null; return null;
} }
for (int i = 0; i < iItemHandler.getSlots(); i++) for (int i = 0; i < itemHandler.getSlots(); i++)
{ {
if (iItemHandler.getStackInSlot(i) != null && iItemHandler.getStackInSlot(i).stackSize > 0 && iItemHandler.getStackInSlot(i).getItem() instanceof ItemBlock && Block.getBlockFromItem(iItemHandler.getStackInSlot(i).getItem()) instanceof BlockBloodRune && iItemHandler.extractItem(i, 1, true) != null) if (!itemHandler.getStackInSlot(i).isEmpty() && itemHandler.getStackInSlot(i).getItem() instanceof ItemBlock && Block.getBlockFromItem(itemHandler.getStackInSlot(i).getItem()) instanceof BlockBloodRune && itemHandler.extractItem(i, 1, true) != null)
{ {
BlockStack blockStack = new BlockStack(Utils.getBlockForComponent(EnumAltarComponent.BLOODRUNE), iItemHandler.getStackInSlot(i).getItemDamage()); BlockStack blockStack = new BlockStack(Utils.getBlockForComponent(EnumAltarComponent.BLOODRUNE), itemHandler.getStackInSlot(i).getItemDamage());
iItemHandler.extractItem(i, 1, false); itemHandler.extractItem(i, 1, false);
return blockStack; return blockStack;
} }
} }
@ -263,7 +263,7 @@ public class RitualAltarBuilder extends Ritual
IInventory inv = (IInventory) tileEntity; IInventory inv = (IInventory) tileEntity;
for (int i = 0; i < inv.getSizeInventory(); i++) for (int i = 0; i < inv.getSizeInventory(); i++)
{ {
if (inv.getStackInSlot(i) != null && inv.getStackInSlot(i).stackSize > 0 && inv.getStackInSlot(i).getItem() instanceof ItemBlock && Block.getBlockFromItem(inv.getStackInSlot(i).getItem()) instanceof BlockBloodRune) if (!inv.getStackInSlot(i).isEmpty() && inv.getStackInSlot(i).getItem() instanceof ItemBlock && Block.getBlockFromItem(inv.getStackInSlot(i).getItem()) instanceof BlockBloodRune)
{ {
BlockStack blockStack = new BlockStack(Utils.getBlockForComponent(EnumAltarComponent.BLOODRUNE), inv.getStackInSlot(i).getItemDamage()); BlockStack blockStack = new BlockStack(Utils.getBlockForComponent(EnumAltarComponent.BLOODRUNE), inv.getStackInSlot(i).getItemDamage());
inv.decrStackSize(i, 1); inv.decrStackSize(i, 1);
@ -281,22 +281,22 @@ public class RitualAltarBuilder extends Ritual
{ {
if (tileEntity.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.DOWN)) if (tileEntity.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.DOWN))
{ {
IItemHandler iItemHandler = tileEntity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.DOWN); IItemHandler itemHandler = tileEntity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.DOWN);
if (iItemHandler.getSlots() <= 0) if (itemHandler.getSlots() <= 0)
{ {
return null; return null;
} }
for (int i = 0; i < iItemHandler.getSlots(); i++) for (int i = 0; i < itemHandler.getSlots(); i++)
{ {
if (iItemHandler.getStackInSlot(i) != null && iItemHandler.getStackInSlot(i).stackSize > 0 && iItemHandler.getStackInSlot(i).getItem() instanceof ItemBlock && !(Block.getBlockFromItem(iItemHandler.getStackInSlot(i).getItem()) instanceof BlockBloodRune) && iItemHandler.extractItem(i, 1, true) != null) if (!itemHandler.getStackInSlot(i).isEmpty() && itemHandler.getStackInSlot(i).getItem() instanceof ItemBlock && !(Block.getBlockFromItem(itemHandler.getStackInSlot(i).getItem()) instanceof BlockBloodRune) && itemHandler.extractItem(i, 1, true) != null)
{ {
Block block = Block.getBlockFromItem(iItemHandler.getStackInSlot(i).getItem()); Block block = Block.getBlockFromItem(itemHandler.getStackInSlot(i).getItem());
if (block != null && block != Blocks.GLOWSTONE && block != ModBlocks.BLOOD_STONE && block != ModBlocks.CRYSTAL) if (block != null && block != Blocks.GLOWSTONE && block != ModBlocks.BLOOD_STONE && block != ModBlocks.CRYSTAL)
{ {
BlockStack blockStack = new BlockStack(block, iItemHandler.getStackInSlot(i).getItemDamage()); BlockStack blockStack = new BlockStack(block, itemHandler.getStackInSlot(i).getItemDamage());
iItemHandler.extractItem(i, 1, false); itemHandler.extractItem(i, 1, false);
return blockStack; return blockStack;
} }
} }
@ -306,10 +306,10 @@ public class RitualAltarBuilder extends Ritual
IInventory inv = (IInventory) tileEntity; IInventory inv = (IInventory) tileEntity;
for (int i = 0; i < inv.getSizeInventory(); i++) for (int i = 0; i < inv.getSizeInventory(); i++)
{ {
if (inv.getStackInSlot(i) != null && inv.getStackInSlot(i).stackSize > 0 && inv.getStackInSlot(i).getItem() instanceof ItemBlock && !(Block.getBlockFromItem(inv.getStackInSlot(i).getItem()) instanceof BlockBloodRune)) if (!inv.getStackInSlot(i).isEmpty() && inv.getStackInSlot(i).getItem() instanceof ItemBlock && !(Block.getBlockFromItem(inv.getStackInSlot(i).getItem()) instanceof BlockBloodRune))
{ {
Block block = Block.getBlockFromItem(inv.getStackInSlot(i).getItem()); Block block = Block.getBlockFromItem(inv.getStackInSlot(i).getItem());
if (block != null && block != Blocks.GLOWSTONE && block != ModBlocks.BLOOD_STONE && block != ModBlocks.CRYSTAL) if (block != Blocks.GLOWSTONE && block != ModBlocks.BLOOD_STONE && block != ModBlocks.CRYSTAL)
{ {
BlockStack blockStack = new BlockStack(block, inv.getStackInSlot(i).getItemDamage()); BlockStack blockStack = new BlockStack(block, inv.getStackInSlot(i).getItemDamage());
inv.decrStackSize(i, 1); inv.decrStackSize(i, 1);

View file

@ -232,7 +232,14 @@ public class RitualAnimalGrowth extends Ritual
@Override @Override
public ITextComponent[] provideInformationOfRitualToPlayer(EntityPlayer player) public ITextComponent[] provideInformationOfRitualToPlayer(EntityPlayer player)
{ {
return new ITextComponent[] { new TextComponentTranslation(this.getUnlocalizedName() + ".info"), new TextComponentTranslation(this.getUnlocalizedName() + ".default.info"), new TextComponentTranslation(this.getUnlocalizedName() + ".corrosive.info"), new TextComponentTranslation(this.getUnlocalizedName() + ".steadfast.info"), new TextComponentTranslation(this.getUnlocalizedName() + ".destructive.info"), new TextComponentTranslation(this.getUnlocalizedName() + ".vengeful.info") }; return new ITextComponent[] {
new TextComponentTranslation(this.getUnlocalizedName() + ".info"),
new TextComponentTranslation(this.getUnlocalizedName() + ".default.info"),
new TextComponentTranslation(this.getUnlocalizedName() + ".corrosive.info"),
new TextComponentTranslation(this.getUnlocalizedName() + ".steadfast.info"),
new TextComponentTranslation(this.getUnlocalizedName() + ".destructive.info"),
new TextComponentTranslation(this.getUnlocalizedName() + ".vengeful.info")
};
} }
public int getBreedingDecreaseForWill(double vengefulWill) public int getBreedingDecreaseForWill(double vengefulWill)

View file

@ -55,7 +55,7 @@ public class RitualArmourEvolve extends Ritual
masterRitualStone.setActive(false); masterRitualStone.setActive(false);
world.spawnEntityInWorld(new EntityLightningBolt(world, pos.getX(), pos.getY() - 1, pos.getZ(), true)); world.spawnEntity(new EntityLightningBolt(world, pos.getX(), pos.getY() - 1, pos.getZ(), true));
} }
} }
} }

View file

@ -48,7 +48,7 @@ public class RitualCobblestone extends Ritual
if (tileEntity != null && tileEntity instanceof TileAlchemyArray) if (tileEntity != null && tileEntity instanceof TileAlchemyArray)
{ {
TileAlchemyArray alchemyArray = (TileAlchemyArray) tileEntity; TileAlchemyArray alchemyArray = (TileAlchemyArray) tileEntity;
if (alchemyArray.getStackInSlot(0) != null && alchemyArray.getStackInSlot(0).getItem() instanceof ItemComponent) if (!alchemyArray.getStackInSlot(0).isEmpty() && alchemyArray.getStackInSlot(0).getItem() instanceof ItemComponent)
{ {
switch (alchemyArray.getStackInSlot(0).getItemDamage()) switch (alchemyArray.getStackInSlot(0).getItemDamage())
{ {

View file

@ -129,7 +129,7 @@ public class RitualCrushing extends Ritual
if (useCuttingFluid) if (useCuttingFluid)
{ {
ItemStack checkStack = block.getItem(world, newPos, state); ItemStack checkStack = block.getItem(world, newPos, state);
if (checkStack == null) if (checkStack.isEmpty())
{ {
continue; continue;
} }
@ -159,7 +159,7 @@ public class RitualCrushing extends Ritual
} }
ItemStack result = recipe.getRecipeOutput(input); ItemStack result = recipe.getRecipeOutput(input);
if (result == null) if (result.isEmpty())
{ {
continue; continue;
} }
@ -167,7 +167,7 @@ public class RitualCrushing extends Ritual
if (tile != null) if (tile != null)
{ {
result = Utils.insertStackIntoTile(result, tile, EnumFacing.DOWN); result = Utils.insertStackIntoTile(result, tile, EnumFacing.DOWN);
if (result != null && result.stackSize > 0) if (!result.isEmpty())
{ {
Utils.spawnStackAtBlock(world, pos, EnumFacing.UP, result); Utils.spawnStackAtBlock(world, pos, EnumFacing.UP, result);
} }
@ -189,7 +189,7 @@ public class RitualCrushing extends Ritual
if (!isBlockClaimed && isSilkTouch && block.canSilkHarvest(world, newPos, state, null)) if (!isBlockClaimed && isSilkTouch && block.canSilkHarvest(world, newPos, state, null))
{ {
ItemStack checkStack = block.getItem(world, newPos, state); ItemStack checkStack = block.getItem(world, newPos, state);
if (checkStack == null) if (checkStack.isEmpty())
{ {
continue; continue;
} }
@ -210,7 +210,7 @@ public class RitualCrushing extends Ritual
else else
Utils.spawnStackAtBlock(world, pos, EnumFacing.UP, copyStack); Utils.spawnStackAtBlock(world, pos, EnumFacing.UP, copyStack);
if (copyStack != null && copyStack.stackSize > 0) if (!copyStack.isEmpty())
{ {
Utils.spawnStackAtBlock(world, pos, EnumFacing.UP, copyStack); Utils.spawnStackAtBlock(world, pos, EnumFacing.UP, copyStack);
} }
@ -223,11 +223,9 @@ public class RitualCrushing extends Ritual
List<ItemStack> stackList = block.getDrops(world, newPos, state, fortune); List<ItemStack> stackList = block.getDrops(world, newPos, state, fortune);
if (stackList != null && !stackList.isEmpty())
{
for (ItemStack item : stackList) for (ItemStack item : stackList)
{ {
ItemStack copyStack = ItemStack.copyItemStack(item); ItemStack copyStack = item.copy();
if (tile != null) if (tile != null)
{ {
@ -237,7 +235,7 @@ public class RitualCrushing extends Ritual
Utils.spawnStackAtBlock(world, pos, EnumFacing.UP, copyStack); Utils.spawnStackAtBlock(world, pos, EnumFacing.UP, copyStack);
continue; continue;
} }
if (copyStack != null && copyStack.stackSize > 0) if (!copyStack.isEmpty())
{ {
Utils.spawnStackAtBlock(world, pos, EnumFacing.UP, copyStack); Utils.spawnStackAtBlock(world, pos, EnumFacing.UP, copyStack);
} }
@ -249,7 +247,6 @@ public class RitualCrushing extends Ritual
destructiveWill -= destructiveWillDrain; destructiveWill -= destructiveWillDrain;
} }
} }
}
world.destroyBlock(newPos, false); world.destroyBlock(newPos, false);
network.syphon(getRefreshCost()); network.syphon(getRefreshCost());
@ -323,7 +320,14 @@ public class RitualCrushing extends Ritual
@Override @Override
public ITextComponent[] provideInformationOfRitualToPlayer(EntityPlayer player) public ITextComponent[] provideInformationOfRitualToPlayer(EntityPlayer player)
{ {
return new ITextComponent[] { new TextComponentTranslation(this.getUnlocalizedName() + ".info"), new TextComponentTranslation(this.getUnlocalizedName() + ".default.info"), new TextComponentTranslation(this.getUnlocalizedName() + ".corrosive.info"), new TextComponentTranslation(this.getUnlocalizedName() + ".steadfast.info"), new TextComponentTranslation(this.getUnlocalizedName() + ".destructive.info"), new TextComponentTranslation(this.getUnlocalizedName() + ".vengeful.info") }; return new ITextComponent[] {
new TextComponentTranslation(this.getUnlocalizedName() + ".info"),
new TextComponentTranslation(this.getUnlocalizedName() + ".default.info"),
new TextComponentTranslation(this.getUnlocalizedName() + ".corrosive.info"),
new TextComponentTranslation(this.getUnlocalizedName() + ".steadfast.info"),
new TextComponentTranslation(this.getUnlocalizedName() + ".destructive.info"),
new TextComponentTranslation(this.getUnlocalizedName() + ".vengeful.info")
};
} }
@Override @Override

View file

@ -136,20 +136,20 @@ public class RitualExpulsion extends Ritual
moveEntityViaTeleport(entityLiving, event.getTargetX(), event.getTargetY(), event.getTargetZ()); moveEntityViaTeleport(entityLiving, event.getTargetX(), event.getTargetY(), event.getTargetZ());
boolean flag = false; boolean flag = false;
int i = MathHelper.floor_double(entityLiving.posX); int i = MathHelper.floor(entityLiving.posX);
int j = MathHelper.floor_double(entityLiving.posY); int j = MathHelper.floor(entityLiving.posY);
int k = MathHelper.floor_double(entityLiving.posZ); int k = MathHelper.floor(entityLiving.posZ);
int l; int l;
if (!entityLiving.worldObj.isAirBlock(new BlockPos(i, j, k))) if (!entityLiving.getEntityWorld().isAirBlock(new BlockPos(i, j, k)))
{ {
boolean flag1 = false; boolean flag1 = false;
while (!flag1 && j > 0) while (!flag1 && j > 0)
{ {
IBlockState state = entityLiving.worldObj.getBlockState(new BlockPos(i, j - 1, k)); IBlockState state = entityLiving.getEntityWorld().getBlockState(new BlockPos(i, j - 1, k));
if (state != null && state.getMaterial().blocksMovement()) if (state.getMaterial().blocksMovement())
{ {
flag1 = true; flag1 = true;
} else } else
@ -163,7 +163,7 @@ public class RitualExpulsion extends Ritual
{ {
moveEntityViaTeleport(entityLiving, entityLiving.posX, entityLiving.posY, entityLiving.posZ); moveEntityViaTeleport(entityLiving, entityLiving.posX, entityLiving.posY, entityLiving.posZ);
if (!entityLiving.isCollided && !entityLiving.worldObj.containsAnyLiquid(entityLiving.getEntityBoundingBox())) if (!entityLiving.isCollided && !entityLiving.getEntityWorld().containsAnyLiquid(entityLiving.getEntityBoundingBox()))
{ {
flag = true; flag = true;
} }
@ -179,13 +179,13 @@ public class RitualExpulsion extends Ritual
for (l = 0; l < 128; ++l) for (l = 0; l < 128; ++l)
{ {
double lengthVal = (double) l / ((double) 128 - 1.0D); double lengthVal = (double) l / ((double) 128 - 1.0D);
float randF1 = (entityLiving.worldObj.rand.nextFloat() - 0.5F) * 0.2F; float randF1 = (entityLiving.getEntityWorld().rand.nextFloat() - 0.5F) * 0.2F;
float randF2 = (entityLiving.worldObj.rand.nextFloat() - 0.5F) * 0.2F; float randF2 = (entityLiving.getEntityWorld().rand.nextFloat() - 0.5F) * 0.2F;
float randF3 = (entityLiving.worldObj.rand.nextFloat() - 0.5F) * 0.2F; float randF3 = (entityLiving.getEntityWorld().rand.nextFloat() - 0.5F) * 0.2F;
double lengthValX = lastX + (entityLiving.posX - lastX) * lengthVal + (entityLiving.worldObj.rand.nextDouble() - 0.5D) * (double) entityLiving.width * 2.0D; double lengthValX = lastX + (entityLiving.posX - lastX) * lengthVal + (entityLiving.getEntityWorld().rand.nextDouble() - 0.5D) * (double) entityLiving.width * 2.0D;
double lengthValY = lastY + (entityLiving.posY - lastY) * lengthVal + entityLiving.worldObj.rand.nextDouble() * (double) entityLiving.height; double lengthValY = lastY + (entityLiving.posY - lastY) * lengthVal + entityLiving.getEntityWorld().rand.nextDouble() * (double) entityLiving.height;
double lengthValZ = lastZ + (entityLiving.posZ - lastZ) * lengthVal + (entityLiving.worldObj.rand.nextDouble() - 0.5D) * (double) entityLiving.width * 2.0D; double lengthValZ = lastZ + (entityLiving.posZ - lastZ) * lengthVal + (entityLiving.getEntityWorld().rand.nextDouble() - 0.5D) * (double) entityLiving.width * 2.0D;
entityLiving.worldObj.spawnParticle(EnumParticleTypes.PORTAL, lengthValX, lengthValY, lengthValZ, (double) randF1, (double) randF2, (double) randF3); entityLiving.getEntityWorld().spawnParticle(EnumParticleTypes.PORTAL, lengthValX, lengthValY, lengthValZ, (double) randF1, (double) randF2, (double) randF3);
} }
return true; return true;
@ -200,7 +200,7 @@ public class RitualExpulsion extends Ritual
{ {
EntityPlayerMP entityplayermp = (EntityPlayerMP) entityLiving; EntityPlayerMP entityplayermp = (EntityPlayerMP) entityLiving;
if (entityplayermp.worldObj == entityLiving.worldObj) if (entityplayermp.getEntityWorld() == entityLiving.getEntityWorld())
{ {
EnderTeleportEvent event = new EnderTeleportEvent(entityplayermp, x, y, z, 5.0F); EnderTeleportEvent event = new EnderTeleportEvent(entityplayermp, x, y, z, 5.0F);

View file

@ -138,7 +138,7 @@ public class RitualFeatheredKnife extends Ritual
float sacrificedHealth = 1; float sacrificedHealth = 1;
double lpModifier = 1; double lpModifier = 1;
if ((health / player.getMaxHealth() > healthThreshold) && ((useIncense && !player.isPotionActive(ModPotions.soulFray)) || !useIncense)) if ((health / player.getMaxHealth() > healthThreshold) && (!useIncense || !player.isPotionActive(ModPotions.soulFray)))
{ {
if (useIncense) if (useIncense)
{ {

View file

@ -114,17 +114,17 @@ public class RitualFelling extends Ritual
private void placeInInventory(IBlockState blockState, World world, BlockPos blockPos, BlockPos tileEntityPos) private void placeInInventory(IBlockState blockState, World world, BlockPos blockPos, BlockPos tileEntityPos)
{ {
TileEntity tile = world.getTileEntity(tileEntityPos); TileEntity tile = world.getTileEntity(tileEntityPos);
if (tile != null && blockState.getBlock().getDrops(world, blockPos, world.getBlockState(blockPos), 0) != null) if (tile != null)
{ {
if (tile instanceof IInventory) if (tile instanceof IInventory)
{ {
for (ItemStack stack : blockState.getBlock().getDrops(world, blockPos, world.getBlockState(blockPos), 0)) for (ItemStack stack : blockState.getBlock().getDrops(world, blockPos, world.getBlockState(blockPos), 0))
{ {
ItemStack copyStack = stack.copy(); ItemStack copyStack = stack.copy();
Utils.insertStackIntoInventory(copyStack, (IInventory) tile, EnumFacing.DOWN); Utils.insertStackIntoTile(copyStack, tile, EnumFacing.DOWN);
if (copyStack.stackSize > 0) if (!copyStack.isEmpty())
{ {
world.spawnEntityInWorld(new EntityItem(world, blockPos.getX() + 0.4, blockPos.getY() + 2, blockPos.getZ() + 0.4, copyStack)); world.spawnEntity(new EntityItem(world, blockPos.getX() + 0.4, blockPos.getY() + 2, blockPos.getZ() + 0.4, copyStack));
} }
} }
} }

View file

@ -123,7 +123,7 @@ public class RitualForsakenSoul extends Ritual
{ {
if (entity.isEntityAlive() && !(entity instanceof EntityPlayer)) if (entity.isEntityAlive() && !(entity instanceof EntityPlayer))
{ {
if (entity.attackEntityFrom(DamageSource.outOfWorld, 1)) if (entity.attackEntityFrom(DamageSource.OUT_OF_WORLD, 1))
{ {
if (!entity.isEntityAlive()) if (!entity.isEntityAlive())
{ {

Some files were not shown because too many files have changed in this diff Show more