diff --git a/build.gradle b/build.gradle index 627f109c..1254f5fa 100644 --- a/build.gradle +++ b/build.gradle @@ -11,7 +11,7 @@ apply plugin: 'net.minecraftforge.gradle.forge' //Only edit below this line, the above code adds and enables the nessasary things for Forge to be setup. -version = "1.10.2-1.0" +version = "1.10.2-1.1" group = "twopiradians.minewatch" // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = "Minewatch" diff --git a/src/main/java/twopiradians/minewatch/client/ClientProxy.java b/src/main/java/twopiradians/minewatch/client/ClientProxy.java index 5fe9cec2..baa799a0 100644 --- a/src/main/java/twopiradians/minewatch/client/ClientProxy.java +++ b/src/main/java/twopiradians/minewatch/client/ClientProxy.java @@ -17,10 +17,12 @@ import twopiradians.minewatch.client.key.KeyToggleMode; import twopiradians.minewatch.client.particle.ParticleHealthPlus; import twopiradians.minewatch.client.render.entity.RenderAnaBullet; +import twopiradians.minewatch.client.render.entity.RenderGenjiShuriken; import twopiradians.minewatch.client.render.entity.RenderReaperBullet; import twopiradians.minewatch.common.CommonProxy; import twopiradians.minewatch.common.Minewatch; import twopiradians.minewatch.common.entity.EntityAnaBullet; +import twopiradians.minewatch.common.entity.EntityGenjiShuriken; import twopiradians.minewatch.common.entity.EntityHanzoArrow; import twopiradians.minewatch.common.entity.EntityReaperBullet; import twopiradians.minewatch.common.item.ModItems; @@ -46,24 +48,25 @@ public void init(FMLInitializationEvent event) { public void postInit(FMLPostInitializationEvent event) { super.postInit(event); } - + private void registerEntityRenders() { RenderingRegistry.registerEntityRenderingHandler(EntityReaperBullet.class, RenderReaperBullet::new); RenderingRegistry.registerEntityRenderingHandler(EntityHanzoArrow.class, RenderTippedArrow::new); RenderingRegistry.registerEntityRenderingHandler(EntityAnaBullet.class, RenderAnaBullet::new); + RenderingRegistry.registerEntityRenderingHandler(EntityGenjiShuriken.class, RenderGenjiShuriken::new); } - + @Override protected void registerEventListeners() { super.registerEventListeners(); MinecraftForge.EVENT_BUS.register(this); } - + @SubscribeEvent public void stitcherEventPre(TextureStitchEvent.Pre event) { event.getMap().registerSprite(ParticleHealthPlus.TEXTURE); } - + @Override public void spawnParticlesHealthPlus(World worldIn, double x, double y, double z, double motionX, double motionY, double motionZ, float scale) { ParticleHealthPlus particle = new ParticleHealthPlus(worldIn, x, y, z, motionX, motionY, motionZ, scale); diff --git a/src/main/java/twopiradians/minewatch/client/render/entity/RenderGenjiShuriken.java b/src/main/java/twopiradians/minewatch/client/render/entity/RenderGenjiShuriken.java new file mode 100644 index 00000000..8875877a --- /dev/null +++ b/src/main/java/twopiradians/minewatch/client/render/entity/RenderGenjiShuriken.java @@ -0,0 +1,46 @@ +package twopiradians.minewatch.client.render.entity; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.RenderItem; +import net.minecraft.client.renderer.block.model.ItemCameraTransforms; +import net.minecraft.client.renderer.entity.Render; +import net.minecraft.client.renderer.entity.RenderManager; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; +import twopiradians.minewatch.common.Minewatch; +import twopiradians.minewatch.common.entity.EntityGenjiShuriken; +import twopiradians.minewatch.common.item.ModItems; + +public class RenderGenjiShuriken extends Render +{ + private final RenderItem itemRenderer; + + public RenderGenjiShuriken(RenderManager renderManager) { + super(renderManager); + this.itemRenderer = Minecraft.getMinecraft().getRenderItem(); + } + + public ItemStack getStackToRender(EntityGenjiShuriken entityIn) { + return new ItemStack(ModItems.genji_shuriken); + } + + protected ResourceLocation getEntityTexture(EntityGenjiShuriken entity) { + return new ResourceLocation(Minewatch.MODID, "textures/entity/genji_shuriken.png"); + } + + @Override + public void doRender(EntityGenjiShuriken entity, double x, double y, double z, float entityYaw, float partialTicks) { + GlStateManager.pushMatrix(); + GlStateManager.translate((float)x, (float)y+.05f, (float)z); + GlStateManager.enableRescaleNormal(); + GlStateManager.scale(0.5d, 0.5d, 0.5d); + GlStateManager.rotate(entity.ticksExisted*60, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(90, 1, 0, 0); + + this.itemRenderer.renderItem(this.getStackToRender(entity), ItemCameraTransforms.TransformType.GROUND); + + GlStateManager.disableRescaleNormal(); + GlStateManager.popMatrix(); + } +} \ No newline at end of file diff --git a/src/main/java/twopiradians/minewatch/common/CommonProxy.java b/src/main/java/twopiradians/minewatch/common/CommonProxy.java index 96a516c6..ddb8383d 100644 --- a/src/main/java/twopiradians/minewatch/common/CommonProxy.java +++ b/src/main/java/twopiradians/minewatch/common/CommonProxy.java @@ -47,7 +47,7 @@ protected void registerEventListeners() { MinecraftForge.EVENT_BUS.register(new ModTokens()); MinecraftForge.EVENT_BUS.register(new ModWeapon()); } - + private void registerCraftingRecipes() { RecipeSorter.register("Matching Damage Recipe", ShapelessMatchingDamageRecipe.class, Category.SHAPELESS, ""); @@ -57,7 +57,7 @@ private void registerCraftingRecipes() { GameRegistry.addRecipe(new ShapelessMatchingDamageRecipe(new ItemStack(ModItems.ana_leggings), new ItemStack(ModItems.ana_token), new ItemStack(Items.IRON_LEGGINGS, 1, OreDictionary.WILDCARD_VALUE))); GameRegistry.addRecipe(new ShapelessMatchingDamageRecipe(new ItemStack(ModItems.ana_boots), new ItemStack(ModItems.ana_token), new ItemStack(Items.IRON_BOOTS, 1, OreDictionary.WILDCARD_VALUE))); GameRegistry.addShapelessRecipe(new ItemStack(ModItems.ana_rifle), new ItemStack(ModItems.ana_token)); - + //Hanzo GameRegistry.addRecipe(new ShapelessMatchingDamageRecipe(new ItemStack(ModItems.hanzo_helmet), new ItemStack(ModItems.hanzo_token), new ItemStack(Items.IRON_HELMET, 1, OreDictionary.WILDCARD_VALUE))); GameRegistry.addRecipe(new ShapelessMatchingDamageRecipe(new ItemStack(ModItems.hanzo_chestplate), new ItemStack(ModItems.hanzo_token), new ItemStack(Items.IRON_CHESTPLATE, 1, OreDictionary.WILDCARD_VALUE))); @@ -78,5 +78,12 @@ private void registerCraftingRecipes() { GameRegistry.addRecipe(new ShapelessMatchingDamageRecipe(new ItemStack(ModItems.reinhardt_leggings), new ItemStack(ModItems.reinhardt_token), new ItemStack(Items.IRON_LEGGINGS, 1, OreDictionary.WILDCARD_VALUE))); GameRegistry.addRecipe(new ShapelessMatchingDamageRecipe(new ItemStack(ModItems.reinhardt_boots), new ItemStack(ModItems.reinhardt_token), new ItemStack(Items.IRON_BOOTS, 1, OreDictionary.WILDCARD_VALUE))); GameRegistry.addShapelessRecipe(new ItemStack(ModItems.reinhardt_hammer), new ItemStack(ModItems.reinhardt_token)); + + //Genji + GameRegistry.addRecipe(new ShapelessMatchingDamageRecipe(new ItemStack(ModItems.genji_helmet), new ItemStack(ModItems.genji_token), new ItemStack(Items.IRON_HELMET, 1, OreDictionary.WILDCARD_VALUE))); + GameRegistry.addRecipe(new ShapelessMatchingDamageRecipe(new ItemStack(ModItems.genji_chestplate), new ItemStack(ModItems.genji_token), new ItemStack(Items.IRON_CHESTPLATE, 1, OreDictionary.WILDCARD_VALUE))); + GameRegistry.addRecipe(new ShapelessMatchingDamageRecipe(new ItemStack(ModItems.genji_leggings), new ItemStack(ModItems.genji_token), new ItemStack(Items.IRON_LEGGINGS, 1, OreDictionary.WILDCARD_VALUE))); + GameRegistry.addRecipe(new ShapelessMatchingDamageRecipe(new ItemStack(ModItems.genji_boots), new ItemStack(ModItems.genji_token), new ItemStack(Items.IRON_BOOTS, 1, OreDictionary.WILDCARD_VALUE))); + GameRegistry.addShapelessRecipe(new ItemStack(ModItems.genji_shuriken), new ItemStack(ModItems.genji_token)); } } diff --git a/src/main/java/twopiradians/minewatch/common/Minewatch.java b/src/main/java/twopiradians/minewatch/common/Minewatch.java index 5c4fc195..016a5262 100644 --- a/src/main/java/twopiradians/minewatch/common/Minewatch.java +++ b/src/main/java/twopiradians/minewatch/common/Minewatch.java @@ -16,7 +16,7 @@ public class Minewatch { public static final String MODNAME = "Minewatch"; public static final String MODID = "minewatch"; - public static final String VERSION = "1.0"; + public static final String VERSION = "1.1"; @Mod.Instance(MODID) public static Minewatch instance; public static MinewatchTab tab = new MinewatchTab("tabMinewatch"); diff --git a/src/main/java/twopiradians/minewatch/common/entity/EntityAnaBullet.java b/src/main/java/twopiradians/minewatch/common/entity/EntityAnaBullet.java index d9f56aa0..5ef169db 100644 --- a/src/main/java/twopiradians/minewatch/common/entity/EntityAnaBullet.java +++ b/src/main/java/twopiradians/minewatch/common/entity/EntityAnaBullet.java @@ -1,5 +1,8 @@ package twopiradians.minewatch.common.entity; +import java.util.Arrays; + +import net.minecraft.block.Block; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; @@ -30,7 +33,7 @@ public EntityAnaBullet(World worldIn, EntityLivingBase throwerIn, boolean heal) super(worldIn, throwerIn); this.setNoGravity(true); this.setSize(0.1f, 0.1f); - this.setPosition(throwerIn.posX, throwerIn.posY + (double)throwerIn.getEyeHeight() - 0.1D, throwerIn.posZ); + this.setPosition(throwerIn.posX, throwerIn.posY + (double)throwerIn.getEyeHeight(), throwerIn.posZ); this.heal = heal; } @@ -66,7 +69,7 @@ public void onUpdate() { @Override protected void onImpact(RayTraceResult result) { - if (result.entityHit instanceof EntityLivingBase && result.entityHit != this.getThrower()) { + if (result.entityHit instanceof EntityLivingBase && this.getThrower() != null && result.entityHit != this.getThrower()) { if (this.heal) { ((EntityLivingBase)result.entityHit).heal(75/ModWeapon.DAMAGE_SCALE); ((WorldServer)result.entityHit.worldObj).spawnParticle(EnumParticleTypes.HEART, @@ -78,7 +81,7 @@ protected void onImpact(RayTraceResult result) { } else { if (this.getThrower() instanceof EntityPlayer) - ((EntityLivingBase)result.entityHit).attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer) this.getThrower()), 60F/ModWeapon.DAMAGE_SCALE); + ((EntityLivingBase)result.entityHit).attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer) this.getThrower()), 60F/ModWeapon.DAMAGE_SCALE); else if (this.getThrower() instanceof EntityPlayer) ((EntityLivingBase)result.entityHit).attackEntityFrom(DamageSource.causeThrownDamage(this, getThrower()), 60F/ModWeapon.DAMAGE_SCALE); @@ -88,7 +91,11 @@ protected void onImpact(RayTraceResult result) { } this.setDead(); } - else if (result.typeOfHit == RayTraceResult.Type.BLOCK) - this.setDead(); + else if (result.typeOfHit == RayTraceResult.Type.BLOCK) { + Block block = this.worldObj.getBlockState(result.getBlockPos()).getBlock(); + + if (!Arrays.asList(ModEntities.ENTITY_PASSES_THROUGH).contains(block)) + this.setDead(); + } } } diff --git a/src/main/java/twopiradians/minewatch/common/entity/EntityGenjiShuriken.java b/src/main/java/twopiradians/minewatch/common/entity/EntityGenjiShuriken.java new file mode 100644 index 00000000..02f77514 --- /dev/null +++ b/src/main/java/twopiradians/minewatch/common/entity/EntityGenjiShuriken.java @@ -0,0 +1,87 @@ +package twopiradians.minewatch.common.entity; + +import java.util.Arrays; + +import net.minecraft.block.Block; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.projectile.EntityThrowable; +import net.minecraft.init.SoundEvents; +import net.minecraft.util.DamageSource; +import net.minecraft.util.SoundCategory; +import net.minecraft.util.math.MathHelper; +import net.minecraft.util.math.RayTraceResult; +import net.minecraft.world.World; +import twopiradians.minewatch.common.item.weapon.ModWeapon; + +public class EntityGenjiShuriken extends EntityThrowable +{ + private static final int LIFETIME = 40; + + public EntityGenjiShuriken(World worldIn) { + super(worldIn); + this.setNoGravity(true); + this.setSize(0.1f, 0.1f); + } + + //Client doesn't read here + public EntityGenjiShuriken(World worldIn, EntityLivingBase throwerIn) { + super(worldIn, throwerIn); + this.setNoGravity(true); + this.setSize(0.1f, 0.1f); + this.setPosition(throwerIn.posX, throwerIn.posY + (double)throwerIn.getEyeHeight(), throwerIn.posZ); + } + + /**Copied from EntityArrow*/ + public void setAim(Entity shooter, float pitch, float yaw, float velocity, float inaccuracy) { + float f = -MathHelper.sin(yaw * (float)Math.PI/180) * MathHelper.cos(pitch * (float)Math.PI/180); + float f1 = -MathHelper.sin(pitch * (float)Math.PI/180); + float f2 = MathHelper.cos(yaw * (float)Math.PI/180) * MathHelper.cos(pitch * (float)Math.PI/180); + this.setThrowableHeading((double)f, (double)f1, (double)f2, velocity, inaccuracy); + this.motionX += shooter.motionX; + this.motionZ += shooter.motionZ; + this.prevRotationPitch = pitch; + this.prevRotationYaw = yaw; + this.setRotation(yaw, pitch); + + if (!shooter.onGround) { + this.motionY += shooter.motionY; + } + } + + @Override + public void onUpdate() { + float f = MathHelper.sqrt_float((float) (this.motionX * this.motionX + this.motionZ * this.motionZ)); + this.rotationYaw = (float)(MathHelper.atan2(this.motionX, this.motionZ) * (180D / Math.PI)); + this.rotationPitch = (float)(MathHelper.atan2(this.motionY, (double)f) * (180D / Math.PI)); + this.prevRotationYaw = this.rotationYaw; + this.prevRotationPitch = this.rotationPitch; + super.onUpdate(); + + if (this.ticksExisted > LIFETIME) + this.setDead(); + } + + @Override + protected void onImpact(RayTraceResult result) { + if (result.entityHit instanceof EntityLivingBase && this.getThrower() != null && result.entityHit != this.getThrower()) { + if (this.getThrower() instanceof EntityPlayer) + ((EntityLivingBase)result.entityHit).attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer) this.getThrower()), 28F/ModWeapon.DAMAGE_SCALE); + else + if (this.getThrower() instanceof EntityPlayer) + ((EntityLivingBase)result.entityHit).attackEntityFrom(DamageSource.causeThrownDamage(this, getThrower()), 28F/ModWeapon.DAMAGE_SCALE); + if (this.getThrower() != null) + result.entityHit.worldObj.playSound(null, this.getThrower().posX, this.getThrower().posY, this.getThrower().posZ, + SoundEvents.ENTITY_ARROW_HIT_PLAYER, SoundCategory.PLAYERS, 0.3f, result.entityHit.worldObj.rand.nextFloat()/2+0.75f); + ((EntityLivingBase)result.entityHit).hurtResistantTime = 0; + this.setDead(); + } + else if (result.typeOfHit == RayTraceResult.Type.BLOCK) { + Block block = this.worldObj.getBlockState(result.getBlockPos()).getBlock(); + + if (!Arrays.asList(ModEntities.ENTITY_PASSES_THROUGH).contains(block)) + this.setDead(); + } + } +} diff --git a/src/main/java/twopiradians/minewatch/common/entity/EntityReaperBullet.java b/src/main/java/twopiradians/minewatch/common/entity/EntityReaperBullet.java index 0090c80b..33b29d02 100644 --- a/src/main/java/twopiradians/minewatch/common/entity/EntityReaperBullet.java +++ b/src/main/java/twopiradians/minewatch/common/entity/EntityReaperBullet.java @@ -1,5 +1,8 @@ package twopiradians.minewatch.common.entity; +import java.util.Arrays; + +import net.minecraft.block.Block; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.projectile.EntityThrowable; @@ -29,7 +32,7 @@ public EntityReaperBullet(World worldIn, EntityLivingBase throwerIn) { double velY = - Math.sin(throwerIn.rotationPitch*Math.PI/180) + (Math.random() - 0.5d)*0.2d; double velZ = Math.cos(throwerIn.rotationPitch*Math.PI/180) * Math.sin(throwerIn.rotationYawHead*Math.PI/180 + Math.PI/2) + (Math.random() - 0.5d)*0.2d; double x = throwerIn.posX + Math.cos(throwerIn.rotationPitch*Math.PI/180)*Math.cos(throwerIn.rotationYawHead*Math.PI/180 + Math.PI/2); - double y = throwerIn.posY + 1.5d - Math.sin(throwerIn.rotationPitch*Math.PI/180); + double y = throwerIn.posY + throwerIn.getEyeHeight() - Math.sin(throwerIn.rotationPitch*Math.PI/180); double z = throwerIn.posZ + Math.cos(throwerIn.rotationPitch*Math.PI/180)*Math.sin(throwerIn.rotationYawHead*Math.PI/180 + Math.PI/2); this.setPosition(x, y, z); this.setRotation(0, 0); @@ -62,7 +65,7 @@ public void onUpdate() { protected void onImpact(RayTraceResult result) { if (result.entityHit != null && result.entityHit == this.getThrower()) return; - else if (result.entityHit instanceof EntityLivingBase) { + else if (result.entityHit instanceof EntityLivingBase && this.getThrower() != null) { float damage = 7 - (7 - 2) * (this.ticksExisted / LIFETIME); if (this.getThrower() instanceof EntityPlayer) ((EntityLivingBase)result.entityHit).attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer) this.getThrower()), damage/ModWeapon.DAMAGE_SCALE); @@ -71,7 +74,11 @@ else if (result.entityHit instanceof EntityLivingBase) { ((EntityLivingBase)result.entityHit).hurtResistantTime = 0; this.setDead(); } - else if (result.typeOfHit == RayTraceResult.Type.BLOCK) - this.setDead(); + else if (result.typeOfHit == RayTraceResult.Type.BLOCK) { + Block block = this.worldObj.getBlockState(result.getBlockPos()).getBlock(); + + if (!Arrays.asList(ModEntities.ENTITY_PASSES_THROUGH).contains(block)) + this.setDead(); + } } } diff --git a/src/main/java/twopiradians/minewatch/common/entity/ModEntities.java b/src/main/java/twopiradians/minewatch/common/entity/ModEntities.java index c26a7d50..8cf1a219 100644 --- a/src/main/java/twopiradians/minewatch/common/entity/ModEntities.java +++ b/src/main/java/twopiradians/minewatch/common/entity/ModEntities.java @@ -1,14 +1,22 @@ package twopiradians.minewatch.common.entity; +import net.minecraft.block.Block; +import net.minecraft.init.Blocks; import net.minecraftforge.fml.common.registry.EntityRegistry; import twopiradians.minewatch.common.Minewatch; public class ModEntities { + public static final Block[] ENTITY_PASSES_THROUGH = + {Blocks.TALLGRASS, Blocks.VINE, Blocks.RED_FLOWER, Blocks.YELLOW_FLOWER, Blocks.BROWN_MUSHROOM, + Blocks.RED_MUSHROOM, Blocks.REEDS, Blocks.DOUBLE_PLANT, Blocks.DEADBUSH, Blocks.WHEAT, + Blocks.WATERLILY, Blocks.CARROTS, Blocks.POTATOES, Blocks.SNOW_LAYER}; + public static void registerEntities() { int id = 0; EntityRegistry.registerModEntity(EntityReaperBullet.class, "reaper_pellet", id++, Minewatch.instance, 16, 1, true); EntityRegistry.registerModEntity(EntityHanzoArrow.class, "hanzo_arrow", id++, Minewatch.instance, 16, 1, true); EntityRegistry.registerModEntity(EntityAnaBullet.class, "ana_bullet", id++, Minewatch.instance, 32, 1, true); + EntityRegistry.registerModEntity(EntityGenjiShuriken.class, "genji_shuriken", id++, Minewatch.instance, 32, 1, true); } } diff --git a/src/main/java/twopiradians/minewatch/common/item/ModItems.java b/src/main/java/twopiradians/minewatch/common/item/ModItems.java index 4a0e8374..f93b5de4 100644 --- a/src/main/java/twopiradians/minewatch/common/item/ModItems.java +++ b/src/main/java/twopiradians/minewatch/common/item/ModItems.java @@ -12,10 +12,12 @@ import net.minecraftforge.fml.common.registry.GameRegistry; import twopiradians.minewatch.common.Minewatch; import twopiradians.minewatch.common.item.armor.ItemAnaArmor; +import twopiradians.minewatch.common.item.armor.ItemGenjiArmor; import twopiradians.minewatch.common.item.armor.ItemHanzoArmor; import twopiradians.minewatch.common.item.armor.ItemReaperArmor; import twopiradians.minewatch.common.item.armor.ItemReinhardtArmor; import twopiradians.minewatch.common.item.weapon.ItemAnaRifle; +import twopiradians.minewatch.common.item.weapon.ItemGenjiShuriken; import twopiradians.minewatch.common.item.weapon.ItemHanzoBow; import twopiradians.minewatch.common.item.weapon.ItemReaperShotgun; import twopiradians.minewatch.common.item.weapon.ItemReinhardtHammer; @@ -57,6 +59,14 @@ public class ModItems public static Item ana_rifle; public static Item ana_token; + public static ArmorMaterial genji = EnumHelper.addArmorMaterial("genji", "minewatch:genji", 20, new int[] {2,3,3,2}, 0, SoundEvents.ITEM_ARMOR_EQUIP_GENERIC, 0); + public static Item genji_helmet; + public static Item genji_chestplate; + public static Item genji_leggings; + public static Item genji_boots; + public static Item genji_shuriken; + public static Item genji_token; + public static void preInit () { reaper_helmet = registerItem(new ItemReaperArmor(reaper, 0, EntityEquipmentSlot.HEAD), "reaper_helmet"); reaper_chestplate = registerItem(new ItemReaperArmor(reaper, 0, EntityEquipmentSlot.CHEST), "reaper_chestplate"); @@ -85,6 +95,13 @@ public static void preInit () { ana_boots = registerItem(new ItemAnaArmor(ana, 0, EntityEquipmentSlot.FEET), "ana_boots"); ana_rifle = registerItem(new ItemAnaRifle(), "ana_rifle"); ana_token = registerItem(new ModTokens.ItemAnaToken(), "ana_token"); + + genji_helmet = registerItem(new ItemGenjiArmor(genji, 0, EntityEquipmentSlot.HEAD), "genji_helmet"); + genji_chestplate = registerItem(new ItemGenjiArmor(genji, 0, EntityEquipmentSlot.CHEST), "genji_chestplate"); + genji_leggings = registerItem(new ItemGenjiArmor(genji, 0, EntityEquipmentSlot.LEGS), "genji_leggings"); + genji_boots = registerItem(new ItemGenjiArmor(genji, 0, EntityEquipmentSlot.FEET), "genji_boots"); + genji_shuriken = registerItem(new ItemGenjiShuriken(), "genji_shuriken"); + genji_token = registerItem(new ModTokens.ItemGenjiToken(), "genji_token"); } private static Item registerItem(Item item, String unlocalizedName) { diff --git a/src/main/java/twopiradians/minewatch/common/item/ModTokens.java b/src/main/java/twopiradians/minewatch/common/item/ModTokens.java index b587cc2d..1aa68632 100644 --- a/src/main/java/twopiradians/minewatch/common/item/ModTokens.java +++ b/src/main/java/twopiradians/minewatch/common/item/ModTokens.java @@ -13,7 +13,7 @@ public class ModTokens extends Item public void onEvent(LivingDropsEvent event) { if (!event.getEntityLiving().worldObj.isRemote && event.getEntityLiving() instanceof EntityLiving && event.getEntityLiving().getEntityWorld().rand.nextDouble() < 0.01d * (1+event.getLootingLevel())) { - int i = event.getEntityLiving().worldObj.rand.nextInt(4); + int i = event.getEntityLiving().worldObj.rand.nextInt(ModItems.tokens.size()); ItemStack stack = new ItemStack(ModItems.tokens.get(i)); EntityItem drop = new EntityItem(event.getEntityLiving().worldObj, event.getEntityLiving().posX, event.getEntityLiving().posY, event.getEntityLiving().posZ, stack); @@ -28,4 +28,6 @@ public static class ItemReinhardtToken extends ModTokens {} public static class ItemAnaToken extends ModTokens {} public static class ItemHanzoToken extends ModTokens {} + + public static class ItemGenjiToken extends ModTokens {} } diff --git a/src/main/java/twopiradians/minewatch/common/item/armor/ItemGenjiArmor.java b/src/main/java/twopiradians/minewatch/common/item/armor/ItemGenjiArmor.java new file mode 100644 index 00000000..539fd8ab --- /dev/null +++ b/src/main/java/twopiradians/minewatch/common/item/armor/ItemGenjiArmor.java @@ -0,0 +1,10 @@ +package twopiradians.minewatch.common.item.armor; + +import net.minecraft.inventory.EntityEquipmentSlot; + +public class ItemGenjiArmor extends ModArmor +{ + public ItemGenjiArmor(ArmorMaterial materialIn, int renderIndexIn, EntityEquipmentSlot equipmentSlotIn) { + super(materialIn, renderIndexIn, equipmentSlotIn); + } +} diff --git a/src/main/java/twopiradians/minewatch/common/item/weapon/ItemGenjiShuriken.java b/src/main/java/twopiradians/minewatch/common/item/weapon/ItemGenjiShuriken.java new file mode 100644 index 00000000..b18e1bd3 --- /dev/null +++ b/src/main/java/twopiradians/minewatch/common/item/weapon/ItemGenjiShuriken.java @@ -0,0 +1,50 @@ +package twopiradians.minewatch.common.item.weapon; + +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumHand; +import net.minecraft.util.SoundCategory; +import net.minecraft.world.World; +import twopiradians.minewatch.common.entity.EntityGenjiShuriken; +import twopiradians.minewatch.common.item.ModItems; +import twopiradians.minewatch.common.sound.ModSoundEvents; + +public class ItemGenjiShuriken extends ModWeapon +{ + int multiShot = 0; + + public ItemGenjiShuriken() { + super(); + this.setMaxDamage(100); + this.hasOffhand = true; + this.material = ModItems.genji; + this.cooldown = 20; + } + + @Override + public void onShoot(World worldIn, EntityPlayer playerIn, EnumHand hand) { + if (!playerIn.worldObj.isRemote) { + for (int i = 0; i < 3; i++) { + EntityGenjiShuriken shuriken = new EntityGenjiShuriken(playerIn.worldObj, playerIn); + shuriken.setAim(playerIn, playerIn.rotationPitch, playerIn.rotationYaw + (1 - i)*15, 3F, 1.0F); + playerIn.worldObj.spawnEntityInWorld(shuriken); + } + playerIn.worldObj.playSound(null, playerIn.posX, playerIn.posY, playerIn.posZ, + ModSoundEvents.genjiShuriken, SoundCategory.PLAYERS, 1.0f, playerIn.worldObj.rand.nextFloat()/2+0.75f); + } + } + + @Override + public void onUsingTick(ItemStack stack, EntityLivingBase player, int count) { + if (!player.worldObj.isRemote && count < 4) { + EntityGenjiShuriken shuriken = new EntityGenjiShuriken(player.worldObj, player); + shuriken.setAim(player, player.rotationPitch, player.rotationYaw, 3F, 1.0F); + player.worldObj.spawnEntityInWorld(shuriken); + player.worldObj.playSound(null, player.posX, player.posY, player.posZ, + ModSoundEvents.genjiShuriken, SoundCategory.PLAYERS, 1.0f, player.worldObj.rand.nextFloat()/2+0.75f); + } + else if (count > 2) + this.multiShot = 0; + } +} diff --git a/src/main/java/twopiradians/minewatch/common/item/weapon/ItemHanzoBow.java b/src/main/java/twopiradians/minewatch/common/item/weapon/ItemHanzoBow.java index 74f5073f..c3c032b2 100644 --- a/src/main/java/twopiradians/minewatch/common/item/weapon/ItemHanzoBow.java +++ b/src/main/java/twopiradians/minewatch/common/item/weapon/ItemHanzoBow.java @@ -141,4 +141,4 @@ public ActionResult onItemRightClick(ItemStack itemStackIn, World wor return new ActionResult(EnumActionResult.SUCCESS, itemstack); } } -} +} \ No newline at end of file diff --git a/src/main/java/twopiradians/minewatch/common/item/weapon/ItemReaperShotgun.java b/src/main/java/twopiradians/minewatch/common/item/weapon/ItemReaperShotgun.java index e2623893..82005f87 100644 --- a/src/main/java/twopiradians/minewatch/common/item/weapon/ItemReaperShotgun.java +++ b/src/main/java/twopiradians/minewatch/common/item/weapon/ItemReaperShotgun.java @@ -20,9 +20,11 @@ public ItemReaperShotgun() { @Override public void onShoot(World worldIn, EntityPlayer playerIn, EnumHand hand) { - for (int i=0; i<20; i++) - worldIn.spawnEntityInWorld(new EntityReaperBullet(worldIn, playerIn)); - worldIn.playSound(null, playerIn.posX, playerIn.posY, playerIn.posZ, - ModSoundEvents.reaperShotgun, SoundCategory.PLAYERS, 1.0f, worldIn.rand.nextFloat()/2+0.75f); + if (!worldIn.isRemote) { + for (int i=0; i<20; i++) + worldIn.spawnEntityInWorld(new EntityReaperBullet(worldIn, playerIn)); + worldIn.playSound(null, playerIn.posX, playerIn.posY, playerIn.posZ, + ModSoundEvents.reaperShotgun, SoundCategory.PLAYERS, 1.0f, worldIn.rand.nextFloat()/2+0.75f); + } } } diff --git a/src/main/java/twopiradians/minewatch/common/item/weapon/ModWeapon.java b/src/main/java/twopiradians/minewatch/common/item/weapon/ModWeapon.java index 68361ef6..5de64e22 100644 --- a/src/main/java/twopiradians/minewatch/common/item/weapon/ModWeapon.java +++ b/src/main/java/twopiradians/minewatch/common/item/weapon/ModWeapon.java @@ -7,6 +7,7 @@ import net.minecraft.client.renderer.GlStateManager; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemArmor.ArmorMaterial; @@ -46,20 +47,29 @@ public class ModWeapon extends Item /**Called on server when right click is held and cooldown is not active*/ protected void onShoot(World worldIn, EntityPlayer playerIn, EnumHand hand) {} + + @Override + public void onUsingTick(ItemStack stack, EntityLivingBase player, int count) {} @Override - public ActionResult onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn, EnumHand hand) { + public ActionResult onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn, EnumHand hand) { // check that item does not have MC cooldown (and nbt cooldown if it hasOffhand) if (cooldown >= 0 && playerIn != null && playerIn.getHeldItem(hand) != null && !playerIn.getCooldownTracker().hasCooldown(playerIn.getHeldItem(hand).getItem()) && (!hasOffhand || (playerIn.getHeldItem(hand).hasTagCompound() && playerIn.getHeldItem(hand).getTagCompound().getInteger("cooldown") <= 0))) { + if (!worldIn.isRemote && playerIn.getHeldItem(hand).getItem() instanceof ItemGenjiShuriken && !Minewatch.keyMode.isKeyDown(playerIn)) { + ((ItemGenjiShuriken)playerIn.getHeldItem(hand).getItem()).onUsingTick(playerIn.getHeldItem(hand), playerIn, ++((ItemGenjiShuriken)playerIn.getHeldItem(hand).getItem()).multiShot); + if (((ItemGenjiShuriken)playerIn.getHeldItem(hand).getItem()).multiShot <= 2) + return new ActionResult(EnumActionResult.PASS, playerIn.getHeldItem(hand)); + } if (playerIn.getHeldItem(hand).getItem() instanceof ItemReinhardtHammer) return new ActionResult(EnumActionResult.PASS, playerIn.getHeldItem(hand)); if (!worldIn.isRemote) { - onShoot(worldIn, playerIn, hand); + if (!(playerIn.getHeldItem(hand).getItem() instanceof ItemGenjiShuriken && !Minewatch.keyMode.isKeyDown(playerIn))) + onShoot(worldIn, playerIn, hand); // set MC cooldown/2 and nbt cooldown if hasOffhand, otherwise just set MC cooldown - if (playerIn.getHeldItem(getInactiveHand(playerIn)) != null + if (playerIn.getHeldItem(getInactiveHand(playerIn)) != null && playerIn.getHeldItem(hand).getItem() != playerIn.getHeldItem(getInactiveHand(playerIn)).getItem()) playerIn.getCooldownTracker().setCooldown(playerIn.getHeldItem(getInactiveHand(playerIn)).getItem(), cooldown+1); if (hasOffhand) { @@ -137,8 +147,8 @@ public void onEvent(FOVModifier event) { if (event.getEntity() != null && event.getEntity() instanceof EntityPlayer && event.getEntity().isSneaking() && ((((EntityPlayer)event.getEntity()).getHeldItemMainhand() != null && ((EntityPlayer)event.getEntity()).getHeldItemMainhand().getItem() instanceof ItemAnaRifle) - || (((EntityPlayer)event.getEntity()).getHeldItemOffhand() != null - && ((EntityPlayer)event.getEntity()).getHeldItemOffhand().getItem() instanceof ItemAnaRifle))) { + || (((EntityPlayer)event.getEntity()).getHeldItemOffhand() != null + && ((EntityPlayer)event.getEntity()).getHeldItemOffhand().getItem() instanceof ItemAnaRifle))) { event.setFOV(20f); } } @@ -155,7 +165,7 @@ public void onEvent(PlayerInteractEvent.LeftClickEmpty event) { } } } - + /**Rendering the scopes for rifles*/ @SideOnly(Side.CLIENT) @SubscribeEvent @@ -186,4 +196,4 @@ else if (player != null && player.getHeldItemOffhand() != null && player.getHel GlStateManager.popMatrix(); } } -} +} \ No newline at end of file diff --git a/src/main/java/twopiradians/minewatch/common/sound/ModSoundEvents.java b/src/main/java/twopiradians/minewatch/common/sound/ModSoundEvents.java index 7e389cee..ac66c25c 100644 --- a/src/main/java/twopiradians/minewatch/common/sound/ModSoundEvents.java +++ b/src/main/java/twopiradians/minewatch/common/sound/ModSoundEvents.java @@ -11,12 +11,14 @@ public class ModSoundEvents { public static SoundEvent hanzoBowShoot; public static SoundEvent hanzoBowDraw; public static SoundEvent reinhardtRocketHammer; + public static SoundEvent genjiShuriken; public static void preInit() { reaperShotgun = registerSound("reaper_shotguns"); hanzoBowShoot = registerSound("hanzo_bow_shoot"); hanzoBowDraw = registerSound("hanzo_bow_draw"); reinhardtRocketHammer = registerSound("reinhardt_rocket_hammer"); + genjiShuriken = registerSound("genji_shuriken"); } private static SoundEvent registerSound(String soundName) { diff --git a/src/main/java/twopiradians/minewatch/creativetab/MinewatchTab.java b/src/main/java/twopiradians/minewatch/creativetab/MinewatchTab.java index 7f6202eb..48651b8f 100644 --- a/src/main/java/twopiradians/minewatch/creativetab/MinewatchTab.java +++ b/src/main/java/twopiradians/minewatch/creativetab/MinewatchTab.java @@ -14,5 +14,5 @@ public MinewatchTab(String label) { @Override public Item getTabIconItem() { return new ItemStack(ModItems.reaper_token).getItem(); - } +} } diff --git a/src/main/resources/assets/minewatch/lang/en_US.lang b/src/main/resources/assets/minewatch/lang/en_US.lang index c6af1b17..250a9f1c 100644 --- a/src/main/resources/assets/minewatch/lang/en_US.lang +++ b/src/main/resources/assets/minewatch/lang/en_US.lang @@ -28,6 +28,14 @@ item.ana_leggings.name=Ana Leggings item.ana_boots.name=Ana Boots item.ana_rifle.name=Ana's Biotic Rifle +item.genji_token.name=Genji Token +item.genji_helmet.name=Genji Helmet +item.genji_chestplate.name=Genji Chestplate +item.genji_leggings.name=Genji Leggings +item.genji_boots.name=Genji Boots +item.genji_shuriken.name=Genji's Shuriken + entity.hanzo_arrow.name=Hanzo Arrow entity.reaper_bullet.name=Reaper Bullet entity.ana_bullet.name=Ana Bullet +entity.genji_shuriken.name=Genji Shuriken diff --git a/src/main/resources/assets/minewatch/models/item/genji_boots.json b/src/main/resources/assets/minewatch/models/item/genji_boots.json new file mode 100644 index 00000000..e5271d27 --- /dev/null +++ b/src/main/resources/assets/minewatch/models/item/genji_boots.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "minewatch:items/genji_boots" + } +} diff --git a/src/main/resources/assets/minewatch/models/item/genji_chestplate.json b/src/main/resources/assets/minewatch/models/item/genji_chestplate.json new file mode 100644 index 00000000..76f12310 --- /dev/null +++ b/src/main/resources/assets/minewatch/models/item/genji_chestplate.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "minewatch:items/genji_chestplate" + } +} diff --git a/src/main/resources/assets/minewatch/models/item/genji_helmet.json b/src/main/resources/assets/minewatch/models/item/genji_helmet.json new file mode 100644 index 00000000..5f1f848e --- /dev/null +++ b/src/main/resources/assets/minewatch/models/item/genji_helmet.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "minewatch:items/genji_helmet" + } +} diff --git a/src/main/resources/assets/minewatch/models/item/genji_leggings.json b/src/main/resources/assets/minewatch/models/item/genji_leggings.json new file mode 100644 index 00000000..7b2c8c1a --- /dev/null +++ b/src/main/resources/assets/minewatch/models/item/genji_leggings.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "minewatch:items/genji_leggings" + } +} diff --git a/src/main/resources/assets/minewatch/models/item/genji_shuriken.json b/src/main/resources/assets/minewatch/models/item/genji_shuriken.json new file mode 100644 index 00000000..0cc05d8a --- /dev/null +++ b/src/main/resources/assets/minewatch/models/item/genji_shuriken.json @@ -0,0 +1,28 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "minewatch:items/genji_shuriken" + }, + "display": { + "thirdperson_righthand": { + "translation": [ 0, 2, 2 ], + "rotation": [ 15, -90, 0 ], + "scale": [ 0.5, 0.5, 0.5 ] + }, + "thirdperson_lefthand": { + "translation": [ 0, 2, 2 ], + "rotation": [ 15, 90, 0 ], + "scale": [ 0.5, 0.5, 0.5 ] + }, + "firstperson_righthand": { + "rotation": [ -45, -90, 0 ], + "translation": [ 1.13, 5.2, -1], + "scale": [ 0.75, 0.75, 0.75 ] + }, + "firstperson_lefthand": { + "rotation": [ 0, 90, -45 ], + "translation": [ 1.13, 5.2, -1], + "scale": [ 0.75, 0.75, 0.75 ] + } + } +} diff --git a/src/main/resources/assets/minewatch/models/item/genji_token.json b/src/main/resources/assets/minewatch/models/item/genji_token.json new file mode 100644 index 00000000..5b171d61 --- /dev/null +++ b/src/main/resources/assets/minewatch/models/item/genji_token.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "minewatch:items/genji_token" + } +} diff --git a/src/main/resources/assets/minewatch/sounds.json b/src/main/resources/assets/minewatch/sounds.json index 13cf3474..61f320d6 100644 --- a/src/main/resources/assets/minewatch/sounds.json +++ b/src/main/resources/assets/minewatch/sounds.json @@ -30,5 +30,13 @@ [ "minewatch:reinhardt_rocket_hammer" ] + }, + "genji_shuriken": + { + "category": "player", + "sounds": + [ + "minewatch:genji_shuriken" + ] } } \ No newline at end of file diff --git a/src/main/resources/assets/minewatch/sounds/genji_shuriken.ogg b/src/main/resources/assets/minewatch/sounds/genji_shuriken.ogg new file mode 100644 index 00000000..28c36afc Binary files /dev/null and b/src/main/resources/assets/minewatch/sounds/genji_shuriken.ogg differ diff --git a/src/main/resources/assets/minewatch/textures/entity/genji_shuriken.png b/src/main/resources/assets/minewatch/textures/entity/genji_shuriken.png new file mode 100644 index 00000000..64f36d8a Binary files /dev/null and b/src/main/resources/assets/minewatch/textures/entity/genji_shuriken.png differ diff --git a/src/main/resources/assets/minewatch/textures/items/genji_boots.png b/src/main/resources/assets/minewatch/textures/items/genji_boots.png new file mode 100644 index 00000000..465e21ea Binary files /dev/null and b/src/main/resources/assets/minewatch/textures/items/genji_boots.png differ diff --git a/src/main/resources/assets/minewatch/textures/items/genji_chestplate.png b/src/main/resources/assets/minewatch/textures/items/genji_chestplate.png new file mode 100644 index 00000000..815d81e4 Binary files /dev/null and b/src/main/resources/assets/minewatch/textures/items/genji_chestplate.png differ diff --git a/src/main/resources/assets/minewatch/textures/items/genji_helmet.png b/src/main/resources/assets/minewatch/textures/items/genji_helmet.png new file mode 100644 index 00000000..64544840 Binary files /dev/null and b/src/main/resources/assets/minewatch/textures/items/genji_helmet.png differ diff --git a/src/main/resources/assets/minewatch/textures/items/genji_leggings.png b/src/main/resources/assets/minewatch/textures/items/genji_leggings.png new file mode 100644 index 00000000..f47863b8 Binary files /dev/null and b/src/main/resources/assets/minewatch/textures/items/genji_leggings.png differ diff --git a/src/main/resources/assets/minewatch/textures/items/genji_shuriken.png b/src/main/resources/assets/minewatch/textures/items/genji_shuriken.png new file mode 100644 index 00000000..64f36d8a Binary files /dev/null and b/src/main/resources/assets/minewatch/textures/items/genji_shuriken.png differ diff --git a/src/main/resources/assets/minewatch/textures/items/genji_token.png b/src/main/resources/assets/minewatch/textures/items/genji_token.png new file mode 100644 index 00000000..0666d8cb Binary files /dev/null and b/src/main/resources/assets/minewatch/textures/items/genji_token.png differ diff --git a/src/main/resources/assets/minewatch/textures/items/reinhardt_helmet.png b/src/main/resources/assets/minewatch/textures/items/reinhardt_helmet.png index 915ac778..eb57b35a 100644 Binary files a/src/main/resources/assets/minewatch/textures/items/reinhardt_helmet.png and b/src/main/resources/assets/minewatch/textures/items/reinhardt_helmet.png differ diff --git a/src/main/resources/assets/minewatch/textures/models/armor/genji_layer_1.png b/src/main/resources/assets/minewatch/textures/models/armor/genji_layer_1.png new file mode 100644 index 00000000..41def2fe Binary files /dev/null and b/src/main/resources/assets/minewatch/textures/models/armor/genji_layer_1.png differ diff --git a/src/main/resources/assets/minewatch/textures/models/armor/genji_layer_2.png b/src/main/resources/assets/minewatch/textures/models/armor/genji_layer_2.png new file mode 100644 index 00000000..4e603f41 Binary files /dev/null and b/src/main/resources/assets/minewatch/textures/models/armor/genji_layer_2.png differ diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info index 1a785490..879a7a26 100644 --- a/src/main/resources/mcmod.info +++ b/src/main/resources/mcmod.info @@ -3,8 +3,8 @@ "modid": "minewatch", "name": "Minewatch", "description": "Overwatch characters in Minecraft.", - "version": "1.0", - "mcversion": "1.11.2", + "version": "1.1", + "mcversion": "1.10.2", "url": "", "updateUrl": "", "authorList": ["2piradians"],