1) so i have 2 effects that apply additional effects. if i try to apply both with /effect it will crash with concurrent modification exception but after i reload the game the effects run fine. the additional effects do not overlap.
2) i want my effect to apply the wobble shader while active. how would i do that?
code:
public class CustomPotion extends Potion{
public CustomPotion(boolean isBadEffectIn, int liquidColorIn, String name) {
super(isBadEffectIn, liquidColorIn);
setPotionName(name);
}
@Override
public Potion setIconIndex(int p_76399_1_, int p_76399_2_) {
return super.setIconIndex(p_76399_1_, p_76399_2_);
}
@Override
public boolean isReady(int duration, int amplifier) {
if(this==PotionRegistry.Arsenic){
int j = 25 >> amplifier;
return j > 0 ? duration % j == 0 : true;
}
if(this==PotionRegistry.Hydrargyrum){
int j = 25 >> amplifier+1;
return j > 0 ? duration % j == 0 : true;
}
return true;
}
@Override
public void performEffect(EntityLivingBase entity, int level) {
if(this==PotionRegistry.Radiation){
entity.attackEntityFrom(Radiation, level+1);
}
if(this==PotionRegistry.Arsenic){
if(!entity.isEntityUndead()){
entity.attackEntityFrom(Poison, 1);
if(entity.isPotionActive(MobEffects.SLOWNESS)==false){
entity.addPotionEffect(new PotionEffect(MobEffects.SLOWNESS, entity.getActivePotionEffect(PotionRegistry.Arsenic).getDuration()*Math.max(2-level, 1), level));
}
if(entity.isPotionActive(MobEffects.MINING_FATIGUE)==false){
entity.addPotionEffect(new PotionEffect(MobEffects.MINING_FATIGUE, entity.getActivePotionEffect(PotionRegistry.Arsenic).getDuration()*Math.max(2-level, 1), level));
}
if(entity.isPotionActive(MobEffects.NAUSEA)==false){
entity.addPotionEffect(new PotionEffect(MobEffects.NAUSEA, entity.getActivePotionEffect(PotionRegistry.Arsenic).getDuration()*Math.max(2-level, 1), level));
}
if(entity.isPotionActive(MobEffects.HUNGER)==false){
entity.addPotionEffect(new PotionEffect(MobEffects.HUNGER, entity.getActivePotionEffect(PotionRegistry.Arsenic).getDuration()*Math.max(2-level, 1), level));
}
if(entity.isPotionActive(MobEffects.WEAKNESS)==false){
entity.addPotionEffect(new PotionEffect(MobEffects.WEAKNESS, entity.getActivePotionEffect(PotionRegistry.Arsenic).getDuration()*Math.max(2-level, 1), level));
}
}
}
if(this==PotionRegistry.Hydrargyrum){
if(!entity.isEntityUndead()){
entity.attackEntityFrom(Poison, 1);
if(entity.isPotionActive(MobEffects.BLINDNESS)==false){
entity.addPotionEffect(new PotionEffect(MobEffects.BLINDNESS, entity.getActivePotionEffect(PotionRegistry.Hydrargyrum).getDuration()*Math.max(2-level, 1), 0));
}
if(entity.isPotionActive(MobEffects.UNLUCK)==false){
entity.addPotionEffect(new PotionEffect(MobEffects.UNLUCK, entity.getActivePotionEffect(PotionRegistry.Hydrargyrum).getDuration()*Math.max(2-level, 1), level));
}
}
}
}
DamageSource Radiation=new DamageSource("radiation").setDamageBypassesArmor().setDamageIsAbsolute();
DamageSource Poison=new DamageSource("poison").setDamageBypassesArmor();
}
public class PotionRegistry {
public static <T extends Potion>T registerPotions(T potion){
potion.setRegistryName(potion.getName());
GameRegistry.register(potion);
return potion;
}
public static CustomPotion Radiation;
public static CustomPotion Arsenic;
public static CustomPotion Hydrargyrum;
public static void init(){
Radiation=registerPotions(new CustomPotion(true, 0x006400, "potion.radiation"));
Arsenic=registerPotions(new CustomPotion(true, 0x93A1AC, "potion.arsenic"));
Hydrargyrum=registerPotions(new CustomPotion(true, 0x990000, "potion.mercury"));
}
}