1
0
forked from xjboss/KCauldronX
KCauldronX/patches/cpw/mods/fml/common/registry/GameData.java.patch

70 lines
2.4 KiB
Diff
Raw Normal View History

2015-03-22 17:38:04 +00:00
--- ../src-base/minecraft/cpw/mods/fml/common/registry/GameData.java
+++ ../src-work/minecraft/cpw/mods/fml/common/registry/GameData.java
@@ -14,7 +14,9 @@
import java.io.File;
import java.io.IOException;
+import java.util.ArrayList;
import java.util.BitSet;
+import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
2016-01-05 06:54:34 +00:00
@@ -1036,4 +1038,56 @@
2015-03-22 17:38:04 +00:00
throw new RuntimeException("WHAT?");
}
}
+
+ // Cauldron start
+ public static void injectItemBukkitMaterials()
+ {
+ FMLControlledNamespacedRegistry<Item> itemRegistry = getItemRegistry();
+ List<Integer> ids = new ArrayList<Integer>();
+
+ for (Item thing : itemRegistry.typeSafeIterable())
+ {
+ ids.add(itemRegistry.getId(thing));
+ }
+
+ // sort by id
+ Collections.sort(ids);
+
+ for (int id : ids)
+ {
+ Item item = itemRegistry.getRaw(id);
+ // inject item materials into Bukkit for FML
+ org.bukkit.Material material = org.bukkit.Material.addMaterial(id, itemRegistry.getNameForObject(item), false);
2017-06-27 06:28:50 +00:00
+ if (material != null && net.minecraft.server.MinecraftServer.kcauldronConfig.loggingMaterialInjection.getValue())
2015-03-22 17:38:04 +00:00
+ {
+ FMLLog.info("Injected new Forge item material %s with ID %d.", material.name(), material.getId());
+ }
+ }
+ }
+
+ public static void injectBlockBukkitMaterials()
+ {
+ FMLControlledNamespacedRegistry<Block> blockRegistry = getBlockRegistry();
+ List<Integer> ids = new ArrayList<Integer>();
+
+ for (Block block : blockRegistry.typeSafeIterable())
+ {
+ ids.add(blockRegistry.getId(block));
+ }
+
+ // sort by id
+ Collections.sort(ids);
+
+ for (int id : ids)
+ {
+ Block block = blockRegistry.getRaw(id);
+ // inject block materials into Bukkit for FML
+ org.bukkit.Material material = org.bukkit.Material.addMaterial(id, blockRegistry.getNameForObject(block), true);
2017-06-27 06:28:50 +00:00
+ if (material != null && net.minecraft.server.MinecraftServer.kcauldronConfig.loggingMaterialInjection.getValue())
2015-03-22 17:38:04 +00:00
+ {
+ FMLLog.info("Injected new Forge block material %s with ID %d.", material.name(), material.getId());
+ }
+ }
+ }
+ // Cauldron end
}