mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-12 08:17:35 +00:00
util, tileentity, stats, realms. Potions got an overhaul and out registry will need to be adapted.
This commit is contained in:
1 parent
f654157adb
commit
1f80eb17df
29 files changed
+303
-407
No files matched your search
@@ -1,11 +1,8 @@
|
||||
package net.minecraftforge.common.brewing;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemPotion;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.potion.PotionHelper;
|
||||
|
||||
/**
|
||||
@@ -21,7 +18,8 @@ public class VanillaBrewingRecipe implements IBrewingRecipe {
|
||||
@Override
|
||||
public boolean isInput(ItemStack stack)
|
||||
{
|
||||
return stack.getItem() instanceof ItemPotion || stack.getItem() == Items.glass_bottle;
|
||||
Item item = stack.getItem();
|
||||
return item == Items.potionitem || item == Items.field_185155_bH || item == Items.field_185156_bI || item == Items.glass_bottle;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -30,7 +28,7 @@ public class VanillaBrewingRecipe implements IBrewingRecipe {
|
||||
@Override
|
||||
public boolean isIngredient(ItemStack stack)
|
||||
{
|
||||
return stack.getItem().isPotionIngredient(stack);
|
||||
return PotionHelper.func_185205_a(stack);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -41,34 +39,14 @@ public class VanillaBrewingRecipe implements IBrewingRecipe {
|
||||
@Override
|
||||
public ItemStack getOutput(ItemStack input, ItemStack ingredient)
|
||||
{
|
||||
if (ingredient != null && input != null && input.getItem() instanceof ItemPotion && isIngredient(ingredient))
|
||||
if (ingredient != null && input != null && isIngredient(ingredient))
|
||||
{
|
||||
int inputMeta = input.getMetadata();
|
||||
int outputMeta = PotionHelper.applyIngredient(inputMeta, ingredient.getItem().getPotionEffect(ingredient));
|
||||
if (inputMeta == outputMeta)
|
||||
ItemStack result = PotionHelper.func_185212_d(ingredient, input);
|
||||
if (result != input)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
List<PotionEffect> oldEffects = Items.potionitem.getEffects(inputMeta);
|
||||
List<PotionEffect> newEffects = Items.potionitem.getEffects(outputMeta);
|
||||
|
||||
boolean hasResult = false;
|
||||
if ((inputMeta <= 0 || oldEffects != newEffects) && (oldEffects == null || !oldEffects.equals(newEffects) && newEffects != null))
|
||||
{
|
||||
hasResult = true;
|
||||
}
|
||||
else if (!ItemPotion.isSplash(inputMeta) && ItemPotion.isSplash(outputMeta))
|
||||
{
|
||||
hasResult = true;
|
||||
}
|
||||
|
||||
if (hasResult)
|
||||
{
|
||||
ItemStack output = input.copy();
|
||||
output.setItemDamage(outputMeta);
|
||||
return output;
|
||||
return result;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
@@ -34,7 +34,7 @@ import org.apache.logging.log4j.Level;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StringTranslate;
|
||||
import net.minecraft.util.text.translation.LanguageMap;
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
import net.minecraftforge.fml.common.FMLLog;
|
||||
import net.minecraftforge.fml.common.Loader;
|
||||
@@ -241,7 +241,7 @@ public class LanguageRegistry
|
||||
}
|
||||
}
|
||||
|
||||
public void injectLanguage(String language, HashMap<String, String> parsedLangFile)
|
||||
public void injectLanguage(String language, Map<String, String> parsedLangFile)
|
||||
{
|
||||
|
||||
Properties p = modLanguageData.get(language);
|
||||
@@ -285,11 +285,11 @@ public class LanguageRegistry
|
||||
String lang = matcher.group(2);
|
||||
//FMLLog.fine("Injecting found translation data for lang %s in zip file %s at %s into language system", lang, source.getName(), ze.getName());
|
||||
added.add(lang);
|
||||
LanguageRegistry.instance().injectLanguage(lang, StringTranslate.parseLangFile(zf.getInputStream(ze)));
|
||||
LanguageRegistry.instance().injectLanguage(lang, LanguageMap.parseLangFile(zf.getInputStream(ze)));
|
||||
// Ensure en_US is available to StringTranslate on the server
|
||||
if ("en_US".equals(lang) && side == Side.SERVER)
|
||||
{
|
||||
StringTranslate.inject(zf.getInputStream(ze));
|
||||
LanguageMap.inject(zf.getInputStream(ze));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -312,11 +312,11 @@ public class LanguageRegistry
|
||||
{
|
||||
String lang = matcher.group(2);
|
||||
FMLLog.fine("Injecting found translation assets for lang %s at %s into language system", lang, currPath);
|
||||
LanguageRegistry.instance().injectLanguage(lang, StringTranslate.parseLangFile(new FileInputStream(file)));
|
||||
LanguageRegistry.instance().injectLanguage(lang, LanguageMap.parseLangFile(new FileInputStream(file)));
|
||||
// Ensure en_US is available to StringTranslate on the server
|
||||
if ("en_US".equals(lang) && side == Side.SERVER)
|
||||
{
|
||||
StringTranslate.inject(new FileInputStream(file));
|
||||
LanguageMap.inject(new FileInputStream(file));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user