mirror of
https://github.com/GTNewHorizons/Draconic-Evolution.git
synced 2026-11-22 13:09:40 +00:00
28/01/2015
This commit is contained in:
1 parent
a557296679
commit
8fcf9897d4
16 files changed
+339
-241
No files matched your search
@@ -27,10 +27,10 @@ public class DraconicEvolution { // TODO Update Licence and add change log to gi
|
||||
public static CreativeTabs tabToolsWeapons = new DETab(CreativeTabs.getNextID(), References.MODID, "toolsAndWeapons", 0);
|
||||
public static CreativeTabs tabBlocksItems = new DETab(CreativeTabs.getNextID(), References.MODID, "blocksAndItems", 1);
|
||||
|
||||
public static final String networkChannelName = "DraconicEvolution";
|
||||
public static final String networkChannelName = "DEvolutionNC";
|
||||
public static SimpleNetworkWrapper network;
|
||||
|
||||
public static boolean debug = true;//todo
|
||||
public static boolean debug = false;//todo
|
||||
|
||||
public static Enchantment reaperEnchant;
|
||||
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ public class ComponentConfigItemButton extends ComponentBase {
|
||||
super(x, y);
|
||||
this.slot = slot;
|
||||
this.inventory = player.inventory;
|
||||
if (inventory.getStackInSlot(slot) != null && ((inventory.getStackInSlot(slot).getItem() instanceof IConfigurableItem && !((IConfigurableItem) inventory.getStackInSlot(slot).getItem()).getFields(inventory.getStackInSlot(slot), slot).isEmpty()) || inventory.getStackInSlot(slot).getItem() instanceof IInventoryTool)) hasValidItem = true;//todo && instanceof IConfigurableItem
|
||||
if (inventory.getStackInSlot(slot) != null && ((inventory.getStackInSlot(slot).getItem() instanceof IConfigurableItem && !((IConfigurableItem) inventory.getStackInSlot(slot).getItem()).getFields(inventory.getStackInSlot(slot), slot).isEmpty()) || inventory.getStackInSlot(slot).getItem() instanceof IInventoryTool)) hasValidItem = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+2
-3
@@ -7,14 +7,13 @@ import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityList;
|
||||
import net.minecraft.entity.monster.EntitySkeleton;
|
||||
import net.minecraft.entity.passive.EntityPig;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class RenderMobSoul implements IItemRenderer {
|
||||
private Minecraft mc;
|
||||
private Entity randomEntity = new EntityPig(Minecraft.getMinecraft().theWorld);
|
||||
private Entity randomEntity = null;
|
||||
private String[] randomEntitys = new String[] {"Pig", "Sheep", "Enderman", "Zombie", "Creeper", "Cow", "Chicken", "Ozelot", "Witch", "Wolf", "MushroomCow", "Squid", "EntityHorse", "Spider", "Skeleton", "Blaze", "Bat", "Villager", "Silverfish"};
|
||||
|
||||
public RenderMobSoul() {
|
||||
@@ -35,9 +34,9 @@ public class RenderMobSoul implements IItemRenderer {
|
||||
@Override
|
||||
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
|
||||
Entity mob = EntityList.createEntityByName(ItemNBTHelper.getString(item, "Name", "Pig"), mc.theWorld);
|
||||
randomEntity = EntityList.createEntityByName(randomEntitys[(int)((Minecraft.getSystemTime() / 1000) % 18)], mc.theWorld);
|
||||
if (ItemNBTHelper.getString(item, "Name", "Pig").equals("Any")) mob = randomEntity;
|
||||
if (mob instanceof EntitySkeleton) ((EntitySkeleton)mob).setSkeletonType(ItemNBTHelper.getInteger(item, "SkeletonType", 0));
|
||||
randomEntity = EntityList.createEntityByName(randomEntitys[(int)((mc.getSystemTime() / 1000) % 18)], mc.theWorld);
|
||||
|
||||
if (mob == null) {
|
||||
LogHelper.error("Invalid Mob Name:" + ItemNBTHelper.getString(item, "Name", "Pig"));
|
||||
|
||||
+90
-187
@@ -6,10 +6,14 @@ import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.lib.Strings;
|
||||
import com.brandon3055.draconicevolution.common.utills.IInventoryTool;
|
||||
import com.brandon3055.draconicevolution.common.utills.ItemConfigField;
|
||||
import com.brandon3055.draconicevolution.common.utills.ItemNBTHelper;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.enchantment.EnumEnchantmentType;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -30,10 +34,11 @@ public class DraconicAxe extends MiningTool implements IInventoryTool {//todo ax
|
||||
public List<ItemConfigField> getFields(ItemStack stack, int slot) {
|
||||
List<ItemConfigField> list = super.getFields(stack, slot);
|
||||
list.add(new ItemConfigField(References.INT_ID, slot, References.DIG_AOE).setMinMaxAndIncromente(0, 3, 1).readFromItem(stack, 0).setModifier("AOE"));
|
||||
list.add(new ItemConfigField(References.BOOLEAN_ID, slot, References.TREE_MODE).readFromItem(stack, true));
|
||||
list.add(new ItemConfigField(References.BOOLEAN_ID, slot, References.TREE_MODE).readFromItem(stack, false));
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return StatCollector.translateToLocal("info.de.toolInventoryEnch.txt");
|
||||
@@ -49,39 +54,19 @@ public class DraconicAxe extends MiningTool implements IInventoryTool {//todo ax
|
||||
return enchant.type == EnumEnchantmentType.digger;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockStartBreak(ItemStack stack, int x, int y, int z, EntityPlayer player) {
|
||||
if (ItemNBTHelper.getBoolean(stack, References.TREE_MODE, false) && isTree(player.worldObj, x, y, z)) {
|
||||
trimLeavs(x, y, z, player, player.worldObj, stack);
|
||||
for (int i = 0; i < 9; i++) player.worldObj.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(player.worldObj.getBlock(x, y, z)) + (player.worldObj.getBlockMetadata(x, y, z) << 12));
|
||||
chopTree(x, y, z, player, player.worldObj, stack);
|
||||
return false;
|
||||
}
|
||||
|
||||
//
|
||||
// @Override
|
||||
// public boolean isItemTool(ItemStack p_77616_1_) {
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// @SideOnly(Side.CLIENT)
|
||||
// @SuppressWarnings("unchecked")
|
||||
// @Override
|
||||
// public void getSubItems(Item item, CreativeTabs tab, List list) {
|
||||
// list.add(ItemNBTHelper.setInteger(new ItemStack(item, 1, 0), "Energy", 0));
|
||||
// list.add(ItemNBTHelper.setInteger(new ItemStack(item, 1, 0), "Energy", capacity));
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String getUnlocalizedName(){
|
||||
//
|
||||
// return String.format("item.%s%s", References.MODID.toLowerCase() + ":", super.getUnlocalizedName().substring(super.getUnlocalizedName().indexOf(".") + 1));
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String getUnlocalizedName(final ItemStack itemStack){
|
||||
// return getUnlocalizedName();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// @SideOnly(Side.CLIENT)
|
||||
// public void registerIcons(final IIconRegister iconRegister) {
|
||||
// this.itemIcon = iconRegister.registerIcon(References.RESOURCESPREFIX + "draconic_axe");
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
return super.onBlockStartBreak(stack, x, y, z, player);
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public boolean onBlockStartBreak(ItemStack stack, int X, int Y, int Z, EntityPlayer player) {
|
||||
// World world = player.worldObj;
|
||||
// boolean tree = isTree(world, X, Y, Z);
|
||||
@@ -108,82 +93,77 @@ public class DraconicAxe extends MiningTool implements IInventoryTool {//todo ax
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// private boolean isTree(World world, int X, int Y, int Z) {
|
||||
// final Block wood = world.getBlock(X, Y, Z);
|
||||
// if (wood == null || !wood.isWood(world, X, Y, Z)) {
|
||||
// return false;
|
||||
// } else {
|
||||
// int top = Y;
|
||||
// for (int y = Y; y <= Y + 50; y++) {
|
||||
// if (!world.getBlock(X, y, Z).isWood(world, X, y, Z) && !world.getBlock(X, y, Z).isLeaves(world, X, y, Z)) {
|
||||
// top += y;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// int leaves = 0;
|
||||
// for (int xPos = X - 1; xPos <= X + 1; xPos++) {
|
||||
// for (int yPos = Y; yPos <= top; yPos++) {
|
||||
// for (int zPos = Z - 1; zPos <= Z + 1; zPos++) {
|
||||
// if (world.getBlock(xPos, yPos, zPos).isLeaves(world, xPos, yPos, zPos)) leaves++;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// if (leaves >= 3) return true;
|
||||
// }
|
||||
//
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// void chopTree(int X, int Y, int Z, EntityPlayer player, World world, ItemStack stack) {
|
||||
// for (int xPos = X - 1; xPos <= X + 1; xPos++) {
|
||||
// for (int yPos = Y; yPos <= Y + 1; yPos++) {
|
||||
// for (int zPos = Z - 1; zPos <= Z + 1; zPos++) {
|
||||
// Block block = world.getBlock(xPos, yPos, zPos);
|
||||
// int meta = world.getBlockMetadata(xPos, yPos, zPos);
|
||||
// if (block.isWood(world, xPos, yPos, zPos)) {
|
||||
// world.setBlockToAir(xPos, yPos, zPos);
|
||||
// if (!player.capabilities.isCreativeMode) {
|
||||
// if (block.removedByPlayer(world, player, xPos, yPos, zPos, false)) {
|
||||
// block.onBlockDestroyedByPlayer(world, xPos, yPos, zPos, meta);
|
||||
// }
|
||||
// block.harvestBlock(world, player, xPos, yPos, zPos, meta);
|
||||
// block.onBlockHarvested(world, xPos, yPos, zPos, meta, player);
|
||||
// onBlockDestroyed(stack, world, block, xPos, yPos, zPos, player);
|
||||
// }
|
||||
// chopTree(xPos, yPos, zPos, player, world, stack);
|
||||
// }//else
|
||||
// //trimLeavs(xPos, yPos, zPos, player, world, stack);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @SuppressWarnings("all")
|
||||
// void trimLeavs(int X, int Y, int Z, EntityPlayer player, World world, ItemStack stack) {
|
||||
// scedualUpdates(X, Y, Z, player, world, stack);
|
||||
// }
|
||||
//
|
||||
// @SuppressWarnings("all")
|
||||
// void scedualUpdates(int X, int Y, int Z, EntityPlayer player, World world, ItemStack stack) {
|
||||
// for (int xPos = X - 15; xPos <= X + 15; xPos++) {
|
||||
// for (int yPos = Y; yPos <= Y + 50; yPos++) {
|
||||
// for (int zPos = Z - 15; zPos <= Z + 15; zPos++) {
|
||||
// Block block = world.getBlock(xPos, yPos, zPos);
|
||||
// if (block.isLeaves(world, xPos, yPos, zPos)) {
|
||||
// world.scheduleBlockUpdate(xPos, yPos, zPos, block, 2 + world.rand.nextInt(10));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int x, int y, int z, int side, float par8, float par9, float par10) {
|
||||
// //System.out.println(x + " " + y + " " + z);
|
||||
// return super.onItemUse(par1ItemStack, par2EntityPlayer, par3World, x, y, z, side, par8, par9, par10);
|
||||
// }
|
||||
//
|
||||
private boolean isTree(World world, int X, int Y, int Z) {
|
||||
final Block wood = world.getBlock(X, Y, Z);
|
||||
if (wood == null || !wood.isWood(world, X, Y, Z)) {
|
||||
return false;
|
||||
} else {
|
||||
int top = Y;
|
||||
for (int y = Y; y <= Y + 50; y++) {
|
||||
if (!world.getBlock(X, y, Z).isWood(world, X, y, Z) && !world.getBlock(X, y, Z).isLeaves(world, X, y, Z)) {
|
||||
top += y;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int leaves = 0;
|
||||
for (int xPos = X - 1; xPos <= X + 1; xPos++) {
|
||||
for (int yPos = Y; yPos <= top; yPos++) {
|
||||
for (int zPos = Z - 1; zPos <= Z + 1; zPos++) {
|
||||
if (world.getBlock(xPos, yPos, zPos).isLeaves(world, xPos, yPos, zPos)) leaves++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (leaves >= 3) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void chopTree(int X, int Y, int Z, EntityPlayer player, World world, ItemStack stack) {
|
||||
for (int xPos = X - 1; xPos <= X + 1; xPos++) {
|
||||
for (int yPos = Y; yPos <= Y + 1; yPos++) {
|
||||
for (int zPos = Z - 1; zPos <= Z + 1; zPos++) {
|
||||
Block block = world.getBlock(xPos, yPos, zPos);
|
||||
int meta = world.getBlockMetadata(xPos, yPos, zPos);
|
||||
if (block.isWood(world, xPos, yPos, zPos)) {
|
||||
world.setBlockToAir(xPos, yPos, zPos);
|
||||
if (!player.capabilities.isCreativeMode) {
|
||||
if (block.removedByPlayer(world, player, xPos, yPos, zPos, false)) {
|
||||
block.onBlockDestroyedByPlayer(world, xPos, yPos, zPos, meta);
|
||||
}
|
||||
block.harvestBlock(world, player, xPos, yPos, zPos, meta);
|
||||
block.onBlockHarvested(world, xPos, yPos, zPos, meta, player);
|
||||
onBlockDestroyed(stack, world, block, xPos, yPos, zPos, player);
|
||||
}
|
||||
chopTree(xPos, yPos, zPos, player, world, stack);
|
||||
}//else
|
||||
//trimLeavs(xPos, yPos, zPos, player, world, stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("all")
|
||||
void trimLeavs(int X, int Y, int Z, EntityPlayer player, World world, ItemStack stack) {
|
||||
scedualUpdates(X, Y, Z, player, world, stack);
|
||||
}
|
||||
|
||||
@SuppressWarnings("all")
|
||||
void scedualUpdates(int X, int Y, int Z, EntityPlayer player, World world, ItemStack stack) {
|
||||
for (int xPos = X - 15; xPos <= X + 15; xPos++) {
|
||||
for (int yPos = Y; yPos <= Y + 50; yPos++) {
|
||||
for (int zPos = Z - 15; zPos <= Z + 15; zPos++) {
|
||||
Block block = world.getBlock(xPos, yPos, zPos);
|
||||
if (block.isLeaves(world, xPos, yPos, zPos)) {
|
||||
world.scheduleBlockUpdate(xPos, yPos, zPos, block, 2 + world.rand.nextInt(10));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// @SuppressWarnings({"rawtypes", "unchecked"})
|
||||
// @Override
|
||||
// public void addInformation(final ItemStack stack, final EntityPlayer player, final List list, final boolean extraInformation) {
|
||||
@@ -196,82 +176,5 @@ public class DraconicAxe extends MiningTool implements IInventoryTool {//todo ax
|
||||
//
|
||||
// }else list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.draconicAxe1.txt"));
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public EnumRarity getRarity(ItemStack stack) {
|
||||
// return EnumRarity.rare;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public int receiveEnergy(ItemStack container, int maxReceive, boolean simulate) {
|
||||
//
|
||||
// if (container.stackTagCompound == null) {
|
||||
// container.stackTagCompound = new NBTTagCompound();
|
||||
// }
|
||||
// int energy = container.stackTagCompound.getInteger("Energy");
|
||||
// int energyReceived = Math.min(capacity - energy, Math.min(this.maxReceive, maxReceive));
|
||||
//
|
||||
// if (!simulate) {
|
||||
// energy += energyReceived;
|
||||
// container.stackTagCompound.setInteger("Energy", energy);
|
||||
// }
|
||||
// return energyReceived;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public int extractEnergy(ItemStack container, int maxExtract, boolean simulate) {
|
||||
//
|
||||
// if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) {
|
||||
// return 0;
|
||||
// }
|
||||
// int energy = container.stackTagCompound.getInteger("Energy");
|
||||
// int energyExtracted = Math.min(energy, Math.min(this.maxExtract, maxExtract));
|
||||
//
|
||||
// if (!simulate) {
|
||||
// energy -= energyExtracted;
|
||||
// container.stackTagCompound.setInteger("Energy", energy);
|
||||
// }
|
||||
// return energyExtracted;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public int getEnergyStored(ItemStack container) {
|
||||
// if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) {
|
||||
// return 0;
|
||||
// }
|
||||
// return container.stackTagCompound.getInteger("Energy");
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public int getMaxEnergyStored(ItemStack container) {
|
||||
// return capacity;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean showDurabilityBar(ItemStack stack) {
|
||||
// return !(getEnergyStored(stack) == getMaxEnergyStored(stack));
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public double getDurabilityForDisplay(ItemStack stack) {
|
||||
// return 1D - ((double)getEnergyStored(stack) / (double)getMaxEnergyStored(stack));
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public float getDigSpeed(ItemStack stack, Block block, int meta) {
|
||||
// if ((stack.getItem() instanceof IEnergyContainerItem) && ((IEnergyContainerItem)stack.getItem()).getEnergyStored(stack) >= References.ENERGYPERBLOCK)
|
||||
// return super.getDigSpeed(stack, block, meta);
|
||||
// else
|
||||
// return 1F;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean hasCustomEntity(ItemStack stack) {
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public Entity createEntity(World world, Entity location, ItemStack itemstack) {
|
||||
// return new EntityPersistentItem(world, location, itemstack);
|
||||
// }
|
||||
|
||||
}
|
||||
+11
-23
@@ -2,13 +2,17 @@ package com.brandon3055.draconicevolution.common.items.tools;
|
||||
|
||||
import com.brandon3055.draconicevolution.common.ModItems;
|
||||
import com.brandon3055.draconicevolution.common.items.tools.baseclasses.MiningTool;
|
||||
import com.brandon3055.draconicevolution.common.items.tools.baseclasses.ToolHandler;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.lib.Strings;
|
||||
import com.brandon3055.draconicevolution.common.utills.IInventoryTool;
|
||||
import com.brandon3055.draconicevolution.common.utills.ItemConfigField;
|
||||
import com.brandon3055.draconicevolution.common.utills.ItemNBTHelper;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.enchantment.EnumEnchantmentType;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
@@ -61,27 +65,11 @@ public class DraconicDistructionStaff extends MiningTool implements IInventoryTo
|
||||
return enchant.type == EnumEnchantmentType.digger || enchant.type == EnumEnchantmentType.weapon;
|
||||
}
|
||||
|
||||
|
||||
// @SuppressWarnings({"unchecked"})
|
||||
// @Override
|
||||
// public void addInformation(final ItemStack stack, final EntityPlayer player, final List list, final boolean extraInformation) {
|
||||
// int size = (ItemNBTHelper.getShort(stack, "size", (short) 0) * 2) + 1;
|
||||
// boolean oblit = ItemNBTHelper.getBoolean(stack, "obliterate", false);
|
||||
// if (InfoHelper.holdShiftForDetails(list)){
|
||||
// InfoHelper.addEnergyInfo(stack, list);
|
||||
//
|
||||
// list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.miningMode.txt") + ": " + InfoHelper.HITC() + size + "x" + size);
|
||||
// list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.changeMiningMode.txt"));
|
||||
// list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.obliterationMode.txt") + ": " + InfoHelper.HITC() + StatCollector.translateToLocal("info.de.obliterationMode"+oblit+".txt"));
|
||||
// list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.toggleOblit.txt"));
|
||||
// list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.oblitInfo.txt"));
|
||||
//
|
||||
// InfoHelper.addLore(stack, list);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public EnumRarity getRarity(ItemStack stack) {
|
||||
// return EnumRarity.epic;
|
||||
// }
|
||||
@Override
|
||||
public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) {
|
||||
//todo Make this awesome
|
||||
ToolHandler.AOEAttack(player, entity, stack, 25, ItemNBTHelper.getInteger(stack, References.ATTACK_AOE, 0));
|
||||
ToolHandler.damageEntityBasedOnHealth(entity, player, 0.5F);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
+11
-7
@@ -1,6 +1,7 @@
|
||||
package com.brandon3055.draconicevolution.common.items.tools.baseclasses;
|
||||
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.utills.DataUtills;
|
||||
import com.brandon3055.draconicevolution.common.utills.ItemConfigField;
|
||||
import com.brandon3055.draconicevolution.common.utills.ItemNBTHelper;
|
||||
import com.brandon3055.draconicevolution.common.utills.LogHelper;
|
||||
@@ -61,7 +62,7 @@ public abstract class MiningTool extends ToolBase {//todo add custom information
|
||||
int radius = ItemNBTHelper.getInteger(stack, References.DIG_AOE, 0);
|
||||
int depth = ItemNBTHelper.getInteger(stack, References.DIG_DEPTH, 1) - 1;
|
||||
|
||||
return getEnergyStored(stack) >= energyPerOperation && (radius > 0 || depth > 0) ? breakAOEBlocks(stack, x, y, z, radius, depth, player) : super.onBlockStartBreak(stack, x, y, z, player);
|
||||
return getEnergyStored(stack) >= energyPerOperation && (radius > 0) ? breakAOEBlocks(stack, x, y, z, radius, depth, player) : super.onBlockStartBreak(stack, x, y, z, player);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -73,13 +74,13 @@ public abstract class MiningTool extends ToolBase {//todo add custom information
|
||||
List<ItemConfigField> fields = getFields(stack, player.inventory.currentItem);
|
||||
for (ItemConfigField field : fields)
|
||||
{
|
||||
if (!world.isRemote && field.name.equals(References.DIG_AOE))
|
||||
{
|
||||
if (field.name.equals(References.DIG_AOE)) {
|
||||
int aoe = (Integer) field.value;
|
||||
aoe++;
|
||||
if (aoe > (Integer)field.max) aoe = (Integer) field.min;
|
||||
if (aoe > (Integer) field.max) aoe = (Integer) field.min;
|
||||
field.value = aoe;
|
||||
field.sendChanges();
|
||||
//field.sendChanges();
|
||||
DataUtills.writeObjectToItem(stack, field.value, field.datatype, field.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -87,11 +88,11 @@ public abstract class MiningTool extends ToolBase {//todo add custom information
|
||||
return super.onItemRightClick(stack, world, player);
|
||||
}
|
||||
|
||||
//todo Hud, Hud Config, shift right click, attack, axe, hoe
|
||||
//todo attack, hoe, textures
|
||||
//This method is basses on tinkerers construct
|
||||
public boolean breakAOEBlocks(ItemStack stack, int x, int y, int z, int breakRadius, int breakDepth, EntityPlayer player)
|
||||
{
|
||||
Map<Block, Integer> blockMap = getObliterationList(stack);
|
||||
Map<Block, Integer> blockMap = ItemNBTHelper.getBoolean(stack, References.OBLITERATE, false) ? getObliterationList(stack) : new HashMap<Block, Integer>();
|
||||
Block block = player.worldObj.getBlock(x,y,z);
|
||||
int meta = player.worldObj.getBlockMetadata(x,y,z);
|
||||
boolean effective = false;
|
||||
@@ -196,6 +197,9 @@ public abstract class MiningTool extends ToolBase {//todo add custom information
|
||||
if (!world.isRemote) {
|
||||
((EntityPlayerMP)player).playerNetServerHandler.sendPacket(new S23PacketBlockChange(x, y, z, world));
|
||||
}
|
||||
|
||||
if ((blockMap.containsKey(block) && blockMap.get(block) == meta)) extractEnergy(stack, energyPerOperation, false);
|
||||
if (breakSound) world.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(block) + (meta << 12));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -127,8 +127,8 @@ public class RFItemBase extends ItemDE implements IEnergyContainerItem, IConfigu
|
||||
@Override
|
||||
public List<String> getDisplayData(ItemStack stack) {
|
||||
List<String> list = new ArrayList<String>();
|
||||
for (ItemConfigField field : getFields(stack, 0)) list.add(field.getLocalizedName() + ": " + field.getFormatedValue());
|
||||
if (capacity > 0) list.add(StatCollector.translateToLocal("info.de.charge.txt") + ": " + Utills.formatNumber(getEnergyStored(stack)) + " / " + Utills.formatNumber(capacity));
|
||||
for (ItemConfigField field : getFields(stack, 0)) list.add(field.getTooltipInfo());//list.add(field.getLocalizedName() + ": " + field.getFormatedValue());
|
||||
if (capacity > 0) list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.charge.txt") + ": " + InfoHelper.HITC() + Utills.formatNumber(getEnergyStored(stack)) + " / " + Utills.formatNumber(capacity));
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
+11
-1
@@ -1,6 +1,7 @@
|
||||
package com.brandon3055.draconicevolution.common.items.tools.baseclasses;
|
||||
|
||||
import com.brandon3055.draconicevolution.DraconicEvolution;
|
||||
import com.brandon3055.draconicevolution.client.keybinding.KeyBindings;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.utills.InfoHelper;
|
||||
import com.brandon3055.draconicevolution.common.utills.ItemConfigField;
|
||||
@@ -12,9 +13,11 @@ import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.ForgeHooks;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
@@ -129,7 +132,6 @@ public class ToolBase extends RFItemBase {
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean extended) {
|
||||
boolean show = InfoHelper.holdShiftForDetails(list);
|
||||
//if (show) InfoHelper.addEnergyInfo(stack, list);
|
||||
if (show){
|
||||
List<ItemConfigField> l = getFields(stack, 0);
|
||||
for (ItemConfigField f : l) list.add(f.getTooltipInfo());
|
||||
@@ -141,5 +143,13 @@ public class ToolBase extends RFItemBase {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addAditionalInformation(ItemStack stack, EntityPlayer player, List list, boolean extended) {
|
||||
list.add("Press " + Keyboard.getKeyName(KeyBindings.toolConfig.getKeyCode()) + " to open config gui");
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack) {
|
||||
if (stack.getUnlocalizedName().contains(":wyvern")) return EnumRarity.rare;
|
||||
if (stack.getUnlocalizedName().contains(":draconic")) return EnumRarity.epic;
|
||||
return EnumRarity.uncommon;
|
||||
}
|
||||
}
|
||||
+9
-2
@@ -172,6 +172,7 @@ public class ToolHandler {
|
||||
entity.attackEntityFrom(DamageSource.causePlayerDamage(player), (entHealth) * dmg);
|
||||
}
|
||||
}
|
||||
((EntityLivingBase) entity).attackTime = 0;
|
||||
} else if (entity instanceof EntityDragonPart) {
|
||||
if (!world.isRemote) {
|
||||
if (stack == null || !(stack.getItem() instanceof IEnergyContainerItem) || ((IEnergyContainerItem) stack.getItem()).getEnergyStored(stack) < References.ENERGYPERBLOCK) {
|
||||
@@ -233,13 +234,18 @@ public class ToolHandler {
|
||||
World world = player.worldObj;
|
||||
AxisAlignedBB box = AxisAlignedBB.getBoundingBox(entity.posX - range, entity.posY - range, entity.posZ - range, entity.posX + range, entity.posY + range, entity.posZ + range).expand(1.0D, 1.0D, 1.0D);
|
||||
List list = world.getEntitiesWithinAABBExcludingEntity(player, box);
|
||||
for (Object entityObject : list) {
|
||||
if (stack == null || !(stack.getItem() instanceof IEnergyContainerItem) || ((IEnergyContainerItem) stack.getItem()).getEnergyStored(stack) < References.ENERGYPERBLOCK) {
|
||||
if (range == 0){
|
||||
if (stack == null || !(stack.getItem() instanceof IEnergyContainerItem) || ((IEnergyContainerItem) stack.getItem()).getEnergyStored(stack) < References.ENERGYPERATTACK) {
|
||||
if (!player.capabilities.isCreativeMode) return;
|
||||
} else {
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
((IEnergyContainerItem) stack.getItem()).extractEnergy(stack, References.ENERGYPERATTACK, false);
|
||||
}
|
||||
entity.attackEntityFrom(DamageSource.causePlayerDamage(player), dmg + sharp);
|
||||
return;
|
||||
}
|
||||
|
||||
for (Object entityObject : list) {
|
||||
if (entityObject instanceof EntityLivingBase) {
|
||||
((Entity) entityObject).attackEntityFrom(DamageSource.causePlayerDamage(player), dmg + sharp);
|
||||
|
||||
@@ -266,6 +272,7 @@ public class ToolHandler {
|
||||
entityLivingBase.motionY = 0.4000000059604645D;
|
||||
}
|
||||
}
|
||||
entityLivingBase.attackTime = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.brandon3055.draconicevolution.common.lib;
|
||||
public final class References {
|
||||
public static final String MODID = "DraconicEvolution";
|
||||
public static final String MODNAME = "Draconic Evolution";
|
||||
public static final String VERSION = "1.0.1-snapshot_0";
|
||||
public static final String VERSION = "1.0.1-snapshot_3";
|
||||
public static final String MCVERSION = "1.7.10";
|
||||
public static final String CLIENTPROXYLOCATION = "com.brandon3055.draconicevolution.client.ClientProxy";
|
||||
public static final String SERVERPROXYLOCATION = "com.brandon3055.draconicevolution.common.ServerProxy";
|
||||
|
||||
+3
-3
@@ -117,14 +117,14 @@ public class TileDissEnchanter extends TileEntity implements ISidedInventory {
|
||||
if (!player.capabilities.isCreativeMode) player.addExperienceLevel(-dissenchantCost);
|
||||
if (items[0] != null && ItemNBTHelper.getInteger(items[0], "RepairCost", 0) > 0)ItemNBTHelper.setInteger(items[0], "RepairCost", ItemNBTHelper.getInteger(items[0], "RepairCost", 0) - Math.min(2, ItemNBTHelper.getInteger(items[0], "RepairCost", 0)));
|
||||
if (!player.capabilities.isCreativeMode) decrStackSize(1, 1);
|
||||
int maxDamage = items[0].getMaxDamage();
|
||||
int maxDamage = items[0] != null ? items[0].getMaxDamage() : 0;
|
||||
float damageF = (40f - bookPower)/100f;
|
||||
int damage = (int)(damageF*(float)maxDamage);
|
||||
int damageResult = items[0].getItemDamage() + damage;
|
||||
int damageResult = items[0] != null ? items[0].getItemDamage() + damage : 0;
|
||||
|
||||
if (!player.capabilities.isCreativeMode && damageResult > maxDamage && maxDamage > 0) {
|
||||
setInventorySlotContents(0, null);
|
||||
}else if (!player.capabilities.isCreativeMode && maxDamage > 0){
|
||||
}else if (!player.capabilities.isCreativeMode && maxDamage > 0 && items[0] != null){
|
||||
items[0].setItemDamage(damageResult);
|
||||
}
|
||||
onInventoryChanged();
|
||||
|
||||
@@ -8,10 +8,5 @@ import java.util.List;
|
||||
* Created by Brandon on 29/12/2014.
|
||||
*/
|
||||
public interface IConfigurableItem {
|
||||
//todo
|
||||
// String[] getNames(ItemStack stack);
|
||||
//
|
||||
// int getDataType(String name);
|
||||
|
||||
List<ItemConfigField> getFields(ItemStack stack, int slot);
|
||||
}
|
||||
@@ -7,6 +7,6 @@ import java.util.List;
|
||||
/**
|
||||
* Created by Brandon on 26/01/2015.
|
||||
*/
|
||||
public interface IHudDisplayItem {//todo create and implement block version
|
||||
public interface IHudDisplayItem {
|
||||
List<String> getDisplayData(ItemStack stack);
|
||||
}
|
||||
+10
-2
@@ -145,7 +145,11 @@ public class WorldGenEnderIsland extends WorldGenerator {
|
||||
private void generateObelisk(World world, int x1, int y1, int z1, boolean outer, Random rand) {
|
||||
if (!outer) {
|
||||
world.setBlock(x1, y1 + 20, z1, Blocks.bedrock, 0, 2);
|
||||
if (!world.isRemote) world.spawnEntityInWorld(new EntityEnderCrystal(world, x1 + 0.5, y1 + 21, z1 + 0.5));
|
||||
if (!world.isRemote) {
|
||||
EntityEnderCrystal crystal = new EntityEnderCrystal(world);
|
||||
crystal.setPosition(x1 + 0.5, y1 + 21, z1 + 0.5);
|
||||
world.spawnEntityInWorld(crystal);
|
||||
}
|
||||
for (int y = y1; y < y1 + 20; y++) {
|
||||
world.setBlock(x1, y, z1, Blocks.obsidian, 0, 2);
|
||||
world.setBlock(x1 + 1, y, z1, Blocks.obsidian, 0, 2);
|
||||
@@ -159,7 +163,11 @@ public class WorldGenEnderIsland extends WorldGenerator {
|
||||
}
|
||||
} else {
|
||||
world.setBlock(x1, y1 + 40, z1, Blocks.bedrock, 0, 2);
|
||||
if (!world.isRemote) world.spawnEntityInWorld(new EntityEnderCrystal(world, x1 + 0.5, y1 + 41, z1 + 0.5));
|
||||
if (!world.isRemote) {
|
||||
EntityEnderCrystal crystal = new EntityEnderCrystal(world);
|
||||
crystal.setPosition(x1 + 0.5, y1 + 41, z1 + 0.5);
|
||||
world.spawnEntityInWorld(crystal);
|
||||
}
|
||||
int diff = 0;
|
||||
for (int y = y1 + 20; y < y1 + 40; y++) {
|
||||
diff++;
|
||||
|
||||
Reference in new issue
Block a user