• R/O
  • HTTP
  • SSH
  • HTTPS

ChemiCraftNext: Commit


Commit MetaInfo

Revisióna8c55217b54f7e6fa93c6876bd9222fa40110533 (tree)
Tiempo2013-03-10 15:48:58
Autormozipi <mozipi@user...>
Commitermozipi

Log Message

放射線銃完成

Cambiar Resumen

Diferencia incremental

--- a/common/pcc/chemicraft/ChemiCraft.java
+++ b/common/pcc/chemicraft/ChemiCraft.java
@@ -30,6 +30,8 @@ import pcc.chemicraft.item.ItemChemiCell;
3030 import pcc.chemicraft.item.ItemCompounds;
3131 import pcc.chemicraft.item.ItemDust;
3232 import pcc.chemicraft.item.ItemGasCollectingBottle;
33+import pcc.chemicraft.item.ItemRadiationBallet;
34+import pcc.chemicraft.item.ItemRadiationGun;
3335 import pcc.chemicraft.ore.BlockAtomOres;
3436 import pcc.chemicraft.ore.ItemAtomOres;
3537 import pcc.chemicraft.system.CommonProxy;
@@ -106,6 +108,9 @@ public class ChemiCraft implements Runnable {
106108 public int gasCollectingBottleID;
107109 public int atomGrenadeID;
108110 public int chemicalCellsID;
111+ public int dustID;
112+ public int radiationGunID;
113+ public int radiationBalletID;
109114
110115 /**
111116 * BlockID.
@@ -147,6 +152,8 @@ public class ChemiCraft implements Runnable {
147152 public Item itemAtomGrenade;
148153 public Item itemChemicalCells;
149154 public Item itemDust;
155+ public Item itemRadiationGun;
156+ public Item itemRadiationBallet;
150157
151158 /**
152159 * このmodで使用するTextureのパス.
@@ -206,6 +213,9 @@ public class ChemiCraft implements Runnable {
206213 Property gasCollectingBottleIDProp = cfg.getItem("gasCollectingBottleID", 25002);
207214 Property atomGrenadeIDProp = cfg.getItem("AtomGrenadeID", 25003);
208215 Property chemicalCellsIDProp = cfg.getItem("ChemicalCellID", 25004);
216+ Property dustIDProp = cfg.getItem("DustID", 25005);
217+ Property radiationGunIDProp = cfg.getItem("RadiationGunID", 25006);
218+ Property radiationBalletIDProp = cfg.getItem("RadiationBalletID", 25007);
209219
210220 Property guiPyrolysisTableIDProp = cfg.get("GUI", "GUIPyrolysisID", 1000);
211221 Property guiElectrolysisTableIDProp = cfg.get("GUI", "GUIElectrolysisTableIDProp", 1001);
@@ -228,6 +238,9 @@ public class ChemiCraft implements Runnable {
228238 this.gasCollectingBottleID = gasCollectingBottleIDProp.getInt();
229239 this.atomGrenadeID = atomGrenadeIDProp.getInt();
230240 this.chemicalCellsID = chemicalCellsIDProp.getInt();
241+ this.dustID = dustIDProp.getInt();
242+ this.radiationGunID = radiationGunIDProp.getInt();
243+ this.radiationBalletID = radiationBalletIDProp.getInt();
231244
232245 this.guiPyrolysisTableID = guiPyrolysisTableIDProp.getInt();
233246 this.guiElectrolysisTableID = guiElectrolysisTableIDProp.getInt();
@@ -323,6 +336,9 @@ public class ChemiCraft implements Runnable {
323336 this.itemAtomGrenade = new ItemAtomsGrenade(this.atomGrenadeID).setItemName("grenade").setIconIndex(1);
324337 this.itemChemicalCells = new ItemChemiCell(this.chemicalCellsID).setItemName("chemiCell").setIconIndex(3);
325338 this.itemDust = new ItemDust(15000).setItemName("dust").setIconIndex(12);
339+ this.itemRadiationGun = new ItemRadiationGun(this.radiationGunID).setIconIndex(4).setItemName("RadiationGun");
340+ this.itemRadiationBallet = new ItemRadiationBallet(this.radiationBalletID).setIconIndex(5).setItemName("RadiationBallet");
341+
326342
327343 // BlockをMinecraftに登録します
328344 GameRegistry.registerBlock(this.blockPyrolysisTable, "BlockPyrolysisTable");
@@ -352,6 +368,10 @@ public class ChemiCraft implements Runnable {
352368 this.nameAuxiliary.addName(this.itemAtomGrenade, "ja_JP", "元素手榴弾");
353369 this.nameAuxiliary.addName(this.itemDust, "dust");
354370 this.nameAuxiliary.addName(this.itemDust, "ja_JP", "粉塵");
371+ this.nameAuxiliary.addName(this.itemRadiationGun, "RadiationGun");
372+ this.nameAuxiliary.addName(this.itemRadiationGun, "ja_JP", "放射線銃");
373+ this.nameAuxiliary.addName(this.itemRadiationBallet, "RadiationBallet");
374+ this.nameAuxiliary.addName(this.itemRadiationGun, "ja_JP", "放射線弾");
355375
356376 // TileEntityを追加します
357377 GameRegistry.registerTileEntity(TileEntityPyrolysisTable.class, "TileEntityPyrolysisTable");
--- /dev/null
+++ b/common/pcc/chemicraft/item/ItemRadiationBallet.java
@@ -0,0 +1,19 @@
1+package pcc.chemicraft.item;
2+
3+import pcc.chemicraft.ChemiCraft;
4+import net.minecraft.item.Item;
5+
6+public class ItemRadiationBallet extends Item {
7+
8+ public ItemRadiationBallet(int par1) {
9+ super(par1);
10+ this.setCreativeTab(ChemiCraft.creativeTabChemiCraft);
11+ this.maxStackSize = 16;
12+ }
13+
14+ @Override
15+ public String getTextureFile() {
16+ return ChemiCraft.instance.ITEM_TEXTURE;
17+ }
18+
19+}
--- /dev/null
+++ b/common/pcc/chemicraft/item/ItemRadiationGun.java
@@ -0,0 +1,112 @@
1+package pcc.chemicraft.item;
2+
3+import java.util.Iterator;
4+
5+import net.minecraft.entity.Entity;
6+import net.minecraft.entity.EntityLiving;
7+import net.minecraft.entity.player.EntityPlayer;
8+import net.minecraft.item.Item;
9+import net.minecraft.item.ItemStack;
10+import net.minecraft.potion.Potion;
11+import net.minecraft.potion.PotionEffect;
12+import net.minecraft.util.AxisAlignedBB;
13+import net.minecraft.util.DamageSource;
14+import net.minecraft.world.World;
15+import pcc.chemicraft.ChemiCraft;
16+
17+public class ItemRadiationGun extends Item {
18+
19+ private short delay;
20+
21+ public ItemRadiationGun(int par1) {
22+ super(par1);
23+ this.setCreativeTab(ChemiCraft.creativeTabChemiCraft);
24+ this.maxStackSize = 1;
25+ }
26+
27+ @Override
28+ public String getTextureFile() {
29+ return ChemiCraft.instance.ITEM_TEXTURE;
30+ }
31+
32+ @Override
33+ public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World,
34+ EntityPlayer par3EntityPlayer) {
35+
36+ boolean isCreative = par3EntityPlayer.capabilities.isCreativeMode;
37+
38+ if (this.delay <= 0) {
39+ if (isCreative) {
40+ if (par3EntityPlayer.inventory.hasItem(ChemiCraft.instance.itemRadiationBallet.shiftedIndex)) {
41+ this.field_00001(par1ItemStack, par2World, par3EntityPlayer);
42+ par3EntityPlayer.inventory.consumeInventoryItem(ChemiCraft.instance.itemRadiationBallet.shiftedIndex);
43+ par2World.playSound(par3EntityPlayer.posX,
44+ par3EntityPlayer.posY,
45+ par3EntityPlayer.posZ,
46+ "mob.endermen.portal",
47+ 1.0F,
48+ 1.3F,
49+ false);
50+ if (!par2World.isRemote) {
51+ this.delay = 100;
52+ }
53+ } else {
54+ this.field_00001(par1ItemStack, par2World, par3EntityPlayer);
55+ par2World.playSound(par3EntityPlayer.posX,
56+ par3EntityPlayer.posY,
57+ par3EntityPlayer.posZ,
58+ "mob.endermen.portal",
59+ 1.0F,
60+ 1.3F,
61+ false);
62+ if (!par2World.isRemote) {
63+ this.delay = 100;
64+ }
65+ }
66+ }
67+ }
68+
69+ return super.onItemRightClick(par1ItemStack, par2World, par3EntityPlayer);
70+ }
71+
72+ private void field_00001(ItemStack par1ItemStack, World par2World,
73+ EntityPlayer par3EntityPlayer) {
74+ int distance = 0;
75+ double minX = par3EntityPlayer.posX;
76+ double minZ = par3EntityPlayer.posZ;
77+ double maxX = par3EntityPlayer.posX - Math.sin(Math.toRadians(par3EntityPlayer.rotationYaw)) * 20;
78+ double maxZ = par3EntityPlayer.posZ + Math.cos(Math.toRadians(par3EntityPlayer.rotationYaw)) * 20;
79+ double posY = par3EntityPlayer.posY;
80+ for(distance = 0;distance < Math.abs(((minX-maxX) + (minZ-maxZ))) / 2;distance++){
81+ AxisAlignedBB aabb = AxisAlignedBB.getBoundingBox(
82+ minX + -Math.sin(Math.toRadians(par3EntityPlayer.rotationYaw)) * distance,
83+ posY + 1,
84+ minZ + Math.cos(Math.toRadians(par3EntityPlayer.rotationYaw)) * distance,
85+ minX + -Math.sin(Math.toRadians(par3EntityPlayer.rotationYaw)) * distance,
86+ posY + 1,
87+ minZ + Math.cos(Math.toRadians(par3EntityPlayer.rotationYaw)) * distance
88+ ).expand(1.5, 3, 1.5);
89+
90+ Iterator itr = par2World.getEntitiesWithinAABB(EntityLiving.class, aabb).iterator();
91+ while(itr.hasNext()){
92+ EntityLiving entity = (EntityLiving) itr.next();
93+ if(entity != par3EntityPlayer){
94+ entity.attackEntityFrom(DamageSource.causePlayerDamage(par3EntityPlayer), 10);
95+ entity.attackEntityFrom(DamageSource.causePlayerDamage(par3EntityPlayer), (int) (10 + Math.random() * 11));
96+ entity.addPotionEffect(new PotionEffect(Potion.moveSlowdown.getId(), 1, 20*20));
97+ entity.addPotionEffect(new PotionEffect(Potion.weakness.getId(), 1, 20*20));
98+ }
99+ }
100+ }
101+ }
102+
103+ @Override
104+ public void onUpdate(ItemStack par1ItemStack, World par2World,
105+ Entity par3Entity, int par4, boolean par5) {
106+ if (this.delay > 0 && !par2World.isRemote) {
107+ this.delay--;
108+ }
109+ }
110+
111+
112+}
Binary files a/resources/pcc/chemicraft/items/items.png and b/resources/pcc/chemicraft/items/items.png differ
Show on old repository browser