mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-19 11:59:25 +00:00
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes: Almost all int x, int y, int z parameters have been changed to BlockPos class ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing. All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it. Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated. As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format. Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata. Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
This commit is contained in:
1 parent
0e91787efb
commit
53659fca06
410 files changed
+8717
-14103
No files matched your search
@@ -1,7 +1,7 @@
|
||||
package net.minecraftforge.common;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -47,27 +47,23 @@ public class ChestGenHooks
|
||||
}
|
||||
|
||||
hasInit = true;
|
||||
// This causes the classes static initializers to run
|
||||
new WorldGenDungeons();
|
||||
new DesertPyramid();
|
||||
new JunglePyramid();
|
||||
new StructureMineshaftPieces();
|
||||
new StructureOceanMonument();
|
||||
new StructureStrongholdPieces.ChestCorridor();
|
||||
new StructureStrongholdPieces.Library();
|
||||
new StructureStrongholdPieces.RoomCrossing();
|
||||
new StructureVillagePieces.House2();
|
||||
WorldServer.fillChestHook();
|
||||
}
|
||||
|
||||
addInfo(MINESHAFT_CORRIDOR, StructureMineshaftPieces.mineshaftChestContents, 3, 7);
|
||||
addInfo(PYRAMID_DESERT_CHEST, DesertPyramid.itemsToGenerateInTemple, 2, 7);
|
||||
addInfo(PYRAMID_JUNGLE_CHEST, JunglePyramid.junglePyramidsChestContents, 2, 7);
|
||||
addInfo(PYRAMID_JUNGLE_DISPENSER, JunglePyramid.junglePyramidsDispenserContents, 2, 2);
|
||||
addInfo(STRONGHOLD_CORRIDOR, ChestCorridor.strongholdChestContents, 2, 4);
|
||||
addInfo(STRONGHOLD_LIBRARY, Library.strongholdLibraryChestContents, 1, 5);
|
||||
addInfo(STRONGHOLD_CROSSING, RoomCrossing.strongholdRoomCrossingChestContents, 1, 5);
|
||||
addInfo(VILLAGE_BLACKSMITH, House2.villageBlacksmithChestContents, 3, 9);
|
||||
addInfo(BONUS_CHEST, WorldServer.bonusChestContent, 10, 10);
|
||||
addInfo(DUNGEON_CHEST, WorldGenDungeons.field_111189_a, 8, 8);
|
||||
|
||||
ItemStack book = new ItemStack(Items.enchanted_book, 1, 0);
|
||||
WeightedRandomChestContent tmp = new WeightedRandomChestContent(book, 1, 1, 1);
|
||||
getInfo(MINESHAFT_CORRIDOR ).addItem(tmp);
|
||||
getInfo(PYRAMID_DESERT_CHEST).addItem(tmp);
|
||||
getInfo(PYRAMID_JUNGLE_CHEST).addItem(tmp);
|
||||
getInfo(STRONGHOLD_CORRIDOR ).addItem(tmp);
|
||||
getInfo(STRONGHOLD_LIBRARY ).addItem(new WeightedRandomChestContent(book, 1, 5, 2));
|
||||
getInfo(STRONGHOLD_CROSSING ).addItem(tmp);
|
||||
getInfo(DUNGEON_CHEST ).addItem(tmp);
|
||||
// INTERNAL DO NO USE
|
||||
public static void init(String category, List items, int min, int max)
|
||||
{
|
||||
chestInfo.put(category, new ChestGenHooks(category, (List<WeightedRandomChestContent>)items, min, max));
|
||||
}
|
||||
|
||||
static void addDungeonLoot(ChestGenHooks dungeon, ItemStack item, int weight, int min, int max)
|
||||
@@ -75,11 +71,6 @@ public class ChestGenHooks
|
||||
dungeon.addItem(new WeightedRandomChestContent(item, min, max, weight));
|
||||
}
|
||||
|
||||
private static void addInfo(String category, WeightedRandomChestContent[] items, int min, int max)
|
||||
{
|
||||
chestInfo.put(category, new ChestGenHooks(category, items, min, max));
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves, or creates the info class for the specified category.
|
||||
*
|
||||
@@ -134,7 +125,7 @@ public class ChestGenHooks
|
||||
}
|
||||
|
||||
//shortcut functions, See the non-static versions below
|
||||
public static WeightedRandomChestContent[] getItems(String category, Random rnd){ return getInfo(category).getItems(rnd); }
|
||||
public static List<WeightedRandomChestContent> getItems(String category, Random rnd){ return getInfo(category).getItems(rnd); }
|
||||
public static int getCount(String category, Random rand){ return getInfo(category).getCount(rand); }
|
||||
public static void addItem(String category, WeightedRandomChestContent item){ getInfo(category).addItem(item); }
|
||||
public static void removeItem(String category, ItemStack item){ getInfo(category).removeItem(item); }
|
||||
@@ -150,7 +141,7 @@ public class ChestGenHooks
|
||||
this.category = category;
|
||||
}
|
||||
|
||||
public ChestGenHooks(String category, WeightedRandomChestContent[] items, int min, int max)
|
||||
public ChestGenHooks(String category, List<WeightedRandomChestContent> items, int min, int max)
|
||||
{
|
||||
this(category);
|
||||
for (WeightedRandomChestContent item : items)
|
||||
@@ -195,7 +186,7 @@ public class ChestGenHooks
|
||||
*
|
||||
* @return The random objects
|
||||
*/
|
||||
public WeightedRandomChestContent[] getItems(Random rnd)
|
||||
public List<WeightedRandomChestContent> getItems(Random rnd)
|
||||
{
|
||||
ArrayList<WeightedRandomChestContent> ret = new ArrayList<WeightedRandomChestContent>();
|
||||
|
||||
@@ -213,7 +204,7 @@ public class ChestGenHooks
|
||||
}
|
||||
}
|
||||
|
||||
return ret.toArray(new WeightedRandomChestContent[ret.size()]);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -236,8 +227,7 @@ public class ChestGenHooks
|
||||
*/
|
||||
public ItemStack getOneItem(Random rand)
|
||||
{
|
||||
WeightedRandomChestContent[] items = getItems(rand);
|
||||
WeightedRandomChestContent item = (WeightedRandomChestContent)WeightedRandom.getRandomItem(rand, items);
|
||||
WeightedRandomChestContent item = (WeightedRandomChestContent)WeightedRandom.getRandomItem(rand, getItems(rand));
|
||||
ItemStack[] stacks = ChestGenHooks.generateStacks(rand, item.theItemId, item.theMinimumChanceToGenerateItem, item.theMaximumChanceToGenerateItem);
|
||||
return (stacks.length > 0 ? stacks[0] : null);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user