Rename POTIONS to MOB_EFFECTS for newer forge versions
This commit is contained in:
@@ -48,77 +48,67 @@ public abstract class ComponentPotion implements IBuilderComponent
|
||||
|
||||
public void setAmplifier(MobEffect potion, byte amplifier)
|
||||
{
|
||||
this.getMetadata(potion).setAmplifier(amplifier);
|
||||
this.get(potion).setAmplifier(amplifier);
|
||||
}
|
||||
|
||||
public byte getAmplifier(MobEffect potion)
|
||||
{
|
||||
return this.getMetadata(potion).getAmplifier();
|
||||
return this.get(potion).getAmplifier();
|
||||
}
|
||||
|
||||
public void setSeconds(MobEffect potion, int seconds)
|
||||
{
|
||||
this.getMetadata(potion).setSeconds(seconds);
|
||||
this.get(potion).setSeconds(seconds);
|
||||
}
|
||||
|
||||
public int getSeconds(MobEffect potion)
|
||||
{
|
||||
return this.getMetadata(potion).getSeconds();
|
||||
return this.get(potion).getSeconds();
|
||||
}
|
||||
|
||||
public void setMinutes(MobEffect potion, int minutes)
|
||||
{
|
||||
this.getMetadata(potion).setMinutes(minutes);
|
||||
this.get(potion).setMinutes(minutes);
|
||||
}
|
||||
|
||||
public int getMinutes(MobEffect potion)
|
||||
{
|
||||
return this.getMetadata(potion).getMinutes();
|
||||
return this.get(potion).getMinutes();
|
||||
}
|
||||
|
||||
public void setHours(MobEffect potion, int hours)
|
||||
{
|
||||
this.getMetadata(potion).setHours(hours);
|
||||
this.get(potion).setHours(hours);
|
||||
}
|
||||
|
||||
public int getHours(MobEffect potion)
|
||||
{
|
||||
return this.getMetadata(potion).getHours();
|
||||
return this.get(potion).getHours();
|
||||
}
|
||||
|
||||
public void setShowParticles(MobEffect potion, boolean showParticles)
|
||||
{
|
||||
this.getMetadata(potion).setShowParticles(showParticles);
|
||||
this.get(potion).setShowParticles(showParticles);
|
||||
}
|
||||
|
||||
public boolean getShowParticles(MobEffect potion)
|
||||
{
|
||||
return this.getMetadata(potion).getShowParticles();
|
||||
return this.get(potion).getShowParticles();
|
||||
}
|
||||
|
||||
public void setAmbient(MobEffect potion, boolean ambient)
|
||||
{
|
||||
this.getMetadata(potion).setAmbient(ambient);
|
||||
this.get(potion).setAmbient(ambient);
|
||||
}
|
||||
|
||||
public boolean getAmbient(MobEffect potion)
|
||||
{
|
||||
return this.getMetadata(potion).getAmbient();
|
||||
return this.get(potion).getAmbient();
|
||||
}
|
||||
|
||||
private EffectNBT getMetadata(MobEffect potion)
|
||||
private EffectNBT get(MobEffect potion)
|
||||
{
|
||||
return this.potions.get(this.validate(potion));
|
||||
}
|
||||
|
||||
private MobEffect validate(MobEffect potion)
|
||||
{
|
||||
if(!this.potions.containsKey(potion))
|
||||
{
|
||||
this.potions.put(potion, new EffectNBT());
|
||||
}
|
||||
|
||||
return potion;
|
||||
return this.potions.computeIfAbsent(potion, key -> new EffectNBT());
|
||||
}
|
||||
|
||||
public Set<MobEffect> getMobEffects()
|
||||
|
||||
@@ -75,7 +75,7 @@ public class BuilderPotionEffect extends CommandBuilder
|
||||
|
||||
if(location != null)
|
||||
{
|
||||
return ForgeRegistries.POTIONS.getValue(location);
|
||||
return ForgeRegistries.MOB_EFFECTS.getValue(location);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
@@ -63,7 +63,7 @@ public class ContentPotions extends ContentChild
|
||||
@Override
|
||||
public void initGui(Container container, int x, int y)
|
||||
{
|
||||
MenuPageList<MobEffect> potions = new MenuPageList<MobEffect>(x, y, new ArrayList<MobEffect>(ForgeRegistries.POTIONS.getValues()), 114, 20, 3, container, new ILogicPageList<MobEffect>()
|
||||
MenuPageList<MobEffect> potions = new MenuPageList<MobEffect>(x, y, new ArrayList<MobEffect>(ForgeRegistries.MOB_EFFECTS.getValues()), 114, 20, 3, container, new ILogicPageList<MobEffect>()
|
||||
{
|
||||
@Override
|
||||
public MutableComponent translate(MobEffect item)
|
||||
|
||||
@@ -316,7 +316,7 @@ public class ContentSummon extends Content
|
||||
|
||||
for(ResourceLocation location : this.sortedPotions())
|
||||
{
|
||||
MobEffect potion = ForgeRegistries.POTIONS.getValue(location);
|
||||
MobEffect potion = ForgeRegistries.MOB_EFFECTS.getValue(location);
|
||||
|
||||
if(!potion.equals(MobEffects.HARM) && !potion.equals(MobEffects.HEAL))
|
||||
{
|
||||
@@ -325,7 +325,7 @@ public class ContentSummon extends Content
|
||||
button1.active = false;
|
||||
}
|
||||
|
||||
if(this.potionPage == ForgeRegistries.POTIONS.getKeys().size() - 3)
|
||||
if(this.potionPage == ForgeRegistries.MOB_EFFECTS.getKeys().size() - 3)
|
||||
{
|
||||
button2.active = false;
|
||||
}
|
||||
@@ -431,7 +431,7 @@ public class ContentSummon extends Content
|
||||
}
|
||||
else if(Page.POTIONS.equals(this.page))
|
||||
{
|
||||
Minecraft.getInstance().font.draw(matrix, (this.potionPage + 1) + "/" + (ForgeRegistries.POTIONS.getKeys().size() - 2), x + 118, y - 11, Config.getSkin().getHeadlineColor());
|
||||
Minecraft.getInstance().font.draw(matrix, (this.potionPage + 1) + "/" + (ForgeRegistries.MOB_EFFECTS.getKeys().size() - 2), x + 118, y - 11, Config.getSkin().getHeadlineColor());
|
||||
}
|
||||
else if(Page.EQUIPMENT.equals(this.page))
|
||||
{
|
||||
@@ -459,8 +459,8 @@ public class ContentSummon extends Content
|
||||
|
||||
private List<ResourceLocation> sortedPotions()
|
||||
{
|
||||
return ForgeRegistries.POTIONS.getKeys().stream()
|
||||
.sorted((a, b) -> I18n.get(ForgeRegistries.POTIONS.getValue(a).getDescriptionId()).compareTo(I18n.get(ForgeRegistries.POTIONS.getValue(b).getDescriptionId())))
|
||||
return ForgeRegistries.MOB_EFFECTS.getKeys().stream()
|
||||
.sorted((a, b) -> I18n.get(ForgeRegistries.MOB_EFFECTS.getValue(a).getDescriptionId()).compareTo(I18n.get(ForgeRegistries.MOB_EFFECTS.getValue(b).getDescriptionId())))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ public class RegistryHelper
|
||||
{
|
||||
registerRegistry(ForgeRegistries.BLOCKS, Block::getDescriptionId);
|
||||
registerRegistry(ForgeRegistries.ITEMS, Item::getDescriptionId);
|
||||
registerRegistry(ForgeRegistries.POTIONS, MobEffect::getDescriptionId);
|
||||
registerRegistry(ForgeRegistries.MOB_EFFECTS, MobEffect::getDescriptionId);
|
||||
registerRegistry(ForgeRegistries.BIOMES, biome ->
|
||||
{
|
||||
Registry<Biome> registry = RegistryAccess.builtin().registryOrThrow(Registry.BIOME_REGISTRY);
|
||||
|
||||
Reference in New Issue
Block a user