- Removed the FOV effect from the Quick Feet speed upgrade.

- Minor work on the Demon Crucible.
This commit is contained in:
WayofTime 2016-02-17 16:31:11 -05:00
parent 3e94aeae77
commit ccb706f15c
13 changed files with 469 additions and 23 deletions

View file

@ -11,6 +11,8 @@ Version 2.0.0-18
- Ammended range of Zephyr ritual
- Fixed Green Grove ritual
- Fixed Crusher ritual so it didn't break everything at once.
- Removed the FOV effect from the Quick Feet speed upgrade.
- Minor work on the Demon Crucible.
------------------------------------------------------
Version 2.0.0-17

View file

@ -100,6 +100,8 @@ public class Constants
public static final String GHOST_STACK_SIZE = "stackSize";
public static final String ITEM_INVENTORY = "itemInventory";
public static final String BLOCKPOS_CONNECTION = "connections";
}
public static class Mod

View file

@ -0,0 +1,13 @@
package WayofTime.bloodmagic.api.soul;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
@Getter
@RequiredArgsConstructor
public enum EnumDemonWillType
{
DEFAULT("Default");
public final String name;
}

View file

@ -0,0 +1,20 @@
package WayofTime.bloodmagic.api.soul;
/**
* Implement this interface on a block that can accept and store Demonic Will.
*
*/
public interface IDemonWillConduit
{
public int getWeight();
public double fillDemonWill(EnumDemonWillType type, double amount, boolean doFill);
public double drainDemonWill(EnumDemonWillType type, double amount, boolean doDrain);
public boolean canFill(EnumDemonWillType type);
public boolean canDrain(EnumDemonWillType type);
public double getCurrentWill(EnumDemonWillType type);
}

View file

@ -3,12 +3,18 @@ package WayofTime.bloodmagic.block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.tile.TileIncenseAltar;
import WayofTime.bloodmagic.api.soul.IDemonWill;
import WayofTime.bloodmagic.api.soul.IDemonWillGem;
import WayofTime.bloodmagic.tile.TileDemonCrucible;
import WayofTime.bloodmagic.util.Utils;
public class BlockDemonCrucible extends BlockContainer
{
@ -53,15 +59,39 @@ public class BlockDemonCrucible extends BlockContainer
@Override
public TileEntity createNewTileEntity(World world, int meta)
{
return new TileIncenseAltar();
return new TileDemonCrucible();
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ)
{
TileDemonCrucible crucible = (TileDemonCrucible) world.getTileEntity(pos);
if (crucible == null || player.isSneaking())
return false;
ItemStack playerItem = player.getCurrentEquippedItem();
if (playerItem != null)
{
if (!(playerItem.getItem() instanceof IDemonWill) && !(playerItem.getItem() instanceof IDemonWillGem))
{
return false;
}
}
Utils.insertItemToTile(crucible, player);
world.markBlockForUpdate(pos);
return true;
}
@Override
public void breakBlock(World world, BlockPos blockPos, IBlockState blockState)
{
TileIncenseAltar TileIncenseAltar = (TileIncenseAltar) world.getTileEntity(blockPos);
if (TileIncenseAltar != null)
TileIncenseAltar.dropItems();
TileDemonCrucible tile = (TileDemonCrucible) world.getTileEntity(blockPos);
if (tile != null)
tile.dropItems();
super.breakBlock(world, blockPos, blockState);
}

View file

@ -0,0 +1,59 @@
package WayofTime.bloodmagic.client.render;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import WayofTime.bloodmagic.tile.TileDemonCrucible;
public class RenderDemonCrucible extends TileEntitySpecialRenderer<TileDemonCrucible>
{
public static Minecraft mc = Minecraft.getMinecraft();
public static ResourceLocation resource = new ResourceLocation("bloodmagic", "textures/blocks/lifeEssenceStill.png");
public static float minHeight = 0.6497f;
public static float maxHeight = 0.79f;
@Override
public void renderTileEntityAt(TileDemonCrucible tile, double x, double y, double z, float partialTicks, int destroyStage)
{
ItemStack inputStack = tile.getStackInSlot(0);
GlStateManager.pushMatrix();
GlStateManager.translate(x, y, z);
this.renderItem(tile.getWorld(), inputStack, partialTicks);
GlStateManager.popMatrix();
}
private void renderItem(World world, ItemStack stack, float partialTicks)
{
RenderItem itemRenderer = mc.getRenderItem();
if (stack != null)
{
GlStateManager.translate(0.5, 1.5, 0.5);
EntityItem entityitem = new EntityItem(world, 0.0D, 0.0D, 0.0D, stack);
entityitem.getEntityItem().stackSize = 1;
entityitem.hoverStart = 0.0F;
GlStateManager.pushMatrix();
GlStateManager.disableLighting();
float rotation = (float) (720.0 * (System.currentTimeMillis() & 0x3FFFL) / 0x3FFFL);
GlStateManager.rotate(rotation, 0.0F, 1.0F, 0);
GlStateManager.scale(0.5F, 0.5F, 0.5F);
GlStateManager.pushAttrib();
RenderHelper.enableStandardItemLighting();
itemRenderer.renderItem(entityitem.getEntityItem(), ItemCameraTransforms.TransformType.FIXED);
RenderHelper.disableStandardItemLighting();
GlStateManager.popAttrib();
GlStateManager.enableLighting();
GlStateManager.popMatrix();
}
}
}

View file

@ -30,6 +30,11 @@ public class LivingArmourUpgradeSpeed extends LivingArmourUpgrade
super(level);
}
public double getSpeedModifier()
{
return speedModifier[this.level];
}
@Override
public void onTick(World world, EntityPlayer player, ILivingArmour livingArmour)
{
@ -52,7 +57,7 @@ public class LivingArmourUpgradeSpeed extends LivingArmourUpgrade
{
Multimap<String, AttributeModifier> modifierMap = HashMultimap.<String, AttributeModifier>create();
modifierMap.put(SharedMonsterAttributes.movementSpeed.getAttributeUnlocalizedName(), new AttributeModifier(new UUID(895132, 1), "Speed modifier" + 1, speedModifier[this.level], 1));
// modifierMap.put(SharedMonsterAttributes.movementSpeed.getAttributeUnlocalizedName(), new AttributeModifier(new UUID(895132, 1), "Speed modifier" + 1, speedModifier[this.level], 1));
if (healthModifier[this.level] > 0)
{

View file

@ -4,7 +4,6 @@ import java.util.List;
import net.minecraft.entity.Entity;
import net.minecraft.entity.IProjectile;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityArrow;
import net.minecraft.entity.projectile.EntityThrowable;
import net.minecraft.util.AxisAlignedBB;
@ -40,21 +39,21 @@ public class PotionEventHandlers
@SubscribeEvent
public void onEntityUpdate(LivingEvent.LivingUpdateEvent event)
{
if (event.entityLiving.isPotionActive(ModPotions.boost))
{
int i = event.entityLiving.getActivePotionEffect(ModPotions.boost).getAmplifier();
{
float percentIncrease = (i + 1) * 0.05f;
if (event.entityLiving instanceof EntityPlayer)
{
EntityPlayer entityPlayer = (EntityPlayer) event.entityLiving;
if ((entityPlayer.onGround || entityPlayer.capabilities.isFlying) && entityPlayer.moveForward > 0F)
entityPlayer.moveFlying(0F, 1F, entityPlayer.capabilities.isFlying ? (percentIncrease / 2.0f) : percentIncrease);
}
}
}
// if (event.entityLiving.isPotionActive(ModPotions.boost))
// {
// int i = event.entityLiving.getActivePotionEffect(ModPotions.boost).getAmplifier();
// {
// float percentIncrease = (i + 1) * 0.05f;
//
// if (event.entityLiving instanceof EntityPlayer)
// {
// EntityPlayer entityPlayer = (EntityPlayer) event.entityLiving;
//
// if ((entityPlayer.onGround || entityPlayer.capabilities.isFlying) && entityPlayer.moveForward > 0F)
// entityPlayer.moveFlying(0F, 1F, entityPlayer.capabilities.isFlying ? (percentIncrease / 2.0f) : percentIncrease);
// }
// }
// }
if (event.entityLiving.isPotionActive(ModPotions.whirlwind))
{

View file

@ -1,6 +1,5 @@
package WayofTime.bloodmagic.proxy;
import WayofTime.bloodmagic.util.helper.InventoryRenderHelperV2;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.client.model.obj.OBJLoader;
import net.minecraftforge.common.MinecraftForge;
@ -11,6 +10,7 @@ import WayofTime.bloodmagic.client.helper.ShaderHelper;
import WayofTime.bloodmagic.client.mesh.CustomMeshDefinitionActivatable;
import WayofTime.bloodmagic.client.render.RenderAlchemyArray;
import WayofTime.bloodmagic.client.render.RenderAltar;
import WayofTime.bloodmagic.client.render.RenderDemonCrucible;
import WayofTime.bloodmagic.client.render.RenderItemRoutingNode;
import WayofTime.bloodmagic.client.render.entity.BloodLightRenderFactory;
import WayofTime.bloodmagic.client.render.entity.SentientArrowRenderFactory;
@ -22,9 +22,11 @@ import WayofTime.bloodmagic.registry.ModBlocks;
import WayofTime.bloodmagic.registry.ModItems;
import WayofTime.bloodmagic.tile.TileAlchemyArray;
import WayofTime.bloodmagic.tile.TileAltar;
import WayofTime.bloodmagic.tile.TileDemonCrucible;
import WayofTime.bloodmagic.tile.routing.TileRoutingNode;
import WayofTime.bloodmagic.util.handler.ClientEventHandler;
import WayofTime.bloodmagic.util.helper.InventoryRenderHelper;
import WayofTime.bloodmagic.util.helper.InventoryRenderHelperV2;
public class ClientProxy extends CommonProxy
{
@ -60,6 +62,7 @@ public class ClientProxy extends CommonProxy
ClientRegistry.bindTileEntitySpecialRenderer(TileAlchemyArray.class, new RenderAlchemyArray());
ClientRegistry.bindTileEntitySpecialRenderer(TileAltar.class, new RenderAltar());
ClientRegistry.bindTileEntitySpecialRenderer(TileRoutingNode.class, new RenderItemRoutingNode());
ClientRegistry.bindTileEntitySpecialRenderer(TileDemonCrucible.class, new RenderDemonCrucible());
}
@Override

View file

@ -38,6 +38,7 @@ import WayofTime.bloodmagic.item.block.ItemBlockRitualController;
import WayofTime.bloodmagic.item.block.ItemBlockRitualStone;
import WayofTime.bloodmagic.tile.TileAlchemyArray;
import WayofTime.bloodmagic.tile.TileAltar;
import WayofTime.bloodmagic.tile.TileDemonCrucible;
import WayofTime.bloodmagic.tile.TileImperfectRitualStone;
import WayofTime.bloodmagic.tile.TileIncenseAltar;
import WayofTime.bloodmagic.tile.TileMasterRitualStone;
@ -131,6 +132,7 @@ public class ModBlocks
GameRegistry.registerTileEntity(TileOutputRoutingNode.class, Constants.Mod.MODID + ":" + TileOutputRoutingNode.class.getSimpleName());
GameRegistry.registerTileEntity(TileItemRoutingNode.class, Constants.Mod.MODID + ":" + TileItemRoutingNode.class.getSimpleName());
GameRegistry.registerTileEntity(TileIncenseAltar.class, Constants.Mod.MODID + ":" + TileIncenseAltar.class.getSimpleName());
GameRegistry.registerTileEntity(TileDemonCrucible.class, Constants.Mod.MODID + ":" + TileDemonCrucible.class.getSimpleName());
}
public static void initRenders()

View file

@ -0,0 +1,279 @@
package WayofTime.bloodmagic.tile;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map.Entry;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.ITickable;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.ritual.AreaDescriptor;
import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
import WayofTime.bloodmagic.api.soul.IDemonWillConduit;
public class TileDemonCrucible extends TileInventory implements ITickable, IDemonWillConduit
{
public AreaDescriptor checkArea = new AreaDescriptor.Rectangle(new BlockPos(-5, -5, -5), 11);
public List<BlockPos> conduitList = new ArrayList<BlockPos>(); //Offset list
public HashMap<EnumDemonWillType, Double> willMap = new HashMap<EnumDemonWillType, Double>();
public final int maxWill = 100;
public final double maxTransferPerTick = 1;
public final double thresholdFill = 0.01;
public int internalCounter = 0;
public TileDemonCrucible()
{
super(1, "demonCrucible");
}
@Override
public void update()
{
if (internalCounter % 100 == 0)
{
conduitList.clear();
List<BlockPos> posList = checkArea.getContainedPositions(pos);
for (BlockPos newPos : posList)
{
TileEntity tile = worldObj.getTileEntity(newPos);
if (tile instanceof IDemonWillConduit)
{
conduitList.add(newPos.subtract(getPos()));
}
}
}
internalCounter++;
if (worldObj.isBlockPowered(getPos()))
{
//TODO: Fill the contained gem if it is there.
} else
{
double maxWeight = 0;
List<IDemonWillConduit> tileList = new ArrayList<IDemonWillConduit>();
Iterator<BlockPos> iterator = conduitList.iterator();
while (iterator.hasNext())
{
BlockPos newPos = pos.add(iterator.next());
TileEntity tile = worldObj.getTileEntity(newPos);
if (tile instanceof IDemonWillConduit)
{
maxWeight += ((IDemonWillConduit) tile).getWeight();
tileList.add((IDemonWillConduit) tile);
} else
{
iterator.remove();
}
}
if (maxWeight > 0)
{
for (EnumDemonWillType type : EnumDemonWillType.values())
{
double currentAmount = this.getCurrentWill(type);
if (currentAmount <= 0)
{
continue;
}
for (IDemonWillConduit conduit : tileList)
{
if (!conduit.canFill(type))
{
continue;
}
double transfer = Math.min(currentAmount, conduit.getWeight() * maxTransferPerTick / maxWeight);
if (transfer <= 0)
{
break;
}
double conduitAmount = conduit.getCurrentWill(type);
if (currentAmount - conduitAmount <= thresholdFill) // Will only fill if this conduit's amount is greater than the conduit it is filling.
{
continue;
}
transfer = conduit.drainDemonWill(type, transfer, false);
if (transfer > 0)
{
conduit.drainDemonWill(type, transfer, true);
currentAmount -= transfer;
}
}
if (currentAmount <= 0)
{
willMap.remove(type);
} else
{
willMap.put(type, currentAmount);
}
}
}
}
}
@Override
public void readFromNBT(NBTTagCompound tag)
{
super.readFromNBT(tag);
willMap.clear();
for (EnumDemonWillType type : EnumDemonWillType.values())
{
double amount = tag.getDouble("EnumWill" + type.getName());
if (amount > 0)
{
willMap.put(type, amount);
}
}
NBTTagList tags = tag.getTagList(Constants.NBT.BLOCKPOS_CONNECTION, 10);
for (int i = 0; i < tags.tagCount(); i++)
{
NBTTagCompound blockTag = tags.getCompoundTagAt(i);
BlockPos newPos = new BlockPos(blockTag.getInteger(Constants.NBT.X_COORD), blockTag.getInteger(Constants.NBT.Y_COORD), blockTag.getInteger(Constants.NBT.Z_COORD));
conduitList.add(newPos);
}
}
@Override
public void writeToNBT(NBTTagCompound tag)
{
super.writeToNBT(tag);
for (Entry<EnumDemonWillType, Double> entry : willMap.entrySet())
{
tag.setDouble("EnumWill" + entry.getKey().getName(), entry.getValue());
}
NBTTagList tags = new NBTTagList();
for (BlockPos pos : conduitList)
{
NBTTagCompound posTag = new NBTTagCompound();
posTag.setInteger(Constants.NBT.X_COORD, pos.getX());
posTag.setInteger(Constants.NBT.Y_COORD, pos.getY());
posTag.setInteger(Constants.NBT.Z_COORD, pos.getZ());
tags.appendTag(posTag);
}
tag.setTag(Constants.NBT.BLOCKPOS_CONNECTION, tags);
}
// IDemonWillConduit
@Override
public int getWeight()
{
return 10;
}
@Override
public double fillDemonWill(EnumDemonWillType type, double amount, boolean doFill)
{
if (amount <= 0)
{
return 0;
}
if (!canFill(type))
{
return 0;
}
if (!doFill)
{
if (!willMap.containsKey(type))
{
return Math.min(maxWill, amount);
}
return Math.min(maxWill - willMap.get(type), amount);
}
if (!willMap.containsKey(type))
{
double max = Math.min(maxWill, amount);
willMap.put(type, max);
return max;
}
double current = willMap.get(type);
double filled = maxWill - current;
if (amount < filled)
{
willMap.put(type, current + amount);
filled = amount;
} else
{
willMap.put(type, (double) maxWill);
}
return filled;
}
@Override
public double drainDemonWill(EnumDemonWillType type, double amount, boolean doDrain)
{
if (!willMap.containsKey(type))
{
return 0;
}
double drained = amount;
double current = willMap.get(type);
if (current < drained)
{
drained = current;
}
if (doDrain)
{
current -= drained;
if (current <= 0)
{
willMap.remove(type);
} else
{
willMap.put(type, current);
}
}
return drained;
}
@Override
public boolean canFill(EnumDemonWillType type)
{
return true;
}
@Override
public boolean canDrain(EnumDemonWillType type)
{
return true;
}
@Override
public double getCurrentWill(EnumDemonWillType type)
{
return willMap.containsKey(type) ? willMap.get(type) : 0;
}
}

View file

@ -72,6 +72,7 @@ import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeArrowShot;
import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeDigging;
import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeGrimReaperSprint;
import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeSelfSacrifice;
import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeSpeed;
import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeStepAssist;
import WayofTime.bloodmagic.registry.ModBlocks;
import WayofTime.bloodmagic.registry.ModItems;
@ -149,6 +150,36 @@ public class EventHandler
player.stepHeight = 0.6f;
}
}
float percentIncrease = 0;
if (LivingArmour.hasFullSet(player))
{
ItemStack chestStack = player.getCurrentArmor(2);
LivingArmour armour = ItemLivingArmour.getLivingArmour(chestStack);
if (armour != null)
{
LivingArmourUpgrade upgrade = ItemLivingArmour.getUpgrade(Constants.Mod.MODID + ".upgrade.movement", chestStack);
if (upgrade instanceof LivingArmourUpgradeSpeed)
{
percentIncrease += 0.1f * ((LivingArmourUpgradeSpeed) upgrade).getSpeedModifier();
}
}
}
if (event.entityLiving.isPotionActive(ModPotions.boost))
{
int i = event.entityLiving.getActivePotionEffect(ModPotions.boost).getAmplifier();
{
percentIncrease += (i + 1) * 0.05f;
}
}
if (percentIncrease > 0 && (player.onGround || player.capabilities.isFlying) && player.moveForward > 0F)
{
player.moveFlying(0F, 1F, player.capabilities.isFlying ? (percentIncrease / 2.0f) : percentIncrease);
}
}
}

View file

@ -180,6 +180,7 @@ tile.BloodMagic.incenseAltar.name=Incense Altar
tile.BloodMagic.teleposer.name=Teleposer
tile.BloodMagic.soulForge.name=Hellfire Forge
tile.BloodMagic.demonCrucible.name=Demon Crucible
tile.BloodMagic.masterRouting.name=Master Routing Node
tile.BloodMagic.outputRouting.name=Output Routing Node