mirror of
https://github.com/GTNewHorizons/BloodArsenal.git
synced 2026-11-25 14:34:41 +00:00
modified: src/main/java/com/arc/bloodarsenal/BloodArsenal.java
modified: src/main/java/com/arc/bloodarsenal/BloodArsenalEventHooks.java modified: src/main/java/com/arc/bloodarsenal/BloodArsenalRecipes.java modified: src/main/java/com/arc/bloodarsenal/ClientProxy.java new file: src/main/java/com/arc/bloodarsenal/LifeInfuser.java modified: src/main/java/com/arc/bloodarsenal/block/BlockBloodStone.java new file: src/main/java/com/arc/bloodarsenal/block/BlockCompactedMRS.java modified: src/main/java/com/arc/bloodarsenal/block/BlockCompacter.java modified: src/main/java/com/arc/bloodarsenal/block/BlockLPMaterializer.java modified: src/main/java/com/arc/bloodarsenal/block/BlockPortableAltar.java modified: src/main/java/com/arc/bloodarsenal/block/ModBlocks.java modified: src/main/java/com/arc/bloodarsenal/items/ItemBloodArsenal.java modified: src/main/java/com/arc/bloodarsenal/items/ItemBloodBall.java modified: src/main/java/com/arc/bloodarsenal/items/ModItems.java modified: src/main/java/com/arc/bloodarsenal/items/block/BloodStoneBlock.java new file: src/main/java/com/arc/bloodarsenal/items/block/CompactedMRSBlock.java new file: src/main/java/com/arc/bloodarsenal/items/block/PortableAltarBlock.java modified: src/main/java/com/arc/bloodarsenal/items/tool/BoundBow.java modified: src/main/java/com/arc/bloodarsenal/misc/ThreadDownloadMod.java modified: src/main/java/com/arc/bloodarsenal/misc/VersionChecker.java new file: src/main/java/com/arc/bloodarsenal/renderer/block/RenderTileLifeInfuser.java modified: src/main/java/com/arc/bloodarsenal/renderer/block/TileLifeInfuserRenderer.java new file: src/main/java/com/arc/bloodarsenal/renderer/item/RenderBow.java modified: src/main/java/com/arc/bloodarsenal/renderer/model/ModelLifeInfuser.java modified: src/main/java/com/arc/bloodarsenal/rituals/RitualEffectEnchant.java modified: src/main/java/com/arc/bloodarsenal/rituals/RitualEffectWithering.java new file: src/main/java/com/arc/bloodarsenal/tileentity/TileCompactedMRS.java modified: src/main/java/com/arc/bloodarsenal/tileentity/TilePortableAltar.java modified: src/main/resources/assets/bloodarsenal/lang/en_US.lang new file: src/main/resources/assets/bloodarsenal/shaders/beam.frag new file: src/main/resources/assets/bloodarsenal/textures/blocks/compacted_mrs.png new file: src/main/resources/assets/bloodarsenal/textures/blocks/compacter_bottom.png new file: src/main/resources/assets/bloodarsenal/textures/blocks/compacter_side.png new file: src/main/resources/assets/bloodarsenal/textures/blocks/compacter_top.png new file: src/main/resources/assets/bloodarsenal/textures/items/glass_shard.png modified: src/main/resources/assets/bloodarsenal/textures/models/altar.png deleted: src/main/java/com/arc/bloodarsenal/LifeInfuser.java
This commit is contained in:
1 parent
d5847e0213
commit
70b03fd6c4
36 files changed
+2027
-268
No files matched your search
@@ -19,13 +19,17 @@ import cpw.mods.fml.common.event.FMLServerStartingEvent;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import com.arc.bloodarsenal.block.ModBlocks;
|
||||
import net.minecraft.item.ItemArmor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.util.EnumHelper;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@@ -37,7 +41,7 @@ import java.lang.reflect.Modifier;
|
||||
public class BloodArsenal
|
||||
{
|
||||
public final static String MODID = "BloodArsenal";
|
||||
public final static String VERSION = "1.1";
|
||||
public final static String VERSION = "1.1-4";
|
||||
|
||||
@SidedProxy(clientSide = "com.arc.bloodarsenal.ClientProxy", serverSide = "com.arc.bloodarsenal.CommonProxy")
|
||||
public static CommonProxy proxy;
|
||||
@@ -136,6 +140,15 @@ public class BloodArsenal
|
||||
@Mod.EventHandler
|
||||
public void postInit(FMLPostInitializationEvent event)
|
||||
{
|
||||
int craftingConstant = OreDictionary.WILDCARD_VALUE;
|
||||
|
||||
ItemStack weakOrb = new ItemStack(WayofTime.alchemicalWizardry.ModItems.weakBloodOrb, 1, craftingConstant);
|
||||
ItemStack apprenticeOrb = new ItemStack(WayofTime.alchemicalWizardry.ModItems.apprenticeBloodOrb, 1, craftingConstant);
|
||||
ItemStack magicianOrb = new ItemStack(WayofTime.alchemicalWizardry.ModItems.magicianBloodOrb, 1, craftingConstant);
|
||||
ItemStack masterOrb = new ItemStack(WayofTime.alchemicalWizardry.ModItems.masterBloodOrb, 1, craftingConstant);
|
||||
ItemStack archmageOrb = new ItemStack(WayofTime.alchemicalWizardry.ModItems.archmageBloodOrb, 1, craftingConstant);
|
||||
ItemStack transcendentOrb = new ItemStack(WayofTime.alchemicalWizardry.ModItems.transcendentBloodOrb, 1, craftingConstant);
|
||||
|
||||
if (Loader.isModLoaded("Baubles"))
|
||||
{
|
||||
isBaublesLoaded = true;
|
||||
@@ -144,6 +157,10 @@ public class BloodArsenal
|
||||
GameRegistry.registerItem(ModItems.vampire_ring, "vampire_ring");
|
||||
GameRegistry.registerItem(ModItems.self_sacrifice_amulet, "self_sacrifice_amulet");
|
||||
GameRegistry.registerItem(ModItems.sacrifice_amulet, "sacrifice_amulet");
|
||||
|
||||
BloodArsenalRecipes.addOreDictBloodOrbRecipe(new ItemStack(ModItems.vampire_ring), "ab ", "bcb", " b ", 'a', ModItems.blood_infused_diamond_bound, 'b', Blocks.stone, 'c', masterOrb);
|
||||
BloodArsenalRecipes.addOreDictBloodOrbRecipe(new ItemStack(ModItems.sacrifice_amulet), "aaa", "aba", "caa", 'a', ModItems.blood_burned_string, 'b', weakOrb, 'c', Items.gold_ingot);
|
||||
BloodArsenalRecipes.addOreDictBloodOrbRecipe(new ItemStack(ModItems.self_sacrifice_amulet), "aaa", "aba", "caa", 'a', ModItems.blood_burned_string, 'b', weakOrb, 'c', Items.glowstone_dust);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -9,11 +9,14 @@ import com.arc.bloodarsenal.items.bauble.SacrificeAmulet;
|
||||
import com.arc.bloodarsenal.items.bauble.SelfSacrificeAmulet;
|
||||
import cpw.mods.fml.client.event.ConfigChangedEvent;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockGlass;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
@@ -22,6 +25,7 @@ import net.minecraftforge.event.entity.living.LivingAttackEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingDeathEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerEvent;
|
||||
import net.minecraftforge.event.world.BlockEvent;
|
||||
|
||||
public class BloodArsenalEventHooks
|
||||
{
|
||||
@@ -96,7 +100,7 @@ public class BloodArsenalEventHooks
|
||||
}
|
||||
}
|
||||
|
||||
public void こんちは(EntityPlayer player)
|
||||
public void こんにちは(EntityPlayer player)
|
||||
{
|
||||
player.addChatMessage(new ChatComponentText("こんにちは!"));
|
||||
}
|
||||
@@ -214,6 +218,25 @@ public class BloodArsenalEventHooks
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void harvestEvent(BlockEvent.HarvestDropsEvent event)
|
||||
{
|
||||
Block block = event.block;
|
||||
EntityPlayer player = event.harvester;
|
||||
|
||||
if (block instanceof BlockGlass)
|
||||
{
|
||||
if (!event.isSilkTouching)
|
||||
{
|
||||
if (player.getCurrentEquippedItem().getItem() == Items.flint)
|
||||
{
|
||||
event.drops.add(new ItemStack(ModItems.glass_shard));
|
||||
event.dropChance = 0.75F;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent event)
|
||||
{
|
||||
|
||||
@@ -69,8 +69,9 @@ public class BloodArsenalRecipes
|
||||
|
||||
addOreDictBloodOrbRecipe(new ItemStack(ModBlocks.blood_stained_ice, 8), "aaa", "aba", "aaa", 'a', Blocks.ice, 'b', apprenticeOrb);
|
||||
addOreDictBloodOrbRecipe(new ItemStack(ModBlocks.blood_stained_glass, 8), "aaa", "aba", "aaa", 'a', Blocks.glass, 'b', apprenticeOrb);
|
||||
addOreDictBloodOrbRecipe(new ItemStack(ModBlocks.life_infuser), "aba", "aca", "aea", 'a', ModItems.blood_infused_iron, 'b', masterOrb, 'c', WayofTime.alchemicalWizardry.ModBlocks.blockAltar, 'd', new ItemStack(ModItems.blood_infused_diamond_bound));
|
||||
addOreDictBloodOrbRecipe(new ItemStack(ModBlocks.life_infuser), "aba", "aca", "ada", 'a', ModItems.blood_infused_iron, 'b', masterOrb, 'c', WayofTime.alchemicalWizardry.ModBlocks.blockAltar, 'd', new ItemStack(ModItems.blood_infused_diamond_bound));
|
||||
addOreDictBloodOrbRecipe(new ItemStack(ModBlocks.lp_materializer), "aba", "bcb", "aba", 'a', ModItems.blood_infused_iron, 'b', imbuedSlate, 'c', masterOrb);
|
||||
addOreDictBloodOrbRecipe(new ItemStack(ModBlocks.compacter), "aaa", "bcb", "ded", 'a', ModBlocks.blood_infused_planks, 'b', ModItems.blood_infused_diamond_bound, 'c', Blocks.piston, 'd', ModBlocks.blood_infused_iron_block, 'e', archmageOrb);
|
||||
addOreDictBloodOrbRecipe(new ItemStack(ModItems.blood_infused_axe_iron), "aaa", "aba", "cdc", 'a', ModItems.blood_infused_iron, 'b', ModItems.blood_infused_axe_wood, 'c', ModItems.amorphic_catalyst, 'd', magicianOrb);
|
||||
addOreDictBloodOrbRecipe(new ItemStack(ModItems.blood_infused_pickaxe_iron), "aaa", "aba", "cdc", 'a', ModItems.blood_infused_iron, 'b', ModItems.blood_infused_pickaxe_wood, 'c', ModItems.amorphic_catalyst, 'd', magicianOrb);
|
||||
addOreDictBloodOrbRecipe(new ItemStack(ModItems.blood_infused_shovel_iron), "aaa", "aba", "cdc", 'a', ModItems.blood_infused_iron, 'b', ModItems.blood_infused_shovel_wood, 'c', ModItems.amorphic_catalyst, 'd', magicianOrb);
|
||||
@@ -88,13 +89,6 @@ public class BloodArsenalRecipes
|
||||
addOreDictBloodOrbRecipe(new ItemStack(ModItems.sigil_of_divinity), "aba", "cde", "fgf", 'a', ModBlocks.blood_infused_glowstone, 'b', new ItemStack(Items.golden_apple, 1, 1), 'c', Items.nether_star, 'd', WayofTime.alchemicalWizardry.ModItems.sigilOfElementalAffinity, 'e', ModItems.blood_infused_diamond_bound, 'f', ModItems.amorphic_catalyst, 'g', transcendentOrb);
|
||||
addOreDictBloodOrbRecipe(new ItemStack(ModItems.blood_burned_string, 4), "aaa", "aba", "aaa", 'a', Items.string, 'b', weakOrb);
|
||||
|
||||
if (BloodArsenal.isBaublesLoaded)
|
||||
{
|
||||
addOreDictBloodOrbRecipe(new ItemStack(ModItems.vampire_ring), "ab ", "bcb", " b ", 'a', ModItems.blood_infused_diamond_bound, 'b', Blocks.stone, 'c', masterOrb);
|
||||
addOreDictBloodOrbRecipe(new ItemStack(ModItems.sacrifice_amulet), "aaa", "aba", "caa", 'a', ModItems.blood_burned_string, 'b', weakOrb, 'c', Items.gold_ingot);
|
||||
addOreDictBloodOrbRecipe(new ItemStack(ModItems.self_sacrifice_amulet), "aaa", "aba", "caa", 'a', ModItems.blood_burned_string, 'b', weakOrb, 'c', Items.glowstone_dust);
|
||||
}
|
||||
|
||||
addOreDictRecipe(new ItemStack(ModBlocks.blood_stone), "aaa", "aaa", "aaa", 'a', blankSlate);
|
||||
addOreDictRecipe(new ItemStack(ModBlocks.blood_stone, 1, 1), "aaa", "aaa", "aaa", 'a', reinforcedSlate);
|
||||
addOreDictRecipe(new ItemStack(ModBlocks.blood_stone, 1, 2), "aaa", "aaa", "aaa", 'a', imbuedSlate);
|
||||
@@ -129,17 +123,17 @@ public class BloodArsenalRecipes
|
||||
addShapelessOreDictRecipe(new ItemStack(ModItems.juice_and_cookies), Items.cookie, ModItems.orange_juice);
|
||||
}
|
||||
|
||||
private static void addOreDictRecipe(ItemStack output, Object... recipe)
|
||||
public static void addOreDictRecipe(ItemStack output, Object... recipe)
|
||||
{
|
||||
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(output, recipe));
|
||||
}
|
||||
|
||||
private static void addOreDictBloodOrbRecipe(ItemStack output, Object... recipe)
|
||||
public static void addOreDictBloodOrbRecipe(ItemStack output, Object... recipe)
|
||||
{
|
||||
CraftingManager.getInstance().getRecipeList().add(new ShapedBloodOrbRecipe(output, recipe));
|
||||
}
|
||||
|
||||
private static void addShapelessOreDictRecipe(ItemStack output, Object... recipe)
|
||||
public static void addShapelessOreDictRecipe(ItemStack output, Object... recipe)
|
||||
{
|
||||
CraftingManager.getInstance().getRecipeList().add(new ShapelessOreRecipe(output, recipe));
|
||||
}
|
||||
|
||||
@@ -6,10 +6,9 @@ import com.arc.bloodarsenal.entity.projectile.EntityBloodBall;
|
||||
import com.arc.bloodarsenal.entity.projectile.EntityGatlingProjectile;
|
||||
import com.arc.bloodarsenal.items.ModItems;
|
||||
import com.arc.bloodarsenal.misc.VersionChecker;
|
||||
import com.arc.bloodarsenal.renderer.block.ShaderHelper;
|
||||
import com.arc.bloodarsenal.renderer.block.TileLifeInfuserRenderer;
|
||||
import com.arc.bloodarsenal.renderer.block.item.TileLifeInfuserItemRenderer;
|
||||
import com.arc.bloodarsenal.renderer.block.*;
|
||||
import com.arc.bloodarsenal.renderer.item.ItemRenderGatling;
|
||||
import com.arc.bloodarsenal.renderer.item.RenderBow;
|
||||
import com.arc.bloodarsenal.renderer.projectile.RenderEntityGatlingProjectile;
|
||||
import com.arc.bloodarsenal.renderer.block.TilePortableAltarRenderer;
|
||||
import com.arc.bloodarsenal.renderer.block.item.TilePortableAltarItemRenderer;
|
||||
@@ -39,11 +38,14 @@ public class ClientProxy extends CommonProxy
|
||||
public void registerRenders()
|
||||
{
|
||||
MinecraftForgeClient.registerItemRenderer(ModItems.energy_gatling, new ItemRenderGatling());
|
||||
MinecraftForgeClient.registerItemRenderer(ModItems.bound_bow, new RenderBow());
|
||||
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityGatlingProjectile.class, new RenderEntityGatlingProjectile());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityBloodTNT.class, new RenderTNTPrimed());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityBloodBall.class, new RenderSnowball(ModItems.blood_ball));
|
||||
|
||||
RenderingRegistry.registerBlockHandler(new RenderTileLifeInfuser());
|
||||
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TilePortableAltar.class, new TilePortableAltarRenderer());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileLifeInfuser.class, new TileLifeInfuserRenderer());
|
||||
ShaderHelper.initShaders();
|
||||
@@ -68,6 +70,5 @@ public class ClientProxy extends CommonProxy
|
||||
public void initRendering()
|
||||
{
|
||||
MinecraftForgeClient.registerItemRenderer(ItemBlock.getItemFromBlock(ModBlocks.portable_altar), new TilePortableAltarItemRenderer());
|
||||
MinecraftForgeClient.registerItemRenderer(ItemBlock.getItemFromBlock(ModBlocks.life_infuser), new TileLifeInfuserItemRenderer());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.arc.bloodarsenal;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
/**
|
||||
* LifeInfuser - Arcaratus
|
||||
* Created using Tabula 4.1.1
|
||||
*/
|
||||
public class LifeInfuser extends ModelBase {
|
||||
public ModelRenderer Base;
|
||||
public ModelRenderer Pillar1;
|
||||
public ModelRenderer Pillar2;
|
||||
public ModelRenderer Pillar3;
|
||||
public ModelRenderer Pillar4;
|
||||
public ModelRenderer Plate1;
|
||||
public ModelRenderer Plate2;
|
||||
|
||||
public LifeInfuser() {
|
||||
this.textureWidth = 64;
|
||||
this.textureHeight = 32;
|
||||
this.Pillar4 = new ModelRenderer(this, 0, 0);
|
||||
this.Pillar4.setRotationPoint(6.0F, 10.0F, -8.0F);
|
||||
this.Pillar4.addBox(0.0F, 0.0F, 0.0F, 2, 12, 2, 0.0F);
|
||||
this.Pillar3 = new ModelRenderer(this, 0, 0);
|
||||
this.Pillar3.setRotationPoint(6.0F, 10.0F, 6.0F);
|
||||
this.Pillar3.addBox(0.0F, 0.0F, 0.0F, 2, 12, 2, 0.0F);
|
||||
this.Plate2 = new ModelRenderer(this, 0, 0);
|
||||
this.Plate2.setRotationPoint(-2.0F, 19.0F, -2.0F);
|
||||
this.Plate2.addBox(0.0F, 0.0F, 0.0F, 4, 1, 4, 0.0F);
|
||||
this.Plate1 = new ModelRenderer(this, 0, 0);
|
||||
this.Plate1.setRotationPoint(-4.0F, 20.0F, -4.0F);
|
||||
this.Plate1.addBox(0.0F, 0.0F, 0.0F, 8, 2, 8, 0.0F);
|
||||
this.Base = new ModelRenderer(this, 0, 0);
|
||||
this.Base.setRotationPoint(-8.0F, 22.0F, -8.0F);
|
||||
this.Base.addBox(0.0F, 0.0F, 0.0F, 16, 2, 16, 0.0F);
|
||||
this.Pillar1 = new ModelRenderer(this, 0, 0);
|
||||
this.Pillar1.setRotationPoint(-8.0F, 10.0F, -8.0F);
|
||||
this.Pillar1.addBox(0.0F, 0.0F, 0.0F, 2, 12, 2, 0.0F);
|
||||
this.Pillar2 = new ModelRenderer(this, 0, 0);
|
||||
this.Pillar2.setRotationPoint(-8.0F, 10.0F, 6.0F);
|
||||
this.Pillar2.addBox(0.0F, 0.0F, 0.0F, 2, 12, 2, 0.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
|
||||
this.Pillar4.render(f5);
|
||||
this.Pillar3.render(f5);
|
||||
this.Plate2.render(f5);
|
||||
this.Plate1.render(f5);
|
||||
this.Base.render(f5);
|
||||
this.Pillar1.render(f5);
|
||||
this.Pillar2.render(f5);
|
||||
}
|
||||
|
||||
/**
|
||||
* This is a helper function from Tabula to set the rotation of model parts
|
||||
*/
|
||||
public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) {
|
||||
modelRenderer.rotateAngleX = x;
|
||||
modelRenderer.rotateAngleY = y;
|
||||
modelRenderer.rotateAngleZ = z;
|
||||
}
|
||||
}
|
||||
@@ -42,6 +42,7 @@ public class BlockBloodStone extends Block
|
||||
blood_stone_5 = iconRegister.registerIcon("BloodArsenal:blood_stone_5");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item par1Item, CreativeTabs par2CreativeTabs, List par3List)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,183 @@
|
||||
package com.arc.bloodarsenal.block;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.rituals.Rituals;
|
||||
import WayofTime.alchemicalWizardry.common.block.BlockMasterStone;
|
||||
import WayofTime.alchemicalWizardry.common.items.ActivationCrystal;
|
||||
import com.arc.bloodarsenal.BloodArsenal;
|
||||
import com.arc.bloodarsenal.tileentity.TileCompactedMRS;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.Explosion;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class BlockCompactedMRS extends BlockMasterStone
|
||||
{
|
||||
public BlockCompactedMRS()
|
||||
{
|
||||
super();
|
||||
setBlockName("compacted_mrs");
|
||||
setBlockTextureName("BloodArsenal:compacted_mrs");
|
||||
setCreativeTab(BloodArsenal.BA_TAB);
|
||||
setHardness(4.0F);
|
||||
setResistance(7.5F);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List)
|
||||
{
|
||||
if (this.equals(ModBlocks.compacted_mrs))
|
||||
{
|
||||
par3List.add(new ItemStack(par1, 1, 0));
|
||||
|
||||
for (String ritualName : Rituals.keyList)
|
||||
{
|
||||
ItemStack stack = new ItemStack(par1, 1, 0);
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
TileCompactedMRS tile = new TileCompactedMRS();
|
||||
|
||||
NBTTagList tagList = new NBTTagList();
|
||||
|
||||
NBTTagCompound savedTag = new NBTTagCompound();
|
||||
|
||||
if (tile != null)
|
||||
{
|
||||
tile.writeToNBT(savedTag);
|
||||
}
|
||||
|
||||
tagList.appendTag(savedTag);
|
||||
|
||||
tag.setString("ritualName", ritualName);
|
||||
|
||||
stack.setTagCompound(tag);
|
||||
|
||||
par3List.add(stack);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
super.getSubBlocks(par1, par2CreativeTabs, par3List);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entityLiving, ItemStack stack)
|
||||
{
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
|
||||
if (tile instanceof TileCompactedMRS)
|
||||
{
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
||||
if (tag != null)
|
||||
{
|
||||
((TileCompactedMRS) tile).readNBTOnPlace(tag);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockHarvested(World world, int x, int y, int z, int meta, EntityPlayer player)
|
||||
{
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
|
||||
if (tile instanceof TileCompactedMRS)
|
||||
{
|
||||
((TileCompactedMRS) tile).useOnRitualBroken();
|
||||
}
|
||||
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
{
|
||||
dropBlockAsItem(world, x, y, z, meta, 0);
|
||||
}
|
||||
|
||||
super.onBlockHarvested(world, x, y, z, meta, player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune)
|
||||
{
|
||||
ArrayList<ItemStack> list = new ArrayList();
|
||||
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
|
||||
if (tile instanceof TileCompactedMRS)
|
||||
{
|
||||
ItemStack drop = new ItemStack(this);
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
((TileCompactedMRS) tile).writeNBTOnHarvest(tag);
|
||||
drop.setTagCompound(tag);
|
||||
|
||||
list.add(drop);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockDestroyedByExplosion(World world, int x, int y, int z, Explosion explosion)
|
||||
{
|
||||
super.onBlockDestroyedByExplosion(world, x, y, z, explosion);
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
|
||||
if (tile instanceof TileCompactedMRS)
|
||||
{
|
||||
((TileCompactedMRS) tile).useOnRitualBrokenExplosion();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are)
|
||||
{
|
||||
TileCompactedMRS tileEntity = (TileCompactedMRS) world.getTileEntity(x, y, z);
|
||||
|
||||
if (tileEntity != null)
|
||||
{
|
||||
ItemStack playerItem = player.getCurrentEquippedItem();
|
||||
|
||||
if (playerItem == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
Item item = playerItem.getItem();
|
||||
|
||||
if (!(item instanceof ActivationCrystal))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
ActivationCrystal acItem = (ActivationCrystal) item;
|
||||
tileEntity.activateRitual(world, acItem.getCrystalLevel(playerItem), playerItem, player, ActivationCrystal.getOwnerName(playerItem));
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
return new TileCompactedMRS();
|
||||
}
|
||||
}
|
||||
@@ -1,57 +1,243 @@
|
||||
package com.arc.bloodarsenal.block;
|
||||
|
||||
import WayofTime.alchemicalWizardry.*;
|
||||
import WayofTime.alchemicalWizardry.ModBlocks;
|
||||
import WayofTime.alchemicalWizardry.api.event.RitualActivatedEvent;
|
||||
import WayofTime.alchemicalWizardry.api.event.RitualRunEvent;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.*;
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.Rituals;
|
||||
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
|
||||
import WayofTime.alchemicalWizardry.api.tile.IBloodAltar;
|
||||
import WayofTime.alchemicalWizardry.common.block.BlockAltar;
|
||||
import WayofTime.alchemicalWizardry.common.block.BlockMasterStone;
|
||||
import WayofTime.alchemicalWizardry.common.block.BloodRune;
|
||||
import WayofTime.alchemicalWizardry.common.bloodAltarUpgrade.AltarComponent;
|
||||
import WayofTime.alchemicalWizardry.common.bloodAltarUpgrade.AltarUpgradeComponent;
|
||||
import WayofTime.alchemicalWizardry.common.bloodAltarUpgrade.UpgradedAltars;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone;
|
||||
import com.arc.bloodarsenal.BloodArsenal;
|
||||
import com.arc.bloodarsenal.tileentity.TileCompactedMRS;
|
||||
import com.arc.bloodarsenal.tileentity.TileCompacter;
|
||||
import com.arc.bloodarsenal.tileentity.TilePortableAltar;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class BlockCompacter extends BlockContainer
|
||||
{
|
||||
private String ritualName;
|
||||
private int direction;
|
||||
|
||||
private int tier;
|
||||
private int lpAmount;
|
||||
private int capacity;
|
||||
private float consumptionMultiplier;
|
||||
private float efficiencyMultiplier;
|
||||
private float sacrificeEfficiencyMultiplier;
|
||||
private float selfSacrificeEfficiencyMultiplier;
|
||||
private float capacityMultiplier;
|
||||
private float orbCapacityMultiplier;
|
||||
private float dislocationMultiplier;
|
||||
private int accelerationUpgrades;
|
||||
private int bufferCapacity;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon topIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon sideIcon;
|
||||
|
||||
public BlockCompacter()
|
||||
{
|
||||
super(Material.iron);
|
||||
setBlockName("compacter");
|
||||
setBlockTextureName("BloodArsenal:compacter");
|
||||
setCreativeTab(BloodArsenal.BA_TAB);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are)
|
||||
{
|
||||
TileEntity tile = world.getTileEntity(x, y + 1, z);
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
|
||||
if (tile instanceof TEMasterStone)
|
||||
if (tileEntity != null && !player.isSneaking())
|
||||
{
|
||||
TEMasterStone ritualStone = (TEMasterStone) tile;
|
||||
String test = Rituals.checkValidRitual(world, x, y + 1, z);
|
||||
ItemStack playerItem = player.getCurrentEquippedItem();
|
||||
|
||||
if (!test.equals(""))
|
||||
if (playerItem == null)
|
||||
{
|
||||
player.addChatMessage(new ChatComponentText("It worked"));
|
||||
|
||||
if (ritualStone.getCurrentRitual().equals(test))
|
||||
{
|
||||
player.addChatMessage( new ChatComponentText(test));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
player.addChatMessage(new ChatComponentText("It failed"));
|
||||
}
|
||||
Item item = playerItem.getItem();
|
||||
|
||||
return true;
|
||||
if (!(item instanceof IBloodOrb))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
Block block = world.getBlock(x, y + 1, z);
|
||||
|
||||
if (block != null)
|
||||
{
|
||||
TileEntity tile;
|
||||
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
world.markBlockForUpdate(x, y + 1, z);
|
||||
|
||||
String owner = player.getCommandSenderName();
|
||||
int currentEssence = SoulNetworkHandler.getCurrentEssence(owner);
|
||||
|
||||
if (block instanceof BlockMasterStone)
|
||||
{
|
||||
tile = world.getTileEntity(x, y + 1, z);
|
||||
|
||||
checkRitual(tile);
|
||||
|
||||
List<RitualComponent> ritualList = Rituals.getRitualList(ritualName);
|
||||
|
||||
if (ritualList == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
float multiplier = 1;
|
||||
|
||||
for (RitualComponent ritualComponent : ritualList)
|
||||
{
|
||||
int stoneType = ritualComponent.getStoneType();
|
||||
|
||||
switch (stoneType)
|
||||
{
|
||||
case 0:
|
||||
break;
|
||||
|
||||
case 1:
|
||||
multiplier = multiplier * 1.05F;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
multiplier = multiplier * 1.05F;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
multiplier = multiplier * 1.05F;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
multiplier = multiplier * 1.05F;
|
||||
break;
|
||||
|
||||
case 5:
|
||||
multiplier = multiplier * 1.075F;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int activationCost = Rituals.getCostForActivation(ritualName);
|
||||
int cost = (activationCost * (int) multiplier) / 2; //Divided by 2 since this fires twice apparently and also because I'm nice
|
||||
|
||||
if (cost <= currentEssence)
|
||||
{
|
||||
compactRitual(tile);
|
||||
SoulNetworkHandler.syphonFromNetwork(owner, cost);
|
||||
}
|
||||
else
|
||||
{
|
||||
player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("message.compacter.notEnoughLP")));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (block instanceof BlockAltar && world.getTileEntity(x, y + 1, z) != null)
|
||||
{
|
||||
tile = world.getTileEntity(x, y + 1, z);
|
||||
|
||||
TEAltar altar = (TEAltar) tile;
|
||||
checkAltar(altar);
|
||||
|
||||
if (tier == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (altar.getStackInSlot(0) != null)
|
||||
{
|
||||
player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("message.compacter.itemInAltar")));
|
||||
}
|
||||
else
|
||||
{
|
||||
float multiplier = 1;
|
||||
|
||||
AltarUpgradeComponent upgradeComponent = UpgradedAltars.getUpgrades(world, x, y + 1, z, tier);
|
||||
|
||||
int speedUpgrades = upgradeComponent.getSpeedUpgrades();
|
||||
int efficiencyUpgrades = upgradeComponent.getEfficiencyUpgrades();
|
||||
int sacrificeUpgrades = upgradeComponent.getSacrificeUpgrades();
|
||||
int selfSacrificeUpgrades = upgradeComponent.getSelfSacrificeUpgrades();
|
||||
int displacementUpgrades = upgradeComponent.getDisplacementUpgrades();
|
||||
int altarCapacitiveUpgrades = upgradeComponent.getAltarCapacitiveUpgrades();
|
||||
int orbCapacitiveUpgrades = upgradeComponent.getOrbCapacitiveUpgrades();
|
||||
int betterCapacitiveUpgrades = upgradeComponent.getBetterCapacitiveUpgrades();
|
||||
int accelerationUpgrades = upgradeComponent.getAccelerationUpgrades();
|
||||
|
||||
multiplier = multiplier * ((speedUpgrades + 4) / 4);
|
||||
multiplier = multiplier * ((efficiencyUpgrades + 3) / 3);
|
||||
multiplier = multiplier * ((sacrificeUpgrades + 3) / 3);
|
||||
multiplier = multiplier * ((selfSacrificeUpgrades + 3) / 3);
|
||||
multiplier = multiplier * ((displacementUpgrades + 3) / 3);
|
||||
multiplier = multiplier * ((altarCapacitiveUpgrades + 3) / 3);
|
||||
multiplier = multiplier * ((orbCapacitiveUpgrades + 3) / 3);
|
||||
multiplier = multiplier * ((betterCapacitiveUpgrades + 2) / 2);
|
||||
multiplier = multiplier * ((accelerationUpgrades + 3) / 3);
|
||||
|
||||
IBloodOrb bloodOrb = (IBloodOrb) item;
|
||||
|
||||
if (bloodOrb.getOrbLevel() >= tier)
|
||||
{
|
||||
int cost = ((tier * 10) * (int) (multiplier * 5)) + capacity;
|
||||
|
||||
if (cost <= currentEssence)
|
||||
{
|
||||
compactAltar(tile);
|
||||
SoulNetworkHandler.syphonFromNetwork(owner, cost);
|
||||
}
|
||||
else
|
||||
{
|
||||
player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("message.compacter.notEnoughLP")));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("message.compacter.wrongOrbTier")));
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -59,9 +245,182 @@ public class BlockCompacter extends BlockContainer
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta)
|
||||
{
|
||||
return side == 1 ? this.topIcon : (side == 0 ? this.blockIcon : this.sideIcon);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister p_149651_1_)
|
||||
{
|
||||
this.blockIcon = p_149651_1_.registerIcon(this.getTextureName() + "_bottom");
|
||||
this.topIcon = p_149651_1_.registerIcon(this.getTextureName() + "_top");
|
||||
this.sideIcon = p_149651_1_.registerIcon(this.getTextureName() + "_side");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
return new TileCompacter();
|
||||
}
|
||||
|
||||
private void checkRitual(TileEntity tileEntity)
|
||||
{
|
||||
TEMasterStone masterStone = (TEMasterStone) tileEntity;
|
||||
World world = masterStone.getWorld();
|
||||
int x = masterStone.xCoord;
|
||||
int y = masterStone.yCoord;
|
||||
int z = masterStone.zCoord;
|
||||
|
||||
ritualName = Rituals.checkValidRitual(world, x, y, z);
|
||||
|
||||
if (ritualName.equals(""))
|
||||
{
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
direction = Rituals.getDirectionOfRitual(world, x, y, z, ritualName);
|
||||
}
|
||||
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
world.markBlockForUpdate(x, y + 1, z);
|
||||
}
|
||||
|
||||
private void compactRitual(TileEntity tileEntity)
|
||||
{
|
||||
TEMasterStone masterStone = (TEMasterStone) tileEntity;
|
||||
World world = masterStone.getWorld();
|
||||
int x = masterStone.xCoord;
|
||||
int y = masterStone.yCoord;
|
||||
int z = masterStone.zCoord;
|
||||
|
||||
List<RitualComponent> ritualList = Rituals.getRitualList(ritualName);
|
||||
|
||||
if (ritualList == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (RitualComponent ritualComponent : ritualList)
|
||||
{
|
||||
world.setBlockToAir(x + ritualComponent.getX(direction), y + ritualComponent.getY(), z + ritualComponent.getZ(direction));
|
||||
world.setBlockToAir(x, y, z);
|
||||
world.markBlockForUpdate(x + ritualComponent.getX(direction), y + ritualComponent.getY(), z + ritualComponent.getZ(direction));
|
||||
}
|
||||
|
||||
world.setBlock(x, y, z, ModBlocks.compacted_mrs);
|
||||
Block block = world.getBlock(x, y, z);
|
||||
configureMRS(world, x, y, z, block);
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
}
|
||||
|
||||
private void configureMRS(World world, int x, int y, int z, Block block)
|
||||
{
|
||||
if (block instanceof BlockCompactedMRS)
|
||||
{
|
||||
if (world.getBlock(x, y, z) == block)
|
||||
{
|
||||
TileCompactedMRS tile = (TileCompactedMRS) world.getTileEntity(x, y, z);
|
||||
|
||||
tile.setRitualName(ritualName);
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void checkAltar(TEAltar altar)
|
||||
{
|
||||
World world = altar.getWorldObj();
|
||||
int x = altar.xCoord;
|
||||
int y = altar.yCoord;
|
||||
int z = altar.zCoord;
|
||||
|
||||
tier = altar.getTier();
|
||||
AltarUpgradeComponent upgrades = UpgradedAltars.getUpgrades(world, x, y, z, tier);
|
||||
|
||||
if (upgrades == null)
|
||||
{
|
||||
this.consumptionMultiplier = 0;
|
||||
this.efficiencyMultiplier = 1;
|
||||
this.sacrificeEfficiencyMultiplier = 0;
|
||||
this.selfSacrificeEfficiencyMultiplier = 0;
|
||||
this.capacityMultiplier = 1;
|
||||
this.orbCapacityMultiplier = 1;
|
||||
this.dislocationMultiplier = 1;
|
||||
this.accelerationUpgrades = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
lpAmount = altar.getFluidAmount();
|
||||
consumptionMultiplier = (float) (0.20 * upgrades.getSpeedUpgrades());
|
||||
efficiencyMultiplier = (float) Math.pow(0.85, upgrades.getSpeedUpgrades());
|
||||
sacrificeEfficiencyMultiplier = (float) (0.10 * upgrades.getSacrificeUpgrades());
|
||||
selfSacrificeEfficiencyMultiplier = (float) (0.10 * upgrades.getSelfSacrificeUpgrades());
|
||||
capacityMultiplier = (float) ((1 * Math.pow(1.10, upgrades.getBetterCapacitiveUpgrades()) + 0.20 * upgrades.getAltarCapacitiveUpgrades()));
|
||||
dislocationMultiplier = (float) (Math.pow(1.2, upgrades.getDisplacementUpgrades()));
|
||||
orbCapacityMultiplier = (float) (1 + 0.02 * upgrades.getOrbCapacitiveUpgrades());
|
||||
capacity = (int) (FluidContainerRegistry.BUCKET_VOLUME * 10 * capacityMultiplier);
|
||||
bufferCapacity = (int) (FluidContainerRegistry.BUCKET_VOLUME * 1 * capacityMultiplier);
|
||||
accelerationUpgrades = upgrades.getAccelerationUpgrades();
|
||||
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
world.markBlockForUpdate(x, y - 1, z);
|
||||
}
|
||||
|
||||
private void compactAltar(TileEntity tileEntity)
|
||||
{
|
||||
TEAltar altar = (TEAltar) tileEntity;
|
||||
World world = altar.getWorldObj();
|
||||
int x = altar.xCoord;
|
||||
int y = altar.yCoord;
|
||||
int z = altar.zCoord;
|
||||
|
||||
List<AltarComponent> altarComponents = UpgradedAltars.getAltarUpgradeListForTier(tier);
|
||||
|
||||
if (altarComponents != null && !world.isRemote)
|
||||
{
|
||||
for (AltarComponent altarComponent : altarComponents)
|
||||
{
|
||||
world.setBlockToAir(x + altarComponent.getX(), y + altarComponent.getY(), z + altarComponent.getZ());
|
||||
world.setBlockToAir(x, y, z);
|
||||
world.markBlockForUpdate(x + altarComponent.getX(), y + altarComponent.getY(), z + altarComponent.getZ());
|
||||
}
|
||||
}
|
||||
|
||||
world.setBlock(x, y, z, ModBlocks.portable_altar);
|
||||
Block altarBlock = world.getBlock(x, y, z);
|
||||
configureAltar(world, x, y, z, altarBlock);
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
world.markBlockForUpdate(x, y - 1, z);
|
||||
}
|
||||
|
||||
private void configureAltar(World world, int x, int y, int z, Block block)
|
||||
{
|
||||
if (block instanceof BlockPortableAltar)
|
||||
{
|
||||
if (world.getBlock(x, y, z) == block)
|
||||
{
|
||||
TilePortableAltar altar = (TilePortableAltar) world.getTileEntity(x, y, z);
|
||||
|
||||
altar.setTier(tier);
|
||||
altar.setCurrentBlood(lpAmount);
|
||||
altar.setConsumptionMultiplier(consumptionMultiplier);
|
||||
altar.setEfficiencyMultiplier(efficiencyMultiplier);
|
||||
altar.setSacrificeMultiplier(sacrificeEfficiencyMultiplier);
|
||||
altar.setSelfSacrificeMultiplier(selfSacrificeEfficiencyMultiplier);
|
||||
altar.setOrbMultiplier(orbCapacityMultiplier);
|
||||
altar.setDislocationMultiplier(dislocationMultiplier);
|
||||
altar.setCapacityMultiplier(capacityMultiplier);
|
||||
altar.setCapacity(capacity);
|
||||
altar.setBufferCapacity(bufferCapacity);
|
||||
altar.setAccelerationUpgrades(accelerationUpgrades);
|
||||
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -78,15 +78,16 @@ public class BlockLPMaterializer extends BlockContainer
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// else if (playerItem.getItem().equals(bucket))
|
||||
else if (playerItem.getItem() == Items.bucket)
|
||||
{
|
||||
// if (!player.capabilities.isCreativeMode)
|
||||
if (tileEntity.getFluidAmount() >= FluidContainerRegistry.BUCKET_VOLUME)
|
||||
{
|
||||
// --playerItem.stackSize;
|
||||
// player.inventory.addItemStackToInventory(ModItems.bucketLife);
|
||||
// tileEntity.drain(FluidContainerRegistry.BUCKET_VOLUME, true);
|
||||
--playerItem.stackSize;
|
||||
player.inventory.addItemStackToInventory(new ItemStack(ModItems.bucketLife));
|
||||
tileEntity.drain(FluidContainerRegistry.BUCKET_VOLUME, true);
|
||||
}
|
||||
}
|
||||
|
||||
if (tileEntity.getStackInSlot(0) == null && playerItem.getItem() instanceof IBloodOrb)
|
||||
{
|
||||
ItemStack newItem = playerItem.copy();
|
||||
|
||||
@@ -5,6 +5,7 @@ import WayofTime.alchemicalWizardry.api.items.IAltarManipulator;
|
||||
import WayofTime.alchemicalWizardry.common.items.EnergyBattery;
|
||||
import WayofTime.alchemicalWizardry.common.items.sigil.SigilOfHolding;
|
||||
import com.arc.bloodarsenal.BloodArsenal;
|
||||
import com.arc.bloodarsenal.tileentity.TileCompactedMRS;
|
||||
import com.arc.bloodarsenal.tileentity.TilePortableAltar;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@@ -12,6 +13,7 @@ import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
@@ -21,18 +23,19 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockPortableAltar extends BlockContainer
|
||||
{
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon topIcon;
|
||||
private IIcon topIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon sideIcon1;
|
||||
private IIcon sideIcon1;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon sideIcon2;
|
||||
private IIcon sideIcon2;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon bottomIcon;
|
||||
private IIcon bottomIcon;
|
||||
|
||||
public BlockPortableAltar()
|
||||
{
|
||||
@@ -115,7 +118,8 @@ public class BlockPortableAltar extends BlockContainer
|
||||
if (player.worldObj.isRemote)
|
||||
{
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
tileEntity.sendChatInfoToPlayer(player);
|
||||
}
|
||||
@@ -127,14 +131,15 @@ public class BlockPortableAltar extends BlockContainer
|
||||
if (player.worldObj.isRemote)
|
||||
{
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
tileEntity.sendMoreChatInfoToPlayer(player);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else if(playerItem.getItem() instanceof IAltarManipulator)
|
||||
else if (playerItem.getItem() instanceof IAltarManipulator)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -147,7 +152,8 @@ public class BlockPortableAltar extends BlockContainer
|
||||
if (player.worldObj.isRemote)
|
||||
{
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
tileEntity.sendChatInfoToPlayer(player);
|
||||
}
|
||||
@@ -159,7 +165,8 @@ public class BlockPortableAltar extends BlockContainer
|
||||
if (player.worldObj.isRemote)
|
||||
{
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
tileEntity.sendMoreChatInfoToPlayer(player);
|
||||
}
|
||||
@@ -181,7 +188,7 @@ public class BlockPortableAltar extends BlockContainer
|
||||
{
|
||||
player.inventory.addItemStackToInventory(tileEntity.getStackInSlot(0));
|
||||
tileEntity.setInventorySlotContents(0, null);
|
||||
tileEntity.setActive();
|
||||
tileEntity.setActive(false);
|
||||
}
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
return true;
|
||||
@@ -234,6 +241,53 @@ public class BlockPortableAltar extends BlockContainer
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entityLiving, ItemStack stack)
|
||||
{
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
|
||||
if (tile instanceof TilePortableAltar)
|
||||
{
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
||||
if (tag != null)
|
||||
{
|
||||
((TilePortableAltar) tile).readNBTOnPlace(tag);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune)
|
||||
{
|
||||
ArrayList<ItemStack> list = new ArrayList();
|
||||
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
|
||||
if (tile instanceof TilePortableAltar)
|
||||
{
|
||||
ItemStack drop = new ItemStack(this);
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
((TilePortableAltar) tile).writeNBTOnHarvest(tag);
|
||||
drop.setTagCompound(tag);
|
||||
|
||||
list.add(drop);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockHarvested(World world, int x, int y, int z, int meta, EntityPlayer player)
|
||||
{
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
{
|
||||
dropBlockAsItem(world, x, y, z, meta, 0);
|
||||
}
|
||||
|
||||
super.onBlockHarvested(world, x, y, z, meta, player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package com.arc.bloodarsenal.block;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.rituals.Rituals;
|
||||
import com.arc.bloodarsenal.items.block.BloodStoneBlock;
|
||||
import com.arc.bloodarsenal.items.block.CompactedMRSBlock;
|
||||
import com.arc.bloodarsenal.items.block.PortableAltarBlock;
|
||||
import com.arc.bloodarsenal.tileentity.*;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import net.minecraft.block.Block;
|
||||
@@ -26,6 +29,7 @@ public class ModBlocks
|
||||
public static Block life_infuser;
|
||||
public static Block compacter;
|
||||
public static Block lp_materializer;
|
||||
public static Block compacted_mrs;
|
||||
|
||||
public static void init()
|
||||
{
|
||||
@@ -48,11 +52,12 @@ public class ModBlocks
|
||||
life_infuser = new BlockLifeInfuser();
|
||||
compacter = new BlockCompacter();
|
||||
lp_materializer = new BlockLPMaterializer();
|
||||
compacted_mrs = new BlockCompactedMRS();
|
||||
}
|
||||
|
||||
public static void registerBlocksInPre()
|
||||
{
|
||||
GameRegistry.registerBlock(blood_stone, BloodStoneBlock.class, "BloodArsenal" + (ModBlocks.blood_stone.getUnlocalizedName().substring(5)));
|
||||
GameRegistry.registerBlock(blood_stone, BloodStoneBlock.class, "BloodArsenal" + ModBlocks.blood_stone.getUnlocalizedName().substring(5));
|
||||
GameRegistry.registerBlock(blood_tnt, "blood_tnt");
|
||||
GameRegistry.registerBlock(blood_stained_glass, "blood_stained_glass");
|
||||
GameRegistry.registerBlock(blood_infused_wood, "blood_infused_wood");
|
||||
@@ -67,10 +72,11 @@ public class ModBlocks
|
||||
GameRegistry.registerBlock(blood_infused_glowstone, "blood_infused_glowstone");
|
||||
GameRegistry.registerBlock(blood_lamp, "blood_lamp");
|
||||
GameRegistry.registerBlock(blood_infused_diamond_block, "blood_infused_diamond_block");
|
||||
GameRegistry.registerBlock(portable_altar, "portable_altar");
|
||||
GameRegistry.registerBlock(portable_altar, PortableAltarBlock.class, "BloodArsenal" + ModBlocks.portable_altar.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(life_infuser, "life_infuser");
|
||||
GameRegistry.registerBlock(compacter, "compacter");
|
||||
GameRegistry.registerBlock(lp_materializer, "lp_materializer");
|
||||
GameRegistry.registerBlock(compacted_mrs, CompactedMRSBlock.class, "BloodArsenal" + ModBlocks.compacted_mrs.getUnlocalizedName());
|
||||
}
|
||||
|
||||
public static void registerTileEntities()
|
||||
@@ -80,5 +86,6 @@ public class ModBlocks
|
||||
GameRegistry.registerTileEntity(TileLifeInfuser.class, "life_infuser");
|
||||
GameRegistry.registerTileEntity(TileCompacter.class, "compacter");
|
||||
GameRegistry.registerTileEntity(TileLPMaterializer.class, "lp_materializer");
|
||||
GameRegistry.registerTileEntity(TileCompactedMRS.class, "compacted_mrs");
|
||||
}
|
||||
}
|
||||
@@ -66,6 +66,8 @@ public class ItemBloodArsenal extends Item
|
||||
itemIcon = iconRegister.registerIcon("BloodArsenal:wolf_hide");
|
||||
else if (this.equals(ModItems.blood_burned_string))
|
||||
itemIcon = iconRegister.registerIcon("BloodArsenal:blood_burned_string");
|
||||
else if (this.equals(ModItems.glass_shard))
|
||||
itemIcon = iconRegister.registerIcon("BloodArsenal:glass_shard");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -99,5 +101,9 @@ public class ItemBloodArsenal extends Item
|
||||
{
|
||||
par3List.add(StatCollector.translateToLocal("tooltip.itemba.soul_fragment"));
|
||||
}
|
||||
if (this.equals(ModItems.glass_shard))
|
||||
{
|
||||
par3List.add(StatCollector.translateToLocal("tooltip.itemba.glass_shard"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,6 +17,7 @@ public class ItemBloodBall extends Item
|
||||
setCreativeTab(BloodArsenal.BA_TAB);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player)
|
||||
{
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
|
||||
@@ -68,6 +68,7 @@ public class ModItems
|
||||
public static Item wolf_hide;
|
||||
public static Item blood_money;
|
||||
public static Item blood_burned_string;
|
||||
public static Item glass_shard;
|
||||
|
||||
public static void init()
|
||||
{
|
||||
@@ -120,6 +121,7 @@ public class ModItems
|
||||
vampire_ring = new VampireRing();
|
||||
self_sacrifice_amulet = new SelfSacrificeAmulet();
|
||||
sacrifice_amulet = new SacrificeAmulet();
|
||||
glass_shard = new ItemBloodArsenal().setUnlocalizedName("glass_shard");
|
||||
}
|
||||
|
||||
public static void registerItems()
|
||||
@@ -170,5 +172,6 @@ public class ModItems
|
||||
GameRegistry.registerItem(wolf_hide, "wolf_hide");
|
||||
GameRegistry.registerItem(blood_money, "blood_money");
|
||||
GameRegistry.registerItem(blood_burned_string, "blood_burned_string");
|
||||
GameRegistry.registerItem(glass_shard, "glass_shard");
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,7 @@ public class BloodStoneBlock extends ItemBlock
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack itemStack)
|
||||
{
|
||||
String name;
|
||||
@@ -45,6 +46,7 @@ public class BloodStoneBlock extends ItemBlock
|
||||
return getUnlocalizedName() + "." + name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetadata(int par1)
|
||||
{
|
||||
return par1;
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.arc.bloodarsenal.items.block;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.rituals.Rituals;
|
||||
import com.arc.bloodarsenal.block.BlockCompactedMRS;
|
||||
import com.arc.bloodarsenal.block.ModBlocks;
|
||||
import com.arc.bloodarsenal.tileentity.TileCompactedMRS;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class CompactedMRSBlock extends ItemBlock
|
||||
{
|
||||
public CompactedMRSBlock(Block block)
|
||||
{
|
||||
super(block);
|
||||
setMaxStackSize(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
|
||||
{
|
||||
if (GuiScreen.isShiftKeyDown())
|
||||
{
|
||||
addHiddenTooltip(par1ItemStack, par2EntityPlayer, par3List, par4);
|
||||
}
|
||||
else
|
||||
{
|
||||
addStringToTooltip(StatCollector.translateToLocal("tooltip.shiftinfo"), par3List);
|
||||
}
|
||||
}
|
||||
|
||||
public void addHiddenTooltip(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
|
||||
{
|
||||
String ritualID = par1ItemStack.getTagCompound().getString("ritualName");
|
||||
String ritualName = Rituals.getNameOfRitual(ritualID);
|
||||
|
||||
addStringToTooltip(StatCollector.translateToLocal("tooltip.ritualName") + " &c" + ritualName + "&7", par3List);
|
||||
}
|
||||
|
||||
public void addStringToTooltip(String s, List<String> tooltip)
|
||||
{
|
||||
tooltip.add(s.replaceAll("&", "\u00a7"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.arc.bloodarsenal.items.block;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.rituals.Rituals;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class PortableAltarBlock extends ItemBlock
|
||||
{
|
||||
public PortableAltarBlock(Block block)
|
||||
{
|
||||
super(block);
|
||||
setMaxStackSize(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
|
||||
{
|
||||
if (GuiScreen.isShiftKeyDown())
|
||||
{
|
||||
addHiddenTooltip(par1ItemStack, par2EntityPlayer, par3List, par4);
|
||||
}
|
||||
else
|
||||
{
|
||||
addStringToTooltip(StatCollector.translateToLocal("tooltip.shiftinfo"), par3List);
|
||||
}
|
||||
}
|
||||
|
||||
public void addHiddenTooltip(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
|
||||
{
|
||||
String capacity = par1ItemStack.getTagCompound().getString("capacity");
|
||||
int alterTier = par1ItemStack.getTagCompound().getInteger("upgradeLevel");
|
||||
int currentEssence = par1ItemStack.getTagCompound().getInteger("currentEssence");
|
||||
|
||||
addStringToTooltip(StatCollector.translateToLocal("tooltip.altarTier") + " &c" + alterTier + "&7", par3List);
|
||||
addStringToTooltip(StatCollector.translateToLocal("tooltip.currentEssence") + " &c" + currentEssence + "&7", par3List);
|
||||
addStringToTooltip(StatCollector.translateToLocal("tooltip.capacity") + " &c" + capacity + "&7", par3List);
|
||||
}
|
||||
|
||||
public void addStringToTooltip(String s, List<String> tooltip)
|
||||
{
|
||||
tooltip.add(s.replaceAll("&", "\u00a7"));
|
||||
}
|
||||
}
|
||||
@@ -174,7 +174,7 @@ public class BoundBow extends ItemBow implements IBindable
|
||||
|
||||
public int getItemEnchantability()
|
||||
{
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
public EnumAction getItemUseAction(ItemStack par1ItemStack)
|
||||
|
||||
@@ -44,7 +44,6 @@ public class ThreadDownloadMod extends Thread
|
||||
VersionChecker.startedDownload = true;
|
||||
|
||||
String base = "http://minecraft.curseforge.com/mc-mods/228823-blood-magic-addon-blood-arsenal";
|
||||
String file = fileName.replaceAll(" ", "%20");
|
||||
URL url = new URL(base + "/files/latest");
|
||||
|
||||
try
|
||||
@@ -53,7 +52,6 @@ public class ThreadDownloadMod extends Thread
|
||||
}
|
||||
catch(IOException e) {}
|
||||
|
||||
url = new URL(base + "files/" + file);
|
||||
webReader = url.openStream();
|
||||
|
||||
File dir = new File(".", "mods");
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.arc.bloodarsenal.misc;
|
||||
|
||||
import com.arc.bloodarsenal.BloodArsenal;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent;
|
||||
@@ -29,19 +30,16 @@ public class VersionChecker
|
||||
{
|
||||
if (doneChecking && event.phase == TickEvent.Phase.END && Minecraft.getMinecraft().thePlayer != null && !triedToWarnPlayer)
|
||||
{
|
||||
Minecraft.getMinecraft().thePlayer.addChatComponentMessage(new ChatComponentText("Passed stage 1"));
|
||||
if (!onlineVersion.isEmpty())
|
||||
{
|
||||
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
|
||||
player.addChatComponentMessage(new ChatComponentText("Passed stage 2"));
|
||||
int onlineBuild = Integer.parseInt(onlineVersion.split("-1.7.10-1.1.4-")[1]);
|
||||
int clientBuild = BUILD.contains("GRADLE") ? Integer.MAX_VALUE : Integer.parseInt(BUILD);
|
||||
int onlineBuild = Integer.parseInt(onlineVersion.split("1.1-")[1]);
|
||||
int clientBuild = Integer.parseInt(BloodArsenal.VERSION.split("1.1-")[1]);
|
||||
|
||||
if (onlineBuild > clientBuild)
|
||||
{
|
||||
player.addChatComponentMessage(new ChatComponentText("Passed stage 3"));
|
||||
player.addChatComponentMessage(new ChatComponentTranslation("ba.versioning.update").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.LIGHT_PURPLE)));
|
||||
player.addChatComponentMessage(new ChatComponentTranslation("ba.versioning.outdated", clientBuild, onlineBuild));
|
||||
player.addChatComponentMessage(new ChatComponentTranslation("ba.versioning.outdated", BloodArsenal.VERSION, onlineVersion));
|
||||
|
||||
IChatComponent component = IChatComponent.Serializer.func_150699_a(StatCollector.translateToLocal("ba.versioning.updateMessage").replaceAll("%version%", onlineVersion));
|
||||
player.addChatComponentMessage(component);
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.arc.bloodarsenal.renderer.block;
|
||||
|
||||
import com.arc.bloodarsenal.tileentity.TileLifeInfuser;
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class RenderTileLifeInfuser implements ISimpleBlockRenderingHandler
|
||||
{
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
GL11.glScalef(1.1F, 1.1F, 1.1F);
|
||||
TileEntityRendererDispatcher.instance.renderTileEntityAt(new TileLifeInfuser(), 0.0D, 0.0D, 0.0D, 0.0F);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int modelId) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package com.arc.bloodarsenal.renderer.block;
|
||||
import com.arc.bloodarsenal.renderer.model.ModelLifeInfuser;
|
||||
import com.arc.bloodarsenal.tileentity.TileLifeInfuser;
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.entity.Render;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
@@ -15,6 +16,7 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
public class TileLifeInfuserRenderer extends TileEntitySpecialRenderer
|
||||
{
|
||||
@@ -37,70 +39,61 @@ public class TileLifeInfuserRenderer extends TileEntitySpecialRenderer
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double d0, double d1, double d2, float f)
|
||||
{
|
||||
if (tileEntity instanceof TileLifeInfuser)
|
||||
ResourceLocation test = new ResourceLocation("bloodarsenal:textures/models/LifeInfuser.png");
|
||||
|
||||
TileLifeInfuser tile = (TileLifeInfuser) tileEntity;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float) d0 + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F);
|
||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(test);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
|
||||
modelLifeInfuser.render(null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
|
||||
GL11.glPopMatrix();
|
||||
GL11.glPopMatrix();
|
||||
GL11.glPushMatrix();
|
||||
|
||||
if (tile.getStackInSlot(0) != null)
|
||||
{
|
||||
TileLifeInfuser tile = (TileLifeInfuser) tileEntity;
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float) d0 + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F);
|
||||
ResourceLocation test = new ResourceLocation("bloodarsenal:textures/models/LifeInfuser.png");
|
||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(test);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
|
||||
this.modelLifeInfuser.render(null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
|
||||
GL11.glPopMatrix();
|
||||
GL11.glPopMatrix();
|
||||
GL11.glPushMatrix();
|
||||
float scaleFactor = getGhostItemScaleFactor(tile.getStackInSlot(0));
|
||||
float rotationAngle = (float) (720.0 * (System.currentTimeMillis() & 0x3FFFL) / 0x3FFFL);
|
||||
EntityItem ghostEntityItem = new EntityItem(tile.getWorldObj());
|
||||
ghostEntityItem.hoverStart = 0.0F;
|
||||
ghostEntityItem.setEntityItemStack(tile.getStackInSlot(0));
|
||||
float displacement = 0.2F;
|
||||
|
||||
if (tile.getStackInSlot(0) != null)
|
||||
if (ghostEntityItem.getEntityItem().getItem() instanceof ItemBlock)
|
||||
{
|
||||
float scaleFactor = getGhostItemScaleFactor(tile.getStackInSlot(0));
|
||||
float rotationAngle = (float) (720.0 * (System.currentTimeMillis() & 0x3FFFL) / 0x3FFFL);
|
||||
EntityItem ghostEntityItem = new EntityItem(tile.getWorldObj());
|
||||
ghostEntityItem.hoverStart = 0.0F;
|
||||
ghostEntityItem.setEntityItemStack(tile.getStackInSlot(0));
|
||||
float displacement = 0.2F;
|
||||
|
||||
if (ghostEntityItem.getEntityItem().getItem() instanceof ItemBlock)
|
||||
{
|
||||
GL11.glTranslatef((float) d0 + 0.5F, (float) d1 + displacement + 0.25F, (float) d2 + 0.5F);
|
||||
}
|
||||
else
|
||||
{
|
||||
GL11.glTranslatef((float) d0 + 0.5F, (float) d1 + displacement + 0.25F, (float) d2 + 0.5F);
|
||||
}
|
||||
|
||||
GL11.glScalef(scaleFactor, scaleFactor, scaleFactor);
|
||||
GL11.glRotatef(rotationAngle, 0.0F, 1.0F, 0.0F);
|
||||
customRenderItem.doRender(ghostEntityItem, 0, 0, 0, 0, 0);
|
||||
GL11.glTranslatef((float) d0 + 0.5F, (float) d1 + displacement + 0.25F, (float) d2 + 0.5F);
|
||||
}
|
||||
else
|
||||
{
|
||||
GL11.glTranslatef((float) d0 + 0.5F, (float) d1 + displacement + 0.25F, (float) d2 + 0.5F);
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float) d0 + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F);
|
||||
|
||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(test);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
|
||||
GL11.glPopMatrix();
|
||||
GL11.glPopMatrix();
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(d0, d1, d2);
|
||||
|
||||
GL11.glRotated(90F, 1F, 0F, 0F);
|
||||
GL11.glTranslatef(-2F, -2F, -0.001F);
|
||||
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
|
||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
GL11.glPopMatrix();
|
||||
GL11.glScalef(scaleFactor, scaleFactor, scaleFactor);
|
||||
GL11.glRotatef(rotationAngle, 0.0F, 1.0F, 0.0F);
|
||||
customRenderItem.doRender(ghostEntityItem, 0, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(test);
|
||||
|
||||
GL11.glTranslated(d0 + 0.5, d1 + 1.5, d2 + 0.5);
|
||||
GL11.glScalef(1F, -1F, -1F);
|
||||
modelLifeInfuser.render();
|
||||
GL11.glScalef(1F, -1F, -1F);
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
private float getGhostItemScaleFactor(ItemStack itemStack)
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
package com.arc.bloodarsenal.renderer.item;
|
||||
|
||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
import net.minecraft.client.renderer.ItemRenderer;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class RenderBow implements IItemRenderer
|
||||
{
|
||||
public static final String[] ITEM_IN_USE = new String[] { "itemInUse", "field_71074_e", "f" };
|
||||
public static final String[] ITEM_IN_USE_COUNT = new String[] { "itemInUseCount", "field_71072_f", "g" };
|
||||
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type)
|
||||
{
|
||||
return type != ItemRenderType.INVENTORY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper)
|
||||
{
|
||||
return helper == ItemRendererHelper.ENTITY_ROTATION || helper == ItemRendererHelper.ENTITY_BOBBING;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderItem(ItemRenderType type, ItemStack item, Object... data)
|
||||
{
|
||||
switch(type)
|
||||
{
|
||||
case ENTITY :
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(-0.5F, 0F, 0F);
|
||||
if (item.isOnItemFrame()) GL11.glTranslatef(0F, -0.3F, 0.01F);
|
||||
render(item, null, false);
|
||||
GL11.glPopMatrix();
|
||||
break;
|
||||
}
|
||||
|
||||
case EQUIPPED :
|
||||
{
|
||||
render(item, data[1] instanceof EntityPlayer ? (EntityPlayer) data[1] : null, true);
|
||||
break;
|
||||
}
|
||||
|
||||
case EQUIPPED_FIRST_PERSON :
|
||||
{
|
||||
render(item, data[1] instanceof EntityPlayer ? (EntityPlayer) data[1] : null, false);
|
||||
break;
|
||||
}
|
||||
|
||||
default : break;
|
||||
}
|
||||
}
|
||||
|
||||
public void render(ItemStack item, EntityPlayer player, boolean transform)
|
||||
{
|
||||
int dmg = item.getItemDamage();
|
||||
IIcon icon = item.getItem().getIconFromDamageForRenderPass(dmg, 0);
|
||||
|
||||
if (player != null)
|
||||
{
|
||||
ItemStack using = ReflectionHelper.getPrivateValue(EntityPlayer.class, player, ITEM_IN_USE);
|
||||
int time = ReflectionHelper.getPrivateValue(EntityPlayer.class, player, ITEM_IN_USE_COUNT);
|
||||
icon = item.getItem().getIcon(item, 0, player, using, time);
|
||||
|
||||
if (transform)
|
||||
{
|
||||
GL11.glTranslatef(0.2F, -0.3F, 0.1F);
|
||||
//GL11.glRotatef(20.0F, 0.0F, 1.0F, 0.0F);
|
||||
//GL11.glRotatef(-100.0F, 1.0F, 0.0F, 0.0F);
|
||||
}
|
||||
}
|
||||
|
||||
float f = icon.getMinU();
|
||||
float f1 = icon.getMaxU();
|
||||
float f2 = icon.getMinV();
|
||||
float f3 = icon.getMaxV();
|
||||
float scale = 1F / 16F;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
ItemRenderer.renderItemIn2D(Tessellator.instance, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), scale);
|
||||
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glPopMatrix();
|
||||
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,6 @@ import org.lwjgl.opengl.GL11;
|
||||
public class ModelLifeInfuser extends ModelBase
|
||||
{
|
||||
private static final ResourceLocation texture = new ResourceLocation("bloodarsenal:textures/models/LifeInfuser.png");
|
||||
|
||||
private IModelCustom modelLifeInfuser;
|
||||
|
||||
public ModelRenderer Base;
|
||||
@@ -56,16 +55,16 @@ public class ModelLifeInfuser extends ModelBase
|
||||
this.Pillar1.addBox(0.0F, 0.0F, 0.0F, 2, 12, 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
|
||||
public void render()
|
||||
{
|
||||
this.Pillar2.render(f5);
|
||||
this.Pillar3.render(f5);
|
||||
this.Pillar4.render(f5);
|
||||
this.Base.render(f5);
|
||||
this.Plate2.render(f5);
|
||||
this.Plate1.render(f5);
|
||||
this.Pillar1.render(f5);
|
||||
float f = 1F / 16F;
|
||||
this.Pillar2.render(f);
|
||||
this.Pillar3.render(f);
|
||||
this.Pillar4.render(f);
|
||||
this.Base.render(f);
|
||||
this.Plate2.render(f);
|
||||
this.Plate1.render(f);
|
||||
this.Pillar1.render(f);
|
||||
}
|
||||
|
||||
public void renderLifeInfuser()
|
||||
@@ -90,13 +89,4 @@ public class ModelLifeInfuser extends ModelBase
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
/**
|
||||
* This is a helper function from Tabula to set the rotation of model parts
|
||||
*/
|
||||
public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z)
|
||||
{
|
||||
modelRenderer.rotateAngleX = x;
|
||||
modelRenderer.rotateAngleY = y;
|
||||
modelRenderer.rotateAngleZ = z;
|
||||
}
|
||||
}
|
||||
@@ -6,11 +6,14 @@ import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
|
||||
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
|
||||
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
|
||||
import WayofTime.alchemicalWizardry.api.tile.IBloodAltar;
|
||||
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEPedestal;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.entity.effect.EntityLightningBolt;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -19,7 +22,9 @@ import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import org.lwjgl.Sys;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -45,6 +50,11 @@ public class RitualEffectEnchant extends RitualEffect
|
||||
World worldSave = MinecraftServer.getServer().worldServers[0];
|
||||
LifeEssenceNetwork data = (LifeEssenceNetwork) worldSave.loadItemData(LifeEssenceNetwork.class, owner);
|
||||
|
||||
if (stage == 0)
|
||||
{
|
||||
advanceStage();
|
||||
}
|
||||
|
||||
if (data == null)
|
||||
{
|
||||
data = new LifeEssenceNetwork(owner);
|
||||
@@ -68,12 +78,14 @@ public class RitualEffectEnchant extends RitualEffect
|
||||
|
||||
if (!(topEntity instanceof TEAltar))
|
||||
{
|
||||
ritualStone.setActive(false);
|
||||
sendPlayerInformation(player, 1);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!canActivate(world, x, y, z))
|
||||
{
|
||||
ritualStone.setActive(false);
|
||||
sendPlayerInformation(player, 2);
|
||||
return;
|
||||
}
|
||||
@@ -83,7 +95,8 @@ public class RitualEffectEnchant extends RitualEffect
|
||||
|
||||
if (targetStack == null)
|
||||
{
|
||||
// sendPlayerInformation(player, 3);
|
||||
ritualStone.setActive(false);
|
||||
sendPlayerInformation(player, 3);
|
||||
return;
|
||||
}
|
||||
else
|
||||
@@ -91,11 +104,6 @@ public class RitualEffectEnchant extends RitualEffect
|
||||
enchantItem = targetStack;
|
||||
}
|
||||
|
||||
if (stage == 0)
|
||||
{
|
||||
advanceStage();
|
||||
}
|
||||
|
||||
switch (stage)
|
||||
{
|
||||
case 1:
|
||||
@@ -104,63 +112,53 @@ public class RitualEffectEnchant extends RitualEffect
|
||||
{
|
||||
ItemStack[] pedestalStack = getItemsInPedestals(world, x, y, z, true);
|
||||
|
||||
// if (pedestalStack.length > 0)
|
||||
int count = pedestalStack.length;
|
||||
boolean addedEnchantment = false;
|
||||
|
||||
if (count > 0 && !world.isRemote)
|
||||
{
|
||||
int count = pedestalStack.length;
|
||||
boolean addedEnchantment = false;
|
||||
|
||||
if (count > 0 && !world.isRemote)
|
||||
for (ItemStack itemStack : pedestalStack)
|
||||
{
|
||||
for (ItemStack itemStack : pedestalStack)
|
||||
if (itemStack != null && itemStack.getItem() == Items.enchanted_book)
|
||||
{
|
||||
if (itemStack.getItem() == Items.enchanted_book)
|
||||
NBTTagList enchants = Items.enchanted_book.func_92110_g(itemStack);
|
||||
|
||||
if (enchants != null && enchants.tagCount() > 0)
|
||||
{
|
||||
NBTTagList enchants = Items.enchanted_book.func_92110_g(itemStack);
|
||||
NBTTagCompound enchant = enchants.getCompoundTagAt(0);
|
||||
short id = enchant.getShort("id");
|
||||
short lvl = enchant.getShort("lvl");
|
||||
|
||||
if (enchants != null && enchants.tagCount() > 0)
|
||||
if (!hasEnchantAlready(id) && isEnchantmentValid(id))
|
||||
{
|
||||
NBTTagCompound enchant = enchants.getCompoundTagAt(0);
|
||||
short id = enchant.getShort("id");
|
||||
short lvl = enchant.getShort("lvl");
|
||||
|
||||
if (!hasEnchantAlready(id) && isEnchantmentValid(id))
|
||||
{
|
||||
this.enchants.add(new EnchantmentData(id, lvl));
|
||||
addedEnchantment = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
stage = 0;
|
||||
this.enchants.add(new EnchantmentData(id, lvl));
|
||||
addedEnchantment = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// else
|
||||
{
|
||||
stage = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!addedEnchantment)
|
||||
{
|
||||
if (enchants.isEmpty())
|
||||
{
|
||||
stage = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
advanceStage();
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
// else
|
||||
else
|
||||
{
|
||||
// sendPlayerInformation(player, 4);
|
||||
sendPlayerInformation(player, 4);
|
||||
}
|
||||
|
||||
if (!addedEnchantment)
|
||||
{
|
||||
if (enchants.isEmpty())
|
||||
{
|
||||
stage = 0;
|
||||
ritualStone.setActive(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
advanceStage();
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -175,7 +173,8 @@ public class RitualEffectEnchant extends RitualEffect
|
||||
for (EnchantmentData d : enchants)
|
||||
{
|
||||
Enchantment ench = Enchantment.enchantmentsList[d.enchant];
|
||||
lpRequired += (int) (5000F * ((15 - Math.min(15, ench.getWeight())) * 1.05F) * ((3F + d.level * d.level) * 0.25F) * (0.9F + enchants.size() * 0.05F));
|
||||
lpRequired += (int) (500F * ((15 - Math.min(15, ench.getWeight())) * 1.05F) * ((3F + d.level * d.level) * 0.25F) * (0.9F + enchants.size() * 0.05F));
|
||||
player.addChatComponentMessage(new ChatComponentText("Lp required: " + lpRequired));
|
||||
SoulNetworkHandler.syphonFromNetwork(owner, lpRequired);
|
||||
}
|
||||
}
|
||||
@@ -185,6 +184,11 @@ public class RitualEffectEnchant extends RitualEffect
|
||||
advanceStage();
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
}
|
||||
else
|
||||
{
|
||||
sendPlayerInformation(player, 5);
|
||||
ritualStone.setActive(false);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -205,6 +209,12 @@ public class RitualEffectEnchant extends RitualEffect
|
||||
lpRequired = -1;
|
||||
advanceStage();
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
|
||||
world.addWeatherEffect(new EntityLightningBolt(world, x, y + 2, z));
|
||||
world.addWeatherEffect(new EntityLightningBolt(world, x + 1, y + 7, z + 1));
|
||||
world.addWeatherEffect(new EntityLightningBolt(world, x - 1, y + 7, z + 1));
|
||||
world.addWeatherEffect(new EntityLightningBolt(world, x + 1, y + 7, z - 1));
|
||||
world.addWeatherEffect(new EntityLightningBolt(world, x - 1, y + 7, z - 1));
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -332,7 +342,6 @@ public class RitualEffectEnchant extends RitualEffect
|
||||
public ItemStack[] getItemsInPedestals(World world, int x, int y, int z, boolean yes)
|
||||
{
|
||||
ItemStack[] items = new ItemStack[4];
|
||||
// itemList.clear();
|
||||
|
||||
if (yes)
|
||||
{
|
||||
@@ -347,7 +356,6 @@ public class RitualEffectEnchant extends RitualEffect
|
||||
if (tileEntity instanceof TEPedestal)
|
||||
{
|
||||
items[i] = ((TEPedestal) tileEntity).getStackInSlot(0);
|
||||
// itemList.add(items[i]);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
@@ -366,7 +374,6 @@ public class RitualEffectEnchant extends RitualEffect
|
||||
if (tileEntity instanceof TEPedestal)
|
||||
{
|
||||
items[i] = ((TEPedestal) tileEntity).getStackInSlot(0);
|
||||
// itemList.add(items[i]);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
@@ -429,16 +436,22 @@ public class RitualEffectEnchant extends RitualEffect
|
||||
switch (number)
|
||||
{
|
||||
case 1:
|
||||
player.addChatComponentMessage(new ChatComponentText("There is no altar!"));
|
||||
player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("message.enchant.noAltar")));
|
||||
break;
|
||||
case 2:
|
||||
player.addChatComponentMessage(new ChatComponentText("There are no pedestals!"));
|
||||
player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("message.enchant.noPedestals")));
|
||||
break;
|
||||
case 3:
|
||||
player.addChatComponentMessage(new ChatComponentText("There is no item to enchant!"));
|
||||
player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("message.enchant.noEnchantItem")));
|
||||
break;
|
||||
case 4:
|
||||
player.addChatComponentMessage(new ChatComponentText("There are no enchantments to apply!"));
|
||||
player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("message.enchant.noEnchantments")));
|
||||
break;
|
||||
case 5:
|
||||
player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("message.enchant.notEnoughLP")));
|
||||
break;
|
||||
case 6:
|
||||
player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("message.enchant.enchantIsNotValid")));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -453,18 +466,4 @@ public class RitualEffectEnchant extends RitualEffect
|
||||
this.level = level;
|
||||
}
|
||||
}
|
||||
|
||||
private static class PedestalLocations
|
||||
{
|
||||
public int xOffset;
|
||||
public int yOffset;
|
||||
public int zOffset;
|
||||
|
||||
public PedestalLocations(int xOffset, int yOffset, int zOffset)
|
||||
{
|
||||
this.xOffset = xOffset;
|
||||
this.yOffset = yOffset;
|
||||
this.zOffset = zOffset;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -56,7 +56,6 @@ public class RitualEffectWithering extends RitualEffect
|
||||
|
||||
List<EntityLivingBase> list = SpellHelper.getLivingEntitiesInRange(world, x + 0.5, y + 0.5, z + 0.5, range, vertRange);
|
||||
int entityCount = 0;
|
||||
boolean flag = false;
|
||||
|
||||
for(EntityLivingBase livingEntity : list)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,717 @@
|
||||
package com.arc.bloodarsenal.tileentity;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.Int3;
|
||||
import WayofTime.alchemicalWizardry.api.alchemy.energy.*;
|
||||
import WayofTime.alchemicalWizardry.api.event.RitualActivatedEvent;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.LocalRitualStorage;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.RitualBreakMethod;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.Rituals;
|
||||
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
|
||||
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone;
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.util.Constants;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class TileCompactedMRS extends TEMasterStone implements IMasterRitualStone
|
||||
{
|
||||
private boolean isActive;
|
||||
private String owner;
|
||||
private String varString1;
|
||||
private int cooldown;
|
||||
private int var1;
|
||||
private int direction;
|
||||
public boolean isRunning;
|
||||
public int runningTime;
|
||||
public String ritualName;
|
||||
|
||||
public LocalRitualStorage storage;
|
||||
|
||||
private NBTTagCompound customRitualTag;
|
||||
|
||||
protected ReagentContainer[] tanks;
|
||||
protected Map<Reagent, Integer> attunedTankMap;
|
||||
|
||||
public TileCompactedMRS()
|
||||
{
|
||||
tanks = new ReagentContainer[]{new ReagentContainer(1000), new ReagentContainer(1000), new ReagentContainer(1000)};
|
||||
this.attunedTankMap = new HashMap();
|
||||
|
||||
isActive = false;
|
||||
owner = "";
|
||||
cooldown = 0;
|
||||
var1 = 0;
|
||||
direction = 0;
|
||||
varString1 = "";
|
||||
isRunning = false;
|
||||
ritualName = "";
|
||||
runningTime = 0;
|
||||
|
||||
this.customRitualTag = new NBTTagCompound();
|
||||
}
|
||||
|
||||
public void readNBTOnPlace(NBTTagCompound tag)
|
||||
{
|
||||
ritualName = tag.getString("ritualName");
|
||||
}
|
||||
|
||||
public void writeNBTOnHarvest(NBTTagCompound tag)
|
||||
{
|
||||
tag.setString("ritualName", ritualName);
|
||||
}
|
||||
|
||||
public void readClientNBT(NBTTagCompound tag)
|
||||
{
|
||||
ritualName = tag.getString("ritualName");
|
||||
isRunning = tag.getBoolean("isRunning");
|
||||
runningTime = tag.getInteger("runningTime");
|
||||
|
||||
NBTTagList tagList = tag.getTagList("reagentTanks", Constants.NBT.TAG_COMPOUND);
|
||||
|
||||
int size = tagList.tagCount();
|
||||
this.tanks = new ReagentContainer[size];
|
||||
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
NBTTagCompound savedTag = tagList.getCompoundTagAt(i);
|
||||
this.tanks[i] = ReagentContainer.readFromNBT(savedTag);
|
||||
}
|
||||
}
|
||||
|
||||
public void writeClientNBT(NBTTagCompound tag)
|
||||
{
|
||||
tag.setString("ritualName", ritualName);
|
||||
tag.setBoolean("isRunning", isRunning);
|
||||
tag.setInteger("runningTime", runningTime);
|
||||
|
||||
NBTTagList tagList = new NBTTagList();
|
||||
|
||||
for (int i = 0; i < this.tanks.length; i++)
|
||||
{
|
||||
NBTTagCompound savedTag = new NBTTagCompound();
|
||||
if (this.tanks[i] != null)
|
||||
{
|
||||
this.tanks[i].writeToNBT(savedTag);
|
||||
}
|
||||
tagList.appendTag(savedTag);
|
||||
}
|
||||
|
||||
tag.setTag("reagentTanks", tagList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
super.readFromNBT(tag);
|
||||
isActive = tag.getBoolean("isActive");
|
||||
owner = tag.getString("owner");
|
||||
cooldown = tag.getInteger("cooldown");
|
||||
var1 = tag.getInteger("var1");
|
||||
direction = tag.getInteger("direction");
|
||||
ritualName = tag.getString("ritualName");
|
||||
isRunning = tag.getBoolean("isRunning");
|
||||
runningTime = tag.getInteger("runningTime");
|
||||
|
||||
NBTTagList tagList = tag.getTagList("reagentTanks", Constants.NBT.TAG_COMPOUND);
|
||||
|
||||
int size = tagList.tagCount();
|
||||
this.tanks = new ReagentContainer[size];
|
||||
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
NBTTagCompound savedTag = tagList.getCompoundTagAt(i);
|
||||
this.tanks[i] = ReagentContainer.readFromNBT(savedTag);
|
||||
}
|
||||
|
||||
NBTTagList attunedTagList = tag.getTagList("attunedTankMap", Constants.NBT.TAG_COMPOUND);
|
||||
|
||||
for (int i = 0; i < attunedTagList.tagCount(); i++)
|
||||
{
|
||||
NBTTagCompound savedTag = attunedTagList.getCompoundTagAt(i);
|
||||
Reagent reagent = ReagentRegistry.getReagentForKey(savedTag.getString("reagent"));
|
||||
this.attunedTankMap.put(reagent, savedTag.getInteger("amount"));
|
||||
}
|
||||
|
||||
customRitualTag = tag.getCompoundTag("customRitualTag");
|
||||
|
||||
LocalRitualStorage newStorage = Rituals.getLocalStorage(ritualName);
|
||||
|
||||
NBTTagCompound localStorageTag = tag.getCompoundTag("localStorage");
|
||||
|
||||
if (newStorage != null)
|
||||
{
|
||||
newStorage.readFromNBT(localStorageTag);
|
||||
storage = newStorage;
|
||||
storage.xCoord = xCoord;
|
||||
storage.yCoord = yCoord;
|
||||
storage.zCoord = zCoord;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
super.writeToNBT(tag);
|
||||
tag.setBoolean("isActive", isActive);
|
||||
tag.setString("owner", owner);
|
||||
tag.setInteger("cooldown", cooldown);
|
||||
tag.setInteger("var1", var1);
|
||||
tag.setInteger("direction", direction);
|
||||
tag.setString("ritualName", ritualName);
|
||||
tag.setBoolean("isRunning", isRunning);
|
||||
tag.setInteger("runningTime", runningTime);
|
||||
|
||||
NBTTagList tagList = new NBTTagList();
|
||||
|
||||
for (int i = 0; i < this.tanks.length; i++)
|
||||
{
|
||||
NBTTagCompound savedTag = new NBTTagCompound();
|
||||
if (this.tanks[i] != null)
|
||||
{
|
||||
this.tanks[i].writeToNBT(savedTag);
|
||||
}
|
||||
tagList.appendTag(savedTag);
|
||||
}
|
||||
|
||||
tag.setTag("reagentTanks", tagList);
|
||||
|
||||
NBTTagList attunedTagList = new NBTTagList();
|
||||
|
||||
for (Map.Entry<Reagent, Integer> entry : this.attunedTankMap.entrySet())
|
||||
{
|
||||
NBTTagCompound savedTag = new NBTTagCompound();
|
||||
savedTag.setString("reagent", ReagentRegistry.getKeyForReagent(entry.getKey()));
|
||||
savedTag.setInteger("amount", entry.getValue());
|
||||
attunedTagList.appendTag(savedTag);
|
||||
}
|
||||
|
||||
tag.setTag("attunedTankMap", attunedTagList);
|
||||
|
||||
tag.setTag("customRitualTag", customRitualTag);
|
||||
|
||||
if (storage != null)
|
||||
{
|
||||
NBTTagCompound localStorageTag = new NBTTagCompound();
|
||||
|
||||
storage.writeToNBT(localStorageTag);
|
||||
tag.setTag("localStorage", localStorageTag);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void activateRitual(World world, int crystalLevel, ItemStack activationCrystal, EntityPlayer player, String crystalOwner)
|
||||
{
|
||||
if (world.isRemote)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//TODO
|
||||
RitualActivatedEvent event = new RitualActivatedEvent(this, crystalOwner, ritualName, player, activationCrystal, crystalLevel);
|
||||
|
||||
if (MinecraftForge.EVENT_BUS.post(event) || event.getResult() == Event.Result.DENY)
|
||||
{
|
||||
player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("message.masterstone.somethingstoppedyou")));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
int eventCrystalTier = event.crystalTier;
|
||||
String eventRitualKey = event.ritualKey;
|
||||
String eventOwnerKey = event.ownerKey;
|
||||
|
||||
boolean testLevel = Rituals.canCrystalActivate(eventRitualKey, eventCrystalTier);
|
||||
|
||||
if (!testLevel)
|
||||
{
|
||||
player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("message.masterstone.crystalvibrates")));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
int currentEssence = SoulNetworkHandler.getCurrentEssence(eventOwnerKey);
|
||||
|
||||
if (currentEssence < Rituals.getCostForActivation(ritualName))
|
||||
{
|
||||
player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("message.masterstone.youfeelapull")));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (!world.isRemote)
|
||||
{
|
||||
if (!Rituals.startRitual(this, ritualName, player))
|
||||
{
|
||||
player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("message.masterstone.ritualresistyou")));
|
||||
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
int drain = SoulNetworkHandler.syphonFromNetwork(eventOwnerKey, Rituals.getCostForActivation(ritualName));
|
||||
|
||||
if (drain > 0)
|
||||
{
|
||||
player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("message.masterstone.energyflows")));
|
||||
|
||||
for (int i = 0; i < 12; i++)
|
||||
{
|
||||
SpellHelper.sendIndexedParticleToAllAround(world, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 1, xCoord, yCoord, zCoord);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("message.masterstone.somethingstoppedyou")));
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!ritualName.equals(""))
|
||||
{
|
||||
Rituals.onRitualBroken(this, ritualName, RitualBreakMethod.ACTIVATE);
|
||||
}
|
||||
|
||||
this.setOwner(eventOwnerKey);
|
||||
cooldown = Rituals.getInitialCooldown(ritualName);
|
||||
var1 = 0;
|
||||
storage = Rituals.getLocalStorage(ritualName);
|
||||
storage.setLocation(new Int3(xCoord, yCoord, zCoord));
|
||||
isActive = true;
|
||||
isRunning = true;
|
||||
direction = Rituals.getDirectionOfRitual(world, xCoord, yCoord, zCoord, ritualName);
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOwner(String owner)
|
||||
{
|
||||
this.owner = owner;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void useOnRitualBroken()
|
||||
{
|
||||
Rituals.onRitualBroken(this, ritualName, RitualBreakMethod.BREAK_MRS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void useOnRitualBrokenExplosion()
|
||||
{
|
||||
Rituals.onRitualBroken(this, ritualName, RitualBreakMethod.EXPLOSION);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity()
|
||||
{
|
||||
if (isRunning && runningTime < 100)
|
||||
{
|
||||
runningTime++;
|
||||
}
|
||||
else if (!isRunning && runningTime > 0)
|
||||
{
|
||||
runningTime--;
|
||||
}
|
||||
|
||||
if (!isActive)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int worldTime = (int) (worldObj.getWorldTime() % 24000);
|
||||
|
||||
if (worldObj.isRemote)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (worldTime % 100 == 0)
|
||||
{
|
||||
SpellHelper.sendIndexedParticleToAllAround(worldObj, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 1, xCoord, yCoord, zCoord);
|
||||
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
if (worldObj.getBlockPowerInput(xCoord, yCoord, zCoord) > 0)
|
||||
{
|
||||
if (isRunning)
|
||||
{
|
||||
Rituals.onRitualBroken(this, ritualName, RitualBreakMethod.REDSTONE);
|
||||
isRunning = false;
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!isRunning)
|
||||
{
|
||||
isRunning = true;
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
}
|
||||
|
||||
performRitual(worldObj, xCoord, yCoord, zCoord, ritualName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void performRitual(World world, int x, int y, int z, String currentRitualString)
|
||||
{
|
||||
Rituals.performEffect(this, ritualName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOwner()
|
||||
{
|
||||
return owner;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCooldown(int newCooldown)
|
||||
{
|
||||
this.cooldown = newCooldown;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCooldown()
|
||||
{
|
||||
return this.cooldown;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setVar1(int newVar1)
|
||||
{
|
||||
this.var1 = newVar1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getVar1()
|
||||
{
|
||||
return this.var1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setActive(boolean active)
|
||||
{
|
||||
Rituals.onRitualBroken(this, ritualName, RitualBreakMethod.DEACTIVATE);
|
||||
this.isActive = active;
|
||||
this.isRunning = active;
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDirection()
|
||||
{
|
||||
return this.direction;
|
||||
}
|
||||
|
||||
@Override
|
||||
public World getWorld()
|
||||
{
|
||||
return this.getWorldObj();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getXCoord()
|
||||
{
|
||||
return xCoord;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getYCoord()
|
||||
{
|
||||
return yCoord;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getZCoord()
|
||||
{
|
||||
return zCoord;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCurrentRitual()
|
||||
{
|
||||
return ritualName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Packet getDescriptionPacket()
|
||||
{
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
writeClientNBT(nbttagcompound);
|
||||
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, -999, nbttagcompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet)
|
||||
{
|
||||
super.onDataPacket(net, packet);
|
||||
readClientNBT(packet.func_148857_g());
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getRenderBoundingBox()
|
||||
{
|
||||
double renderExtention = 1.0d;
|
||||
AxisAlignedBB bb = AxisAlignedBB.getBoundingBox(xCoord - renderExtention, yCoord - renderExtention, zCoord - renderExtention, xCoord + 1 + renderExtention, yCoord + 1 + renderExtention, zCoord + 1 + renderExtention);
|
||||
return bb;
|
||||
}
|
||||
|
||||
/* ISegmentedReagentHandler */
|
||||
@Override
|
||||
public int fill(ForgeDirection from, ReagentStack resource, boolean doFill)
|
||||
{
|
||||
if (doFill)
|
||||
{
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
int totalFill = 0;
|
||||
|
||||
boolean useTankLimit = !this.attunedTankMap.isEmpty();
|
||||
|
||||
if (resource != null)
|
||||
{
|
||||
int totalTanksFillable = useTankLimit ? this.getTanksTunedToReagent(resource.reagent) : this.tanks.length;
|
||||
int tanksFilled = 0;
|
||||
|
||||
int maxFill = resource.amount;
|
||||
|
||||
for (int i = this.tanks.length - 1; i >= 0; i--)
|
||||
{
|
||||
ReagentStack remainingStack = resource.copy();
|
||||
remainingStack.amount = maxFill - totalFill;
|
||||
|
||||
boolean doesReagentMatch = tanks[i].getReagent() == null ? false : tanks[i].getReagent().isReagentEqual(remainingStack);
|
||||
|
||||
if (doesReagentMatch)
|
||||
{
|
||||
totalFill += tanks[i].fill(remainingStack, doFill);
|
||||
tanksFilled++;
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (totalFill >= maxFill || tanksFilled >= totalTanksFillable)
|
||||
{
|
||||
return totalFill;
|
||||
}
|
||||
}
|
||||
|
||||
if (tanksFilled >= totalTanksFillable)
|
||||
{
|
||||
return totalFill;
|
||||
}
|
||||
|
||||
for (int i = this.tanks.length - 1; i >= 0; i--)
|
||||
{
|
||||
ReagentStack remainingStack = resource.copy();
|
||||
remainingStack.amount = maxFill - totalFill;
|
||||
|
||||
boolean isTankEmpty = tanks[i].getReagent() == null;
|
||||
|
||||
if (isTankEmpty)
|
||||
{
|
||||
totalFill += tanks[i].fill(remainingStack, doFill);
|
||||
tanksFilled++;
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (totalFill >= maxFill || tanksFilled >= totalTanksFillable)
|
||||
{
|
||||
return totalFill;
|
||||
}
|
||||
}
|
||||
}
|
||||
return totalFill;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReagentStack drain(ForgeDirection from, ReagentStack resource, boolean doDrain)
|
||||
{
|
||||
if (resource == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (doDrain)
|
||||
{
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
int maxDrain = resource.amount;
|
||||
Reagent reagent = resource.reagent;
|
||||
int drained = 0;
|
||||
|
||||
for (int i = 0; i < tanks.length; i++)
|
||||
{
|
||||
if (drained >= maxDrain)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (resource.isReagentEqual(tanks[i].getReagent()))
|
||||
{
|
||||
ReagentStack drainStack = tanks[i].drain(maxDrain - drained, doDrain);
|
||||
if (drainStack != null)
|
||||
{
|
||||
drained += drainStack.amount;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new ReagentStack(reagent, drained);
|
||||
}
|
||||
|
||||
/* Only returns the amount from the first available tank */
|
||||
@Override
|
||||
public ReagentStack drain(ForgeDirection from, int maxDrain, boolean doDrain)
|
||||
{
|
||||
for (int i = 0; i < tanks.length; i++)
|
||||
{
|
||||
ReagentStack stack = tanks[i].drain(maxDrain, doDrain);
|
||||
if (stack != null)
|
||||
{
|
||||
if (doDrain)
|
||||
{
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFill(ForgeDirection from, Reagent reagent)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDrain(ForgeDirection from, Reagent reagent)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReagentContainerInfo[] getContainerInfo(ForgeDirection from)
|
||||
{
|
||||
ReagentContainerInfo[] info = new ReagentContainerInfo[this.getNumberOfTanks()];
|
||||
for (int i = 0; i < this.getNumberOfTanks(); i++)
|
||||
{
|
||||
info[i] = tanks[i].getInfo();
|
||||
}
|
||||
return info;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNumberOfTanks()
|
||||
{
|
||||
return tanks.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTanksTunedToReagent(Reagent reagent)
|
||||
{
|
||||
if (this.attunedTankMap.containsKey(reagent) && this.attunedTankMap.get(reagent) != null)
|
||||
{
|
||||
return this.attunedTankMap.get(reagent);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTanksTunedToReagent(Reagent reagent, int total)
|
||||
{
|
||||
if (total == 0 && this.attunedTankMap.containsKey(reagent))
|
||||
{
|
||||
this.attunedTankMap.remove(reagent);
|
||||
return;
|
||||
}
|
||||
|
||||
this.attunedTankMap.put(reagent, new Integer(total));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<Reagent, Integer> getAttunedTankMap()
|
||||
{
|
||||
return this.attunedTankMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean areTanksEmpty()
|
||||
{
|
||||
for (int i = 0; i < this.tanks.length; i++)
|
||||
{
|
||||
if (tanks[i] != null && tanks[i].getReagent() != null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound getCustomRitualTag()
|
||||
{
|
||||
return this.customRitualTag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCustomRitualTag(NBTTagCompound tag)
|
||||
{
|
||||
this.customRitualTag = tag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRunningTime()
|
||||
{
|
||||
return this.runningTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LocalRitualStorage getLocalStorage()
|
||||
{
|
||||
return storage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLocalStorage(LocalRitualStorage storage)
|
||||
{
|
||||
this.storage = storage;
|
||||
}
|
||||
|
||||
public void setRitualName(String ritualName)
|
||||
{
|
||||
this.ritualName = ritualName;
|
||||
}
|
||||
}
|
||||
@@ -117,6 +117,60 @@ public class TilePortableAltar extends TileEntity implements IInventory, IFluidT
|
||||
this.demonBloodDuration = Math.max(0, this.demonBloodDuration - 1);
|
||||
}
|
||||
|
||||
public void readNBTOnPlace(NBTTagCompound tag)
|
||||
{
|
||||
fluid.amount = tag.getInteger("currentEssence");
|
||||
upgradeLevel = tag.getInteger("upgradeLevel");
|
||||
isActive = tag.getBoolean("isActive");
|
||||
liquidRequired = tag.getInteger("liquidRequired");
|
||||
canBeFilled = tag.getBoolean("canBeFilled");
|
||||
isUpgraded = tag.getBoolean("isUpgraded");
|
||||
consumptionRate = tag.getInteger("consumptionRate");
|
||||
drainRate = tag.getInteger("drainRate");
|
||||
consumptionMultiplier = tag.getFloat("consumptionMultiplier");
|
||||
efficiencyMultiplier = tag.getFloat("efficiencyMultiplier");
|
||||
selfSacrificeEfficiencyMultiplier = tag.getFloat("selfSacrificeEfficiencyMultiplier");
|
||||
sacrificeEfficiencyMultiplier = tag.getFloat("sacrificeEfficiencyMultiplier");
|
||||
capacityMultiplier = tag.getFloat("capacityMultiplier");
|
||||
orbCapacityMultiplier = tag.getFloat("orbCapacityMultiplier");
|
||||
dislocationMultiplier = tag.getFloat("dislocationMultiplier");
|
||||
capacity = tag.getInteger("capacity");
|
||||
bufferCapacity = tag.getInteger("bufferCapacity");
|
||||
progress = tag.getInteger("progress");
|
||||
isResultBlock = tag.getBoolean("isResultBlock");
|
||||
lockdownDuration = tag.getInteger("lockdownDuration");
|
||||
accelerationUpgrades = tag.getInteger("accelerationUpgrades");
|
||||
demonBloodDuration = tag.getInteger("demonBloodDuration");
|
||||
cooldownAfterCrafting = tag.getInteger("cooldownAfterCrafting");
|
||||
}
|
||||
|
||||
public void writeNBTOnHarvest(NBTTagCompound tag)
|
||||
{
|
||||
tag.setInteger("currentEssence", fluid.amount);
|
||||
tag.setInteger("upgradeLevel", upgradeLevel);
|
||||
tag.setBoolean("isActive", isActive);
|
||||
tag.setInteger("liquidRequired", liquidRequired);
|
||||
tag.setBoolean("canBeFilled", canBeFilled);
|
||||
tag.setBoolean("isUpgraded", isUpgraded);
|
||||
tag.setInteger("consumptionRate", consumptionRate);
|
||||
tag.setInteger("drainRate", drainRate);
|
||||
tag.setFloat("consumptionMultiplier", consumptionMultiplier);
|
||||
tag.setFloat("efficiencyMultiplier", efficiencyMultiplier);
|
||||
tag.setFloat("sacrificeEfficiencyMultiplier", sacrificeEfficiencyMultiplier);
|
||||
tag.setFloat("selfSacrificeEfficiencyMultiplier", selfSacrificeEfficiencyMultiplier);
|
||||
tag.setBoolean("isResultBlock", isResultBlock);
|
||||
tag.setFloat("capacityMultiplier", capacityMultiplier);
|
||||
tag.setFloat("orbCapacityMultiplier", orbCapacityMultiplier);
|
||||
tag.setFloat("dislocationMultiplier", dislocationMultiplier);
|
||||
tag.setInteger("capacity", capacity);
|
||||
tag.setInteger("progress", progress);
|
||||
tag.setInteger("bufferCapacity", bufferCapacity);
|
||||
tag.setInteger("lockdownDuration", lockdownDuration);
|
||||
tag.setInteger("accelerationUpgrades", this.accelerationUpgrades);
|
||||
tag.setInteger("demonBloodDuration", demonBloodDuration);
|
||||
tag.setInteger("cooldownAfterCrafting", cooldownAfterCrafting);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound par1NBTTagCompound)
|
||||
{
|
||||
@@ -161,6 +215,7 @@ public class TilePortableAltar extends TileEntity implements IInventory, IFluidT
|
||||
}
|
||||
}
|
||||
|
||||
fluid.amount = par1NBTTagCompound.getInteger("currentEssence");
|
||||
upgradeLevel = par1NBTTagCompound.getInteger("upgradeLevel");
|
||||
isActive = par1NBTTagCompound.getBoolean("isActive");
|
||||
liquidRequired = par1NBTTagCompound.getInteger("liquidRequired");
|
||||
@@ -242,6 +297,7 @@ public class TilePortableAltar extends TileEntity implements IInventory, IFluidT
|
||||
par1NBTTagCompound.setInteger("inputAmount", fluidInput.amount);
|
||||
}
|
||||
|
||||
par1NBTTagCompound.setInteger("currentEssence", fluid.amount);
|
||||
par1NBTTagCompound.setInteger("upgradeLevel", upgradeLevel);
|
||||
par1NBTTagCompound.setBoolean("isActive", isActive);
|
||||
par1NBTTagCompound.setInteger("liquidRequired", liquidRequired);
|
||||
@@ -396,18 +452,33 @@ public class TilePortableAltar extends TileEntity implements IInventory, IFluidT
|
||||
return capacity;
|
||||
}
|
||||
|
||||
public void setCapacity(int capacity)
|
||||
{
|
||||
this.capacity = capacity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCurrentBlood()
|
||||
{
|
||||
return getFluidAmount();
|
||||
}
|
||||
|
||||
public void setCurrentBlood(int amount)
|
||||
{
|
||||
this.fluid.amount = amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTier()
|
||||
{
|
||||
return upgradeLevel;
|
||||
}
|
||||
|
||||
public void setTier(int tier)
|
||||
{
|
||||
this.upgradeLevel = tier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getProgress()
|
||||
{
|
||||
@@ -420,30 +491,75 @@ public class TilePortableAltar extends TileEntity implements IInventory, IFluidT
|
||||
return sacrificeEfficiencyMultiplier;
|
||||
}
|
||||
|
||||
public void setSacrificeMultiplier(float sacrificeMultiplier)
|
||||
{
|
||||
this.sacrificeEfficiencyMultiplier = sacrificeMultiplier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getSelfSacrificeMultiplier()
|
||||
{
|
||||
return selfSacrificeEfficiencyMultiplier;
|
||||
}
|
||||
|
||||
public void setSelfSacrificeMultiplier(float selfSacrificeMultiplier)
|
||||
{
|
||||
this.selfSacrificeEfficiencyMultiplier = selfSacrificeMultiplier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getOrbMultiplier()
|
||||
{
|
||||
return orbCapacityMultiplier;
|
||||
}
|
||||
|
||||
public void setOrbMultiplier(float orbMultiplier)
|
||||
{
|
||||
this.orbCapacityMultiplier = orbMultiplier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDislocationMultiplier()
|
||||
{
|
||||
return dislocationMultiplier;
|
||||
}
|
||||
|
||||
public void setDislocationMultiplier(float dislocationMultiplier)
|
||||
{
|
||||
this.dislocationMultiplier = dislocationMultiplier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBufferCapacity()
|
||||
{
|
||||
return bufferCapacity;
|
||||
}
|
||||
|
||||
public void setBufferCapacity(int bufferCapacity)
|
||||
{
|
||||
this.bufferCapacity = bufferCapacity;
|
||||
}
|
||||
|
||||
public void setConsumptionMultiplier(float consumptionMultiplier)
|
||||
{
|
||||
this.consumptionMultiplier = consumptionMultiplier;
|
||||
}
|
||||
|
||||
public void setEfficiencyMultiplier(float efficiencyMultiplier)
|
||||
{
|
||||
this.efficiencyMultiplier = efficiencyMultiplier;
|
||||
}
|
||||
|
||||
public void setCapacityMultiplier(float capacityMultiplier)
|
||||
{
|
||||
this.capacityMultiplier = capacityMultiplier;
|
||||
}
|
||||
|
||||
public void setAccelerationUpgrades(int accelerationUpgrades)
|
||||
{
|
||||
this.accelerationUpgrades = accelerationUpgrades;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTankInfo getInfo()
|
||||
{
|
||||
@@ -597,7 +713,6 @@ public class TilePortableAltar extends TileEntity implements IInventory, IFluidT
|
||||
if (AlchemicalWizardry.lockdownAltar)
|
||||
{
|
||||
List<EntityPlayer> list = SpellHelper.getPlayersInRange(worldObj, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, 15, 15);
|
||||
boolean hasHighRegen = false;
|
||||
for (EntityPlayer player : list)
|
||||
{
|
||||
PotionEffect regenEffect = player.getActivePotionEffect(Potion.regeneration);
|
||||
@@ -625,8 +740,8 @@ public class TilePortableAltar extends TileEntity implements IInventory, IFluidT
|
||||
if (worldObj.getWorldTime() % Math.max(20 - this.accelerationUpgrades, 1) == 0)
|
||||
{
|
||||
int syphonMax = (int) (20 * this.dislocationMultiplier);
|
||||
int fluidInputted = 0;
|
||||
int fluidOutputted = 0;
|
||||
int fluidInputted;
|
||||
int fluidOutputted;
|
||||
fluidInputted = Math.min(syphonMax, -this.fluid.amount + capacity);
|
||||
fluidInputted = Math.min(this.fluidInput.amount, fluidInputted);
|
||||
this.fluid.amount += fluidInputted;
|
||||
@@ -687,7 +802,7 @@ public class TilePortableAltar extends TileEntity implements IInventory, IFluidT
|
||||
|
||||
if (progress >= liquidRequired * stackSize)
|
||||
{
|
||||
ItemStack result = null;
|
||||
ItemStack result;
|
||||
result = AltarRecipeRegistry.getItemForItemAndTier(this.getStackInSlot(0), this.upgradeLevel);
|
||||
if (result != null)
|
||||
{
|
||||
@@ -759,9 +874,9 @@ public class TilePortableAltar extends TileEntity implements IInventory, IFluidT
|
||||
}
|
||||
}
|
||||
|
||||
public void setActive()
|
||||
public void setActive(boolean active)
|
||||
{
|
||||
isActive = false;
|
||||
isActive = active;
|
||||
}
|
||||
|
||||
public boolean isActive()
|
||||
@@ -886,55 +1001,6 @@ public class TilePortableAltar extends TileEntity implements IInventory, IFluidT
|
||||
|
||||
public void checkAndSetAltar()
|
||||
{
|
||||
boolean checkUpgrade = true;
|
||||
int upgradeState = UpgradedAltars.isAltarValid(worldObj, xCoord, yCoord, zCoord);
|
||||
|
||||
if (upgradeState <= 1)
|
||||
{
|
||||
upgradeLevel = 1;
|
||||
isUpgraded = false;
|
||||
this.consumptionMultiplier = 0;
|
||||
this.efficiencyMultiplier = 1;
|
||||
this.sacrificeEfficiencyMultiplier = 0;
|
||||
this.selfSacrificeEfficiencyMultiplier = 0;
|
||||
this.capacityMultiplier = 1;
|
||||
this.orbCapacityMultiplier = 1;
|
||||
this.dislocationMultiplier = 1;
|
||||
this.accelerationUpgrades = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
AltarUpgradeComponent upgrades = UpgradedAltars.getUpgrades(worldObj, xCoord, yCoord, zCoord, upgradeState);
|
||||
|
||||
if (upgrades == null)
|
||||
{
|
||||
upgradeLevel = 1;
|
||||
isUpgraded = false;
|
||||
this.consumptionMultiplier = 0;
|
||||
this.efficiencyMultiplier = 1;
|
||||
this.sacrificeEfficiencyMultiplier = 0;
|
||||
this.selfSacrificeEfficiencyMultiplier = 0;
|
||||
this.capacityMultiplier = 1;
|
||||
this.orbCapacityMultiplier = 1;
|
||||
this.dislocationMultiplier = 1;
|
||||
this.upgradeLevel = upgradeState;
|
||||
this.accelerationUpgrades = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
this.isUpgraded = checkUpgrade;
|
||||
this.upgradeLevel = upgradeState;
|
||||
this.consumptionMultiplier = (float) (0.20 * upgrades.getSpeedUpgrades());
|
||||
this.efficiencyMultiplier = (float) Math.pow(0.85, upgrades.getSpeedUpgrades());
|
||||
this.sacrificeEfficiencyMultiplier = (float) (0.10 * upgrades.getSacrificeUpgrades());
|
||||
this.selfSacrificeEfficiencyMultiplier = (float) (0.10 * upgrades.getSelfSacrificeUpgrades());
|
||||
this.capacityMultiplier = (float) ((1 * Math.pow(1.10, upgrades.getBetterCapacitiveUpgrades()) + 0.20 * upgrades.getAltarCapacitiveUpgrades()));
|
||||
this.dislocationMultiplier = (float) (Math.pow(1.2, upgrades.getDisplacementUpgrades()));
|
||||
this.orbCapacityMultiplier = (float) (1 + 0.02 * upgrades.getOrbCapacitiveUpgrades());
|
||||
this.capacity = (int) (FluidContainerRegistry.BUCKET_VOLUME * 10 * capacityMultiplier);
|
||||
this.bufferCapacity = (int) (FluidContainerRegistry.BUCKET_VOLUME * 1 * capacityMultiplier);
|
||||
this.accelerationUpgrades = upgrades.getAccelerationUpgrades();
|
||||
|
||||
if (this.fluid.amount > this.capacity)
|
||||
{
|
||||
this.fluid.amount = this.capacity;
|
||||
@@ -1063,7 +1129,7 @@ public class TilePortableAltar extends TileEntity implements IInventory, IFluidT
|
||||
public void sendChatInfoToPlayer(EntityPlayer player)
|
||||
{
|
||||
player.addChatMessage(new ChatComponentText("Altar's Current Essence: " + this.fluid.amount + "LP"));
|
||||
player.addChatMessage(new ChatComponentText("Altar's Current Tier: " + UpgradedAltars.isAltarValid(worldObj, xCoord, yCoord, zCoord)));
|
||||
player.addChatMessage(new ChatComponentText("Altar's Current Tier: " + this.upgradeLevel));
|
||||
player.addChatMessage(new ChatComponentText("Capacity: " + this.getCapacity() + "LP"));
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user