Potion cleanup. Moar fixes!

This commit is contained in:
cpw 2016-03-08 23:49:19 -05:00
parent 56a0d125bd
commit c11732fc40
4 changed files with 38 additions and 86 deletions

View file

@ -1,6 +1,41 @@
--- ../src-base/minecraft/net/minecraft/potion/PotionEffect.java --- ../src-base/minecraft/net/minecraft/potion/PotionEffect.java
+++ ../src-work/minecraft/net/minecraft/potion/PotionEffect.java +++ ../src-work/minecraft/net/minecraft/potion/PotionEffect.java
@@ -240,4 +240,53 @@ @@ -19,6 +19,8 @@
@SideOnly(Side.CLIENT)
private boolean isPotionDurationMax;
private boolean field_188421_h;
+ /** List of ItemStack that can cure the potion effect **/
+ private java.util.List<net.minecraft.item.ItemStack> curativeItems;
public PotionEffect(Potion p_i46811_1_)
{
@@ -42,6 +44,8 @@
this.amplifier = p_i46814_3_;
this.isAmbient = p_i46814_4_;
this.field_188421_h = p_i46814_5_;
+ this.curativeItems = new java.util.ArrayList<net.minecraft.item.ItemStack>();
+ this.curativeItems.add(new net.minecraft.item.ItemStack(net.minecraft.init.Items.milk_bucket));
}
public PotionEffect(PotionEffect other)
@@ -51,6 +55,7 @@
this.amplifier = other.amplifier;
this.isAmbient = other.isAmbient;
this.field_188421_h = other.field_188421_h;
+ this.curativeItems = other.curativeItems;
}
public void combine(PotionEffect other)
@@ -200,7 +205,7 @@
public static PotionEffect readCustomPotionEffectFromNBT(NBTTagCompound nbt)
{
- int i = nbt.getByte("Id");
+ int i = nbt.getByte("Id") & 0xFF;
Potion potion = Potion.func_188412_a(i);
if (potion == null)
@@ -240,4 +245,53 @@
{ {
return this.isPotionDurationMax; return this.isPotionDurationMax;
} }

View file

@ -1,46 +0,0 @@
++++ REJECTED PATCH 1
public class Potion
{
- public static final Potion[] potionTypes = new Potion[32];
+ public static final Potion[] potionTypes = new Potion[256];
private static final Map<ResourceLocation, Potion> field_180150_I = Maps.<ResourceLocation, Potion>newHashMap();
public static final Potion field_180151_b = null;
public static final Potion moveSpeed = (new Potion(1, new ResourceLocation("speed"), false, 8171462)).setPotionName("potion.moveSpeed").setIconIndex(0, 0).registerPotionAttributeModifier(SharedMonsterAttributes.movementSpeed, "91AEAA56-376B-4498-935B-2F7F68070635", 0.20000000298023224D, 2);
++++ END PATCH
++++ REJECTED PATCH 2
private double effectiveness;
private boolean usable;
+ @Deprecated // use the Constructor without potion ID or everything will explode.
protected Potion(int potionID, ResourceLocation location, boolean badEffect, int potionColor)
{
- this.id = potionID;
- potionTypes[potionID] = this;
+ net.minecraftforge.fml.common.registry.GameData.getPotionRegistry().register(potionID, location, this);
field_180150_I.put(location, this);
this.isBadEffect = badEffect;
++++ END PATCH
++++ REJECTED PATCH 3
this.liquidColor = potionColor;
}
+ protected Potion(ResourceLocation location, boolean badEffect, int potionColor) {
+ this(-1, location, badEffect, potionColor);
+ }
+
public static Potion getPotionFromResourceLocation(String location)
{
- return (Potion)field_180150_I.get(new ResourceLocation(location));
+ return net.minecraftforge.fml.common.registry.GameData.getPotionRegistry().getObject(new ResourceLocation(location));
}
public static Set<ResourceLocation> getPotionLocations()
{
- return field_180150_I.keySet();
+ return net.minecraftforge.fml.common.registry.GameData.getPotionRegistry().getKeys();
}
protected Potion setIconIndex(int p_76399_1_, int p_76399_2_)
++++ END PATCH

View file

@ -1,39 +0,0 @@
++++ REJECTED PATCH 1
@SideOnly(Side.CLIENT)
private boolean isPotionDurationMax;
private boolean showParticles;
+ /** List of ItemStack that can cure the potion effect **/
+ private java.util.List<net.minecraft.item.ItemStack> curativeItems;
public PotionEffect(int id, int effectDuration)
{
++++ END PATCH
++++ REJECTED PATCH 2
this.amplifier = effectAmplifier;
this.isAmbient = ambient;
this.showParticles = showParticles;
+ this.curativeItems = new java.util.ArrayList<net.minecraft.item.ItemStack>();
+ this.curativeItems.add(new net.minecraft.item.ItemStack(net.minecraft.init.Items.milk_bucket));
}
public PotionEffect(PotionEffect other)
++++ END PATCH
++++ REJECTED PATCH 3
this.amplifier = other.amplifier;
this.isAmbient = other.isAmbient;
this.showParticles = other.showParticles;
+ this.curativeItems = other.curativeItems;
}
public void combine(PotionEffect other)
++++ END PATCH
++++ REJECTED PATCH 4
public static PotionEffect readCustomPotionEffectFromNBT(NBTTagCompound nbt)
{
- int i = nbt.getByte("Id");
+ int i = nbt.getByte("Id") & 0xff;
if (i >= 0 && i < Potion.potionTypes.length && Potion.potionTypes[i] != null)
{
++++ END PATCH

View file

@ -32,6 +32,8 @@ public net.minecraft.item.Item func_77627_a(Z)Lnet.minecraft.item.Item; #setHasS
#public net.minecraft.client.entity.EntityPlayerSP func_71012_a(Lnet/minecraft/entity/item/EntityItem;)V #joinEntityItemWithWorld #public net.minecraft.client.entity.EntityPlayerSP func_71012_a(Lnet/minecraft/entity/item/EntityItem;)V #joinEntityItemWithWorld
public net.minecraft.entity.player.EntityPlayer func_71053_j()V #closeScreen public net.minecraft.entity.player.EntityPlayer func_71053_j()V #closeScreen
#public uf.b #FD:EntityPlayer/field_71076_b #sleepTimer #public uf.b #FD:EntityPlayer/field_71076_b #sleepTimer
# EntityTrackerEntry
public net.minecraft.entity.EntityTrackerEntry field_73134_o # trackingPlayers
# World Gen Chests Related # World Gen Chests Related
public net.minecraft.util.WeightedRandomChestContent * public net.minecraft.util.WeightedRandomChestContent *
# Save Location # Save Location