--- /dev/null
+\83|\83P\83b\83g\83T\83E\83\93\83h:
+http://pocket-se.info/
\ No newline at end of file
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;
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本体
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();
public ChemiCraftRegisterCompoundsHandler registerCompoundsHandler;
public ChemiCraftRegisterEntitys registerEntitys;
+ /**
+ * Sin Visualizer Instance.
+ */
+ public SinVisualizer sinVisualizer;
+
public ChemiCraft() {
this.registerBlock = new ChemiCraftRegisterBlock(this);
this.registerItem = new ChemiCraftRegisterItem(this);
this.registerCompounds = new ChemiCraftRegisterCompounds(this);
this.registerCompoundsHandler = new ChemiCraftRegisterCompoundsHandler(this);
this.registerEntitys = new ChemiCraftRegisterEntitys(this);
+
+ //this.sinVisualizer = new SinVisualizer();
}
/**
}
+
+
+ public SinVisualizer getSinVisualizer() {
+ return this.sinVisualizer;
+ }
+
}
package pcc.chemicraft.container;
+import java.awt.Toolkit;
+
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
@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;
}
world = player.worldObj;
list = world.loadedEntityList;
itr = list.iterator();
- player.dimension = 128;
while(itr.hasNext()){
Entity entity = itr.next();
if(entity instanceof EntityItem){
package pcc.chemicraft.item;
+import java.util.ArrayList;
import java.util.Iterator;
import net.minecraft.entity.Entity;
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;
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,
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;
}
}
}
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
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 {
}
+ 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;
+ }
+
+ }
+
}