mk4.5, sorta

This commit is contained in:
HbmMods 2018-05-21 22:51:57 +02:00
parent ae6d92c239
commit babe46761e
14 changed files with 175 additions and 7 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 293 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 258 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 300 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 287 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 280 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 294 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 280 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 293 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 374 B

View File

@ -22,10 +22,10 @@ public class BlockNTMDirt extends BlockDirt {
{
p_149666_3_.add(new ItemStack(this, 1, 0));
}
public String getItemStackDisplayName(ItemStack stack)
public String getLocalizedName()
{
return ("" + StatCollector.translateToLocal(Blocks.dirt.getUnlocalizedName())).trim();
return ("" + StatCollector.translateToLocal(Blocks.dirt.getUnlocalizedName()) + ".name").trim();
}
@Override

View File

@ -62,7 +62,7 @@ public class EntityNukeExplosionMK4 extends Entity {
//if(!worldObj.isRemote)
//MainRegistry.logger.info(explosion.getStoredSize() + " / " + count / length);
//explosion.collectTip(speed * 10);
explosion.collectTipAusf3(speed * 10);
explosion.collectTipMk4_5(speed * 10);
} else if(explosion.getStoredSize() > 0) {
//if(!worldObj.isRemote)
//MainRegistry.logger.info(explosion.getProgress() + " / " + count / length);

View File

@ -25,7 +25,7 @@ public class ExplosionNukeRay {
int speed;
int processed;
int length;
double startY;
int startY;
int startCir;
public boolean isAusf3Complete = false;
@ -38,7 +38,10 @@ public class ExplosionNukeRay {
this.count = count;
this.speed = speed;
this.length = length;
this.startY = strength;
//Ausf3, must be double
//this.startY = strength;
//Mk 4.5, must be int32
this.startY = 0;
this.startCir = 0;
}
@ -223,7 +226,7 @@ public class ExplosionNukeRay {
}
}
public void collectTipAusf3(int count) {
/*public void collectTipAusf3(int count) {
int amountProcessed = 0;
@ -293,6 +296,89 @@ public class ExplosionNukeRay {
}
}
isAusf3Complete = true;
}*/
public void collectTipMk4_5(int count) {
int amountProcessed = 0;
double bow = Math.PI * this.strength;
double bowCount = Math.ceil(bow);
//Axial
//StartY starts at this.length
for(int v = startY; v <= bowCount; v++) {
Vec3 heightVec = Vec3.createVectorHelper(0, strength, 0);
heightVec.rotateAroundZ((float)(Math.PI/bow * -(float)v));
double y = heightVec.yCoord;
System.out.println(v + " " + y);
double sectionRad = Math.sqrt(Math.pow(strength, 2) - Math.pow(y, 2));
double circumference = 2 * Math.PI * sectionRad;
//circumference = Math.ceil(circumference);
//Radial
//StartCir starts at circumference
for(int r = startCir; r < circumference; r ++) {
Vec3 vec = Vec3.createVectorHelper(sectionRad, y, 0);
vec = vec.normalize();
/*if(y > 0)
vec.rotateAroundZ((float) (y / sectionRad) * 0.15F);*/
if(y < 0)
vec.rotateAroundZ((float) (y / sectionRad) * 0.15F);
vec.rotateAroundY((float) (360 / circumference * r));
int length = (int)Math.ceil(strength);
float res = strength;
FloatTriplet lastPos = null;
for(int i = 0; i < length; i ++) {
if(i > this.length)
break;
float x0 = (float) (posX + (vec.xCoord * i));
float y0 = (float) (posY + (vec.yCoord * i));
float z0 = (float) (posZ + (vec.zCoord * i));
double fac = 100 - ((double) i) / ((double) length) * 100;
fac *= 0.07D;
if(!world.getBlock((int)x0, (int)y0, (int)z0).getMaterial().isLiquid())
res -= Math.pow(world.getBlock((int)x0, (int)y0, (int)z0).getExplosionResistance(null), 7.5D - fac);
else
res -= Math.pow(Blocks.air.getExplosionResistance(null), 7.5D - fac);
if(res > 0 && world.getBlock((int)x0, (int)y0, (int)z0) != Blocks.air) {
lastPos = new FloatTriplet(x0, y0, z0);
}
if(res <= 0 || i + 1 >= this.length) {
if(affectedBlocks.size() < Integer.MAX_VALUE - 100 && lastPos != null) {
affectedBlocks.add(new FloatTriplet(lastPos.xCoord, lastPos.yCoord, lastPos.zCoord));
}
break;
}
}
amountProcessed++;
if(amountProcessed >= count) {
startY = v;
startCir = startCir + 1;
return;
}
}
}
isAusf3Complete = true;
}

View File

@ -3,13 +3,21 @@ package com.hbm.items.special;
import com.hbm.entity.logic.EntityNukeExplosionMK4;
import com.hbm.lib.ModDamageSource;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
public class ItemUnstable extends Item {
IIcon iconElements;
IIcon iconArsenic;
IIcon iconVault;
int radius;
int timer;
@ -17,9 +25,14 @@ public class ItemUnstable extends Item {
public ItemUnstable(int radius, int timer) {
this.radius = radius;
this.timer = timer;
this.setHasSubtypes(true);
}
public void onUpdate(ItemStack stack, World world, Entity entity, int i, boolean b) {
if(stack.getItemDamage() != 0)
return;
this.setTimer(stack, this.getTimer(stack) + 1);
if(this.getTimer(stack) == timer && !world.isRemote) {
@ -43,4 +56,34 @@ public class ItemUnstable extends Item {
return stack.stackTagCompound.getInteger("timer");
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister p_94581_1_)
{
super.registerIcons(p_94581_1_);
this.iconElements = p_94581_1_.registerIcon("hbm:hs-elements");
this.iconArsenic = p_94581_1_.registerIcon("hbm:hs-arsenic");
this.iconVault = p_94581_1_.registerIcon("hbm:hs-vault");
}
@Override
@SideOnly(Side.CLIENT)
public boolean requiresMultipleRenderPasses()
{
return true;
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIconFromDamageForRenderPass(int damage, int layer)
{
switch(damage) {
case 1: return this.iconElements;
case 2: return this.iconArsenic;
case 3: return this.iconVault;
default: return this.itemIcon;
}
}
}

View File

@ -1,12 +1,17 @@
package com.hbm.items.tool;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import com.hbm.blocks.ModBlocks;
import com.hbm.items.ModItems;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
public class ItemMS extends Item {
@ -15,5 +20,39 @@ public class ItemMS extends Item {
{
list.add("Lost but not forgotten");
}
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int i, float a, float b, float c)
{
if(!world.isRemote) {
if(world.getBlock(x, y, z) == ModBlocks.ntm_dirt) {
world.func_147480_a(x, y, z, false);
Random rand = new Random();
List<ItemStack> list = new ArrayList<ItemStack>();
list.add(new ItemStack(ModItems.ingot_u238m2, 1, 1));
list.add(new ItemStack(ModItems.ingot_u238m2, 1, 2));
list.add(new ItemStack(ModItems.ingot_u238m2, 1, 3));
for(ItemStack sta : list) {
float f = rand.nextFloat() * 0.8F + 0.1F;
float f1 = rand.nextFloat() * 0.8F + 0.1F;
float f2 = rand.nextFloat() * 0.8F + 0.1F;
EntityItem entityitem = new EntityItem(world, x + f, y + f1, z + f2, sta);
float f3 = 0.05F;
entityitem.motionX = (float)rand.nextGaussian() * f3;
entityitem.motionY = (float)rand.nextGaussian() * f3 + 0.2F;
entityitem.motionZ = (float)rand.nextGaussian() * f3;
if(!world.isRemote)
world.spawnEntityInWorld(entityitem);
}
return true;
}
}
return false;
}
}