• R/O
  • HTTP
  • SSH
  • HTTPS

ChemiCraftNext: Commit


Commit MetaInfo

Revisiónad066e3e28b95c1173af6cd31fc9ab0db1655d2c (tree)
Tiempo2013-03-07 19:40:19
Autormozipi <mozipi@user...>
Commitermozipi

Log Message

くるったのでtc

Cambiar Resumen

Diferencia incremental

--- a/common/pcc/chemicraft/ChemiCraft.java
+++ b/common/pcc/chemicraft/ChemiCraft.java
@@ -5,6 +5,7 @@ import net.minecraft.block.material.Material;
55 import net.minecraft.creativetab.CreativeTabs;
66 import net.minecraft.item.Item;
77 import net.minecraft.item.ItemStack;
8+import net.minecraft.src.ModLoader;
89 import net.minecraftforge.common.Configuration;
910 import net.minecraftforge.common.Property;
1011 import net.minecraftforge.oredict.OreDictionary;
@@ -20,10 +21,12 @@ import pcc.chemicraft.creativetab.CreativeTabChemiCraft;
2021 import pcc.chemicraft.debug.CommandDeleteItem;
2122 import pcc.chemicraft.debug.CommandGenDebugRoom;
2223 import pcc.chemicraft.debug.CommandSetTile;
24+import pcc.chemicraft.entity.EntityDust;
2325 import pcc.chemicraft.item.ItemAtoms;
2426 import pcc.chemicraft.item.ItemAtomsGrenade;
2527 import pcc.chemicraft.item.ItemChemiCell;
2628 import pcc.chemicraft.item.ItemCompounds;
29+import pcc.chemicraft.item.ItemDust;
2730 import pcc.chemicraft.item.ItemGasCollectingBottle;
2831 import pcc.chemicraft.ore.BlockAtomOres;
2932 import pcc.chemicraft.ore.ItemAtomOres;
@@ -45,7 +48,9 @@ import cpw.mods.fml.common.event.FMLPreInitializationEvent;
4548 import cpw.mods.fml.common.event.FMLServerStartingEvent;
4649 import cpw.mods.fml.common.network.NetworkMod;
4750 import cpw.mods.fml.common.network.NetworkRegistry;
51+import cpw.mods.fml.common.registry.EntityRegistry;
4852 import cpw.mods.fml.common.registry.GameRegistry;
53+import cpw.mods.fml.common.registry.LanguageRegistry;
4954 /**
5055 * ChemiCraft本体
5156 * @author P.C.C.
@@ -139,6 +144,7 @@ public class ChemiCraft implements Runnable {
139144 public Item itemGasCollectingBottle;
140145 public Item itemAtomGrenade;
141146 public Item itemChemicalCells;
147+ public Item itemDust;
142148
143149 /**
144150 * このmodで使用するTextureのパス.
@@ -155,6 +161,7 @@ public class ChemiCraft implements Runnable {
155161 public final String GUI_CHEMICALCOMBINATION_TEXTURE = "/pcc/chemicraft/guis/ChemicalCombination.png";
156162 public final String GUI_TOOLANDWEAPONCRAFTING_TEXTURE = "/pcc/chemicraft/guis/ToolAndWeaponCrafting.png";
157163 public final String GUI_CHEMICALCRAFTING_TEXTURE = "/pcc/chemicraft/guis/MaterialCrafting.png";
164+ public final String ENTITY_PARTICLE_TEXRURE = "/pcc/chemicraft/entityParticles/dust.png";
158165
159166 /**
160167 * このmodに必要な補助クラスのインスタンス.
@@ -312,6 +319,7 @@ public class ChemiCraft implements Runnable {
312319 this.itemGasCollectingBottle = new ItemGasCollectingBottle(this.gasCollectingBottleID).setItemName("gasCollectingBottle").setIconIndex(0);
313320 this.itemAtomGrenade = new ItemAtomsGrenade(this.atomGrenadeID).setItemName("grenade").setIconIndex(1);
314321 this.itemChemicalCells = new ItemChemiCell(this.chemicalCellsID).setItemName("chemiCell").setIconIndex(3);
322+ this.itemDust = new ItemDust(15000).setItemName("dust").setIconIndex(12);
315323
316324 // BlockをMinecraftに登録します
317325 GameRegistry.registerBlock(this.blockPyrolysisTable, "BlockPyrolysisTable");
@@ -339,6 +347,8 @@ public class ChemiCraft implements Runnable {
339347 this.nameAuxiliary.addName(this.itemGasCollectingBottle, "ja_JP", "集気瓶");
340348 this.nameAuxiliary.addName(this.itemAtomGrenade, "AtomGrenade");
341349 this.nameAuxiliary.addName(this.itemAtomGrenade, "ja_JP", "元素手榴弾");
350+ this.nameAuxiliary.addName(this.itemDust, "dust");
351+ this.nameAuxiliary.addName(this.itemDust, "ja_JP", "粉塵");
342352
343353 // TileEntityを追加します
344354 GameRegistry.registerTileEntity(TileEntityPyrolysisTable.class, "TileEntityPyrolysisTable");
@@ -514,6 +524,21 @@ public class ChemiCraft implements Runnable {
514524 api.getAtomOresAmounts().get(api.getAtomOresName().getKeyList(i)));
515525 }
516526
527+ //Entityを追加
528+ LanguageRegistry.instance().addStringLocalization("entity.Dust.name", "en_US", "Dust");
529+ EntityRegistry.registerModEntity(EntityDust.class,
530+ "Dust",
531+ ModLoader.getUniqueEntityId(),
532+ this,
533+ 250,
534+ 5,
535+ true);
536+ /*
537+ EntityRegistry.registerGlobalEntityID(EntityDust.class,
538+ "Dust",
539+ ModLoader.getUniqueEntityId());
540+ */
541+
517542 this.api.addPyrolysisDecompositionFuel(new ItemStack(Item.coal), 2000*8);
518543 }
519544
--- a/common/pcc/chemicraft/client/ClientProxy.java
+++ b/common/pcc/chemicraft/client/ClientProxy.java
@@ -1,5 +1,7 @@
11 package pcc.chemicraft.client;
22
3+import net.minecraft.client.particle.EffectRenderer;
4+import net.minecraft.client.particle.EntityFX;
35 import net.minecraft.entity.player.EntityPlayer;
46 import net.minecraft.tileentity.TileEntity;
57 import net.minecraft.world.World;
@@ -8,12 +10,14 @@ import pcc.chemicraft.ChemiCraft;
810 import pcc.chemicraft.container.ContainerElectrolysisTable;
911 import pcc.chemicraft.debug.DebugTick;
1012 import pcc.chemicraft.entity.EntityAtomsGrenade;
13+import pcc.chemicraft.entity.EntityDust;
1114 import pcc.chemicraft.gui.GuiChemicalCombinationTable;
1215 import pcc.chemicraft.gui.GuiChemicalCraftingTable;
1316 import pcc.chemicraft.gui.GuiElectrolysisTable;
1417 import pcc.chemicraft.gui.GuiPyrolysisTable;
1518 import pcc.chemicraft.gui.GuiToolAndWeaponCraftingTable;
1619 import pcc.chemicraft.render.RenderAtomsGrenade;
20+import pcc.chemicraft.render.RenderDust;
1721 import pcc.chemicraft.system.CommonProxy;
1822 import pcc.chemicraft.tileentity.TileEntityChemicalCombinationTable;
1923 import pcc.chemicraft.tileentity.TileEntityChemicalCraftingTable;
@@ -22,6 +26,8 @@ import pcc.chemicraft.tileentity.TileEntityPyrolysisTable;
2226 import pcc.chemicraft.tileentity.TileEntityToolAndWeaponCraftingTable;
2327 import cpw.mods.fml.client.FMLClientHandler;
2428 import cpw.mods.fml.client.registry.RenderingRegistry;
29+import cpw.mods.fml.common.registry.EntityRegistry;
30+import cpw.mods.fml.common.registry.EntityRegistry.EntityRegistration;
2531 import cpw.mods.fml.common.registry.TickRegistry;
2632 import cpw.mods.fml.relauncher.Side;
2733
@@ -39,7 +45,9 @@ public class ClientProxy extends CommonProxy {
3945 MinecraftForgeClient.preloadTexture(ChemiCraft.instance.GUI_CHEMICALCOMBINATION_TEXTURE);
4046 MinecraftForgeClient.preloadTexture(ChemiCraft.instance.GUI_CHEMICALCRAFTING_TEXTURE);
4147 MinecraftForgeClient.preloadTexture(ChemiCraft.instance.GUI_TOOLANDWEAPONCRAFTING_TEXTURE);
48+ MinecraftForgeClient.preloadTexture(ChemiCraft.instance.ENTITY_PARTICLE_TEXRURE);
4249 RenderingRegistry.registerEntityRenderingHandler(EntityAtomsGrenade.class, new RenderAtomsGrenade(0.5F));
50+ RenderingRegistry.registerEntityRenderingHandler(EntityDust.class, new RenderDust());
4351 }
4452
4553
--- /dev/null
+++ b/common/pcc/chemicraft/entity/EntityDust.java
@@ -0,0 +1,108 @@
1+package pcc.chemicraft.entity;
2+
3+import net.minecraft.entity.Entity;
4+import net.minecraft.entity.projectile.EntityThrowable;
5+import net.minecraft.nbt.NBTTagCompound;
6+import net.minecraft.util.MathHelper;
7+import net.minecraft.util.MovingObjectPosition;
8+import net.minecraft.world.World;
9+
10+public class EntityDust extends Entity {
11+
12+ private final float explodeSize = 2.0F;
13+ private final short explodeRad = 5;
14+ private int delay = 0;
15+ private int deadDelay = 20;
16+ private float rad = 0;
17+
18+ public EntityDust(World par1World) {
19+ super(par1World);
20+ }
21+
22+ public EntityDust(World par1World, double par2, double par3, double par4) {
23+ super(par1World);
24+ this.posX = par2;
25+ this.posY = par3;
26+ this.posZ = par4;
27+ }
28+
29+ @Override
30+ public void onUpdate() {
31+ super.onUpdate();
32+ this.delay++;
33+ if (this.delay > 100) {
34+ if (this.deadDelay > 0) {
35+ this.deadDelay--;
36+ this.rad += 0.5;
37+ if (this.deadDelay % 4 == 0) {
38+ this.explode(this.rad);
39+ }
40+ } else {
41+ this.setDead();
42+ }
43+ }
44+
45+ float var17 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
46+ this.rotationYaw = (float)(Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI);
47+
48+ for (this.rotationPitch = (float)(Math.atan2(this.motionY, (double)var17) * 180.0D / Math.PI); this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F)
49+ {
50+ ;
51+ }
52+
53+ while (this.rotationPitch - this.prevRotationPitch >= 180.0F)
54+ {
55+ this.prevRotationPitch += 360.0F;
56+ }
57+
58+ while (this.rotationYaw - this.prevRotationYaw < -180.0F)
59+ {
60+ this.prevRotationYaw -= 360.0F;
61+ }
62+
63+ while (this.rotationYaw - this.prevRotationYaw >= 180.0F)
64+ {
65+ this.prevRotationYaw += 360.0F;
66+ }
67+
68+ this.rotationPitch = this.prevRotationPitch + (this.rotationPitch - this.prevRotationPitch) * 0.2F;
69+ this.rotationYaw = this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * 0.2F;
70+
71+ }
72+
73+ @Override
74+ protected void entityInit() {
75+
76+ }
77+
78+ @Override
79+ public void readEntityFromNBT(NBTTagCompound var1) {
80+
81+ }
82+
83+ @Override
84+ public void writeEntityToNBT(NBTTagCompound var1) {
85+
86+ }
87+
88+ private void explode(double r) {
89+ double angle = 0;
90+ double angleY = 0;
91+ for (int i = 0; i < r; i++) {
92+ double y = this.posY - (r/2) + (i * 1F);
93+ double ry = 0;
94+ for (int j = 1; j < r; j++) {
95+ ry = Math.sin((double) i / r * Math.PI) * 8;
96+ angle += 360/j;
97+ double x = this.posX - Math.sin(Math.toRadians(angle)) * ry;
98+ double z = this.posZ + Math.cos(Math.toRadians(angle)) * ry;
99+ this.worldObj.createExplosion(this, x - 6 + Math.random() * 12, y + 3, z - 6 + Math.random() * 12, this.explodeSize, false);
100+ }
101+ }
102+ }
103+
104+ public int getDelay() {
105+ return this.delay;
106+ }
107+
108+}
--- /dev/null
+++ b/common/pcc/chemicraft/item/ItemDust.java
@@ -0,0 +1,29 @@
1+package pcc.chemicraft.item;
2+
3+import pcc.chemicraft.ChemiCraft;
4+import pcc.chemicraft.entity.EntityDust;
5+import net.minecraft.creativetab.CreativeTabs;
6+import net.minecraft.entity.player.EntityPlayer;
7+import net.minecraft.item.Item;
8+import net.minecraft.item.ItemStack;
9+import net.minecraft.world.World;
10+
11+public class ItemDust extends Item {
12+
13+ public ItemDust(int par1) {
14+ super(par1);
15+ this.setCreativeTab(ChemiCraft.instance.creativeTabChemiCraft);
16+ }
17+
18+ @Override
19+ public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World,
20+ EntityPlayer par3EntityPlayer) {
21+ par2World.spawnEntityInWorld(new EntityDust(par2World,
22+ par3EntityPlayer.posX,
23+ par3EntityPlayer.posY,
24+ par3EntityPlayer.posZ));
25+ return par1ItemStack;
26+ }
27+
28+
29+}
--- /dev/null
+++ b/common/pcc/chemicraft/render/RenderDust.java
@@ -0,0 +1,46 @@
1+package pcc.chemicraft.render;
2+
3+import org.lwjgl.opengl.GL11;
4+import org.lwjgl.opengl.GL12;
5+
6+import pcc.chemicraft.ChemiCraft;
7+import pcc.chemicraft.entity.EntityDust;
8+import net.minecraft.client.renderer.Tessellator;
9+import net.minecraft.client.renderer.entity.RenderEntity;
10+import net.minecraft.entity.Entity;
11+
12+public class RenderDust extends RenderEntity {
13+
14+ @Override
15+ public void doRender(Entity var1, double var2, double var4, double var6,
16+ float var8, float var9) {
17+ EntityDust entity = (EntityDust) var1;
18+ GL11.glPushMatrix();
19+ GL11.glTranslatef((float)var2, (float)var4, (float)var6);
20+ GL11.glEnable(GL12.GL_RESCALE_NORMAL);
21+ float var10 = entity.getDelay() / 8.0F;
22+ GL11.glScalef(var10 / 1.0F, var10 / 1.0F, var10 / 1.0F);
23+ byte var11 = 0;
24+ this.loadTexture(ChemiCraft.instance.ENTITY_PARTICLE_TEXRURE);
25+ Tessellator var12 = Tessellator.instance;
26+ float var13 = (float)(var11 % 256 * 256 + 0) / 256F;
27+ float var14 = (float)(var11 % 256 * 256 + 256) / 256F;
28+ float var15 = (float)(var11 / 256 * 256 + 0) / 256F;
29+ float var16 = (float)(var11 / 256 * 256 + 256) / 256F;
30+ float var17 = 1.0F;
31+ float var18 = 0.5F;
32+ float var19 = 0.25F;
33+ GL11.glRotatef(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
34+ GL11.glRotatef(-this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
35+ var12.startDrawingQuads();
36+ var12.setNormal(0.0F, 1.0F, 0.0F);
37+ var12.addVertexWithUV((double)(0.0F - var18), (double)(0.0F - var19), 0.0D, (double)var13, (double)var16);
38+ var12.addVertexWithUV((double)(var17 - var18), (double)(0.0F - var19), 0.0D, (double)var14, (double)var16);
39+ var12.addVertexWithUV((double)(var17 - var18), (double)(1.0F - var19), 0.0D, (double)var14, (double)var15);
40+ var12.addVertexWithUV((double)(0.0F - var18), (double)(1.0F - var19), 0.0D, (double)var13, (double)var15);
41+ var12.draw();
42+ GL11.glDisable(GL12.GL_RESCALE_NORMAL);
43+ GL11.glPopMatrix();
44+ }
45+
46+}
Show on old repository browser