mirror of
https://github.com/GTNewHorizons/Draconic-Evolution.git
synced 2026-11-24 22:14:51 +00:00
Fixed Grinder crash
This commit is contained in:
1 parent
641c23e80d
commit
ada67f3cf7
20 files changed
+74
-96
No files matched your search
@@ -3,7 +3,7 @@ package cofh.api.energy;
|
||||
/**
|
||||
* An energy internalGenBuffer is the unit of interaction with EnergyHelper inventories.
|
||||
*
|
||||
* A reference implementation can be found at {@link EnergyStorage}.
|
||||
* A reference implementation can be found at {@link com.brandon3055.draconicevolution.common.core.utills.EnergyStorage}.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package cofh.api.energy;
|
||||
|
||||
import com.brandon3055.draconicevolution.common.core.utills.EnergyStorage;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
@@ -15,7 +15,7 @@ public class KeyBindings {
|
||||
public static KeyBinding placeItem;
|
||||
|
||||
public static void init() {
|
||||
placeItem = new KeyBinding("key.pong", Keyboard.KEY_P, "key.categories."+ References.MODID);
|
||||
placeItem = new KeyBinding("key.placeItem", Keyboard.KEY_P, References.MODNAME);
|
||||
ClientRegistry.registerKeyBinding(placeItem);
|
||||
}
|
||||
}
|
||||
+9
-4
@@ -14,6 +14,7 @@ public class ConfigHandler {
|
||||
public static int disableXrayBlock;
|
||||
public static boolean bowBlockDamage;
|
||||
public static String[] spawnerList;
|
||||
public static String[] obliterationList;
|
||||
public static boolean spawnerListType;
|
||||
public static int soulDropChance;
|
||||
public static int dislocator_Min_Range;
|
||||
@@ -23,8 +24,10 @@ public class ConfigHandler {
|
||||
public static int admin_dislocator_Detect_Range;
|
||||
public static int disable_LRD;
|
||||
public static boolean updateFix;
|
||||
public static boolean showUnlocalizedNames;
|
||||
|
||||
private static String[] defaultList = new String[] {"ExampleMob1", "ExampleMob2", "ExampleMob3 (these examples can be deleted)"};
|
||||
private static String[] defaultSpawnerList = new String[] {"ExampleMob1", "ExampleMob2", "ExampleMob3 (these examples can be deleted)"};
|
||||
private static String[] defaultObliterationList = new String[] {"tile.stonebrick", "tile.gravel", "tile.dirt", "tile.stone", "tile.dirt", "tile.sandStone", "tile.sand", "tile.grass", "tile.hellrock"};
|
||||
|
||||
public static void init(File confFile) {
|
||||
if (config == null) {
|
||||
@@ -43,8 +46,10 @@ public class ConfigHandler {
|
||||
teleporterUsesPerPearl = config.get(Configuration.CATEGORY_GENERAL, "Teleporter Uses PerPearl", 1, "Charm of Dislocation uses per Ender pearl").getInt(10);
|
||||
bowBlockDamage = config.get(Configuration.CATEGORY_GENERAL, "Bow Block Damage", true, "Dose Draconic bow explosion damage blocks").getBoolean(true);
|
||||
spawnerListType = config.get("spawner", "listType", false, "Sets weather the spawner list is a white list or a black list (true = white list false = black list)").getBoolean(false);
|
||||
spawnerList = config.getStringList("Spawn List", "spawner", defaultList, "List of names that will be ether accepted or rejected by the spawner depending on the list type");
|
||||
soulDropChance = config.get("spawner", "soulDropChance", 1000, "Mobs have a 1 in this number chance to drop a soul", 1, Integer.MAX_VALUE).getInt(1000);
|
||||
spawnerList = config.getStringList("Spawn List", "spawner", defaultSpawnerList, "List of names that will be ether accepted or rejected by the spawner depending on the list type");
|
||||
obliterationList = config.getStringList("Oblit Mode List", Configuration.CATEGORY_GENERAL, defaultObliterationList, "List of block (unlocalized)names that will be destroyed by tools in obliteration mode. To find the unlocalized name of a block see the \"Show Unlocalized Names\" config option");
|
||||
showUnlocalizedNames = config.get(Configuration.CATEGORY_GENERAL, "Show Unlocalized Names", false, "If set to true the unlocalized name of every block and item will be displayed in its tool tip").getBoolean(false);
|
||||
soulDropChance = config.get(Configuration.CATEGORY_GENERAL, "soulDropChance", 1000, "Mobs have a 1 in this number chance to drop a soul", 1, Integer.MAX_VALUE).getInt(1000);
|
||||
updateFix = config.get(Configuration.CATEGORY_GENERAL, "Update Fix", true, "Convert blocks from v0.9.2 to the v0.2.3+ format (set to false if you are not updating from v0.9.2 or earlier)").getBoolean(true);
|
||||
|
||||
//dislocator_Min_Range = config.get("Long Range Dislocator", "Admin Dislocator Min Range", 1000000).getInt(1000000);
|
||||
@@ -72,7 +77,7 @@ public class ConfigHandler {
|
||||
teleporterUsesPerPearl = config.getInt("Teleporter Uses PerPearl", Configuration.CATEGORY_GENERAL, teleporterUsesPerPearl, 0, Integer.MAX_VALUE, "Charm of Dislocation uses per Ender pearl");
|
||||
bowBlockDamage = config.getBoolean(Configuration.CATEGORY_GENERAL, "Bow Block Damage", bowBlockDamage, "Dose Draconic bow explosion damage blocks");
|
||||
spawnerListType = config.getBoolean("spawner", "listType", spawnerListType, "Sets weather the spawner list is a white list or a black list (true = white list false = black list)");
|
||||
spawnerList = config.getStringList("Spawn List", "spawner", defaultList, "List of names that will be ether accepted or rejected by the spawner depending on the list type");
|
||||
spawnerList = config.getStringList("Spawn List", "spawner", defaultSpawnerList, "List of names that will be ether accepted or rejected by the spawner depending on the list type");
|
||||
soulDropChance = config.getInt("soulDropChance", "spawner", soulDropChance, 1, Integer.MAX_VALUE, "Mobs have a 1 in this number chance to drop a soul");
|
||||
updateFix = config.getBoolean(Configuration.CATEGORY_GENERAL, "Update Fix", updateFix, "Convert blocks from v0.9.2 to the v0.2.3+ format (set to false if you are not updating from v0.9.2 or earlier)");
|
||||
|
||||
|
||||
+6
@@ -21,6 +21,7 @@ import net.minecraft.world.chunk.storage.ExtendedBlockStorage;
|
||||
import net.minecraftforge.event.entity.EntityEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingDropsEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
|
||||
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
|
||||
import net.minecraftforge.event.world.ChunkEvent;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -174,4 +175,9 @@ public class MinecraftForgeEventHandler {
|
||||
{
|
||||
if (event.entity instanceof EntityPlayer && ExtendedPlayer.get((EntityPlayer) event.entity) == null) ExtendedPlayer.register((EntityPlayer) event.entity);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void itemTooltipEvent(ItemTooltipEvent event){
|
||||
if (ConfigHandler.showUnlocalizedNames) event.toolTip.add(event.itemStack.getUnlocalizedName());
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package com.brandon3055.draconicevolution.common.core.proxy;
|
||||
|
||||
import com.brandon3055.draconicevolution.DraconicEvolution;
|
||||
import com.brandon3055.draconicevolution.client.keybinding.KeyBindings;
|
||||
import com.brandon3055.draconicevolution.client.keybinding.KeyInputHandler;
|
||||
import com.brandon3055.draconicevolution.client.render.*;
|
||||
import com.brandon3055.draconicevolution.common.blocks.ModBlocks;
|
||||
import com.brandon3055.draconicevolution.common.entity.EntityCustomDragon;
|
||||
@@ -11,6 +12,7 @@ import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.Til
|
||||
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileEnergyStorageCore;
|
||||
import cpw.mods.fml.client.registry.ClientRegistry;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
@@ -28,6 +30,7 @@ public class ClientProxy extends CommonProxy {
|
||||
super.preInit(event);
|
||||
|
||||
//Client Only
|
||||
FMLCommonHandler.instance().bus().register(new KeyInputHandler());
|
||||
registerRendering();
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.brandon3055.draconicevolution.common.core.proxy;
|
||||
|
||||
import com.brandon3055.draconicevolution.DraconicEvolution;
|
||||
import com.brandon3055.draconicevolution.client.interfaces.GuiHandler;
|
||||
import com.brandon3055.draconicevolution.client.keybinding.KeyInputHandler;
|
||||
import com.brandon3055.draconicevolution.common.blocks.ModBlocks;
|
||||
import com.brandon3055.draconicevolution.common.core.handler.ConfigHandler;
|
||||
import com.brandon3055.draconicevolution.common.core.handler.CraftingHandler;
|
||||
@@ -79,7 +78,6 @@ public class CommonProxy {
|
||||
public void registerEventListeners() {
|
||||
MinecraftForge.EVENT_BUS.register(new MinecraftForgeEventHandler());
|
||||
FMLCommonHandler.instance().bus().register(new FMLEventHandler());
|
||||
FMLCommonHandler.instance().bus().register(new KeyInputHandler());
|
||||
}
|
||||
|
||||
public void registerPackets() {
|
||||
|
||||
+3
-2
@@ -1,9 +1,10 @@
|
||||
package cofh.api.energy;
|
||||
package com.brandon3055.draconicevolution.common.core.utills;
|
||||
|
||||
import cofh.api.energy.IEnergyStorage;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
/**
|
||||
* Reference implementation of {@link IEnergyStorage}. Use/extend this or implement your own.
|
||||
* Reference implementation of {@link cofh.api.energy.IEnergyStorage}. Use/extend this or implement your own.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
@@ -138,6 +138,8 @@ public class DraconicArmor extends ItemArmor implements ISpecialArmor{
|
||||
if(stack != null && stack.getItem() == ModItems.draconicHelm) {
|
||||
if (player.worldObj.getBlockLightValue((int)player.posX, (int)player.posY, (int)player.posZ) < 5)
|
||||
player.addPotionEffect(new PotionEffect(16, 210, 0, true));
|
||||
else if (player.isPotionActive(16))
|
||||
player.removePotionEffect(16);
|
||||
}
|
||||
if(stack != null && stack.getItem() == ModItems.draconicLeggs) {
|
||||
if (player.isSprinting())
|
||||
|
||||
+3
-3
@@ -40,7 +40,7 @@ public class DraconicDistructionStaff extends ItemTool implements IEnergyContain
|
||||
public IIcon itemIcon0;
|
||||
public IIcon itemIcon1;
|
||||
public IIcon itemIcon2;
|
||||
protected int capacity = References.DRACONICCAPACITY;
|
||||
protected int capacity = References.DRACONICCAPACITY * 10;
|
||||
protected int maxReceive = References.DRACONICTRANSFER;
|
||||
protected int maxExtract = References.DRACONICTRANSFER * 50;
|
||||
|
||||
@@ -68,7 +68,7 @@ public class DraconicDistructionStaff extends ItemTool implements IEnergyContain
|
||||
this.setUnlocalizedName(Strings.draconicDStaffName);
|
||||
this.setCreativeTab(DraconicEvolution.tolkienTabToolsWeapons);
|
||||
this.setHarvestLevel("pickaxe", 4);
|
||||
this.setHarvestLevel("spade", 4);
|
||||
this.setHarvestLevel("shovel", 4);
|
||||
this.setHarvestLevel("axe", 4);
|
||||
GameRegistry.registerItem(this, Strings.draconicDStaffName);
|
||||
}
|
||||
@@ -142,7 +142,7 @@ public class DraconicDistructionStaff extends ItemTool implements IEnergyContain
|
||||
@Override
|
||||
public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) {
|
||||
ToolHandler.AOEAttack(player, entity, stack, 25, ItemNBTHelper.getShort(stack, "size", (short) 0) * 2);
|
||||
ToolHandler.demageEntytyBasedOnHealth(entity, player, 0.5F);
|
||||
ToolHandler.damageEntityBasedOnHealth(entity, player, 0.5F);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
+36
-43
@@ -18,7 +18,6 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldSettings.GameType;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -28,7 +27,7 @@ public class ToolHandler {
|
||||
public static Material[] materialsPick = {Material.anvil, Material.circuits, Material.coral, Material.glass, Material.ice, Material.iron, Material.rock};
|
||||
public static Material[] materialsShovel = {Material.clay, Material.ground, Material.grass, Material.sand, Material.snow, Material.craftedSnow};
|
||||
public static Material[] materialsAxe = {Material.cactus, Material.leaves, Material.wood, Material.plants};
|
||||
public static Material[] materialsDStaff = {Material.anvil, Material.circuits, Material.coral, Material.glass, Material.ice, Material.iron, Material.rock, Material.clay, Material.ground, Material.grass, Material.sand, Material.snow, Material.craftedSnow, Material.cactus, Material.leaves, Material.wood, Material.plants};
|
||||
public static Material[] materialsDStaff = {Material.anvil, Material.circuits, Material.coral, Material.glass, Material.ice, Material.iron, Material.rock, Material.clay, Material.ground, Material.grass, Material.sand, Material.snow, Material.craftedSnow, Material.cactus, Material.leaves, Material.wood, Material.plants, Material.cloth};
|
||||
public static Block[] destroyList = {Blocks.cobblestone, Blocks.stone, Blocks.dirt, Blocks.gravel, Blocks.sand, Blocks.grass, Blocks.netherrack};
|
||||
|
||||
public static boolean isRightMaterial(final Material material, final Material[] materialsListing) {
|
||||
@@ -53,8 +52,7 @@ public class ToolHandler {
|
||||
int size = stack.getItem().equals(ModItems.draconicAxe) ? 2 : ItemNBTHelper.getShort(stack, "size", (short) 0);
|
||||
MovingObjectPosition mop = raytraceFromEntity(world, player, 4.5D);
|
||||
if (mop == null) {
|
||||
if (player instanceof EntityPlayer)
|
||||
updateGhostBlocks(player, world);
|
||||
if (player instanceof EntityPlayer) updateGhostBlocks(player, world);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -101,21 +99,25 @@ public class ToolHandler {
|
||||
Material mat = block.getMaterial();
|
||||
if ((block != null) && (!block.isAir(world, x, y, z)) && (block.getPlayerRelativeBlockHardness(player, world, x, y, z) != 0.0F)) {
|
||||
List<ItemStack> items = new ArrayList();
|
||||
|
||||
if ((!block.canHarvestBlock(player, meta)) || (!isRightMaterial(mat, materialsListing))) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(stack.getItem() instanceof IEnergyContainerItem) || ((IEnergyContainerItem) stack.getItem()).getEnergyStored(stack) < References.ENERGYPERBLOCK) {
|
||||
if (!player.capabilities.isCreativeMode) return;
|
||||
} else {
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
((IEnergyContainerItem) stack.getItem()).extractEnergy(stack, References.ENERGYPERBLOCK, false);
|
||||
}
|
||||
|
||||
if (checkDestroyList(block) && (ItemNBTHelper.getBoolean(stack, "obliterate", false))) {
|
||||
world.setBlockToAir(x, y, z);
|
||||
return;
|
||||
}
|
||||
if (!(stack.getItem() instanceof IEnergyContainerItem) || ((IEnergyContainerItem)stack.getItem()).getEnergyStored(stack) < References.ENERGYPERBLOCK) {
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
return;
|
||||
} else {
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
((IEnergyContainerItem)stack.getItem()).extractEnergy(stack, References.ENERGYPERBLOCK, false);
|
||||
}
|
||||
|
||||
if ((stack.getItem().equals(ModItems.draconicAxe) ? 2 : ItemNBTHelper.getShort(stack, "size", (short) 0)) == 0) return;
|
||||
|
||||
if ((silk) && (block.canSilkHarvest(world, player, x, y, z, meta))) {
|
||||
if (block == Blocks.lit_redstone_ore)
|
||||
items.add(new ItemStack(Item.getItemFromBlock(Blocks.redstone_ore)));
|
||||
@@ -126,8 +128,10 @@ public class ToolHandler {
|
||||
int xp = block.getExpDrop(world, meta, fortune);
|
||||
player.addExperience(xp);
|
||||
}
|
||||
|
||||
world.setBlockToAir(x, y, z);
|
||||
if (!world.isRemote && !(((EntityPlayerMP) player).theItemInWorldManager.getGameType() == GameType.CREATIVE)) {
|
||||
|
||||
if (!world.isRemote && !player.capabilities.isCreativeMode && world.getGameRules().getGameRuleBooleanValue("doTileDrops")) {
|
||||
for (final ItemStack item : items) {
|
||||
world.spawnEntityInWorld(new EntityItem(world, player.posX, player.posY, player.posZ, item));
|
||||
}
|
||||
@@ -154,42 +158,39 @@ public class ToolHandler {
|
||||
return stack;
|
||||
}
|
||||
|
||||
public static void demageEntytyBasedOnHealth(Entity entity, EntityPlayer player, float dmg) {
|
||||
public static void damageEntityBasedOnHealth(Entity entity, EntityPlayer player, float dmg) {
|
||||
World world = player.worldObj;
|
||||
ItemStack stack = player.getCurrentEquippedItem();
|
||||
if (entity instanceof EntityLivingBase) {
|
||||
float entHealth = ((EntityLivingBase) entity).getHealth();
|
||||
if (!world.isRemote) {
|
||||
if (entHealth > 20) {
|
||||
if (stack == null || !(stack.getItem() instanceof IEnergyContainerItem) || ((IEnergyContainerItem)stack.getItem()).getEnergyStored(stack) < References.ENERGYPERBLOCK) {
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
return;
|
||||
if (stack == null || !(stack.getItem() instanceof IEnergyContainerItem) || ((IEnergyContainerItem) stack.getItem()).getEnergyStored(stack) < References.ENERGYPERBLOCK) {
|
||||
if (!player.capabilities.isCreativeMode) return;
|
||||
} else {
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
((IEnergyContainerItem)stack.getItem()).extractEnergy(stack, References.ENERGYPERATTACK + (int)((entHealth) * 100), false);
|
||||
((IEnergyContainerItem) stack.getItem()).extractEnergy(stack, References.ENERGYPERATTACK + (int) ((entHealth) * 100), false);
|
||||
}
|
||||
entity.attackEntityFrom(DamageSource.causePlayerDamage(player), (entHealth) * dmg);
|
||||
}
|
||||
}
|
||||
} else if (entity instanceof EntityDragonPart) {
|
||||
if (!world.isRemote) {
|
||||
if (stack == null || !(stack.getItem() instanceof IEnergyContainerItem) || ((IEnergyContainerItem)stack.getItem()).getEnergyStored(stack) < References.ENERGYPERBLOCK) {
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
return;
|
||||
if (stack == null || !(stack.getItem() instanceof IEnergyContainerItem) || ((IEnergyContainerItem) stack.getItem()).getEnergyStored(stack) < References.ENERGYPERBLOCK) {
|
||||
if (!player.capabilities.isCreativeMode) return;
|
||||
} else {
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
((IEnergyContainerItem)stack.getItem()).extractEnergy(stack, References.ENERGYPERATTACK + (int)((200F) * 100), false);
|
||||
((IEnergyContainerItem) stack.getItem()).extractEnergy(stack, References.ENERGYPERATTACK + (int) ((200F) * 100), false);
|
||||
}
|
||||
entity.attackEntityFrom(DamageSource.causePlayerDamage(player), 200F * dmg);
|
||||
}
|
||||
} else {
|
||||
if (!world.isRemote) {
|
||||
if (stack == null || !(stack.getItem() instanceof IEnergyContainerItem) || ((IEnergyContainerItem)stack.getItem()).getEnergyStored(stack) < References.ENERGYPERBLOCK) {
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
return;
|
||||
if (stack == null || !(stack.getItem() instanceof IEnergyContainerItem) || ((IEnergyContainerItem) stack.getItem()).getEnergyStored(stack) < References.ENERGYPERBLOCK) {
|
||||
if (!player.capabilities.isCreativeMode) return;
|
||||
} else {
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
((IEnergyContainerItem)stack.getItem()).extractEnergy(stack, References.ENERGYPERATTACK + (int)((100F) * 100), false);
|
||||
((IEnergyContainerItem) stack.getItem()).extractEnergy(stack, References.ENERGYPERATTACK + (int) ((100F) * 100), false);
|
||||
}
|
||||
entity.attackEntityFrom(DamageSource.causePlayerDamage(player), 100F * dmg);
|
||||
}
|
||||
@@ -205,12 +206,11 @@ public class ToolHandler {
|
||||
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 o : list) {
|
||||
if (stack == null || !(stack.getItem() instanceof IEnergyContainerItem) || ((IEnergyContainerItem)stack.getItem()).getEnergyStored(stack) < References.ENERGYPERBLOCK) {
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
return;
|
||||
if (stack == null || !(stack.getItem() instanceof IEnergyContainerItem) || ((IEnergyContainerItem) stack.getItem()).getEnergyStored(stack) < References.ENERGYPERBLOCK) {
|
||||
if (!player.capabilities.isCreativeMode) return;
|
||||
} else {
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
((IEnergyContainerItem)stack.getItem()).extractEnergy(stack, References.ENERGYPERATTACK, false);
|
||||
((IEnergyContainerItem) stack.getItem()).extractEnergy(stack, References.ENERGYPERATTACK, false);
|
||||
}
|
||||
if (((Entity) o) instanceof EntityLivingBase)
|
||||
((Entity) o).attackEntityFrom(DamageSource.causePlayerDamage(player), dmg + sharp);
|
||||
@@ -219,15 +219,13 @@ public class ToolHandler {
|
||||
|
||||
}
|
||||
|
||||
public static MovingObjectPosition raytraceFromEntity (World world, Entity player, double range)
|
||||
{
|
||||
public static MovingObjectPosition raytraceFromEntity(World world, Entity player, double range) {
|
||||
float f = 1.0F;
|
||||
float f1 = player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch) * f;
|
||||
float f2 = player.prevRotationYaw + (player.rotationYaw - player.prevRotationYaw) * f;
|
||||
double d0 = player.prevPosX + (player.posX - player.prevPosX) * (double) f;
|
||||
double d1 = player.prevPosY + (player.posY - player.prevPosY) * (double) f;
|
||||
if (!world.isRemote && player instanceof EntityPlayer)
|
||||
d1 += 1.62D;
|
||||
if (!world.isRemote && player instanceof EntityPlayer) d1 += 1.62D;
|
||||
double d2 = player.prevPosZ + (player.posZ - player.prevPosZ) * (double) f;
|
||||
Vec3 vec3 = Vec3.createVectorHelper(d0, d1, d2);
|
||||
float f3 = MathHelper.cos(-f2 * 0.017453292F - (float) Math.PI);
|
||||
@@ -237,26 +235,21 @@ public class ToolHandler {
|
||||
float f7 = f4 * f5;
|
||||
float f8 = f3 * f5;
|
||||
double d3 = range;
|
||||
if (player instanceof EntityPlayerMP)
|
||||
{
|
||||
if (player instanceof EntityPlayerMP) {
|
||||
d3 = ((EntityPlayerMP) player).theItemInWorldManager.getBlockReachDistance();
|
||||
}
|
||||
Vec3 vec31 = vec3.addVector((double) f7 * d3, (double) f6 * d3, (double) f8 * d3);
|
||||
return world.rayTraceBlocks(vec3, vec31);
|
||||
}
|
||||
|
||||
private static void updateGhostBlocks(EntityPlayer player, World world)
|
||||
{
|
||||
private static void updateGhostBlocks(EntityPlayer player, World world) {
|
||||
int xPos = (int) player.posX;
|
||||
int yPos = (int) player.posY;
|
||||
int zPos = (int) player.posZ;
|
||||
|
||||
for (int x = xPos - 6; x < xPos + 6; x++)
|
||||
{
|
||||
for (int y = yPos - 6; y < yPos + 6; y++)
|
||||
{
|
||||
for (int z = zPos - 6; z < zPos + 6; z++)
|
||||
{
|
||||
for (int x = xPos - 6; x < xPos + 6; x++) {
|
||||
for (int y = yPos - 6; y < yPos + 6; y++) {
|
||||
for (int z = zPos - 6; z < zPos + 6; z++) {
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -58,7 +58,7 @@ public class DraconicSword extends ItemSword implements IEnergyContainerItem{
|
||||
public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity)
|
||||
{
|
||||
ToolHandler.AOEAttack(player, entity, stack, 15, 3);
|
||||
ToolHandler.demageEntytyBasedOnHealth(entity, player, 0.3F);
|
||||
ToolHandler.damageEntityBasedOnHealth(entity, player, 0.3F);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -61,7 +61,7 @@ public class WyvernSword extends ItemSword implements IEnergyContainerItem{
|
||||
public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity)
|
||||
{
|
||||
ToolHandler.AOEAttack(player, entity, stack, 8, 1);
|
||||
ToolHandler.demageEntytyBasedOnHealth(entity, player, 0.2F);
|
||||
ToolHandler.damageEntityBasedOnHealth(entity, player, 0.2F);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
+1
-7
@@ -1,17 +1,14 @@
|
||||
package com.brandon3055.draconicevolution.common.tileentities;
|
||||
|
||||
import cofh.api.energy.EnergyStorage;
|
||||
import com.brandon3055.draconicevolution.common.core.utills.EnergyStorage;
|
||||
import cofh.api.energy.IEnergyContainerItem;
|
||||
import cofh.api.energy.IEnergyHandler;
|
||||
import com.brandon3055.draconicevolution.client.render.EnergyParticle;
|
||||
import com.brandon3055.draconicevolution.common.core.handler.ParticleHandler;
|
||||
import com.brandon3055.draconicevolution.common.core.utills.EnergyHelper;
|
||||
import com.brandon3055.draconicevolution.common.core.utills.InventoryHelper;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -19,13 +16,10 @@ import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import static net.minecraftforge.common.util.ForgeDirection.UP;
|
||||
|
||||
/**
|
||||
* Created by Brandon on 27/06/2014.
|
||||
*/
|
||||
|
||||
+1
-13
@@ -1,16 +1,10 @@
|
||||
package com.brandon3055.draconicevolution.common.tileentities;
|
||||
|
||||
import cofh.api.energy.EnergyStorage;
|
||||
import com.brandon3055.draconicevolution.common.core.utills.EnergyStorage;
|
||||
import cofh.api.energy.IEnergyHandler;
|
||||
import com.brandon3055.draconicevolution.common.core.utills.LogHelper;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityCreature;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.item.EntityXPOrb;
|
||||
import net.minecraft.entity.monster.EntitySkeleton;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
@@ -21,14 +15,8 @@ import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static net.minecraftforge.common.util.ForgeDirection.UP;
|
||||
|
||||
public class TileGenerator extends TileEntity implements ISidedInventory, IEnergyHandler {
|
||||
//########### variables #############//
|
||||
private ItemStack[] items;
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ package com.brandon3055.draconicevolution.common.tileentities;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cofh.api.energy.EnergyStorage;
|
||||
import com.brandon3055.draconicevolution.common.core.utills.EnergyStorage;
|
||||
import cofh.api.energy.IEnergyHandler;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
+2
-7
@@ -1,14 +1,9 @@
|
||||
package com.brandon3055.draconicevolution.common.tileentities;
|
||||
|
||||
import static net.minecraftforge.common.util.ForgeDirection.DOWN;
|
||||
import static net.minecraftforge.common.util.ForgeDirection.EAST;
|
||||
import static net.minecraftforge.common.util.ForgeDirection.NORTH;
|
||||
import static net.minecraftforge.common.util.ForgeDirection.SOUTH;
|
||||
import static net.minecraftforge.common.util.ForgeDirection.UP;
|
||||
import static net.minecraftforge.common.util.ForgeDirection.WEST;
|
||||
import cofh.api.energy.EnergyStorage;
|
||||
|
||||
import com.brandon3055.draconicevolution.common.core.utills.EnergyStorage;
|
||||
import cofh.api.energy.IEnergyHandler;
|
||||
import com.brandon3055.draconicevolution.common.core.utills.LogHelper;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
+1
-6
@@ -1,15 +1,13 @@
|
||||
package com.brandon3055.draconicevolution.common.tileentities.multiblocktiles;
|
||||
|
||||
import cofh.api.energy.EnergyStorage;
|
||||
import com.brandon3055.draconicevolution.common.core.utills.EnergyStorage;
|
||||
import cofh.api.energy.IEnergyHandler;
|
||||
import com.brandon3055.draconicevolution.client.render.Particles;
|
||||
import com.brandon3055.draconicevolution.common.blocks.ModBlocks;
|
||||
import com.brandon3055.draconicevolution.common.blocks.multiblock.MultiblockHelper.TileLocation;
|
||||
import com.brandon3055.draconicevolution.common.core.handler.ParticleHandler;
|
||||
import com.brandon3055.draconicevolution.common.core.utills.LogHelper;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.Packet;
|
||||
@@ -18,9 +16,6 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
|
||||
-3
@@ -1,7 +1,5 @@
|
||||
package com.brandon3055.draconicevolution.common.tileentities.multiblocktiles;
|
||||
|
||||
import cofh.api.energy.EnergyStorage;
|
||||
import cofh.api.energy.IEnergyHandler;
|
||||
import com.brandon3055.draconicevolution.common.blocks.ModBlocks;
|
||||
import com.brandon3055.draconicevolution.common.blocks.multiblock.MultiblockHelper.TileLocation;
|
||||
import com.brandon3055.draconicevolution.common.core.utills.LogHelper;
|
||||
@@ -13,7 +11,6 @@ import net.minecraft.network.Packet;
|
||||
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
/**
|
||||
* Created by Brandon on 25/07/2014.
|
||||
|
||||
Reference in new issue
Block a user