mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-25 14:24:35 +00:00
Added a few new constructors to OreGas to make creating them easier
This commit is contained in:
1 parent
84b59eefb2
commit
f65682a402
4 files changed
+29
-24
No files matched your search
@@ -19,7 +19,7 @@ import net.minecraftforge.fluids.FluidRegistry;
|
||||
*/
|
||||
public class Gas {
|
||||
|
||||
private String name;
|
||||
private final String name;
|
||||
|
||||
private String unlocalizedName;
|
||||
|
||||
@@ -41,8 +41,7 @@ public class Gas {
|
||||
* @param s - name or key to associate this Gas with
|
||||
*/
|
||||
public Gas(String s, String icon) {
|
||||
unlocalizedName = name = s;
|
||||
iconLocation = new ResourceLocation(icon);
|
||||
this(s, new ResourceLocation(icon));
|
||||
}
|
||||
|
||||
public Gas(String s, ResourceLocation icon) {
|
||||
@@ -57,8 +56,7 @@ public class Gas {
|
||||
* @param t - tint of this Gas
|
||||
*/
|
||||
public Gas(String s, int t) {
|
||||
unlocalizedName = name = s;
|
||||
iconLocation = new ResourceLocation(Mekanism.MODID, "blocks/liquid/liquid");
|
||||
this(s, "mekanism:blocks/liquid/liquid");
|
||||
tint = t;
|
||||
}
|
||||
|
||||
@@ -156,7 +154,6 @@ public class Gas {
|
||||
*/
|
||||
public Gas setTranslationKey(String s) {
|
||||
unlocalizedName = s;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,20 +2,33 @@ package mekanism.api.gas;
|
||||
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
|
||||
|
||||
public class OreGas extends Gas {
|
||||
|
||||
private String oreName;
|
||||
private String oreLangKey;
|
||||
private OreGas cleanGas;
|
||||
|
||||
public OreGas(String s, String name) {
|
||||
public OreGas(String s, String oreLangKey) {
|
||||
super(s, "mekanism:blocks/liquid/Liquid" + (s.contains("clean") ? "Clean" : "") + "Ore");
|
||||
|
||||
oreName = name;
|
||||
|
||||
this.oreLangKey = oreLangKey;
|
||||
setTint(0xf2cd67);//default old tint
|
||||
}
|
||||
|
||||
public OreGas(String s, String oreLangKey, int tint, boolean isClean) {
|
||||
super(s, "mekanism:blocks/liquid/Liquid" + (isClean ? "Clean" : "") + "Ore");
|
||||
this.oreLangKey = oreLangKey;
|
||||
setTint(tint);
|
||||
setVisible(false);
|
||||
}
|
||||
|
||||
public OreGas(String s, String oreLangKey, int tint) {
|
||||
this(s, oreLangKey, tint, true);
|
||||
}
|
||||
|
||||
public OreGas(String s, String oreLangKey, int tint, OreGas clean) {
|
||||
this(s, oreLangKey, tint, false);
|
||||
setCleanGas(clean);
|
||||
}
|
||||
|
||||
public boolean isClean() {
|
||||
return getCleanGas() == null;
|
||||
}
|
||||
@@ -26,11 +39,10 @@ public class OreGas extends Gas {
|
||||
|
||||
public OreGas setCleanGas(OreGas gas) {
|
||||
cleanGas = gas;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getOreName() {
|
||||
return I18n.translateToLocal(oreName);
|
||||
return I18n.translateToLocal(oreLangKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
@API(apiVersion = "9.0.0", owner = "mekanism", provides = "MekanismAPI|gas")
|
||||
@API(apiVersion = "9.1.0", owner = "mekanism", provides = "MekanismAPI|gas")
|
||||
package mekanism.api.gas;
|
||||
|
||||
import net.minecraftforge.fml.common.API;
|
||||
|
||||
@@ -60,15 +60,11 @@ public class MekanismFluids {
|
||||
for (Resource resource : Resource.values()) {
|
||||
String name = resource.getName();
|
||||
String nameLower = name.toLowerCase(Locale.ROOT);
|
||||
|
||||
OreGas clean = new OreGas("clean" + name, "oregas." + nameLower);
|
||||
clean.setVisible(false).setTint(resource.tint);
|
||||
|
||||
OreGas dirty = new OreGas(nameLower, "oregas." + nameLower).setCleanGas(clean);
|
||||
dirty.setVisible(false).setTint(resource.tint);
|
||||
|
||||
//Clean
|
||||
OreGas clean = new OreGas("clean" + name, "oregas." + nameLower, resource.tint);
|
||||
GasRegistry.register(clean);
|
||||
GasRegistry.register(dirty);
|
||||
//Dirty
|
||||
GasRegistry.register(new OreGas(nameLower, "oregas." + nameLower, resource.tint, clean));
|
||||
}
|
||||
|
||||
FluidRegistry.enableUniversalBucket();
|
||||
|
||||
Reference in new issue
Block a user