Added bypass functions to Defaulted registry, DO NOT USE THIS MODDERS FORGE INTERNAL ONLY.
And some other fixups for running.
This commit is contained in:
parent
7b7156e87f
commit
90b2c86a9f
4 changed files with 27 additions and 17 deletions
|
@ -9,16 +9,7 @@
|
|||
|
||||
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 @@
|
||||
@@ -51,6 +53,7 @@
|
||||
this.amplifier = other.amplifier;
|
||||
this.isAmbient = other.isAmbient;
|
||||
this.field_188421_h = other.field_188421_h;
|
||||
|
@ -26,7 +17,7 @@
|
|||
}
|
||||
|
||||
public void combine(PotionEffect other)
|
||||
@@ -200,7 +205,7 @@
|
||||
@@ -200,7 +203,7 @@
|
||||
|
||||
public static PotionEffect readCustomPotionEffectFromNBT(NBTTagCompound nbt)
|
||||
{
|
||||
|
@ -35,7 +26,7 @@
|
|||
Potion potion = Potion.func_188412_a(i);
|
||||
|
||||
if (potion == null)
|
||||
@@ -240,4 +245,53 @@
|
||||
@@ -240,4 +243,58 @@
|
||||
{
|
||||
return this.isPotionDurationMax;
|
||||
}
|
||||
|
@ -47,6 +38,11 @@
|
|||
+ */
|
||||
+ public java.util.List<net.minecraft.item.ItemStack> getCurativeItems()
|
||||
+ {
|
||||
+ if (this.curativeItems == null) //Lazy load this so that we don't create a circular dep on Items.
|
||||
+ {
|
||||
+ this.curativeItems = new java.util.ArrayList<net.minecraft.item.ItemStack>();
|
||||
+ this.curativeItems.add(new net.minecraft.item.ItemStack(net.minecraft.init.Items.milk_bucket));
|
||||
+ }
|
||||
+ return this.curativeItems;
|
||||
+ }
|
||||
+
|
||||
|
@ -57,7 +53,7 @@
|
|||
+ */
|
||||
+ public boolean isCurativeItem(net.minecraft.item.ItemStack stack)
|
||||
+ {
|
||||
+ for (net.minecraft.item.ItemStack curativeItem : this.curativeItems)
|
||||
+ for (net.minecraft.item.ItemStack curativeItem : this.getCurativeItems())
|
||||
+ {
|
||||
+ if (curativeItem.isItemEqual(stack))
|
||||
+ {
|
||||
|
@ -85,7 +81,7 @@
|
|||
+ {
|
||||
+ if (!this.isCurativeItem(stack))
|
||||
+ {
|
||||
+ this.curativeItems.add(stack);
|
||||
+ this.getCurativeItems().add(stack);
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
--- ../src-base/minecraft/net/minecraft/util/registry/RegistryNamespacedDefaultedByKey.java
|
||||
+++ ../src-work/minecraft/net/minecraft/util/registry/RegistryNamespacedDefaultedByKey.java
|
||||
@@ -57,4 +57,11 @@
|
||||
V v = super.func_186801_a(p_186801_1_);
|
||||
return (V)(v == null ? this.defaultValue : v);
|
||||
}
|
||||
+
|
||||
+ //Bypass functions to allow querying this registry WITHOUT getting the defaulted value.
|
||||
+ // MODDERS DO NOT USE THIS IS FOR FORGE INTERNAL CHECKS
|
||||
+ public int getIDForObjectBypass(V bypass) { return super.getIDForObject(bypass); }
|
||||
+ public K getNameForObjectBypass(V value) { return super.getNameForObject(value); }
|
||||
+ public V getObjectBypass(K name) { return super.getObject(name); }
|
||||
+ public V getObjectByIdBypass(int id){ return super.getObjectById(id); }
|
||||
}
|
|
@ -276,7 +276,7 @@ public class FMLControlledNamespacedRegistry<I> extends RegistryNamespacedDefaul
|
|||
*/
|
||||
public int getId(I thing)
|
||||
{
|
||||
return getIDForObject(thing);
|
||||
return getIDForObjectBypass(thing);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -122,8 +122,8 @@ public class ForgeBlockStatesLoaderDebug {
|
|||
}
|
||||
|
||||
public static enum CustomVariant implements IStringSerializable {
|
||||
TypeA,
|
||||
TypeB;
|
||||
type_a,
|
||||
type_b;
|
||||
|
||||
public String getName() { return this.toString(); };
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue