diff --git a/build.gradle b/build.gradle index f2116314e..079aae557 100644 --- a/build.gradle +++ b/build.gradle @@ -32,7 +32,6 @@ sourceSets { "$projectDir/src/externalapi", "$projectDir/src/forcefields", "$projectDir/src/nuclear", - "$projectDir/src/missiles" ] include '**/*.java' } @@ -120,14 +119,6 @@ task forcefieldJar(type: Jar) { } } -task missilesJar(type: Jar) { - baseName = 'PhysicaMissiles' - - from zipTree(jar.outputs.getFiles().getSingleFile()).matching { - include 'physica/missiles/**' - } -} - task incrementBuildNumber() { doLast { config.version_build = (config.version_build.toString().toInteger()) + 1 @@ -139,7 +130,6 @@ task incrementBuildNumber() { coreJar.dependsOn('reobf') nuclearJar.dependsOn('reobf') forcefieldJar.dependsOn('reobf') -missilesJar.dependsOn('reobf') incrementBuildNumber.dependsOn('reobf') task releaseJars(type: Copy) { dependsOn "reobf" diff --git a/build.properties b/build.properties index d675cde49..a00dc089d 100644 --- a/build.properties +++ b/build.properties @@ -1,7 +1,7 @@ # #Wed Dec 11 18:56:12 CET 2019 -version_minor=6 -version_revision=0 +version_minor=5 +version_revision=5 minecraft_version=1.7.10 -version_build=1 +version_build=0 version_major=1 diff --git a/src/missiles/physica/missiles/MissileReferences.java b/src/missiles/physica/missiles/MissileReferences.java deleted file mode 100644 index e2a091eb1..000000000 --- a/src/missiles/physica/missiles/MissileReferences.java +++ /dev/null @@ -1,10 +0,0 @@ -package physica.missiles; - -import physica.CoreReferences; - -public class MissileReferences { - - public static final String NAME = CoreReferences.NAME + "Missiles"; - public static final String DOMAIN = CoreReferences.DOMAIN + "missiles"; - public static final String PREFIX = DOMAIN + ":"; -} diff --git a/src/missiles/physica/missiles/PhysicaMissiles.java b/src/missiles/physica/missiles/PhysicaMissiles.java deleted file mode 100644 index 57da1d470..000000000 --- a/src/missiles/physica/missiles/PhysicaMissiles.java +++ /dev/null @@ -1,125 +0,0 @@ -package physica.missiles; - -import java.io.File; - -import cpw.mods.fml.common.Mod; -import cpw.mods.fml.common.Mod.EventHandler; -import cpw.mods.fml.common.Mod.Instance; -import cpw.mods.fml.common.Mod.Metadata; -import cpw.mods.fml.common.ModMetadata; -import cpw.mods.fml.common.SidedProxy; -import cpw.mods.fml.common.event.FMLInitializationEvent; -import cpw.mods.fml.common.event.FMLLoadCompleteEvent; -import cpw.mods.fml.common.event.FMLPostInitializationEvent; -import cpw.mods.fml.common.event.FMLPreInitializationEvent; -import cpw.mods.fml.relauncher.Side; -import net.minecraft.block.BlockDispenser; -import net.minecraft.dispenser.IBehaviorDispenseItem; -import net.minecraft.util.EnumFacing; -import net.minecraft.world.World; -import physica.CoreReferences; -import physica.api.core.abstraction.recipe.IRecipeRegister; -import physica.api.core.load.ContentLoader; -import physica.api.core.load.LoadPhase; -import physica.library.location.VectorLocation; -import physica.missiles.client.MissileClientRegister; -import physica.missiles.common.MissileBlockRegister; -import physica.missiles.common.MissileEntityRegister; -import physica.missiles.common.MissileItemRegister; -import physica.missiles.common.MissileTabRegister; -import physica.missiles.common.entity.EntityGrenade; -import physica.proxy.CommonProxy; - -@Mod(modid = MissileReferences.DOMAIN, name = MissileReferences.NAME, version = CoreReferences.VERSION, dependencies = "required-after:" + CoreReferences.DOMAIN) -public class PhysicaMissiles { - - @SidedProxy(clientSide = "physica.proxy.ClientProxy", serverSide = "physica.proxy.ServerProxy") - public static CommonProxy sidedProxy; - public static ContentLoader proxyLoader = new ContentLoader(); - - @Instance(MissileReferences.NAME) - public static PhysicaMissiles INSTANCE; - @Metadata(MissileReferences.DOMAIN) - public static ModMetadata metadata; - - public static File configFolder; - - @EventHandler - public void preInit(FMLPreInitializationEvent event) - { - INSTANCE = this; - configFolder = new File(event.getModConfigurationDirectory(), "/" + MissileReferences.DOMAIN); - proxyLoader.addContent(sidedProxy); - proxyLoader.addContent(new MissileTabRegister()); - - // proxyLoader.addContent(new NuclearFluidRegister()); - proxyLoader.addContent(new MissileBlockRegister()); - proxyLoader.addContent(new MissileItemRegister()); - proxyLoader.addContent(new MissileEntityRegister()); - - if (event.getSide() == Side.CLIENT) - { - proxyLoader.addContent(new MissileClientRegister()); - } - - // proxyLoader.addContent(new NuclearRecipeRegister()); - // proxyLoader.addContent(new NuclearWorldGenRegister()); - metadata.authorList = CoreReferences.Metadata.AUTHORS; - metadata.autogenerated = false; - metadata.credits = CoreReferences.Metadata.CREDITS; - metadata.description = CoreReferences.Metadata.DESCRIPTION.replace("Physica", MissileReferences.NAME); - metadata.modId = MissileReferences.DOMAIN; - metadata.name = MissileReferences.NAME; - metadata.parent = CoreReferences.DOMAIN; - metadata.updateUrl = CoreReferences.Metadata.UPDATE_URL; - metadata.url = CoreReferences.Metadata.URL; - metadata.version = CoreReferences.VERSION; - proxyLoader.callRegister(LoadPhase.CreativeTabRegister); - proxyLoader.callRegister(LoadPhase.ConfigRegister); - proxyLoader.callRegister(LoadPhase.RegisterObjects); - proxyLoader.callRegister(LoadPhase.PreInitialize); - proxyLoader.callRegister(LoadPhase.ClientRegister); - BlockDispenser.dispenseBehaviorRegistry.putObject(MissileItemRegister.itemGrenade, (IBehaviorDispenseItem) (blockSource, itemStack) -> - { - World world = blockSource.getWorld(); - - if (!world.isRemote) - { - int x = blockSource.getXInt(); - int y = blockSource.getYInt(); - int z = blockSource.getZInt(); - EnumFacing enumFacing = EnumFacing.getFront(blockSource.getBlockMetadata()); - - EntityGrenade entity = new EntityGrenade(world, new VectorLocation(x, y, z), itemStack.getItemDamage()); - entity.setThrowableHeading(enumFacing.getFrontOffsetX(), 0.1D, enumFacing.getFrontOffsetZ(), 0.5F, 1.0F); - world.spawnEntityInWorld(entity); - } - - itemStack.stackSize--; - - return itemStack; - }); - } - - @EventHandler - public void init(FMLInitializationEvent event) - { - proxyLoader.callRegister(LoadPhase.Initialize); - proxyLoader.callRegister(LoadPhase.EntityRegister); - proxyLoader.callRegister(LoadPhase.FluidRegister); - proxyLoader.callRegister(LoadPhase.WorldRegister); - } - - @EventHandler - public void postInit(FMLPostInitializationEvent event) - { - proxyLoader.callRegister(LoadPhase.PostInitialize); - } - - @EventHandler - public void loadComplete(FMLLoadCompleteEvent event) - { - proxyLoader.callRegister(LoadPhase.OnStartup); - IRecipeRegister.callRegister("Missiles"); - } -} diff --git a/src/missiles/physica/missiles/client/MissileClientRegister.java b/src/missiles/physica/missiles/client/MissileClientRegister.java deleted file mode 100644 index 8b4f3c5de..000000000 --- a/src/missiles/physica/missiles/client/MissileClientRegister.java +++ /dev/null @@ -1,30 +0,0 @@ -package physica.missiles.client; - -import cpw.mods.fml.client.registry.RenderingRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import physica.api.core.load.IContent; -import physica.api.core.load.LoadPhase; -import physica.missiles.client.render.entity.RenderEntityPrimedExplosive; -import physica.missiles.client.render.entity.RenderGrenade; -import physica.missiles.client.render.entity.RenderShrapnelFragment; -import physica.missiles.common.entity.EntityFragment; -import physica.missiles.common.entity.EntityGrenade; -import physica.missiles.common.entity.EntityPrimedExplosive; - -@SideOnly(Side.CLIENT) -public class MissileClientRegister implements IContent { - - @Override - public void register(LoadPhase phase) - { - if (phase == LoadPhase.ClientRegister) - { - } else if (phase == LoadPhase.PostInitialize) - { - RenderingRegistry.registerEntityRenderingHandler(EntityPrimedExplosive.class, new RenderEntityPrimedExplosive()); - RenderingRegistry.registerEntityRenderingHandler(EntityFragment.class, new RenderShrapnelFragment()); - RenderingRegistry.registerEntityRenderingHandler(EntityGrenade.class, new RenderGrenade()); - } - } -} diff --git a/src/missiles/physica/missiles/client/render/entity/RenderEntityPrimedExplosive.java b/src/missiles/physica/missiles/client/render/entity/RenderEntityPrimedExplosive.java deleted file mode 100644 index 41a079bb9..000000000 --- a/src/missiles/physica/missiles/client/render/entity/RenderEntityPrimedExplosive.java +++ /dev/null @@ -1,81 +0,0 @@ -package physica.missiles.client.render.entity; - -import org.lwjgl.opengl.GL11; - -import cpw.mods.fml.client.FMLClientHandler; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.client.renderer.RenderBlocks; -import net.minecraft.client.renderer.entity.Render; -import net.minecraft.entity.Entity; -import net.minecraft.util.ResourceLocation; -import physica.missiles.common.MissileBlockRegister; -import physica.missiles.common.entity.EntityPrimedExplosive; - -@SideOnly(Side.CLIENT) -public class RenderEntityPrimedExplosive extends Render { - - private RenderBlocks blockRenderer = new RenderBlocks(); - - public RenderEntityPrimedExplosive() { - shadowSize = 0.5F; - } - - @Override - public void doRender(Entity par1Entity, double x, double y, double z, float par8, float par9) - { - EntityPrimedExplosive entityExplosive = (EntityPrimedExplosive) par1Entity; - if (entityExplosive.fuse > 0) - { - GL11.glPushMatrix(); - GL11.glTranslatef((float) x, (float) y, (float) z); - float f2; - - if (entityExplosive.fuse - par9 + 1.0F < 10.0F) - { - f2 = 1.0F - (entityExplosive.fuse - par9 + 1.0F) / 10.0F; - - if (f2 < 0.0F) - { - f2 = 0.0F; - } - - if (f2 > 1.0F) - { - f2 = 1.0F; - } - - f2 *= f2; - f2 *= f2; - float f3 = 1.0F + f2 * 0.3F; - GL11.glScalef(f3, f3, f3); - } - - f2 = (1.0F - (entityExplosive.fuse - par9 + 1.0F) / 100.0F) * 0.8F; - FMLClientHandler.instance().getClient().renderEngine.bindTexture(FMLClientHandler.instance().getClient().renderEngine.getResourceLocation(0)); - blockRenderer.renderBlockAsItem(MissileBlockRegister.primedBlock, entityExplosive.explosiveID, entityExplosive.getBrightness(par9)); - if (entityExplosive.fuse / 5 % 2 == 0) - { - GL11.glDisable(GL11.GL_TEXTURE_2D); - GL11.glDisable(GL11.GL_LIGHTING); - GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_DST_ALPHA); - GL11.glColor4f(1.0F, 1.0F, 1.0F, f2); - blockRenderer.renderBlockAsItem(MissileBlockRegister.primedBlock, entityExplosive.explosiveID, 1.0F); - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - GL11.glDisable(GL11.GL_BLEND); - GL11.glEnable(GL11.GL_LIGHTING); - GL11.glEnable(GL11.GL_TEXTURE_2D); - } - - GL11.glPopMatrix(); - } - } - - @Override - protected ResourceLocation getEntityTexture(Entity entity) - { - return null; - } - -} diff --git a/src/missiles/physica/missiles/client/render/entity/RenderGrenade.java b/src/missiles/physica/missiles/client/render/entity/RenderGrenade.java deleted file mode 100644 index 3d81ed653..000000000 --- a/src/missiles/physica/missiles/client/render/entity/RenderGrenade.java +++ /dev/null @@ -1,62 +0,0 @@ -package physica.missiles.client.render.entity; - -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL12; - -import cpw.mods.fml.client.FMLClientHandler; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.entity.Render; -import net.minecraft.entity.Entity; -import net.minecraft.util.IIcon; -import net.minecraft.util.ResourceLocation; -import physica.missiles.common.MissileItemRegister; -import physica.missiles.common.entity.EntityGrenade; - -@SideOnly(Side.CLIENT) -public class RenderGrenade extends Render { - - @Override - public void doRender(Entity entity, double x, double y, double z, float par8, float par9) - { - /** Renders the grenade based on the explosive ID. */ - IIcon icon = MissileItemRegister.itemGrenade.getIconFromDamage(((EntityGrenade) entity).explosiveID); - - GL11.glPushMatrix(); - GL11.glTranslatef((float) x, (float) y + 0.4f, (float) z); - GL11.glEnable(GL12.GL_RESCALE_NORMAL); - GL11.glScalef(0.6F, 0.6F, 0.6F); - FMLClientHandler.instance().getClient().renderEngine.bindTexture(FMLClientHandler.instance().getClient().renderEngine.getResourceLocation(MissileItemRegister.itemGrenade.getSpriteNumber())); - Tessellator tessellator = Tessellator.instance; - renderIcon(tessellator, icon); - GL11.glDisable(GL12.GL_RESCALE_NORMAL); - GL11.glPopMatrix(); - } - - private void renderIcon(Tessellator par1Tessellator, IIcon icon) - { - float f = icon.getMinU(); - float f1 = icon.getMaxU(); - float f2 = icon.getMinV(); - float f3 = icon.getMaxV(); - float f4 = 1.0F; - float f5 = 0.5F; - float f6 = 0.25F; - GL11.glRotatef(180.0F - renderManager.playerViewY, 0.0F, 1.0F, 0.0F); - GL11.glRotatef(-renderManager.playerViewX, 1.0F, 0.0F, 0.0F); - par1Tessellator.startDrawingQuads(); - par1Tessellator.setNormal(0.0F, 1.0F, 0.0F); - par1Tessellator.addVertexWithUV(0.0F - f5, 0.0F - f6, 0.0D, f, f3); - par1Tessellator.addVertexWithUV(f4 - f5, 0.0F - f6, 0.0D, f1, f3); - par1Tessellator.addVertexWithUV(f4 - f5, f4 - f6, 0.0D, f1, f2); - par1Tessellator.addVertexWithUV(0.0F - f5, f4 - f6, 0.0D, f, f2); - par1Tessellator.draw(); - } - - @Override - protected ResourceLocation getEntityTexture(Entity entity) - { - return null; - } -} diff --git a/src/missiles/physica/missiles/client/render/entity/RenderShrapnelFragment.java b/src/missiles/physica/missiles/client/render/entity/RenderShrapnelFragment.java deleted file mode 100644 index d9fedd3a6..000000000 --- a/src/missiles/physica/missiles/client/render/entity/RenderShrapnelFragment.java +++ /dev/null @@ -1,120 +0,0 @@ -package physica.missiles.client.render.entity; - -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL12; - -import cpw.mods.fml.client.FMLClientHandler; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.block.Block; -import net.minecraft.client.renderer.entity.Render; -import net.minecraft.entity.Entity; -import net.minecraft.init.Blocks; -import net.minecraft.util.MathHelper; -import net.minecraft.util.ResourceLocation; -import net.minecraft.world.World; -import physica.CoreReferences; -import physica.library.client.render.TessellatorWrapper; -import physica.missiles.MissileReferences; -import physica.missiles.common.entity.EntityFragment; -import physica.missiles.common.explosive.blast.types.EnumShrapnel; - -@SideOnly(Side.CLIENT) -public class RenderShrapnelFragment extends Render { - - public static final ResourceLocation TEXTURE_FILE = new ResourceLocation(MissileReferences.DOMAIN, CoreReferences.MODEL_TEXTURE_DIRECTORY + "fragment.png"); - - public void renderFragment(EntityFragment fragment, double x, double y, double z, float par8, float par9) - { - TessellatorWrapper wrapper = TessellatorWrapper.instance; - if (fragment.type == EnumShrapnel.ANVIL) - { - GL11.glPushMatrix(); - GL11.glTranslatef((float) x, (float) y, (float) z); - FMLClientHandler.instance().getClient().renderEngine.bindTexture(FMLClientHandler.instance().getClient().renderEngine.getResourceLocation(0)); - Block block = Blocks.anvil; - World world = fragment.worldObj; - GL11.glDisable(GL11.GL_LIGHTING); - - field_147909_c.blockAccess = world; - - wrapper.startDrawingQuads(); - wrapper.setTranslation((-MathHelper.floor_double(fragment.posX)) - 0.5F, (-MathHelper.floor_double(fragment.posY)) - 0.5F, (-MathHelper.floor_double(fragment.posZ)) - 0.5F); - field_147909_c.renderBlockByRenderType(block, MathHelper.floor_double(fragment.posX), MathHelper.floor_double(fragment.posY), MathHelper.floor_double(fragment.posZ)); - wrapper.setTranslation(0.0D, 0.0D, 0.0D); - wrapper.draw(); - - GL11.glEnable(GL11.GL_LIGHTING); - GL11.glPopMatrix(); - } else - { - bindTexture(TEXTURE_FILE); - GL11.glPushMatrix(); - GL11.glTranslatef((float) x, (float) y, (float) z); - GL11.glRotatef(fragment.prevRotationYaw + (fragment.rotationYaw - fragment.prevRotationYaw) * par9 - 90.0F, 0.0F, 1.0F, 0.0F); - GL11.glRotatef(fragment.prevRotationPitch + (fragment.rotationPitch - fragment.prevRotationPitch) * par9, 0.0F, 0.0F, 1.0F); - float u3 = 0.0F; - float u4 = 0.5F; - float v3 = 0; - float v4 = 5 / 32.0F; - float u1 = 0.0F; - float u2 = 0.15625F; - float v1 = 5 / 32.0F; - float v2 = 10 / 32.0F; - float var20 = 0.05625F; - GL11.glEnable(GL12.GL_RESCALE_NORMAL); - float var21 = fragment.projectileSPin - par9; - - if (var21 > 0.0F) - { - float var22 = -MathHelper.sin(var21 * 3.0F) * var21; - GL11.glRotatef(var22, 0.0F, 0.0F, 1.0F); - } - - GL11.glRotatef(45.0F, 1.0F, 0.0F, 0.0F); - GL11.glScalef(var20, var20, var20); - GL11.glTranslatef(-4.0F, 0.0F, 0.0F); - GL11.glNormal3f(var20, 0.0F, 0.0F); - wrapper.startDrawingQuads(); - wrapper.addVertexWithUV(-7.0D, -2.0D, -2.0D, u1, v1); - wrapper.addVertexWithUV(-7.0D, -2.0D, 2.0D, u2, v1); - wrapper.addVertexWithUV(-7.0D, 2.0D, 2.0D, u2, v2); - wrapper.addVertexWithUV(-7.0D, 2.0D, -2.0D, u1, v2); - wrapper.draw(); - GL11.glNormal3f(-var20, 0.0F, 0.0F); - wrapper.startDrawingQuads(); - wrapper.addVertexWithUV(-7.0D, 2.0D, -2.0D, u1, v1); - wrapper.addVertexWithUV(-7.0D, 2.0D, 2.0D, u2, v1); - wrapper.addVertexWithUV(-7.0D, -2.0D, 2.0D, u2, v2); - wrapper.addVertexWithUV(-7.0D, -2.0D, -2.0D, u1, v2); - wrapper.draw(); - - for (int var23 = 0; var23 < 4; ++var23) - { - GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F); - GL11.glNormal3f(0.0F, 0.0F, var20); - wrapper.startDrawingQuads(); - wrapper.addVertexWithUV(-8.0D, -2.0D, 0.0D, u3, v3); - wrapper.addVertexWithUV(8.0D, -2.0D, 0.0D, u4, v3); - wrapper.addVertexWithUV(8.0D, 2.0D, 0.0D, u4, v4); - wrapper.addVertexWithUV(-8.0D, 2.0D, 0.0D, u3, v4); - wrapper.draw(); - } - - GL11.glDisable(GL12.GL_RESCALE_NORMAL); - GL11.glPopMatrix(); - } - } - - @Override - public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9) - { - renderFragment((EntityFragment) par1Entity, par2, par4, par6, par8, par9); - } - - @Override - protected ResourceLocation getEntityTexture(Entity entity) - { - return null; - } -} diff --git a/src/missiles/physica/missiles/client/render/model/ModelMissileBase.java b/src/missiles/physica/missiles/client/render/model/ModelMissileBase.java deleted file mode 100644 index c92eb3c27..000000000 --- a/src/missiles/physica/missiles/client/render/model/ModelMissileBase.java +++ /dev/null @@ -1,9 +0,0 @@ -package physica.missiles.client.render.model; - -import net.minecraft.client.model.ModelBase; - -public abstract class ModelMissileBase extends ModelBase { - public void render(float size) - { - } -} diff --git a/src/missiles/physica/missiles/common/MissileBlockRegister.java b/src/missiles/physica/missiles/common/MissileBlockRegister.java deleted file mode 100644 index 5d49d8723..000000000 --- a/src/missiles/physica/missiles/common/MissileBlockRegister.java +++ /dev/null @@ -1,23 +0,0 @@ -package physica.missiles.common; - -import cpw.mods.fml.common.registry.GameRegistry; -import physica.api.core.load.IContent; -import physica.api.core.load.LoadPhase; -import physica.library.item.ItemBlockDescriptable; -import physica.missiles.common.block.BlockPrimedBlock; -import physica.missiles.common.items.ItemBlockPrimed; - -public class MissileBlockRegister implements IContent { - public static BlockPrimedBlock primedBlock; - - @Override - public void register(LoadPhase phase) - { - if (phase == LoadPhase.RegisterObjects) - { - GameRegistry.registerBlock(primedBlock = new BlockPrimedBlock(), ItemBlockPrimed.class, "primedBlock"); - - ItemBlockDescriptable.addDescription(primedBlock, 0, "Slightly more desructive version of TNT", "Also explodes instantaneously."); - } - } -} diff --git a/src/missiles/physica/missiles/common/MissileEntityRegister.java b/src/missiles/physica/missiles/common/MissileEntityRegister.java deleted file mode 100644 index 6934d8440..000000000 --- a/src/missiles/physica/missiles/common/MissileEntityRegister.java +++ /dev/null @@ -1,32 +0,0 @@ -package physica.missiles.common; - -import cpw.mods.fml.common.registry.EntityRegistry; -import net.minecraft.entity.Entity; -import physica.api.core.load.IContent; -import physica.api.core.load.LoadPhase; -import physica.missiles.PhysicaMissiles; -import physica.missiles.common.entity.EntityFragment; -import physica.missiles.common.entity.EntityGrenade; -import physica.missiles.common.entity.EntityPrimedExplosive; - -public class MissileEntityRegister implements IContent { - - private static int MOD_ID = 120; - - @Override - public void register(LoadPhase phase) - { - if (phase == LoadPhase.EntityRegister) - { - registerEntity(EntityPrimedExplosive.class, "physicaprimedexplosive", 40, 5, true); - registerEntity(EntityFragment.class, "physicafragments", 40, 5, true); - registerEntity(EntityGrenade.class, "physicagrenade", 40, 5, true); - } - } - - private static void registerEntity(Class entityClass, String entityName, int trackingRange, int updateFrequency, boolean sendsVelocityUpdates) - { - EntityRegistry.registerGlobalEntityID(entityClass, entityName, EntityRegistry.findGlobalUniqueEntityId()); - EntityRegistry.registerModEntity(entityClass, entityName, MOD_ID++, PhysicaMissiles.INSTANCE, trackingRange, updateFrequency, sendsVelocityUpdates); - } -} diff --git a/src/missiles/physica/missiles/common/MissileItemRegister.java b/src/missiles/physica/missiles/common/MissileItemRegister.java deleted file mode 100644 index 5f2fa499f..000000000 --- a/src/missiles/physica/missiles/common/MissileItemRegister.java +++ /dev/null @@ -1,19 +0,0 @@ -package physica.missiles.common; - -import cpw.mods.fml.common.registry.GameRegistry; -import physica.api.core.load.IContent; -import physica.api.core.load.LoadPhase; -import physica.missiles.common.items.ItemGrenade; - -public class MissileItemRegister implements IContent { - public static ItemGrenade itemGrenade; - - @Override - public void register(LoadPhase phase) - { - if (phase == LoadPhase.RegisterObjects) - { - GameRegistry.registerItem(itemGrenade = new ItemGrenade(), itemGrenade.getUnlocalizedName()); - } - } -} diff --git a/src/missiles/physica/missiles/common/MissileTabRegister.java b/src/missiles/physica/missiles/common/MissileTabRegister.java deleted file mode 100644 index 3355619cb..000000000 --- a/src/missiles/physica/missiles/common/MissileTabRegister.java +++ /dev/null @@ -1,29 +0,0 @@ -package physica.missiles.common; - -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.init.Items; -import net.minecraft.item.Item; -import physica.api.core.load.IContent; -import physica.api.core.load.LoadPhase; -import physica.missiles.MissileReferences; - -public class MissileTabRegister implements IContent { - - public static CreativeTabs missilesTab; - - @Override - public void register(LoadPhase phase) - { - if (phase == LoadPhase.CreativeTabRegister) - { - missilesTab = new CreativeTabs(MissileReferences.DOMAIN + "Missiles") - { - @Override - public Item getTabIconItem() - { - return Items.arrow; - } - }; - } - } -} diff --git a/src/missiles/physica/missiles/common/block/BlockPrimedBlock.java b/src/missiles/physica/missiles/common/block/BlockPrimedBlock.java deleted file mode 100644 index 31482f18b..000000000 --- a/src/missiles/physica/missiles/common/block/BlockPrimedBlock.java +++ /dev/null @@ -1,172 +0,0 @@ -package physica.missiles.common.block; - -import java.util.ArrayList; -import java.util.List; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.block.Block; -import net.minecraft.block.material.Material; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; -import net.minecraft.init.Items; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.IIcon; -import net.minecraft.world.Explosion; -import net.minecraft.world.World; -import physica.api.core.abstraction.Face; -import physica.library.location.GridLocation; -import physica.missiles.MissileReferences; -import physica.missiles.common.MissileTabRegister; -import physica.missiles.common.entity.EntityPrimedExplosive; -import physica.missiles.common.explosive.Explosive; - -public class BlockPrimedBlock extends Block { - - @SideOnly(Side.CLIENT) - public ArrayList topIcons = new ArrayList<>(); - @SideOnly(Side.CLIENT) - public ArrayList sideIcons = new ArrayList<>(); - @SideOnly(Side.CLIENT) - public ArrayList bottomIcons = new ArrayList<>(); - - public BlockPrimedBlock() { - super(Material.tnt); - setBlockName(MissileReferences.PREFIX + "blockExplosive"); - setCreativeTab(MissileTabRegister.missilesTab); - } - - @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon(int side, int meta) - { - return side == 0 ? bottomIcons.get(meta) : side == 1 ? topIcons.get(meta) : sideIcons.get(meta); - } - - @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister register) - { - for (Explosive ex : Explosive.explosiveSet) - { - if (ex.hasBlock) - { - topIcons.add(ex.getId(), register.registerIcon(MissileReferences.PREFIX + "explosives/" + ex.getTopIcon())); - sideIcons.add(ex.getId(), register.registerIcon(MissileReferences.PREFIX + "explosives/" + ex.getSideIcon())); - bottomIcons.add(ex.getId(), register.registerIcon(MissileReferences.PREFIX + "explosives/" + ex.getBottomIcon())); - } else - { - topIcons.add(ex.getId(), register.registerIcon("tnt_top")); - sideIcons.add(ex.getId(), register.registerIcon("tnt_side")); - bottomIcons.add(ex.getId(), register.registerIcon("tnt_bottom")); - } - } - } - - @Override - public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack itemStack) - { - world.setBlockMetadataWithNotify(x, y, z, itemStack.getItemDamage(), 3); - if (world.isBlockIndirectlyGettingPowered(x, y, z)) - { - detonate(world, x, y, z, itemStack.getItemDamage(), 0); - } else - { - for (Face face : Face.values()) - { - GridLocation position = new GridLocation(x, y, z).OffsetFace(face); - - Block block = position.getBlock(world); - - if (block == Blocks.fire || block == Blocks.flowing_lava || block == Blocks.lava) - { - detonate(world, x, y, z, itemStack.getItemDamage(), 2); - break; - } - } - } - } - - @Override - public void onNeighborBlockChange(World world, int x, int y, int z, Block block) - { - int explosiveID = world.getBlockMetadata(x, y, z); - - if (world.isBlockIndirectlyGettingPowered(x, y, z)) - { - detonate(world, x, y, z, explosiveID, 0); - } else if (block == Blocks.fire || block == Blocks.flowing_lava || block == Blocks.lava) - { - detonate(world, x, y, z, explosiveID, 2); - } - } - - @Override - public void onBlockExploded(World world, int x, int y, int z, Explosion explosion) - { - detonate(world, x, y, z, world.getBlockMetadata(x, y, z), 1); - super.onBlockExploded(world, x, y, z, explosion); - } - - /** - * Called upon block activation (left or right click on the block.). The three - * integers represent x,y,z of the block. - */ - @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int par6, float par7, float par8, float par9) - { - - if (entityPlayer.getCurrentEquippedItem() != null) - { - if (entityPlayer.getCurrentEquippedItem().getItem() == Items.flint_and_steel) - { - detonate(world, x, y, z, world.getBlockMetadata(x, y, z), 0); - return true; - } - } - - return false; - } - - public static void detonate(World world, int x, int y, int z, int explosiveID, int causeOfExplosion) - { - if (!world.isRemote) - { - EntityPrimedExplosive explosive = new EntityPrimedExplosive(world, x + 0.5, y + 0.5, z + 0.5, explosiveID); - if (causeOfExplosion == 2) - { - explosive.setFire(100); - } - if (causeOfExplosion == 1) - { - explosive.fuse = 10; - } - world.spawnEntityInWorld(explosive); - world.setBlockToAir(x, y, z); - } - } - - @Override - public int damageDropped(int metadata) - { - return metadata; - } - - @SuppressWarnings("unchecked") - @Override - public void getSubBlocks(Item item, CreativeTabs tabs, @SuppressWarnings("rawtypes") List holder) - { - for (Explosive ex : Explosive.explosiveSet) - { - if (ex.hasBlock) - { - holder.add(new ItemStack(item, 1, ex.getId())); - } - } - - } -} diff --git a/src/missiles/physica/missiles/common/entity/EntityFragment.java b/src/missiles/physica/missiles/common/entity/EntityFragment.java deleted file mode 100644 index 84832f9fb..000000000 --- a/src/missiles/physica/missiles/common/entity/EntityFragment.java +++ /dev/null @@ -1,450 +0,0 @@ -package physica.missiles.common.entity; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import cpw.mods.fml.common.registry.IEntityAdditionalSpawnData; -import io.netty.buffer.ByteBuf; -import net.minecraft.block.Block; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLiving; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.DamageSource; -import net.minecraft.util.EntityDamageSourceIndirect; -import net.minecraft.util.MathHelper; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.util.Vec3; -import net.minecraft.world.World; -import physica.missiles.common.explosive.blast.types.EnumShrapnel; - -public class EntityFragment extends Entity implements IEntityAdditionalSpawnData { - - private int xTile = -1; - private int yTile = -1; - private int zTile = -1; - private Block inTile = null; - private int inData = 0; - private boolean inGround = false; - public boolean doesArrowBelongToPlayer = false; - public EnumShrapnel type = EnumShrapnel.SHRAPNEL; - private boolean isExploding = false; - public int projectileSPin = 0; - private int ticksInAir = 0; - private final int damage = 11; - private int knowBackStrength; - public boolean isCritical = false; - public float explosionSize = 1.5F; - - public EntityFragment(World par1World) { - super(par1World); - setSize(0.5F, 0.5F); - } - - public EntityFragment(World world, double x, double y, double z, EnumShrapnel type) { - super(world); - setPosition(x, y, z); - yOffset = 0.0F; - this.type = type; - - if (type == EnumShrapnel.ANVIL) - { - setSize(1, 1); - } else - { - setSize(0.5f, 0.5f); - } - } - - @Override - public void writeSpawnData(ByteBuf data) - { - data.writeInt(type.ordinal()); - } - - @Override - public void readSpawnData(ByteBuf data) - { - type = EnumShrapnel.values()[data.readInt()]; - } - - @Override - protected void entityInit() - { - } - - @Override - public String getCommandSenderName() - { - return "Fragment"; - } - - /** - * Uses the provided coordinates as a heading and determines the velocity from - * it with the set force and random variance. Args: x, y, z, force, - * forceVariation - */ - public void setArrowHeading(double par1, double par3, double par5, float par7, float par8) - { - float var9 = MathHelper.sqrt_double(par1 * par1 + par3 * par3 + par5 * par5); - par1 /= var9; - par3 /= var9; - par5 /= var9; - par1 += rand.nextGaussian() * 0.007499999832361937D * par8; - par3 += rand.nextGaussian() * 0.007499999832361937D * par8; - par5 += rand.nextGaussian() * 0.007499999832361937D * par8; - par1 *= par7; - par3 *= par7; - par5 *= par7; - motionX = par1; - motionY = par3; - motionZ = par5; - float var10 = MathHelper.sqrt_double(par1 * par1 + par5 * par5); - prevRotationYaw = rotationYaw = (float) (Math.atan2(par1, par5) * 180.0D / Math.PI); - prevRotationPitch = rotationPitch = (float) (Math.atan2(par3, var10) * 180.0D / Math.PI); - } - - /** Sets the velocity to the args. Args: x, y, z */ - @Override - public void setVelocity(double par1, double par3, double par5) - { - motionX = par1; - motionY = par3; - motionZ = par5; - - if (prevRotationPitch == 0.0F && prevRotationYaw == 0.0F) - { - float var7 = MathHelper.sqrt_double(par1 * par1 + par5 * par5); - prevRotationYaw = rotationYaw = (float) (Math.atan2(par1, par5) * 180.0D / Math.PI); - prevRotationPitch = rotationPitch = (float) (Math.atan2(par3, var7) * 180.0D / Math.PI); - prevRotationPitch = rotationPitch; - prevRotationYaw = rotationYaw; - setLocationAndAngles(posX, posY, posZ, rotationYaw, rotationPitch); - } - } - - private void explode() - { - if (!isExploding && !worldObj.isRemote) - { - isExploding = true; - worldObj.createExplosion(this, xTile, yTile, zTile, explosionSize * (type == EnumShrapnel.SHRAPNEL ? 1 : type == EnumShrapnel.ANVIL ? 0 : 3), true); - setDead(); - } - } - - /** Called to update the entity's position/logic. */ - @Override - public void onUpdate() - { - super.onUpdate(); - - if (type == EnumShrapnel.ANVIL) - { - @SuppressWarnings("unchecked") - ArrayList entities = new ArrayList(worldObj.getEntitiesWithinAABBExcludingEntity(this, boundingBox)); - - Iterator var5 = entities.iterator(); - - while (var5.hasNext()) - { - Entity entity = (Entity) var5.next(); - entity.attackEntityFrom(DamageSource.anvil, 15); - } - } - - if (prevRotationPitch == 0.0F && prevRotationYaw == 0.0F) - { - float var1 = MathHelper.sqrt_double(motionX * motionX + motionZ * motionZ); - prevRotationYaw = rotationYaw = (float) (Math.atan2(motionX, motionZ) * 180.0D / Math.PI); - prevRotationPitch = rotationPitch = (float) (Math.atan2(motionY, var1) * 180.0D / Math.PI); - } - - Block block = worldObj.getBlock(xTile, yTile, zTile); - - if (!worldObj.isAirBlock(xTile, yTile, zTile)) - { - block.setBlockBoundsBasedOnState(worldObj, xTile, yTile, zTile); - AxisAlignedBB var2 = block.getCollisionBoundingBoxFromPool(worldObj, xTile, yTile, zTile); - - if (var2 != null && var2.isVecInside(Vec3.createVectorHelper(posX, posY, posZ))) - { - inGround = true; - } - } - - if (projectileSPin > 0) - { - --projectileSPin; - } - - if (inGround) - { - block = worldObj.getBlock(xTile, yTile, zTile); - int var18 = worldObj.getBlockMetadata(xTile, yTile, zTile); - - if (block == inTile && var18 == inData) - { - if (type != EnumShrapnel.ANVIL) - { - explode(); - } else - { - if (type == EnumShrapnel.ANVIL && worldObj.rand.nextFloat() > 0.5f) - { - worldObj.playAuxSFX(1022, (int) posX, (int) posY, (int) posZ, 0); - } - - setDead(); - } - } else - { - inGround = false; - motionX *= rand.nextFloat() * 0.2F; - motionY *= rand.nextFloat() * 0.2F; - motionZ *= rand.nextFloat() * 0.2F; - ticksInAir = 0; - } - } else - { - ++ticksInAir; - Vec3 var16 = Vec3.createVectorHelper(posX, posY, posZ); - Vec3 var17 = Vec3.createVectorHelper(posX + motionX, posY + motionY, posZ + motionZ); - MovingObjectPosition movingObjPos = worldObj.func_147447_a(var16, var17, false, true, false); - var16 = Vec3.createVectorHelper(posX, posY, posZ); - var17 = Vec3.createVectorHelper(posX + motionX, posY + motionY, posZ + motionZ); - - if (movingObjPos != null) - { - var17 = Vec3.createVectorHelper(movingObjPos.hitVec.xCoord, movingObjPos.hitVec.yCoord, movingObjPos.hitVec.zCoord); - } - - Entity var4 = null; - List var5 = worldObj.getEntitiesWithinAABBExcludingEntity(this, boundingBox.addCoord(motionX, motionY, motionZ).expand(1.0D, 1.0D, 1.0D)); - double var6 = 0.0D; - int var8; - float var10; - - for (var8 = 0; var8 < var5.size(); ++var8) - { - Entity var9 = (Entity) var5.get(var8); - - if (var9.canBeCollidedWith() && ticksInAir >= 5) - { - var10 = 0.3F; - AxisAlignedBB var11 = var9.boundingBox.expand(var10, var10, var10); - MovingObjectPosition var12 = var11.calculateIntercept(var16, var17); - - if (var12 != null) - { - double var13 = var16.distanceTo(var12.hitVec); - - if (var13 < var6 || var6 == 0.0D) - { - var4 = var9; - var6 = var13; - } - } - } - } - - if (var4 != null) - { - movingObjPos = new MovingObjectPosition(var4); - } - - float speed; - - if (movingObjPos != null) - { - if (movingObjPos.entityHit != null) - { - speed = MathHelper.sqrt_double(motionX * motionX + motionY * motionY + motionZ * motionZ); - int damage = (int) Math.ceil(speed * this.damage); - - if (isCritical) - { - damage += rand.nextInt(damage / 2 + 2); - } - - DamageSource damageSource = new EntityDamageSourceIndirect("arrow", this, this).setProjectile(); - - if (isBurning()) - { - movingObjPos.entityHit.setFire(5); - } - - if (movingObjPos.entityHit.attackEntityFrom(damageSource, damage)) - { - if (movingObjPos.entityHit instanceof EntityLiving) - { - EntityLiving var24 = (EntityLiving) movingObjPos.entityHit; - - if (!worldObj.isRemote) - { - var24.setArrowCountInEntity(var24.getArrowCountInEntity() + 1); - } - - if (knowBackStrength > 0) - { - float var21 = MathHelper.sqrt_double(motionX * motionX + motionZ * motionZ); - - if (var21 > 0.0F) - { - movingObjPos.entityHit.addVelocity(motionX * knowBackStrength * 0.6000000238418579D / var21, 0.1D, motionZ * knowBackStrength * 0.6000000238418579D / var21); - } - } - } - - worldObj.playSoundAtEntity(this, "random.bowhit", 1.0F, 1.2F / (rand.nextFloat() * 0.2F + 0.9F)); - setDead(); - } else - { - motionX *= -0.10000000149011612D; - motionY *= -0.10000000149011612D; - motionZ *= -0.10000000149011612D; - rotationYaw += 180.0F; - prevRotationYaw += 180.0F; - ticksInAir = 0; - } - } else - { - xTile = movingObjPos.blockX; - yTile = movingObjPos.blockY; - zTile = movingObjPos.blockZ; - inTile = worldObj.getBlock(xTile, yTile, zTile); - inData = worldObj.getBlockMetadata(xTile, yTile, zTile); - motionX = (float) (movingObjPos.hitVec.xCoord - posX); - motionY = (float) (movingObjPos.hitVec.yCoord - posY); - motionZ = (float) (movingObjPos.hitVec.zCoord - posZ); - speed = MathHelper.sqrt_double(motionX * motionX + motionY * motionY + motionZ * motionZ); - posX -= motionX / speed * 0.05000000074505806D; - posY -= motionY / speed * 0.05000000074505806D; - posZ -= motionZ / speed * 0.05000000074505806D; - worldObj.playSoundAtEntity(this, "random.bowhit", 1.0F, 1.2F / (rand.nextFloat() * 0.2F + 0.9F)); - inGround = true; - projectileSPin = 7; - isCritical = false; - } - } - - if (isCritical) - { - for (var8 = 0; var8 < 4; ++var8) - { - worldObj.spawnParticle("crit", posX + motionX * var8 / 4.0D, posY + motionY * var8 / 4.0D, posZ + motionZ * var8 / 4.0D, -motionX, -motionY + 0.2D, -motionZ); - } - } - - posX += motionX; - posY += motionY; - posZ += motionZ; - speed = MathHelper.sqrt_double(motionX * motionX + motionZ * motionZ); - rotationYaw = (float) (Math.atan2(motionX, motionZ) * 180.0D / Math.PI); - - for (rotationPitch = (float) (Math.atan2(motionY, speed) * 180.0D / Math.PI); rotationPitch - prevRotationPitch < -180.0F; prevRotationPitch -= 360.0F) - { - - } - - while (rotationPitch - prevRotationPitch >= 180.0F) - { - prevRotationPitch += 360.0F; - } - - while (rotationYaw - prevRotationYaw < -180.0F) - { - prevRotationYaw -= 360.0F; - } - - while (rotationYaw - prevRotationYaw >= 180.0F) - { - prevRotationYaw += 360.0F; - } - - rotationPitch = prevRotationPitch + (rotationPitch - prevRotationPitch) * 0.2F; - rotationYaw = prevRotationYaw + (rotationYaw - prevRotationYaw) * 0.2F; - float var23 = 0.99F; - var10 = 0.05F; - - if (isInWater()) - { - for (int var25 = 0; var25 < 4; ++var25) - { - float var24 = 0.25F; - worldObj.spawnParticle("bubble", posX - motionX * var24, posY - motionY * var24, posZ - motionZ * var24, motionX, motionY, motionZ); - } - - var23 = 0.8F; - } - - motionX *= var23; - motionY *= var23; - motionZ *= var23; - motionY -= var10; - setPosition(posX, posY, posZ); - } - } - - /** - * (abstract) Protected helper method to write subclass entity data to NBT. - */ - @Override - public void writeEntityToNBT(NBTTagCompound tag) - { - tag.setInteger("xTile", xTile); - tag.setInteger("yTile", yTile); - tag.setInteger("zTile", zTile); - tag.setInteger("inTile", Block.getIdFromBlock(inTile)); - tag.setByte("inData", (byte) inData); - tag.setByte("shake", (byte) projectileSPin); - tag.setByte("inGround", (byte) (inGround ? 1 : 0)); - - tag.setInteger("type", type.ordinal()); - } - - /** - * (abstract) Protected helper method to read subclass entity data from NBT. - */ - @Override - public void readEntityFromNBT(NBTTagCompound tag) - { - xTile = tag.getInteger("xTile"); - yTile = tag.getInteger("yTile"); - zTile = tag.getInteger("zTile"); - inTile = Block.getBlockById(tag.getInteger("inTile")); - inData = tag.getByte("inData") & 255; - projectileSPin = tag.getByte("shake") & 255; - inGround = tag.getByte("inGround") == 1; - - type = EnumShrapnel.values()[tag.getInteger("type")]; - } - - /** Called by a player entity when they collide with an entity */ - @Override - public void applyEntityCollision(Entity par1Entity) - { - super.applyEntityCollision(par1Entity); - - if (type != EnumShrapnel.ANVIL && ticksExisted < 20 * 2) - { - explode(); - } - } - - @Override - public float getShadowSize() - { - return 0.0F; - } - - /** - * If returns false, the item will not inflict any damage against entities. - */ - @Override - public boolean canAttackWithItem() - { - return false; - } -} diff --git a/src/missiles/physica/missiles/common/entity/EntityGrenade.java b/src/missiles/physica/missiles/common/entity/EntityGrenade.java deleted file mode 100644 index 98b4567d4..000000000 --- a/src/missiles/physica/missiles/common/entity/EntityGrenade.java +++ /dev/null @@ -1,289 +0,0 @@ -package physica.missiles.common.entity; - -import java.util.HashMap; - -import cpw.mods.fml.common.registry.IEntityAdditionalSpawnData; -import io.netty.buffer.ByteBuf; -import net.minecraft.block.material.Material; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.MathHelper; -import net.minecraft.world.World; -import physica.library.location.VectorLocation; -import physica.missiles.common.explosive.Explosive; -import physica.missiles.common.explosive.blast.BlastTemplate; -import physica.missiles.common.explosive.blast.IStateHolder; - -public class EntityGrenade extends Entity implements IEntityAdditionalSpawnData, IStateHolder { - - /** - * Is the entity that throws this 'thing' (snowball, ender pearl, eye of ender - * or potion) - */ - protected EntityLivingBase thrower; - - public int explosiveID; - - public EntityGrenade(World par1World) { - super(par1World); - setSize(0.3F, 0.3F); - renderDistanceWeight = 8; - } - - public EntityGrenade(World par1World, VectorLocation position, int explosiveID) { - this(par1World); - setPosition(position.x, position.y, position.z); - this.explosiveID = explosiveID; - } - - public EntityGrenade(World par1World, EntityLivingBase par2EntityLiving, int explosiveID, float par4) { - this(par1World); - thrower = par2EntityLiving; - setSize(0.25F, 0.25F); - setLocationAndAngles(par2EntityLiving.posX, par2EntityLiving.posY + par2EntityLiving.getEyeHeight(), par2EntityLiving.posZ, par2EntityLiving.rotationYaw, par2EntityLiving.rotationPitch); - posX -= MathHelper.cos(rotationYaw / 180.0F * (float) Math.PI) * 0.16F; - posY -= 0.10000000149011612D; - posZ -= MathHelper.sin(rotationYaw / 180.0F * (float) Math.PI) * 0.16F; - setPosition(posX, posY, posZ); - yOffset = 0.0F; - float var3 = 0.4F; - motionX = -MathHelper.sin(rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(rotationPitch / 180.0F * (float) Math.PI) * var3; - motionZ = MathHelper.cos(rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(rotationPitch / 180.0F * (float) Math.PI) * var3; - motionY = -MathHelper.sin(rotationPitch / 180.0F * (float) Math.PI) * var3; - setThrowableHeading(motionX, motionY, motionZ, 1.8f * par4, 1.0F); - this.explosiveID = explosiveID; - } - - @Override - public String getCommandSenderName() - { - if (Explosive.get(explosiveID) != null) - { - return "Grenade." + Explosive.get(explosiveID).localeName; - } - - return "Grenade"; - } - - @Override - public void writeSpawnData(ByteBuf data) - { - data.writeInt(explosiveID); - } - - @Override - public void readSpawnData(ByteBuf data) - { - explosiveID = data.readInt(); - } - - /** - * Similar to setArrowHeading, it's point the throwable entity to a x, y, z - * direction. - */ - public void setThrowableHeading(double par1, double par3, double par5, float par7, float par8) - { - float var9 = MathHelper.sqrt_double(par1 * par1 + par3 * par3 + par5 * par5); - par1 /= var9; - par3 /= var9; - par5 /= var9; - par1 += rand.nextGaussian() * 0.007499999832361937D * par8; - par3 += rand.nextGaussian() * 0.007499999832361937D * par8; - par5 += rand.nextGaussian() * 0.007499999832361937D * par8; - par1 *= par7; - par3 *= par7; - par5 *= par7; - motionX = par1; - motionY = par3; - motionZ = par5; - float var10 = MathHelper.sqrt_double(par1 * par1 + par5 * par5); - prevRotationYaw = rotationYaw = (float) (Math.atan2(par1, par5) * 180.0D / Math.PI); - prevRotationPitch = rotationPitch = (float) (Math.atan2(par3, var10) * 180.0D / Math.PI); - } - - /** Sets the velocity to the args. Args: x, y, z */ - @Override - public void setVelocity(double par1, double par3, double par5) - { - motionX = par1; - motionY = par3; - motionZ = par5; - - if (prevRotationPitch == 0.0F && prevRotationYaw == 0.0F) - { - float var7 = MathHelper.sqrt_double(par1 * par1 + par5 * par5); - prevRotationYaw = rotationYaw = (float) (Math.atan2(par1, par5) * 180.0D / Math.PI); - prevRotationPitch = rotationPitch = (float) (Math.atan2(par3, var7) * 180.0D / Math.PI); - } - } - - /** - * returns if this entity triggers Block.onEntityWalking on the blocks they walk - * on. used for spiders and wolves to prevent them from trampling crops - */ - @Override - protected boolean canTriggerWalking() - { - return false; - } - - @Override - protected void entityInit() - { - } - - /** Called to update the entity's position/logic. */ - @Override - public void onUpdate() - { - lastTickPosX = posX; - lastTickPosY = posY; - lastTickPosZ = posZ; - super.onUpdate(); - - moveEntity(motionX, motionY, motionZ); - float var16 = MathHelper.sqrt_double(motionX * motionX + motionZ * motionZ); - rotationYaw = (float) (Math.atan2(motionX, motionZ) * 180.0D / Math.PI); - - for (rotationPitch = (float) (Math.atan2(motionY, var16) * 180.0D / Math.PI); rotationPitch - prevRotationPitch < -180.0F; prevRotationPitch -= 360.0F) - { - - } - - while (rotationPitch - prevRotationPitch >= 180.0F) - { - prevRotationPitch += 360.0F; - } - - while (rotationYaw - prevRotationYaw < -180.0F) - { - prevRotationYaw -= 360.0F; - } - - while (rotationYaw - prevRotationYaw >= 180.0F) - { - prevRotationYaw += 360.0F; - } - - rotationPitch = prevRotationPitch + (rotationPitch - prevRotationPitch) * 0.2F; - rotationYaw = prevRotationYaw + (rotationYaw - prevRotationYaw) * 0.2F; - float var17 = 0.98F; - float gravity = 0.03F; - - if (isInWater()) - { - for (int var7 = 0; var7 < 4; ++var7) - { - float var19 = 0.25F; - worldObj.spawnParticle("bubble", posX - motionX * var19, posY - motionY * var19, posZ - motionZ * var19, motionX, motionY, motionZ); - } - - var17 = 0.8F; - } - - motionX *= var17; - motionY *= var17; - motionZ *= var17; - - if (onGround) - { - motionX *= 0.5; - motionZ *= 0.5; - motionY *= 0.5; - } else - { - motionY -= gravity; - func_145771_j(posX, (boundingBox.minY + boundingBox.maxY) / 2.0D, posZ); - } - - if (ticksExisted > Math.max(60, getExplosiveType().getBlastTemplate().fuseTime)) - { - explode(); - } - } - - private boolean isPrepared = false; - private int callcount; - private HashMap register = new HashMap<>(); - - @Override - public void addObject(String register, Object object) - { - this.register.put(register, object); - } - - @Override - public Object getObject(String register) - { - return this.register.get(register); - } - - public void explode() - { - - BlastTemplate template = getExplosiveType().getBlastTemplate(); - if (!isPrepared) - { - isPrepared = true; - register.put("cause", this); - template.prepare(worldObj, new VectorLocation(this).BlockLocation(), this); - } - template.call(worldObj, new VectorLocation(this).BlockLocation(), callcount, this); - callcount++; - if (callcount >= template.callCount) - { - template.end(worldObj, new VectorLocation(this).BlockLocation(), this); - setDead(); - } - } - - private Explosive getExplosiveType() - { - return Explosive.get(explosiveID); - } - - /** - * Returns if this entity is in water and will end up adding the waters velocity - * to the entity - */ - @Override - public boolean handleWaterMovement() - { - return worldObj.handleMaterialAcceleration(boundingBox, Material.water, this); - } - - /** - * Returns true if other Entities should be prevented from moving through this - * Entity. - */ - @Override - public boolean canBeCollidedWith() - { - return true; - } - - /** - * Returns true if this entity should push and be pushed by other entities when - * colliding. - */ - @Override - public boolean canBePushed() - { - return true; - } - - @Override - protected void readEntityFromNBT(NBTTagCompound nbt) - { - explosiveID = nbt.getInteger("explosiveId"); - - } - - @Override - protected void writeEntityToNBT(NBTTagCompound nbt) - { - nbt.setInteger("explosiveId", explosiveID); - } - -} diff --git a/src/missiles/physica/missiles/common/entity/EntityPrimedExplosive.java b/src/missiles/physica/missiles/common/entity/EntityPrimedExplosive.java deleted file mode 100644 index 83c0331dc..000000000 --- a/src/missiles/physica/missiles/common/entity/EntityPrimedExplosive.java +++ /dev/null @@ -1,192 +0,0 @@ -package physica.missiles.common.entity; - -import java.util.HashMap; - -import cpw.mods.fml.common.registry.IEntityAdditionalSpawnData; -import io.netty.buffer.ByteBuf; -import net.minecraft.entity.Entity; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.world.World; -import physica.library.location.VectorLocation; -import physica.missiles.common.explosive.Explosive; -import physica.missiles.common.explosive.blast.BlastTemplate; -import physica.missiles.common.explosive.blast.IStateHolder; - -public class EntityPrimedExplosive extends Entity implements IEntityAdditionalSpawnData, IStateHolder { - - public int fuse = 90; - public int callcount = 0; - - public int explosiveID = 0; - - public NBTTagCompound nbtData = new NBTTagCompound(); - - public EntityPrimedExplosive(World par1World) { - super(par1World); - fuse = 0; - preventEntitySpawning = true; - setSize(0.98F, 0.98F); - yOffset = height / 2.0F; - } - - public EntityPrimedExplosive(World par1World, double x, double y, double z, int explosiveID) { - this(par1World); - setPosition(x, y, z); - float var8 = (float) (Math.random() * Math.PI * 2.0D); - motionX = -((float) Math.sin(var8)) * 0.02F; - motionY = 0.20000000298023224D; - motionZ = -((float) Math.cos(var8)) * 0.02F; - prevPosX = x; - prevPosY = y; - prevPosZ = z; - this.explosiveID = explosiveID; - fuse = Explosive.get(explosiveID).getBlastTemplate().fuseTime; - } - - @Override - public String getCommandSenderName() - { - return "PrimedExplosives"; - } - - /** Called to update the entity's position/logic. */ - @Override - public void onUpdate() - { - if (fuse > 0) - { - prevPosX = posX; - prevPosY = posY; - prevPosZ = posZ; - - motionX *= 0.95; - motionY -= 0.045D; - motionZ *= 0.95; - - moveEntity(motionX, motionY, motionZ); - worldObj.spawnParticle("smoke", posX, posY + 0.5D, posZ, 0.0D, 0.0D, 0.0D); - } - if (fuse < 1) - { - explode(); - } else - { - fuse--; - } - if (fuse > 0 || isDead) - { - super.onUpdate(); - } - } - - private boolean isPrepared = false; - private HashMap register = new HashMap<>(); - - @Override - public void addObject(String register, Object object) - { - this.register.put(register, object); - } - - @Override - public Object getObject(String register) - { - return this.register.get(register); - } - - public void explode() - { - - BlastTemplate template = getExplosiveType().getBlastTemplate(); - if (!isPrepared) - { - isPrepared = true; - register.put("cause", this); - template.prepare(worldObj, new VectorLocation(this).BlockLocation(), this); - } - template.call(worldObj, new VectorLocation(this).BlockLocation(), callcount, this); - callcount++; - if (callcount >= template.callCount) - { - template.end(worldObj, new VectorLocation(this).BlockLocation(), this); - setDead(); - } - } - - @Override - public boolean isEntityInvulnerable() - { - return true; - } - - /** - * (abstract) Protected helper method to read subclass entity data from NBT. - */ - @Override - protected void readEntityFromNBT(NBTTagCompound nbt) - { - fuse = nbt.getByte("Fuse"); - explosiveID = nbt.getInteger("explosiveID"); - nbtData = nbt.getCompoundTag("data"); - } - - /** - * (abstract) Protected helper method to write subclass entity data to NBT. - */ - @Override - protected void writeEntityToNBT(NBTTagCompound nbt) - { - nbt.setByte("Fuse", (byte) fuse); - nbt.setInteger("explosiveID", explosiveID); - nbt.setTag("data", nbtData); - } - - @Override - public float getShadowSize() - { - return 0.5F; - } - - @Override - protected void entityInit() - { - } - - @Override - protected boolean canTriggerWalking() - { - return true; - } - - @Override - public boolean canBeCollidedWith() - { - return true; - } - - @Override - public boolean canBePushed() - { - return true; - } - - @Override - public void writeSpawnData(ByteBuf data) - { - data.writeInt(explosiveID); - data.writeInt(fuse); - } - - @Override - public void readSpawnData(ByteBuf data) - { - explosiveID = data.readInt(); - fuse = data.readInt(); - } - - public Explosive getExplosiveType() - { - return Explosive.get(explosiveID); - } - -} diff --git a/src/missiles/physica/missiles/common/explosive/Explosive.java b/src/missiles/physica/missiles/common/explosive/Explosive.java deleted file mode 100644 index a96f4f14c..000000000 --- a/src/missiles/physica/missiles/common/explosive/Explosive.java +++ /dev/null @@ -1,133 +0,0 @@ -package physica.missiles.common.explosive; - -import java.util.ArrayList; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.util.ResourceLocation; -import physica.missiles.client.render.model.ModelMissileBase; -import physica.missiles.common.explosive.blast.BlastTemplate; -import physica.missiles.common.explosive.blast.types.BlastTemplateFire; -import physica.missiles.common.explosive.blast.types.BlastTemplatePrimed; -import physica.missiles.common.explosive.blast.types.BlastTemplatePush; -import physica.missiles.common.explosive.blast.types.BlastTemplateRejuvenation; -import physica.missiles.common.explosive.blast.types.BlastTemplateSpread; -import physica.missiles.common.explosive.blast.types.EnumShrapnel; - -public class Explosive { - public static ArrayList explosiveSet = new ArrayList<>(); - static - { - explosiveSet.add(new Explosive("condensive", true, true, true, "condensive_top", "condensive_side", "tier1_bottom").setBlastTemplate(new BlastTemplatePrimed(1, 1, 1, 4.5f))); - explosiveSet.add(new Explosive("repulsive", true, true, true, "repulsive_top", "repulsive_side", "tier1_bottom").setBlastTemplate(new BlastTemplatePush(120, 1, 1, 2.0f, false))); - explosiveSet.add(new Explosive("attractive", true, true, true, "attractive_top", "attractive_side", "tier1_bottom").setBlastTemplate(new BlastTemplatePush(120, 1, 1, 2.0f, true))); - explosiveSet.add(new Explosive("shrapnel", true, true, true, "shrapnel_top", "shrapnel_side", "tier1_bottom").setBlastTemplate(new BlastTemplateSpread(120, 1, 1, EnumShrapnel.SHRAPNEL))); - explosiveSet.add(new Explosive("anvil", true, true, true, "anvil_top", "anvil_side", "tier1_bottom").setBlastTemplate(new BlastTemplateSpread(120, 1, 1, EnumShrapnel.ANVIL))); - explosiveSet.add(new Explosive("incendiary", true, true, true, "incendiary_top", "incendiary_side", "tier1_bottom").setBlastTemplate(new BlastTemplateFire(120, 1, 1, 9.0f))); - explosiveSet.add(new Explosive("fragmentation", true, true, false, "fragmentation_top", "fragmentation_side", "tier2_bottom").setBlastTemplate(new BlastTemplateSpread(180, 2, 1, EnumShrapnel.FRAGMENT))); - explosiveSet.add(new Explosive("breaching", true, true, false, "breaching_top", "breaching_side", "tier2_bottom").setBlastTemplate(new BlastTemplatePrimed(1, 2, 1, 7.5f))); - explosiveSet.add(new Explosive("rejuvenation", true, true, false, "rejuvenation_top", "rejuvenation_side", "tier2_bottom").setBlastTemplate(new BlastTemplateRejuvenation(180, 2, 1))); - } - public final String localeName; - public final boolean hasMissile; - public final boolean hasBlock; - public final boolean hasGrenade; - private BlastTemplate blastTemplate; - @SideOnly(Side.CLIENT) - private ModelMissileBase renderModel; - - @SideOnly(Side.CLIENT) - private ResourceLocation renderResource; - - private String topIcon, bottomIcon, sideIcon; - private int id; - - public Explosive(String localeName, boolean hasMissile, boolean hasBlock, boolean hasGrenade) { - this.localeName = localeName; - this.hasMissile = hasMissile; - this.hasBlock = hasBlock; - this.hasGrenade = hasGrenade; - - } - - public Explosive(String localeName, boolean hasMissile, boolean hasBlock, boolean hasGrenade, String topIcon, String sideIcon, String bottomIcon) { - this.localeName = localeName; - this.hasMissile = hasMissile; - this.hasBlock = hasBlock; - this.hasGrenade = hasGrenade; - this.topIcon = topIcon; - this.sideIcon = sideIcon; - this.bottomIcon = bottomIcon; - id = explosiveSet.size(); - } - - public int getId() - { - return id; - } - - public BlastTemplate getBlastTemplate() - { - return blastTemplate; - } - - public Explosive setBlastTemplate(BlastTemplate blastTemplate) - { - this.blastTemplate = blastTemplate; - return this; - } - - @SideOnly(Side.CLIENT) - public ModelMissileBase getRenderModel() - { - return renderModel; - } - - @SideOnly(Side.CLIENT) - public Explosive setRenderModel(ModelMissileBase renderModel) - { - this.renderModel = renderModel; - return this; - } - - @SideOnly(Side.CLIENT) - public ResourceLocation getRenderResource() - { - return renderResource; - } - - @SideOnly(Side.CLIENT) - public Explosive setRenderResource(ResourceLocation renderResource) - { - this.renderResource = renderResource; - return this; - } - - public String getTopIcon() - { - return topIcon; - } - - public String getSideIcon() - { - return sideIcon; - } - - public String getBottomIcon() - { - return bottomIcon; - } - - public static Explosive get(int explosiveID) - { - for (Explosive ex : explosiveSet) - { - if (ex.id == explosiveID) - { - return ex; - } - } - return null; - } - -} diff --git a/src/missiles/physica/missiles/common/explosive/blast/BlastTemplate.java b/src/missiles/physica/missiles/common/explosive/blast/BlastTemplate.java deleted file mode 100644 index f24b3cdfb..000000000 --- a/src/missiles/physica/missiles/common/explosive/blast/BlastTemplate.java +++ /dev/null @@ -1,76 +0,0 @@ -package physica.missiles.common.explosive.blast; - -import java.util.List; - -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.MathHelper; -import net.minecraft.world.World; -import physica.library.location.GridLocation; -import physica.library.location.VectorLocation; - -public class BlastTemplate { - public final int fuseTime; - public final int tier; - public final int callCount; - - public BlastTemplate(int fuseTime, int tier, int callCount) { - this.fuseTime = fuseTime; - this.tier = tier; - this.callCount = callCount; - } - - public void prepare(World world, GridLocation loc, IStateHolder holder) - { - } - - public void call(World world, GridLocation loc, int callCount, IStateHolder holder) - { - } - - public void end(World world, GridLocation loc, IStateHolder holder) - { - } - - public void pushEntities(World world, GridLocation loc, float radius, float force, boolean drawTowards) - { - VectorLocation vec = loc.Vector().add(0.5); - VectorLocation minCoord = vec.Copy(); - minCoord.translate(-radius - 1.0F, -radius - 1.0F, -radius - 1.0F); - VectorLocation maxCoord = vec.Copy(); - maxCoord.translate(radius + 1.0F, radius + 1.0F, radius + 1.0F); - AxisAlignedBB box = AxisAlignedBB.getBoundingBox(minCoord.x, minCoord.y, minCoord.z, maxCoord.x, maxCoord.y, maxCoord.z); - List entities = world.getEntitiesWithinAABB(Entity.class, box); - for (Entity entity : entities) - { - double var13 = entity.getDistance(vec.x, vec.y, vec.z) / radius; - - if (var13 <= 1.0D) - { - double xDifference = entity.posX - vec.x; - double yDifference = entity.posY - vec.y; - double zDifference = entity.posZ - vec.z; - double distance = MathHelper.sqrt_double(xDifference * xDifference + yDifference * yDifference + zDifference * zDifference); - xDifference /= distance; - yDifference /= distance; - zDifference /= distance; - - if (drawTowards) - { - double modifier = var13 * force * (entity instanceof EntityPlayer ? 0.5 : 1); - entity.addVelocity(-xDifference * modifier, -yDifference * modifier, -zDifference * modifier); - } else - { - double modifier = (1.0D - var13) * force * (entity instanceof EntityPlayer ? 0.5 : 1); - entity.addVelocity(xDifference * modifier, yDifference * modifier, zDifference * modifier); - } - } - } - } - - public int incrementEvery() - { - return 1; - } -} diff --git a/src/missiles/physica/missiles/common/explosive/blast/IStateHolder.java b/src/missiles/physica/missiles/common/explosive/blast/IStateHolder.java deleted file mode 100644 index 2fb334950..000000000 --- a/src/missiles/physica/missiles/common/explosive/blast/IStateHolder.java +++ /dev/null @@ -1,7 +0,0 @@ -package physica.missiles.common.explosive.blast; - -public interface IStateHolder { - public void addObject(String register, Object object); - - public Object getObject(String register); -} diff --git a/src/missiles/physica/missiles/common/explosive/blast/types/BlastTemplateFire.java b/src/missiles/physica/missiles/common/explosive/blast/types/BlastTemplateFire.java deleted file mode 100644 index c966c627c..000000000 --- a/src/missiles/physica/missiles/common/explosive/blast/types/BlastTemplateFire.java +++ /dev/null @@ -1,53 +0,0 @@ -package physica.missiles.common.explosive.blast.types; - -import net.minecraft.init.Blocks; -import net.minecraft.world.World; -import physica.library.location.GridLocation; -import physica.library.location.VectorLocation; -import physica.missiles.common.explosive.blast.BlastTemplate; -import physica.missiles.common.explosive.blast.IStateHolder; - -public class BlastTemplateFire extends BlastTemplate { - private float size; - - public BlastTemplateFire(int fuseTime, int tier, int callCount, float size) { - super(fuseTime, tier, callCount); - this.size = size; - } - - @Override - public void call(World world, GridLocation loc, int callCount, IStateHolder holder) - { - VectorLocation vec = loc.Vector().add(0.5); - if (!world.isRemote) - { - int radius = (int) size; - for (int i = -radius; i <= radius; i++) - { - for (int j = -radius; j <= radius; j++) - { - for (int k = -radius; k <= radius; k++) - { - if (world.rand.nextFloat() < 0.95f) - { - if (vec.getDistance(loc.xCoord + i + 0.5f, loc.yCoord + j + 0.5f, loc.zCoord + k + 0.5f) <= radius) - { - GridLocation target = new GridLocation(i + loc.xCoord, j + loc.yCoord, k + loc.zCoord); - if (target.isAirBlock(world) || target.getBlock(world) == Blocks.snow || target.getBlock(world) == Blocks.snow_layer) - { - target.setBlock(world, Blocks.fire); - } else if (target.getBlock(world) == Blocks.ice) - { - target.setBlock(world, Blocks.water); - } - } - } - } - - } - } - } - - } - -} diff --git a/src/missiles/physica/missiles/common/explosive/blast/types/BlastTemplatePrimed.java b/src/missiles/physica/missiles/common/explosive/blast/types/BlastTemplatePrimed.java deleted file mode 100644 index 56d9ecc4f..000000000 --- a/src/missiles/physica/missiles/common/explosive/blast/types/BlastTemplatePrimed.java +++ /dev/null @@ -1,31 +0,0 @@ -package physica.missiles.common.explosive.blast.types; - -import net.minecraft.entity.Entity; -import net.minecraft.world.World; -import physica.library.location.GridLocation; -import physica.missiles.common.explosive.blast.BlastTemplate; -import physica.missiles.common.explosive.blast.IStateHolder; - -public class BlastTemplatePrimed extends BlastTemplate { - public final float size; - - public BlastTemplatePrimed(int fuseTime, int tier, int callCount, float size) { - super(fuseTime, tier, callCount); - this.size = size; - } - - @Override - public void prepare(World world, GridLocation loc, IStateHolder holder) - { - world.spawnParticle("hugeexplosion", loc.xCoord + 0.5, loc.yCoord + 0.5, loc.zCoord + 0.5, 0.0D, 0.0D, 0.0D); - } - - @Override - public void call(World world, GridLocation loc, int callCount, IStateHolder holder) - { - if (!world.isRemote) - { - world.createExplosion((Entity) holder.getObject("cause"), loc.xCoord + 0.5, loc.yCoord + 0.5, loc.zCoord + 0.5, size, true); - } - } -} diff --git a/src/missiles/physica/missiles/common/explosive/blast/types/BlastTemplatePush.java b/src/missiles/physica/missiles/common/explosive/blast/types/BlastTemplatePush.java deleted file mode 100644 index cba9a1d77..000000000 --- a/src/missiles/physica/missiles/common/explosive/blast/types/BlastTemplatePush.java +++ /dev/null @@ -1,39 +0,0 @@ -package physica.missiles.common.explosive.blast.types; - -import net.minecraft.entity.Entity; -import net.minecraft.world.World; -import physica.library.location.GridLocation; -import physica.missiles.common.explosive.blast.BlastTemplate; -import physica.missiles.common.explosive.blast.IStateHolder; - -public class BlastTemplatePush extends BlastTemplate { - public final float size; - public final boolean drawTowards; - - public BlastTemplatePush(int fuseTime, int tier, int callCount, float size, boolean drawTowards) { - super(fuseTime, tier, callCount); - this.size = size; - this.drawTowards = drawTowards; - } - - @Override - public void prepare(World world, GridLocation loc, IStateHolder holder) - { - world.spawnParticle("hugeexplosion", loc.xCoord + 0.5, loc.yCoord + 0.5, loc.zCoord + 0.5, 0.0D, 0.0D, 0.0D); - } - - @Override - public void call(World world, GridLocation loc, int callCount, IStateHolder holder) - { - if (!world.isRemote) - { - world.createExplosion((Entity) holder.getObject("cause"), loc.xCoord + 0.5, loc.yCoord + 0.5, loc.zCoord + 0.5, size, true); - } - } - - @Override - public void end(World world, GridLocation loc, IStateHolder holder) - { - pushEntities(world, loc, 12.0f, 8.0f, drawTowards); - } -} diff --git a/src/missiles/physica/missiles/common/explosive/blast/types/BlastTemplateRejuvenation.java b/src/missiles/physica/missiles/common/explosive/blast/types/BlastTemplateRejuvenation.java deleted file mode 100644 index 3bc3908f5..000000000 --- a/src/missiles/physica/missiles/common/explosive/blast/types/BlastTemplateRejuvenation.java +++ /dev/null @@ -1,54 +0,0 @@ -package physica.missiles.common.explosive.blast.types; - -import net.minecraft.block.Block; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; -import net.minecraft.world.WorldServer; -import net.minecraft.world.chunk.Chunk; -import net.minecraft.world.chunk.IChunkProvider; -import net.minecraft.world.gen.ChunkProviderServer; -import physica.library.location.GridLocation; -import physica.missiles.common.explosive.blast.BlastTemplate; -import physica.missiles.common.explosive.blast.IStateHolder; - -public class BlastTemplateRejuvenation extends BlastTemplate { - - public BlastTemplateRejuvenation(int fuseTime, int tier, int callCount) { - super(fuseTime, tier, callCount); - } - - @Override - public void call(World world, GridLocation loc, int callCount, IStateHolder holder) - { - if (!world.isRemote) - { - Chunk oldChunk = world.getChunkFromBlockCoords(loc.xCoord, loc.zCoord); - if (world instanceof WorldServer) - { - WorldServer worldServer = (WorldServer) world; - ChunkProviderServer chunkProviderServer = worldServer.theChunkProviderServer; - IChunkProvider chunkProviderGenerate = chunkProviderServer.currentChunkProvider; - Chunk newChunk = chunkProviderGenerate.provideChunk(oldChunk.xPosition, oldChunk.zPosition); - for (int x = 0; x < 16; x++) - { - for (int z = 0; z < 16; z++) - { - for (int y = 0; y < worldServer.getHeight(); y++) - { - Block block = newChunk.getBlock(x, y, z); - int meta = newChunk.getBlockMetadata(x, y, z); - worldServer.setBlock(x + oldChunk.xPosition * 16, y, z + oldChunk.zPosition * 16, block, meta, 2); - TileEntity tile = newChunk.getTileEntityUnsafe(x, y, z); - if (tile != null) - { - worldServer.setTileEntity(x + oldChunk.xPosition * 16, y, z + oldChunk.zPosition * 16, tile); - } - } - } - } - oldChunk.isTerrainPopulated = false; - chunkProviderGenerate.populate(chunkProviderGenerate, oldChunk.xPosition, oldChunk.zPosition); - } - } - } -} diff --git a/src/missiles/physica/missiles/common/explosive/blast/types/BlastTemplateSpread.java b/src/missiles/physica/missiles/common/explosive/blast/types/BlastTemplateSpread.java deleted file mode 100644 index d50f840d9..000000000 --- a/src/missiles/physica/missiles/common/explosive/blast/types/BlastTemplateSpread.java +++ /dev/null @@ -1,55 +0,0 @@ -package physica.missiles.common.explosive.blast.types; - -import net.minecraft.entity.Entity; -import net.minecraft.util.MathHelper; -import net.minecraft.world.World; -import physica.library.location.GridLocation; -import physica.missiles.common.entity.EntityFragment; -import physica.missiles.common.explosive.blast.BlastTemplate; -import physica.missiles.common.explosive.blast.IStateHolder; - -public class BlastTemplateSpread extends BlastTemplate { - private EnumShrapnel type; - - public BlastTemplateSpread(int fuseTime, int tier, int callCount, EnumShrapnel type) { - super(fuseTime, tier, callCount); - this.type = type; - } - - @Override - public void call(World world, GridLocation loc, int callCount, IStateHolder holder) - { - if (!world.isRemote) - { - float rad = type == EnumShrapnel.FRAGMENT ? 8.0f : 5.0f; - for (int i = 0; i < rad; i++) - { - float rotationYaw = world.rand.nextFloat() * 360.0f; - for (int j = 0; j < rad; j++) - { - EntityFragment fragment = new EntityFragment(world, loc.xCoord + 0.5, loc.yCoord + 1 + 0.5, loc.zCoord + 0.5, type); - - if (((Entity) holder.getObject("cause")).isBurning()) - { - fragment.isCritical = true; - fragment.setFire(100); - } - - float rotationPitch = rotationYaw / (world.rand.nextFloat() * 3); - fragment.setLocationAndAngles(loc.xCoord + 0.5, loc.yCoord + 1 + 0.5, loc.zCoord + 0.5, rotationYaw, rotationPitch); - fragment.posX -= MathHelper.cos(rotationYaw / 180.0F * (float) Math.PI) * 0.16F; - fragment.posY -= 0.10000000149011612D; - fragment.posZ -= MathHelper.sin(rotationYaw / 180.0F * (float) Math.PI) * 0.16F; - fragment.setPosition(fragment.posX, fragment.posY, fragment.posZ); - fragment.yOffset = 0.0F; - fragment.motionX = -MathHelper.sin(rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(rotationPitch / 180.0F * (float) Math.PI); - fragment.motionZ = MathHelper.cos(rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(rotationPitch / 180.0F * (float) Math.PI); - fragment.motionY = -MathHelper.sin(rotationPitch / 180.0F * (float) Math.PI); - fragment.setArrowHeading(fragment.motionX * world.rand.nextFloat(), fragment.motionY * world.rand.nextFloat(), fragment.motionZ * world.rand.nextFloat(), 0.5f + 0.7f * world.rand.nextFloat(), 1.0F); - world.spawnEntityInWorld(fragment); - } - } - } - } - -} diff --git a/src/missiles/physica/missiles/common/explosive/blast/types/EnumShrapnel.java b/src/missiles/physica/missiles/common/explosive/blast/types/EnumShrapnel.java deleted file mode 100644 index fca56e50b..000000000 --- a/src/missiles/physica/missiles/common/explosive/blast/types/EnumShrapnel.java +++ /dev/null @@ -1,5 +0,0 @@ -package physica.missiles.common.explosive.blast.types; - -public enum EnumShrapnel { - SHRAPNEL, FRAGMENT, ANVIL -} diff --git a/src/missiles/physica/missiles/common/items/ItemBlockPrimed.java b/src/missiles/physica/missiles/common/items/ItemBlockPrimed.java deleted file mode 100644 index 8c9d002a0..000000000 --- a/src/missiles/physica/missiles/common/items/ItemBlockPrimed.java +++ /dev/null @@ -1,21 +0,0 @@ -package physica.missiles.common.items; - -import net.minecraft.block.Block; -import net.minecraft.item.ItemStack; -import physica.library.item.ItemBlockMetadata; -import physica.missiles.common.explosive.Explosive; - -public class ItemBlockPrimed extends ItemBlockMetadata { - - public ItemBlockPrimed(Block block) { - super(block); - } - - @Override - public String getUnlocalizedName(ItemStack itemStack) - { - Explosive handler = Explosive.get(itemStack.getItemDamage()); - return "physicaMissiles.explosive." + (handler == null ? "unknown" : handler.localeName); - } - -} diff --git a/src/missiles/physica/missiles/common/items/ItemGrenade.java b/src/missiles/physica/missiles/common/items/ItemGrenade.java deleted file mode 100644 index e4f800fe0..000000000 --- a/src/missiles/physica/missiles/common/items/ItemGrenade.java +++ /dev/null @@ -1,144 +0,0 @@ -package physica.missiles.common.items; - -import java.util.HashMap; -import java.util.List; -import java.util.UUID; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.EnumAction; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.IIcon; -import net.minecraft.world.World; -import physica.library.item.ItemDescriptable; -import physica.missiles.MissileReferences; -import physica.missiles.common.MissileTabRegister; -import physica.missiles.common.entity.EntityGrenade; -import physica.missiles.common.explosive.Explosive; - -public class ItemGrenade extends ItemDescriptable { - - public static final IIcon[] ICONS = new IIcon[256]; - private static final int firingDelay = 1000; - private HashMap clickTimePlayer = new HashMap<>(); - - public ItemGrenade() { - super("grenades", "grenade"); - setMaxStackSize(16); - setMaxDamage(0); - setHasSubtypes(true); - setCreativeTab(MissileTabRegister.missilesTab); - } - - @Override - public ItemStack onEaten(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { - return par1ItemStack; - } - - @Override - public EnumAction getItemUseAction(ItemStack par1ItemStack) - { - return EnumAction.bow; - } - - @Override - public int getMaxItemUseDuration(ItemStack par1ItemStack) - { - return 3 * 20; - } - - @Override - public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer entityPlayer) - { - if (itemStack != null) - { - entityPlayer.setItemInUse(itemStack, getMaxItemUseDuration(itemStack)); - } - - return itemStack; - } - - @Override - public void onPlayerStoppedUsing(ItemStack itemStack, World world, EntityPlayer entityPlayer, int itemInUseCount) - { - if (!world.isRemote) - { - long clickMs = System.currentTimeMillis(); - if (clickTimePlayer.containsKey(entityPlayer.getUniqueID())) - { - if (clickMs - clickTimePlayer.get(entityPlayer.getUniqueID()) < (entityPlayer.capabilities.isCreativeMode ? firingDelay / 2 : firingDelay)) - { - return; - } - } - Explosive explosive = Explosive.get(itemStack.getItemDamage()); - if (!entityPlayer.capabilities.isCreativeMode) - { - itemStack.stackSize--; - - if (itemStack.stackSize <= 0) - { - entityPlayer.inventory.setInventorySlotContents(entityPlayer.inventory.currentItem, null); - } - } - - world.playSoundAtEntity(entityPlayer, "game.tnt.primed", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F)); - world.spawnEntityInWorld(new EntityGrenade(world, entityPlayer, explosive.getId(), (float) (getMaxItemUseDuration(itemStack) - itemInUseCount) / (float) getMaxItemUseDuration(itemStack))); - clickTimePlayer.put(entityPlayer.getUniqueID(), clickMs); - } - } - - @Override - public int getMetadata(int damage) - { - return damage; - } - - @Override - public String getUnlocalizedName(ItemStack itemstack) - { - return getUnlocalizedName() + "." + Explosive.get(itemstack.getItemDamage()).localeName; - } - - @Override - public String getUnlocalizedName() - { - return "physicaMissiles.grenade"; - } - - @SideOnly(Side.CLIENT) - @Override - public void registerIcons(IIconRegister iconRegister) - { - for (Explosive ex : Explosive.explosiveSet) - { - if (ex.hasGrenade) - { - ICONS[ex.getId()] = iconRegister.registerIcon(MissileReferences.PREFIX + "grenades/grenade." + ex.localeName); - } - } - } - - @Override - public IIcon getIconFromDamage(int i) - { - return ICONS[i]; - } - - @Override - public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, @SuppressWarnings("rawtypes") List par3List) - { - for (Explosive ex : Explosive.explosiveSet) - { - if (ex.hasGrenade) - { - par3List.add(new ItemStack(par1, 1, ex.getId())); - } - } - } -}