Frozen Dungeon update
@ -1,2 +1,3 @@
|
||||
build
|
||||
.gradle
|
||||
.idea
|
||||
|
||||
@ -0,0 +1,5 @@
|
||||
Files src/main/java/com/zivilon/cinder_loe/CinderLoE.java and ../CinderLoE-Nex/src/main/java/com/zivilon/cinder_loe/CinderLoE.java differ
|
||||
|
||||
Files src/main/java/com/zivilon/cinder_loe/util/DurableItemCrafter.java and ../CinderLoE-Nex/src/main/java/com/zivilon/cinder_loe/util/DurableItemCrafter.java differ
|
||||
Files src/main/resources/assets/cinder_loe/lang/en_US.lang and ../CinderLoE-Nex/src/main/resources/assets/cinder_loe/lang/en_US.lang differ
|
||||
|
||||
@ -0,0 +1,47 @@
|
||||
package com.zivilon.cinder_loe.blocks;
|
||||
|
||||
import com.zivilon.cinder_loe.LoECreativeTabs;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockIce;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Random;
|
||||
|
||||
public class EnchantedIce extends BlockIce {
|
||||
public IIcon baseIcon;
|
||||
|
||||
public EnchantedIce() {
|
||||
super();
|
||||
this.setTickRandomly(false);
|
||||
this.setCreativeTab(LoECreativeTabs.tabBlockLoE);
|
||||
setBlockTextureName("minecraft:ice");
|
||||
setBlockName("lotr:enchantedIce");
|
||||
setLightLevel(0.25F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
this.baseIcon = iconRegister.registerIcon(this.getTextureName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return this.baseIcon;
|
||||
}
|
||||
|
||||
public IIcon getBaseIcon() {
|
||||
return this.baseIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick(World p_149674_1_, int p_149674_2_, int p_149674_3_, int p_149674_4_, Random p_149674_5_) {}
|
||||
}
|
||||
@ -0,0 +1,279 @@
|
||||
package com.zivilon.cinder_loe.blocks;
|
||||
|
||||
import com.zivilon.cinder_loe.CinderLoE;
|
||||
import com.zivilon.cinder_loe.LoECreativeTabs;
|
||||
import com.zivilon.cinder_loe.items.NimveilPart;
|
||||
import com.zivilon.cinder_loe.items.Nimveil;
|
||||
import com.zivilon.cinder_loe.recipe.ForgingRecipe;
|
||||
import com.zivilon.cinder_loe.recipe.ForgingRecipes;
|
||||
import com.zivilon.cinder_loe.tileentity.TileEntityForgingStation;
|
||||
|
||||
import lotr.common.item.LOTRItemHammer;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ForgingStation extends BlockContainer {
|
||||
|
||||
public ForgingStation() {
|
||||
super(Material.anvil);
|
||||
setHardness(10.0F);
|
||||
setResistance(10.0F);
|
||||
setBlockName("forging_station");
|
||||
setCreativeTab(LoECreativeTabs.tabDecoLoE);
|
||||
setBlockBounds(0, 0, 0, 1, 1, 1); // Set the block bounds to cover 1x1x1 for each individual part
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return -1; // Use custom renderer
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return new TileEntityForgingStation();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase placer, ItemStack itemStack) {
|
||||
int direction = MathHelper.floor_double((double)(placer.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
|
||||
|
||||
// Middle part (placed block)
|
||||
world.setBlockMetadataWithNotify(x, y, z, (direction << 2) | 1, 2);
|
||||
|
||||
// Right and right parts based on orientation
|
||||
if (direction == 0) { // South
|
||||
world.setBlock(x - 1, y, z, this, (direction << 2) | 0, 2); // Right part
|
||||
world.setBlock(x + 1, y, z, this, (direction << 2) | 2, 2); // Left part
|
||||
} else if (direction == 1) { // West
|
||||
world.setBlock(x, y, z - 1, this, (direction << 2) | 0, 2); // Right part
|
||||
world.setBlock(x, y, z + 1, this, (direction << 2) | 2, 2); // Left part
|
||||
} else if (direction == 2) { // North
|
||||
world.setBlock(x + 1, y, z, this, (direction << 2) | 0, 2); // Right part
|
||||
world.setBlock(x - 1, y, z, this, (direction << 2) | 2, 2); // Left part
|
||||
} else if (direction == 3) { // East
|
||||
world.setBlock(x, y, z + 1, this, (direction << 2) | 0, 2); // Right part
|
||||
world.setBlock(x, y, z - 1, this, (direction << 2) | 2, 2); // Left part
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
|
||||
int direction = meta >> 2;
|
||||
int part = meta & 3;
|
||||
|
||||
if (direction == 0) { // South
|
||||
if (part == 1) { // Middle
|
||||
world.setBlockToAir(x - 1, y, z); // Right part
|
||||
world.setBlockToAir(x + 1, y, z); // Left part
|
||||
} else if (part == 0) { // Right
|
||||
world.setBlockToAir(x + 1, y, z); // Middle part
|
||||
world.setBlockToAir(x + 2, y, z); // Left part
|
||||
} else if (part == 2) { // Left
|
||||
world.setBlockToAir(x - 1, y, z); // Middle part
|
||||
world.setBlockToAir(x - 2, y, z); // Right part
|
||||
}
|
||||
} else if (direction == 1) { // West
|
||||
if (part == 1) { // Middle
|
||||
world.setBlockToAir(x, y, z - 1); // Right part
|
||||
world.setBlockToAir(x, y, z + 1); // Left part
|
||||
} else if (part == 0) { // Right
|
||||
world.setBlockToAir(x, y, z + 1); // Middle part
|
||||
world.setBlockToAir(x, y, z + 2); // Left part
|
||||
} else if (part == 2) { // Left
|
||||
world.setBlockToAir(x, y, z - 1); // Middle part
|
||||
world.setBlockToAir(x, y, z - 2); // Right part
|
||||
}
|
||||
} else if (direction == 2) { // North
|
||||
if (part == 1) { // Middle
|
||||
world.setBlockToAir(x + 1, y, z); // Right part
|
||||
world.setBlockToAir(x - 1, y, z); // Left part
|
||||
} else if (part == 0) { // Right
|
||||
world.setBlockToAir(x - 1, y, z); // Middle part
|
||||
world.setBlockToAir(x - 2, y, z); // Left part
|
||||
} else if (part == 2) { // Left
|
||||
world.setBlockToAir(x + 1, y, z); // Middle part
|
||||
world.setBlockToAir(x + 2, y, z); // Right part
|
||||
}
|
||||
} else if (direction == 3) { // East
|
||||
if (part == 1) { // Middle
|
||||
world.setBlockToAir(x, y, z + 1); // Right part
|
||||
world.setBlockToAir(x, y, z - 1); // Left part
|
||||
} else if (part == 0) { // Right
|
||||
world.setBlockToAir(x, y, z - 1); // Middle part
|
||||
world.setBlockToAir(x, y, z - 2); // Left part
|
||||
} else if (part == 2) { // Left
|
||||
world.setBlockToAir(x, y, z + 1); // Middle part
|
||||
world.setBlockToAir(x, y, z + 2); // Right part
|
||||
}
|
||||
}
|
||||
|
||||
super.breakBlock(world, x, y, z, block, meta);
|
||||
}
|
||||
|
||||
public TileEntityForgingStation getCentralTileEntity(World world, int x, int y, int z) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
int direction = meta >> 2; // Extract the direction
|
||||
int part = meta & 3; // Extract the part (0, 1, 2)
|
||||
|
||||
int centralX = x, centralZ = z;
|
||||
|
||||
switch (direction) {
|
||||
case 0: // South
|
||||
if (part == 0) {
|
||||
centralX = x + 1; // Right part, middle is to the left
|
||||
} else if (part == 2) {
|
||||
centralX = x - 1; // Left part, middle is to the right
|
||||
}
|
||||
break;
|
||||
case 1: // West
|
||||
if (part == 0) {
|
||||
centralZ = z + 1; // Right part, middle is to the front
|
||||
} else if (part == 2) {
|
||||
centralZ = z - 1; // Left part, middle is to the back
|
||||
}
|
||||
break;
|
||||
case 2: // North
|
||||
if (part == 0) {
|
||||
centralX = x - 1; // Right part, middle is to the right
|
||||
} else if (part == 2) {
|
||||
centralX = x + 1; // Left part, middle is to the left
|
||||
}
|
||||
break;
|
||||
case 3: // East
|
||||
if (part == 0) {
|
||||
centralZ = z - 1; // Right part, middle is to the back
|
||||
} else if (part == 2) {
|
||||
centralZ = z + 1; // Left part, middle is to the front
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
TileEntity tileEntity = world.getTileEntity(centralX, y, centralZ);
|
||||
return (tileEntity instanceof TileEntityForgingStation) ? (TileEntityForgingStation) tileEntity : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockClicked(World world, int x, int y, int z, EntityPlayer player) {
|
||||
ItemStack heldStack = player.getHeldItem();
|
||||
if (heldStack == null) return;
|
||||
|
||||
boolean isBlessedHammer = heldStack.getItem() == CinderLoE.aulendurHammer;
|
||||
boolean isRegularHammer = heldStack.getItem() instanceof LOTRItemHammer;
|
||||
|
||||
if (!isBlessedHammer && !isRegularHammer) return;
|
||||
|
||||
TileEntityForgingStation tileentity = getCentralTileEntity(world, x, y, z);
|
||||
if (tileentity == null) return;
|
||||
|
||||
ItemStack left = tileentity.getLeftItem();
|
||||
ItemStack middle = tileentity.getMiddleItem();
|
||||
ItemStack right = tileentity.getRightItem();
|
||||
|
||||
// Iterate through available recipes and find a match
|
||||
for (ForgingRecipe recipe : ForgingRecipes.getAllRecipes()) {
|
||||
|
||||
if (recipe.matches(left, middle, right, isBlessedHammer)) {
|
||||
// Clear the inputs if the recipe matches
|
||||
tileentity.setLeftItem(null);
|
||||
tileentity.setRightItem(null);
|
||||
tileentity.setMiddleItem(recipe.getOutput());
|
||||
|
||||
// Damage the hammer by 1
|
||||
if (heldStack.attemptDamageItem(1, player.getRNG())) {
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
|
||||
} else {
|
||||
player.inventory.markDirty();
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
if (!world.isRemote) {
|
||||
TileEntityForgingStation tileentity = getCentralTileEntity(world, x, y, z);
|
||||
if (tileentity == null) return true;
|
||||
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
int part = meta & 3;
|
||||
|
||||
ItemStack stack = null;
|
||||
if (part == 0) stack = tileentity.getRightItem();
|
||||
else if (part == 1) stack = tileentity.getMiddleItem();
|
||||
else if (part == 2) stack = tileentity.getLeftItem();
|
||||
|
||||
if (stack != null) {
|
||||
// Try to pick up the item
|
||||
boolean hasSpace = player.inventory.addItemStackToInventory(stack);
|
||||
if (hasSpace) {
|
||||
if (part == 0) tileentity.setRightItem(null);
|
||||
else if (part == 1) tileentity.setMiddleItem(null);
|
||||
else if (part == 2) tileentity.setLeftItem(null);
|
||||
|
||||
if (player instanceof EntityPlayerMP) {
|
||||
((EntityPlayerMP) player).sendContainerToPlayer(player.inventoryContainer);
|
||||
}
|
||||
} else {
|
||||
player.addChatMessage(new ChatComponentText("You need more inventory space"));
|
||||
}
|
||||
} else {
|
||||
// Try to place an item
|
||||
ItemStack heldStack = player.getHeldItem();
|
||||
if (heldStack == null) return true;
|
||||
|
||||
boolean itemPlaced = false;
|
||||
|
||||
// Check all recipes to see if the held item matches any input slot
|
||||
for (ForgingRecipe recipe : ForgingRecipes.getAllRecipes()) {
|
||||
if (part == 0 && recipe.matchesItem(recipe.rightInput, heldStack)) {
|
||||
tileentity.setRightItem(heldStack.splitStack(1));
|
||||
itemPlaced = true;
|
||||
} else if (part == 1 && recipe.matchesItem(recipe.middleInput, heldStack)) {
|
||||
tileentity.setMiddleItem(heldStack.splitStack(1));
|
||||
itemPlaced = true;
|
||||
} else if (part == 2 && recipe.matchesItem(recipe.leftInput, heldStack)) {
|
||||
tileentity.setLeftItem(heldStack.splitStack(1));
|
||||
itemPlaced = true;
|
||||
}
|
||||
|
||||
if (itemPlaced) {
|
||||
tileentity.markDirty();
|
||||
if (heldStack.stackSize <= 0) {
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
|
||||
}
|
||||
player.inventory.markDirty();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!itemPlaced) {
|
||||
player.addChatMessage(new ChatComponentText("This item does not fit here."));
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,221 @@
|
||||
package com.zivilon.cinder_loe.blocks;
|
||||
|
||||
import com.zivilon.cinder_loe.CinderLoE;
|
||||
import com.zivilon.cinder_loe.LoECreativeTabs;
|
||||
import com.zivilon.cinder_loe.util.Utilities;
|
||||
import com.zivilon.cinder_loe.client.render.block.RenderIceCage;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class IceCage extends Block {
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon blockIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon emptyIcon;
|
||||
|
||||
public IceCage() {
|
||||
super(Material.ice);
|
||||
setHardness(2.0F);
|
||||
setResistance(1.0F);
|
||||
setStepSound(soundTypeGlass);
|
||||
setBlockTextureName(Utilities.toSnakeCase("lotr:iceCage"));
|
||||
setBlockName(Utilities.toSnakeCase("lotr:iceCage"));
|
||||
setLightOpacity(5); // Semi-transparent
|
||||
setCreativeTab(CreativeTabs.tabBlock);
|
||||
setCreativeTab(LoECreativeTabs.tabDecoLoE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return RenderIceCage.RENDER_ID; // Use the custom render type
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getRenderBlockPass() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
this.blockIcon = iconRegister.registerIcon("lotr:ice_cage");
|
||||
this.emptyIcon = iconRegister.registerIcon("lotr:invisible");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
/* if ((meta == 0 && side == 1) || (meta == 1 && side == 0)) {
|
||||
return this.blockIcon;
|
||||
}*/
|
||||
return this.blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
|
||||
return AxisAlignedBB.getBoundingBox(x, y, z, x + 1.0F, y + 1.0F, z + 1.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCollisionBoxesToList(World world, int x, int y, int z, AxisAlignedBB aabb, List list, Entity entity) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if (meta == 0) { // Lower part
|
||||
float thickness = 0.0625F; // 1/16th of a block thickness
|
||||
|
||||
AxisAlignedBB[] boundingBoxes = new AxisAlignedBB[]{
|
||||
AxisAlignedBB.getBoundingBox(x, y, z, x + thickness, y + 1.0F, z + 1.0F), // Left wall
|
||||
AxisAlignedBB.getBoundingBox(x + 1.0F - thickness, y, z, x + 1.0F, y + 1.0F, z + 1.0F), // Right wall
|
||||
AxisAlignedBB.getBoundingBox(x, y, z, x + 1.0F, y + 1.0F, z + thickness), // Front wall
|
||||
AxisAlignedBB.getBoundingBox(x, y, z + 1.0F - thickness, x + 1.0F, y + 1.0F, z + 1.0F) // Back wall
|
||||
};
|
||||
|
||||
for (AxisAlignedBB boundingBox : boundingBoxes) {
|
||||
if (boundingBox != null && aabb.intersectsWith(boundingBox)) {
|
||||
list.add(boundingBox);
|
||||
}
|
||||
}
|
||||
} else if (meta == 1) { // Upper partplayer.addPotionEffect(new PotionEffect(Potion.digSlowdown.id, 20, 2, true)); // Mining Fatigue III
|
||||
float thickness = 0.0625F; // 1/16th of a block thickness
|
||||
|
||||
AxisAlignedBB[] boundingBoxes = new AxisAlignedBB[]{
|
||||
AxisAlignedBB.getBoundingBox(x, y, z, x + thickness, y + 1.0F, z + 1.0F), // Left wall
|
||||
AxisAlignedBB.getBoundingBox(x + 1.0F - thickness, y, z, x + 1.0F, y + 1.0F, z + 1.0F), // Right wall
|
||||
AxisAlignedBB.getBoundingBox(x, y, z, x + 1.0F, y + 1.0F, z + thickness), // Front wall
|
||||
AxisAlignedBB.getBoundingBox(x, y, z + 1.0F - thickness, x + 1.0F, y + 1.0F, z + 1.0F), // Back wall
|
||||
AxisAlignedBB.getBoundingBox(x, y + 1.0F - thickness, z, x + 1.0F, y + 1.0F, z + 1.0F) // Ceiling
|
||||
};
|
||||
|
||||
for (AxisAlignedBB boundingBox : boundingBoxes) {
|
||||
if (boundingBox != null && aabb.intersectsWith(boundingBox)) {
|
||||
list.add(boundingBox);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) {
|
||||
if (entity instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) entity;
|
||||
AxisAlignedBB blockBounds = AxisAlignedBB.getBoundingBox(x, y, z, x + 1.0F, y + 1.0F, z + 1.0F);
|
||||
if (blockBounds != null && blockBounds.intersectsWith(player.boundingBox)) {
|
||||
player.motionX = 0;
|
||||
player.motionY = 0;
|
||||
player.motionZ = 0;
|
||||
player.addPotionEffect(new PotionEffect(Potion.digSlowdown.id, 20, 2, true)); // Mining Fatigue III
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick(World world, int x, int y, int z, Random random) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if (meta == 0) { // Lower part
|
||||
List<EntityPlayer> players = world.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(x, y, z, x + 1.0F, y + 2.0F, z + 1.0F));
|
||||
for (EntityPlayer player : players) {
|
||||
player.motionX = 0;
|
||||
player.motionY = 0;
|
||||
player.motionZ = 0;
|
||||
player.addPotionEffect(new PotionEffect(Potion.digSlowdown.id, 20, 2, true)); // Mining Fatigue III
|
||||
}
|
||||
}
|
||||
world.scheduleBlockUpdate(x, y, z, this, this.tickRate(world));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int tickRate(World world) {
|
||||
return 1; // Adjust the tick rate as needed
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlaceBlockAt(World world, int x, int y, int z) {
|
||||
return world.isAirBlock(x, y, z) && world.isAirBlock(x, y + 1, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase placer, ItemStack itemStack) {
|
||||
world.setBlockMetadataWithNotify(x, y, z, 0, 2); // Lower part
|
||||
world.setBlock(x, y + 1, z, this, 1, 2); // Upper part
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_) {
|
||||
if (player.getHeldItem() != null && player.getHeldItem().getItem() == CinderLoE.iceThawer) {
|
||||
if (!player.capabilities.isCreativeMode) {
|
||||
player.getHeldItem().stackSize--;
|
||||
if (player.getHeldItem().stackSize <= 0) {
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
|
||||
}
|
||||
}
|
||||
|
||||
world.func_147480_a(x, y, z, false);
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(World world, int x, int y, int z, Block neighbor) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if (meta == 0) { // Lower part
|
||||
if (world.getBlock(x, y + 1, z) != this) {
|
||||
world.setBlockToAir(x, y, z);
|
||||
}
|
||||
} else if (meta == 1) { // Upper part
|
||||
if (world.getBlock(x, y - 1, z) != this) {
|
||||
world.setBlockToAir(x, y, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
|
||||
if (meta == 0) { // Lower part
|
||||
if (world.getBlock(x, y + 1, z) == this) {
|
||||
world.setBlockToAir(x, y + 1, z);
|
||||
}
|
||||
} else if (meta == 1) { // Upper part
|
||||
if (world.getBlock(x, y - 1, z) == this) {
|
||||
world.setBlockToAir(x, y - 1, z);
|
||||
}
|
||||
}
|
||||
super.breakBlock(world, x, y, z, block, meta);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,71 @@
|
||||
package com.zivilon.cinder_loe.blocks;
|
||||
|
||||
import lotr.common.LOTRCreativeTabs;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.block.BlockPressurePlate;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import com.zivilon.cinder_loe.LoECreativeTabs;
|
||||
import com.zivilon.cinder_loe.LoEDamage;
|
||||
import com.zivilon.cinder_loe.tileentity.TileEntityShadowTile;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Random;
|
||||
|
||||
public class ShadowTile extends BlockPressurePlate {
|
||||
public int ticksLived = 0;
|
||||
|
||||
public ShadowTile() {
|
||||
super("lotr:shadow_tile", Material.rock, BlockPressurePlate.Sensitivity.players);
|
||||
this.setCreativeTab(LoECreativeTabs.tabMiscLoE);
|
||||
setBlockTextureName("lotr:shadow_tile");
|
||||
setBlockName("lotr:shadowTile");
|
||||
this.isBlockContainer = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity(int metadata) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createTileEntity(World world, int metadata) {
|
||||
return new TileEntityShadowTile();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockAdded(World world, int x, int y, int z) {
|
||||
super.onBlockAdded(world, x, y, z);
|
||||
|
||||
// Manually create and initialize the tile entity
|
||||
if (!world.isRemote) {
|
||||
world.setTileEntity(x, y, z, createTileEntity(world, world.getBlockMetadata(x, y, z)));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
|
||||
super.breakBlock(world, x, y, z, block, meta);
|
||||
world.removeTileEntity(x, y, z); // Clean up the tile entity
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) {
|
||||
if (entity instanceof EntityPlayer && !world.isRemote) {
|
||||
EntityPlayer player = (EntityPlayer)entity;
|
||||
player.attackEntityFrom(LoEDamage.shadow, 10.0F);
|
||||
player.addPotionEffect(new PotionEffect(15, 6*20, 0, false));
|
||||
world.setBlockToAir(x, y, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,72 @@
|
||||
package com.zivilon.cinder_loe.client.model.blocks;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
/**
|
||||
* forging_station - Shinare
|
||||
* Created using Tabula 4.1.1
|
||||
*/
|
||||
public class ModelForgingStation extends ModelBase {
|
||||
public ModelRenderer middle_block;
|
||||
public ModelRenderer left_block;
|
||||
public ModelRenderer right_block;
|
||||
public ModelRenderer left_leg;
|
||||
public ModelRenderer left_leg_top;
|
||||
public ModelRenderer left_leg_base;
|
||||
public ModelRenderer right_leg_front;
|
||||
public ModelRenderer right_leg_back;
|
||||
|
||||
public ModelForgingStation() {
|
||||
this.textureWidth = 128;
|
||||
this.textureHeight = 64;
|
||||
this.right_leg_back = new ModelRenderer(this, 0, 0);
|
||||
this.right_leg_back.setRotationPoint(4.0F, 10.0F, 0.0F);
|
||||
this.right_leg_back.addBox(0.0F, 0.0F, -2.0F, 2, 2, 16, 0.0F);
|
||||
this.setRotateAngle(right_leg_back, 0.7853981633974483F, 0.0F, 0.0F);
|
||||
this.left_leg = new ModelRenderer(this, 0, 32);
|
||||
this.left_leg.setRotationPoint(6.0F, 2.0F, 6.0F);
|
||||
this.left_leg.addBox(0.0F, 0.0F, 0.0F, 4, 14, 4, 0.0F);
|
||||
this.left_leg_top = new ModelRenderer(this, 0, 32);
|
||||
this.left_leg_top.setRotationPoint(-1.0F, 0.0F, -1.0F);
|
||||
this.left_leg_top.addBox(0.0F, 0.0F, 0.0F, 6, 2, 6, 0.0F);
|
||||
this.left_block = new ModelRenderer(this, 64, 32);
|
||||
this.left_block.setRotationPoint(16.0F, 0.0F, 0.0F);
|
||||
this.left_block.addBox(0.0F, 0.0F, 0.0F, 16, 2, 16, 0.0F);
|
||||
this.setRotateAngle(left_block, 0.0F, 3.141592653589793F, 0.0F);
|
||||
this.right_leg_front = new ModelRenderer(this, 0, 0);
|
||||
this.right_leg_front.setRotationPoint(11.0F, 10.0F, 0.0F);
|
||||
this.right_leg_front.addBox(0.0F, 0.0F, -2.0F, 2, 2, 16, 0.0F);
|
||||
this.setRotateAngle(right_leg_front, 0.7853981633974483F, 0.0F, 0.0F);
|
||||
this.left_leg_base = new ModelRenderer(this, 0, 32);
|
||||
this.left_leg_base.setRotationPoint(-1.0F, 12.0F, -1.0F);
|
||||
this.left_leg_base.addBox(0.0F, 0.0F, 0.0F, 6, 2, 6, 0.0F);
|
||||
this.right_block = new ModelRenderer(this, 64, 0);
|
||||
this.right_block.setRotationPoint(0.0F, 0.0F, 16.0F);
|
||||
this.right_block.addBox(0.0F, 0.0F, 0.0F, 16, 2, 16, 0.0F);
|
||||
this.middle_block = new ModelRenderer(this, 0, 0);
|
||||
this.middle_block.setRotationPoint(-8.0F, 8.0F, -8.0F);
|
||||
this.middle_block.addBox(0.0F, 0.0F, 0.0F, 16, 16, 16, 0.0F);
|
||||
this.right_block.addChild(this.right_leg_back);
|
||||
this.left_block.addChild(this.left_leg);
|
||||
this.left_leg.addChild(this.left_leg_top);
|
||||
this.middle_block.addChild(this.left_block);
|
||||
this.right_block.addChild(this.right_leg_front);
|
||||
this.left_leg.addChild(this.left_leg_base);
|
||||
this.middle_block.addChild(this.right_block);
|
||||
}
|
||||
|
||||
public void render(float f5) {
|
||||
this.middle_block.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;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,200 @@
|
||||
package com.zivilon.cinder_loe.client.model;
|
||||
|
||||
import lotr.common.LOTRConfig;
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.MathHelper;
|
||||
|
||||
public class ModelNex extends ModelBase {
|
||||
public ModelRenderer body;
|
||||
|
||||
public ModelRenderer neck;
|
||||
|
||||
public ModelRenderer head;
|
||||
|
||||
public ModelRenderer rightArm;
|
||||
|
||||
public ModelRenderer leftArm;
|
||||
|
||||
public ModelRenderer rightLeg;
|
||||
|
||||
public ModelRenderer leftLeg;
|
||||
|
||||
public ModelRenderer tail;
|
||||
|
||||
public ModelRenderer rightWing;
|
||||
|
||||
public ModelRenderer leftWing;
|
||||
|
||||
private boolean isFireModel;
|
||||
|
||||
public int heldItemRight;
|
||||
|
||||
public ModelNex() {
|
||||
this(0.0F);
|
||||
}
|
||||
|
||||
public ModelNex(float f) {
|
||||
this.textureWidth = 128;
|
||||
this.textureHeight = 256;
|
||||
this.body = new ModelRenderer(this, 0, 38);
|
||||
this.body.setRotationPoint(0.0F, 7.0F, 3.0F);
|
||||
this.body.addBox(-8.0F, -15.0F, -6.0F, 16, 18, 12, f);
|
||||
this.body.setTextureOffset(0, 207);
|
||||
this.body.addBox(-9.0F, -6.5F, -7.0F, 7, 1, 14, f);
|
||||
this.body.addBox(-9.0F, -9.5F, -7.0F, 7, 1, 14, f);
|
||||
this.body.addBox(-9.0F, -12.5F, -7.0F, 7, 1, 14, f);
|
||||
this.body.mirror = true;
|
||||
this.body.addBox(2.0F, -6.5F, -7.0F, 7, 1, 14, f);
|
||||
this.body.addBox(2.0F, -9.5F, -7.0F, 7, 1, 14, f);
|
||||
this.body.addBox(2.0F, -12.5F, -7.0F, 7, 1, 14, f);
|
||||
this.body.mirror = false;
|
||||
this.body.setTextureOffset(0, 0).addBox(-9.0F, -29.0F, -7.0F, 18, 14, 15, f);
|
||||
this.body.setTextureOffset(81, 163).addBox(-2.0F, -21.0F, 5.5F, 4, 25, 2, f);
|
||||
this.neck = new ModelRenderer(this, 76, 0);
|
||||
this.neck.setRotationPoint(0.0F, -25.0F, -3.0F);
|
||||
this.neck.addBox(-6.0F, -5.0F, -10.0F, 12, 12, 14, f);
|
||||
this.body.addChild(this.neck);
|
||||
this.head = new ModelRenderer(this, 92, 48);
|
||||
this.head.setRotationPoint(0.0F, 0.0F, -10.0F);
|
||||
this.head.addBox(-4.0F, -6.0F, -6.0F, 8, 10, 7, f);
|
||||
this.head.setTextureOffset(57, 58).addBox(-6.0F, -7.0F, -4.0F, 12, 4, 4, f);
|
||||
this.head.rotateAngleX = (float)Math.toRadians(10.0D);
|
||||
this.neck.addChild(this.head);
|
||||
ModelRenderer rightHorn1 = new ModelRenderer(this, 57, 47);
|
||||
rightHorn1.setRotationPoint(-6.0F, -5.0F, -2.0F);
|
||||
rightHorn1.addBox(-7.0F, -1.5F, -1.5F, 8, 3, 3, f);
|
||||
rightHorn1.rotateAngleY = (float)Math.toRadians(-35.0D);
|
||||
this.head.addChild(rightHorn1);
|
||||
ModelRenderer rightHorn2 = new ModelRenderer(this, 57, 35);
|
||||
rightHorn2.setRotationPoint(-7.0F, 0.0F, 0.0F);
|
||||
rightHorn2.addBox(-1.0F, -1.0F, -6.0F, 2, 2, 6, f);
|
||||
rightHorn2.rotateAngleY = (float)Math.toRadians(45.0D);
|
||||
rightHorn1.addChild(rightHorn2);
|
||||
ModelRenderer leftHorn1 = new ModelRenderer(this, 57, 47);
|
||||
leftHorn1.setRotationPoint(6.0F, -5.0F, -2.0F);
|
||||
leftHorn1.mirror = true;
|
||||
leftHorn1.addBox(-1.0F, -1.5F, -1.5F, 8, 3, 3, f);
|
||||
leftHorn1.rotateAngleY = (float)Math.toRadians(35.0D);
|
||||
this.head.addChild(leftHorn1);
|
||||
ModelRenderer leftHorn2 = new ModelRenderer(this, 57, 35);
|
||||
leftHorn2.setRotationPoint(7.0F, 0.0F, 0.0F);
|
||||
leftHorn2.mirror = true;
|
||||
leftHorn2.addBox(-1.0F, -1.0F, -6.0F, 2, 2, 6, f);
|
||||
leftHorn2.rotateAngleY = (float)Math.toRadians(-45.0D);
|
||||
leftHorn1.addChild(leftHorn2);
|
||||
this.rightArm = new ModelRenderer(this, 59, 136);
|
||||
this.rightArm.setRotationPoint(-9.0F, -25.0F, 0.0F);
|
||||
this.rightArm.addBox(-7.0F, -2.0F, -4.0F, 7, 10, 8, f);
|
||||
this.rightArm.setTextureOffset(93, 136).addBox(-6.5F, 8.0F, -3.0F, 6, 16, 6, f);
|
||||
this.body.addChild(this.rightArm);
|
||||
this.leftArm = new ModelRenderer(this, 59, 136);
|
||||
this.leftArm.setRotationPoint(9.0F, -25.0F, 0.0F);
|
||||
this.leftArm.mirror = true;
|
||||
this.leftArm.addBox(0.0F, -2.0F, -4.0F, 7, 10, 8, f);
|
||||
this.leftArm.setTextureOffset(93, 136).addBox(0.5F, 8.0F, -3.0F, 6, 16, 6, f);
|
||||
this.body.addChild(this.leftArm);
|
||||
this.rightLeg = new ModelRenderer(this, 46, 230);
|
||||
this.rightLeg.setRotationPoint(-6.0F, 6.0F, 3.0F);
|
||||
this.rightLeg.addBox(-7.0F, -2.0F, -4.0F, 7, 9, 8, f);
|
||||
this.rightLeg.setTextureOffset(46, 208).addBox(-6.5F, 2.0F, 4.0F, 6, 13, 5, f);
|
||||
ModelRenderer rightFoot = new ModelRenderer(this, 0, 243);
|
||||
rightFoot.setRotationPoint(0.0F, 0.0F, 0.0F);
|
||||
rightFoot.addBox(-7.0F, 15.0F, -6.0F, 7, 3, 9, f);
|
||||
rightFoot.rotateAngleX = (float)Math.toRadians(25.0D);
|
||||
this.rightLeg.addChild(rightFoot);
|
||||
this.leftLeg = new ModelRenderer(this, 46, 230);
|
||||
this.leftLeg.setRotationPoint(6.0F, 6.0F, 3.0F);
|
||||
this.leftLeg.mirror = true;
|
||||
this.leftLeg.addBox(0.0F, -2.0F, -4.0F, 7, 9, 8, f);
|
||||
this.leftLeg.setTextureOffset(46, 208).addBox(0.5F, 2.0F, 4.0F, 6, 13, 5, f);
|
||||
ModelRenderer leftFoot = new ModelRenderer(this, 0, 243);
|
||||
leftFoot.setRotationPoint(0.0F, 0.0F, 0.0F);
|
||||
leftFoot.mirror = true;
|
||||
leftFoot.addBox(0.0F, 15.0F, -6.0F, 7, 3, 9, f);
|
||||
leftFoot.rotateAngleX = (float)Math.toRadians(25.0D);
|
||||
this.leftLeg.addChild(leftFoot);
|
||||
this.tail = new ModelRenderer(this, 79, 200);
|
||||
this.tail.setRotationPoint(0.0F, -3.0F, 3.0F);
|
||||
this.tail.addBox(-3.5F, -3.0F, 2.0F, 7, 7, 10, f);
|
||||
this.tail.setTextureOffset(80, 225).addBox(-2.5F, -2.5F, 11.0F, 5, 5, 14, f);
|
||||
this.tail.setTextureOffset(96, 175).addBox(-1.5F, -2.0F, 24.0F, 3, 3, 12, f);
|
||||
this.body.addChild(this.tail);
|
||||
this.rightWing = new ModelRenderer(this, 0, 137);
|
||||
this.rightWing.setRotationPoint(-6.0F, -27.0F, 4.0F);
|
||||
this.rightWing.addBox(-1.5F, -1.5F, 0.0F, 3, 3, 25, f);
|
||||
this.rightWing.setTextureOffset(0, 167).addBox(-1.0F, -2.0F, 25.0F, 2, 24, 2, f);
|
||||
this.rightWing.setTextureOffset(0, 30).addBox(-0.5F, -7.0F, 25.5F, 1, 5, 1, f);
|
||||
this.rightWing.setTextureOffset(0, 69).addBox(0.0F, 0.0F, 0.0F, 0, 35, 25, f);
|
||||
this.body.addChild(this.rightWing);
|
||||
this.leftWing = new ModelRenderer(this, 0, 137);
|
||||
this.leftWing.setRotationPoint(6.0F, -27.0F, 4.0F);
|
||||
this.leftWing.mirror = true;
|
||||
this.leftWing.addBox(-1.5F, -1.5F, 0.0F, 3, 3, 25, f);
|
||||
this.leftWing.setTextureOffset(0, 167).addBox(-1.0F, -2.0F, 25.0F, 2, 24, 2, f);
|
||||
this.leftWing.setTextureOffset(0, 30).addBox(-0.5F, -7.0F, 25.5F, 1, 5, 1, f);
|
||||
this.leftWing.setTextureOffset(0, 69).addBox(0.0F, 0.0F, 0.0F, 0, 35, 25, f);
|
||||
this.body.addChild(this.leftWing);
|
||||
}
|
||||
|
||||
public void setFireModel() {
|
||||
this.isFireModel = true;
|
||||
}
|
||||
|
||||
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
|
||||
this.rightWing.showModel = true;
|
||||
setRotationAngles(f, f1, f2, f3, f4, f5, entity);
|
||||
this.body.render(f5);
|
||||
this.rightLeg.render(f5);
|
||||
this.leftLeg.render(f5);
|
||||
}
|
||||
|
||||
public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) {
|
||||
this.neck.rotateAngleX = (float)Math.toRadians(-10.0D);
|
||||
this.neck.rotateAngleY = 0.0F;
|
||||
this.neck.rotateAngleX += f4 / (float)Math.toDegrees(1.0D);
|
||||
this.neck.rotateAngleY += f3 / (float)Math.toDegrees(1.0D);
|
||||
this.body.rotateAngleX = (float)Math.toRadians(10.0D);
|
||||
this.body.rotateAngleX += MathHelper.cos(f2 * 0.03F) * 0.15F;
|
||||
this.rightArm.rotateAngleX = 0.0F;
|
||||
this.leftArm.rotateAngleX = 0.0F;
|
||||
this.rightArm.rotateAngleZ = 0.0F;
|
||||
this.leftArm.rotateAngleZ = 0.0F;
|
||||
this.rightArm.rotateAngleX += MathHelper.cos(f * 0.4F + 3.1415927F) * 0.8F * f1;
|
||||
this.leftArm.rotateAngleX += MathHelper.cos(f * 0.4F) * 0.8F * f1;
|
||||
this.rightArm.rotateAngleZ += MathHelper.cos(f2 * 0.09F) * 0.05F + 0.05F;
|
||||
this.leftArm.rotateAngleZ -= MathHelper.cos(f2 * 0.09F) * 0.05F + 0.05F;
|
||||
if (this.onGround > -9990.0F) {
|
||||
float f6 = this.onGround;
|
||||
this.rightArm.rotateAngleY += this.body.rotateAngleY;
|
||||
this.leftArm.rotateAngleY += this.body.rotateAngleY;
|
||||
this.leftArm.rotateAngleX += this.body.rotateAngleY;
|
||||
f6 = 1.0F - this.onGround;
|
||||
f6 *= f6;
|
||||
f6 *= f6;
|
||||
f6 = 1.0F - f6;
|
||||
float f7 = MathHelper.sin(f6 * 3.1415927F);
|
||||
float f8 = MathHelper.sin(this.onGround * 3.1415927F) * -(this.head.rotateAngleX - 0.7F) * 0.75F;
|
||||
this.rightArm.rotateAngleX = (float)(this.rightArm.rotateAngleX - f7 * 1.2D + f8);
|
||||
this.rightArm.rotateAngleY += this.body.rotateAngleY * 2.0F;
|
||||
this.rightArm.rotateAngleZ = MathHelper.sin(this.onGround * 3.1415927F) * -0.4F;
|
||||
}
|
||||
if (this.heldItemRight != 0)
|
||||
this.rightArm.rotateAngleX = this.rightArm.rotateAngleX * 0.5F - 0.31415927F * this.heldItemRight;
|
||||
this.rightLeg.rotateAngleX = (float)Math.toRadians(-25.0D);
|
||||
this.leftLeg.rotateAngleX = (float)Math.toRadians(-25.0D);
|
||||
this.rightLeg.rotateAngleX += MathHelper.sin(f * 0.4F) * 1.2F * f1;
|
||||
this.leftLeg.rotateAngleX += MathHelper.sin(f * 0.4F + 3.1415927F) * 1.2F * f1;
|
||||
this.rightWing.rotateAngleX = (float)Math.toRadians(40.0D);
|
||||
this.leftWing.rotateAngleX = (float)Math.toRadians(40.0D);
|
||||
this.rightWing.rotateAngleY = (float)Math.toRadians(-40.0D);
|
||||
this.leftWing.rotateAngleY = (float)Math.toRadians(40.0D);
|
||||
this.rightWing.rotateAngleY += MathHelper.cos(f2 * 0.04F) * 0.5F;
|
||||
this.leftWing.rotateAngleY -= MathHelper.cos(f2 * 0.04F) * 0.5F;
|
||||
this.tail.rotateAngleX = (float)Math.toRadians(-40.0D);
|
||||
this.tail.rotateAngleY = 0.0F;
|
||||
this.tail.rotateAngleY += MathHelper.cos(f2 * 0.05F) * 0.15F;
|
||||
this.tail.rotateAngleY += MathHelper.sin(f * 0.1F) * 0.6F * f1;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,69 @@
|
||||
package com.zivilon.cinder_loe.client.render.block;
|
||||
|
||||
import com.zivilon.cinder_loe.blocks.IceCage;
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class RenderIceCage implements ISimpleBlockRenderingHandler {
|
||||
|
||||
public static final int RENDER_ID = RenderingRegistry.getNextAvailableRenderId();
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
|
||||
if (modelID != RENDER_ID) return;
|
||||
|
||||
// Render inventory block as flat texture icon
|
||||
renderer.renderBlockAsItem(block, metadata, 1.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
|
||||
if (!(block instanceof IceCage) || modelId != RENDER_ID) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
float thickness = 0.0625F; // 1/16th of a block thickness
|
||||
|
||||
// Render the bounding boxes as defined in the block class
|
||||
if (meta == 0) { // Lower part
|
||||
renderer.setRenderBounds(0, 0, 0, thickness, 1, 1); // Left wall
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.setRenderBounds(1 - thickness, 0, 0, 1, 1, 1); // Right wall
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.setRenderBounds(0, 0, 0, 1, 1, thickness); // Front wall
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.setRenderBounds(0, 0, 1 - thickness, 1, 1, 1); // Back wall
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.setRenderBounds(0, 0, 0, 1, thickness, 1); // Floor
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
} else if (meta == 1) { // Upper part
|
||||
renderer.setRenderBounds(0, 0, 0, thickness, 1, 1); // Left wall
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.setRenderBounds(1 - thickness, 0, 0, 1, 1, 1); // Right wall
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.setRenderBounds(0, 0, 0, 1, 1, thickness); // Front wall
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.setRenderBounds(0, 0, 1 - thickness, 1, 1, 1); // Back wall
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.setRenderBounds(0, 1, 0, 1, 1 + thickness, 1); // Ceiling
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int modelId) {
|
||||
return false; // Do not render as 3D in inventory
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return RENDER_ID;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,136 @@
|
||||
package com.zivilon.cinder_loe.client.render.effect;
|
||||
|
||||
import com.zivilon.cinder_loe.entity.effect.NimveilLightningBolt;
|
||||
|
||||
import net.minecraft.client.renderer.entity.RenderLightningBolt;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.Random;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class RenderNimveilBolt extends RenderLightningBolt {
|
||||
|
||||
public void doRender(NimveilLightningBolt p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_) {
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
|
||||
double[] adouble = new double[8];
|
||||
double[] adouble1 = new double[8];
|
||||
double d3 = 0.0D;
|
||||
double d4 = 0.0D;
|
||||
Random random = new Random(p_76986_1_.boltVertex);
|
||||
|
||||
for (int i = 7; i >= 0; --i) {
|
||||
adouble[i] = d3;
|
||||
adouble1[i] = d4;
|
||||
d3 += (double)(random.nextInt(11) - 5);
|
||||
d4 += (double)(random.nextInt(11) - 5);
|
||||
}
|
||||
|
||||
for (int k1 = 0; k1 < 4; ++k1) {
|
||||
Random random1 = new Random(p_76986_1_.boltVertex);
|
||||
|
||||
for (int j = 0; j < 3; ++j) {
|
||||
int k = 7;
|
||||
int l = 0;
|
||||
|
||||
if (j > 0) {
|
||||
k = 7 - j;
|
||||
}
|
||||
|
||||
if (j > 0) {
|
||||
l = k - 2;
|
||||
}
|
||||
|
||||
double d5 = adouble[k] - d3;
|
||||
double d6 = adouble1[k] - d4;
|
||||
|
||||
for (int i1 = k; i1 >= l; --i1) {
|
||||
double d7 = d5;
|
||||
double d8 = d6;
|
||||
|
||||
if (j == 0) {
|
||||
d5 += (double)(random1.nextInt(11) - 5);
|
||||
d6 += (double)(random1.nextInt(11) - 5);
|
||||
} else {
|
||||
d5 += (double)(random1.nextInt(31) - 15);
|
||||
d6 += (double)(random1.nextInt(31) - 15);
|
||||
}
|
||||
|
||||
tessellator.startDrawing(5);
|
||||
float f2 = 0.5F;
|
||||
tessellator.setColorRGBA_F(0.9F * f2, 0.9F * f2, 1.0F * f2, 0.3F);
|
||||
double d9 = 0.1D + (double)k1 * 0.2D;
|
||||
|
||||
if (j == 0) {
|
||||
d9 *= (double)i1 * 0.1D + 1.0D;
|
||||
}
|
||||
|
||||
double d10 = 0.1D + (double)k1 * 0.2D;
|
||||
|
||||
if (j == 0) {
|
||||
d10 *= (double)(i1 - 1) * 0.1D + 1.0D;
|
||||
}
|
||||
|
||||
for (int j1 = 0; j1 < 5; ++j1) {
|
||||
double d11 = p_76986_2_ + 0.5D - d9;
|
||||
double d12 = p_76986_6_ + 0.5D - d9;
|
||||
|
||||
if (j1 == 1 || j1 == 2) {
|
||||
d11 += d9 * 2.0D;
|
||||
}
|
||||
|
||||
if (j1 == 2 || j1 == 3) {
|
||||
d12 += d9 * 2.0D;
|
||||
}
|
||||
|
||||
double d13 = p_76986_2_ + 0.5D - d10;
|
||||
double d14 = p_76986_6_ + 0.5D - d10;
|
||||
|
||||
if (j1 == 1 || j1 == 2) {
|
||||
d13 += d10 * 2.0D;
|
||||
}
|
||||
|
||||
if (j1 == 2 || j1 == 3) {
|
||||
d14 += d10 * 2.0D;
|
||||
}
|
||||
|
||||
tessellator.addVertex(d13 + d5, p_76986_4_ + (double)(i1 * 16), d14 + d6);
|
||||
tessellator.addVertex(d11 + d7, p_76986_4_ + (double)((i1 + 1) * 16), d12 + d8);
|
||||
}
|
||||
|
||||
tessellator.draw();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
|
||||
*/
|
||||
public ResourceLocation getEntityTexture(NimveilLightningBolt p_110775_1_) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
|
||||
*/
|
||||
public ResourceLocation getEntityTexture(Entity p_110775_1_) {
|
||||
return this.getEntityTexture((NimveilLightningBolt)p_110775_1_);
|
||||
}
|
||||
|
||||
public void doRender(Entity p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_)
|
||||
{
|
||||
this.doRender((NimveilLightningBolt)p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_);
|
||||
}
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
package com.zivilon.cinder_loe.client.render;
|
||||
package com.zivilon.cinder_loe.client.render.entity;
|
||||
|
||||
import com.zivilon.cinder_loe.entity.npc.good_human.BattleNun;
|
||||
import lotr.client.model.LOTRModelHuman;
|
||||
@ -1,4 +1,4 @@
|
||||
package com.zivilon.cinder_loe.client.render;
|
||||
package com.zivilon.cinder_loe.client.render.entity;
|
||||
|
||||
import lotr.client.render.entity.LOTRRenderSpiderBase;
|
||||
import lotr.client.render.entity.LOTRRenderUtumnoIceSpider;
|
||||
@ -1,4 +1,4 @@
|
||||
package com.zivilon.cinder_loe.client.render;
|
||||
package com.zivilon.cinder_loe.client.render.entity;
|
||||
|
||||
import lotr.client.render.entity.LOTRRandomSkins;
|
||||
import lotr.common.entity.LOTRRandomSkinEntity;
|
||||
@ -1,4 +1,4 @@
|
||||
package com.zivilon.cinder_loe.client.render;
|
||||
package com.zivilon.cinder_loe.client.render.entity;
|
||||
|
||||
import com.zivilon.cinder_loe.entity.npc.radagast.FangornBear;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
package com.zivilon.cinder_loe.client.render;
|
||||
package com.zivilon.cinder_loe.client.render.entity;
|
||||
|
||||
import lotr.common.entity.LOTRRandomSkinEntity;
|
||||
import lotr.client.render.entity.LOTRRandomSkins;
|
||||
@ -1,4 +1,4 @@
|
||||
package com.zivilon.cinder_loe.client.render;
|
||||
package com.zivilon.cinder_loe.client.render.entity;
|
||||
|
||||
import lotr.client.model.LOTRModelBoar;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
package com.zivilon.cinder_loe.client.render;
|
||||
package com.zivilon.cinder_loe.client.render.entity;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.renderer.entity.RenderLiving;
|
||||
@ -1,4 +1,4 @@
|
||||
package com.zivilon.cinder_loe.client.render;
|
||||
package com.zivilon.cinder_loe.client.render.entity;
|
||||
|
||||
import lotr.client.model.LOTRModelHuman;
|
||||
import lotr.client.render.entity.LOTRRenderBiped;
|
||||
@ -1,4 +1,4 @@
|
||||
package com.zivilon.cinder_loe.client.render;
|
||||
package com.zivilon.cinder_loe.client.render.entity;
|
||||
|
||||
import com.zivilon.cinder_loe.entity.npc.evil_human.Limwaith;
|
||||
import lotr.client.render.entity.LOTRRandomSkins;
|
||||
@ -0,0 +1,136 @@
|
||||
package com.zivilon.cinder_loe.client.render.entity;
|
||||
|
||||
import com.zivilon.cinder_loe.client.model.ModelNex;
|
||||
import com.zivilon.cinder_loe.entity.npc.frozen_dungeon.Nex;
|
||||
import lotr.client.render.entity.LOTRRandomSkins;
|
||||
import lotr.common.entity.LOTRRandomSkinEntity;
|
||||
import lotr.common.entity.npc.LOTREntityBalrog;
|
||||
import lotr.client.render.entity.LOTRRandomSkins;
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.entity.RenderLiving;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class RenderNex extends RenderLiving {
|
||||
private static LOTRRandomSkins balrogSkins;
|
||||
|
||||
private static LOTRRandomSkins balrogSkinsBright;
|
||||
|
||||
private static final ResourceLocation fireTexture = new ResourceLocation("lotr:mob/balrog/fire.png");
|
||||
|
||||
private ModelNex balrogModel;
|
||||
|
||||
private ModelNex balrogModelBright;
|
||||
|
||||
private ModelNex fireModel;
|
||||
|
||||
public RenderNex() {
|
||||
super((ModelBase)new ModelNex(), 0.5F);
|
||||
this.balrogModel = (ModelNex)this.mainModel;
|
||||
this.balrogModelBright = new ModelNex(0.05F);
|
||||
this.fireModel = new ModelNex(0.0F);
|
||||
this.fireModel.setFireModel();
|
||||
balrogSkins = LOTRRandomSkins.loadSkinsList("lotr:mob/balrog/balrog");
|
||||
balrogSkinsBright = LOTRRandomSkins.loadSkinsList("lotr:mob/balrog/balrog_bright");
|
||||
}
|
||||
|
||||
protected ResourceLocation getEntityTexture(Entity entity) {
|
||||
return balrogSkins.getRandomSkin((LOTRRandomSkinEntity)entity);
|
||||
}
|
||||
|
||||
public void doRender(Entity entity, double d, double d1, double d2, float f, float f1) {
|
||||
Nex balrog = (Nex)entity;
|
||||
ItemStack heldItem = balrog.getHeldItem();
|
||||
this.fireModel.heldItemRight = (heldItem == null) ? 0 : 2;
|
||||
doRender((EntityLiving)balrog, d, d1, d2, f, f1);
|
||||
}
|
||||
|
||||
protected void preRenderCallback(EntityLivingBase entity, float f) {
|
||||
Nex balrog = (Nex)entity;
|
||||
float scale = 2.0F;
|
||||
GL11.glScalef(scale, scale, scale);
|
||||
}
|
||||
|
||||
private void setupFullBright() {
|
||||
int light = 15728880;
|
||||
int lx = light % 65536;
|
||||
int ly = light / 65536;
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lx / 1.0F, ly / 1.0F);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
protected int shouldRenderPass(EntityLivingBase entity, int pass, float f) {
|
||||
Nex balrog = (Nex)entity;
|
||||
if (pass == 1) {
|
||||
float alpha;
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240.0F, 240.0F);
|
||||
GL11.glMatrixMode(5890);
|
||||
GL11.glLoadIdentity();
|
||||
float f1 = balrog.ticksExisted + f;
|
||||
float f2 = f1 * 0.01F;
|
||||
float f3 = f1 * 0.01F;
|
||||
GL11.glTranslatef(f2, f3, 0.0F);
|
||||
GL11.glMatrixMode(5888);
|
||||
GL11.glAlphaFunc(516, 0.01F);
|
||||
GL11.glEnable(3042);
|
||||
GL11.glBlendFunc(1, 1);
|
||||
alpha = 0.3F + MathHelper.sin(f1 * 0.05F) * 0.15F;
|
||||
GL11.glColor4f(alpha, alpha, alpha, 1.0F);
|
||||
GL11.glDisable(2896);
|
||||
GL11.glDepthMask(false);
|
||||
setRenderPassModel((ModelBase)this.fireModel);
|
||||
bindTexture(fireTexture);
|
||||
return 1;
|
||||
}
|
||||
if (pass == 2) {
|
||||
GL11.glMatrixMode(5890);
|
||||
GL11.glLoadIdentity();
|
||||
GL11.glMatrixMode(5888);
|
||||
GL11.glAlphaFunc(516, 0.1F);
|
||||
GL11.glDisable(3042);
|
||||
GL11.glEnable(2896);
|
||||
GL11.glDepthMask(true);
|
||||
GL11.glDisable(2896);
|
||||
setupFullBright();
|
||||
setRenderPassModel((ModelBase)this.balrogModelBright);
|
||||
bindTexture(balrogSkinsBright.getRandomSkin((LOTRRandomSkinEntity)balrog));
|
||||
GL11.glEnable(3042);
|
||||
GL11.glBlendFunc(770, 771);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
return 1;
|
||||
}
|
||||
if (pass == 3) {
|
||||
GL11.glEnable(2896);
|
||||
GL11.glDisable(3042);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
protected void renderEquippedItems(EntityLivingBase entity, float f) {
|
||||
GL11.glColor3f(1.0F, 1.0F, 1.0F);
|
||||
ItemStack heldItem = entity.getHeldItem();
|
||||
if (heldItem != null) {
|
||||
GL11.glPushMatrix();
|
||||
this.balrogModel.body.postRender(0.0625F);
|
||||
this.balrogModel.rightArm.postRender(0.0625F);
|
||||
GL11.glTranslatef(-0.25F, 1.5F, -0.125F);
|
||||
float scale = 1.25F;
|
||||
GL11.glScalef(scale, -scale, scale);
|
||||
GL11.glRotatef(-100.0F, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
|
||||
this.renderManager.itemRenderer.renderItem(entity, heldItem, 0);
|
||||
if (heldItem.getItem().requiresMultipleRenderPasses())
|
||||
for (int x = 1; x < heldItem.getItem().getRenderPasses(heldItem.getItemDamage()); x++)
|
||||
this.renderManager.itemRenderer.renderItem(entity, heldItem, x);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,50 @@
|
||||
package com.zivilon.cinder_loe.client.render.entity;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.client.renderer.entity.Render;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.zivilon.cinder_loe.entity.npc.frozen_dungeon.NexCloud;
|
||||
|
||||
public class RenderNexCloud extends Render {
|
||||
|
||||
public static ResourceLocation GREEN_PIXEL_TEXTURE = new ResourceLocation("cinder_loe:mob/green.png");
|
||||
public ModelBase model = new ModelBase() {}; // Create an empty ModelBase instance
|
||||
public ModelRenderer cube;
|
||||
|
||||
public RenderNexCloud() {
|
||||
this.cube = new ModelRenderer(this.model, 0, 0);
|
||||
this.cube.addBox(-8F, -8F, -8F, 16, 16, 16); // Define a cube of 16x16x16 pixels
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(Entity entity) {
|
||||
return GREEN_PIXEL_TEXTURE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doRender(Entity entity, double x, double y, double z, float entityYaw, float partialTicks) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float) x, (float) y + entity.height / 2, (float) z);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GL11.glDisable(GL11.GL_CULL_FACE); // Disable face culling
|
||||
|
||||
this.bindEntityTexture(entity); // Bind the single-pixel texture
|
||||
|
||||
NexCloud nexCloud = (NexCloud) entity;
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, nexCloud.opacity); // Use the opacity from the entity
|
||||
|
||||
// Render the cube model
|
||||
GL11.glScalef(entity.width, entity.height, entity.width);
|
||||
this.cube.render(0.0625F); // Render the cube with a scaling factor
|
||||
|
||||
GL11.glEnable(GL11.GL_CULL_FACE); // Re-enable face culling
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,49 @@
|
||||
package com.zivilon.cinder_loe.client.render.entity;
|
||||
|
||||
import com.zivilon.cinder_loe.entity.npc.frozen_dungeon.*;
|
||||
|
||||
import lotr.client.model.LOTRModelHuman;
|
||||
import lotr.client.render.entity.LOTRRenderBiped;
|
||||
import net.minecraft.client.model.ModelBiped;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class RenderNexMiniboss extends LOTRRenderBiped {
|
||||
public static ResourceLocation SHADOW_TEXTURE = new ResourceLocation("cinder_loe:mob/nex/shadow.png");
|
||||
public static ResourceLocation FIRE_TEXTURE = new ResourceLocation("cinder_loe:mob/nex/fire.png");
|
||||
public static ResourceLocation ICE_TEXTURE = new ResourceLocation("cinder_loe:mob/nex/ice.png");
|
||||
public static ResourceLocation TOXIN_TEXTURE = new ResourceLocation("cinder_loe:mob/nex/toxin.png");
|
||||
|
||||
public RenderNexMiniboss() {
|
||||
super(new LOTRModelHuman(), 0.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(Entity entity) {
|
||||
if (entity instanceof NexToxin) {
|
||||
return TOXIN_TEXTURE;
|
||||
} else if (entity instanceof NexFire) {
|
||||
return FIRE_TEXTURE;
|
||||
} else if (entity instanceof NexIce) {
|
||||
return ICE_TEXTURE;
|
||||
} else {
|
||||
return SHADOW_TEXTURE;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void preRenderCallback(EntityLivingBase entity, float partialTickTime) {
|
||||
super.preRenderCallback(entity, partialTickTime);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.5F); // Apply 50% transparency
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderModel(EntityLivingBase entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor) {
|
||||
super.renderModel(entity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scaleFactor);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
}
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
package com.zivilon.cinder_loe.client.render;
|
||||
package com.zivilon.cinder_loe.client.render.entity;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelBiped;
|
||||
@ -1,4 +1,4 @@
|
||||
package com.zivilon.cinder_loe.client.render;
|
||||
package com.zivilon.cinder_loe.client.render.entity;
|
||||
|
||||
import lotr.client.model.LOTRModelBoar;
|
||||
import lotr.client.model.LOTRModelCrocodile;
|
||||
@ -1,4 +1,4 @@
|
||||
package com.zivilon.cinder_loe.client.render;
|
||||
package com.zivilon.cinder_loe.client.render.entity;
|
||||
|
||||
import lotr.client.model.LOTRModelHuman;
|
||||
import lotr.client.render.entity.LOTRRenderBiped;
|
||||
@ -1,4 +1,4 @@
|
||||
package com.zivilon.cinder_loe.client.render;
|
||||
package com.zivilon.cinder_loe.client.render.entity;
|
||||
|
||||
import lotr.client.model.LOTRModelMarshWraith;
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
@ -0,0 +1,59 @@
|
||||
package com.zivilon.cinder_loe.client.render.item;
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
|
||||
public class TrollClubRenderer implements IItemRenderer {
|
||||
|
||||
public static ResourceLocation texture = new ResourceLocation("lotr", "textures/items/troll_chieftain_club.png");
|
||||
|
||||
public ModelBase model;
|
||||
/* public ModelTrollChieftainClub model;
|
||||
|
||||
public TrollClubRenderer(ModelTrollChieftainClub model) {
|
||||
this.model = model;
|
||||
}*/
|
||||
public TrollClubRenderer() {
|
||||
this.model = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
|
||||
return type == ItemRenderType.EQUIPPED || type == ItemRenderType.EQUIPPED_FIRST_PERSON;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
|
||||
GL11.glPushMatrix();
|
||||
|
||||
// Position the model correctly
|
||||
if (type == ItemRenderType.EQUIPPED_FIRST_PERSON) {
|
||||
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
|
||||
} else {
|
||||
GL11.glTranslatef(0.7F, 0.4F, 0.5F);
|
||||
}
|
||||
|
||||
// Rotate and scale the model as needed
|
||||
GL11.glScalef(1.0F, 1.0F, 1.0F);
|
||||
|
||||
// Bind the texture
|
||||
RenderManager.instance.renderEngine.bindTexture(texture);
|
||||
|
||||
// Render the model
|
||||
model.render(null, 0, 0, 0, 0, 0, 0.0625F);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,113 @@
|
||||
package com.zivilon.cinder_loe.client.render.tileentity;
|
||||
|
||||
import com.zivilon.cinder_loe.client.model.blocks.ModelForgingStation;
|
||||
import com.zivilon.cinder_loe.tileentity.TileEntityForgingStation;
|
||||
import com.zivilon.cinder_loe.client.render.item.RenderHelper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.ItemRenderer;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
|
||||
public class TileEntityForgingStationRenderer extends TileEntitySpecialRenderer {
|
||||
public ModelForgingStation model = new ModelForgingStation();
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float partialTick) {
|
||||
|
||||
if (tileEntity instanceof TileEntityForgingStation) {
|
||||
TileEntityForgingStation tile = (TileEntityForgingStation) tileEntity;
|
||||
|
||||
// Get the metadata to determine if this is the middle part
|
||||
int meta = tile.getBlockMetadata();
|
||||
int direction = meta >> 2;
|
||||
int part = meta & 3;
|
||||
float rotation = 270F;
|
||||
if (part != 1) return;
|
||||
|
||||
rotation = direction * 90F - 90F;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
GL11.glTranslatef((float)x + 0.5F, (float)y + 1.5F, (float)z + 0.5F);
|
||||
GL11.glScalef(-1.0F, -1.0F, 1.0F);
|
||||
GL11.glRotatef(rotation, 0F, 1F, 0F); // Adjust rotation as needed
|
||||
bindTexture(new ResourceLocation("lotr:textures/blocks/forging_station.png"));
|
||||
this.model.render(0.0625F); // Render the model
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
GL11.glPopMatrix();
|
||||
|
||||
|
||||
// Render the items above each part of the Forging Station
|
||||
float offset = 0F;
|
||||
switch (direction) {
|
||||
case 1:
|
||||
case 3:
|
||||
offset -= 180F;
|
||||
break;
|
||||
}
|
||||
renderStoredItems(tile, x, y, z, direction * 90F + offset);
|
||||
}
|
||||
}
|
||||
|
||||
public void renderStoredItems(TileEntityForgingStation tile, double x, double y, double z, float rotation) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float) x + 0.5F, (float) y + 1.0F, (float) z + 0.5F); // Adjust the position
|
||||
GL11.glRotatef(rotation, 0F, 1F, 0F); // Rotate to match the block's orientation
|
||||
|
||||
ItemStack left = tile.getLeftItem();
|
||||
ItemStack middle = tile.getMiddleItem();
|
||||
ItemStack right = tile.getRightItem();
|
||||
|
||||
// Render left item
|
||||
if (left != null) {
|
||||
renderItemInWorld(left, 1.0, 0.0, 0.0);
|
||||
}
|
||||
|
||||
// Render middle item
|
||||
if (middle != null) {
|
||||
renderItemInWorld(middle, 0.0, 0.0, 0.0);
|
||||
}
|
||||
|
||||
// Render right item
|
||||
if (right != null) {
|
||||
renderItemInWorld(right, -1.0, 0.0, 0.0);
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
public void renderItemInWorld(ItemStack stack, double x, double y, double z) {
|
||||
if (stack != null) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x, y, z);
|
||||
GL11.glScalef(1.0F, 1.0F, 1.0F); // Adjust the item size
|
||||
|
||||
// Bind the item texture
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.locationItemsTexture);
|
||||
IIcon icon = stack.getIconIndex();
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
// Set up the item rendering parameters
|
||||
float minU = icon.getMinU();
|
||||
float maxU = icon.getMaxU();
|
||||
float minV = icon.getMinV();
|
||||
float maxV = icon.getMaxV();
|
||||
|
||||
// Render the item in 2D
|
||||
GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glTranslatef(-0.25F, -0.25F, 0.0F);
|
||||
GL11.glScalef(0.5F, 0.5F, 0.5F);
|
||||
|
||||
RenderHelper.customRenderItemIn2D(tessellator, maxU, minV, minU, maxV, icon.getIconWidth(), icon.getIconHeight(), 0.0625F, false);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,84 @@
|
||||
package com.zivilon.cinder_loe.entity.effect;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.effect.EntityWeatherEffect;
|
||||
import net.minecraft.entity.passive.EntityPig;
|
||||
import net.minecraft.entity.monster.EntityCreeper;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class NimveilLightningBolt extends EntityWeatherEffect {
|
||||
/** Declares which state the lightning bolt is in. Whether it's in the air, hit the ground, etc. */
|
||||
public int lightningState;
|
||||
/** A random long that is used to change the vertex of the lightning rendered in RenderLightningBolt */
|
||||
public long boltVertex;
|
||||
/** Determines the time before the NimveilLightningBolt is destroyed. It is a random integer decremented over time. */
|
||||
public int boltLivingTime;
|
||||
|
||||
public NimveilLightningBolt(World world, double x, double y, double z) {
|
||||
super(world);
|
||||
this.setLocationAndAngles(x, y, z, 0.0F, 0.0F);
|
||||
this.lightningState = 2;
|
||||
this.boltVertex = this.rand.nextLong();
|
||||
this.boltLivingTime = this.rand.nextInt(3) + 1;
|
||||
}
|
||||
public NimveilLightningBolt(World world) {
|
||||
this(world, 0, 0, 0);// Summon line of custom lightning bolts
|
||||
// Must not place fire or affect any non-EntityLivingBase targets
|
||||
// Probably the most work of all of these
|
||||
}
|
||||
|
||||
/**
|
||||
* Called to update the entity's position/logic.
|
||||
*/
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
|
||||
if (this.lightningState == 2) {
|
||||
this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "ambient.weather.thunder", 10000.0F, 0.8F + this.rand.nextFloat() * 0.2F);
|
||||
this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "random.explode", 2.0F, 0.5F + this.rand.nextFloat() * 0.2F);
|
||||
}
|
||||
|
||||
--this.lightningState;
|
||||
|
||||
if (this.lightningState < 0) {
|
||||
if (this.boltLivingTime == 0) {
|
||||
this.setDead();
|
||||
} else if (this.lightningState < -this.rand.nextInt(10)) {
|
||||
--this.boltLivingTime;
|
||||
this.lightningState = 1;
|
||||
this.boltVertex = this.rand.nextLong();
|
||||
}
|
||||
}
|
||||
|
||||
if (this.lightningState >= 0) {
|
||||
if (this.worldObj.isRemote) {
|
||||
this.worldObj.lastLightningBolt = 2;
|
||||
} else {
|
||||
double d0 = 3.0D;
|
||||
List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, AxisAlignedBB.getBoundingBox(this.posX - d0, this.posY - d0, this.posZ - d0, this.posX + d0, this.posY + 6.0D + d0, this.posZ + d0));
|
||||
list.removeIf(entity -> !(entity instanceof EntityLivingBase));
|
||||
list.removeIf(entity -> (entity instanceof EntityPig));
|
||||
list.removeIf(entity -> (entity instanceof EntityCreeper));
|
||||
|
||||
for (int l = 0; l < list.size(); ++l) {
|
||||
Entity entity = (Entity)list.get(l);
|
||||
if (entity.isImmuneToFire() == false) {
|
||||
entity.attackEntityFrom(DamageSource.inFire, 20.0F);
|
||||
entity.setFire(8);
|
||||
}
|
||||
System.out.println("Striking " + entity.getCommandSenderName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void entityInit() {}
|
||||
public void readEntityFromNBT(NBTTagCompound p_70037_1_) {}
|
||||
public void writeEntityToNBT(NBTTagCompound p_70014_1_) {}
|
||||
}
|
||||
@ -0,0 +1,413 @@
|
||||
package com.zivilon.cinder_loe.entity.npc.frozen_dungeon;
|
||||
|
||||
import lotr.common.LOTRDamage;
|
||||
import lotr.common.entity.ai.LOTREntityAIAttackOnCollide;
|
||||
import lotr.common.entity.npc.LOTREntityNPC;
|
||||
import lotr.common.fac.LOTRFaction;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.EnumCreatureAttribute;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.entity.ai.EntityAIBase;
|
||||
import net.minecraft.entity.ai.EntityAILookIdle;
|
||||
import net.minecraft.entity.ai.EntityAIWander;
|
||||
import net.minecraft.entity.ai.EntityAIWatchClosest;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.EntityDamageSource;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.zivilon.cinder_loe.CinderLoE;
|
||||
import com.zivilon.cinder_loe.entity.ai.LoEPreciseAttackOnCollide;
|
||||
import com.zivilon.cinder_loe.util.BlockPos;
|
||||
import com.zivilon.cinder_loe.util.Utilities;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public class Nex extends LOTREntityNPC {
|
||||
public EntityAIBase normal_attack_ai;
|
||||
public EntityAIBase desperate_attack_ai;
|
||||
public static double normal_attack_damage = 30.0D;
|
||||
public static double desperate_attack_damage = 50.0D;
|
||||
public static int normal_attack_speed = 20;
|
||||
public static int desperate_attack_speed = 10;
|
||||
|
||||
public static List<WeakReference<Nex>> nex_instances = new ArrayList<>();
|
||||
|
||||
public AxisAlignedBB collisionBox;
|
||||
public AxisAlignedBB hitbox;
|
||||
public int phase = 0;
|
||||
public ChunkCoordinates currentFlightTarget;
|
||||
public EntityPlayer playerTarget;
|
||||
public int tickCounter = 0;
|
||||
|
||||
public Nex(World world) {
|
||||
super(world);
|
||||
setSize(1.5F, 3.0F);
|
||||
normal_attack_ai = (EntityAIBase) new LoEPreciseAttackOnCollide(this, 1.3D, 3.0D, normal_attack_speed, false);
|
||||
desperate_attack_ai = (EntityAIBase) new LoEPreciseAttackOnCollide(this, 1.3D, 3.0D, desperate_attack_speed, false);
|
||||
((EntityLiving) this).tasks.addTask(2, normal_attack_ai);
|
||||
((EntityLiving) this).tasks.addTask(2, (EntityAIBase) new EntityAIWander(this, 1.0D));
|
||||
((EntityLiving) this).tasks.addTask(3, (EntityAIBase) new EntityAILookIdle((EntityLiving) this));
|
||||
addTargetTasks(true);
|
||||
store_nex_instance();
|
||||
clear_shadow_tiles();
|
||||
}
|
||||
protected void entityInit() {
|
||||
super.entityInit();
|
||||
this.dataWatcher.addObject(31, Integer.valueOf(0));
|
||||
}
|
||||
|
||||
public void clear_shadow_tiles() {
|
||||
if (!this.worldObj.isRemote) {
|
||||
int xz_range = 100;
|
||||
int y_range = 10;
|
||||
int i = MathHelper.floor_double(this.posX);
|
||||
int j = MathHelper.floor_double(this.posY);
|
||||
int k = MathHelper.floor_double(this.posZ);
|
||||
for (int i1 = i - xz_range; i1 <= i + xz_range; i1++) {
|
||||
for (int j1 = j - y_range; j1 <= j + y_range; j1++) {
|
||||
for (int k1 = k - xz_range; k1 <= k + xz_range; k1++) {
|
||||
Block block = this.worldObj.getBlock(i1, j1, k1);
|
||||
if (block == CinderLoE.shadowTile)
|
||||
this.worldObj.setBlockToAir(i1, j1, k1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected void applyEntityAttributes() {
|
||||
super.applyEntityAttributes();
|
||||
getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(5000.0D);
|
||||
getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.2D);
|
||||
getEntityAttribute(SharedMonsterAttributes.knockbackResistance).setBaseValue(1.0D);
|
||||
getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(100.0D);
|
||||
getEntityAttribute(npcAttackDamage).setBaseValue(normal_attack_damage);
|
||||
}
|
||||
|
||||
public int getPhase() {
|
||||
phase = this.dataWatcher.getWatchableObjectInt(31);
|
||||
return phase;
|
||||
}
|
||||
public void setPhase(int i) {
|
||||
phase = i;
|
||||
this.dataWatcher.updateObject(31, Integer.valueOf(phase));
|
||||
}
|
||||
|
||||
public void next_phase() {
|
||||
Utilities.setInvulnerable((Entity)this, false);
|
||||
phase = getPhase();
|
||||
switch(phase) {
|
||||
case 0: // Move to Toxic phase
|
||||
clear_shadow_tiles();
|
||||
setPhase(phase + 1);
|
||||
return;
|
||||
case 1: // Move to Ice phase
|
||||
setPhase(phase + 1);
|
||||
return;
|
||||
case 2: // Move to Fire phase
|
||||
setPhase(phase + 1);
|
||||
return;
|
||||
case 3: // Move to Desperation phase
|
||||
setPhase(phase + 1);
|
||||
this.tasks.removeTask(normal_attack_ai);
|
||||
this.tasks.addTask(2, desperate_attack_ai);
|
||||
getEntityAttribute(npcAttackDamage).setBaseValue(desperate_attack_damage);
|
||||
return;
|
||||
default:
|
||||
System.out.println("[CinderLoE] Nex phase shift past phase 4???");
|
||||
}
|
||||
}
|
||||
|
||||
public LOTRFaction getFaction() {
|
||||
return LOTRFaction.UTUMNO;
|
||||
}
|
||||
|
||||
public void writeEntityToNBT(NBTTagCompound nbt) {
|
||||
super.writeEntityToNBT(nbt);
|
||||
nbt.setInteger("NexPhase", getPhase());
|
||||
}
|
||||
|
||||
public void readEntityFromNBT(NBTTagCompound nbt) {
|
||||
super.readEntityFromNBT(nbt);
|
||||
setPhase(nbt.getInteger("NexPhase"));
|
||||
}
|
||||
|
||||
public boolean canBePushed() {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void fall(float f) {}
|
||||
|
||||
protected void updateFallState(double d, boolean flag) {}
|
||||
|
||||
protected boolean canDespawn() {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Phase 0 - Shadow
|
||||
// Phase 1 - Toxin
|
||||
// Phase 2 - Ice
|
||||
// Phase 3 - Fire
|
||||
// Phase 4 - Desperation
|
||||
|
||||
public void release_miniboss() {
|
||||
Utilities.setInvulnerable((Entity)this, true);
|
||||
System.out.println("Set Nex invulnerable: " + this.isEntityInvulnerable());
|
||||
Class<?> phaseClass = null;
|
||||
switch (phase) {
|
||||
case 0:
|
||||
phaseClass = NexShadow.class;
|
||||
break;
|
||||
case 1:
|
||||
phaseClass = NexToxin.class;
|
||||
break;
|
||||
case 2:
|
||||
phaseClass = NexIce.class;
|
||||
break;
|
||||
case 3:
|
||||
phaseClass = NexFire.class;
|
||||
break;
|
||||
default:
|
||||
this.setDead();
|
||||
System.out.println("ERROR! Invalid Nex phase change: " + phase);
|
||||
return;
|
||||
}
|
||||
|
||||
System.out.println("Miniboss class: " + phaseClass.getSimpleName());
|
||||
List<Entity> entityList = this.worldObj.getEntitiesWithinAABB(NexMiniboss.class, this.boundingBox.expand(100, 10, 100));
|
||||
for (Entity entity : entityList) {
|
||||
if (phaseClass.isInstance(entity)) {
|
||||
System.out.println("Found correct miniboss class");
|
||||
NexMiniboss miniboss = (NexMiniboss) entity;
|
||||
miniboss.unbind();
|
||||
return;
|
||||
}
|
||||
}
|
||||
System.out.println("ERROR! Nex is missing miniboss of type " + phaseClass.getSimpleName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
tickCounter++;
|
||||
|
||||
switch (phase) {
|
||||
case 0:
|
||||
runShadowTasks();
|
||||
break;
|
||||
case 1:
|
||||
runToxinTasks();
|
||||
break;
|
||||
case 2:
|
||||
runIceTasks();
|
||||
break;
|
||||
case 3:
|
||||
runFireTasks();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void runShadowTasks() {
|
||||
if (tickCounter >= 100) { // 5 seconds (100 ticks)
|
||||
tickCounter = 0;
|
||||
|
||||
// Find air blocks with solid blocks underneath and place ShadowTile
|
||||
placeShadowTiles();
|
||||
}
|
||||
}
|
||||
public void runToxinTasks() {
|
||||
if (tickCounter >= 200) {
|
||||
tickCounter = 0;
|
||||
spawnToxicCloud();
|
||||
}
|
||||
}
|
||||
public void runIceTasks() {}
|
||||
public void runFireTasks() {}
|
||||
|
||||
public List<BlockPos> getValidPositions() {
|
||||
int radius = 64; // Radius to search for valid blocks
|
||||
|
||||
List<BlockPos> validPositions = new ArrayList<>();
|
||||
|
||||
// Iterate over blocks in a specific area
|
||||
for (int x = -radius; x <= radius; x++) {
|
||||
for (int y = -4; y <= 4; y++) {
|
||||
for (int z = -radius; z <= radius; z++) {
|
||||
BlockPos pos = new BlockPos(MathHelper.floor_double(this.posX) + x, MathHelper.floor_double(this.posY) + y, MathHelper.floor_double(this.posZ) + z);
|
||||
BlockPos below = pos.down();
|
||||
|
||||
if (worldObj.isAirBlock(pos.x, pos.y, pos.z) && worldObj.getBlock(below.x, below.y, below.z).isOpaqueCube()) {
|
||||
validPositions.add(pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return validPositions;
|
||||
}
|
||||
|
||||
public void spawnToxicCloud() {
|
||||
if (this.worldObj.isRemote) return;
|
||||
int toxicCloudsToPlace = 4;
|
||||
if (countToxicClouds() >= toxicCloudsToPlace) return;
|
||||
|
||||
List<BlockPos> validPositions = getValidPositions();
|
||||
|
||||
// Place NexCloud in 2 random valid positions
|
||||
for (int i = 0; i < toxicCloudsToPlace && !validPositions.isEmpty(); i++) {
|
||||
int randomIndex = worldObj.rand.nextInt(validPositions.size());
|
||||
BlockPos pos = validPositions.remove(randomIndex);
|
||||
|
||||
NexCloud cloud = new NexCloud(this.worldObj);
|
||||
cloud.setPosition(pos.x + 0.5, pos.y + 1.5, pos.z + 0.5);
|
||||
this.worldObj.spawnEntityInWorld(cloud);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean attackEntityAsMob(Entity entity) {
|
||||
if (super.attackEntityAsMob(entity)) {
|
||||
if (entity instanceof EntityPlayerMP)
|
||||
LOTRDamage.doFrostDamage((EntityPlayerMP)entity);
|
||||
if (entity instanceof EntityLivingBase) {
|
||||
int difficulty = this.worldObj.difficultySetting.getDifficultyId();
|
||||
int duration = difficulty * (difficulty + 5) / 2;
|
||||
if (duration > 0)
|
||||
((EntityLivingBase)entity).addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, duration * 20, 0));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public int countToxicClouds() {
|
||||
List<NexCloud> clouds = worldObj.getEntitiesWithinAABB(NexCloud.class, this.boundingBox.expand(100.0, 10.0, 100.0));
|
||||
return clouds.size();
|
||||
}
|
||||
|
||||
public void placeShadowTiles() {
|
||||
if (this.worldObj.isRemote) return;
|
||||
int shadowTilesToPlace = 8; // Number of shadow tiles to place
|
||||
|
||||
List<BlockPos> validPositions = getValidPositions();
|
||||
|
||||
// Place ShadowTile in 4 random valid positions
|
||||
for (int i = 0; i < shadowTilesToPlace && !validPositions.isEmpty(); i++) {
|
||||
int randomIndex = worldObj.rand.nextInt(validPositions.size());
|
||||
BlockPos pos = validPositions.remove(randomIndex);
|
||||
worldObj.setBlock(pos.x, pos.y, pos.z, CinderLoE.shadowTile);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean attackEntityFrom(DamageSource source, float dmg) {
|
||||
super.attackEntityFrom(source, dmg);
|
||||
int current_phase = (int) (this.getHealth() + dmg) / 1000;
|
||||
int new_phase = (int) this.getHealth() / 1000;
|
||||
System.out.println("Damage received: " + dmg + "while at health " + this.getHealth());
|
||||
if (phase == 3) {
|
||||
if (source instanceof EntityDamageSource) {
|
||||
Entity attacker = ((EntityDamageSource)source).getEntity();
|
||||
if (Utilities.has_fire_weapon(attacker)) {
|
||||
attacker.attackEntityFrom(DamageSource.causeMobDamage(this), dmg);
|
||||
attacker.setFire(10);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (current_phase != new_phase && current_phase != 5) {
|
||||
System.out.println("New phase should occur. Current phase health: " + current_phase + " and new phase health: " + new_phase);
|
||||
if (phase != 4)
|
||||
release_miniboss();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
protected void dropFewItems(boolean flag, int i) {
|
||||
return;
|
||||
}
|
||||
|
||||
protected String getHurtSound() {
|
||||
return "lotr:wight.hurt";
|
||||
}
|
||||
|
||||
protected String getDeathSound() {
|
||||
return "lotr:wight.death";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void heal(float amount) {}
|
||||
|
||||
@Override
|
||||
public void attackEntityWithRangedAttack(EntityLivingBase target, float distanceFactor) {}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickedResult(MovingObjectPosition target) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Scripting data methods, VT hooks into these. See util.VT_additions
|
||||
public void store_nex_instance() {
|
||||
cleanup_instances();
|
||||
nex_instances.add(new WeakReference<>(this));
|
||||
}
|
||||
public static Nex get_nex_instance() {
|
||||
cleanup_instances();
|
||||
if (!nex_instances.isEmpty()) {
|
||||
return nex_instances.get(0).get();
|
||||
}
|
||||
return null; // or handle this scenario accordingly
|
||||
}
|
||||
public static int get_nex_phase() {
|
||||
Nex nex = get_nex_instance();
|
||||
if (nex == null) {
|
||||
return -404;
|
||||
}
|
||||
return nex.phase;
|
||||
}
|
||||
|
||||
public static int get_nex_health() {
|
||||
Nex nex = get_nex_instance();
|
||||
if (nex == null) {
|
||||
return -404;
|
||||
}
|
||||
return (int)nex.getHealth();
|
||||
}
|
||||
public static void cleanup_instances() {
|
||||
for (int i = nex_instances.size() - 1; i >= 0; i--) {
|
||||
WeakReference<Nex> weakRef = nex_instances.get(i);
|
||||
Nex listed_instance = weakRef.get();
|
||||
if (listed_instance == null || !listed_instance.isEntityAlive()) {
|
||||
nex_instances.remove(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean is_nex_fire_phase_nearby(EntityLivingBase entity) {
|
||||
List<Nex> entityList = entity.worldObj.getEntitiesWithinAABB(Nex.class, entity.boundingBox.expand(100, 10, 100));
|
||||
for (Nex nex : entityList) { // We don't actually need to iterate, checking the first object is enough
|
||||
if (nex.phase == 3) return true;
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,180 @@
|
||||
package com.zivilon.cinder_loe.entity.npc.frozen_dungeon;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.world.World;
|
||||
import lotr.common.entity.npc.LOTREntityNPC;
|
||||
import lotr.common.fac.LOTRFaction;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class NexCloud extends Entity {
|
||||
public int tickCounter = 0;
|
||||
public float opacity = 0.0F;
|
||||
public boolean unbound = false;
|
||||
|
||||
public NexCloud(World world) {
|
||||
super(world);
|
||||
this.setSize(5.0F, 3.0F); // Set the size of the cloud
|
||||
this.noClip = true; // Disable hitbox
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void entityInit() {
|
||||
this.dataWatcher.addObject(20, 0.0F); // Index 20, initial opacity
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void readEntityFromNBT(NBTTagCompound nbt) {
|
||||
// Load entity data from NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void writeEntityToNBT(NBTTagCompound nbt) {
|
||||
// Save entity data to NBT
|
||||
}
|
||||
|
||||
public void syncOpacityToClient() {
|
||||
this.dataWatcher.updateObject(20, this.opacity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
this.noClip = true;
|
||||
if (worldObj.isRemote) {
|
||||
this.opacity = this.dataWatcher.getWatchableObjectFloat(20);
|
||||
// Update the client's position to match the server's position
|
||||
this.setPosition(this.posX, this.posY, this.posZ);
|
||||
return;
|
||||
}
|
||||
syncOpacityToClient();
|
||||
tickCounter++;
|
||||
|
||||
if (tickCounter <= 100) {
|
||||
// Increase opacity from 0.0F to 0.5F over the first 100 ticks
|
||||
opacity = 0.5F * (tickCounter / 100.0F);
|
||||
} else if (tickCounter <= 200) {
|
||||
// Maintain opacity at 0.5F for the next 100 ticks
|
||||
opacity = 0.5F;
|
||||
}
|
||||
|
||||
if (unbound) {
|
||||
followNearestPlayer();
|
||||
// Apply the motion to the entity's position
|
||||
this.posX += this.motionX;
|
||||
this.posY += this.motionY;
|
||||
this.posZ += this.motionZ;
|
||||
|
||||
this.setPosition(this.posX, this.posY, this.posZ); // Update the entity's position
|
||||
}
|
||||
|
||||
if (tickCounter % 10 == 0) {
|
||||
if (tickCounter > 60 && tickCounter < 240)
|
||||
applyPoisonEffect();
|
||||
unbound = isMinibossUnbound();
|
||||
if (unbound && tickCounter > 100) {
|
||||
tickCounter = 100;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (unbound) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (tickCounter <= 300 && tickCounter > 200) {
|
||||
// Decrease opacity from 0.5F to 0.0F over the next 100 ticks
|
||||
opacity = 0.5F * ((300 - tickCounter) / 100.0F);
|
||||
return;
|
||||
}
|
||||
if (tickCounter > 300) {
|
||||
// Set the entity as dead after 300 ticks
|
||||
System.out.println("Setting cloud dead. Ticks: " + tickCounter + " and unbound state: " + unbound);
|
||||
this.setDead();
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void moveEntity(double x, double y, double z) {
|
||||
if (this.noClip) {
|
||||
this.setPosition(this.posX + x, this.posY + y, this.posZ + z);
|
||||
} else {
|
||||
super.moveEntity(x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public boolean isMinibossUnbound() {
|
||||
List<Entity> entities = worldObj.getEntitiesWithinAABB(Entity.class, this.boundingBox.expand(100.0, 10.0, 100.0));
|
||||
for (Entity entity : entities) {
|
||||
if (entity instanceof NexToxin) {
|
||||
NexToxin miniboss = (NexToxin) entity;
|
||||
// System.out.println("Found miniboss. Is unbound: " + !miniboss.bound);
|
||||
return !miniboss.bound;
|
||||
}
|
||||
}
|
||||
// System.out.println("Miniboss not found");
|
||||
return false;
|
||||
}
|
||||
|
||||
public void applyPoisonEffect() {
|
||||
List<Entity> entities = worldObj.getEntitiesWithinAABB(EntityLivingBase.class, this.boundingBox);
|
||||
for (Entity entity : entities) {
|
||||
if (entity != this && !(entity instanceof LOTREntityNPC && ((LOTREntityNPC) entity).getFaction() == LOTRFaction.UTUMNO)) {
|
||||
if (entity instanceof EntityLivingBase) {
|
||||
EntityLivingBase livingEntity = (EntityLivingBase) entity;
|
||||
livingEntity.attackEntityFrom(DamageSource.magic, 2.0F);
|
||||
livingEntity.addPotionEffect(new PotionEffect(Potion.poison.id, 200, 1)); // 10 seconds of poison (200 ticks)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getBoundingBox() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public void followNearestPlayer() {
|
||||
List<EntityPlayer> players = worldObj.getEntitiesWithinAABB(EntityPlayer.class, this.boundingBox.expand(100.0, 4.0, 100.0));
|
||||
if (!players.isEmpty()) {
|
||||
EntityPlayer nearestPlayer = players.get(0);
|
||||
double minDistance = this.getDistanceToEntity(nearestPlayer);
|
||||
for (EntityPlayer player : players) {
|
||||
double distance = this.getDistanceToEntity(player);
|
||||
if (distance < minDistance) {
|
||||
nearestPlayer = player;
|
||||
minDistance = distance;
|
||||
}
|
||||
}
|
||||
double speed = 0.01;
|
||||
this.motionX = (nearestPlayer.posX - this.posX) * speed;
|
||||
this.motionY = (nearestPlayer.posY - this.posY) * speed;
|
||||
this.motionZ = (nearestPlayer.posZ - this.posZ) * speed;
|
||||
} else {
|
||||
this.motionX = 0;
|
||||
this.motionY = 0;
|
||||
this.motionZ = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeCollidedWith() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBePushed() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,67 @@
|
||||
package com.zivilon.cinder_loe.entity.npc.frozen_dungeon;
|
||||
|
||||
import com.zivilon.cinder_loe.CinderLoE;
|
||||
import com.zivilon.cinder_loe.util.Utilities;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.World;
|
||||
import lotr.common.LOTRMod;
|
||||
import lotr.common.enchant.LOTREnchantmentHelper;
|
||||
import lotr.common.enchant.LOTREnchantment;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class NexFire extends NexMiniboss {
|
||||
public String entity_name = "§4Naira";
|
||||
|
||||
public NexFire(World world) {
|
||||
super(world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setupEquipment() {
|
||||
ItemStack weapon = new ItemStack(LOTRMod.hammerUtumno, 0);
|
||||
ItemStack boots = new ItemStack(CinderLoE.bootsNexFire, 0);
|
||||
ItemStack legs = new ItemStack(CinderLoE.legsNexFire, 0);
|
||||
ItemStack body = new ItemStack(CinderLoE.bodyNexFire, 0);
|
||||
ItemStack helmet = new ItemStack(CinderLoE.helmetNexFire, 0);
|
||||
Utilities.setAppliedRandomEnchants(weapon);
|
||||
Utilities.setLOTREnchant(weapon, LOTREnchantment.strong4);
|
||||
Utilities.setLOTREnchant(weapon, LOTREnchantment.strong4);
|
||||
Utilities.setLOTREnchant(weapon, LOTREnchantment.strong4);
|
||||
Utilities.setLOTREnchant(weapon, LOTREnchantment.strong2);
|
||||
Utilities.setLOTREnchant(weapon, LOTREnchantment.strong1);
|
||||
Utilities.setLOTREnchant(weapon, LOTREnchantment.meleeReach1);
|
||||
Utilities.setLOTREnchant(weapon, LOTREnchantment.meleeSpeed1);
|
||||
Utilities.setLOTREnchant(weapon, LOTREnchantment.fire);
|
||||
|
||||
this.npcItemsInv.setIdleItem(weapon);
|
||||
this.npcItemsInv.setMeleeWeapon(weapon);
|
||||
setCurrentItemOrArmor(0, weapon);
|
||||
setCurrentItemOrArmor(1, boots);
|
||||
setCurrentItemOrArmor(2, legs);
|
||||
setCurrentItemOrArmor(3, body);
|
||||
setCurrentItemOrArmor(4, helmet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNPCName() {
|
||||
return entity_name;
|
||||
}
|
||||
@Override
|
||||
public String getNPCFormattedName(String npcName, String entityName) {
|
||||
return entity_name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSpeechBank(EntityPlayer entityplayer) {
|
||||
return "nex/fire";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBoundUpdate(int x, int y, int z) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUnboundUpdate() {
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,68 @@
|
||||
package com.zivilon.cinder_loe.entity.npc.frozen_dungeon;
|
||||
|
||||
import com.zivilon.cinder_loe.CinderLoE;
|
||||
import com.zivilon.cinder_loe.util.Utilities;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.World;
|
||||
import lotr.common.LOTRMod;
|
||||
import lotr.common.enchant.LOTREnchantmentHelper;
|
||||
import lotr.common.enchant.LOTREnchantment;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
|
||||
public class NexIce extends NexMiniboss {
|
||||
public String entity_name = "§bNinquë";
|
||||
|
||||
public NexIce(World world) {
|
||||
super(world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setupEquipment() {
|
||||
ItemStack weapon = new ItemStack(LOTRMod.spearUtumno, 0);
|
||||
ItemStack boots = new ItemStack(CinderLoE.bootsNexIce, 0);
|
||||
ItemStack legs = new ItemStack(CinderLoE.legsNexIce, 0);
|
||||
ItemStack body = new ItemStack(CinderLoE.bodyNexIce, 0);
|
||||
ItemStack helmet = new ItemStack(CinderLoE.helmetNexIce, 0);
|
||||
Utilities.setAppliedRandomEnchants(weapon);
|
||||
Utilities.setLOTREnchant(weapon, LOTREnchantment.strong4);
|
||||
Utilities.setLOTREnchant(weapon, LOTREnchantment.strong4);
|
||||
Utilities.setLOTREnchant(weapon, LOTREnchantment.strong4);
|
||||
Utilities.setLOTREnchant(weapon, LOTREnchantment.strong3);
|
||||
Utilities.setLOTREnchant(weapon, LOTREnchantment.strong1);
|
||||
Utilities.setLOTREnchant(weapon, LOTREnchantment.meleeReach1);
|
||||
Utilities.setLOTREnchant(weapon, LOTREnchantment.meleeSpeed1);
|
||||
Utilities.setLOTREnchant(weapon, LOTREnchantment.chill);
|
||||
|
||||
this.npcItemsInv.setIdleItem(weapon);
|
||||
this.npcItemsInv.setMeleeWeapon(weapon);
|
||||
setCurrentItemOrArmor(0, weapon);
|
||||
setCurrentItemOrArmor(1, boots);
|
||||
setCurrentItemOrArmor(2, legs);
|
||||
setCurrentItemOrArmor(3, body);
|
||||
setCurrentItemOrArmor(4, helmet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNPCName() {
|
||||
return entity_name;
|
||||
}
|
||||
@Override
|
||||
public String getNPCFormattedName(String npcName, String entityName) {
|
||||
return entity_name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSpeechBank(EntityPlayer entityplayer) {
|
||||
return "nex/ice";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBoundUpdate(int x, int y, int z) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUnboundUpdate() {
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,151 @@
|
||||
package com.zivilon.cinder_loe.entity.npc.frozen_dungeon;
|
||||
|
||||
import com.zivilon.cinder_loe.CinderLoE;
|
||||
import com.zivilon.cinder_loe.util.Utilities;
|
||||
import com.zivilon.cinder_loe.entity.ai.LoEPreciseAttackOnCollide;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.ai.EntityAIBase;
|
||||
import net.minecraft.entity.ai.EntityAIWatchClosest;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import lotr.common.entity.npc.LOTREntityMan;
|
||||
import lotr.common.fac.LOTRFaction;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public abstract class NexMiniboss extends LOTREntityMan {
|
||||
public String entity_name = "UNDEFINED";
|
||||
public boolean bound = true;
|
||||
|
||||
public NexMiniboss(World world) {
|
||||
super(world);
|
||||
setSize(0.6F, 1.8F);
|
||||
((EntityLiving) this).tasks.addTask(2, (EntityAIBase) new LoEPreciseAttackOnCollide(this, 1.3D, 1.0D, 40, false));
|
||||
((EntityLiving) this).tasks.addTask(8, (EntityAIBase) new EntityAIWatchClosest((EntityLiving) this, Nex.class, 8.0F, 0.02F));
|
||||
addTargetTasks(true);
|
||||
setupEquipment();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void attackEntityWithRangedAttack(EntityLivingBase target, float distanceFactor) {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void applyEntityAttributes() {
|
||||
super.applyEntityAttributes();
|
||||
getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(200.0D);
|
||||
getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.225D);
|
||||
getEntityAttribute(SharedMonsterAttributes.knockbackResistance).setBaseValue(1.0D);
|
||||
getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(100.0D);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LOTRFaction getFaction() {
|
||||
return LOTRFaction.UTUMNO;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canDespawn() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNPCName() {
|
||||
return entity_name;
|
||||
}
|
||||
@Override
|
||||
public String getNPCFormattedName(String npcName, String entityName) {
|
||||
return entity_name;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dropFewItems(boolean flag, int i) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getCanSpawnHere() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSpeechBank(EntityPlayer entityplayer) {
|
||||
return "nex/undefined";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setupNPCName() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickedResult(MovingObjectPosition target) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDeath(DamageSource source) {
|
||||
List<Nex> entityList = this.worldObj.getEntitiesWithinAABB(Nex.class, this.boundingBox.expand(100, 10, 100));
|
||||
for (Nex nex : entityList) {
|
||||
nex.next_phase();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public void unbind() {
|
||||
System.out.println("Unbinding " + this.getClass().getSimpleName());
|
||||
|
||||
int x = MathHelper.floor_double(this.posX);
|
||||
int y = MathHelper.floor_double(this.posY);
|
||||
int z = MathHelper.floor_double(this.posZ);
|
||||
|
||||
Block blockAtFeet = this.worldObj.getBlock(x, y, z);
|
||||
Block blockAtHead = this.worldObj.getBlock(x, y + 1, z);
|
||||
if (blockAtFeet == CinderLoE.iceCage) {
|
||||
this.worldObj.setBlock(x, y, z, Blocks.air);
|
||||
}
|
||||
if (blockAtHead == CinderLoE.iceCage) {
|
||||
this.worldObj.setBlock(x, y, z, Blocks.air);
|
||||
}
|
||||
bound = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
checkInsideIceCage();
|
||||
}
|
||||
|
||||
public void checkInsideIceCage() {
|
||||
int x = MathHelper.floor_double(this.posX);
|
||||
int y = MathHelper.floor_double(this.posY);
|
||||
int z = MathHelper.floor_double(this.posZ);
|
||||
|
||||
|
||||
Block blockAtFeet = this.worldObj.getBlock(x, y, z);
|
||||
Block blockAtHead = this.worldObj.getBlock(x, y + 1, z);
|
||||
|
||||
if (blockAtFeet == CinderLoE.iceCage || blockAtHead == CinderLoE.iceCage) {
|
||||
onBoundUpdate(x, y, z);
|
||||
Utilities.setInvulnerable((Entity)this, true);
|
||||
// System.out.println("Nex Miniboss vulnerable: " + this.isEntityInvulnerable());
|
||||
} else {
|
||||
onUnboundUpdate();
|
||||
Utilities.setInvulnerable((Entity)this, false);
|
||||
// System.out.println("Nex Miniboss vulnerable: " + this.isEntityInvulnerable());
|
||||
}
|
||||
}
|
||||
|
||||
public abstract void onBoundUpdate(int x, int y, int z);
|
||||
public abstract void onUnboundUpdate();
|
||||
public abstract void setupEquipment();
|
||||
}
|
||||
@ -0,0 +1,85 @@
|
||||
package com.zivilon.cinder_loe.entity.npc.frozen_dungeon;
|
||||
|
||||
import com.zivilon.cinder_loe.CinderLoE;
|
||||
import com.zivilon.cinder_loe.util.Utilities;
|
||||
|
||||
import lotr.common.LOTRMod;
|
||||
import lotr.common.enchant.LOTREnchantmentHelper;
|
||||
import lotr.common.enchant.LOTREnchantment;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class NexShadow extends NexMiniboss {
|
||||
public String entity_name = "§7Fuinë";
|
||||
|
||||
public NexShadow(World world) {
|
||||
super(world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setupEquipment() {
|
||||
ItemStack weapon = new ItemStack(LOTRMod.swordUtumno, 0);
|
||||
ItemStack boots = new ItemStack(CinderLoE.bootsNexShadow, 0);
|
||||
ItemStack legs = new ItemStack(CinderLoE.legsNexShadow, 0);
|
||||
ItemStack body = new ItemStack(CinderLoE.bodyNexShadow, 0);
|
||||
ItemStack helmet = new ItemStack(CinderLoE.helmetNexShadow, 0);
|
||||
Utilities.setAppliedRandomEnchants(weapon);
|
||||
Utilities.setLOTREnchant(weapon, LOTREnchantment.strong4);
|
||||
Utilities.setLOTREnchant(weapon, LOTREnchantment.strong4);
|
||||
Utilities.setLOTREnchant(weapon, LOTREnchantment.strong4);
|
||||
Utilities.setLOTREnchant(weapon, LOTREnchantment.strong1);
|
||||
Utilities.setLOTREnchant(weapon, LOTREnchantment.meleeReach1);
|
||||
Utilities.setLOTREnchant(weapon, LOTREnchantment.meleeSpeed1);
|
||||
|
||||
this.npcItemsInv.setIdleItem(weapon);
|
||||
this.npcItemsInv.setMeleeWeapon(weapon);
|
||||
setCurrentItemOrArmor(0, weapon);
|
||||
setCurrentItemOrArmor(1, boots);
|
||||
setCurrentItemOrArmor(2, legs);
|
||||
setCurrentItemOrArmor(3, body);
|
||||
setCurrentItemOrArmor(4, helmet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNPCName() {
|
||||
return entity_name;
|
||||
}
|
||||
@Override
|
||||
public String getNPCFormattedName(String npcName, String entityName) {
|
||||
return entity_name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSpeechBank(EntityPlayer entityplayer) {
|
||||
return "nex/shadow";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBoundUpdate(int x, int y, int z) {
|
||||
this.motionX = 0;
|
||||
this.motionY = 0;
|
||||
this.motionZ = 0;
|
||||
this.setPosition(x + 0.5, y, z + 0.5);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUnboundUpdate() {
|
||||
List<EntityPlayer> players = this.worldObj.getEntitiesWithinAABB(EntityPlayer.class, this.boundingBox.expand(100.0D, 100.0D, 100.0D));
|
||||
|
||||
for (EntityPlayer player : players) {
|
||||
int playerLightLevel = this.worldObj.getBlockLightValue(MathHelper.floor_double(player.posX), MathHelper.floor_double(player.posY), MathHelper.floor_double(player.posZ));
|
||||
double playerDistanceY = player.posY - this.posY;
|
||||
|
||||
if (playerLightLevel < 4 && Math.abs(playerDistanceY) <= 4.0D) {
|
||||
player.addPotionEffect(new PotionEffect(Potion.blindness.id, 100)); // 5 seconds of blindness
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,73 @@
|
||||
package com.zivilon.cinder_loe.entity.npc.frozen_dungeon;
|
||||
|
||||
import com.zivilon.cinder_loe.CinderLoE;
|
||||
import com.zivilon.cinder_loe.util.Utilities;
|
||||
|
||||
import lotr.common.LOTRMod;
|
||||
import lotr.common.enchant.LOTREnchantmentHelper;
|
||||
import lotr.common.enchant.LOTREnchantment;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class NexToxin extends NexMiniboss {
|
||||
public String entity_name = "§2Hloirë";
|
||||
|
||||
public NexToxin(World world) {
|
||||
super(world);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void applyEntityAttributes() {
|
||||
super.applyEntityAttributes();
|
||||
getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(200.0D);
|
||||
getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.25D);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setupEquipment() {
|
||||
ItemStack weapon = new ItemStack(LOTRMod.daggerUtumnoPoisoned, 0);
|
||||
ItemStack boots = new ItemStack(CinderLoE.bootsNexToxin, 0);
|
||||
ItemStack legs = new ItemStack(CinderLoE.legsNexToxin, 0);
|
||||
ItemStack body = new ItemStack(CinderLoE.bodyNexToxin, 0);
|
||||
ItemStack helmet = new ItemStack(CinderLoE.helmetNexToxin, 0);
|
||||
Utilities.setAppliedRandomEnchants(weapon);
|
||||
Utilities.setLOTREnchant(weapon, LOTREnchantment.strong4);
|
||||
Utilities.setLOTREnchant(weapon, LOTREnchantment.strong4);
|
||||
Utilities.setLOTREnchant(weapon, LOTREnchantment.strong4);
|
||||
Utilities.setLOTREnchant(weapon, LOTREnchantment.strong1);
|
||||
Utilities.setLOTREnchant(weapon, LOTREnchantment.meleeReach1);
|
||||
Utilities.setLOTREnchant(weapon, LOTREnchantment.meleeSpeed1);
|
||||
|
||||
this.npcItemsInv.setIdleItem(weapon);
|
||||
this.npcItemsInv.setMeleeWeapon(weapon);
|
||||
setCurrentItemOrArmor(0, weapon);
|
||||
setCurrentItemOrArmor(1, boots);
|
||||
setCurrentItemOrArmor(2, legs);
|
||||
setCurrentItemOrArmor(3, body);
|
||||
setCurrentItemOrArmor(4, helmet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNPCName() {
|
||||
return entity_name;
|
||||
}
|
||||
@Override
|
||||
public String getNPCFormattedName(String npcName, String entityName) {
|
||||
return entity_name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSpeechBank(EntityPlayer entityplayer) {
|
||||
return "nex/toxin";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBoundUpdate(int x, int y, int z) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUnboundUpdate() {
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,26 @@
|
||||
package com.zivilon.cinder_loe.items;
|
||||
|
||||
import com.zivilon.cinder_loe.CinderLoE;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class AulendurHammer extends LoEHammer {
|
||||
public AulendurHammer() {
|
||||
super(CinderLoE.MATERIAL_NIMVEIL, CinderLoE.enchantedIce);
|
||||
this.setTextureName("lotr:aulendur_hammer");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack item) {
|
||||
return "item.aulendur_hammer";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean advanced) {
|
||||
list.add(EnumChatFormatting.GRAY + "This blacksmith hammer is brimming with power");
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,26 @@
|
||||
package com.zivilon.cinder_loe.items;
|
||||
|
||||
import com.zivilon.cinder_loe.CinderLoE;
|
||||
import com.zivilon.cinder_loe.LoECreativeTabs;
|
||||
|
||||
import lotr.common.item.LOTRItemPolearm;
|
||||
import lotr.common.item.LOTRWeaponStats;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class Celeiniss extends LOTRItemPolearm {
|
||||
public Celeiniss() {
|
||||
super(CinderLoE.MATERIAL_NEX_ICE);
|
||||
this.lotrWeaponDamage = 11.5F;
|
||||
this.setUnlocalizedName("lotr:firstAgeGlaive");
|
||||
this.setTextureName("lotr:firstAgeGlaive");
|
||||
this.setCreativeTab(LoECreativeTabs.tabCombatLoE);
|
||||
LOTRWeaponStats.registerMeleeReach(Celeiniss.class, 1.8F);
|
||||
LOTRWeaponStats.registerMeleeSpeed(Celeiniss.class, 1.0F);
|
||||
}
|
||||
|
||||
public boolean getIsRepairable(ItemStack itemstack, ItemStack repairItem) {
|
||||
return (repairItem.getItem() == Item.getItemFromBlock(CinderLoE.enchantedIce));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
package com.zivilon.cinder_loe.items;
|
||||
|
||||
import com.zivilon.cinder_loe.LoECreativeTabs;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class IceThawer extends Item {
|
||||
|
||||
public IceThawer() {
|
||||
this.setUnlocalizedName("ice_thawer");
|
||||
this.setTextureName("lotr:ice_thawer");
|
||||
setCreativeTab(LoECreativeTabs.tabMiscLoE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean advanced) {
|
||||
list.add(EnumChatFormatting.DARK_PURPLE + "You feel like if you held this");
|
||||
list.add(EnumChatFormatting.DARK_PURPLE + "against a frozen body, it might melt.");
|
||||
list.add(EnumChatFormatting.DARK_PURPLE + "But why would you need such thing?");
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,458 @@
|
||||
package com.zivilon.cinder_loe.items;
|
||||
|
||||
import com.zivilon.cinder_loe.CinderLoE;
|
||||
import com.zivilon.cinder_loe.LoECreativeTabs;
|
||||
import com.zivilon.cinder_loe.entity.effect.NimveilLightningBolt;
|
||||
import com.zivilon.cinder_loe.potion.LoEPotions;
|
||||
import com.zivilon.cinder_loe.util.Utilities;
|
||||
|
||||
import lotr.common.LOTRLevelData;
|
||||
import lotr.common.entity.npc.LOTREntityNPC;
|
||||
import lotr.common.fac.LOTRFaction;
|
||||
import lotr.common.item.LOTRItemSword;
|
||||
import lotr.common.item.LOTRMaterial;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumAction;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Nimveil extends LOTRItemSword {
|
||||
public static String NBT_STATE = "NimveilState";
|
||||
public static String NBT_VARIANT = "NimveilVariant";
|
||||
public static String NBT_TICK = "Tick";
|
||||
public IIcon[] icons;
|
||||
|
||||
public Nimveil() {
|
||||
super(CinderLoE.MATERIAL_NIMVEIL);
|
||||
this.setHasSubtypes(true);
|
||||
this.canRepair = false;
|
||||
this.setMaxDamage(300);
|
||||
setCreativeTab(LoECreativeTabs.tabCombatLoE);
|
||||
}
|
||||
|
||||
public boolean getIsRepairable(ItemStack nimveil, ItemStack repair_material) {
|
||||
if (repair_material.getItem() == Item.getItemFromBlock(CinderLoE.enchantedIce))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showDurabilityBar(ItemStack stack) {
|
||||
return true; // Always show the durability bar
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getDurabilityForDisplay(ItemStack stack) {
|
||||
int state = get_state(stack);
|
||||
|
||||
// No charges found, show recharge meter
|
||||
if (state == 0) {
|
||||
double damage = ((double) stack.getItemDamage() / (double) stack.getMaxDamage());
|
||||
return damage;
|
||||
}
|
||||
|
||||
// The only variant where state is > 1 is "ancient". So we skip an NBT read here.
|
||||
if (state > 1) {
|
||||
double ancient_charges = 1.0D - (10.0D - (double)state) / 10.0D;
|
||||
return 1.0D - ancient_charges;
|
||||
}
|
||||
|
||||
// If variant is not "ancient", then it can't have more than 1 charge. We already checked that there is charge, so it's at max
|
||||
String variant = get_variant(stack);
|
||||
if (!variant.equals("ancient"))
|
||||
return 0.0D;
|
||||
|
||||
// If variant is "ancient" and state is 1, we know the bar is at 0.9.
|
||||
return 0.9D;
|
||||
}
|
||||
|
||||
/**
|
||||
* Nimveil state handling
|
||||
*/
|
||||
public static byte get_state(ItemStack stack) {
|
||||
if (stack.hasTagCompound()) {
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
return tag.getByte(NBT_STATE);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
public static void set_state(ItemStack stack, byte state) {
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
if (tag == null) {
|
||||
tag = new NBTTagCompound();
|
||||
stack.setTagCompound(tag);
|
||||
}
|
||||
tag.setByte(NBT_STATE, state);
|
||||
}
|
||||
public static boolean decrement_state(ItemStack stack) {
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
if (tag == null) {
|
||||
return false;
|
||||
}
|
||||
byte state = tag.getByte(NBT_STATE);
|
||||
if (state > 0) {
|
||||
if (state == 1)
|
||||
stack.setItemDamage(300);
|
||||
tag.setByte(NBT_STATE, --state);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public static int tick(ItemStack stack) {
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
if (tag == null) {
|
||||
tag = new NBTTagCompound();
|
||||
stack.setTagCompound(tag);
|
||||
}
|
||||
int tick = tag.getInteger(NBT_TICK);
|
||||
if (tick >= 20) {
|
||||
tick = 0;
|
||||
} else {
|
||||
tick++;
|
||||
}
|
||||
tag.setInteger(NBT_TICK, tick);
|
||||
return tick;
|
||||
}
|
||||
|
||||
/**
|
||||
* Methods to put all variants under one item type
|
||||
*/
|
||||
public IIcon getIconIndex(ItemStack stack)
|
||||
{
|
||||
int icon_index = 0;
|
||||
if (get_state(stack) != 0)
|
||||
icon_index += 5;
|
||||
switch(get_variant(stack)) {
|
||||
case "valar":
|
||||
break;
|
||||
case "mortals":
|
||||
icon_index += 1;
|
||||
break;
|
||||
case "udun":
|
||||
icon_index += 2;
|
||||
break;
|
||||
case "sauron":
|
||||
icon_index += 3;
|
||||
break;
|
||||
case "ancient":
|
||||
icon_index += 4;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return icons[icon_index];
|
||||
}
|
||||
@Override
|
||||
public void registerIcons(IIconRegister iconRegister) {
|
||||
this.icons = new IIcon[10];
|
||||
this.icons[0] = iconRegister.registerIcon("lotr:nimveil_valar");
|
||||
this.icons[1] = iconRegister.registerIcon("lotr:nimveil_mortals");
|
||||
this.icons[2] = iconRegister.registerIcon("lotr:nimveil_udun");
|
||||
this.icons[3] = iconRegister.registerIcon("lotr:nimveil_sauron");
|
||||
this.icons[4] = iconRegister.registerIcon("lotr:nimveil_ancient");
|
||||
this.icons[5] = iconRegister.registerIcon("lotr:nimveil_valar_glow");
|
||||
this.icons[6] = iconRegister.registerIcon("lotr:nimveil_mortals_glow");
|
||||
this.icons[7] = iconRegister.registerIcon("lotr:nimveil_udun_glow");
|
||||
this.icons[8] = iconRegister.registerIcon("lotr:nimveil_sauron_glow");
|
||||
this.icons[9] = iconRegister.registerIcon("lotr:nimveil_ancient_glow");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack item) {
|
||||
// return "item.nimveil_" + get_variant(item);
|
||||
return "lotr:nimveil";
|
||||
}
|
||||
public static String get_variant(ItemStack stack) {
|
||||
if (stack.hasTagCompound()) {
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
return tag.getString(NBT_VARIANT);
|
||||
}
|
||||
return "invalid";
|
||||
}
|
||||
public static ItemStack init_variant(ItemStack stack, String variant) {
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
if (tag == null) {
|
||||
tag = new NBTTagCompound();
|
||||
stack.setTagCompound(tag);
|
||||
}
|
||||
tag.setString(NBT_VARIANT, variant);
|
||||
tag.setByte(NBT_STATE, (byte)0);
|
||||
return stack;
|
||||
}
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean advanced) {
|
||||
switch(get_variant(stack)) {
|
||||
case "valar":
|
||||
list.add(EnumChatFormatting.AQUA + "Valar");
|
||||
list.add("");
|
||||
list.add(EnumChatFormatting.GOLD + "Special Attack:");
|
||||
list.add(EnumChatFormatting.YELLOW + " Cast a line of lightning strikes");
|
||||
return;
|
||||
case "mortals":
|
||||
list.add(EnumChatFormatting.DARK_GREEN + "Mortals");
|
||||
list.add("");
|
||||
list.add(EnumChatFormatting.GOLD + "Special Attack:");
|
||||
list.add(EnumChatFormatting.YELLOW + " Deal 25% of your missing health as damage");
|
||||
return;
|
||||
case "udun":
|
||||
list.add(EnumChatFormatting.DARK_RED + "Udûn");
|
||||
list.add("");
|
||||
list.add(EnumChatFormatting.GOLD + "Special Attack:");
|
||||
list.add(EnumChatFormatting.YELLOW + " +20% Attack Damage");
|
||||
list.add(EnumChatFormatting.YELLOW + " Reverse Knockback");
|
||||
return;
|
||||
case "sauron":
|
||||
list.add(EnumChatFormatting.DARK_PURPLE + "Sauron");
|
||||
list.add(EnumChatFormatting.GOLD + "Special Attack:");
|
||||
list.add(EnumChatFormatting.YELLOW + " Apply Corrupting effect for 60 seconds");
|
||||
list.add(EnumChatFormatting.YELLOW + " Causes all NPCs to be hostile");
|
||||
return;
|
||||
case "ancient":
|
||||
list.add(EnumChatFormatting.DARK_AQUA + "Ancient");
|
||||
list.add(EnumChatFormatting.GOLD + "Special Attack:");
|
||||
list.add(EnumChatFormatting.YELLOW + " For each outnumbering non-allied NPC nearby");
|
||||
list.add(EnumChatFormatting.YELLOW + " +5% damage vs NPCs");
|
||||
list.add(EnumChatFormatting.YELLOW + " +1.25% damage vs players");
|
||||
return;
|
||||
default:
|
||||
list.add(EnumChatFormatting.GRAY + "Invalid");
|
||||
return;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void getSubItems(Item item, CreativeTabs tab, List list) {
|
||||
list.add(init_variant(new ItemStack(item, 1), "ancient"));
|
||||
list.add(init_variant(new ItemStack(item, 1), "valar"));
|
||||
list.add(init_variant(new ItemStack(item, 1), "mortals"));
|
||||
list.add(init_variant(new ItemStack(item, 1), "udun"));
|
||||
list.add(init_variant(new ItemStack(item, 1), "sauron"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Modify sword mechanics to those unique to Nimveil
|
||||
*/
|
||||
@Override
|
||||
public boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker) {
|
||||
if (attacker.worldObj.isRemote) return false;
|
||||
if (stack.getItemDamage() != 0) return false;
|
||||
|
||||
if (decrement_state(stack)) {
|
||||
special_damage(stack, target, attacker);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
|
||||
if (world.isRemote) return stack;
|
||||
if (stack.getItemDamage() != 0) return stack;
|
||||
|
||||
byte state = get_state(stack);
|
||||
if (state == 0) {
|
||||
special_action(stack, world, player);
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Unused but here to remind they exist for later
|
||||
*/
|
||||
@Override
|
||||
public EnumAction getItemUseAction(ItemStack p_77661_1_) {
|
||||
return EnumAction.none; // might be modified later, it's here so I remember it exists,
|
||||
}
|
||||
|
||||
/**
|
||||
* Recharging durability (special attack) bar
|
||||
*/
|
||||
@Override
|
||||
public void onUpdate(ItemStack stack, World world, Entity entity, int itemSlot, boolean isSelected) {
|
||||
super.onUpdate(stack, world, entity, itemSlot, isSelected);
|
||||
|
||||
// Only run on the server-side to prevent conflicts with client-side rendering
|
||||
if (!world.isRemote && get_state(stack) == 0) {
|
||||
int tick = tick(stack);
|
||||
if (tick == 20 && stack.getItemDamage() > 0) {
|
||||
stack.setItemDamage(stack.getItemDamage() - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generic redirects for Nimveil special actions
|
||||
*/
|
||||
public void special_action(ItemStack stack, World world, EntityPlayer player) {
|
||||
String variant = get_variant(stack);
|
||||
switch(variant) {
|
||||
case "valar":
|
||||
special_action_valar(stack, world, player);
|
||||
return;
|
||||
case "mortals":
|
||||
special_action_mortals(stack, world, player);
|
||||
return;
|
||||
case "udun":
|
||||
special_action_udun(stack, world, player);
|
||||
return;
|
||||
case "sauron":
|
||||
special_action_sauron(stack, world, player);
|
||||
return;
|
||||
case "ancient":
|
||||
special_action_ancient(stack, world, player);
|
||||
return;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
public void special_damage(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker) {
|
||||
String variant = get_variant(stack);
|
||||
switch(variant) {
|
||||
case "mortals":
|
||||
special_damage_mortals(stack, target, attacker);
|
||||
return;
|
||||
case "udun":
|
||||
special_damage_udun(stack, target, attacker);
|
||||
return;
|
||||
case "sauron":
|
||||
special_damage_sauron(stack, target, attacker);
|
||||
return;
|
||||
case "ancient":
|
||||
special_damage_ancient(stack, target, attacker);
|
||||
return;
|
||||
case "valar":
|
||||
special_damage_valar(stack, target, attacker);
|
||||
return;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Valar Nimveil special actions
|
||||
*/
|
||||
public void special_action_valar(ItemStack stack, World world, EntityPlayer player) {
|
||||
// No charges because this triggers immediately. Set damage to max
|
||||
stack.setItemDamage(stack.getMaxDamage());
|
||||
System.out.println("Triggering Valar action. Also max damage is " + stack.getMaxDamage());
|
||||
summon_lightning_line(world, player);
|
||||
}
|
||||
public void special_damage_valar(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker) {
|
||||
// Do nothing, this method should never run but exists for consistency and extensibility
|
||||
}
|
||||
public void summon_lightning_line(World world, EntityPlayer player) {
|
||||
// Get the player's facing direction
|
||||
float yaw = player.rotationYaw;
|
||||
|
||||
// Calculate the initial position, 4 blocks in front
|
||||
double x = player.posX - Math.sin(Math.toRadians(yaw)) * 7;
|
||||
double z = player.posZ + Math.cos(Math.toRadians(yaw)) * 7;
|
||||
double y = player.posY;
|
||||
|
||||
// Summon the first lightning bolt
|
||||
world.spawnEntityInWorld(new NimveilLightningBolt(world, x, y, z));
|
||||
|
||||
// Summon 6 more lightning bolts, each 3 blocks apart
|
||||
for (int i = 1; i < 7; i++) {
|
||||
x -= Math.sin(Math.toRadians(yaw)) * 5;
|
||||
z += Math.cos(Math.toRadians(yaw)) * 5;
|
||||
world.spawnEntityInWorld(new NimveilLightningBolt(world, x, y, z));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Udûn Nimveil special actions
|
||||
*/
|
||||
public void special_action_udun(ItemStack stack, World world, EntityPlayer player) {
|
||||
// Set 1 charge
|
||||
set_state(stack, (byte)1);
|
||||
}
|
||||
public void special_damage_udun(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker) {
|
||||
double damage = Utilities.calculate_melee_damage_on_entity(target, attacker);
|
||||
target.attackEntityFrom(DamageSource.causeMobDamage(attacker), 0.2F * (float)damage);
|
||||
Utilities.knockback(target, attacker, -3.0D);
|
||||
target.worldObj.playSoundAtEntity(target, "lotr:item.maceSauron", 1.0F, 1.3F);
|
||||
}
|
||||
|
||||
/**
|
||||
* Mortals Nimveil special actions
|
||||
*/
|
||||
public void special_action_mortals(ItemStack stack, World world, EntityPlayer player) {
|
||||
// Set 1 charge
|
||||
set_state(stack, (byte)1);
|
||||
}
|
||||
public void special_damage_mortals(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker) {
|
||||
// Set 1 charge
|
||||
float max_health = attacker.getMaxHealth();
|
||||
float current_health = attacker.getHealth();
|
||||
target.attackEntityFrom(DamageSource.causeMobDamage(attacker).setDamageBypassesArmor(), 0.25F * (max_health - current_health));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sauron Nimveil special actions
|
||||
*/
|
||||
public void special_action_sauron(ItemStack stack, World world, EntityPlayer player) {
|
||||
// Set 1 charge
|
||||
set_state(stack, (byte)1);
|
||||
}
|
||||
public void special_damage_sauron(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker) {
|
||||
// Check if the target is an instance of EntityPlayer
|
||||
if (target instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) target;
|
||||
|
||||
// Apply the Corrupting potion effect
|
||||
player.addPotionEffect(new PotionEffect(LoEPotions.corrupting.id, 1200, 0)); // 60 seconds duration (20 ticks per second)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Ancient Nimveil special actions
|
||||
*/
|
||||
public void special_action_ancient(ItemStack stack, World world, EntityPlayer player) {
|
||||
// Set 10 charges
|
||||
this.set_state(stack, ((byte)10));
|
||||
}
|
||||
public void special_damage_ancient(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker) {
|
||||
if (!(attacker instanceof EntityPlayer)) return;
|
||||
LOTRFaction pledged_faction = LOTRLevelData.getData(((EntityPlayer)attacker)).getPledgeFaction();
|
||||
if (pledged_faction == null) {
|
||||
((EntityPlayer)attacker).addChatMessage(new ChatComponentText("You need to be pledged to a faction to use this"));
|
||||
return;
|
||||
}
|
||||
List<LOTREntityNPC> entity_list = attacker.worldObj.getEntitiesWithinAABB(LOTREntityNPC.class, attacker.boundingBox.expand(100, 10, 100));
|
||||
int friendly_count = 0;
|
||||
int total_count = entity_list.size();
|
||||
double damage = 0.0D;
|
||||
for (LOTREntityNPC npc : entity_list) {
|
||||
if (npc.getFaction().isGoodRelation(pledged_faction))
|
||||
friendly_count++;
|
||||
}
|
||||
int outnumber_count = Math.min(total_count - friendly_count * 2, 20);
|
||||
if (outnumber_count > 0)
|
||||
damage = Utilities.calculate_melee_damage_on_entity(target, attacker);
|
||||
float final_damage = 0.0F;
|
||||
if (!(target instanceof EntityPlayer)) {
|
||||
final_damage = 0.05F * (float)outnumber_count * (float)damage;
|
||||
target.attackEntityFrom(DamageSource.causeMobDamage(attacker), final_damage);
|
||||
return;
|
||||
}
|
||||
final_damage = 0.0125F * ((float)outnumber_count) * ((float)damage);
|
||||
target.attackEntityFrom(DamageSource.causeMobDamage(attacker), final_damage);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,128 @@
|
||||
package com.zivilon.cinder_loe.items;
|
||||
|
||||
import com.zivilon.cinder_loe.entity.projectile.EntityWarDart;
|
||||
import com.zivilon.cinder_loe.LoECreativeTabs;
|
||||
|
||||
import lotr.common.dispenser.LOTRDispenseThrowingAxe;
|
||||
import lotr.common.enchant.LOTREnchantment;
|
||||
import lotr.common.enchant.LOTREnchantmentHelper;
|
||||
import lotr.common.entity.projectile.LOTREntityThrowingAxe;
|
||||
import lotr.common.item.LOTRMaterial;
|
||||
import lotr.common.recipe.LOTRRecipes;
|
||||
import net.minecraft.block.BlockDispenser;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.EnumCreatureAttribute;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import java.util.List;
|
||||
|
||||
public class NimveilPart extends Item {
|
||||
public IIcon[] icons;
|
||||
|
||||
public NimveilPart() {
|
||||
this.setHasSubtypes(true);
|
||||
setCreativeTab(LoECreativeTabs.tabMiscLoE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIconFromDamage(int damage) {
|
||||
if (damage < 0 || damage >= icons.length) {
|
||||
damage = 0;
|
||||
}
|
||||
return this.icons[damage];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(IIconRegister iconRegister) {
|
||||
this.icons = new IIcon[7];
|
||||
this.icons[0] = iconRegister.registerIcon("lotr:nimveil_hilt");
|
||||
this.icons[1] = iconRegister.registerIcon("lotr:nimveil_blade");
|
||||
this.icons[2] = iconRegister.registerIcon("lotr:nimveil_gem_valar");
|
||||
this.icons[3] = iconRegister.registerIcon("lotr:nimveil_gem_mortals");
|
||||
this.icons[4] = iconRegister.registerIcon("lotr:nimveil_gem_udun");
|
||||
this.icons[5] = iconRegister.registerIcon("lotr:nimveil_gem_sauron");
|
||||
this.icons[6] = iconRegister.registerIcon("lotr:nimveil_gem_ancient");
|
||||
}
|
||||
|
||||
public static String get_part_type(ItemStack item) {
|
||||
switch(item.getItemDamage()) {
|
||||
case 0:
|
||||
return "hilt";
|
||||
case 1:
|
||||
return "blade";
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
case 5:
|
||||
case 6:
|
||||
return "gem";
|
||||
default:
|
||||
return "hilt";
|
||||
}
|
||||
}
|
||||
|
||||
public static String get_gem_type(ItemStack item) {
|
||||
switch(item.getItemDamage()) {
|
||||
case 0:
|
||||
case 1:
|
||||
return "invalid";
|
||||
case 2:
|
||||
return "valar";
|
||||
case 3:
|
||||
return "mortals";
|
||||
case 4:
|
||||
return "udun";
|
||||
case 5:
|
||||
return "sauron";
|
||||
case 6:
|
||||
return "ancient";
|
||||
default:
|
||||
return "invalid";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack item) {
|
||||
return "item.nimveil_" + get_part_type(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean advanced) {
|
||||
switch(get_gem_type(stack)) {
|
||||
case "valar":
|
||||
list.add(EnumChatFormatting.AQUA + "Valar");
|
||||
return;
|
||||
case "mortals":
|
||||
list.add(EnumChatFormatting.DARK_GREEN + "Mortals");
|
||||
return;
|
||||
case "udun":
|
||||
list.add(EnumChatFormatting.DARK_RED + "Udûn");
|
||||
return;
|
||||
case "sauron":
|
||||
list.add(EnumChatFormatting.DARK_PURPLE + "Sauron");
|
||||
return;
|
||||
case "ancient":
|
||||
list.add(EnumChatFormatting.DARK_AQUA + "Ancient");
|
||||
return;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems(Item item, CreativeTabs tab, List list) {
|
||||
for (int i = 0; i < icons.length; i++) {
|
||||
list.add(new ItemStack(item, 1, i));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package com.zivilon.cinder_loe.items;
|
||||
|
||||
import com.zivilon.cinder_loe.LoECreativeTabs;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
public class ToxicCore extends Item {
|
||||
|
||||
public ToxicCore() {
|
||||
this.setUnlocalizedName("lotr:toxicCore");
|
||||
this.setTextureName("lotr:toxic_core");
|
||||
setCreativeTab(LoECreativeTabs.tabMiscLoE);
|
||||
this.setMaxDamage(10000);
|
||||
this.setNoRepair();
|
||||
this.setMaxStackSize(1);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,127 @@
|
||||
package com.zivilon.cinder_loe.items;
|
||||
|
||||
import com.zivilon.cinder_loe.entity.projectile.EntityWarDart;
|
||||
import com.zivilon.cinder_loe.LoECreativeTabs;
|
||||
|
||||
import lotr.common.dispenser.LOTRDispenseThrowingAxe;
|
||||
import lotr.common.enchant.LOTREnchantment;
|
||||
import lotr.common.enchant.LOTREnchantmentHelper;
|
||||
import lotr.common.entity.projectile.LOTREntityThrowingAxe;
|
||||
import lotr.common.item.LOTRMaterial;
|
||||
import lotr.common.recipe.LOTRRecipes;
|
||||
import net.minecraft.block.BlockDispenser;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.EnumCreatureAttribute;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import java.util.List;
|
||||
|
||||
public class WeaponPart extends Item {
|
||||
public IIcon[] icons;
|
||||
|
||||
public WeaponPart() {
|
||||
this.setHasSubtypes(true);
|
||||
setCreativeTab(LoECreativeTabs.tabMiscLoE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIconFromDamage(int damage) {
|
||||
if (damage < 0 || damage >= icons.length) {
|
||||
damage = 0;
|
||||
}
|
||||
return this.icons[damage];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(IIconRegister iconRegister) {
|
||||
this.icons = new IIcon[12];
|
||||
this.icons[0] = iconRegister.registerIcon("lotr:deceiver_blade_blade");
|
||||
this.icons[1] = iconRegister.registerIcon("lotr:deceiver_blade_guard");
|
||||
this.icons[2] = iconRegister.registerIcon("lotr:deceiver_blade_hilt");
|
||||
this.icons[3] = iconRegister.registerIcon("lotr:anarore_bow_top");
|
||||
this.icons[4] = iconRegister.registerIcon("lotr:anarore_bow_bottom");
|
||||
this.icons[5] = iconRegister.registerIcon("lotr:anarore_bow_bowstring");
|
||||
this.icons[6] = iconRegister.registerIcon("lotr:chieftain_club_???");
|
||||
this.icons[7] = iconRegister.registerIcon("lotr:chieftain_club_???");
|
||||
this.icons[8] = iconRegister.registerIcon("lotr:chieftain_club_???");
|
||||
this.icons[9] = iconRegister.registerIcon("lotr:glaechir_spear_tip");
|
||||
this.icons[10] = iconRegister.registerIcon("lotr:glaechir_spear_shaft");
|
||||
this.icons[11] = iconRegister.registerIcon("lotr:glaechir_spear_???");
|
||||
}
|
||||
|
||||
public static String get_part(ItemStack item) {
|
||||
switch(item.getItemDamage()) {
|
||||
case 0:
|
||||
return "blade";
|
||||
case 1:
|
||||
return "guard";
|
||||
case 2:
|
||||
return "hilt";
|
||||
case 3:
|
||||
return "top";
|
||||
case 4:
|
||||
return "bottom";
|
||||
case 5:
|
||||
return "bowstring";
|
||||
case 6:
|
||||
return "club";
|
||||
case 7:
|
||||
return "spikes";
|
||||
case 8:
|
||||
return "???";
|
||||
case 9:
|
||||
return "tip";
|
||||
case 10:
|
||||
return "shaft";
|
||||
case 11:
|
||||
return "???";
|
||||
default:
|
||||
return "invalid";
|
||||
}
|
||||
}
|
||||
|
||||
public static String get_weapon(ItemStack item) {
|
||||
switch(item.getItemDamage()) {
|
||||
case 0:
|
||||
case 1:
|
||||
case 2:
|
||||
return "deceiver_blade";
|
||||
case 3:
|
||||
case 4:
|
||||
case 5:
|
||||
return "anarore_bow";
|
||||
case 6:
|
||||
case 7:
|
||||
case 8:
|
||||
return "troll_chieftain_club";
|
||||
case 9:
|
||||
case 10:
|
||||
case 11:
|
||||
return "glaechir_spear";
|
||||
default:
|
||||
return "invalid";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack item) {
|
||||
return "item." + get_weapon(item) + "_" + get_part(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems(Item item, CreativeTabs tab, List list) {
|
||||
for (int i = 0; i < icons.length; i++) {
|
||||
list.add(new ItemStack(item, 1, i));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,57 @@
|
||||
package com.zivilon.cinder_loe.recipe;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ForgingRecipe {
|
||||
|
||||
public boolean isBlessed;
|
||||
public ItemStack leftInput;
|
||||
public ItemStack middleInput;
|
||||
public ItemStack rightInput;
|
||||
public ItemStack output;
|
||||
|
||||
public ForgingRecipe(ItemStack leftInput, ItemStack middleInput, ItemStack rightInput, ItemStack output, boolean isBlessed) {
|
||||
this.leftInput = leftInput;
|
||||
this.middleInput = middleInput;
|
||||
this.rightInput = rightInput;
|
||||
this.output = output;
|
||||
this.isBlessed = isBlessed;
|
||||
}
|
||||
|
||||
public boolean matches(ItemStack left, ItemStack middle, ItemStack right, boolean isBlessedHammer) {
|
||||
if (this.isBlessed && !isBlessedHammer) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return matchesItem(leftInput, left) &&
|
||||
matchesItem(middleInput, middle) &&
|
||||
matchesItem(rightInput, right);
|
||||
}
|
||||
|
||||
public boolean matchesItem(ItemStack recipeInput, ItemStack stationInput) {
|
||||
if (recipeInput == null && stationInput == null) {
|
||||
return true;
|
||||
}
|
||||
if (recipeInput == null || stationInput == null) {
|
||||
return false;
|
||||
}
|
||||
return recipeInput.getItem() == stationInput.getItem() &&
|
||||
recipeInput.getItemDamage() == stationInput.getItemDamage();
|
||||
}
|
||||
|
||||
public ItemStack getOutput() {
|
||||
return output.copy();
|
||||
}
|
||||
|
||||
public static String getSafeName(ItemStack stack) {
|
||||
if (stack == null) return "null";
|
||||
return stack.getUnlocalizedName();
|
||||
}
|
||||
|
||||
public static void printRecipeDetails(ForgingRecipe recipe) {
|
||||
System.out.println("Left: " + getSafeName(recipe.leftInput));
|
||||
System.out.println("Middle: " + getSafeName(recipe.middleInput));
|
||||
System.out.println("Right: " + getSafeName(recipe.rightInput));
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,85 @@
|
||||
package com.zivilon.cinder_loe.recipe;
|
||||
|
||||
import com.zivilon.cinder_loe.CinderLoE;
|
||||
import com.zivilon.cinder_loe.items.Nimveil;
|
||||
import com.zivilon.cinder_loe.util.Utilities;
|
||||
|
||||
import lotr.common.enchant.LOTREnchantment;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ForgingRecipes {
|
||||
public static List<ForgingRecipe> recipes = new ArrayList();
|
||||
|
||||
public static void register_recipe(ForgingRecipe recipe) {
|
||||
recipes.add(recipe);
|
||||
}
|
||||
|
||||
public static void register_recipes() {
|
||||
register_recipe(new ForgingRecipe(
|
||||
new ItemStack(CinderLoE.nimveilPart, 1, 2),
|
||||
new ItemStack(CinderLoE.nimveilPart, 1, 1),
|
||||
new ItemStack(CinderLoE.nimveilPart, 1, 0),
|
||||
Nimveil.init_variant(new ItemStack(CinderLoE.nimveil, 1), "valar"),
|
||||
true
|
||||
));
|
||||
register_recipe(new ForgingRecipe(
|
||||
new ItemStack(CinderLoE.nimveilPart, 1, 3),
|
||||
new ItemStack(CinderLoE.nimveilPart, 1, 1),
|
||||
new ItemStack(CinderLoE.nimveilPart, 1, 0),
|
||||
Nimveil.init_variant(new ItemStack(CinderLoE.nimveil, 1), "mortals"),
|
||||
true
|
||||
));
|
||||
register_recipe(new ForgingRecipe(
|
||||
new ItemStack(CinderLoE.nimveilPart, 1, 4),
|
||||
new ItemStack(CinderLoE.nimveilPart, 1, 1),
|
||||
new ItemStack(CinderLoE.nimveilPart, 1, 0),
|
||||
Nimveil.init_variant(new ItemStack(CinderLoE.nimveil, 1), "udun"),
|
||||
true
|
||||
));
|
||||
register_recipe(new ForgingRecipe(
|
||||
new ItemStack(CinderLoE.nimveilPart, 1, 5),
|
||||
new ItemStack(CinderLoE.nimveilPart, 1, 1),
|
||||
new ItemStack(CinderLoE.nimveilPart, 1, 0),
|
||||
Nimveil.init_variant(new ItemStack(CinderLoE.nimveil, 1), "sauron"),
|
||||
true
|
||||
));
|
||||
register_recipe(new ForgingRecipe(
|
||||
new ItemStack(CinderLoE.nimveilPart, 1, 6),
|
||||
new ItemStack(CinderLoE.nimveilPart, 1, 1),
|
||||
new ItemStack(CinderLoE.nimveilPart, 1, 0),
|
||||
Nimveil.init_variant(new ItemStack(CinderLoE.nimveil, 1), "ancient"),
|
||||
true
|
||||
));
|
||||
register_recipe(new ForgingRecipe(
|
||||
null,
|
||||
new ItemStack(CinderLoE.nimveil, 1),
|
||||
null,
|
||||
new ItemStack(CinderLoE.nimveilPart, 1, 1),
|
||||
true
|
||||
));
|
||||
register_recipe(new ForgingRecipe(
|
||||
new ItemStack(CinderLoE.weaponPart, 1, 0),
|
||||
new ItemStack(CinderLoE.weaponPart, 1, 1),
|
||||
new ItemStack(CinderLoE.weaponPart, 1, 2),
|
||||
deceiver_blade(),
|
||||
false
|
||||
));
|
||||
}
|
||||
|
||||
public static ItemStack deceiver_blade() {
|
||||
ItemStack blade = new ItemStack(CinderLoE.deceiverBlade, 1);
|
||||
Utilities.setAppliedRandomEnchants(blade);
|
||||
Utilities.setLOTREnchant(blade, LOTREnchantment.strong4);
|
||||
Utilities.setLOTREnchant(blade, LOTREnchantment.meleeSpeed1);
|
||||
Utilities.setLOTREnchant(blade, LOTREnchantment.meleeReach1);
|
||||
return blade;
|
||||
}
|
||||
|
||||
public static List<ForgingRecipe> getAllRecipes() {
|
||||
return recipes;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,81 @@
|
||||
package com.zivilon.cinder_loe.recipe;
|
||||
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.world.World;
|
||||
import com.zivilon.cinder_loe.CinderLoE;
|
||||
|
||||
public class ToxicCoreArrowsRecipe implements IRecipe {
|
||||
|
||||
private final ItemStack result;
|
||||
|
||||
public ToxicCoreArrowsRecipe(ItemStack result) {
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(InventoryCrafting inv, World worldIn) {
|
||||
ItemStack toxicCore = null;
|
||||
int arrowCount = 0;
|
||||
|
||||
for (int i = 0; i < inv.getSizeInventory(); i++) {
|
||||
ItemStack itemstack = inv.getStackInSlot(i);
|
||||
|
||||
if (itemstack != null) {
|
||||
if (itemstack.getItem() == CinderLoE.toxicCore) {
|
||||
if (toxicCore != null) {
|
||||
return false; // Only one toxic core allowed
|
||||
}
|
||||
toxicCore = itemstack;
|
||||
} else if (itemstack.getItem() == Items.arrow) {
|
||||
arrowCount++;
|
||||
} else {
|
||||
return false; // Invalid item in grid
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (toxicCore != null && arrowCount > 0) {
|
||||
return toxicCore.getItemDamage() + arrowCount <= toxicCore.getMaxDamage();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getCraftingResult(InventoryCrafting inv) {
|
||||
ItemStack toxicCore = null;
|
||||
int arrowCount = 0;
|
||||
|
||||
for (int i = 0; i < inv.getSizeInventory(); i++) {
|
||||
ItemStack itemstack = inv.getStackInSlot(i);
|
||||
|
||||
if (itemstack != null) {
|
||||
if (itemstack.getItem() == CinderLoE.toxicCore) {
|
||||
toxicCore = itemstack;
|
||||
} else if (itemstack.getItem() == Items.arrow) {
|
||||
arrowCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (toxicCore != null && arrowCount > 0) {
|
||||
ItemStack resultStack = new ItemStack(result.getItem(), arrowCount);
|
||||
return resultStack;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRecipeSize() {
|
||||
return 9;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getRecipeOutput() {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,127 @@
|
||||
package com.zivilon.cinder_loe.tileentity;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
|
||||
public class TileEntityForgingStation extends TileEntity {
|
||||
|
||||
public ItemStack leftItem;
|
||||
public ItemStack middleItem;
|
||||
public ItemStack rightItem;
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getRenderBoundingBox() {
|
||||
return AxisAlignedBB.getBoundingBox(
|
||||
xCoord - 1, yCoord, zCoord - 1,
|
||||
xCoord + 2, yCoord + 1, zCoord + 2
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Packet getDescriptionPacket() {
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
writeToNBT(tag);
|
||||
return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 1, tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
|
||||
readFromNBT(pkt.func_148857_g());
|
||||
}
|
||||
|
||||
|
||||
// Getters and Setters for the items
|
||||
public ItemStack getLeftItem() {
|
||||
return leftItem;
|
||||
}
|
||||
|
||||
public void setLeftItem(ItemStack leftItem) {
|
||||
this.leftItem = leftItem;
|
||||
markDirty(); // Mark the tile entity as dirty to ensure the world saves the changes
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
public ItemStack getMiddleItem() {
|
||||
return middleItem;
|
||||
}
|
||||
|
||||
public void setMiddleItem(ItemStack middleItem) {
|
||||
this.middleItem = middleItem;
|
||||
markDirty(); // Mark the tile entity as dirty to ensure the world saves the changes
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
public ItemStack getRightItem() {
|
||||
return rightItem;
|
||||
}
|
||||
|
||||
public void setRightItem(ItemStack rightItem) {
|
||||
this.rightItem = rightItem;
|
||||
markDirty(); // Mark the tile entity as dirty to ensure the world saves the changes
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
// Method to write data to NBT
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound compound) {
|
||||
super.writeToNBT(compound);
|
||||
|
||||
if (leftItem != null) {
|
||||
NBTTagCompound leftTag = new NBTTagCompound();
|
||||
leftItem.writeToNBT(leftTag);
|
||||
compound.setTag("LeftItem", leftTag);
|
||||
} else {
|
||||
compound.removeTag("LeftItem");
|
||||
}
|
||||
|
||||
if (middleItem != null) {
|
||||
NBTTagCompound middleTag = new NBTTagCompound();
|
||||
middleItem.writeToNBT(middleTag);
|
||||
compound.setTag("MiddleItem", middleTag);
|
||||
} else {
|
||||
compound.removeTag("MiddleItem");
|
||||
}
|
||||
|
||||
if (rightItem != null) {
|
||||
NBTTagCompound rightTag = new NBTTagCompound();
|
||||
rightItem.writeToNBT(rightTag);
|
||||
compound.setTag("RightItem", rightTag);
|
||||
} else {
|
||||
compound.removeTag("RightItem");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Method to read data from NBT
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound compound) {
|
||||
super.readFromNBT(compound);
|
||||
|
||||
if (compound.hasKey("LeftItem")) {
|
||||
NBTTagCompound leftTag = compound.getCompoundTag("LeftItem");
|
||||
leftItem = ItemStack.loadItemStackFromNBT(leftTag);
|
||||
} else {
|
||||
leftItem = null;
|
||||
}
|
||||
|
||||
if (compound.hasKey("MiddleItem")) {
|
||||
NBTTagCompound middleTag = compound.getCompoundTag("MiddleItem");
|
||||
middleItem = ItemStack.loadItemStackFromNBT(middleTag);
|
||||
} else {
|
||||
middleItem = null;
|
||||
}
|
||||
|
||||
if (compound.hasKey("RightItem")) {
|
||||
NBTTagCompound rightTag = compound.getCompoundTag("RightItem");
|
||||
rightItem = ItemStack.loadItemStackFromNBT(rightTag);
|
||||
} else {
|
||||
rightItem = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,37 @@
|
||||
package com.zivilon.cinder_loe.tileentity;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public class TileEntityShadowTile extends TileEntity {
|
||||
public long spawnTime;
|
||||
public static long REMOVAL_DELAY_MS = 15000;
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
if (!worldObj.isRemote) {
|
||||
if (spawnTime == 0) {
|
||||
spawnTime = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
long currentTime = System.currentTimeMillis();
|
||||
if (currentTime >= spawnTime + REMOVAL_DELAY_MS) {
|
||||
worldObj.setBlockToAir(xCoord, yCoord, zCoord);
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); // Force the client to update
|
||||
worldObj.removeTileEntity(xCoord, yCoord, zCoord); // Clean up the tile entity
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
nbt.setLong("spawnTime", spawnTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
spawnTime = nbt.getLong("spawnTime");
|
||||
}
|
||||
}
|
||||
@ -1,9 +1,11 @@
|
||||
package com.zivilon.cinder_loe.util;
|
||||
|
||||
import com.zivilon.cinder_loe.entity.npc.frozen_dungeon.Nex;
|
||||
|
||||
public class VT_additions {
|
||||
public static String applyCustomPlaceholders(String scriptLine) {
|
||||
/* scriptLine = scriptLine.replace("<nexphase>", String.valueOf(Nex.get_nex_phase()));
|
||||
scriptLine = scriptLine.replace("<nexhealth>", String.valueOf(Nex.get_nex_health()));*/
|
||||
scriptLine = scriptLine.replace("<nexphase>", String.valueOf(Nex.get_nex_phase()));
|
||||
scriptLine = scriptLine.replace("<nexhealth>", String.valueOf(Nex.get_nex_health()));
|
||||
return scriptLine;
|
||||
}
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 6.5 KiB |
|
After Width: | Height: | Size: 4.4 KiB |
|
Before Width: | Height: | Size: 6.4 KiB After Width: | Height: | Size: 4.6 KiB |
|
After Width: | Height: | Size: 4.4 KiB |
|
Before Width: | Height: | Size: 6.6 KiB |
|
After Width: | Height: | Size: 4.6 KiB |
|
After Width: | Height: | Size: 4.8 KiB |
|
After Width: | Height: | Size: 5.0 KiB |
|
After Width: | Height: | Size: 4.6 KiB |
|
After Width: | Height: | Size: 4.8 KiB |
|
After Width: | Height: | Size: 4.8 KiB |
|
After Width: | Height: | Size: 5.0 KiB |
|
After Width: | Height: | Size: 4.8 KiB |
|
After Width: | Height: | Size: 5.0 KiB |
|
After Width: | Height: | Size: 4.8 KiB |
|
After Width: | Height: | Size: 5.0 KiB |
|
After Width: | Height: | Size: 4.6 KiB |
|
Before Width: | Height: | Size: 5.7 KiB After Width: | Height: | Size: 4.8 KiB |
|
After Width: | Height: | Size: 4.4 KiB |