Inital patch update for 1.7.2, Doesn't compile, not done yet.

This commit is contained in:
Lex Manos committed 2013-12-22 03:06:10 -08:00
1 parent cd34090eb8
commit a6c45a7ade
273 files changed
+6887 -8037

No files matched your search

@@ -213,7 +213,7 @@ public class BiomeDictionary
if (biome.theBiomeDecorator instanceof DeferredBiomeDecorator)
{
DeferredBiomeDecorator decorator = (DeferredBiomeDecorator) biome.theBiomeDecorator;
decorator.fireCreateEventAndReplace();
decorator.fireCreateEventAndReplace(biome);
}
checkRegistration(biome);
@@ -38,17 +38,17 @@ public class BiomeManager
public static void addStrongholdBiome(BiomeGenBase biome)
{
if (!MapGenStronghold.allowedBiomes.contains(biome))
if (!MapGenStronghold.field_151546_e.contains(biome))
{
MapGenStronghold.allowedBiomes.add(biome);
MapGenStronghold.field_151546_e.add(biome);
}
}
public static void removeStrongholdBiome(BiomeGenBase biome)
{
if (MapGenStronghold.allowedBiomes.contains(biome))
if (MapGenStronghold.field_151546_e.contains(biome))
{
MapGenStronghold.allowedBiomes.remove(biome);
MapGenStronghold.field_151546_e.remove(biome);
}
}
@@ -1,26 +0,0 @@
package net.minecraftforge.common;
import net.minecraft.block.Block;
public class BlockExtension
{
/**
* The Block that this extension object is associated with
*/
public final Block owner;
/**
* Determines wither or not a enderman can pickup and move this block.
*/
public boolean carriable = false;
public BlockExtension(Block owner)
{
if (MinecraftForge.getBlockExtension(owner, false) != null)
{
throw new IllegalArgumentException(owner + " already has an extension object allocated");
}
this.owner = owner;
}
}
@@ -12,7 +12,8 @@ import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.concurrent.ConcurrentMap;
import java.util.logging.Level;
import org.apache.logging.log4j.Level;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.HashMultiset;
@@ -26,7 +27,6 @@ import com.google.common.collect.Sets;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.FMLLog;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.server.MinecraftServer;
import net.minecraft.world.ChunkCoordIntPair;
@@ -251,7 +251,7 @@ public class DimensionManager
ISaveHandler savehandler = overworld.getSaveHandler();
WorldSettings worldSettings = new WorldSettings(overworld.getWorldInfo());
WorldServer world = (dim == 0 ? overworld : new WorldServerMulti(mcServer, savehandler, overworld.getWorldInfo().getWorldName(), dim, worldSettings, overworld, mcServer.theProfiler, overworld.getWorldLogAgent()));
WorldServer world = (dim == 0 ? overworld : new WorldServerMulti(mcServer, savehandler, overworld.getWorldInfo().getWorldName(), dim, worldSettings, overworld, mcServer.theProfiler));
world.addWorldAccess(new WorldManager(mcServer, world));
MinecraftForge.EVENT_BUS.post(new WorldEvent.Load(world));
if (!mcServer.isSinglePlayer())
@@ -259,7 +259,7 @@ public class DimensionManager
world.getWorldInfo().setGameType(mcServer.getGameType());
}
mcServer.setDifficultyForAllWorlds(mcServer.getDifficulty());
mcServer.func_147139_a(mcServer.func_147135_j());
}
public static WorldServer getWorld(int id)
@@ -308,7 +308,7 @@ public class DimensionManager
}
catch (Exception e)
{
FMLCommonHandler.instance().getFMLLogger().log(Level.SEVERE,String.format("An error occured trying to create an instance of WorldProvider %d (%s)",
FMLCommonHandler.instance().getFMLLogger().log(Level.ERROR, String.format("An error occured trying to create an instance of WorldProvider %d (%s)",
dim, providers.get(getProviderType(dim)).getSimpleName()),e);
throw new RuntimeException(e);
}
@@ -11,7 +11,8 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.logging.Level;
import org.apache.logging.log4j.Level;
import com.google.common.base.Supplier;
import com.google.common.base.Suppliers;
@@ -219,7 +220,7 @@ public class ForgeChunkManager
}
else
{
FMLLog.log(Level.SEVERE, "Attempt to create a player ticket without a valid player");
FMLLog.log(Level.ERROR, "Attempt to create a player ticket without a valid player");
throw new RuntimeException();
}
}
@@ -422,7 +423,7 @@ public class ForgeChunkManager
}
catch (IOException e)
{
FMLLog.log(Level.WARNING, e, "Unable to read forced chunk data at %s - it will be ignored", chunkLoaderData.getAbsolutePath());
FMLLog.log(Level.WARN, e, "Unable to read forced chunk data at %s - it will be ignored", chunkLoaderData.getAbsolutePath());
return;
}
NBTTagList ticketList = forcedChunkData.func_150295_c("TicketList", 9);
@@ -628,7 +629,7 @@ public class ForgeChunkManager
ModContainer mc = getContainer(mod);
if (mc == null)
{
FMLLog.log(Level.SEVERE, "Failed to locate the container for mod instance %s (%s : %x)", mod, mod.getClass().getName(), System.identityHashCode(mod));
FMLLog.log(Level.ERROR, "Failed to locate the container for mod instance %s (%s : %x)", mod, mod.getClass().getName(), System.identityHashCode(mod));
return null;
}
if (playerTickets.get(player).size()>playerTicketLength)
@@ -654,7 +655,7 @@ public class ForgeChunkManager
ModContainer container = getContainer(mod);
if (container == null)
{
FMLLog.log(Level.SEVERE, "Failed to locate the container for mod instance %s (%s : %x)", mod, mod.getClass().getName(), System.identityHashCode(mod));
FMLLog.log(Level.ERROR, "Failed to locate the container for mod instance %s (%s : %x)", mod, mod.getClass().getName(), System.identityHashCode(mod));
return null;
}
String modId = container.getModId();
@@ -874,7 +875,7 @@ public class ForgeChunkManager
}
catch (IOException e)
{
FMLLog.log(Level.WARNING, e, "Unable to write forced chunk data to %s - chunkloading won't work", chunkLoaderData.getAbsolutePath());
FMLLog.log(Level.WARN, e, "Unable to write forced chunk data to %s - chunkloading won't work", chunkLoaderData.getAbsolutePath());
return;
}
}
@@ -936,7 +937,7 @@ public class ForgeChunkManager
dest.delete();
}
cfgFile.renameTo(dest);
FMLLog.log(Level.SEVERE, e, "A critical error occured reading the forgeChunkLoading.cfg file, defaults will be used - the invalid file is backed up at forgeChunkLoading.cfg.bak");
FMLLog.log(Level.ERROR, e, "A critical error occured reading the forgeChunkLoading.cfg file, defaults will be used - the invalid file is backed up at forgeChunkLoading.cfg.bak");
}
config.addCustomCategoryComment("defaults", "Default configuration for forge chunk loading control");
Property maxTicketCount = config.get("defaults", "maximumTicketCount", 200);
@@ -5,11 +5,13 @@ import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Random;
import java.util.Set;
import cpw.mods.fml.common.eventhandler.Event;
import cpw.mods.fml.relauncher.ReflectionHelper;
import net.minecraft.block.Block;
import net.minecraft.block.BlockFlower;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
@@ -22,18 +24,25 @@ import net.minecraft.inventory.Container;
import net.minecraft.item.Item;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemAxe;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemPickaxe;
import net.minecraft.item.ItemSpade;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemSword;
import net.minecraft.network.NetHandlerPlayServer;
import net.minecraft.network.Packet;
import net.minecraft.network.play.server.S23PacketBlockChange;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.MovingObjectPosition.MovingObjectType;
import net.minecraft.util.WeightedRandom;
import net.minecraft.world.World;
import net.minecraft.world.WorldSettings.GameType;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.event.ForgeEventFactory;
import net.minecraftforge.event.ServerChatEvent;
import net.minecraftforge.event.entity.item.ItemTossEvent;
@@ -47,6 +56,7 @@ import net.minecraftforge.event.entity.living.LivingHurtEvent;
import net.minecraftforge.event.entity.living.LivingSetAttackTargetEvent;
import net.minecraftforge.event.entity.player.PlayerOpenContainerEvent;
import net.minecraftforge.event.world.BlockEvent;
import static net.minecraft.init.Blocks.*;
public class ForgeHooks
{
@@ -74,14 +84,21 @@ public class ForgeHooks
static final List<GrassEntry> grassList = new ArrayList<GrassEntry>();
static final List<SeedEntry> seedList = new ArrayList<SeedEntry>();
public static void plantGrass(World world, int x, int y, int z)
public static void plantGrass(World world, Random rand, int x, int y, int z)
{
BiomeGenBase biome = world.getBiomeGenForCoords(x, z);
String flowername = biome.func_150572_a(rand, x, y, z);
/*
field_149992_a.debug("Flower in " + p_149853_1_.getBiomeGenForCoords(i1, k1).biomeName + ": " + s);
BlockFlower blockflower = BlockFlower.func_149857_e(s);
*/
GrassEntry grass = (GrassEntry)WeightedRandom.getRandomItem(world.rand, grassList);
if (grass == null || grass.block == null || !grass.block.canBlockStay(world, x, y, z))
if (grass == null || grass.block == null || !grass.block.func_149718_j(world, x, y, z))
{
return;
}
world.setBlock(x, y, z, grass.block, grass.metadata, 3);
world.func_147465_d(x, y, z, grass.block, grass.metadata, 3);
}
public static ItemStack getGrassSeed(World world)
@@ -95,64 +112,42 @@ public class ForgeHooks
}
private static boolean toolInit = false;
static HashMap<Item, List> toolClasses = new HashMap<Item, List>();
static HashMap<List, Integer> toolHarvestLevels = new HashMap<List, Integer>();
static HashSet<List> toolEffectiveness = new HashSet<List>();
public static boolean canHarvestBlock(Block block, EntityPlayer player, int metadata)
{
if (block.blockMaterial.isToolNotRequired())
if (block.func_149688_o().isToolNotRequired())
{
return true;
}
ItemStack stack = player.inventory.getCurrentItem();
if (stack == null)
String tool = block.getHarvestTool(metadata);
if (stack == null || tool == null)
{
return player.canHarvestBlock(block);
return player.func_146099_a(block);
}
List info = toolClasses.get(stack.getItem());
if (info == null)
int toolLevel = stack.getItem().getHarvestLevel(stack, tool);
if (toolLevel < 0)
{
return player.canHarvestBlock(block);
return player.func_146099_a(block);
}
Object[] tmp = info.toArray();
String toolClass = (String)tmp[0];
int harvestLevel = (Integer)tmp[1];
Integer blockHarvestLevel = toolHarvestLevels.get(Arrays.asList(block, metadata, toolClass));
if (blockHarvestLevel == null)
{
return player.canHarvestBlock(block);
}
if (blockHarvestLevel > harvestLevel)
{
return false;
}
return true;
return toolLevel >= block.getHarvestLevel(metadata);
}
public static boolean canToolHarvestBlock(Block block, int metadata, ItemStack stack)
{
if (stack == null) return false;
List info = toolClasses.get(stack.getItem());
if (info == null) return false;
Object[] tmp = info.toArray();
String toolClass = (String)tmp[0];
int harvestLevel = (Integer)tmp[1];
Integer blockHarvestLevel = toolHarvestLevels.get(Arrays.asList(block, metadata, toolClass));
return !(blockHarvestLevel == null || blockHarvestLevel > harvestLevel);
String tool = block.getHarvestTool(metadata);
if (stack == null || tool == null) return false;
return stack.getItem().getHarvestLevel(stack, tool) >= block.getHarvestLevel(metadata);
}
public static float blockStrength(Block block, EntityPlayer player, World world, int x, int y, int z)
{
int metadata = world.getBlockMetadata(x, y, z);
float hardness = block.getBlockHardness(world, x, y, z);
float hardness = block.func_149712_f(world, x, y, z);
if (hardness < 0.0F)
{
return 0.0F;
@@ -160,19 +155,22 @@ public class ForgeHooks
if (!canHarvestBlock(block, player, metadata))
{
float speed = ForgeEventFactory.getBreakSpeed(player, block, metadata, 1.0f);
return (speed < 0 ? 0 : speed) / hardness / 100F;
return player.getBreakSpeed(block, true, metadata) / hardness / 100F;
}
else
{
return player.getCurrentPlayerStrVsBlock(block, false, metadata) / hardness / 30F;
return player.getBreakSpeed(block, false, metadata) / hardness / 30F;
}
}
public static boolean isToolEffective(ItemStack stack, Block block, int metadata)
{
List toolClass = toolClasses.get(stack.getItem());
return toolClass != null && toolEffectiveness.contains(Arrays.asList(block, metadata, toolClass.get(0)));
for (String type : stack.getItem().getToolClasses(stack))
{
if (block.isToolEffective(type, metadata))
return true;
}
return false;
}
static void initTools()
@@ -183,55 +181,33 @@ public class ForgeHooks
}
toolInit = true;
MinecraftForge.setToolClass(Items.wooden_pickaxe, "pickaxe", 0);
MinecraftForge.setToolClass(Items.stone_pickaxe, "pickaxe", 1);
MinecraftForge.setToolClass(Items.iron_pickaxe, "pickaxe", 2);
MinecraftForge.setToolClass(Items.golden_pickaxe, "pickaxe", 0);
MinecraftForge.setToolClass(Items.diamond_pickaxe, "pickaxe", 3);
MinecraftForge.setToolClass(Items.wooden_axe, "axe", 0);
MinecraftForge.setToolClass(Items.stone_axe, "axe", 1);
MinecraftForge.setToolClass(Items.iron_axe, "axe", 2);
MinecraftForge.setToolClass(Items.golden_axe, "axe", 0);
MinecraftForge.setToolClass(Items.diamond_axe, "axe", 3);
MinecraftForge.setToolClass(Items.wooden_shovel, "shovel", 0);
MinecraftForge.setToolClass(Items.stone_shovel, "shovel", 1);
MinecraftForge.setToolClass(Items.iron_shovel, "shovel", 2);
MinecraftForge.setToolClass(Items.golden_shovel, "shovel", 0);
MinecraftForge.setToolClass(Items.diamond_shovel, "shovel", 3);
Set<Block> blocks = ReflectionHelper.getPrivateValue(ItemPickaxe.class, null, 0);
for (Block block : blocks)
{
MinecraftForge.setBlockHarvestLevel(block, "pickaxe", 0);
block.setHarvestLevel("pickaxe", 0);
}
blocks = ReflectionHelper.getPrivateValue(ItemSpade.class, null, 0);
for (Block block : blocks)
{
MinecraftForge.setBlockHarvestLevel(block, "shovel", 0);
block.setHarvestLevel("shovel", 0);
}
blocks = ReflectionHelper.getPrivateValue(ItemAxe.class, null, 0);
for (Block block : blocks)
{
MinecraftForge.setBlockHarvestLevel(block, "axe", 0);
block.setHarvestLevel("axe", 0);
}
MinecraftForge.setBlockHarvestLevel(Blocks.obsidian, "pickaxe", 3);
MinecraftForge.setBlockHarvestLevel(Blocks.emerald_ore, "pickaxe", 2);
MinecraftForge.setBlockHarvestLevel(Blocks.emerald_block, "pickaxe", 2);
MinecraftForge.setBlockHarvestLevel(Blocks.diamond_ore, "pickaxe", 2);
MinecraftForge.setBlockHarvestLevel(Blocks.diamond_block, "pickaxe", 2);
MinecraftForge.setBlockHarvestLevel(Blocks.gold_ore, "pickaxe", 2);
MinecraftForge.setBlockHarvestLevel(Blocks.gold_block, "pickaxe", 2);
MinecraftForge.setBlockHarvestLevel(Blocks.iron_ore, "pickaxe", 1);
MinecraftForge.setBlockHarvestLevel(Blocks.iron_block, "pickaxe", 1);
MinecraftForge.setBlockHarvestLevel(Blocks.lapis_ore, "pickaxe", 1);
MinecraftForge.setBlockHarvestLevel(Blocks.lapis_block, "pickaxe", 1);
MinecraftForge.setBlockHarvestLevel(Blocks.redstone_ore, "pickaxe", 2);
MinecraftForge.setBlockHarvestLevel(Blocks.lit_redstone_ore, "pickaxe", 2);
Blocks.obsidian.setHarvestLevel("pickaxe", 3);
for (Block block : new Block[]{emerald_ore, emerald_block, diamond_ore, diamond_block, gold_ore, gold_block, redstone_ore, lit_redstone_ore})
{
block.setHarvestLevel("pickaxe", 2);
}
Blocks.iron_ore.setHarvestLevel("pickaxe", 1);
Blocks.iron_block.setHarvestLevel("pickaxe", 1);
Blocks.lapis_ore.setHarvestLevel("pickaxe", 1);
Blocks.lapis_block.setHarvestLevel("pickaxe", 1);
MinecraftForge.removeBlockEffectiveness(Blocks.redstone_ore, "pickaxe");
MinecraftForge.removeBlockEffectiveness(Blocks.obsidian, "pickaxe");
MinecraftForge.removeBlockEffectiveness(Blocks.lit_redstone_ore, "pickaxe");
@@ -271,23 +247,23 @@ public class ForgeHooks
ItemStack result = null;
boolean isCreative = player.capabilities.isCreativeMode;
if (target.typeOfHit == EnumMovingObjectType.TILE)
if (target.typeOfHit == MovingObjectType.BLOCK)
{
int x = target.blockX;
int y = target.blockY;
int z = target.blockZ;
Block var8 = world.func_147439_a(x, y, z);
Block block = world.func_147439_a(x, y, z);
if (var8 == null)
if (block.isAir(world, x, y, z))
{
return false;
}
result = var8.getPickBlock(target, world, x, y, z);
result = block.getPickBlock(target, world, x, y, z);
}
else
{
if (target.typeOfHit != EnumMovingObjectType.ENTITY || target.entityHit == null || !isCreative)
if (target.typeOfHit != MovingObjectType.ENTITY || target.entityHit == null || !isCreative)
{
return false;
}
@@ -401,10 +377,10 @@ public class ForgeHooks
MinecraftForge.EVENT_BUS.post(new LivingJumpEvent(entity));
}
public static EntityItem onPlayerTossEvent(EntityPlayer player, ItemStack item)
public static EntityItem onPlayerTossEvent(EntityPlayer player, ItemStack item, boolean includeName)
{
player.captureDrops = true;
EntityItem ret = player.dropPlayerItemWithRandomChoice(item, false);
EntityItem ret = player.func_146097_a(item, false, includeName);
player.capturedDrops.clear();
player.captureDrops = false;
@@ -425,18 +401,12 @@ public class ForgeHooks
public static float getEnchantPower(World world, int x, int y, int z)
{
if (world.isAirBlock(x, y, z))
{
return 0;
}
Block block = world.func_147439_a(x, y, z);
return (block == null ? 0 : block.getEnchantPowerBonus(world, x, y, z));
return world.func_147439_a(x, y, z).getEnchantPowerBonus(world, x, y, z);
}
public static ChatMessageComponent onServerChatEvent(NetServerHandler net, String raw, ChatMessageComponent comp)
public static ChatComponentTranslation onServerChatEvent(NetHandlerPlayServer net, String raw, ChatComponentTranslation comp)
{
ServerChatEvent event = new ServerChatEvent(net.playerEntity, raw, comp);
ServerChatEvent event = new ServerChatEvent(net.field_147369_b, raw, comp);
if (MinecraftForge.EVENT_BUS.post(event))
{
return null;
@@ -451,7 +421,7 @@ public class ForgeHooks
return event.getResult() == Event.Result.DEFAULT ? event.canInteractWith : event.getResult() == Event.Result.ALLOW ? true : false;
}
public static BlockEvent.BreakEvent onBlockBreakEvent(World world, EnumGameType gameType, EntityPlayerMP entityPlayer, int x, int y, int z)
public static BlockEvent.BreakEvent onBlockBreakEvent(World world, GameType gameType, EntityPlayerMP entityPlayer, int x, int y, int z)
{
// Logic from tryHarvestBlock for pre-canceling the event
boolean preCancelEvent = false;
@@ -465,12 +435,12 @@ public class ForgeHooks
}
// Tell client the block is gone immediately then process events
if (world.getBlockTileEntity(x, y, z) == null)
if (world.func_147438_o(x, y, z) == null)
{
Packet53BlockChange packet = new Packet53BlockChange(x, y, z, world);
packet.type = 0;
packet.metadata = 0;
entityPlayer.playerNetServerHandler.sendPacketToPlayer(packet);
S23PacketBlockChange packet = new S23PacketBlockChange(x, y, z, world);
packet.field_148883_d = Blocks.air;
packet.field_148884_e = 0;
entityPlayer.playerNetServerHandler.func_147359_a(packet);
}
// Post the block break event
@@ -484,16 +454,16 @@ public class ForgeHooks
if (event.isCanceled())
{
// Let the client know the block still exists
entityPlayer.playerNetServerHandler.sendPacketToPlayer(new Packet53BlockChange(x, y, z, world));
entityPlayer.playerNetServerHandler.func_147359_a(new S23PacketBlockChange(x, y, z, world));
// Update any tile entity data for this block
TileEntity tileentity = world.getBlockTileEntity(x, y, z);
TileEntity tileentity = world.func_147438_o(x, y, z);
if (tileentity != null)
{
Packet pkt = tileentity.func_145844_m();
if (pkt != null)
{
entityPlayer.playerNetServerHandler.sendPacketToPlayer(pkt);
entityPlayer.playerNetServerHandler.func_147359_a(pkt);
}
}
}
@@ -39,9 +39,9 @@ public class ForgeInternalHandler
Item item = stack.getItem();
if (item == null)
{
FMLLog.warning("Attempted to add a EntityItem to the world with a invalid item: ID %d at " +
FMLLog.warning("Attempted to add a EntityItem to the world with a invalid item at " +
"(%2.2f, %2.2f, %2.2f), this is most likely a config issue between you and the server. Please double check your configs",
stack.itemID, entity.posX, entity.posY, entity.posZ);
entity.posX, entity.posY, entity.posZ);
entity.setDead();
event.setCanceled(true);
return;
@@ -11,6 +11,7 @@ import java.util.Arrays;
import java.util.Map;
import java.util.logging.Level;
import net.minecraft.init.Blocks;
import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.storage.SaveHandler;
@@ -35,6 +36,7 @@ import cpw.mods.fml.common.ModMetadata;
import cpw.mods.fml.common.WorldAccessContainer;
import cpw.mods.fml.common.event.FMLConstructionEvent;
import cpw.mods.fml.common.event.FMLLoadCompleteEvent;
import cpw.mods.fml.common.event.FMLModIdMappingEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.event.FMLServerStartingEvent;
@@ -50,7 +52,7 @@ public class ForgeModContainer extends DummyModContainer implements WorldAccessC
public static boolean forceDuplicateFluidBlockCrash = true;
public static boolean fullBoundingBoxLadders = false;
public static double zombieSummonBaseChance = 0.1;
public static int[] blendRanges = { 20, 15, 10, 5 };
public static int[] blendRanges = { 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32 };
public static float zombieBabyChance = 0.05f;
public static boolean shouldSortRecipies = false;
@@ -141,7 +143,7 @@ public class ForgeModContainer extends DummyModContainer implements WorldAccessC
FMLLog.warning("Disabling forced crashes on duplicate Fluid Blocks - USE AT YOUR OWN RISK");
}
prop = config.get(Configuration.CATEGORY_GENERAL, "biomeSkyBlendRange", new int[] { 20, 15, 10, 5 });
prop = config.get(Configuration.CATEGORY_GENERAL, "biomeSkyBlendRange", new int[] { 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32 });
prop.comment = "Control the range of sky blending for colored skies in biomes.";
blendRanges = prop.getIntList();
@@ -222,6 +224,13 @@ public class ForgeModContainer extends DummyModContainer implements WorldAccessC
}
}
@Subscribe
public void mappingChanged(FMLModIdMappingEvent evt)
{
Blocks.fire.rebuildFireInfo();
}
@Override
public File getSource()
{
@@ -1,10 +1,12 @@
package net.minecraftforge.common;
import net.minecraft.block.Block;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public interface IPlantable
{
public EnumPlantType getPlantType(World world, int x, int y, int z);
public int getPlantID(World world, int x, int y, int z);
public int getPlantMetadata(World world, int x, int y, int z);
public EnumPlantType getPlantType(IBlockAccess world, int x, int y, int z);
public Block getPlant(IBlockAccess world, int x, int y, int z);
public int getPlantMetadata(IBlockAccess world, int x, int y, int z);
}
@@ -5,7 +5,7 @@ import java.util.ArrayList;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import net.minecraft.world.IBlockAccess;
/**
*
@@ -28,7 +28,7 @@ public interface IShearable
* @param z The Z Position
* @return If this is shearable, and onSheared should be called.
*/
public boolean isShearable(ItemStack item, World world, int x, int y, int z);
public boolean isShearable(ItemStack item, IBlockAccess world, int x, int y, int z);
/**
* Performs the shear function on this object.
@@ -49,5 +49,5 @@ public interface IShearable
* @param fortune The fortune level of the shears being used
* @return A ArrayList containing all items from this shearing. Possible to be null.
*/
public ArrayList<ItemStack> onSheared(ItemStack item, World world, int x, int y, int z, int fortune);
public ArrayList<ItemStack> onSheared(ItemStack item, IBlockAccess world, int x, int y, int z, int fortune);
}
@@ -19,7 +19,6 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.ForgeHooks.GrassEntry;
import net.minecraftforge.common.ForgeHooks.SeedEntry;
import net.minecraftforge.common.util.IdentityMap;
import net.minecraftforge.event.entity.EntityEvent;
import net.minecraftforge.oredict.OreDictionary;
@@ -38,8 +37,6 @@ public class MinecraftForge
public static final EventBus ORE_GEN_BUS = new EventBus();
private static final ForgeInternalHandler INTERNAL_HANDLER = new ForgeInternalHandler();
private static final IdentityMap<Block, BlockExtension> EXTENSION_BLOCK = new IdentityMap<Block, BlockExtension>(4096, 1.0f);
/** Register a new plant to be planted when bonemeal is used on grass.
@@ -65,141 +62,6 @@ public class MinecraftForge
ForgeHooks.seedList.add(new SeedEntry(seed, weight));
}
/**
*
* Register a tool as a tool class with a given harvest level.
*
* @param tool The custom tool to register.
* @param toolClass The tool class to register as. The predefined tool
* clases are "pickaxe", "shovel", "axe". You can add
* others for custom tools.
* @param harvestLevel The harvest level of the tool.
*/
public static void setToolClass(Item tool, String toolClass, int harvestLevel)
{
ForgeHooks.toolClasses.put(tool, Arrays.asList(toolClass, harvestLevel));
}
/**
* Register a block to be harvested by a tool class. This is the metadata
* sensitive version, use it if your blocks are using metadata variants.
* By default, this sets the block class as effective against that type.
*
* @param block The block to register.
* @param metadata The metadata for the block subtype.
* @param toolClass The tool class to register as able to remove this block.
* You may register the same block multiple times with different tool
* classes, if multiple tool types can be used to harvest this block.
* @param harvestLevel The minimum tool harvest level required to successfully
* harvest the block.
* @see MinecraftForge#setToolClass for details on tool classes.
*/
public static void setBlockHarvestLevel(Block block, int metadata, String toolClass, int harvestLevel)
{
List key = Arrays.asList(block, metadata, toolClass);
ForgeHooks.toolHarvestLevels.put(key, harvestLevel);
ForgeHooks.toolEffectiveness.add(key);
}
/**
* Remove a block effectiveness mapping. Since setBlockHarvestLevel
* makes the tool class effective against the block by default, this can be
* used to remove that mapping. This will force a block to be harvested at
* the same speed regardless of tool quality, while still requiring a given
* harvesting level.
*
* @param block The block to remove effectiveness from.
* @param metadata The metadata for the block subtype.
* @param toolClass The tool class to remove the effectiveness mapping from.
* @see MinecraftForge#setToolClass for details on tool classes.
*/
public static void removeBlockEffectiveness(Block block, int metadata, String toolClass)
{
List key = Arrays.asList(block, metadata, toolClass);
ForgeHooks.toolEffectiveness.remove(key);
}
/**
* Register a block to be harvested by a tool class.
* By default, this sets the block class as effective against that type.
*
* @param block The block to register.
* @param toolClass The tool class to register as able to remove this block.
* You may register the same block multiple times with different tool
* classes, if multiple tool types can be used to harvest this block.
* @param harvestLevel The minimum tool harvest level required to successfully
* harvest the block.
* @see MinecraftForge#setToolClass for details on tool classes.
*/
public static void setBlockHarvestLevel(Block block, String toolClass, int harvestLevel)
{
for (int metadata = 0; metadata < 16; metadata++)
{
List key = Arrays.asList(block, metadata, toolClass);
ForgeHooks.toolHarvestLevels.put(key, harvestLevel);
ForgeHooks.toolEffectiveness.add(key);
}
}
/**
* Returns the block harvest level for a particular tool class.
*
* @param block The block to check.
* @param metadata The metadata for the block subtype.
* @param toolClass The tool class to check as able to remove this block.
* @see MinecraftForge#setToolClass for details on tool classes.
* @return The harvest level or -1 if no mapping exists.
*/
public static int getBlockHarvestLevel(Block block, int metadata, String toolClass)
{
ForgeHooks.initTools();
List key = Arrays.asList(block, metadata, toolClass);
Integer harvestLevel = ForgeHooks.toolHarvestLevels.get(key);
return (harvestLevel == null ? -1 : harvestLevel);
}
/**
* Remove a block effectiveness mapping. Since setBlockHarvestLevel
* makes the tool class effective against the block by default, this can be
* used to remove that mapping. This will force a block to be harvested at
* the same speed regardless of tool quality, while still requiring a given
* harvesting level.
*
* @param block The block to remove effectiveness from.
* @param toolClass The tool class to remove the effectiveness mapping from.
* @see MinecraftForge#setToolClass for details on tool classes.
*/
public static void removeBlockEffectiveness(Block block, String toolClass)
{
for (int metadata = 0; metadata < 16; metadata++)
{
List key = Arrays.asList(block, metadata, toolClass);
ForgeHooks.toolEffectiveness.remove(key);
}
}
/**
* Gets the associated Extension object for the specified block,
* if guarantee is true, and there is no extension associated, it will
* create a new one and register it.
*
* May return null, unless guarantee is set to true
*
* @param block The block instance
* @param guarantee Wither to create a new extension if one does not exist.
* @return The extension object or null if none is registered and guarantee is false
*/
public static BlockExtension getBlockExtension(Block block, boolean guarantee)
{
BlockExtension ret = EXTENSION_BLOCK.get(block);
if (ret == null && guarantee)
{
ret = new BlockExtension(block);
EXTENSION_BLOCK.put(block, ret);
}
return ret;
}
/**
* Method invoked by FML before any other mods are loaded.
*/
@@ -35,10 +35,12 @@ public class WorldSpecificSaveHandler implements ISaveHandler
@Override public IPlayerFileData getSaveHandler() { return parent.getSaveHandler(); }
@Override public void flush() { parent.flush(); }
@Override public String getWorldDirectoryName() { return parent.getWorldDirectoryName(); }
@Override public File getWorldDirectory() { return parent.getWorldDirectory(); }
@Override
public File getMapFileFromName(String name)
{
return new File(dataDir, name + ".dat");
}
}
@@ -36,23 +36,27 @@ public abstract class ForgeMessage {
@Override
void toBytes(ByteBuf bytes)
{
/*
bytes.writeInt(FluidRegistry.maxID);
for (Map.Entry<String, Integer> entry : FluidRegistry.fluidIDs.entrySet())
{
ByteBufUtils.writeUTF8String(bytes,entry.getKey());
bytes.writeInt(entry.getValue());
}
*/
}
@Override
void fromBytes(ByteBuf bytes)
{
/*
int listSize = bytes.readInt();
for (int i = 0; i < listSize; i++) {
String fluidName = ByteBufUtils.readUTF8String(bytes);
int fluidId = bytes.readInt();
fluidIds.put(fluidName, fluidId);
}
*/
}
}
@@ -1,134 +0,0 @@
package net.minecraftforge.common.util;
import gnu.trove.iterator.TIntObjectIterator;
import gnu.trove.map.hash.TIntIntHashMap;
import gnu.trove.map.hash.TIntObjectHashMap;
import java.util.AbstractMap;
import java.util.AbstractSet;
import java.util.Collection;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
public class IdentityMap<K, V> implements Map<K, V>
{
private TIntObjectHashMap<V> values;
private TIntObjectHashMap<K> keys;
private EntrySet entrySet;
public IdentityMap(int initialCapacity, float loadFactor)
{
keys = new TIntObjectHashMap<K>(initialCapacity, loadFactor, -1);
values = new TIntObjectHashMap<V>(initialCapacity, loadFactor, -1);
}
@Override public int size(){ return values.size(); }
@Override public boolean isEmpty(){ return values.isEmpty(); }
@Override public boolean containsKey(Object key){ return values.containsKey(System.identityHashCode(key)); }
@Override public boolean containsValue(Object value){ return values.containsValue(value); }
@Override public V get(Object key){ return values.get(System.identityHashCode(key)); }
@Override
public V put(K key, V value)
{
int id = System.identityHashCode(key);
keys.put(id, key);
return values.put(id, value);
}
@Override public V remove(Object key)
{
/*
int id = System.identityHashCode(key);
keys.remove(id);
return values.remove(id);
*/
throw new IllegalStateException();
}
@Override
public void putAll(Map<? extends K, ? extends V> m)
{
for (Entry<? extends K, ? extends V> entry : m.entrySet())
{
put(entry.getKey(), entry.getValue());
}
}
@Override
public void clear()
{
/*
keys.clear();
values.clear();
*/
throw new IllegalStateException();
}
@Override
public Set<K> keySet()
{
return new TreeSet<K>(keys.valueCollection());
}
@Override
public Collection<V> values()
{
return values.valueCollection();
}
@Override
public Set<Entry<K, V>> entrySet()
{
if (entrySet == null) entrySet = new EntrySet();
return entrySet;
}
private class EntrySet extends AbstractSet<Entry<K,V>>
{
@Override
public Iterator<Entry<K, V>> iterator()
{
return new EntryIterator(keys.iterator());
}
@Override
public int size()
{
return keys.size();
}
}
private class EntryIterator implements Iterator<Entry<K, V>>
{
private TIntObjectIterator<K> itr;
private int last = -1;
private EntryIterator(TIntObjectIterator<K> itr)
{
this.itr = itr;
}
@Override
public boolean hasNext()
{
return itr.hasNext();
}
@Override
public Entry<K, V> next()
{
itr.advance();
return new AbstractMap.SimpleEntry<K,V>(itr.value(), values.get(itr.key()));
}
@Override
public void remove()
{
/*
keys.remove(itr.key());
values.remove(itr.key());
*/
throw new IllegalStateException();
}
}
}