OSDN Git Service

RaditionGunのSE追加。Credit表記も
[chemicraft/chemicraft.git] / common / pcc / chemicraft / util / Auxiliary.java
index a34db96..8e42b4f 100644 (file)
@@ -1,10 +1,25 @@
 package pcc.chemicraft.util;
 
+import java.awt.Toolkit;
 import java.util.ArrayList;
 
+import pcc.chemicraft.ChemiCraft;
+import pcc.chemicraft.debug.DebugData;
+import pcc.chemicraft.debug.DebugTick;
+
+import sinVisualizer.SinVisualizerPanel;
+import sinVisualizer.Values;
+
 import net.minecraft.block.Block;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.EntityLiving;
+import net.minecraft.entity.player.EntityPlayer;
 import net.minecraft.item.Item;
 import net.minecraft.item.ItemStack;
+import net.minecraft.pathfinding.PathEntity;
+import net.minecraft.util.DamageSource;
+import net.minecraft.util.MathHelper;
+import net.minecraft.world.World;
 import cpw.mods.fml.common.registry.LanguageRegistry;
 
 public class Auxiliary {
@@ -227,4 +242,46 @@ public class Auxiliary {
 
        }
 
+       public static class MathAuxiliary {
+
+               public static ArrayList<Entity> getTriangleEntitys(World par1World,
+                               double par2, double par3, double par4,
+                               double yaw,
+                               double pitch,
+                               double angle,
+                               double rad) {
+
+                       ArrayList<Entity> entitys = (ArrayList<Entity>) par1World.loadedEntityList;
+                       ArrayList<Entity> result = new ArrayList<Entity>();
+                       for (int i = 0; i < entitys.size(); i++) {
+                               Entity entity = entitys.get(i);
+                               double x = entity.posX;
+                               double y = entity.posY;
+                               double z = entity.posZ;
+                               double bx = par2;
+                               double by = par3;
+                               double bz = par4;
+                               double look = Math.sin(Math.toRadians(yaw)) * 180;
+                               double lookPitch = Math.abs(pitch);
+                               double playerToEntityAngleXZ = Math.sin(Math.atan2(bx - x, bz - z)) * 180;
+                               double playerToEntityAngleY = Math.toDegrees(Math.atan(y - by));
+                               double length =
+                                               Math.sqrt(
+                                                               Math.pow(Math.abs(bx - x), 2) +
+                                                               Math.pow(Math.abs(by - y), 2) +
+                                                               Math.pow(Math.abs(bz - z), 2));
+
+                               if (look + angle/2 > playerToEntityAngleXZ && look - angle/2 < playerToEntityAngleXZ) {
+                                       if (length < rad) {
+                                               result.add(entity);
+                                       }
+                               }
+
+                       }
+
+                       return result;
+               }
+
+       }
+
 }