Added Deafness potion effect

This commit is contained in:
WayofTime 2016-08-10 17:38:37 -04:00
parent d3c6a474de
commit 253c26326f
3 changed files with 40 additions and 14 deletions

View file

@ -1,12 +1,11 @@
package WayofTime.bloodmagic.registry;
import WayofTime.bloodmagic.api.Constants;
import net.minecraft.potion.Potion;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.registry.GameRegistry;
import WayofTime.bloodmagic.api.util.helper.PlayerSacrificeHelper;
import WayofTime.bloodmagic.potion.PotionBloodMagic;
import WayofTime.bloodmagic.potion.PotionEventHandlers;
import net.minecraftforge.fml.common.registry.GameRegistry;
public class ModPotions
{
@ -20,6 +19,7 @@ public class ModPotions
public static Potion fireFuse;
public static Potion constrict;
public static Potion plantLeech;
public static Potion deafness;
public static void init()
{
@ -46,6 +46,7 @@ public class ModPotions
fireFuse = registerPotion("Fire Fuse", new ResourceLocation("fireFuse"), true, 0xFF3333, 5, 0);
constrict = registerPotion("Constriction", new ResourceLocation("constrict"), true, 0x000000, 6, 0);
plantLeech = registerPotion("Plant Leech", new ResourceLocation("plantLeech"), true, 0x000000, 7, 0);
deafness = registerPotion("Deaf", new ResourceLocation("deafness"), true, 0x000000, 0, 1);
// heavyHeart = new PotionBloodMagic("Heavy Heart", new
// ResourceLocation(resourceLocation +
// heavyHeart.getName().toLowerCase()), true, 0, 0, 0);

View file

@ -403,7 +403,7 @@ public class ModRecipes
addPotionRecipe(1000, 1, new ItemStack(Items.POISONOUS_POTATO), new PotionEffect(MobEffects.SATURATION, 1));
addPotionRecipe(1000, 1, new ItemStack(ModItems.bloodShard, 1, 0), new PotionEffect(MobEffects.HEALTH_BOOST, 2 * 60 * 20));
addPotionRecipe(1000, 1, new ItemStack(Items.BEETROOT), new PotionEffect(ModPotions.plantLeech, 1 * 60 * 20));
addPotionRecipe(1000, 1, new ItemStack(Items.BEETROOT), new PotionEffect(ModPotions.deafness, 450));
}
static ItemStack mundaneLengtheningStack = ItemComponent.getStack(ItemComponent.CATALYST_LENGTH_1);

View file

@ -1,14 +1,13 @@
package WayofTime.bloodmagic.util.handler.event;
import java.util.*;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.annotation.Nullable;
import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.ConfigHandler;
import WayofTime.bloodmagic.api.registry.RitualRegistry;
import com.google.common.base.Stopwatch;
import com.google.common.collect.SetMultimap;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.renderer.GlStateManager;
@ -24,7 +23,12 @@ import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.World;
import net.minecraftforge.client.event.*;
import net.minecraftforge.client.event.ModelBakeEvent;
import net.minecraftforge.client.event.MouseEvent;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.client.event.RenderWorldLastEvent;
import net.minecraftforge.client.event.TextureStitchEvent;
import net.minecraftforge.client.event.sound.PlaySoundEvent;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
import net.minecraftforge.fml.client.FMLClientHandler;
@ -37,8 +41,11 @@ import net.minecraftforge.fml.relauncher.SideOnly;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11;
import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.ConfigHandler;
import WayofTime.bloodmagic.annot.Handler;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.registry.RitualRegistry;
import WayofTime.bloodmagic.api.ritual.AreaDescriptor;
import WayofTime.bloodmagic.api.ritual.Ritual;
import WayofTime.bloodmagic.api.ritual.RitualComponent;
@ -49,11 +56,15 @@ import WayofTime.bloodmagic.item.ItemRitualReader;
import WayofTime.bloodmagic.item.sigil.ItemSigilHolding;
import WayofTime.bloodmagic.network.BloodMagicPacketHandler;
import WayofTime.bloodmagic.network.SigilHoldingPacketProcessor;
import WayofTime.bloodmagic.registry.ModPotions;
import WayofTime.bloodmagic.tile.TileMasterRitualStone;
import WayofTime.bloodmagic.util.GhostItemHelper;
import WayofTime.bloodmagic.util.handler.BMKeyBinding;
import WayofTime.bloodmagic.util.helper.TextHelper;
import com.google.common.base.Stopwatch;
import com.google.common.collect.SetMultimap;
@Handler
@SideOnly(Side.CLIENT)
public class ClientHandler
@ -110,6 +121,16 @@ public class ClientHandler
}
}
@SubscribeEvent
public void onSoundEvent(PlaySoundEvent event)
{
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
if (player != null && player.isPotionActive(ModPotions.deafness))
{
event.setResultSound(null);
}
}
@SubscribeEvent
public void onTextureStitch(TextureStitchEvent.Pre event)
{
@ -208,7 +229,8 @@ public class ClientHandler
// Stolen from Chisel
@SubscribeEvent
public void onModelBake(ModelBakeEvent event) {
public void onModelBake(ModelBakeEvent event)
{
if (BloodMagic.isDev() && SUPPRESS_ASSET_ERRORS)
return;
@ -244,7 +266,8 @@ public class ClientHandler
// For some reason, we need some bad textures to be listed in the Crystal and Node models. This will hide that from the end user.
@SubscribeEvent
public void onTextureStitch(TextureStitchEvent.Post event) {
public void onTextureStitch(TextureStitchEvent.Post event)
{
if (BloodMagic.isDev() && SUPPRESS_ASSET_ERRORS)
return;
@ -257,7 +280,8 @@ public class ClientHandler
Set<ResourceLocation> toRemove = new HashSet<ResourceLocation>();
// Find our missing textures and mark them for removal. Cannot directly remove as it would cause a CME
if (missingTextures.containsKey(mc)) {
if (missingTextures.containsKey(mc))
{
Set<ResourceLocation> missingMCTextures = missingTextures.get(mc);
for (ResourceLocation texture : missingMCTextures)
if (texture.getResourcePath().equalsIgnoreCase(String.format(format, "node")) || texture.getResourcePath().equalsIgnoreCase(String.format(format, "crystal")))
@ -268,7 +292,8 @@ public class ClientHandler
missingTextures.get(mc).removeAll(toRemove);
// Make sure to only remove the bad MC domain if no other textures are missing
if (missingTextures.get(mc).isEmpty()) {
if (missingTextures.get(mc).isEmpty())
{
missingTextures.keySet().remove(mc);
badTextureDomains.remove(mc);
}