Vanilla bow nerf

This commit is contained in:
mDiyo 2013-03-22 17:34:08 -07:00
parent 57d8a3b405
commit 5b707d93f0
9 changed files with 228 additions and 45 deletions

View File

@ -0,0 +1,81 @@
package mods.tinker.tconstruct;
import java.util.Random;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.projectile.EntityArrow;
import net.minecraft.item.Item;
import net.minecraftforge.event.ForgeSubscribe;
import net.minecraftforge.event.entity.player.ArrowLooseEvent;
public class TAfterEventHandler
{
Random rand = new Random();
/* Bows */
@ForgeSubscribe
public void arrowShoot (ArrowLooseEvent event)
{
event.setCanceled(true);
int j = event.charge;
boolean flag = event.entityPlayer.capabilities.isCreativeMode || EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, event.bow) > 0;
if (flag || event.entityPlayer.inventory.hasItem(Item.arrow.itemID))
{
float f = (float)j / 20.0F;
f = (f * f + f * 2.0F) / 3.0F;
if ((double)f < 0.1D)
{
return;
}
if (f > 1.0F)
{
f = 1.0F;
}
EntityArrow entityarrow = new EntityArrow(event.entityPlayer.worldObj, event.entityPlayer, f * 2.0F);
if (f == 1.0F)
{
entityarrow.setIsCritical(true);
}
int k = EnchantmentHelper.getEnchantmentLevel(Enchantment.power.effectId, event.bow);
entityarrow.setDamage(1.5D + k * 0.45D);
int l = EnchantmentHelper.getEnchantmentLevel(Enchantment.punch.effectId, event.bow);
if (l > 0)
{
entityarrow.setKnockbackStrength(l);
}
if (EnchantmentHelper.getEnchantmentLevel(Enchantment.flame.effectId, event.bow) > 0)
{
entityarrow.setFire(100);
}
event.bow.damageItem(1, event.entityPlayer);
event.entityPlayer.worldObj.playSoundAtEntity(event.entityPlayer, "random.bow", 1.0F, 1.0F / (rand.nextFloat() * 0.4F + 1.2F) + f * 0.5F);
if (flag)
{
entityarrow.canBePickedUp = 2;
}
else
{
event.entityPlayer.inventory.consumeInventoryItem(Item.arrow.itemID);
}
if (!event.entityPlayer.worldObj.isRemote)
{
event.entityPlayer.worldObj.spawnEntityInWorld(entityarrow);
}
}
}
}

View File

@ -23,7 +23,7 @@ import cpw.mods.fml.common.registry.GameRegistry;
* @author: mDiyo * @author: mDiyo
*/ */
@Mod(modid = "TConstruct", name = "TConstruct", version = "1.5.1_1.2.1", dependencies = "before:*") @Mod(modid = "TConstruct", name = "TConstruct", version = "1.5.1_1.2.1")
@NetworkMod(serverSideRequired = false, clientSideRequired = true, channels = { "TConstruct" }, packetHandler = mods.tinker.tconstruct.TPacketHandler.class) @NetworkMod(serverSideRequired = false, clientSideRequired = true, channels = { "TConstruct" }, packetHandler = mods.tinker.tconstruct.TPacketHandler.class)
public class TConstruct public class TConstruct
{ {
@ -74,9 +74,12 @@ public class TConstruct
{ {
content.modIntegration(); content.modIntegration();
content.oreRegistry(); content.oreRegistry();
lateEvents = new TAfterEventHandler();
MinecraftForge.EVENT_BUS.register(lateEvents);
} }
public static TEventHandler events; public static TEventHandler events;
public static TAfterEventHandler lateEvents;
public static TPlayerHandler playerTracker; public static TPlayerHandler playerTracker;
public static TContent content; public static TContent content;

View File

@ -19,9 +19,10 @@ import mods.tinker.tconstruct.crafting.LiquidCasting;
import mods.tinker.tconstruct.crafting.PatternBuilder; import mods.tinker.tconstruct.crafting.PatternBuilder;
import mods.tinker.tconstruct.crafting.Smeltery; import mods.tinker.tconstruct.crafting.Smeltery;
import mods.tinker.tconstruct.crafting.ToolBuilder; import mods.tinker.tconstruct.crafting.ToolBuilder;
import mods.tinker.tconstruct.entity.BlueSlime;
import mods.tinker.tconstruct.entity.CartEntity; import mods.tinker.tconstruct.entity.CartEntity;
import mods.tinker.tconstruct.entity.Crystal; import mods.tinker.tconstruct.entity.Crystal;
import mods.tinker.tconstruct.entity.BlueSlime; import mods.tinker.tconstruct.entity.MetalSlime;
import mods.tinker.tconstruct.entity.Skyla; import mods.tinker.tconstruct.entity.Skyla;
import mods.tinker.tconstruct.entity.UnstableCreeper; import mods.tinker.tconstruct.entity.UnstableCreeper;
import mods.tinker.tconstruct.items.CraftedSoilItemBlock; import mods.tinker.tconstruct.items.CraftedSoilItemBlock;
@ -187,12 +188,14 @@ public class TContent implements IFuelHandler
EntityRegistry.registerModEntity(Skyla.class, "Skyla", 10, TConstruct.instance, 32, 5, true); EntityRegistry.registerModEntity(Skyla.class, "Skyla", 10, TConstruct.instance, 32, 5, true);
EntityRegistry.registerModEntity(UnstableCreeper.class, "UnstableCreeper", 11, TConstruct.instance, 64, 5, true); EntityRegistry.registerModEntity(UnstableCreeper.class, "UnstableCreeper", 11, TConstruct.instance, 64, 5, true);
EntityRegistry.registerModEntity(BlueSlime.class, "EdibleSlime", 12, TConstruct.instance, 64, 5, true); EntityRegistry.registerModEntity(BlueSlime.class, "EdibleSlime", 12, TConstruct.instance, 64, 5, true);
EntityRegistry.registerModEntity(MetalSlime.class, "MetalSlime", 13, TConstruct.instance, 64, 5, true);
BiomeGenBase[] overworldBiomes = new BiomeGenBase[] { BiomeGenBase.ocean, BiomeGenBase.plains, BiomeGenBase.desert, BiomeGenBase.extremeHills, BiomeGenBase.forest, BiomeGenBase.taiga, BiomeGenBase[] overworldBiomes = new BiomeGenBase[] { BiomeGenBase.ocean, BiomeGenBase.plains, BiomeGenBase.desert, BiomeGenBase.extremeHills, BiomeGenBase.forest, BiomeGenBase.taiga,
BiomeGenBase.swampland, BiomeGenBase.river, BiomeGenBase.frozenOcean, BiomeGenBase.frozenRiver, BiomeGenBase.icePlains, BiomeGenBase.iceMountains, BiomeGenBase.beach, BiomeGenBase.swampland, BiomeGenBase.river, BiomeGenBase.frozenOcean, BiomeGenBase.frozenRiver, BiomeGenBase.icePlains, BiomeGenBase.iceMountains, BiomeGenBase.beach,
BiomeGenBase.desertHills, BiomeGenBase.forestHills, BiomeGenBase.taigaHills, BiomeGenBase.extremeHillsEdge, BiomeGenBase.jungle, BiomeGenBase.jungleHills }; BiomeGenBase.desertHills, BiomeGenBase.forestHills, BiomeGenBase.taigaHills, BiomeGenBase.extremeHillsEdge, BiomeGenBase.jungle, BiomeGenBase.jungleHills };
EntityRegistry.addSpawn(UnstableCreeper.class, 8, 4, 6, EnumCreatureType.monster, overworldBiomes); EntityRegistry.addSpawn(UnstableCreeper.class, 8, 4, 6, EnumCreatureType.monster, overworldBiomes);
EntityRegistry.addSpawn(BlueSlime.class, 10, 4, 4, EnumCreatureType.monster, overworldBiomes); EntityRegistry.addSpawn(BlueSlime.class, 10, 4, 4, EnumCreatureType.monster, overworldBiomes);
EntityRegistry.addSpawn(MetalSlime.class, 1, 4, 4, EnumCreatureType.monster, overworldBiomes);
} }
void registerBlocks () void registerBlocks ()
@ -314,7 +317,9 @@ public class TContent implements IFuelHandler
Item.doorSteel.setMaxStackSize(16); Item.doorSteel.setMaxStackSize(16);
Item.snowball.setMaxStackSize(64); Item.snowball.setMaxStackSize(64);
Item.boat.setMaxStackSize(16); Item.boat.setMaxStackSize(16);
Item.potion.setMaxStackSize(16); Item.minecartEmpty.setMaxStackSize(3);
Item.minecartCrate.setMaxStackSize(3);
Item.minecartPowered.setMaxStackSize(3);
} }
void registerMaterials () void registerMaterials ()

View File

@ -1,20 +1,26 @@
package mods.tinker.tconstruct; package mods.tinker.tconstruct;
import java.util.Random;
import mods.tinker.tconstruct.crafting.PatternBuilder; import mods.tinker.tconstruct.crafting.PatternBuilder;
import mods.tinker.tconstruct.crafting.Smeltery; import mods.tinker.tconstruct.crafting.Smeltery;
import mods.tinker.tconstruct.logic.LiquidTextureLogic; import mods.tinker.tconstruct.logic.LiquidTextureLogic;
import net.minecraft.client.Minecraft;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.projectile.EntityArrow;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumMovingObjectType; import net.minecraft.util.EnumMovingObjectType;
import net.minecraftforge.event.Event.Result; import net.minecraftforge.event.Event.Result;
import net.minecraftforge.event.ForgeSubscribe; import net.minecraftforge.event.ForgeSubscribe;
import net.minecraftforge.event.entity.player.ArrowLooseEvent;
import net.minecraftforge.event.entity.player.FillBucketEvent; import net.minecraftforge.event.entity.player.FillBucketEvent;
import net.minecraftforge.liquids.LiquidStack; import net.minecraftforge.liquids.LiquidStack;
import net.minecraftforge.oredict.OreDictionary.OreRegisterEvent; import net.minecraftforge.oredict.OreDictionary.OreRegisterEvent;
public class TEventHandler public class TEventHandler
{ {
/* Ore Dictionary */ /* Ore Dictionary */
@ForgeSubscribe @ForgeSubscribe
public void registerOre (OreRegisterEvent evt) public void registerOre (OreRegisterEvent evt)

View File

@ -1,12 +1,7 @@
package mods.tinker.tconstruct.entity; package mods.tinker.tconstruct.entity;
import com.google.common.io.ByteArrayDataInput;
import com.google.common.io.ByteArrayDataOutput;
import cpw.mods.fml.common.registry.IEntityAdditionalSpawnData;
import mods.tinker.tconstruct.TConstruct; import mods.tinker.tconstruct.TConstruct;
import mods.tinker.tconstruct.TContent; import mods.tinker.tconstruct.TContent;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.EntityLiving; import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.monster.EntitySkeleton; import net.minecraft.entity.monster.EntitySkeleton;
import net.minecraft.entity.monster.IMob; import net.minecraft.entity.monster.IMob;
@ -27,7 +22,7 @@ public class BlueSlime extends EntityLiving implements IMob
public float field_70812_c; public float field_70812_c;
/** the time between each jump of the slime */ /** the time between each jump of the slime */
private int slimeJumpDelay = 0; protected int slimeJumpDelay = 0;
public BlueSlime(World world) public BlueSlime(World world)
{ {
@ -38,16 +33,27 @@ public class BlueSlime extends EntityLiving implements IMob
this.slimeJumpDelay = this.rand.nextInt(20) + 10; this.slimeJumpDelay = this.rand.nextInt(20) + 10;
this.setSlimeSize(i); this.setSlimeSize(i);
this.jumpMovementFactor = 0.004F * i + 0.01F; this.jumpMovementFactor = 0.004F * i + 0.01F;
//if (i > 6)
//makeSlimeJocky(world);
//System.out.println("Woo");
} }
protected void damageEntity(DamageSource damageSource, int damage)
{
//Minecraft.getMinecraft().getLogAgent().logInfo("Damage: "+damage);
if (damageSource.damageType.equals("arrow"))
damage = damage/2;
super.damageEntity(damageSource, damage);
}
/*public boolean attackEntityFrom(DamageSource damageSource, int damage)
{
if (damageSource.damageType.equals("arrow") && rand.nextInt(5) == 0)
return false;
return super.attackEntityFrom(damageSource, damage);
}*/
@Override @Override
public void initCreature () public void initCreature ()
{ {
//Minecraft.getMinecraft().getLogAgent().logInfo("Initializing a slime with size "+getSlimeSize()); if (getSlimeSize() == 2 && rand.nextInt(8) == 0)
if (getSlimeSize() == 2 && rand.nextInt(15) == 0)
{ {
EntitySkeleton entityskeleton = new EntitySkeleton(this.worldObj); EntitySkeleton entityskeleton = new EntitySkeleton(this.worldObj);
entityskeleton.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, 0.0F); entityskeleton.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, 0.0F);
@ -58,41 +64,12 @@ public class BlueSlime extends EntityLiving implements IMob
} }
/*@Override
public void updateRiderPosition()
{
if (this.riddenByEntity != null)
{
if (!(this.riddenByEntity instanceof EntityPlayer) || !((EntityPlayer)this.riddenByEntity).func_71066_bF())
{
this.riddenByEntity.lastTickPosX = this.lastTickPosX;//+Math.sin(this.rotationYaw/360);
this.riddenByEntity.lastTickPosY = this.lastTickPosY + this.getMountedYOffset() + this.riddenByEntity.getYOffset();
this.riddenByEntity.lastTickPosZ = this.lastTickPosZ;//+Math.cos(this.rotationYaw/360);
}
this.riddenByEntity.setPosition(this.posX, this.posY + this.getMountedYOffset() + this.riddenByEntity.getYOffset(), this.posZ);
}
}*/
@Override @Override
public double getMountedYOffset() public double getMountedYOffset()
{ {
return this.height * 0.3; return this.height * 0.3;
} }
/*protected void makeSlimeJocky(World world)
{
//if (!world.isRemote)
//{
EntitySkeleton skeleton = new EntitySkeleton(world);
skeleton.setPosition(posX, posY, posZ);
skeleton.setAngles(this.rotationYaw, this.rotationYaw);
world.spawnEntityInWorld(skeleton);
skeleton.mountEntity(this);
spawnedJocky = true;
//}
}*/
protected void jump () protected void jump ()
{ {
this.motionY = 0.05 * getSlimeSize() + 0.37; this.motionY = 0.05 * getSlimeSize() + 0.37;
@ -264,6 +241,7 @@ public class BlueSlime extends EntityLiving implements IMob
protected void updateEntityActionState () protected void updateEntityActionState ()
{ {
//Minecraft.getMinecraft().getLogAgent().logInfo("Collided with "+entity.getEntityName());
this.despawnEntity(); this.despawnEntity();
EntityPlayer entityplayer = this.worldObj.getClosestVulnerablePlayerToEntity(this, 16.0D); EntityPlayer entityplayer = this.worldObj.getClosestVulnerablePlayerToEntity(this, 16.0D);
@ -273,7 +251,6 @@ public class BlueSlime extends EntityLiving implements IMob
} }
else if (this.onGround && this.slimeJumpDelay == 1) else if (this.onGround && this.slimeJumpDelay == 1)
{ {
//this.rotationPitch = rand.nextFloat()*360;
this.rotationYaw = this.rotationYaw + rand.nextFloat() * 180 - 90; this.rotationYaw = this.rotationYaw + rand.nextFloat() * 180 - 90;
if (rotationYaw > 360) if (rotationYaw > 360)
rotationYaw -= 360; rotationYaw -= 360;

View File

@ -0,0 +1,111 @@
package mods.tinker.tconstruct.entity;
import mods.tinker.tconstruct.TContent;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.DamageSource;
import net.minecraft.world.World;
public class MetalSlime extends BlueSlime
{
public MetalSlime(World world)
{
super(world);
this.texture = "/mods/tinker/textures/mob/slimemetal.png";
}
public boolean attackEntityFrom (DamageSource damageSource, int damage)
{
if (!damageSource.isExplosion() && damageSource.isProjectile())
return false;
return super.attackEntityFrom(damageSource, damage);
}
public int getMaxHealth ()
{
int i = this.getSlimeSize();
if (i == 1)
return 4;
return (int) Math.min(i * i + 20, 100);
}
public int getTotalArmorValue ()
{
return super.getTotalArmorValue() + 12;
}
public void setDead ()
{
this.isDead = true;
}
/*protected void dropFewItems (boolean par1, int par2)
{
int j = this.getDropItemId();
if (j > 0)
{
int k = rand.nextInt(3) + rand.nextInt(this.getSlimeSize());
if (par2 > 0)
{
k += this.rand.nextInt(par2 + 1);
}
for (int l = 0; l < k; ++l)
{
this.dropItem(j, 1);
}
}
}*/
protected void updateEntityActionState ()
{
this.despawnEntity();
EntityPlayer entityplayer = this.worldObj.getClosestVulnerablePlayerToEntity(this, 16.0D);
if (entityplayer != null)
{
this.faceEntity(entityplayer, 10.0F, 20.0F);
}
else if (this.onGround && this.slimeJumpDelay == 1)
{
this.rotationYaw = this.rotationYaw + rand.nextFloat() * 180 - 90;
if (rotationYaw > 360)
rotationYaw -= 360;
if (rotationYaw < 0)
rotationYaw += 360;
}
if (this.onGround && this.slimeJumpDelay-- <= 0)
{
this.slimeJumpDelay = this.getJumpDelay();
if (entityplayer != null)
{
this.slimeJumpDelay /= 3;
}
this.isJumping = true;
if (this.makesSoundOnJump())
{
this.playSound(this.getJumpSound(), this.getSoundVolume(), ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F) * 0.8F);
}
this.moveStrafing = 1.0F - this.rand.nextFloat() * 2.0F;
this.moveForward = (float) (1 * this.getSlimeSize());
}
else
{
this.isJumping = false;
if (this.onGround)
{
this.moveStrafing = this.moveForward = 0.0F;
}
}
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 724 B