Make Villager profession unlocalized name use modids when not 'minecraft' Closes #5977
Fixed trees able to be generated through water. Closes #6000 Change Block#toString to use getRegistryName instead of getNameForObject Closes #5937 Allow Cooking Recipes to deserialize results with stack sizes. Closes #5960
This commit is contained in:
parent
318fc6ffe8
commit
48fa2f458c
9 changed files with 60 additions and 677 deletions
|
@ -132,6 +132,24 @@
|
|||
public SoundType func_220072_p(BlockState p_220072_1_) {
|
||||
return this.field_149762_H;
|
||||
}
|
||||
@@ -763,7 +771,7 @@
|
||||
this.field_220086_i = Item.func_150898_a(this);
|
||||
}
|
||||
|
||||
- return this.field_220086_i;
|
||||
+ return this.field_220086_i.delegate.get(); //Forge: Vanilla caches the items, update with registry replacements.
|
||||
}
|
||||
|
||||
public boolean func_208619_r() {
|
||||
@@ -771,7 +779,7 @@
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
- return "Block{" + Registry.field_212618_g.func_177774_c(this) + "}";
|
||||
+ return "Block{" + getRegistryName() + "}";
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@@ -779,13 +787,80 @@
|
||||
}
|
||||
|
||||
|
|
|
@ -9,3 +9,12 @@
|
|||
if (this.func_70631_g_()) {
|
||||
this.func_213756_es();
|
||||
return super.func_184645_a(p_184645_1_, p_184645_2_);
|
||||
@@ -611,7 +611,7 @@
|
||||
});
|
||||
} else {
|
||||
VillagerProfession villagerprofession = this.func_213700_eh().func_221130_b();
|
||||
- ITextComponent itextcomponent1 = (new TranslationTextComponent(this.func_200600_R().func_210760_d() + '.' + Registry.field_218370_L.func_177774_c(villagerprofession).func_110623_a())).func_211710_a((p_213773_1_) -> {
|
||||
+ ITextComponent itextcomponent1 = (new TranslationTextComponent(this.func_200600_R().func_210760_d() + '.' + (!"minecraft".equals(villagerprofession.getRegistryName().func_110624_b()) ? villagerprofession.getRegistryName().func_110624_b() + '.' : "") + villagerprofession.getRegistryName().func_110623_a())).func_211710_a((p_213773_1_) -> {
|
||||
p_213773_1_.func_150209_a(this.func_174823_aP()).func_179989_a(this.func_189512_bd());
|
||||
});
|
||||
if (team != null) {
|
||||
|
|
|
@ -9,3 +9,22 @@
|
|||
private final int field_222178_t;
|
||||
private final CookingRecipeSerializer.IFactory<T> field_222179_u;
|
||||
|
||||
@@ -21,11 +21,17 @@
|
||||
String s = JSONUtils.func_151219_a(p_199425_2_, "group", "");
|
||||
JsonElement jsonelement = (JsonElement)(JSONUtils.func_151202_d(p_199425_2_, "ingredient") ? JSONUtils.func_151214_t(p_199425_2_, "ingredient") : JSONUtils.func_152754_s(p_199425_2_, "ingredient"));
|
||||
Ingredient ingredient = Ingredient.func_199802_a(jsonelement);
|
||||
+ //Forge: Check if primitive string to keep vanilla or a object which can contain a count field.
|
||||
+ if (!p_199425_2_.has("result")) throw new com.google.gson.JsonSyntaxException("Missing result, expected to find a string or object");
|
||||
+ ItemStack itemstack;
|
||||
+ if (p_199425_2_.get("result").isJsonObject()) itemstack = ShapedRecipe.func_199798_a(JSONUtils.func_152754_s(p_199425_2_, "result"));
|
||||
+ else {
|
||||
String s1 = JSONUtils.func_151200_h(p_199425_2_, "result");
|
||||
ResourceLocation resourcelocation = new ResourceLocation(s1);
|
||||
- ItemStack itemstack = new ItemStack(Registry.field_212630_s.func_218349_b(resourcelocation).orElseThrow(() -> {
|
||||
+ itemstack = new ItemStack(Registry.field_212630_s.func_218349_b(resourcelocation).orElseThrow(() -> {
|
||||
return new IllegalStateException("Item: " + s1 + " does not exist");
|
||||
}));
|
||||
+ }
|
||||
float f = JSONUtils.func_151221_a(p_199425_2_, "experience", 0.0F);
|
||||
int i = JSONUtils.func_151208_a(p_199425_2_, "cookingtime", this.field_222178_t);
|
||||
return this.field_222179_u.create(p_199425_1_, s, ingredient, itemstack, f, i);
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
--- a/net/minecraft/world/storage/loot/functions/Smelt.java
|
||||
+++ b/net/minecraft/world/storage/loot/functions/Smelt.java
|
||||
@@ -30,7 +30,7 @@
|
||||
ItemStack itemstack = optional.get().func_77571_b();
|
||||
if (!itemstack.func_190926_b()) {
|
||||
ItemStack itemstack1 = itemstack.func_77946_l();
|
||||
- itemstack1.func_190920_e(p_215859_1_.func_190916_E());
|
||||
+ itemstack1.func_190920_e(p_215859_1_.func_190916_E() * itemstack.func_190916_E()); //Forge: Support smelting returning multiple
|
||||
return itemstack1;
|
||||
}
|
||||
}
|
|
@ -1,441 +0,0 @@
|
|||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2019.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation version 2.1
|
||||
* of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
package net.minecraftforge.client.gui;
|
||||
/*
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraftforge.common.ForgeChunkManager;
|
||||
import net.minecraftforge.common.ForgeMod;
|
||||
import net.minecraftforge.versions.forge.ForgeVersion;
|
||||
import net.minecraftforge.common.config.ConfigCategory;
|
||||
import net.minecraftforge.common.config.ConfigElement;
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
import net.minecraftforge.common.config.Property;
|
||||
import net.minecraftforge.fml.client.IModGuiFactory;
|
||||
import net.minecraftforge.fml.client.config.ConfigGuiType;
|
||||
import net.minecraftforge.fml.client.config.DummyConfigElement;
|
||||
import net.minecraftforge.fml.client.config.DummyConfigElement.DummyCategoryElement;
|
||||
import net.minecraftforge.fml.client.config.GuiConfig;
|
||||
import net.minecraftforge.fml.client.config.GuiConfigEntries;
|
||||
import net.minecraftforge.fml.client.config.GuiConfigEntries.CategoryEntry;
|
||||
import net.minecraftforge.fml.client.config.GuiConfigEntries.IConfigEntry;
|
||||
import net.minecraftforge.fml.client.config.GuiConfigEntries.SelectValueEntry;
|
||||
import net.minecraftforge.fml.client.config.GuiConfigEntries.BooleanEntry;
|
||||
import net.minecraftforge.fml.client.config.IConfigElement;
|
||||
import net.minecraftforge.fml.ModContainer;
|
||||
import net.minecraftforge.fml.ModList;
|
||||
|
||||
import static net.minecraftforge.common.ForgeMod.VERSION_CHECK_CAT;
|
||||
|
||||
/**
|
||||
* This is the base GuiConfig screen class that all the other Forge-specific config screens will be called from.
|
||||
* Since Forge has multiple config files I thought I would use that opportunity to show some of the ways
|
||||
* that the config GUI system can be extended to create custom config GUIs that have additional features
|
||||
* over the base functionality of just displaying Properties and ConfigCategories.
|
||||
*
|
||||
* The concepts implemented here are:
|
||||
* - using custom IConfigEntry objects to define child-screens that have specific Properties listed
|
||||
* - using custom IConfigEntry objects to define a dummy property that can be used to generate new ConfigCategory objects
|
||||
* - defining the configID string for a GuiConfig object so that the config changed events will be posted when that GuiConfig screen is closed
|
||||
* (the configID string is optional; if it is not defined the config changed events will be posted when the top-most GuiConfig screen
|
||||
* is closed, eg when the parent is null or is not an instance of GuiConfig)
|
||||
* - overriding the IConfigEntry.enabled() method to control the enabled state of one list entry based on the value of another entry
|
||||
* - overriding the IConfigEntry.onGuiClosed() method to perform custom actions when the screen that owns the entry is closed (in this
|
||||
* case a new ConfigCategory is added to the Configuration object)
|
||||
*
|
||||
* The config file structure looks like this:
|
||||
* forge.cfg (general settings all in one category)
|
||||
* forgeChunkLoading.cfg
|
||||
* - Forge (category)
|
||||
* - defaults (category)
|
||||
* - [optional mod override categories]...
|
||||
*
|
||||
* The GUI structure is this:
|
||||
* Base Screen
|
||||
* - General Settings (from forge.cfg)
|
||||
* - Chunk Loader Settings (from forgeChunkLoading.cfg)
|
||||
* - Defaults (these elements are listed directly on this screen)
|
||||
* - Mod Overrides
|
||||
* - Add New Mod Override
|
||||
* - Mod1
|
||||
* - Mod2
|
||||
* - etc.
|
||||
*
|
||||
* Other things to check out:
|
||||
* ForgeMod.syncConfig()
|
||||
* ForgeMod.onConfigChanged()
|
||||
* ForgeChunkManager.syncConfigDefaults()
|
||||
* ForgeChunkManager.loadConfiguration()
|
||||
*/
|
||||
/* TODO Config gui
|
||||
public class ForgeGuiFactory implements IModGuiFactory
|
||||
{
|
||||
@Override
|
||||
public void initialize(Minecraft minecraftInstance) {}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean hasConfigGui() { return true; }
|
||||
|
||||
@Override
|
||||
public GuiScreen createConfigGui(GuiScreen parent) { return new ForgeConfigGui(parent); }
|
||||
|
||||
@Override
|
||||
public Set<RuntimeOptionCategoryElement> runtimeGuiCategories() { return null; }
|
||||
|
||||
public static class ForgeConfigGui extends GuiConfig
|
||||
{
|
||||
public ForgeConfigGui(GuiScreen parentScreen)
|
||||
{
|
||||
super(parentScreen, getConfigElements(), ForgeVersion.MOD_ID, false, false, I18n.format("forge.configgui.forgeConfigTitle"));
|
||||
}
|
||||
|
||||
private static List<IConfigElement> getConfigElements()
|
||||
{
|
||||
List<IConfigElement> list = new ArrayList<IConfigElement>();
|
||||
list.add(new DummyCategoryElement("forgeCfg", "forge.configgui.ctgy.forgeGeneralConfig", GeneralEntry.class));
|
||||
list.add(new DummyCategoryElement("forgeClientCfg", "forge.configgui.ctgy.forgeClientConfig", ClientEntry.class));
|
||||
list.add(new DummyCategoryElement("forgeChunkLoadingCfg", "forge.configgui.ctgy.forgeChunkLoadingConfig", ChunkLoaderEntry.class));
|
||||
list.add(new DummyCategoryElement("forgeVersionCheckCfg", "forge.configgui.ctgy.VersionCheckConfig", VersionCheckEntry.class));
|
||||
return list;
|
||||
}
|
||||
|
||||
*//**
|
||||
* This custom list entry provides the General Settings entry on the Minecraft Forge Configuration screen.
|
||||
* It extends the base Category entry class and defines the IConfigElement objects that will be used to build the child screen.
|
||||
*//*
|
||||
public static class GeneralEntry extends CategoryEntry
|
||||
{
|
||||
public GeneralEntry(GuiConfig owningScreen, GuiConfigEntries owningEntryList, IConfigElement prop)
|
||||
{
|
||||
super(owningScreen, owningEntryList, prop);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected GuiScreen buildChildScreen()
|
||||
{
|
||||
// This GuiConfig object specifies the configID of the object and as such will force-save when it is closed. The parent
|
||||
// GuiConfig object's entryList will also be refreshed to reflect the changes.
|
||||
return new GuiConfig(this.owningScreen,
|
||||
(new ConfigElement(ForgeMod.getConfig().getCategory(Configuration.CATEGORY_GENERAL))).getChildElements(),
|
||||
this.owningScreen.modID, Configuration.CATEGORY_GENERAL, this.configElement.requiresWorldRestart() || this.owningScreen.allRequireWorldRestart,
|
||||
this.configElement.requiresMcRestart() || this.owningScreen.allRequireMcRestart,
|
||||
GuiConfig.getAbridgedConfigPath(ForgeMod.getConfig().toString()));
|
||||
}
|
||||
}
|
||||
|
||||
*//**
|
||||
* This custom list entry provides the Client only Settings entry on the Minecraft Forge Configuration screen.
|
||||
* It extends the base Category entry class and defines the IConfigElement objects that will be used to build the child screen.
|
||||
*//*
|
||||
public static class ClientEntry extends CategoryEntry
|
||||
{
|
||||
public ClientEntry(GuiConfig owningScreen, GuiConfigEntries owningEntryList, IConfigElement prop)
|
||||
{
|
||||
super(owningScreen, owningEntryList, prop);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected GuiScreen buildChildScreen()
|
||||
{
|
||||
// This GuiConfig object specifies the configID of the object and as such will force-save when it is closed. The parent
|
||||
// GuiConfig object's entryList will also be refreshed to reflect the changes.
|
||||
return new GuiConfig(this.owningScreen,
|
||||
(new ConfigElement(ForgeMod.getConfig().getCategory(Configuration.CATEGORY_CLIENT))).getChildElements(),
|
||||
this.owningScreen.modID, Configuration.CATEGORY_CLIENT, this.configElement.requiresWorldRestart() || this.owningScreen.allRequireWorldRestart,
|
||||
this.configElement.requiresMcRestart() || this.owningScreen.allRequireMcRestart,
|
||||
GuiConfig.getAbridgedConfigPath(ForgeMod.getConfig().toString()));
|
||||
}
|
||||
}
|
||||
|
||||
*//**
|
||||
* This custom list entry provides the Forge Chunk Manager Config entry on the Minecraft Forge Configuration screen.
|
||||
* It extends the base Category entry class and defines the IConfigElement objects that will be used to build the child screen.
|
||||
*//*
|
||||
public static class ChunkLoaderEntry extends CategoryEntry
|
||||
{
|
||||
public ChunkLoaderEntry(GuiConfig owningScreen, GuiConfigEntries owningEntryList, IConfigElement prop)
|
||||
{
|
||||
super(owningScreen, owningEntryList, prop);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected GuiScreen buildChildScreen()
|
||||
{
|
||||
List<IConfigElement> list = new ArrayList<IConfigElement>();
|
||||
|
||||
list.add(new DummyCategoryElement("forgeChunkLoadingModCfg", "forge.configgui.ctgy.forgeChunkLoadingModConfig",
|
||||
ModOverridesEntry.class));
|
||||
list.addAll((new ConfigElement(ForgeChunkManager.getDefaultsCategory())).getChildElements());
|
||||
|
||||
// This GuiConfig object specifies the configID of the object and as such will force-save when it is closed. The parent
|
||||
// GuiConfig object's propertyList will also be refreshed to reflect the changes.
|
||||
return new GuiConfig(this.owningScreen, list, this.owningScreen.modID, "chunkLoader",
|
||||
this.configElement.requiresWorldRestart() || this.owningScreen.allRequireWorldRestart,
|
||||
this.configElement.requiresMcRestart() || this.owningScreen.allRequireMcRestart,
|
||||
GuiConfig.getAbridgedConfigPath(ForgeChunkManager.getConfig().toString()),
|
||||
I18n.format("forge.configgui.ctgy.forgeChunkLoadingConfig"));
|
||||
}
|
||||
}
|
||||
|
||||
*//**
|
||||
* This custom list entry provides the Forge Version Checking Config entry on the Minecraft Forge Configuration screen.
|
||||
* It extends the base Category entry class and defines the IConfigElement objects that will be used to build the child screen.
|
||||
*//*
|
||||
public static class VersionCheckEntry extends CategoryEntry
|
||||
{
|
||||
public VersionCheckEntry(GuiConfig owningScreen, GuiConfigEntries owningEntryList, IConfigElement prop)
|
||||
{
|
||||
super(owningScreen, owningEntryList, prop);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected GuiScreen buildChildScreen()
|
||||
{
|
||||
ConfigCategory cfg = ForgeMod.getConfig().getCategory(VERSION_CHECK_CAT);
|
||||
Map<String, Property> values = new HashMap<String, Property>(cfg.getValues());
|
||||
values.remove("Global");
|
||||
|
||||
Property global = ForgeMod.getConfig().get(VERSION_CHECK_CAT, "Global", true);
|
||||
|
||||
List<Property> props = new ArrayList<Property>();
|
||||
// TODO
|
||||
|
||||
for (ModContainer mod : ForgeVersion.gatherMods().keySet())
|
||||
{
|
||||
values.remove(mod.getModId());
|
||||
props.add(ForgeMod.getConfig().get(VERSION_CHECK_CAT, mod.getModId(), true)); //Get or make the value in the config
|
||||
}
|
||||
|
||||
props.addAll(values.values()); // Add any left overs from the config
|
||||
props.sort(Comparator.comparing(Property::getName));
|
||||
|
||||
List<IConfigElement> list = new ArrayList<IConfigElement>();
|
||||
list.add(new ConfigElement(global));
|
||||
for (Property prop : props)
|
||||
{
|
||||
list.add(new ConfigElement(prop));
|
||||
}
|
||||
|
||||
// This GuiConfig object specifies the configID of the object and as such will force-save when it is closed. The parent
|
||||
// GuiConfig object's propertyList will also be refreshed to reflect the changes.
|
||||
return new GuiConfig(this.owningScreen,
|
||||
list,
|
||||
this.owningScreen.modID, VERSION_CHECK_CAT, true, true,
|
||||
GuiConfig.getAbridgedConfigPath(ForgeMod.getConfig().toString()));
|
||||
}
|
||||
}
|
||||
|
||||
*//**
|
||||
* This custom list entry provides the Mod Overrides entry on the Forge Chunk Loading config screen.
|
||||
* It extends the base Category entry class and defines the IConfigElement objects that will be used to build the child screen.
|
||||
* In this case it adds the custom entry for adding a new mod override and lists the existing mod overrides.
|
||||
*//*
|
||||
public static class ModOverridesEntry extends CategoryEntry
|
||||
{
|
||||
public ModOverridesEntry(GuiConfig owningScreen, GuiConfigEntries owningEntryList, IConfigElement prop)
|
||||
{
|
||||
super(owningScreen, owningEntryList, prop);
|
||||
}
|
||||
|
||||
*//**
|
||||
* This method is called in the constructor and is used to set the childScreen field.
|
||||
*//*
|
||||
@Override
|
||||
protected GuiScreen buildChildScreen()
|
||||
{
|
||||
List<IConfigElement> list = new ArrayList<IConfigElement>();
|
||||
|
||||
list.add(new DummyCategoryElement("addForgeChunkLoadingModCfg", "forge.configgui.ctgy.forgeChunkLoadingAddModConfig",
|
||||
AddModOverrideEntry.class));
|
||||
for (ConfigCategory cc : ForgeChunkManager.getModCategories())
|
||||
list.add(new ConfigElement(cc));
|
||||
|
||||
return new GuiConfig(this.owningScreen, list, this.owningScreen.modID,
|
||||
this.configElement.requiresWorldRestart() || this.owningScreen.allRequireWorldRestart,
|
||||
this.configElement.requiresMcRestart() || this.owningScreen.allRequireMcRestart, this.owningScreen.title,
|
||||
I18n.format("forge.configgui.ctgy.forgeChunkLoadingModConfig"));
|
||||
}
|
||||
|
||||
*//**
|
||||
* By overriding the enabled() method and checking the value of the "enabled" entry this entry is enabled/disabled based on the value of
|
||||
* the other entry.
|
||||
*//*
|
||||
@Override
|
||||
public boolean enabled()
|
||||
{
|
||||
for (IConfigEntry entry : this.owningEntryList.listEntries)
|
||||
{
|
||||
if (entry.getName().equals("enabled") && entry instanceof BooleanEntry)
|
||||
{
|
||||
return Boolean.valueOf(entry.getCurrentValue().toString());
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
*//**
|
||||
* Check to see if the child screen's entry list has changed.
|
||||
*//*
|
||||
@Override
|
||||
public boolean isChanged()
|
||||
{
|
||||
if (childScreen instanceof GuiConfig)
|
||||
{
|
||||
GuiConfig child = (GuiConfig) childScreen;
|
||||
return child.entryList.listEntries.size() != child.initEntries.size() || child.entryList.hasChangedEntry(true);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
*//**
|
||||
* Since adding a new entry to the child screen is what constitutes a change here, reset the child
|
||||
* screen listEntries to the saved list.
|
||||
*//*
|
||||
@Override
|
||||
public void undoChanges()
|
||||
{
|
||||
if (childScreen instanceof GuiConfig)
|
||||
{
|
||||
GuiConfig child = (GuiConfig) childScreen;
|
||||
for (IConfigEntry ice : child.entryList.listEntries)
|
||||
if (!child.initEntries.contains(ice) && ForgeChunkManager.getConfig().hasCategory(ice.getName()))
|
||||
ForgeChunkManager.getConfig().removeCategory(ForgeChunkManager.getConfig().getCategory(ice.getName()));
|
||||
|
||||
child.entryList.listEntries = new ArrayList<IConfigEntry>(child.initEntries);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*//**
|
||||
* This custom list entry provides a button that will open to a screen that will allow a user to define a new mod override.
|
||||
*//*
|
||||
public static class AddModOverrideEntry extends CategoryEntry
|
||||
{
|
||||
public AddModOverrideEntry(GuiConfig owningScreen, GuiConfigEntries owningEntryList, IConfigElement prop)
|
||||
{
|
||||
super(owningScreen, owningEntryList, prop);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected GuiScreen buildChildScreen()
|
||||
{
|
||||
List<IConfigElement> list = new ArrayList<IConfigElement>();
|
||||
|
||||
list.add(new DummyConfigElement("modID", "", ConfigGuiType.STRING, "forge.configgui.modID").setCustomListEntryClass(ModIDEntry.class));
|
||||
list.add(new ConfigElement(new Property("maximumTicketCount", "200", Property.Type.INTEGER, "forge.configgui.maximumTicketCount")));
|
||||
list.add(new ConfigElement(new Property("maximumChunksPerTicket", "25", Property.Type.INTEGER, "forge.configgui.maximumChunksPerTicket")));
|
||||
|
||||
return new GuiConfig(this.owningScreen, list, this.owningScreen.modID,
|
||||
this.configElement.requiresWorldRestart() || this.owningScreen.allRequireWorldRestart,
|
||||
this.configElement.requiresMcRestart() || this.owningScreen.allRequireMcRestart, this.owningScreen.title,
|
||||
I18n.format("forge.configgui.ctgy.forgeChunkLoadingAddModConfig"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isChanged()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
*//**
|
||||
* This custom list entry provides a Mod ID selector. The control is a button that opens a list of values to select from.
|
||||
* This entry also overrides onGuiClosed() to run code to save the data to a new ConfigCategory when the user is done.
|
||||
*//*
|
||||
public static class ModIDEntry extends SelectValueEntry
|
||||
{
|
||||
public ModIDEntry(GuiConfig owningScreen, GuiConfigEntries owningEntryList, IConfigElement prop)
|
||||
{
|
||||
super(owningScreen, owningEntryList, prop, getSelectableValues());
|
||||
if (this.selectableValues.size() == 0)
|
||||
this.btnValue.enabled = false;
|
||||
}
|
||||
|
||||
private static Map<Object, String> getSelectableValues()
|
||||
{
|
||||
Map<Object, String> selectableValues = new TreeMap<Object, String>();
|
||||
// TODO
|
||||
|
||||
|
||||
for (ModContainer mod : Loader.instance().getActiveModList())
|
||||
// only add mods to the list that have a non-immutable ModContainer
|
||||
if (!mod.isImmutable() && mod.getMod() != null)
|
||||
selectableValues.put(mod.getModId(), mod.getName());
|
||||
|
||||
|
||||
return selectableValues;
|
||||
}
|
||||
|
||||
*//**
|
||||
* By overriding onGuiClosed() for this entry we can perform additional actions when the user is done such as saving
|
||||
* a new ConfigCategory object to the Configuration object.
|
||||
*//*
|
||||
@Override
|
||||
public void onGuiClosed()
|
||||
{
|
||||
Object modObject = ModList.get().getModContainerById(getCurrentValue());
|
||||
int maxTickets = 200;
|
||||
int maxChunks = 25;
|
||||
if (modObject != null)
|
||||
{
|
||||
this.owningEntryList.saveConfigElements();
|
||||
for(IConfigElement ice : this.owningScreen.configElements)
|
||||
if ("maximumTicketCount".equals(ice.getName()))
|
||||
maxTickets = Integer.valueOf(ice.get().toString());
|
||||
else if ("maximumChunksPerTicket".equals(ice.getName()))
|
||||
maxChunks = Integer.valueOf(ice.get().toString());
|
||||
|
||||
ForgeChunkManager.addConfigProperty(modObject, "maximumTicketCount", String.valueOf(maxTickets), Property.Type.INTEGER);
|
||||
ForgeChunkManager.addConfigProperty(modObject, "maximumChunksPerTicket", String.valueOf(maxChunks), Property.Type.INTEGER);
|
||||
|
||||
if (this.owningScreen.parentScreen instanceof GuiConfig)
|
||||
{
|
||||
GuiConfig superParent = (GuiConfig) this.owningScreen.parentScreen;
|
||||
ConfigCategory modCtgy = ForgeChunkManager.getConfigFor(modObject);
|
||||
modCtgy.setPropertyOrder(ForgeChunkManager.MOD_PROP_ORDER);
|
||||
ConfigElement modConfig = new ConfigElement(modCtgy);
|
||||
|
||||
boolean found = false;
|
||||
for (IConfigElement ice : superParent.configElements)
|
||||
if (ice.getName().equals(currentValue))
|
||||
found = true;
|
||||
|
||||
if (!found)
|
||||
superParent.configElements.add(modConfig);
|
||||
|
||||
superParent.needsRefresh = true;
|
||||
superParent.initGui();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
|
@ -125,7 +125,7 @@ public class ForgeConfig
|
|||
public final BooleanValue selectiveResourceReloadEnabled;
|
||||
|
||||
public final BooleanValue showLoadWarnings;
|
||||
|
||||
|
||||
public final BooleanValue allowEmissiveItems;
|
||||
|
||||
Client(ForgeConfigSpec.Builder builder) {
|
||||
|
@ -168,7 +168,7 @@ public class ForgeConfig
|
|||
.comment("When enabled, forge will show any warnings that occurred during loading")
|
||||
.translation("forge.configgui.showloadwarnings")
|
||||
.define("showLoadWarnings", true);
|
||||
|
||||
|
||||
allowEmissiveItems = builder
|
||||
.comment("Allow item rendering to detect emissive quads and draw them properly. This allows glowing blocks to look the same in item form, but incurs a very slight performance hit.")
|
||||
.translation("forge.configgui.allowEmissiveItems")
|
||||
|
@ -209,67 +209,4 @@ public class ForgeConfig
|
|||
//public static boolean disableVersionCheck = false;
|
||||
//public static boolean logCascadingWorldGeneration = true; // see Chunk#logCascadingWorldGeneration()
|
||||
//public static boolean fixVanillaCascading = false;
|
||||
|
||||
//Client
|
||||
//public static int clumpingThreshold = 64;
|
||||
//public static boolean zoomInMissingModelTextInGui = false;
|
||||
//public static boolean disableStairSlabCulling = false;
|
||||
//public static boolean alwaysSetupTerrainOffThread = false;
|
||||
//public static boolean forgeLightPipelineEnabled = true;
|
||||
//public static boolean selectiveResourceReloadEnabled = false;
|
||||
|
||||
//TODO
|
||||
//public static int[] blendRanges = { 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34 };
|
||||
|
||||
/*
|
||||
private static void syncConfig(boolean load)
|
||||
{
|
||||
//prop = config.get(Configuration.CATEGORY_CLIENT, "biomeSkyBlendRange", new int[] { 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34 });
|
||||
//prop.setComment("Control the range of sky blending for colored skies in biomes.");
|
||||
//prop.setLanguageKey("forge.configgui.biomeSkyBlendRange");
|
||||
//blendRanges = prop.getIntList();
|
||||
//propOrder.add(prop.getName());
|
||||
}
|
||||
|
||||
/**
|
||||
* By subscribing to the OnConfigChangedEvent we are able to execute code when our config screens are closed.
|
||||
* This implementation uses the optional configID string to handle multiple Configurations using one event handler.
|
||||
* /
|
||||
@SubscribeEvent
|
||||
public void onConfigChanged(OnConfigChangedEvent event)
|
||||
{
|
||||
if (getMetadata().modId.equals(event.getModID()))
|
||||
{
|
||||
if ("chunkLoader".equals(event.getConfigID()))
|
||||
{
|
||||
ForgeChunkManager.syncConfigDefaults();
|
||||
ForgeChunkManager.loadConfiguration();
|
||||
}
|
||||
else
|
||||
{
|
||||
boolean tmpStairs = disableStairSlabCulling;
|
||||
|
||||
syncConfig(false);
|
||||
|
||||
if (event.isWorldRunning() && tmpStairs != disableStairSlabCulling)
|
||||
{
|
||||
FMLCommonHandler.instance().reloadRenderers();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@net.minecraftforge.eventbus.api.SubscribeEvent
|
||||
public void playerLogin(PlayerEvent.PlayerLoggedInEvent event)
|
||||
{
|
||||
UsernameCache.setUsername(event.player.getPersistentID(), event.player.getGameProfile().getName());
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void postInit(InterModProcessEvent evt)
|
||||
{
|
||||
ForgeChunkManager.loadConfiguration();
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
|
|
|
@ -23,9 +23,7 @@ import net.minecraftforge.eventbus.api.IEventBus;
|
|||
import net.minecraftforge.fml.*;
|
||||
import net.minecraftforge.fml.config.ModConfig;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLLoadCompleteEvent;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLModIdMappingEvent;
|
||||
import net.minecraftforge.fml.event.lifecycle.InterModProcessEvent;
|
||||
import net.minecraftforge.fml.event.server.FMLServerStartingEvent;
|
||||
import net.minecraftforge.fml.event.server.FMLServerStoppingEvent;
|
||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||
|
@ -89,8 +87,6 @@ public class ForgeMod implements WorldPersistenceHooks.WorldPersistenceHook
|
|||
WorldPersistenceHooks.addHook(new FMLWorldPersistenceHook());
|
||||
final IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus();
|
||||
modEventBus.addListener(this::preInit);
|
||||
modEventBus.addListener(this::postInit);
|
||||
modEventBus.addListener(this::onAvailable);
|
||||
modEventBus.addListener(this::gatherData);
|
||||
MinecraftForge.EVENT_BUS.addListener(this::serverStarting);
|
||||
MinecraftForge.EVENT_BUS.addListener(this::playerLogin);
|
||||
|
@ -103,20 +99,6 @@ public class ForgeMod implements WorldPersistenceHooks.WorldPersistenceHook
|
|||
StartupMessageManager.addModMessage("Forge version "+ForgeVersion.getVersion());
|
||||
}
|
||||
|
||||
/*
|
||||
public void missingMapping(RegistryEvent.MissingMappings<Item> event)
|
||||
{
|
||||
for (MissingMappings.Mapping<Item> entry : event.getAllMappings())
|
||||
{
|
||||
if (entry.key.toString().equals("minecraft:totem")) //This item changed from 1.11 -> 1.11.2
|
||||
{
|
||||
ResourceLocation newTotem = new ResourceLocation("minecraft:totem_of_undying");
|
||||
entry.remap(ForgeRegistries.ITEMS.getValue(newTotem));
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
public void playerLogin(PlayerEvent.PlayerLoggedInEvent event)
|
||||
{
|
||||
UsernameCache.setUsername(event.getPlayer().getUniqueID(), event.getPlayer().getGameProfile().getName());
|
||||
|
@ -138,47 +120,6 @@ public class ForgeMod implements WorldPersistenceHooks.WorldPersistenceHook
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
public void registrItems(RegistryEvent.Register<Item> event)
|
||||
{
|
||||
// Add and register the forge universal bucket, if it's enabled
|
||||
if(FluidRegistry.isUniversalBucketEnabled())
|
||||
{
|
||||
universalBucket = new UniversalBucket();
|
||||
universalBucket.setUnlocalizedName("forge.bucketFilled");
|
||||
event.getRegistry().register(universalBucket.setRegistryName(ForgeVersion.MOD_ID, "bucket_filled"));
|
||||
MinecraftForge.EVENT_BUS.register(universalBucket);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
public void postInit(InterModProcessEvent evt)
|
||||
{
|
||||
registerAllBiomesAndGenerateEvents();
|
||||
//ForgeChunkManager.loadConfiguration();
|
||||
}
|
||||
|
||||
private static void registerAllBiomesAndGenerateEvents()
|
||||
{
|
||||
/*
|
||||
for (Biome biome : ForgeRegistries.BIOMES.getValuesCollection())
|
||||
{
|
||||
if (biome.decorator instanceof DeferredBiomeDecorator)
|
||||
{
|
||||
DeferredBiomeDecorator decorator = (DeferredBiomeDecorator)biome.decorator;
|
||||
decorator.fireCreateEventAndReplace(biome);
|
||||
}
|
||||
|
||||
BiomeDictionary.ensureHasTypes(biome);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
public void onAvailable(FMLLoadCompleteEvent evt)
|
||||
{
|
||||
// FluidRegistry.validateFluidRegistry();
|
||||
}
|
||||
|
||||
public void serverStarting(FMLServerStartingEvent evt)
|
||||
{
|
||||
new ForgeCommand(evt.getCommandDispatcher());
|
||||
|
|
|
@ -365,7 +365,7 @@ public interface IForgeBlock
|
|||
*/
|
||||
default boolean canBeReplacedByLeaves(BlockState state, IWorldReader world, BlockPos pos)
|
||||
{
|
||||
return (isAir(state, world, pos) || state.isIn(BlockTags.LEAVES)) || !state.isOpaqueCube(world, pos);
|
||||
return isAir(state, world, pos) || state.isIn(BlockTags.LEAVES);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,111 +0,0 @@
|
|||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2019.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation version 2.1
|
||||
* of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/* TODO error GUIs
|
||||
package net.minecraftforge.fml.client.gui;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.gui.GuiYesNo;
|
||||
import net.minecraft.client.gui.GuiYesNoCallback;
|
||||
import net.minecraftforge.fml.client.FMLClientHandler;
|
||||
import net.minecraftforge.fml.common.FMLLog;
|
||||
import net.minecraftforge.fml.StartupQuery;
|
||||
import net.minecraftforge.fml.common.ZipperUtil;
|
||||
|
||||
public class GuiOldSaveLoadConfirm extends GuiYesNo implements GuiYesNoCallback {
|
||||
|
||||
private String dirName;
|
||||
private String saveName;
|
||||
private File zip;
|
||||
private GuiScreen parent;
|
||||
public GuiOldSaveLoadConfirm(String dirName, String saveName, GuiScreen parent)
|
||||
{
|
||||
super(null, "", "", 0);
|
||||
this.parent = parent;
|
||||
this.dirName = dirName;
|
||||
this.saveName = saveName;
|
||||
this.zip = new File(FMLClientHandler.instance().getClient().mcDataDir,String.format("%s-%2$td%2$tm%2$ty%2$tH%2$tM%2$tS.zip", dirName, System.currentTimeMillis()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
this.drawDefaultBackground();
|
||||
this.drawCenteredString(this.fontRenderer, String.format("The world %s contains pre-update modding data", saveName), this.width / 2, 50, 16777215);
|
||||
this.drawCenteredString(this.fontRenderer, String.format("There may be problems updating it to this version"), this.width / 2, 70, 16777215);
|
||||
this.drawCenteredString(this.fontRenderer, String.format("FML will save a zip to %s", zip.getName()), this.width / 2, 90, 16777215);
|
||||
this.drawCenteredString(this.fontRenderer, String.format("Do you wish to continue loading?"), this.width / 2, 110, 16777215);
|
||||
int k;
|
||||
|
||||
for (k = 0; k < this.buttonList.size(); ++k)
|
||||
{
|
||||
this.buttonList.get(k).drawButton(this.mc, mouseX, mouseY, partialTicks);
|
||||
}
|
||||
|
||||
for (k = 0; k < this.labelList.size(); ++k)
|
||||
{
|
||||
this.labelList.get(k).drawLabel(this.mc, mouseX, mouseY);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton button)
|
||||
{
|
||||
if (button.id == 1)
|
||||
{
|
||||
FMLClientHandler.instance().showGuiScreen(parent);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOGGER.info("Capturing current state of world {} into file {}", saveName, zip.getAbsolutePath());
|
||||
try
|
||||
{
|
||||
String skip = System.getProperty("fml.doNotBackup");
|
||||
if (skip == null || !"true".equals(skip))
|
||||
{
|
||||
ZipperUtil.zip(new File(FMLClientHandler.instance().getSavesDir(), dirName), zip);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int x = 0; x < 10; x++)
|
||||
LOGGER.fatal("!!!!!!!!!! UPDATING WORLD WITHOUT DOING BACKUP !!!!!!!!!!!!!!!!");
|
||||
}
|
||||
} catch (IOException e)
|
||||
{
|
||||
LOGGER.warn("There was a problem saving the backup {}. Please fix and try again", zip.getName(), e);
|
||||
FMLClientHandler.instance().showGuiScreen(new GuiBackupFailed(parent, zip));
|
||||
return;
|
||||
}
|
||||
FMLClientHandler.instance().showGuiScreen(null);
|
||||
|
||||
try
|
||||
{
|
||||
mc.launchIntegratedServer(dirName, saveName, null);
|
||||
}
|
||||
catch (StartupQuery.AbortedException e)
|
||||
{
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
Loading…
Reference in a new issue