OSDN Git Service

RaditionGunのSE追加。Credit表記も
authormozipi <mozipi@users.sourceforge.jp>
Thu, 21 Mar 2013 17:16:27 +0000 (02:16 +0900)
committermozipi <mozipi@users.sourceforge.jp>
Thu, 21 Mar 2013 17:16:27 +0000 (02:16 +0900)
SE/Credit.txt [new file with mode: 0644]
SE/raditionGun.ogg [new file with mode: 0644]
common/pcc/chemicraft/ChemiCraft.java
common/pcc/chemicraft/container/ContainerChemicalCraftingTable.java
common/pcc/chemicraft/debug/CommandDeleteItem.java
common/pcc/chemicraft/item/ItemRadiationGun.java
common/pcc/chemicraft/util/Auxiliary.java

diff --git a/SE/Credit.txt b/SE/Credit.txt
new file mode 100644 (file)
index 0000000..cc51636
--- /dev/null
@@ -0,0 +1,2 @@
+\83|\83P\83b\83g\83T\83E\83\93\83h:
+http://pocket-se.info/
\ No newline at end of file
diff --git a/SE/raditionGun.ogg b/SE/raditionGun.ogg
new file mode 100644 (file)
index 0000000..ac0bac6
Binary files /dev/null and b/SE/raditionGun.ogg differ
index ac73030..c682bc3 100644 (file)
@@ -1,50 +1,26 @@
 package pcc.chemicraft;
 
 import net.minecraft.block.Block;
-import net.minecraft.block.material.Material;
 import net.minecraft.creativetab.CreativeTabs;
 import net.minecraft.item.Item;
 import net.minecraft.item.ItemStack;
-import net.minecraft.src.ModLoader;
 import net.minecraftforge.common.Configuration;
-import net.minecraftforge.common.MinecraftForge;
 import net.minecraftforge.common.Property;
 import net.minecraftforge.oredict.OreDictionary;
-import pcc.chemicraft.block.BlockChemicalCombinationTable;
-import pcc.chemicraft.block.BlockChemicalCraftingTable;
-import pcc.chemicraft.block.BlockElectrolysisTable;
-import pcc.chemicraft.block.BlockPyrolysisTable;
-import pcc.chemicraft.block.BlockToolAndWeaponCraftingTable;
 import pcc.chemicraft.compounds.CompoundDebug;
-import pcc.chemicraft.compounds.CompoundWater;
 import pcc.chemicraft.creativetab.CreativeTabAtomOres;
 import pcc.chemicraft.creativetab.CreativeTabChemiCraft;
 import pcc.chemicraft.debug.CommandDeleteItem;
 import pcc.chemicraft.debug.CommandGenDebugRoom;
 import pcc.chemicraft.debug.CommandSetTile;
-import pcc.chemicraft.entity.EntityDust;
-import pcc.chemicraft.gen.EnumOreSpawnFrequency;
-import pcc.chemicraft.item.ItemAtoms;
-import pcc.chemicraft.item.ItemAtomsGrenade;
-import pcc.chemicraft.item.ItemChemiCell;
-import pcc.chemicraft.item.ItemCompounds;
-import pcc.chemicraft.item.ItemDust;
-import pcc.chemicraft.item.ItemGasCollectingBottle;
-import pcc.chemicraft.item.ItemRadiationBallet;
-import pcc.chemicraft.item.ItemRadiationGun;
-import pcc.chemicraft.ore.BlockAtomOres;
-import pcc.chemicraft.ore.ItemAtomOres;
 import pcc.chemicraft.system.CommonProxy;
 import pcc.chemicraft.system.PacketHandler;
-import pcc.chemicraft.tileentity.TileEntityChemicalCombinationTable;
-import pcc.chemicraft.tileentity.TileEntityChemicalCraftingTable;
-import pcc.chemicraft.tileentity.TileEntityElectrolysisTable;
-import pcc.chemicraft.tileentity.TileEntityPyrolysisTable;
-import pcc.chemicraft.tileentity.TileEntityToolAndWeaponCraftingTable;
 import pcc.chemicraft.util.Auxiliary;
 import pcc.chemicraft.util.Auxiliary.ArrayAuxiliary;
+import pcc.chemicraft.util.Auxiliary.MathAuxiliary;
 import pcc.chemicraft.util.Auxiliary.NameAuxiliary;
-import pcc.chemicraft.util.NBTRecipeGrenade;
+import sinVisualizer.SinVisualizer;
+import sinVisualizer.SinVisualizerPanel;
 import cpw.mods.fml.common.Mod;
 import cpw.mods.fml.common.Mod.Instance;
 import cpw.mods.fml.common.Mod.PostInit;
@@ -56,9 +32,7 @@ import cpw.mods.fml.common.event.FMLPreInitializationEvent;
 import cpw.mods.fml.common.event.FMLServerStartingEvent;
 import cpw.mods.fml.common.network.NetworkMod;
 import cpw.mods.fml.common.network.NetworkRegistry;
-import cpw.mods.fml.common.registry.EntityRegistry;
 import cpw.mods.fml.common.registry.GameRegistry;
-import cpw.mods.fml.common.registry.LanguageRegistry;
 
 /**
  * ChemiCraft本体
@@ -188,7 +162,11 @@ public class ChemiCraft implements Runnable {
        public Auxiliary auxiliary = new Auxiliary();
        public NameAuxiliary nameAuxiliary = new NameAuxiliary();
        public ArrayAuxiliary arrayAuxiliary = new ArrayAuxiliary();
+       public MathAuxiliary mathAuxiliary = new MathAuxiliary();
 
+       /**
+        * API Instance and Data Instance.
+        */
        public ChemiCraftAPI api = ChemiCraftAPI.instance();
        public static final ChemiCraftData chemicalData = new ChemiCraftData();
 
@@ -214,6 +192,11 @@ public class ChemiCraft implements Runnable {
        public ChemiCraftRegisterCompoundsHandler registerCompoundsHandler;
        public ChemiCraftRegisterEntitys registerEntitys;
 
+       /**
+        * Sin Visualizer Instance.
+        */
+       public SinVisualizer sinVisualizer;
+
        public ChemiCraft() {
                this.registerBlock = new ChemiCraftRegisterBlock(this);
                this.registerItem = new ChemiCraftRegisterItem(this);
@@ -223,6 +206,8 @@ public class ChemiCraft implements Runnable {
                this.registerCompounds = new ChemiCraftRegisterCompounds(this);
                this.registerCompoundsHandler = new ChemiCraftRegisterCompoundsHandler(this);
                this.registerEntitys = new ChemiCraftRegisterEntitys(this);
+
+               //this.sinVisualizer  = new SinVisualizer();
        }
 
        /**
@@ -441,4 +426,10 @@ public class ChemiCraft implements Runnable {
 
        }
 
+
+
+       public SinVisualizer getSinVisualizer() {
+               return this.sinVisualizer;
+       }
+
 }
index 9492bcd..4f50e87 100644 (file)
@@ -1,5 +1,7 @@
 package pcc.chemicraft.container;
 
+import java.awt.Toolkit;
+
 import net.minecraft.entity.player.EntityPlayer;
 import net.minecraft.inventory.Container;
 import net.minecraft.inventory.IInventory;
@@ -133,8 +135,40 @@ public class ContainerChemicalCraftingTable extends Container {
 
 
        @Override
-       public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2){
-               return null;
+       public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) {
+               ItemStack var3 = null;
+               Slot var4 = (Slot)this.inventorySlots.get(par2);
+               Slot var6 = (Slot)this.inventorySlots.get(0);
+
+               if (var4 != null && var4.getHasStack()) {
+                       ItemStack var5 = var4.getStack();
+                       var3 = var5.copy();
+                       if (par2 >= 0 && par2 < 13) {
+                               if (!this.mergeItemStack(var5, 13, 13+36, false)) {
+                                       return null;
+                               }
+                       } else if (par2 >= 16 && par2 < 53) {
+                               if (var6.isItemValid(var3)) {
+                                       if (!this.mergeItemStack(var5, 3, 13, false)) {
+                                               return null;
+                                       }
+                               }
+                       }
+
+                       if (var5.stackSize == 0) {
+                               var4.putStack((ItemStack)null);
+                       } else {
+                               var4.onSlotChanged();
+                       }
+
+                       if (var5.stackSize == var3.stackSize) {
+                               return null;
+                       }
+
+                       var4.onPickupFromSlot(par1EntityPlayer, var5);
+               }
+
+               return var3;
        }
 
 
index 362b6ae..77a78aa 100644 (file)
@@ -48,7 +48,6 @@ public class CommandDeleteItem extends CommandBase {
                        world = player.worldObj;
                        list = world.loadedEntityList;
                        itr = list.iterator();
-                       player.dimension = 128;
                        while(itr.hasNext()){
                                Entity entity = itr.next();
                                if(entity instanceof EntityItem){
index 0d202ea..9623918 100644 (file)
@@ -1,5 +1,6 @@
 package pcc.chemicraft.item;
 
+import java.util.ArrayList;
 import java.util.Iterator;
 
 import net.minecraft.entity.Entity;
@@ -11,6 +12,9 @@ import net.minecraft.potion.Potion;
 import net.minecraft.potion.PotionEffect;
 import net.minecraft.util.AxisAlignedBB;
 import net.minecraft.util.DamageSource;
+import net.minecraft.util.MovingObjectPosition;
+import net.minecraft.util.Vec3;
+import net.minecraft.util.Vec3Pool;
 import net.minecraft.world.World;
 import pcc.chemicraft.ChemiCraft;
 
@@ -36,9 +40,9 @@ public class ItemRadiationGun extends Item {
                boolean isCreative = par3EntityPlayer.capabilities.isCreativeMode;
 
                if (this.delay <= 0) {
-                       if (isCreative) {
+                       if (!isCreative) {
+                               this.field_00001(par1ItemStack, par2World, par3EntityPlayer);
                                if (par3EntityPlayer.inventory.hasItem(ChemiCraft.instance.itemRadiationBallet.shiftedIndex)) {
-                                       this.field_00001(par1ItemStack, par2World, par3EntityPlayer);
                                        par3EntityPlayer.inventory.consumeInventoryItem(ChemiCraft.instance.itemRadiationBallet.shiftedIndex);
                                        par2World.playSound(par3EntityPlayer.posX,
                                                        par3EntityPlayer.posY,
@@ -50,18 +54,18 @@ public class ItemRadiationGun extends Item {
                                        if (!par2World.isRemote) {
                                                this.delay = 100;
                                        }
-                               } else {
-                                       this.field_00001(par1ItemStack, par2World, par3EntityPlayer);
-                                       par2World.playSound(par3EntityPlayer.posX,
-                                                       par3EntityPlayer.posY,
-                                                       par3EntityPlayer.posZ,
-                                                       "mob.endermen.portal",
-                                                       1.0F,
-                                                       1.3F,
-                                                       false);
-                                       if (!par2World.isRemote) {
-                                               this.delay = 100;
-                                       }
+                               }
+                       } else {
+                               this.field_00001(par1ItemStack, par2World, par3EntityPlayer);
+                               par2World.playSound(par3EntityPlayer.posX,
+                                               par3EntityPlayer.posY,
+                                               par3EntityPlayer.posZ,
+                                               "mob.endermen.portal",
+                                               1.0F,
+                                               1.3F,
+                                               false);
+                               if (!par2World.isRemote) {
+                                       this.delay = 100;
                                }
                        }
                }
@@ -71,33 +75,27 @@ public class ItemRadiationGun extends Item {
 
        private void field_00001(ItemStack par1ItemStack, World par2World,
                        EntityPlayer par3EntityPlayer) {
-               int distance = 0;
-               double minX = par3EntityPlayer.posX;
-               double minZ = par3EntityPlayer.posZ;
-               double maxX = par3EntityPlayer.posX - Math.sin(Math.toRadians(par3EntityPlayer.rotationYaw)) * 20;
-               double maxZ = par3EntityPlayer.posZ + Math.cos(Math.toRadians(par3EntityPlayer.rotationYaw)) * 20;
-               double posY = par3EntityPlayer.posY;
-               for(distance = 0;distance < Math.abs(((minX-maxX) + (minZ-maxZ))) / 2;distance++){
-                       AxisAlignedBB aabb = AxisAlignedBB.getBoundingBox(
-                                       minX + -Math.sin(Math.toRadians(par3EntityPlayer.rotationYaw)) * distance,
-                                       posY + 1,
-                                       minZ + Math.cos(Math.toRadians(par3EntityPlayer.rotationYaw)) * distance,
-                                       minX + -Math.sin(Math.toRadians(par3EntityPlayer.rotationYaw)) * distance,
-                                       posY + 1,
-                                       minZ + Math.cos(Math.toRadians(par3EntityPlayer.rotationYaw)) * distance
-                                       ).expand(1.5, 3, 1.5);
-
-                       Iterator itr = par2World.getEntitiesWithinAABB(EntityLiving.class, aabb).iterator();
-                       while(itr.hasNext()){
-                               EntityLiving entity = (EntityLiving) itr.next();
-                               if(entity != par3EntityPlayer){
-                                       entity.attackEntityFrom(DamageSource.causePlayerDamage(par3EntityPlayer), 10);
+
+               ArrayList<Entity> collisions = ChemiCraft.instance.mathAuxiliary.getTriangleEntitys(par2World,
+                               par3EntityPlayer.posX,
+                               par3EntityPlayer.posY,
+                               par3EntityPlayer.posZ,
+                               par3EntityPlayer.rotationYaw,
+                               par3EntityPlayer.rotationPitch,
+                               30,
+                               15);
+
+               for (int i = 0; i < collisions.size(); i++) {
+                       if (collisions.get(i) instanceof EntityLiving) {
+                               try {
+                                       EntityLiving entity = (EntityLiving) collisions.get(i);
                                        entity.attackEntityFrom(DamageSource.causePlayerDamage(par3EntityPlayer), (int) (10 + Math.random() * 11));
-                                       entity.addPotionEffect(new PotionEffect(Potion.moveSlowdown.getId(), 1, 20*20));
-                                       entity.addPotionEffect(new PotionEffect(Potion.weakness.getId(), 1, 20*20));
+                               } catch (ClassCastException e) {
+                                       break;
                                }
                        }
                }
+
        }
 
        @Override
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;
+               }
+
+       }
+
 }