Merge remote-tracking branch 'origin/main'
# Conflicts: # src/main/java/com/zivilon/cinder_loe/CinderLoE.java # src/main/resources/assets/lotr/textures/items/nimveil_blade.png # src/main/resources/assets/lotr/textures/items/war_dart_ancient.png # src/main/resources/assets/lotr/textures/items/war_dart_heads_1.png # src/main/resources/assets/lotr/textures/items/war_dart_mithril.pngfrozen
commit
bad721e87b
Binary file not shown.
@ -0,0 +1,93 @@
|
||||
package com.zivilon.cinder_loe;
|
||||
|
||||
import lotr.common.LOTRLevelData;
|
||||
import lotr.common.entity.LOTREntities;
|
||||
import lotr.common.entity.npc.LOTRBannerBearer;
|
||||
import lotr.common.entity.npc.LOTRHireableBase;
|
||||
import lotr.common.entity.npc.LOTRUnitTradeEntry;
|
||||
import lotr.common.fac.LOTRFaction;
|
||||
import lotr.common.item.LOTRItemCoin;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class CinderUnitTradeEntry extends LOTRUnitTradeEntry {
|
||||
|
||||
public Class entityClass;
|
||||
private String name;
|
||||
private PledgeType pledgeType = PledgeType.NONE;
|
||||
private String objectivename;
|
||||
private static Configuration config;
|
||||
private String extraInfo;
|
||||
|
||||
static {
|
||||
config = new Configuration(new File("CinderLoE.cfg"));
|
||||
config.load();
|
||||
}
|
||||
|
||||
public CinderUnitTradeEntry(Class c, int cost, float alignment) {
|
||||
super(c, cost, alignment);
|
||||
this.entityClass = c; // Set entityClass to the passed class
|
||||
|
||||
if (LOTRBannerBearer.class.isAssignableFrom(this.entityClass)) {
|
||||
this.setExtraInfo("Banner");
|
||||
}
|
||||
}
|
||||
|
||||
public CinderUnitTradeEntry(Class c, Class c1, String s, int cost, float alignment) {
|
||||
super(c, cost, alignment);
|
||||
this.entityClass = c; // Set entityClass to the passed class
|
||||
this.mountClass = c1;
|
||||
this.name = s;
|
||||
}
|
||||
|
||||
public boolean isObjectiveComplete(String objective) {
|
||||
return config.getBoolean(objective, Configuration.CATEGORY_GENERAL, false, "Set true if " + objective + " is complete");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasRequiredCostAndAlignment(EntityPlayer entityplayer, LOTRHireableBase trader) {
|
||||
int coins = LOTRItemCoin.getInventoryValue(entityplayer, false);
|
||||
if (coins < this.getCost(entityplayer, trader)) {
|
||||
return false;
|
||||
}
|
||||
LOTRFaction fac = trader.getFaction();
|
||||
if (!this.pledgeType.canAcceptPlayer(entityplayer, fac)) {
|
||||
return false;
|
||||
}
|
||||
if (objectivename != null && !isObjectiveComplete(objectivename)) {
|
||||
return false;
|
||||
}
|
||||
float alignment = LOTRLevelData.getData(entityplayer).getAlignment(fac);
|
||||
return alignment >= this.alignmentRequired;
|
||||
}
|
||||
|
||||
public CinderUnitTradeEntry setObjective(String objective) {
|
||||
this.objectivename = objective;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getFormattedExtraInfo() {
|
||||
return StatCollector.translateToLocal((String) "lotr.unitinfo." + this.objectivename);
|
||||
}
|
||||
|
||||
public LOTRUnitTradeEntry setExtraInfo(String s) {
|
||||
this.extraInfo = s;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean hasExtraInfo() {
|
||||
return this.extraInfo != null;
|
||||
}
|
||||
|
||||
public String getUnitTradeName() {
|
||||
if (this.mountClass == null) {
|
||||
String entityName = LOTREntities.getStringFromClass(this.entityClass);
|
||||
return StatCollector.translateToLocal((String)("entity." + entityName + ".name"));
|
||||
}
|
||||
return StatCollector.translateToLocal((String)("lotr.unit." + this.name));
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
package com.zivilon.cinder_loe;
|
||||
|
||||
import net.minecraft.util.DamageSource;
|
||||
|
||||
public class LoEDamage {
|
||||
public static DamageSource shadow = (new DamageSource("cinder_loe.shadow")).setDamageBypassesArmor().setMagicDamage();
|
||||
}
|
||||
@ -0,0 +1,149 @@
|
||||
package com.zivilon.cinder_loe.blocks;
|
||||
|
||||
import com.zivilon.cinder_loe.LoECreativeTabs;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import lotr.common.block.LOTRBlockOrcChain;
|
||||
import net.minecraft.block.*;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class CinderChain extends LOTRBlockOrcChain {
|
||||
|
||||
public static final String[] chainTypes = {"bronze", "gold", "silver", "iron"};
|
||||
@SideOnly(value= Side.CLIENT)
|
||||
private IIcon[] iconMiddle;
|
||||
@SideOnly(value=Side.CLIENT)
|
||||
private IIcon[] iconTop;
|
||||
@SideOnly(value=Side.CLIENT)
|
||||
private IIcon[] iconBottom;
|
||||
@SideOnly(value=Side.CLIENT)
|
||||
private IIcon[] iconSingle;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon[] iconItem;
|
||||
|
||||
|
||||
public CinderChain() {
|
||||
this.setCreativeTab(LoECreativeTabs.tabDecoLoE);
|
||||
this.setHardness(1.0f);
|
||||
this.setStepSound(Block.soundTypeMetal);
|
||||
setBlockName("lotr:cinderchain");
|
||||
setBlockTextureName("lotr:cinderchain");
|
||||
float f = 0.2f;
|
||||
this.setBlockBounds(0.5f - f, 0.0f, 0.5f - f, 0.5f + f, 1.0f, 0.5f + f);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
|
||||
this.iconItem = new IIcon[chainTypes.length];
|
||||
|
||||
for (int i = 0; i < chainTypes.length; ++i) {
|
||||
this.iconItem[i] = iconRegister.registerIcon(this.getTextureName() + "_" + chainTypes[i] + "_item");
|
||||
}
|
||||
|
||||
this.iconMiddle = new IIcon[chainTypes.length];
|
||||
this.iconTop = new IIcon[chainTypes.length];
|
||||
this.iconBottom = new IIcon[chainTypes.length];
|
||||
this.iconSingle = new IIcon[chainTypes.length];
|
||||
|
||||
for (int i = 0; i < chainTypes.length; ++i) {
|
||||
this.iconMiddle[i] = iconRegister.registerIcon(this.getTextureName() + "_" + chainTypes[i] + "_mid");
|
||||
this.iconTop[i] = iconRegister.registerIcon(this.getTextureName() + "_" + chainTypes[i] + "_top");
|
||||
this.iconBottom[i] = iconRegister.registerIcon(this.getTextureName() + "_" + chainTypes[i] + "_bottom");
|
||||
this.iconSingle[i] = iconRegister.registerIcon(this.getTextureName() + "_" + chainTypes[i] + "_single");
|
||||
}
|
||||
}
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
Block above = world.getBlock(x, y + 1, z);
|
||||
Block below = world.getBlock(x, y - 1, z);
|
||||
boolean chainAbove = above instanceof CinderChain;
|
||||
boolean chainBelow = below instanceof CinderChain;
|
||||
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if (chainAbove && chainBelow) {
|
||||
return this.iconMiddle[meta];
|
||||
}
|
||||
if (chainAbove) {
|
||||
return this.iconBottom[meta];
|
||||
}
|
||||
if (chainBelow) {
|
||||
return this.iconTop[meta];
|
||||
}
|
||||
return this.iconSingle[meta];
|
||||
}
|
||||
|
||||
@SideOnly(value=Side.CLIENT)
|
||||
public IIcon getIcon(int i, int j) {
|
||||
return i == 1 ? this.iconItem[0] : this.iconItem[1];
|
||||
}
|
||||
|
||||
@SideOnly(value=Side.CLIENT)
|
||||
public String getItemIconName() {
|
||||
return this.getTextureName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int meta) {
|
||||
return meta;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, List list) {
|
||||
for (int i = 0; i < chainTypes.length; ++i) {
|
||||
list.add(new ItemStack(item, 1, i));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int onBlockPlaced(World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int metadata) {
|
||||
// The metadata provided here is the metadata of the block being placed (from the item stack).
|
||||
return metadata; // Return the metadata of the block that should be placed.
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean canPlaceBlockAt(World world, int x, int y, int z) {
|
||||
Block blockAbove = world.getBlock(x, y + 1, z);
|
||||
int metaAbove = world.getBlockMetadata(x, y + 1, z);
|
||||
|
||||
// Get the metadata of the block to be placed (already handled by onBlockPlaced)
|
||||
int currentMeta = world.getBlockMetadata(x, y, z); // Metadata of the block being placed
|
||||
|
||||
// Check if the block above is a chain block and if the metadata matches
|
||||
if (blockAbove instanceof CinderChain) {
|
||||
if (metaAbove != currentMeta) {
|
||||
return false; // Prevent placement of different types of chains
|
||||
}
|
||||
return true; // Same type, allow placement
|
||||
}
|
||||
|
||||
// Other checks for fences, walls, slabs, etc.
|
||||
if (blockAbove instanceof BlockFence || blockAbove instanceof BlockWall) {
|
||||
return true;
|
||||
}
|
||||
if (blockAbove instanceof BlockSlab && !blockAbove.isOpaqueCube() && (metaAbove & 8) == 0) {
|
||||
return true;
|
||||
}
|
||||
if (blockAbove instanceof BlockStairs && (metaAbove & 4) == 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check if the block above is solid on the bottom
|
||||
return blockAbove.isSideSolid(world, x, y + 1, z, ForgeDirection.DOWN);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,64 @@
|
||||
package com.zivilon.cinder_loe.blocks;
|
||||
|
||||
import com.zivilon.cinder_loe.LoECreativeTabs;
|
||||
import com.zivilon.cinder_loe.util.Utilities;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import lotr.common.LOTRCreativeTabs;
|
||||
import lotr.common.block.LOTRBlockBrickBase;
|
||||
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.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.List;
|
||||
|
||||
public class CinderFurBlock extends Block {
|
||||
protected IIcon[] brickIcons;
|
||||
protected String[] brickNames;
|
||||
|
||||
|
||||
public CinderFurBlock() {
|
||||
super(Material.cloth);
|
||||
this.setCreativeTab(LoECreativeTabs.tabBlockLoE);
|
||||
setBlockTextureName("lotr:cinderfur");
|
||||
setBlockName("lotr:cinderfur");
|
||||
setStepSound(Block.soundTypeCloth);
|
||||
this.setBrickNames("brown", "gray", "black", "white", "obsidian", "bearblack", "bearbrown", "lion", "lioness");
|
||||
}
|
||||
|
||||
protected void setBrickNames(String ... names) {
|
||||
this.brickNames = names;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister iconregister) {
|
||||
this.brickIcons = new IIcon[this.brickNames.length];
|
||||
for (int i = 0; i < this.brickNames.length; ++i) {
|
||||
String texturePath = this.getTextureName() + "_" + this.brickNames[i];
|
||||
System.out.println("Registering texture: " + texturePath); // Debug log
|
||||
this.brickIcons[i] = iconregister.registerIcon(texturePath);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return this.brickIcons[meta];
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int meta) {
|
||||
return meta;
|
||||
}
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, List list) {
|
||||
for (int i = 0; i < this.brickNames.length; ++i) {
|
||||
list.add(new ItemStack(item, 1, i));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,47 +0,0 @@
|
||||
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,45 @@
|
||||
package com.zivilon.cinder_loe.blocks;
|
||||
|
||||
import com.zivilon.cinder_loe.CinderLoE;
|
||||
import com.zivilon.cinder_loe.LoECreativeTabs;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockCarpet;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class FurCarpet extends BlockCarpet {
|
||||
public FurCarpet()
|
||||
{
|
||||
super();
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.0625F, 1.0F);
|
||||
this.setTickRandomly(true);
|
||||
this.setCreativeTab(LoECreativeTabs.tabDecoLoE);
|
||||
this.func_150089_b(0);
|
||||
setBlockName("lotr:cinderfurcarpet");
|
||||
setStepSound(Block.soundTypeCloth);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta)
|
||||
{
|
||||
return CinderLoE.cinderfur.getIcon(side, meta);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item itemIn, CreativeTabs tab, List list)
|
||||
{
|
||||
for (int i = 0; i < 9; ++i)
|
||||
{
|
||||
list.add(new ItemStack(itemIn, 1, i));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,200 +0,0 @@
|
||||
package com.zivilon.cinder_loe.blocks;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@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.emptyIcon;
|
||||
}
|
||||
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 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);
|
||||
}
|
||||
}
|
||||
@ -1,44 +0,0 @@
|
||||
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 cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
public class ShadowTile extends BlockPressurePlate {
|
||||
|
||||
public ShadowTile() {
|
||||
super("lotr:shadow_tile", Material.rock, BlockPressurePlate.Sensitivity.players);
|
||||
try {
|
||||
Field tabField = LOTRCreativeTabs.class.getDeclaredField("tabMisc"); // Stupid workaround because ForgeGradle tries to obfuscate field LOTRCreativeTabs.tabBlock when it's not supposed to
|
||||
LOTRCreativeTabs tab = (LOTRCreativeTabs)tabField.get(null);
|
||||
setCreativeTab((CreativeTabs)tab);
|
||||
} catch (NoSuchFieldException | IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
setBlockTextureName("lotr:shadow_tile");
|
||||
setBlockName("lotr:shadowTile");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) {
|
||||
if (entity instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer)entity;
|
||||
player.attackEntityFrom(new DamageSource("shadow"), 10.0F);
|
||||
player.addPotionEffect(new PotionEffect(15, 6*20, 0, false));
|
||||
world.setBlockToAir(x, y, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,200 +0,0 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
@ -1,134 +0,0 @@
|
||||
package lotr.client.render.entity;
|
||||
|
||||
import com.zivilon.cinder_loe.client.model.ModelNex;
|
||||
import com.zivilon.cinder_loe.entity.Nex;
|
||||
import lotr.common.entity.LOTRRandomSkinEntity;
|
||||
import lotr.common.entity.npc.LOTREntityBalrog;
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,76 +0,0 @@
|
||||
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
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glPopMatrix();
|
||||
|
||||
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,50 @@
|
||||
package com.zivilon.cinder_loe.enchants;
|
||||
|
||||
import lotr.common.enchant.LOTREnchantmentProtectionRanged;
|
||||
import lotr.common.enchant.LOTREnchantmentProtectionSpecial;
|
||||
import lotr.common.item.LOTRMaterial;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemArmor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
public class LOTREnchantmentWeakProtectionRanged extends LOTREnchantmentProtectionSpecial {
|
||||
|
||||
public LOTREnchantmentWeakProtectionRanged(String s, int level) {
|
||||
super(s, level);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription(ItemStack itemstack) {
|
||||
return StatCollector.translateToLocalFormatted((String)"lotr.enchant.protectRanged.desc", (Object[])new Object[]{this.formatAdditiveInt(this.calcIntProtection())});
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canApply(ItemStack itemstack, boolean considering) {
|
||||
if (super.canApply(itemstack, considering)) {
|
||||
Item item = itemstack.getItem();
|
||||
return !(item instanceof ItemArmor) || ((ItemArmor)item).getArmorMaterial() != LOTRMaterial.GALVORN.toArmorMaterial();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isBeneficial() {
|
||||
// This enchantment is detrimental, so return false
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean protectsAgainst(DamageSource damageSource) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int calcIntProtection() {
|
||||
return this.protectLevel;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,117 +0,0 @@
|
||||
package com.zivilon.cinder_loe.entity;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import lotr.common.entity.ai.LOTREntityAIAttackOnCollide;
|
||||
import lotr.common.entity.npc.LOTREntityNPC;
|
||||
import lotr.common.fac.LOTRFaction;
|
||||
|
||||
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.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.util.DamageSource;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
|
||||
import com.zivilon.cinder_loe.CinderLoE;
|
||||
|
||||
public class Nex extends LOTREntityNPC {
|
||||
public AxisAlignedBB collisionBox;
|
||||
public AxisAlignedBB hitbox;
|
||||
public int phase = 1;
|
||||
public ChunkCoordinates currentFlightTarget;
|
||||
public EntityPlayer playerTarget;
|
||||
|
||||
public Nex(World world) {
|
||||
super(world);
|
||||
setSize(1.5F, 3.0F);
|
||||
((EntityLiving) this).tasks.addTask(2, (EntityAIBase) new LOTREntityAIAttackOnCollide(this, 1.3D, false));
|
||||
((EntityLiving) this).tasks.addTask(5, (EntityAIBase) new EntityAIWander(this, 1.0D));
|
||||
((EntityLiving) this).tasks.addTask(9, (EntityAIBase) new EntityAILookIdle((EntityLiving) this));
|
||||
addTargetTasks(true);
|
||||
}
|
||||
|
||||
protected void entityInit() {
|
||||
super.entityInit();
|
||||
this.dataWatcher.addObject(31, Integer.valueOf(0));
|
||||
}
|
||||
|
||||
protected void applyEntityAttributes() {
|
||||
super.applyEntityAttributes();
|
||||
getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(1000.0D);
|
||||
getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.2D);
|
||||
}
|
||||
|
||||
public int getPhase() {
|
||||
return this.dataWatcher.getWatchableObjectInt(31);
|
||||
}
|
||||
public void setPhase(int i) {
|
||||
this.dataWatcher.updateObject(31, Integer.valueOf(i));
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
public void onLivingUpdate() {
|
||||
super.onLivingUpdate();
|
||||
if (rand.nextBoolean())
|
||||
((Entity)this).worldObj.spawnParticle("chill", ((Entity)this).posX + (rand.nextDouble() - 0.5D) * ((Entity)this).width, ((Entity)this).posY + rand.nextDouble() * ((Entity)this).height, ((Entity)this).posZ + (rand.nextDouble() - 0.5D) * ((Entity)this).width, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
|
||||
protected void dropFewItems(boolean flag, int i) {
|
||||
return;
|
||||
}
|
||||
|
||||
protected String getHurtSound() {
|
||||
return "lotr:wight.hurt";
|
||||
}
|
||||
|
||||
protected String getDeathSound() {
|
||||
return "lotr:wight.death";
|
||||
}
|
||||
|
||||
public void attackEntityWithRangedAttack(EntityLivingBase target, float distanceFactor) {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickedResult(MovingObjectPosition target) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -1,102 +0,0 @@
|
||||
package com.zivilon.cinder_loe.entity;
|
||||
|
||||
import com.zivilon.cinder_loe.CinderLoE;
|
||||
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.IRangedAttackMob;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.ai.EntityAIBase;
|
||||
import net.minecraft.entity.ai.EntityAILookIdle;
|
||||
import net.minecraft.entity.ai.EntityAIOpenDoor;
|
||||
import net.minecraft.entity.ai.EntityAISwimming;
|
||||
import net.minecraft.entity.ai.EntityAIWander;
|
||||
import net.minecraft.entity.ai.EntityAIWatchClosest;
|
||||
import net.minecraft.entity.ai.EntityAIWatchClosest2;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import lotr.common.LOTRFoods;
|
||||
import lotr.common.LOTRMod;
|
||||
import lotr.common.entity.ai.LOTREntityAIAttackOnCollide;
|
||||
import lotr.common.entity.ai.LOTREntityAIDrink;
|
||||
import lotr.common.entity.ai.LOTREntityAIEat;
|
||||
import lotr.common.entity.ai.LOTREntityAIFollowHiringPlayer;
|
||||
import lotr.common.entity.ai.LOTREntityAIHiredRemainStill;
|
||||
import lotr.common.entity.animal.LOTREntityHorse;
|
||||
import lotr.common.entity.npc.LOTREntityMan;
|
||||
import lotr.common.entity.npc.LOTREntityNPC;
|
||||
import lotr.common.entity.npc.LOTRNPCMount;
|
||||
import lotr.common.entity.npc.LOTRNames;
|
||||
import lotr.common.fac.LOTRFaction;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class NexShadow extends LOTREntityMan {
|
||||
String entity_name = "§7Fuinë";
|
||||
|
||||
public NexShadow(World world) {
|
||||
super(world);
|
||||
setSize(0.6F, 1.8F);
|
||||
((EntityLiving) this).tasks.addTask(2, (EntityAIBase) new LOTREntityAIAttackOnCollide(this, 1.3D, false));
|
||||
((EntityLiving) this).tasks.addTask(7, (EntityAIBase) new EntityAIWatchClosest2((EntityLiving) this, EntityPlayer.class, 8.0F, 0.02F));
|
||||
((EntityLiving) this).tasks.addTask(7, (EntityAIBase) new EntityAIWatchClosest2((EntityLiving) this, LOTREntityNPC.class, 5.0F, 0.02F));
|
||||
((EntityLiving) this).tasks.addTask(8, (EntityAIBase) new EntityAIWatchClosest((EntityLiving) this, EntityLiving.class, 8.0F, 0.02F));
|
||||
((EntityLiving) this).tasks.addTask(9, (EntityAIBase) new EntityAILookIdle((EntityLiving) this));
|
||||
addTargetTasks(true);
|
||||
}
|
||||
|
||||
public void attackEntityWithRangedAttack(EntityLivingBase target, float distanceFactor) {
|
||||
}
|
||||
|
||||
public void setupNPCGender() {
|
||||
this.familyInfo.setMale(true);
|
||||
}
|
||||
|
||||
protected void applyEntityAttributes() {
|
||||
super.applyEntityAttributes();
|
||||
getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(200.0D);
|
||||
getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.2D);
|
||||
}
|
||||
|
||||
public LOTRFaction getFaction() {
|
||||
return LOTRFaction.UTUMNO;
|
||||
}
|
||||
|
||||
public String getNPCName() {
|
||||
return entity_name;
|
||||
}
|
||||
|
||||
public String getNPCFormattedName(String npcName, String entityName) {
|
||||
return entity_name;
|
||||
}
|
||||
|
||||
protected void onAttackModeChange(LOTREntityNPC.AttackMode mode, boolean mounted) {
|
||||
}
|
||||
|
||||
protected void dropFewItems(boolean flag, int i) {
|
||||
}
|
||||
|
||||
public boolean getCanSpawnHere() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public String getSpeechBank(EntityPlayer entityplayer) {
|
||||
return "nex/shadow";
|
||||
}
|
||||
|
||||
public void setupNPCName() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickedResult(MovingObjectPosition target) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,97 @@
|
||||
package com.zivilon.cinder_loe.entity.ai;
|
||||
|
||||
import lotr.common.entity.ai.LOTREntityAIAttackOnCollide;
|
||||
import lotr.common.entity.npc.LOTREntityNPC;
|
||||
import lotr.common.entity.projectile.LOTREntitySpear;
|
||||
import lotr.common.item.LOTRItemSpear;
|
||||
import lotr.common.item.LOTRWeaponStats;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityCreature;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.pathfinding.PathEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class LoEPreciseAttackOnCollide extends LOTREntityAIAttackOnCollide {
|
||||
public double attack_range;
|
||||
public int attack_cooldown;
|
||||
|
||||
public LoEPreciseAttackOnCollide(EntityCreature entity, double speed, double reach, int delay, boolean flag) {
|
||||
super(entity, speed, flag);
|
||||
attack_range = reach;
|
||||
attack_cooldown = delay;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTask() {
|
||||
updateLookAndPathing();
|
||||
if (this.attackTick > 0)
|
||||
this.attackTick--;
|
||||
ItemStack weapon = this.theOwner.getHeldItem();
|
||||
|
||||
// Throw a throwing spear if available
|
||||
if (weapon != null && weapon.getItem() instanceof LOTRItemSpear && this.attackTick <= 0 && this.theOwner instanceof LOTREntityNPC) {
|
||||
LOTREntityNPC theNPC = (LOTREntityNPC)this.theOwner;
|
||||
ItemStack spearBackup = theNPC.npcItemsInv.getSpearBackup();
|
||||
|
||||
if (spearBackup != null) {
|
||||
LOTRItemSpear spearItem = (LOTRItemSpear)weapon.getItem();
|
||||
double d = this.theOwner.getDistanceToEntity((Entity)this.attackTarget);
|
||||
double range = this.theOwner.getNavigator().getPathSearchRange();
|
||||
if (d > 5.0D && d < range * 0.75D) {
|
||||
LOTREntitySpear spear = new LOTREntitySpear(this.worldObj, (EntityLivingBase)this.theOwner, this.attackTarget, weapon.copy(), 0.75F + (float)d * 0.025F, 0.5F);
|
||||
this.worldObj.playSoundAtEntity((Entity)this.theOwner, "random.bow", 1.0F, 1.0F / (this.worldObj.rand.nextFloat() * 0.4F + 1.2F) + 0.25F);
|
||||
this.worldObj.spawnEntityInWorld((Entity)spear);
|
||||
this.attackTick = 30 + this.theOwner.getRNG().nextInt(20);
|
||||
if (ItemStack.areItemStacksEqual(theNPC.npcItemsInv.getIdleItem(), theNPC.npcItemsInv.getMeleeWeapon()))
|
||||
theNPC.npcItemsInv.setIdleItem(spearBackup);
|
||||
theNPC.npcItemsInv.setMeleeWeapon(spearBackup);
|
||||
theNPC.npcItemsInv.setSpearBackup(null);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
float weaponReach = 1.0F;
|
||||
if (this.theOwner.ridingEntity != null)
|
||||
weaponReach = LOTREntityNPC.MOUNT_RANGE_BONUS;
|
||||
if (weapon == null) {
|
||||
weaponReach = (float)attack_range;
|
||||
} else {
|
||||
weaponReach *= LOTRWeaponStats.getMeleeReachFactor(weapon);
|
||||
}
|
||||
|
||||
float meleeRange = (float)this.theOwner.boundingBox.getAverageEdgeLength() + weaponReach;
|
||||
double distanceSq = this.theOwner.getDistanceSqToEntity((Entity)this.attackTarget);
|
||||
|
||||
if (distanceSq <= (meleeRange * meleeRange) || this.theOwner.boundingBox.intersectsWith(this.attackTarget.boundingBox)) {
|
||||
if (this.attackTick <= 0) {
|
||||
this.attackTick = (weapon == null) ? attack_cooldown : LOTRWeaponStats.getAttackTimeMob(weapon); // Apply cooldown here
|
||||
this.theOwner.attackEntityAsMob((Entity)this.attackTarget);
|
||||
this.theOwner.swingItem();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateLookAndPathing() {
|
||||
this.theOwner.getLookHelper().setLookPositionWithEntity((Entity)this.attackTarget, 30.0F, 30.0F);
|
||||
if (this.theOwner.riddenByEntity != null && this.theOwner.riddenByEntity instanceof EntityLiving) {
|
||||
((EntityLiving)this.theOwner.riddenByEntity).rotationYaw = this.theOwner.rotationYaw;
|
||||
((EntityLiving)this.theOwner.riddenByEntity).rotationYawHead = this.theOwner.rotationYawHead;
|
||||
}
|
||||
if ((this.sightNotRequired || this.theOwner.getEntitySenses().canSee((Entity)this.attackTarget)) && --this.pathCheckTimer <= 0) {
|
||||
this.pathCheckTimer = 2;
|
||||
PathEntity path = getPathEntity();
|
||||
if (path != null)
|
||||
this.theOwner.getNavigator().setPath(path, this.moveSpeed);
|
||||
}
|
||||
}
|
||||
|
||||
public PathEntity getPathEntity() {
|
||||
if (this.theOwner.ridingEntity != null)
|
||||
return this.worldObj.getPathEntityToEntity((Entity)this.theOwner, (Entity)this.attackTarget, this.theOwner.getNavigator().getPathSearchRange(), true, this.theOwner.getNavigator().getCanBreakDoors(), this.theOwner.getNavigator().getAvoidsWater(), false);
|
||||
return this.theOwner.getNavigator().getPathToEntityLiving((Entity)this.attackTarget);
|
||||
}
|
||||
}
|
||||
@ -1,52 +0,0 @@
|
||||
package com.zivilon.cinder_loe.entity.npc;
|
||||
|
||||
import com.zivilon.cinder_loe.CinderLoE;
|
||||
|
||||
import lotr.common.LOTRMod;
|
||||
import lotr.common.LOTRShields;
|
||||
import lotr.common.entity.npc.LOTREntityDwarfWarrior;
|
||||
import net.minecraft.entity.IEntityLivingData;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class DwarfLevy extends LOTREntityDwarfWarrior {
|
||||
|
||||
private static ItemStack[] levyWeapons = new ItemStack[]{new ItemStack(LOTRMod.daggerDwarven), new ItemStack(LOTRMod.daggerDwarvenPoisoned), new ItemStack(LOTRMod.swordDwarven), new ItemStack(LOTRMod.axeDwarven), new ItemStack(LOTRMod.battleaxeDwarven), new ItemStack(LOTRMod.hammerDwarven), new ItemStack(Items.iron_axe), new ItemStack(LOTRMod.battleaxeIron), new ItemStack(LOTRMod.spearDwarven), new ItemStack(LOTRMod.spearIron)};
|
||||
private static ItemStack[] levySpears = new ItemStack[]{new ItemStack(LOTRMod.spearDwarven), new ItemStack(LOTRMod.spearIron)};
|
||||
private static ItemStack[] levyBodies = new ItemStack[]{new ItemStack(Items.leather_chestplate), new ItemStack(LOTRMod.bodyDaleGambeson)};
|
||||
private static ItemStack[] levyLegs = new ItemStack[]{new ItemStack(Items.leather_leggings), new ItemStack(Items.iron_leggings)};
|
||||
private static ItemStack[] levyBoots = new ItemStack[]{new ItemStack(Items.leather_boots), new ItemStack(LOTRMod.bootsBronze), null};
|
||||
private static final int[] colors = new int[]{14823729, 5512477, 14196753, 11374145, 7366222};
|
||||
|
||||
public DwarfLevy(World world) {
|
||||
super(world);
|
||||
this.npcShield = null;
|
||||
}
|
||||
|
||||
public IEntityLivingData onSpawnWithEgg(IEntityLivingData data) {
|
||||
data = super.onSpawnWithEgg(data);
|
||||
int i = (this).rand.nextInt(levyWeapons.length);
|
||||
this.npcItemsInv.setMeleeWeapon(levyWeapons[i].copy());
|
||||
this.npcItemsInv.setIdleItem(this.npcItemsInv.getMeleeWeapon());
|
||||
if ((this).rand.nextInt(5) == 0) {
|
||||
this.npcItemsInv.setSpearBackup(this.npcItemsInv.getMeleeWeapon());
|
||||
i = (this).rand.nextInt(levySpears.length);
|
||||
this.npcItemsInv.setMeleeWeapon(levySpears[i].copy());
|
||||
}
|
||||
i = (this).rand.nextInt(levyBoots.length);
|
||||
this.setCurrentItemOrArmor(1, levyBoots[i].copy());
|
||||
i = (this).rand.nextInt(levyLegs.length);
|
||||
this.setCurrentItemOrArmor(2, levyLegs[i].copy());
|
||||
i = (this).rand.nextInt(levyBodies.length);
|
||||
this.setCurrentItemOrArmor(3, levyBodies[i].copy());
|
||||
this.setCurrentItemOrArmor(4, null);
|
||||
return data;
|
||||
}
|
||||
@Override
|
||||
public ItemStack getPickedResult(MovingObjectPosition target) {
|
||||
return new ItemStack(CinderLoE.spawnEgg, 1, 24);
|
||||
}
|
||||
}
|
||||
@ -1,60 +0,0 @@
|
||||
package com.zivilon.cinder_loe.entity.npc;
|
||||
|
||||
import com.zivilon.cinder_loe.CinderLoE;
|
||||
|
||||
import lotr.common.LOTRMod;
|
||||
import lotr.common.LOTRShields;
|
||||
import lotr.common.entity.npc.LOTREntityBreeGuard;
|
||||
import lotr.common.entity.npc.LOTREntityNearHaradrim;
|
||||
import lotr.common.item.LOTRItemHaradRobes;
|
||||
import net.minecraft.entity.IEntityLivingData;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
|
||||
public class HaradLevy extends LOTREntityNearHaradrim {
|
||||
private static ItemStack[] levyWeapons = new ItemStack[]{new ItemStack(LOTRMod.daggerHarad), new ItemStack(LOTRMod.daggerHaradPoisoned), new ItemStack(LOTRMod.swordHarad), new ItemStack(LOTRMod.swordMoredain), new ItemStack(LOTRMod.battleaxeBronze), new ItemStack(LOTRMod.maceNearHarad), new ItemStack(Items.iron_sword), new ItemStack(LOTRMod.swordBronze), new ItemStack(LOTRMod.battleaxeIron), new ItemStack(LOTRMod.poleaxeNearHarad), new ItemStack(LOTRMod.spearHarad), new ItemStack(LOTRMod.spearIron), new ItemStack(LOTRMod.spearBronze)};
|
||||
private static ItemStack[] levySpears = new ItemStack[]{new ItemStack(LOTRMod.spearHarad), new ItemStack(LOTRMod.spearIron), new ItemStack(LOTRMod.spearBronze)};
|
||||
private static ItemStack[] levyBodies = new ItemStack[]{new ItemStack(Items.leather_chestplate), new ItemStack(LOTRMod.bodyBronze), new ItemStack(LOTRMod.bodyHaradRobes)};
|
||||
private static ItemStack[] levyLegs = new ItemStack[]{new ItemStack(Items.leather_leggings), new ItemStack(LOTRMod.legsBronze)};
|
||||
private static ItemStack[] levyBoots = new ItemStack[]{new ItemStack(Items.leather_boots), new ItemStack(LOTRMod.bootsBronze), null};
|
||||
private static final int[] colors = new int[]{14823729, 5512477, 14196753, 11374145, 7366222};
|
||||
|
||||
public HaradLevy(World world) {
|
||||
super(world);
|
||||
this.spawnRidingHorse = false;
|
||||
this.addTargetTasks(true);
|
||||
this.npcShield = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setupNPCGender() {
|
||||
this.familyInfo.setMale(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEntityLivingData onSpawnWithEgg(IEntityLivingData data) {
|
||||
data = super.onSpawnWithEgg(data);
|
||||
int i = (this).rand.nextInt(levyWeapons.length);
|
||||
this.npcItemsInv.setMeleeWeapon(levyWeapons[i].copy());
|
||||
this.npcItemsInv.setIdleItem(this.npcItemsInv.getMeleeWeapon());
|
||||
if ((this).rand.nextInt(5) == 0) {
|
||||
this.npcItemsInv.setSpearBackup(this.npcItemsInv.getMeleeWeapon());
|
||||
i = (this).rand.nextInt(levySpears.length);
|
||||
this.npcItemsInv.setMeleeWeapon(levySpears[i].copy());
|
||||
}
|
||||
i = (this).rand.nextInt(levyBoots.length);
|
||||
this.setCurrentItemOrArmor(1, levyBoots[i].copy());
|
||||
i = (this).rand.nextInt(levyLegs.length);
|
||||
this.setCurrentItemOrArmor(2, levyLegs[i].copy());
|
||||
i = (this).rand.nextInt(levyBodies.length);
|
||||
this.setCurrentItemOrArmor(3, levyBodies[i].copy());
|
||||
this.setCurrentItemOrArmor(4, null);
|
||||
return data;
|
||||
}
|
||||
@Override
|
||||
public ItemStack getPickedResult(MovingObjectPosition target) {
|
||||
return new ItemStack(CinderLoE.spawnEgg, 1, 25);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,29 @@
|
||||
package com.zivilon.cinder_loe.entity.npc;
|
||||
|
||||
import com.zivilon.cinder_loe.CinderLoE;
|
||||
import lotr.common.entity.npc.LOTRBannerBearer;
|
||||
import lotr.common.entity.npc.LOTREntityHobbitBounder;
|
||||
import lotr.common.item.LOTRItemBanner;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class HobbitBannerBearer extends LOTREntityHobbitBounder implements LOTRBannerBearer {
|
||||
public HobbitBannerBearer(World world) {
|
||||
super(world);
|
||||
}
|
||||
@Override
|
||||
public LOTRItemBanner.BannerType getBannerType() {
|
||||
return LOTRItemBanner.BannerType.HOBBIT;
|
||||
}
|
||||
@Override
|
||||
public ItemStack getPickedResult(MovingObjectPosition target) {
|
||||
return new ItemStack(CinderLoE.spawnEgg, 1, 16);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void attackEntityWithRangedAttack(EntityLivingBase p_82196_1_, float p_82196_2_) {
|
||||
|
||||
}
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
package com.zivilon.cinder_loe.entity.npc;
|
||||
package com.zivilon.cinder_loe.entity.npc.dwarf;
|
||||
|
||||
import com.zivilon.cinder_loe.CinderLoE;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
package com.zivilon.cinder_loe.entity.npc;
|
||||
package com.zivilon.cinder_loe.entity.npc.dwarf;
|
||||
|
||||
import com.zivilon.cinder_loe.CinderLoE;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
package com.zivilon.cinder_loe.entity.npc;
|
||||
package com.zivilon.cinder_loe.entity.npc.dwarf;
|
||||
|
||||
import com.zivilon.cinder_loe.CinderLoE;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
package com.zivilon.cinder_loe.entity.npc;
|
||||
package com.zivilon.cinder_loe.entity.npc.dwarf;
|
||||
|
||||
import com.zivilon.cinder_loe.CinderLoE;
|
||||
|
||||
@ -0,0 +1,82 @@
|
||||
package com.zivilon.cinder_loe.entity.npc.elf;
|
||||
|
||||
import com.zivilon.cinder_loe.CinderLoE;
|
||||
import lotr.common.LOTRAchievement;
|
||||
import lotr.common.LOTRMod;
|
||||
import lotr.common.LOTRShields;
|
||||
import lotr.common.entity.ai.LOTREntityAIAttackOnCollide;
|
||||
import lotr.common.entity.npc.LOTREntityHighElf;
|
||||
import lotr.common.entity.npc.LOTREntityHighElfWarrior;
|
||||
import lotr.common.entity.npc.LOTREntityMoredain;
|
||||
import lotr.common.entity.npc.LOTRNPCMount;
|
||||
import net.minecraft.entity.IEntityLivingData;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.ai.EntityAIBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
|
||||
public class Sirrandrai extends LOTREntityHighElfWarrior {
|
||||
public Sirrandrai(World world) {
|
||||
super(world);
|
||||
this.tasks.addTask(2, this.meleeAttackAI);
|
||||
this.spawnRidingHorse = this.rand.nextInt(4) == 0;
|
||||
this.npcShield = LOTRShields.ALIGNMENT_HIGH_ELF;
|
||||
}
|
||||
@Override
|
||||
protected EntityAIBase createElfMeleeAttackAI() {
|
||||
return new LOTREntityAIAttackOnCollide(this, 1.5, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected EntityAIBase createElfRangedAttackAI() {
|
||||
return this.createElfMeleeAttackAI();
|
||||
}
|
||||
@Override
|
||||
protected void applyEntityAttributes() {
|
||||
super.applyEntityAttributes();
|
||||
this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(24.0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEntityLivingData onSpawnWithEgg(IEntityLivingData data) {
|
||||
data = super.onSpawnWithEgg(data);
|
||||
int i = this.rand.nextInt(2);
|
||||
if (i == 0) {
|
||||
this.npcItemsInv.setMeleeWeapon(new ItemStack(LOTRMod.polearmHighElven));
|
||||
if (this.rand.nextInt(5) == 0) {
|
||||
this.npcItemsInv.setSpearBackup(this.npcItemsInv.getMeleeWeapon());
|
||||
this.npcItemsInv.setMeleeWeapon(new ItemStack(LOTRMod.spearHighElven));
|
||||
}
|
||||
} else if (i == 1) {
|
||||
this.npcItemsInv.setMeleeWeapon(new ItemStack(LOTRMod.spearHighElven));
|
||||
this.npcItemsInv.setSpearBackup(null);
|
||||
}
|
||||
this.npcItemsInv.setIdleItem(this.npcItemsInv.getMeleeWeapon());
|
||||
this.npcItemsInv.setRangedWeapon(this.npcItemsInv.getMeleeWeapon());
|
||||
this.setCurrentItemOrArmor(1, new ItemStack(LOTRMod.bootsHighElven));
|
||||
this.setCurrentItemOrArmor(2, new ItemStack(LOTRMod.legsHighElven));
|
||||
this.setCurrentItemOrArmor(3, new ItemStack(LOTRMod.bodyHighElven));
|
||||
this.setCurrentItemOrArmor(4, new ItemStack(LOTRMod.helmetHighElven));
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getAlignmentBonus() {
|
||||
return 3.0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSpeechBank(EntityPlayer entityplayer) {
|
||||
if (this.isFriendlyAndAligned(entityplayer)) {
|
||||
if (this.hiredNPCInfo.getHiringPlayer() == entityplayer) {
|
||||
return "highElf/elf/hired";
|
||||
}
|
||||
return "highElf/warrior/friendly";
|
||||
}
|
||||
return "highElf/warrior/hostile";
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
package com.zivilon.cinder_loe.entity.npc;
|
||||
package com.zivilon.cinder_loe.entity.npc.evil_human;
|
||||
|
||||
import com.zivilon.cinder_loe.CinderLoE;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
package com.zivilon.cinder_loe.entity.npc;
|
||||
package com.zivilon.cinder_loe.entity.npc.evil_human;
|
||||
|
||||
import com.zivilon.cinder_loe.CinderLoE;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
package com.zivilon.cinder_loe.entity.npc;
|
||||
package com.zivilon.cinder_loe.entity.npc.evil_human;
|
||||
|
||||
import com.zivilon.cinder_loe.CinderLoE;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
package com.zivilon.cinder_loe.entity.npc;
|
||||
package com.zivilon.cinder_loe.entity.npc.evil_human;
|
||||
|
||||
import com.zivilon.cinder_loe.CinderLoE;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
package com.zivilon.cinder_loe.entity.npc;
|
||||
package com.zivilon.cinder_loe.entity.npc.evil_human;
|
||||
|
||||
import com.zivilon.cinder_loe.CinderLoE;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
package com.zivilon.cinder_loe.entity.npc;
|
||||
package com.zivilon.cinder_loe.entity.npc.evil_human;
|
||||
|
||||
import com.zivilon.cinder_loe.CinderLoE;
|
||||
|
||||
@ -0,0 +1,44 @@
|
||||
package com.zivilon.cinder_loe.entity.npc.evil_human;
|
||||
|
||||
import com.zivilon.cinder_loe.CinderLoE;
|
||||
import lotr.common.LOTRMod;
|
||||
import lotr.common.LOTRShields;
|
||||
import lotr.common.entity.npc.LOTREntityAngmarHillmanWarrior;
|
||||
import net.minecraft.entity.IEntityLivingData;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
|
||||
public class RhudaurSoldier extends LOTREntityAngmarHillmanWarrior {
|
||||
|
||||
private static ItemStack[] weapons = new ItemStack[]{new ItemStack(LOTRMod.swordAngmar), new ItemStack(LOTRMod.battleaxeAngmar), new ItemStack(LOTRMod.hammerAngmar), new ItemStack(LOTRMod.polearmAngmar), new ItemStack(LOTRMod.spearAngmar)};
|
||||
private static ItemStack[] helmets = new ItemStack[]{new ItemStack(CinderLoE.helmetRhudaur)};
|
||||
private static ItemStack[] bodies = new ItemStack[]{new ItemStack(CinderLoE.bodyRhudaur)};
|
||||
private static ItemStack[] legs = new ItemStack[]{new ItemStack(CinderLoE.legsRhudaur)};
|
||||
private static ItemStack[] boots = new ItemStack[]{new ItemStack(CinderLoE.bootsRhudaur)};
|
||||
|
||||
public RhudaurSoldier(World world) {
|
||||
super(world);
|
||||
this.npcShield = LOTRShields.ALIGNMENT_MORDOR;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEntityLivingData onSpawnWithEgg(IEntityLivingData data) {
|
||||
data = super.onSpawnWithEgg(data);
|
||||
int i = this.rand.nextInt(weapons.length);
|
||||
this.npcItemsInv.setMeleeWeapon(weapons[i].copy());
|
||||
this.npcItemsInv.setIdleItem(this.npcItemsInv.getMeleeWeapon());
|
||||
i = this.rand.nextInt(boots.length);
|
||||
this.setCurrentItemOrArmor(1, boots[i].copy());
|
||||
i = this.rand.nextInt(legs.length);
|
||||
this.setCurrentItemOrArmor(2, legs[i].copy());
|
||||
i = this.rand.nextInt(bodies.length);
|
||||
this.setCurrentItemOrArmor(3, bodies[i].copy());
|
||||
if (this.rand.nextInt(5) != 0) {
|
||||
i = this.rand.nextInt(helmets.length);
|
||||
this.setCurrentItemOrArmor(4, helmets[i].copy());
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
package com.zivilon.cinder_loe.entity.npc;
|
||||
package com.zivilon.cinder_loe.entity.npc.good_human;
|
||||
|
||||
import com.zivilon.cinder_loe.CinderLoE;
|
||||
import lotr.common.entity.npc.LOTRBannerBearer;
|
||||
@ -1,4 +1,4 @@
|
||||
package com.zivilon.cinder_loe.entity.npc;
|
||||
package com.zivilon.cinder_loe.entity.npc.good_human;
|
||||
|
||||
import com.zivilon.cinder_loe.CinderLoE;
|
||||
import lotr.common.LOTRCapes;
|
||||
@ -1,4 +1,4 @@
|
||||
package com.zivilon.cinder_loe.entity.npc;
|
||||
package com.zivilon.cinder_loe.entity.npc.good_human;
|
||||
|
||||
import lotr.common.entity.ai.LOTREntityAIAttackOnCollide;
|
||||
import lotr.common.entity.npc.LOTREntityDunedain;
|
||||
@ -1,4 +1,4 @@
|
||||
package com.zivilon.cinder_loe.entity.npc;
|
||||
package com.zivilon.cinder_loe.entity.npc.good_human;
|
||||
|
||||
import com.zivilon.cinder_loe.CinderLoE;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
package com.zivilon.cinder_loe.entity.npc;
|
||||
package com.zivilon.cinder_loe.entity.npc.good_human;
|
||||
|
||||
import com.zivilon.cinder_loe.CinderLoE;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
package com.zivilon.cinder_loe.entity.npc;
|
||||
package com.zivilon.cinder_loe.entity.npc.good_human;
|
||||
|
||||
import com.zivilon.cinder_loe.CinderLoE;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
package com.zivilon.cinder_loe.entity.npc;
|
||||
package com.zivilon.cinder_loe.entity.npc.good_human;
|
||||
|
||||
import com.zivilon.cinder_loe.CinderLoE;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
package com.zivilon.cinder_loe.entity.npc;
|
||||
package com.zivilon.cinder_loe.entity.npc.good_human;
|
||||
|
||||
import com.zivilon.cinder_loe.CinderLoE;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
package com.zivilon.cinder_loe.entity.npc;
|
||||
package com.zivilon.cinder_loe.entity.npc.good_human;
|
||||
|
||||
import com.zivilon.cinder_loe.CinderLoE;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
package com.zivilon.cinder_loe.entity.npc;
|
||||
package com.zivilon.cinder_loe.entity.npc.good_human;
|
||||
|
||||
import com.zivilon.cinder_loe.CinderLoE;
|
||||
|
||||
@ -0,0 +1,23 @@
|
||||
package com.zivilon.cinder_loe.entity.npc.good_human;
|
||||
|
||||
import com.zivilon.cinder_loe.CinderLoE;
|
||||
import lotr.common.LOTRMod;
|
||||
import lotr.common.LOTRShields;
|
||||
import lotr.common.entity.npc.LOTREntityDaleSoldier;
|
||||
import lotr.common.entity.npc.LOTREntityDunedain;
|
||||
import lotr.common.fac.LOTRFaction;
|
||||
import lotr.common.quest.LOTRMiniQuest;
|
||||
import lotr.common.quest.LOTRMiniQuestFactory;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.IEntityLivingData;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EsgarothSoldier extends LOTREntityDaleSoldier {
|
||||
public EsgarothSoldier(World world) {
|
||||
super(world);
|
||||
this.npcShield = LOTRShields.ALIGNMENT_ESGAROTH;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,54 @@
|
||||
package com.zivilon.cinder_loe.entity.npc.good_human;
|
||||
|
||||
import lotr.common.LOTRMod;
|
||||
import lotr.common.LOTRShields;
|
||||
import lotr.common.entity.ai.LOTREntityAIAttackOnCollide;
|
||||
import lotr.common.entity.npc.LOTREntityDaleSoldier;
|
||||
import lotr.common.entity.npc.LOTREntityTauredain;
|
||||
import net.minecraft.entity.IEntityLivingData;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.ai.EntityAIBase;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class TauredainTrueBlood extends LOTREntityTauredain {
|
||||
public TauredainTrueBlood(World world) {
|
||||
super(world);
|
||||
this.npcShield = LOTRShields.ALIGNMENT_TAUREDAIN;
|
||||
}
|
||||
@Override
|
||||
public EntityAIBase createHaradrimAttackAI() {
|
||||
return new LOTREntityAIAttackOnCollide(this, 1.7, false);
|
||||
}
|
||||
@Override
|
||||
protected void applyEntityAttributes() {
|
||||
super.applyEntityAttributes();
|
||||
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(26.0);
|
||||
this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(24.0);
|
||||
this.getEntityAttribute(npcAttackDamageExtra).setBaseValue(2.0);
|
||||
}
|
||||
|
||||
private static ItemStack[] weapons = new ItemStack[]{new ItemStack(LOTRMod.swordTauredain), new ItemStack(LOTRMod.battleaxeTauredain), new ItemStack(LOTRMod.hammerTauredain), new ItemStack(LOTRMod.spearTauredain), new ItemStack(LOTRMod.pikeTauredain)};
|
||||
private static ItemStack[] helmets = new ItemStack[]{new ItemStack(LOTRMod.helmetTauredainChieftain), new ItemStack(LOTRMod.helmetTauredainChieftain), new ItemStack(LOTRMod.helmetTauredainGold, 0)};
|
||||
private static ItemStack[] bodies = new ItemStack[]{new ItemStack(LOTRMod.bodyTauredain), new ItemStack(LOTRMod.bodyTauredain), new ItemStack(LOTRMod.bodyTauredainGold, 0)};
|
||||
private static ItemStack[] legs = new ItemStack[]{new ItemStack(LOTRMod.legsTauredain), new ItemStack(LOTRMod.legsTauredain), new ItemStack(LOTRMod.legsTauredainGold, 0)};
|
||||
private static ItemStack[] boots = new ItemStack[]{new ItemStack(LOTRMod.bootsTauredain), new ItemStack(LOTRMod.bootsTauredain), new ItemStack(LOTRMod.bootsTauredainGold, 0)};
|
||||
@Override
|
||||
public IEntityLivingData onSpawnWithEgg(IEntityLivingData data) {
|
||||
data = super.onSpawnWithEgg(data);
|
||||
int i = this.rand.nextInt(weapons.length);
|
||||
this.npcItemsInv.setMeleeWeapon(weapons[i].copy());
|
||||
this.npcItemsInv.setIdleItem(this.npcItemsInv.getMeleeWeapon());
|
||||
i = this.rand.nextInt(boots.length);
|
||||
this.setCurrentItemOrArmor(1, boots[i].copy());
|
||||
i = this.rand.nextInt(legs.length);
|
||||
this.setCurrentItemOrArmor(2, legs[i].copy());
|
||||
i = this.rand.nextInt(bodies.length);
|
||||
this.setCurrentItemOrArmor(3, bodies[i].copy());
|
||||
if (this.rand.nextInt(5) != 0) {
|
||||
i = this.rand.nextInt(helmets.length);
|
||||
this.setCurrentItemOrArmor(4, helmets[i].copy());
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
package com.zivilon.cinder_loe.entity.npc.orc;
|
||||
|
||||
import lotr.common.LOTRShields;
|
||||
import lotr.common.entity.npc.LOTREntityMordorOrc;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
|
||||
public class MorgulOrc extends LOTREntityMordorOrc {
|
||||
public MorgulOrc(World world) {
|
||||
super(world);
|
||||
this.npcShield = LOTRShields.ALIGNMENT_MINAS_MORGUL;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,74 @@
|
||||
package com.zivilon.cinder_loe.entity.npc.orc;
|
||||
|
||||
import com.zivilon.cinder_loe.CinderLoE;
|
||||
import lotr.common.LOTRLevelData;
|
||||
import lotr.common.LOTRMod;
|
||||
import lotr.common.LOTRShields;
|
||||
import lotr.common.entity.npc.LOTREntityAngmarHillmanWarrior;
|
||||
import lotr.common.entity.npc.LOTREntityGundabadUruk;
|
||||
import lotr.common.fac.LOTRFaction;
|
||||
import net.minecraft.entity.IEntityLivingData;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
|
||||
public class NorthernOrc extends LOTREntityGundabadUruk {
|
||||
|
||||
private static ItemStack[] weapons = new ItemStack[]{new ItemStack(LOTRMod.swordAngmar), new ItemStack(LOTRMod.battleaxeAngmar), new ItemStack(LOTRMod.hammerGundabadUruk), new ItemStack(LOTRMod.polearmAngmar), new ItemStack(LOTRMod.spearAngmar), new ItemStack(LOTRMod.swordGundabadUruk)};
|
||||
private static ItemStack[] helmets = new ItemStack[]{new ItemStack(LOTRMod.helmetAngmar), new ItemStack(LOTRMod.helmetGundabadUruk), new ItemStack(LOTRMod.helmetBone)};
|
||||
private static ItemStack[] bodies = new ItemStack[]{new ItemStack(LOTRMod.bodyAngmar), new ItemStack(LOTRMod.bodyGundabadUruk), new ItemStack(LOTRMod.bodyUruk)};
|
||||
private static ItemStack[] legs = new ItemStack[]{new ItemStack(LOTRMod.legsAngmar), new ItemStack(LOTRMod.legsGundabadUruk), new ItemStack(LOTRMod.legsUruk)};
|
||||
private static ItemStack[] boots = new ItemStack[]{new ItemStack(LOTRMod.bootsAngmar), new ItemStack(LOTRMod.bootsGundabadUruk), new ItemStack(LOTRMod.bootsUruk)};
|
||||
|
||||
public NorthernOrc(World world) {
|
||||
super(world);
|
||||
this.setSize(0.6f, 1.8f);
|
||||
this.isWeakOrc = false;
|
||||
this.npcShield = LOTRShields.ALIGNMENT_ANGMAR;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEntityLivingData onSpawnWithEgg(IEntityLivingData data) {
|
||||
data = super.onSpawnWithEgg(data);
|
||||
int i = this.rand.nextInt(weapons.length);
|
||||
this.npcItemsInv.setMeleeWeapon(weapons[i].copy());
|
||||
this.npcItemsInv.setIdleItem(this.npcItemsInv.getMeleeWeapon());
|
||||
i = this.rand.nextInt(boots.length);
|
||||
this.setCurrentItemOrArmor(1, boots[i].copy());
|
||||
i = this.rand.nextInt(legs.length);
|
||||
this.setCurrentItemOrArmor(2, legs[i].copy());
|
||||
i = this.rand.nextInt(bodies.length);
|
||||
this.setCurrentItemOrArmor(3, bodies[i].copy());
|
||||
if (this.rand.nextInt(5) != 0) {
|
||||
i = this.rand.nextInt(helmets.length);
|
||||
this.setCurrentItemOrArmor(4, helmets[i].copy());
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LOTRFaction getFaction() {
|
||||
return LOTRFaction.ANGMAR;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSpeechBank(EntityPlayer entityplayer) {
|
||||
if (this.isFriendlyAndAligned(entityplayer)) {
|
||||
if (this.hiredNPCInfo.getHiringPlayer() == entityplayer) {
|
||||
return "angmar/orc/hired";
|
||||
}
|
||||
if (LOTRLevelData.getData(entityplayer).getAlignment(this.getFaction()) >= 100.0f) {
|
||||
return "angmar/orc/friendly";
|
||||
}
|
||||
return "angmar/orc/neutral";
|
||||
}
|
||||
return "angmar/orc/hostile";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canOrcSkirmish() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
package com.zivilon.cinder_loe.entity.npc;
|
||||
package com.zivilon.cinder_loe.entity.npc.radagast;
|
||||
|
||||
import com.zivilon.cinder_loe.CinderLoE;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
package com.zivilon.cinder_loe.entity.npc;
|
||||
package com.zivilon.cinder_loe.entity.npc.radagast;
|
||||
|
||||
import com.zivilon.cinder_loe.CinderLoE;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
package com.zivilon.cinder_loe.entity.npc;
|
||||
package com.zivilon.cinder_loe.entity.npc.radagast;
|
||||
|
||||
import com.zivilon.cinder_loe.CinderLoE;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
package com.zivilon.cinder_loe.entity.npc;
|
||||
package com.zivilon.cinder_loe.entity.npc.radagast;
|
||||
|
||||
import com.zivilon.cinder_loe.CinderLoE;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
package com.zivilon.cinder_loe.entity.npc;
|
||||
package com.zivilon.cinder_loe.entity.npc.radagast;
|
||||
|
||||
import com.zivilon.cinder_loe.CinderLoE;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
package com.zivilon.cinder_loe.entity.npc;
|
||||
package com.zivilon.cinder_loe.entity.npc.radagast;
|
||||
|
||||
import com.zivilon.cinder_loe.CinderLoE;
|
||||
|
||||
@ -0,0 +1,56 @@
|
||||
package com.zivilon.cinder_loe.items;
|
||||
|
||||
import com.zivilon.cinder_loe.LoECreativeTabs;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class CinderFurItem extends Item {
|
||||
public IIcon[] icons;
|
||||
|
||||
public CinderFurItem() {
|
||||
super();
|
||||
this.setCreativeTab(LoECreativeTabs.tabMiscLoE);
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(IIconRegister iconRegister) {
|
||||
icons = new IIcon[7];
|
||||
for (int i = 0; i < 7; i++) {
|
||||
icons[i] = iconRegister.registerIcon("lotr:cinder_fur_item_" + i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack item) {
|
||||
return "item.cinder_fur_item_" + item.getItemDamage();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIconIndex(ItemStack item) {
|
||||
return getIcon(item, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(ItemStack stack, int renderPass) {
|
||||
int dmg = stack.getItemDamage();
|
||||
|
||||
// Ensure dmg is within the expected range of subtypes
|
||||
if (dmg < 7) {
|
||||
return icons[dmg];
|
||||
}
|
||||
return icons[0]; // Default to 0 if out of bounds
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems(Item item, CreativeTabs tab, List list) {
|
||||
for (int i = 0; i < 7; i++) {
|
||||
list.add(new ItemStack(item, 1, i));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,57 +0,0 @@
|
||||
package com.zivilon.cinder_loe.items;
|
||||
|
||||
import com.zivilon.cinder_loe.CinderLoE;
|
||||
import com.zivilon.cinder_loe.LoECreativeTabs;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import lotr.common.LOTRBannerProtection;
|
||||
import lotr.common.LOTRMod;
|
||||
import lotr.common.enchant.LOTREnchantment;
|
||||
import lotr.common.enchant.LOTREnchantmentHelper;
|
||||
import lotr.common.item.LOTRItemSword;
|
||||
import lotr.common.item.LOTRItemPolearm;
|
||||
import lotr.common.item.LOTRMaterial;
|
||||
import lotr.common.item.LOTRWeaponStats;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.EnumAction;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class FirstAgeGlaive extends LOTRItemPolearm {
|
||||
public FirstAgeGlaive() {
|
||||
super(CinderLoE.MATERIAL_NEX_ICE);
|
||||
this.lotrWeaponDamage = 11.5F;
|
||||
this.setUnlocalizedName("lotr:firstAgeGlaive");
|
||||
this.setTextureName("lotr:firstAgeGlaive");
|
||||
this.setCreativeTab(LoECreativeTabs.tabCombatLoE);
|
||||
LOTRWeaponStats.registerMeleeReach(FirstAgeGlaive.class, 1.8F);
|
||||
LOTRWeaponStats.registerMeleeSpeed(FirstAgeGlaive.class, 1.0F);
|
||||
}
|
||||
|
||||
public boolean getIsRepairable(ItemStack itemstack, ItemStack repairItem) {
|
||||
return (repairItem.getItem() == Item.getItemFromBlock(CinderLoE.enchantedIce));
|
||||
}
|
||||
|
||||
// private void checkIncompatibleModifiers(ItemStack itemstack) {}
|
||||
|
||||
public static UUID accessWeaponDamageModifier() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,58 @@
|
||||
package com.zivilon.cinder_loe.items;
|
||||
|
||||
import lotr.common.item.LOTRMaterial;
|
||||
import lotr.common.item.LOTRItemSword;
|
||||
import com.zivilon.cinder_loe.LoECreativeTabs;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ForgingKit extends Item {
|
||||
public IIcon[] icons;
|
||||
|
||||
public ForgingKit() {
|
||||
this.setHasSubtypes(true);
|
||||
setMaxStackSize(64);
|
||||
this.setMaxDamage(0);
|
||||
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[2];
|
||||
this.icons[0] = iconRegister.registerIcon("lotr:repair_kit");
|
||||
this.icons[1] = iconRegister.registerIcon("lotr:upgrade_kit");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack item) {
|
||||
switch(item.getItemDamage()) {
|
||||
case 0:
|
||||
return "item.repair_kit";
|
||||
case 1:
|
||||
return "item.upgrade_kit";
|
||||
default:
|
||||
return "item.repair_kit";
|
||||
}
|
||||
}
|
||||
|
||||
@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,40 @@
|
||||
package com.zivilon.cinder_loe.items;
|
||||
|
||||
import lotr.common.item.LOTRMaterial;
|
||||
import lotr.common.item.LOTRItemArmor;
|
||||
import com.zivilon.cinder_loe.LoECreativeTabs;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class LoEArmor extends LOTRItemArmor {
|
||||
public Item repair_item;
|
||||
|
||||
public LoEArmor(LOTRMaterial material, int slotType) {
|
||||
this(material, slotType, "");
|
||||
}
|
||||
public LoEArmor(LOTRMaterial material, int slotType, String s) {
|
||||
this(material, slotType, s, (Item) null);
|
||||
}
|
||||
public LoEArmor(LOTRMaterial material, int slotType, Item item) {
|
||||
this(material, slotType, "", item);
|
||||
}
|
||||
public LoEArmor(LOTRMaterial material, int slotType, Block block) {
|
||||
this(material, slotType, "", block);
|
||||
}
|
||||
public LoEArmor(LOTRMaterial material, int slotType, String s, Block block) {
|
||||
this(material, slotType, s, Item.getItemFromBlock(block));
|
||||
}
|
||||
public LoEArmor(LOTRMaterial material, int slotType, String s, Item item) {
|
||||
super(material, slotType, s);
|
||||
repair_item = item;
|
||||
setCreativeTab(LoECreativeTabs.tabCombatLoE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getIsRepairable(ItemStack item, ItemStack repair_material) {
|
||||
if (repair_material.getItem() == repair_item)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,43 @@
|
||||
package com.zivilon.cinder_loe.items;
|
||||
|
||||
import lotr.common.item.LOTRMaterial;
|
||||
import lotr.common.item.LOTRItemBow;
|
||||
import com.zivilon.cinder_loe.LoECreativeTabs;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class LoEBow extends LOTRItemBow {
|
||||
public Item repair_item;
|
||||
|
||||
public LoEBow(LOTRMaterial material) {
|
||||
this(material, (Item) null, 1.0D);
|
||||
}
|
||||
public LoEBow(LOTRMaterial material, Block repair_block) {
|
||||
this(material, Item.getItemFromBlock(repair_block), 1.0D);
|
||||
}
|
||||
public LoEBow(LOTRMaterial material, Block repair_block, double damage) {
|
||||
this(material, Item.getItemFromBlock(repair_block), damage);
|
||||
}
|
||||
public LoEBow(LOTRMaterial material, double damage, Block repair_block) {
|
||||
this(material, Item.getItemFromBlock(repair_block), damage);
|
||||
}
|
||||
public LoEBow(LOTRMaterial material, double damage) {
|
||||
this(material, (Item) null, damage);
|
||||
}
|
||||
public LoEBow(LOTRMaterial material, double damage, Item item) {
|
||||
this(material, item, damage);
|
||||
}
|
||||
public LoEBow(LOTRMaterial material, Item item, double damage) {
|
||||
super(material, damage);
|
||||
repair_item = item;
|
||||
setCreativeTab(LoECreativeTabs.tabCombatLoE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getIsRepairable(ItemStack item, ItemStack repair_material) {
|
||||
if (repair_material.getItem() == repair_item)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,31 @@
|
||||
package com.zivilon.cinder_loe.items;
|
||||
|
||||
import lotr.common.item.LOTRMaterial;
|
||||
import lotr.common.item.LOTRItemHammer;
|
||||
import com.zivilon.cinder_loe.LoECreativeTabs;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class LoEHammer extends LOTRItemHammer {
|
||||
public Item repair_item;
|
||||
|
||||
public LoEHammer(LOTRMaterial material) {
|
||||
this(material, (Item) null);
|
||||
}
|
||||
public LoEHammer(LOTRMaterial material, Block repair_block) {
|
||||
this(material, Item.getItemFromBlock(repair_block));
|
||||
}
|
||||
public LoEHammer(LOTRMaterial material, Item item) {
|
||||
super(material);
|
||||
repair_item = item;
|
||||
setCreativeTab(LoECreativeTabs.tabCombatLoE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getIsRepairable(ItemStack item, ItemStack repair_material) {
|
||||
if (repair_material.getItem() == repair_item)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,69 @@
|
||||
package com.zivilon.cinder_loe.items;
|
||||
|
||||
import com.zivilon.cinder_loe.LoECreativeTabs;
|
||||
|
||||
import lotr.common.item.LOTRItemMug;
|
||||
import lotr.common.item.LOTRItemMug.Vessel;
|
||||
import lotr.client.render.LOTRDrinkIcons;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class LoEItemMug extends LOTRItemMug {
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon[] drinkIcons;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon liquidIcon;
|
||||
|
||||
public LoEItemMug(boolean full, boolean food) {
|
||||
super(full, food, false, 0.0F);
|
||||
}
|
||||
|
||||
public LoEItemMug(float alc) {
|
||||
this(true, false, true, alc);
|
||||
}
|
||||
|
||||
public LoEItemMug(boolean full, boolean food, boolean brew, float alc) {
|
||||
super(full, food, brew, alc);
|
||||
setCreativeTab(LoECreativeTabs.tabFoodLoE);
|
||||
}
|
||||
|
||||
public void setTextureNameFromUnlocalizedName() {
|
||||
String textureName = getUnlocalizedName().substring("item.".length()); // Strip the "item." prefix
|
||||
this.setTextureName(textureName);
|
||||
}
|
||||
|
||||
|
||||
public void registerIcons(IIconRegister iconregister) {
|
||||
if (this.isFullMug) {
|
||||
this.drinkIcons = new IIcon[(Vessel.values()).length];
|
||||
for (int i = 0; i < (Vessel.values()).length; i++) {
|
||||
this.drinkIcons[i] = LOTRDrinkIcons.registerDrinkIcon(iconregister, this, getIconString(), (Vessel.values()[i]).name);
|
||||
}
|
||||
this.liquidIcon = LOTRDrinkIcons.registerLiquidIcon(iconregister, this, getIconString());
|
||||
barrelGui_emptyBucketSlotIcon = iconregister.registerIcon("lotr:barrel_emptyBucketSlot");
|
||||
barrelGui_emptyMugSlotIcon = iconregister.registerIcon("lotr:barrel_emptyMugSlot");
|
||||
} else {
|
||||
super.registerIcons(iconregister);
|
||||
}
|
||||
}
|
||||
|
||||
public IIcon getIconFromDamage(int i) {
|
||||
if (this.isFullMug) {
|
||||
if (i == -1)
|
||||
return this.liquidIcon;
|
||||
int vessel = (getVessel(i)).id;
|
||||
return this.drinkIcons[vessel];
|
||||
}
|
||||
return super.getIconFromDamage(i);
|
||||
}
|
||||
|
||||
public static Vessel getVessel(int damage) {
|
||||
int i = damage / vesselMeta;
|
||||
return Vessel.forMeta(i);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,31 @@
|
||||
package com.zivilon.cinder_loe.items;
|
||||
|
||||
import lotr.common.item.LOTRMaterial;
|
||||
import lotr.common.item.LOTRItemSpear;
|
||||
import com.zivilon.cinder_loe.LoECreativeTabs;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class LoESpear extends LOTRItemSpear {
|
||||
public Item repair_item;
|
||||
|
||||
public LoESpear(LOTRMaterial material) {
|
||||
this(material, (Item) null);
|
||||
}
|
||||
public LoESpear(LOTRMaterial material, Block repair_block) {
|
||||
this(material, Item.getItemFromBlock(repair_block));
|
||||
}
|
||||
public LoESpear(LOTRMaterial material, Item item) {
|
||||
super(material);
|
||||
repair_item = item;
|
||||
setCreativeTab(LoECreativeTabs.tabCombatLoE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getIsRepairable(ItemStack item, ItemStack repair_material) {
|
||||
if (repair_material.getItem() == repair_item)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,36 @@
|
||||
package com.zivilon.cinder_loe.items;
|
||||
|
||||
import lotr.common.item.LOTRMaterial;
|
||||
import lotr.common.item.LOTRItemSword;
|
||||
import com.zivilon.cinder_loe.LoECreativeTabs;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class LoESword extends LOTRItemSword {
|
||||
public Item repair_item;
|
||||
|
||||
public LoESword(LOTRMaterial material) {
|
||||
this(material, (Item) null);
|
||||
}
|
||||
public LoESword(LOTRMaterial material, Block repair_block) {
|
||||
this(material, Item.getItemFromBlock(repair_block));
|
||||
}
|
||||
public LoESword(LOTRMaterial material, Item item) {
|
||||
super(material);
|
||||
repair_item = item;
|
||||
setCreativeTab(LoECreativeTabs.tabCombatLoE);
|
||||
}
|
||||
|
||||
public LoESword setWeaponDamage(float damage) {
|
||||
this.lotrWeaponDamage = damage;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getIsRepairable(ItemStack item, ItemStack repair_material) {
|
||||
if (repair_material.getItem() == repair_item)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -1,17 +0,0 @@
|
||||
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(100);
|
||||
this.setNoRepair();
|
||||
this.setMaxStackSize(1);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,82 @@
|
||||
package com.zivilon.cinder_loe.items;
|
||||
|
||||
import com.zivilon.cinder_loe.CinderLoE;
|
||||
import com.zivilon.cinder_loe.LoECreativeTabs;
|
||||
import lotr.common.entity.npc.LOTREntityNPC;
|
||||
import lotr.common.entity.npc.LOTRHiredNPCInfo;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumAction;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class unitLevelTool extends Item {
|
||||
|
||||
public unitLevelTool() {
|
||||
setCreativeTab(LoECreativeTabs.tabMiscLoE);
|
||||
}
|
||||
|
||||
public EnumAction getItemUseAction(ItemStack itemstack) {
|
||||
return EnumAction.bow;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) {
|
||||
List<LOTREntityNPC> hiredNPCs = this.findHiredNPCsNearPlayer(player);
|
||||
|
||||
if (!hiredNPCs.isEmpty()) {
|
||||
for (LOTREntityNPC hiredNPC : hiredNPCs) {
|
||||
if (hiredNPC != null && hiredNPC.hiredNPCInfo != null) {
|
||||
try {
|
||||
LOTRHiredNPCInfo npcInfo = hiredNPC.hiredNPCInfo;
|
||||
|
||||
Method addExperienceMethod = LOTRHiredNPCInfo.class.getDeclaredMethod("addExperience", int.class);
|
||||
addExperienceMethod.setAccessible(true);
|
||||
|
||||
int xpToAdd = 1;
|
||||
|
||||
try {
|
||||
xpToAdd = Integer.parseInt(itemStack.getDisplayName());
|
||||
} catch (NumberFormatException e) {
|
||||
player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Tool name wasnt a number, applying 1 Xp instead"));
|
||||
continue;
|
||||
}
|
||||
|
||||
addExperienceMethod.invoke(npcInfo, xpToAdd);
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
private List<LOTREntityNPC> findHiredNPCsNearPlayer(EntityPlayer player) {
|
||||
// Logic to find all nearby hired NPCs within a certain range
|
||||
double range = 20.0D; // Set the range within which the NPCs should be found
|
||||
List<LOTREntityNPC> nearbyHiredNPCs = new ArrayList<>();
|
||||
|
||||
for (Object entity : player.worldObj.getEntitiesWithinAABB(LOTREntityNPC.class, player.boundingBox.expand(range, range, range))) {
|
||||
LOTREntityNPC npc = (LOTREntityNPC) entity;
|
||||
|
||||
// Check if the player has sufficient permission level (admin tool usage)
|
||||
if (npc.hiredNPCInfo.getHiringPlayerUUID() != null && player.canCommandSenderUseCommand(2, "")) {
|
||||
nearbyHiredNPCs.add(npc);
|
||||
}
|
||||
}
|
||||
|
||||
return nearbyHiredNPCs;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
package com.zivilon.cinder_loe.mixins;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Overwrite;
|
||||
import lotr.common.item.LOTRWeaponStats;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import lotr.common.enchant.LOTREnchantmentHelper;
|
||||
|
||||
@Mixin(EnchantmentHelper.class)
|
||||
public class MixinEnchantmentHelper {
|
||||
|
||||
/**
|
||||
* @author Shinare
|
||||
* @reason Having full knockbackResistance attribute now negates bonus knockback as well
|
||||
*/
|
||||
@Overwrite
|
||||
public static int getKnockbackModifier(EntityLivingBase attacker, EntityLivingBase target) {
|
||||
int vanilla_ench_level = EnchantmentHelper.getEnchantmentLevel(Enchantment.knockback.effectId, attacker.getHeldItem());
|
||||
int base_extra_knockback = LOTRWeaponStats.getBaseExtraKnockback(attacker.getHeldItem());
|
||||
int modifier_extra_knockback = LOTREnchantmentHelper.calcExtraKnockback(attacker.getHeldItem());
|
||||
if (target.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).getAttributeValue() == 1.0D) return 0;
|
||||
return vanilla_ench_level + base_extra_knockback + modifier_extra_knockback;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
package com.zivilon.cinder_loe.mixins;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
@Mixin(Entity.class)
|
||||
public interface MixinEntity {
|
||||
|
||||
@Accessor("invulnerable")
|
||||
void setInvulnerable(boolean invulnerable);
|
||||
}
|
||||
@ -0,0 +1,305 @@
|
||||
package com.zivilon.cinder_loe.mixins;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.Overwrite;
|
||||
import lotr.common.item.LOTRWeaponStats;
|
||||
import net.minecraft.entity.projectile.EntityArrow;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import lotr.common.enchant.LOTREnchantmentHelper;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.network.play.server.S2BPacketChangeGameState;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import java.util.List;
|
||||
import net.minecraft.entity.monster.EntityEnderman;
|
||||
|
||||
@Mixin(EntityArrow.class)
|
||||
public abstract class MixinEntityArrow extends Entity {
|
||||
|
||||
public MixinEntityArrow(World world) {
|
||||
super(world);
|
||||
}
|
||||
|
||||
@Shadow
|
||||
public abstract void setIsCritical(boolean p_70243_1_);
|
||||
@Shadow
|
||||
public abstract boolean getIsCritical();
|
||||
|
||||
@Shadow
|
||||
private Block field_145790_g;
|
||||
@Shadow
|
||||
private int field_145791_d;
|
||||
@Shadow
|
||||
private int field_145792_e;
|
||||
@Shadow
|
||||
private int field_145789_f;
|
||||
@Shadow
|
||||
private boolean inGround;
|
||||
@Shadow
|
||||
public int arrowShake;
|
||||
@Shadow
|
||||
private int inData;
|
||||
@Shadow
|
||||
private int ticksInGround;
|
||||
@Shadow
|
||||
private int ticksInAir;
|
||||
@Shadow
|
||||
public Entity shootingEntity;
|
||||
@Shadow
|
||||
private int knockbackStrength;
|
||||
@Shadow
|
||||
private double damage;
|
||||
|
||||
/**
|
||||
* @author Shinare
|
||||
* @reason Having full knockbackResistance attribute now negates bonus knockback as well
|
||||
*/
|
||||
@Overwrite
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
|
||||
EntityArrow arrow = (EntityArrow)(Object)this;
|
||||
|
||||
if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F) {
|
||||
float f = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
|
||||
this.prevRotationYaw = this.rotationYaw = (float)(Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI);
|
||||
this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(this.motionY, (double)f) * 180.0D / Math.PI);
|
||||
}
|
||||
|
||||
Block block = this.worldObj.getBlock(this.field_145791_d, this.field_145792_e, this.field_145789_f);
|
||||
|
||||
if (block.getMaterial() != Material.air) {
|
||||
block.setBlockBoundsBasedOnState(this.worldObj, this.field_145791_d, this.field_145792_e, this.field_145789_f);
|
||||
AxisAlignedBB axisalignedbb = block.getCollisionBoundingBoxFromPool(this.worldObj, this.field_145791_d, this.field_145792_e, this.field_145789_f);
|
||||
|
||||
if (axisalignedbb != null && axisalignedbb.isVecInside(Vec3.createVectorHelper(this.posX, this.posY, this.posZ))) {
|
||||
this.inGround = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.arrowShake > 0) {
|
||||
--this.arrowShake;
|
||||
}
|
||||
|
||||
if (this.inGround) {
|
||||
int j = this.worldObj.getBlockMetadata(this.field_145791_d, this.field_145792_e, this.field_145789_f);
|
||||
|
||||
if (block == this.field_145790_g && j == this.inData) {
|
||||
++this.ticksInGround;
|
||||
|
||||
if (this.ticksInGround == 1200) {
|
||||
this.setDead();
|
||||
}
|
||||
} else {
|
||||
this.inGround = false;
|
||||
this.motionX *= (double)(this.rand.nextFloat() * 0.2F);
|
||||
this.motionY *= (double)(this.rand.nextFloat() * 0.2F);
|
||||
this.motionZ *= (double)(this.rand.nextFloat() * 0.2F);
|
||||
this.ticksInGround = 0;
|
||||
this.ticksInAir = 0;
|
||||
}
|
||||
} else {
|
||||
++this.ticksInAir;
|
||||
Vec3 vec31 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ);
|
||||
Vec3 vec3 = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
|
||||
MovingObjectPosition movingobjectposition = this.worldObj.func_147447_a(vec31, vec3, false, true, false);
|
||||
vec31 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ);
|
||||
vec3 = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
|
||||
|
||||
if (movingobjectposition != null) {
|
||||
vec3 = Vec3.createVectorHelper(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord);
|
||||
}
|
||||
|
||||
Entity entity = null;
|
||||
List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D));
|
||||
double d0 = 0.0D;
|
||||
int i;
|
||||
float f1;
|
||||
|
||||
for (i = 0; i < list.size(); ++i) {
|
||||
Entity entity1 = (Entity)list.get(i);
|
||||
|
||||
if (entity1.canBeCollidedWith() && (entity1 != this.shootingEntity || this.ticksInAir >= 5)) {
|
||||
f1 = 0.3F;
|
||||
AxisAlignedBB axisalignedbb1 = entity1.boundingBox.expand((double)f1, (double)f1, (double)f1);
|
||||
MovingObjectPosition movingobjectposition1 = axisalignedbb1.calculateIntercept(vec31, vec3);
|
||||
|
||||
if (movingobjectposition1 != null) {
|
||||
double d1 = vec31.distanceTo(movingobjectposition1.hitVec);
|
||||
|
||||
if (d1 < d0 || d0 == 0.0D) {
|
||||
entity = entity1;
|
||||
d0 = d1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (entity != null) {
|
||||
movingobjectposition = new MovingObjectPosition(entity);
|
||||
}
|
||||
|
||||
if (movingobjectposition != null && movingobjectposition.entityHit != null && movingobjectposition.entityHit instanceof EntityPlayer) {
|
||||
EntityPlayer entityplayer = (EntityPlayer)movingobjectposition.entityHit;
|
||||
|
||||
if (entityplayer.capabilities.disableDamage || this.shootingEntity instanceof EntityPlayer && !((EntityPlayer)this.shootingEntity).canAttackPlayer(entityplayer)) {
|
||||
movingobjectposition = null;
|
||||
}
|
||||
}
|
||||
|
||||
float f2;
|
||||
float f4;
|
||||
|
||||
if (movingobjectposition != null) {
|
||||
if (movingobjectposition.entityHit != null) {
|
||||
f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ);
|
||||
int k = MathHelper.ceiling_double_int((double)f2 * this.damage);
|
||||
|
||||
if (this.getIsCritical()) {
|
||||
k += this.rand.nextInt(k / 2 + 2);
|
||||
}
|
||||
|
||||
DamageSource damagesource = null;
|
||||
|
||||
if (this.shootingEntity == null) {
|
||||
damagesource = DamageSource.causeArrowDamage(arrow, this);
|
||||
} else {
|
||||
damagesource = DamageSource.causeArrowDamage(arrow, this.shootingEntity);
|
||||
}
|
||||
|
||||
if (arrow.isBurning() && !(movingobjectposition.entityHit instanceof EntityEnderman)) {
|
||||
movingobjectposition.entityHit.setFire(5);
|
||||
}
|
||||
|
||||
if (movingobjectposition.entityHit.attackEntityFrom(damagesource, (float)k)) {
|
||||
if (movingobjectposition.entityHit instanceof EntityLivingBase) {
|
||||
EntityLivingBase entitylivingbase = (EntityLivingBase)movingobjectposition.entityHit;
|
||||
|
||||
if (!this.worldObj.isRemote) {
|
||||
entitylivingbase.setArrowCountInEntity(entitylivingbase.getArrowCountInEntity() + 1);
|
||||
}
|
||||
|
||||
|
||||
double knockback_resistance = entitylivingbase.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).getAttributeValue();
|
||||
if (this.knockbackStrength > 0 && knockback_resistance < 1.0D) {
|
||||
f4 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
|
||||
|
||||
if (f4 > 0.0F) {
|
||||
entitylivingbase.addVelocity(this.motionX * (double)this.knockbackStrength * 0.6000000238418579D / (double)f4, 0.1D, this.motionZ * (double)this.knockbackStrength * 0.6000000238418579D / (double)f4);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.shootingEntity != null && this.shootingEntity instanceof EntityLivingBase) {
|
||||
EnchantmentHelper.func_151384_a(entitylivingbase, this.shootingEntity);
|
||||
EnchantmentHelper.func_151385_b((EntityLivingBase)this.shootingEntity, entitylivingbase);
|
||||
}
|
||||
|
||||
if (this.shootingEntity != null && entitylivingbase != this.shootingEntity && entitylivingbase instanceof EntityPlayer && this.shootingEntity instanceof EntityPlayerMP) {
|
||||
((EntityPlayerMP)this.shootingEntity).playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(6, 0.0F));
|
||||
}
|
||||
}
|
||||
|
||||
arrow.playSound("random.bowhit", 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F));
|
||||
|
||||
if (!(movingobjectposition.entityHit instanceof EntityEnderman)) {
|
||||
arrow.setDead();
|
||||
}
|
||||
} else {
|
||||
this.motionX *= -0.10000000149011612D;
|
||||
this.motionY *= -0.10000000149011612D;
|
||||
this.motionZ *= -0.10000000149011612D;
|
||||
this.rotationYaw += 180.0F;
|
||||
this.prevRotationYaw += 180.0F;
|
||||
this.ticksInAir = 0;
|
||||
}
|
||||
} else {
|
||||
this.field_145791_d = movingobjectposition.blockX;
|
||||
this.field_145792_e = movingobjectposition.blockY;
|
||||
this.field_145789_f = movingobjectposition.blockZ;
|
||||
this.field_145790_g = this.worldObj.getBlock(this.field_145791_d, this.field_145792_e, this.field_145789_f);
|
||||
this.inData = arrow.worldObj.getBlockMetadata(this.field_145791_d, this.field_145792_e, this.field_145789_f);
|
||||
this.motionX = (double)((float)(movingobjectposition.hitVec.xCoord - this.posX));
|
||||
this.motionY = (double)((float)(movingobjectposition.hitVec.yCoord - this.posY));
|
||||
this.motionZ = (double)((float)(movingobjectposition.hitVec.zCoord - this.posZ));
|
||||
f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ);
|
||||
this.posX -= this.motionX / (double)f2 * 0.05000000074505806D;
|
||||
this.posY -= this.motionY / (double)f2 * 0.05000000074505806D;
|
||||
this.posZ -= this.motionZ / (double)f2 * 0.05000000074505806D;
|
||||
this.playSound("random.bowhit", 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F));
|
||||
this.inGround = true;
|
||||
this.arrowShake = 7;
|
||||
this.setIsCritical(false);
|
||||
|
||||
if (this.field_145790_g.getMaterial() != Material.air) {
|
||||
this.field_145790_g.onEntityCollidedWithBlock(this.worldObj, this.field_145791_d, this.field_145792_e, this.field_145789_f, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (arrow.getIsCritical()) {
|
||||
for (i = 0; i < 4; ++i) {
|
||||
arrow.worldObj.spawnParticle("crit", arrow.posX + arrow.motionX * (double)i / 4.0D, arrow.posY + arrow.motionY * (double)i / 4.0D, arrow.posZ + arrow.motionZ * (double)i / 4.0D, -arrow.motionX, -arrow.motionY + 0.2D, -arrow.motionZ);
|
||||
}
|
||||
}
|
||||
|
||||
arrow.posX += arrow.motionX;
|
||||
arrow.posY += arrow.motionY;
|
||||
arrow.posZ += arrow.motionZ;
|
||||
f2 = MathHelper.sqrt_double(arrow.motionX * arrow.motionX + arrow.motionZ * arrow.motionZ);
|
||||
arrow.rotationYaw = (float)(Math.atan2(arrow.motionX, arrow.motionZ) * 180.0D / Math.PI);
|
||||
|
||||
for (arrow.rotationPitch = (float)(Math.atan2(arrow.motionY, (double)f2) * 180.0D / Math.PI); arrow.rotationPitch - arrow.prevRotationPitch < -180.0F; arrow.prevRotationPitch -= 360.0F) {
|
||||
;
|
||||
}
|
||||
|
||||
while (arrow.rotationPitch - arrow.prevRotationPitch >= 180.0F) {
|
||||
arrow.prevRotationPitch += 360.0F;
|
||||
}
|
||||
|
||||
while (arrow.rotationYaw - arrow.prevRotationYaw < -180.0F) {
|
||||
arrow.prevRotationYaw -= 360.0F;
|
||||
}
|
||||
|
||||
while (arrow.rotationYaw - arrow.prevRotationYaw >= 180.0F) {
|
||||
arrow.prevRotationYaw += 360.0F;
|
||||
}
|
||||
|
||||
arrow.rotationPitch = arrow.prevRotationPitch + (arrow.rotationPitch - arrow.prevRotationPitch) * 0.2F;
|
||||
arrow.rotationYaw = arrow.prevRotationYaw + (arrow.rotationYaw - arrow.prevRotationYaw) * 0.2F;
|
||||
float f3 = 0.99F;
|
||||
f1 = 0.05F;
|
||||
|
||||
if (arrow.isInWater()) {
|
||||
for (int l = 0; l < 4; ++l) {
|
||||
f4 = 0.25F;
|
||||
arrow.worldObj.spawnParticle("bubble", arrow.posX - arrow.motionX * (double)f4, arrow.posY - arrow.motionY * (double)f4, arrow.posZ - arrow.motionZ * (double)f4, arrow.motionX, arrow.motionY, arrow.motionZ);
|
||||
}
|
||||
|
||||
f3 = 0.8F;
|
||||
}
|
||||
|
||||
if (arrow.isWet()) {
|
||||
arrow.extinguish();
|
||||
}
|
||||
|
||||
arrow.motionX *= (double)f3;
|
||||
arrow.motionY *= (double)f3;
|
||||
arrow.motionZ *= (double)f3;
|
||||
arrow.motionY -= (double)f1;
|
||||
arrow.setPosition(arrow.posX, arrow.posY, arrow.posZ);
|
||||
this.func_145775_I();
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue