Added Soul Forge block and WIP model

This commit is contained in:
WayofTime 2016-01-07 16:36:52 -05:00
parent 72ed003da1
commit 8b024e1703
8 changed files with 287 additions and 13 deletions

View file

@ -1,14 +1,9 @@
package WayofTime.bloodmagic.block;
import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.api.Constants;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.api.Constants;
public class BlockSoulForge extends Block
{
@ -16,7 +11,7 @@ public class BlockSoulForge extends Block
{
super(Material.iron);
setUnlocalizedName(Constants.Mod.MODID + ".soulforge.");
setUnlocalizedName(Constants.Mod.MODID + ".soulforge");
setHardness(2.0F);
setResistance(5.0F);
setStepSound(soundTypeMetal);
@ -25,11 +20,26 @@ public class BlockSoulForge extends Block
}
@Override
public boolean onBlockActivated(World world, BlockPos blockPos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ)
public boolean isOpaqueCube()
{
if (world.isRemote)
return false;
return false;
}
@Override
public boolean isFullCube()
{
return false;
}
@Override
public boolean isVisuallyOpaque()
{
return false;
}
@Override
public int getRenderType()
{
return 3;
}
}

View file

@ -19,6 +19,7 @@ import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.soul.ISoul;
import WayofTime.bloodmagic.api.soul.ISoulWeapon;
import WayofTime.bloodmagic.api.soul.PlayerSoulHandler;
import WayofTime.bloodmagic.api.util.helper.NBTHelper;
import WayofTime.bloodmagic.registry.ModItems;
import WayofTime.bloodmagic.util.helper.TextHelper;
@ -28,6 +29,10 @@ import com.google.common.collect.Multimap;
public class ItemSoulSword extends ItemSword implements ISoulWeapon
{
public int[] soulBracket = new int[] { 16 };
public double[] damageAdded = new double[] { 1 };
public double[] soulDrainPerSwing = new double[] { 0.1 };
public ItemSoulSword()
{
super(ModItems.soulToolMaterial);
@ -46,12 +51,33 @@ public class ItemSoulSword extends ItemSword implements ISoulWeapon
if (getActivated(stack))
{
setDamageOfActivatedSword(stack, 7);
double soulsRemaining = PlayerSoulHandler.getTotalSouls(player);
int level = getLevel(stack, soulsRemaining);
double drain = level >= 0 ? soulDrainPerSwing[level] : 0;
double extraDamage = level >= 0 ? damageAdded[level] : 0;
setDrainOfActivatedSword(stack, drain);
setDamageOfActivatedSword(stack, 7 + extraDamage);
}
return stack;
}
private int getLevel(ItemStack stack, double soulsRemaining)
{
int lvl = -1;
for (int i = 0; i < soulBracket.length; i++)
{
if (soulsRemaining >= soulBracket[i])
{
lvl = i;
}
}
return lvl;
}
@Override
public EnumAction getItemUseAction(ItemStack stack)
{
@ -78,6 +104,21 @@ public class ItemSoulSword extends ItemSword implements ISoulWeapon
{
if (getActivated(stack))
{
double drain = this.getDrainOfActivatedSword(stack);
if (drain > 0)
{
double soulsRemaining = PlayerSoulHandler.getTotalSouls(player);
if (drain > soulsRemaining)
{
setActivated(stack, false);
return false;
} else
{
PlayerSoulHandler.consumeSouls(player, drain);
}
}
return super.onLeftClickEntity(stack, player, entity);
}
@ -128,6 +169,23 @@ public class ItemSoulSword extends ItemSword implements ISoulWeapon
tag.setDouble(Constants.NBT.SOUL_SWORD_DAMAGE, damage);
}
public double getDrainOfActivatedSword(ItemStack stack)
{
NBTHelper.checkNBT(stack);
NBTTagCompound tag = stack.getTagCompound();
return tag.getDouble(Constants.NBT.SOUL_SWORD_ACTIVE_DRAIN);
}
public void setDrainOfActivatedSword(ItemStack stack, double drain)
{
NBTHelper.checkNBT(stack);
NBTTagCompound tag = stack.getTagCompound();
tag.setDouble(Constants.NBT.SOUL_SWORD_ACTIVE_DRAIN, drain);
}
@Override
public Multimap<String, AttributeModifier> getAttributeModifiers(ItemStack stack)
{

View file

@ -25,6 +25,7 @@ public class ModBlocks
public static Block alchemyArray;
public static Block spectralBlock;
public static Block phantomBlock;
public static Block soulForge;
public static Block lifeEssence;
@ -47,6 +48,7 @@ public class ModBlocks
alchemyArray = registerBlock(new BlockAlchemyArray());
spectralBlock = registerBlock(new BlockSpectral());
phantomBlock = registerBlock(new BlockPhantom());
soulForge = registerBlock(new BlockSoulForge());
crystal = registerBlock(new BlockCrystal(), ItemBlockCrystal.class);
bloodStoneBrick = registerBlock(new BlockBloodStoneBrick(), ItemBlockBloodStoneBrick.class);
@ -95,6 +97,7 @@ public class ModBlocks
renderHelper.itemRender(InventoryRenderHelper.getItemFromBlock(alchemyArray));
renderHelper.itemRender(InventoryRenderHelper.getItemFromBlock(spectralBlock));
renderHelper.itemRender(InventoryRenderHelper.getItemFromBlock(phantomBlock));
renderHelper.itemRender(InventoryRenderHelper.getItemFromBlock(soulForge));
}
private static Block registerBlock(Block block, Class<? extends ItemBlock> itemBlock, String name)

View file

@ -0,0 +1,20 @@
{
"forge_marker": 1,
"defaults": {
"textures": {
"base": "minecraft:blocks/iron_block",
"base_bottom": "minecraft:blocks/gold_block",
"glass": "minecraft:blocks/glass",
"attachment": "minecraft:blocks/stone"
},
"uvlock": true
},
"variants": {
"normal": {
"model": "bloodmagic:sub/BlockSoulForge",
"submodel": {
}
}
}
}

View file

@ -147,6 +147,7 @@ tile.BloodMagic.spectralBlock.name=Spectral Block
tile.BloodMagic.phantomBlock.name=Phantom Block
tile.BloodMagic.teleposer.name=Teleposer
tile.BloodMagic.soulforge.name=Soul Forge
# Tooltips
tooltip.BloodMagic.orb.desc=Stores raw Life Essence

View file

@ -0,0 +1,9 @@
{
"parent": "bloodmagic:block/sub/BlockSoulForge",
"textures": {
"base": "minecraft:blocks/iron_block",
"base_bottom": "minecraft:blocks/gold_block",
"glass": "minecraft:blocks/glass",
"attachment": "minecraft:blocks/stone"
}
}

View file

@ -0,0 +1,160 @@
{
"textures": {
"particle": "#base"
},
"elements": [
{
"from": [ 2, 0, 2 ],
"to": [ 6, 3, 6 ],
"faces": {
"down": { "uv": [ 3, 0, 4.5, 1.5 ], "texture": "#base" },
"up": { "uv": [ 1.5, 0, 3, 1.5 ], "texture": "#base" },
"north": { "uv": [ 1.5, 1.5, 3, 3 ], "texture": "#base" },
"south": { "uv": [ 4.5, 1.5, 6, 3 ], "texture": "#base" },
"west": { "uv": [ 3, 1.5, 4.5, 3 ], "texture": "#base" },
"east": { "uv": [ 0, 1.5, 1.5, 3 ], "texture": "#base" }
},
"__comment": "These are the feet of the model"
},
{
"from": [ 10, 0, 10 ],
"to": [ 14, 3, 14 ],
"faces": {
"down": { "uv": [ 3, 0, 4.5, 1.5 ], "texture": "#base" },
"up": { "uv": [ 1.5, 0, 3, 1.5 ], "texture": "#base" },
"north": { "uv": [ 1.5, 1.5, 3, 3 ], "texture": "#base" },
"south": { "uv": [ 4.5, 1.5, 6, 3 ], "texture": "#base" },
"west": { "uv": [ 3, 1.5, 4.5, 3 ], "texture": "#base" },
"east": { "uv": [ 0, 1.5, 1.5, 3 ], "texture": "#base" }
}
},
{
"from": [ 2, 0, 10 ],
"to": [ 6, 3, 14 ],
"faces": {
"down": { "uv": [ 3, 0, 4.5, 1.5 ], "texture": "#base" },
"up": { "uv": [ 1.5, 0, 3, 1.5 ], "texture": "#base" },
"north": { "uv": [ 1.5, 1.5, 3, 3 ], "texture": "#base" },
"south": { "uv": [ 4.5, 1.5, 6, 3 ], "texture": "#base" },
"west": { "uv": [ 3, 1.5, 4.5, 3 ], "texture": "#base" },
"east": { "uv": [ 0, 1.5, 1.5, 3 ], "texture": "#base" }
}
},
{
"from": [ 10, 0, 2 ],
"to": [ 14, 3, 6 ],
"faces": {
"down": { "uv": [ 3, 0, 4.5, 1.5 ], "texture": "#base" },
"up": { "uv": [ 1.5, 0, 3, 1.5 ], "texture": "#base" },
"north": { "uv": [ 1.5, 1.5, 3, 3 ], "texture": "#base" },
"south": { "uv": [ 4.5, 1.5, 6, 3 ], "texture": "#base" },
"west": { "uv": [ 3, 1.5, 4.5, 3 ], "texture": "#base" },
"east": { "uv": [ 0, 1.5, 1.5, 3 ], "texture": "#base" }
}
},
{
"from": [ 3, 3, 3 ],
"to": [ 13, 5, 13 ],
"faces": {
"down": { "uv": [ 3, 0, 4.5, 1.5 ], "texture": "#base" },
"up": { "uv": [ 1.5, 0, 3, 1.5 ], "texture": "#base" },
"north": { "uv": [ 1.5, 1.5, 3, 3 ], "texture": "#base" },
"south": { "uv": [ 4.5, 1.5, 6, 3 ], "texture": "#base" },
"west": { "uv": [ 3, 1.5, 4.5, 3 ], "texture": "#base" },
"east": { "uv": [ 0, 1.5, 1.5, 3 ], "texture": "#base" }
},
"__comment": "Base of the model"
},
{
"from": [ 1, 5, 1 ],
"to": [ 15, 8, 15 ],
"faces": {
"down": { "uv": [ 3, 0, 4.5, 1.5 ], "texture": "#base" },
"up": { "uv": [ 1.5, 0, 3, 1.5 ], "texture": "#base" },
"north": { "uv": [ 1.5, 1.5, 3, 3 ], "texture": "#base" },
"south": { "uv": [ 4.5, 1.5, 6, 3 ], "texture": "#base" },
"west": { "uv": [ 3, 1.5, 4.5, 3 ], "texture": "#base" },
"east": { "uv": [ 0, 1.5, 1.5, 3 ], "texture": "#base" }
},
"__comment": "Base of the model"
},
{
"from": [ 0, 8, 0 ],
"to": [ 16, 10, 16 ],
"faces": {
"down": { "uv": [ 3, 0, 4.5, 1.5 ], "texture": "#base" },
"up": { "uv": [ 1.5, 0, 3, 1.5 ], "texture": "#base" },
"north": { "uv": [ 1.5, 1.5, 3, 3 ], "texture": "#base" },
"south": { "uv": [ 4.5, 1.5, 6, 3 ], "texture": "#base" },
"west": { "uv": [ 3, 1.5, 4.5, 3 ], "texture": "#base" },
"east": { "uv": [ 0, 1.5, 1.5, 3 ], "texture": "#base" }
},
"__comment": "Base of the model"
},
{
"from": [ 0, 10, 0 ],
"to": [ 4, 12, 4 ],
"faces": {
"down": { "uv": [ 3, 0, 4.5, 1.5 ], "texture": "#base" },
"up": { "uv": [ 1.5, 0, 3, 1.5 ], "texture": "#base" },
"north": { "uv": [ 1.5, 1.5, 3, 3 ], "texture": "#base" },
"south": { "uv": [ 4.5, 1.5, 6, 3 ], "texture": "#base" },
"west": { "uv": [ 3, 1.5, 4.5, 3 ], "texture": "#base" },
"east": { "uv": [ 0, 1.5, 1.5, 3 ], "texture": "#base" }
},
"__comment": "Space for the item"
},
{
"from": [ 12, 10, 12 ],
"to": [ 16, 12, 16 ],
"faces": {
"down": { "uv": [ 3, 0, 4.5, 1.5 ], "texture": "#base" },
"up": { "uv": [ 1.5, 0, 3, 1.5 ], "texture": "#base" },
"north": { "uv": [ 1.5, 1.5, 3, 3 ], "texture": "#base" },
"south": { "uv": [ 4.5, 1.5, 6, 3 ], "texture": "#base" },
"west": { "uv": [ 3, 1.5, 4.5, 3 ], "texture": "#base" },
"east": { "uv": [ 0, 1.5, 1.5, 3 ], "texture": "#base" }
},
"__comment": "Space for the item"
},
{
"from": [ 0, 10, 12 ],
"to": [ 4, 12, 16 ],
"faces": {
"down": { "uv": [ 3, 0, 4.5, 1.5 ], "texture": "#base" },
"up": { "uv": [ 1.5, 0, 3, 1.5 ], "texture": "#base" },
"north": { "uv": [ 1.5, 1.5, 3, 3 ], "texture": "#base" },
"south": { "uv": [ 4.5, 1.5, 6, 3 ], "texture": "#base" },
"west": { "uv": [ 3, 1.5, 4.5, 3 ], "texture": "#base" },
"east": { "uv": [ 0, 1.5, 1.5, 3 ], "texture": "#base" }
},
"__comment": "Space for the item"
},
{
"from": [ 12, 10, 0 ],
"to": [ 16, 12, 4 ],
"faces": {
"down": { "uv": [ 3, 0, 4.5, 1.5 ], "texture": "#base" },
"up": { "uv": [ 1.5, 0, 3, 1.5 ], "texture": "#base" },
"north": { "uv": [ 1.5, 1.5, 3, 3 ], "texture": "#base" },
"south": { "uv": [ 4.5, 1.5, 6, 3 ], "texture": "#base" },
"west": { "uv": [ 3, 1.5, 4.5, 3 ], "texture": "#base" },
"east": { "uv": [ 0, 1.5, 1.5, 3 ], "texture": "#base" }
},
"__comment": "Space for the item"
},
{
"from": [ 4, 10, 4 ],
"to": [ 12, 11, 12 ],
"faces": {
"down": { "uv": [ 3, 0, 4.5, 1.5 ], "texture": "#base_bottom" },
"up": { "uv": [ 1.5, 0, 3, 1.5 ], "texture": "#base_bottom" },
"north": { "uv": [ 1.5, 1.5, 3, 3 ], "texture": "#base_bottom" },
"south": { "uv": [ 4.5, 1.5, 6, 3 ], "texture": "#base_bottom" },
"west": { "uv": [ 3, 1.5, 4.5, 3 ], "texture": "#base_bottom" },
"east": { "uv": [ 0, 1.5, 1.5, 3 ], "texture": "#base_bottom" }
},
"__comment": "Space for the item"
}
]
}

View file

@ -0,0 +1,13 @@
{
"parent": "bloodmagic:block/BlockSoulForge",
"display": {
"thirdperson": {
"rotation": [ 10, -45, 170 ],
"translation": [ 0, 1.5, -2.75 ],
"scale": [ 0.375, 0.375, 0.375 ]
}
}
}