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

@@ -13,10 +13,7 @@ public class FMLForgePlugin implements IFMLLoadingPlugin
@Override
public String[] getASMTransformerClass()
{
return new String[]{
"net.minecraftforge.transformers.ForgeAccessTransformer",
"net.minecraftforge.transformers.EventTransformer"
};
return new String[0];
}
@Override
@@ -37,4 +34,10 @@ public class FMLForgePlugin implements IFMLLoadingPlugin
RUNTIME_DEOBF = (Boolean)data.get("runtimeDeobfuscationEnabled");
forgeLocation = (File)data.get("coremodLocation");
}
@Override
public String getAccessTransformerClass()
{
return "net.minecraftforge.transformers.ForgeAccessTransformer";
}
}
@@ -18,9 +18,9 @@ import org.lwjgl.opengl.PixelFormat;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.common.FMLLog;
import net.minecraft.client.Minecraft;
import net.minecraft.block.Block;
import net.minecraft.block.BlockFluid;
import net.minecraft.block.BlockLiquid;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.Entity;
@@ -28,19 +28,23 @@ import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.RenderGlobal;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.settings.GameSettings;
import net.minecraftforge.client.IItemRenderer.ItemRenderType;
import net.minecraftforge.client.event.DrawBlockHighlightEvent;
import net.minecraftforge.client.event.RenderWorldLastEvent;
@@ -67,7 +71,7 @@ public class ForgeHooksClient
return result != null ? result : _default;
}
public static boolean renderEntityItem(EntityItem entity, ItemStack item, float bobing, float rotation, Random random, TextureManager engine, RenderBlocks renderBlocks)
public static boolean renderEntityItem(EntityItem entity, ItemStack item, float bobing, float rotation, Random random, TextureManager engine, RenderBlocks renderBlocks, int count)
{
IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(item, ENTITY);
if (customRenderer == null)
@@ -86,11 +90,12 @@ public class ForgeHooksClient
boolean is3D = customRenderer.shouldUseRenderHelper(ENTITY, item, BLOCK_3D);
engine.bindTexture(item.getItemSpriteNumber() == 0 ? TextureMap.locationBlocksTexture : TextureMap.locationItemsTexture);
Block block = (item.itemID < Block.blocksList.length ? Block.blocksList[item.itemID] : null);
if (is3D || (block != null && RenderBlocks.renderItemIn3d(block.getRenderType())))
Block block = item.getItem() instanceof ItemBlock ? Block.func_149634_a(item.getItem()) : null;
if (is3D || (block != null && RenderBlocks.func_147739_a(block.func_149645_b())))
{
int renderType = (block != null ? block.getRenderType() : 1);
int renderType = (block != null ? block.func_149645_b() : 1);
float scale = (renderType == 1 || renderType == 19 || renderType == 12 || renderType == 2 ? 0.5F : 0.25F);
boolean blend = block != null && block.func_149701_w() > 0;
if (RenderItem.renderInFrame)
{
@@ -99,10 +104,14 @@ public class ForgeHooksClient
GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
}
GL11.glScalef(scale, scale, scale);
if (blend)
{
GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
GL11.glEnable(GL11.GL_BLEND);
OpenGlHelper.func_148821_a(770, 771, 1, 0);
}
int size = item.stackSize;
int count = (size > 40 ? 5 : (size > 20 ? 4 : (size > 5 ? 3 : (size > 1 ? 2 : 1))));
GL11.glScalef(scale, scale, scale);
for(int j = 0; j < count; j++)
{
@@ -117,6 +126,11 @@ public class ForgeHooksClient
customRenderer.renderItem(ENTITY, item, renderBlocks, entity);
GL11.glPopMatrix();
}
if (blend)
{
GL11.glDisable(GL11.GL_BLEND);
}
}
else
{
@@ -147,7 +161,7 @@ public class ForgeHooksClient
if(inColor)
{
int color = Item.itemsList[item.itemID].getColorFromItemStack(item, 0);
int color = item.getItem().getColorFromItemStack(item, 0);
float r = (float)(color >> 16 & 0xff) / 255F;
float g = (float)(color >> 8 & 0xff) / 255F;
float b = (float)(color & 0xff) / 255F;
@@ -155,9 +169,9 @@ public class ForgeHooksClient
}
GL11.glRotatef(-90F, 0.0F, 1.0F, 0.0F);
renderBlocks.useInventoryTint = inColor;
renderBlocks.field_147844_c = inColor;
customRenderer.renderItem(INVENTORY, item, renderBlocks);
renderBlocks.useInventoryTint = true;
renderBlocks.field_147844_c = true;
GL11.glPopMatrix();
}
else
@@ -168,7 +182,7 @@ public class ForgeHooksClient
if (inColor)
{
int color = Item.itemsList[item.itemID].getColorFromItemStack(item, 0);
int color = item.getItem().getColorFromItemStack(item, 0);
float r = (float)(color >> 16 & 255) / 255.0F;
float g = (float)(color >> 8 & 255) / 255.0F;
float b = (float)(color & 255) / 255.0F;
@@ -223,8 +237,7 @@ public class ForgeHooksClient
if (block != null && block.isBed(mc.theWorld, x, y, z, entity))
{
int var12 = block.getBedDirection(mc.theWorld, x, y, z);
GL11.glRotatef((float)(var12 * 90), 0.0F, 1.0F, 0.0F);
GL11.glRotatef((float)(block.getBedDirection(mc.theWorld, x, y, z) * 90), 0.0F, 1.0F, 0.0F);
}
}
@@ -259,8 +272,7 @@ public class ForgeHooksClient
{
if (Tessellator.renderingWorldRenderer)
{
String msg = String.format("Warning: Texture %s not preloaded, will cause render glitches!", texture);
System.out.println(msg);
FMLLog.warning("Warning: Texture %s not preloaded, will cause render glitches!", texture);
if (Tessellator.class.getPackage() != null)
{
if (Tessellator.class.getPackage().getName().startsWith("net.minecraft."))
@@ -268,7 +280,7 @@ public class ForgeHooksClient
Minecraft mc = FMLClientHandler.instance().getClient();
if (mc.ingameGUI != null)
{
mc.ingameGUI.getChatGUI().printChatMessage(msg);
mc.ingameGUI.func_146158_b().func_146227_a(new ChatComponentTranslation("forge.texture.preload.warning", texture));
}
}
}
@@ -350,8 +362,14 @@ public class ForgeHooksClient
return skyRGBMultiplier;
}
skyInit = true;
int distance = Minecraft.getMinecraft().gameSettings.fancyGraphics ? ForgeModContainer.blendRanges[Minecraft.getMinecraft().gameSettings.renderDistance] : 0;
GameSettings settings = Minecraft.getMinecraft().gameSettings;
int[] ranges = ForgeModContainer.blendRanges;
int distance = 0;
if (settings.fancyGraphics && settings.field_151451_c >= 0 && settings.field_151451_c < ranges.length)
{
distance = ranges[settings.field_151451_c];
}
int r = 0;
int g = 0;
@@ -383,7 +401,7 @@ public class ForgeHooksClient
*/
static
{
FluidRegistry.renderIdFluid = RenderingRegistry.getNextAvailableRenderId();
RenderingRegistry.registerBlockHandler(RenderBlockFluid.instance);
//FluidRegistry.renderIdFluid = RenderingRegistry.getNextAvailableRenderId();
//RenderingRegistry.registerBlockHandler(RenderBlockFluid.instance);
}
}
@@ -6,9 +6,12 @@
package net.minecraftforge.client;
import java.util.BitSet;
import java.util.IdentityHashMap;
import org.lwjgl.opengl.Display;
import com.google.common.collect.Maps;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.item.Item;
@@ -20,7 +23,7 @@ import net.minecraftforge.common.MinecraftForge;
public class MinecraftForgeClient
{
private static IItemRenderer[] customItemRenderers = new IItemRenderer[Item.itemsList.length];
private static IdentityHashMap<Item, IItemRenderer> customItemRenderers = Maps.newIdentityHashMap();
/**
* Register a custom renderer for a specific item. This can be used to
@@ -30,17 +33,17 @@ public class MinecraftForgeClient
* @param renderer The IItemRenderer interface that handles rendering for
* this item.
*/
public static void registerItemRenderer(int itemID, IItemRenderer renderer)
public static void registerItemRenderer(Item item, IItemRenderer renderer)
{
customItemRenderers[itemID] = renderer;
customItemRenderers.put(item, renderer);
}
public static IItemRenderer getItemRenderer(ItemStack item, ItemRenderType type)
{
IItemRenderer renderer = customItemRenderers[item.itemID];
IItemRenderer renderer = customItemRenderers.get(item);
if (renderer != null && renderer.handleRenderType(item, type))
{
return customItemRenderers[item.itemID];
return renderer;
}
return null;
}
@@ -1,13 +1,14 @@
package net.minecraftforge.client.event;
import net.minecraft.util.IChatComponent;
import cpw.mods.fml.common.eventhandler.Cancelable;
import cpw.mods.fml.common.eventhandler.Event;
@Cancelable
public class ClientChatReceivedEvent extends Event
{
public String message;
public ClientChatReceivedEvent(String message)
public IChatComponent message;
public ClientChatReceivedEvent(IChatComponent message)
{
this.message = message;
}
@@ -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();
}
}
}
@@ -4,17 +4,19 @@ import java.util.ArrayList;
import java.util.List;
import cpw.mods.fml.common.eventhandler.Event.Result;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.entity.effect.EntityLightningBolt;
import net.minecraft.entity.monster.EntityZombie;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.EntityStruckByLightningEvent;
import net.minecraftforge.event.entity.living.LivingPackSizeEvent;
import net.minecraftforge.event.entity.living.LivingSpawnEvent;
import net.minecraftforge.event.entity.living.LivingSpawnEvent.AllowDespawn;
@@ -118,4 +120,9 @@ public class ForgeEventFactory
MinecraftForge.EVENT_BUS.post(summonEvent);
return summonEvent;
}
public static boolean onEntityStruckByLightning(Entity entity, EntityLightningBolt bolt)
{
return MinecraftForge.EVENT_BUS.post(new EntityStruckByLightningEvent(entity, bolt));
}
}
@@ -3,15 +3,15 @@ package net.minecraftforge.event;
import cpw.mods.fml.common.eventhandler.Cancelable;
import cpw.mods.fml.common.eventhandler.Event;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.util.ChatMessageComponent;
import net.minecraft.util.ChatComponentTranslation;
@Cancelable
public class ServerChatEvent extends Event
{
public final String message, username;
public final EntityPlayerMP player;
public ChatMessageComponent component;
public ServerChatEvent(EntityPlayerMP player, String message, ChatMessageComponent component)
public ChatComponentTranslation component;
public ServerChatEvent(EntityPlayerMP player, String message, ChatComponentTranslation component)
{
super();
this.message = message;
@@ -2,6 +2,7 @@ package net.minecraftforge.event.entity.player;
import cpw.mods.fml.common.eventhandler.Cancelable;
import cpw.mods.fml.common.eventhandler.Event;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
@@ -20,18 +21,18 @@ public class BonemealEvent extends PlayerEvent
*/
public final World world;
public final int ID;
public final int X;
public final int Y;
public final int Z;
public final Block block;
public final int x;
public final int y;
public final int z;
public BonemealEvent(EntityPlayer player, World world, int id, int x, int y, int z)
public BonemealEvent(EntityPlayer player, World world, Block block, int x, int y, int z)
{
super(player);
this.world = world;
this.ID = id;
this.X = x;
this.Y = y;
this.Z = z;
this.block = block;
this.x = x;
this.y = y;
this.z = z;
}
}
@@ -1,9 +1,11 @@
package net.minecraftforge.event.terraingen;
import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.common.eventhandler.Cancelable;
import cpw.mods.fml.common.eventhandler.Event;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.world.biome.BiomeDecorator;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.event.*;
@@ -30,19 +32,6 @@ public class BiomeEvent extends Event
}
}
public static class BlockReplacement extends BiomeEvent
{
public final int original;
public int replacement;
public BlockReplacement(BiomeGenBase biome, int original, int replacement)
{
super(biome);
this.original = original;
this.replacement = replacement;
}
}
public static class BiomeColor extends BiomeEvent
{
public final int originalColor;
@@ -60,14 +49,20 @@ public class BiomeEvent extends Event
* This event is fired when the village generator attempts to choose a block ID
* based on the village's biome.
*
* You can set the result to DENY to prevent the default block ID selection.
* You can cancel the event to override default values
*/
@HasResult
public static class GetVillageBlockID extends BlockReplacement
public static class GetVillageBlockID extends BiomeEvent
{
public GetVillageBlockID(BiomeGenBase biome, int original, int replacement)
public final Block original;
public final int type;
public Block replacement;
public GetVillageBlockID(BiomeGenBase biome, Block original, int type)
{
super(biome, original, replacement);
super(biome);
this.original = original;
this.type = type;
}
}
@@ -78,11 +73,17 @@ public class BiomeEvent extends Event
* You can set the result to DENY to prevent the default block metadata selection.
*/
@HasResult
public static class GetVillageBlockMeta extends BlockReplacement
public static class GetVillageBlockMeta extends BiomeEvent
{
public GetVillageBlockMeta(BiomeGenBase biome, int original, int replacement)
public final Block original;
public final int type;
public int replacement;
public GetVillageBlockMeta(BiomeGenBase biome, Block original, int type)
{
super(biome, original, replacement);
super(biome);
this.original = original;
this.type = type;
}
}
@@ -1,6 +1,7 @@
package net.minecraftforge.event.terraingen;
import cpw.mods.fml.common.eventhandler.Event;
import net.minecraft.block.Block;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraftforge.event.*;
@@ -26,10 +27,10 @@ public class ChunkProviderEvent extends Event
{
public final int chunkX;
public final int chunkZ;
public final byte[] blockArray;
public final Block[] blockArray;
public final BiomeGenBase[] biomeArray;
public ReplaceBiomeBlocks(IChunkProvider chunkProvider, int chunkX, int chunkZ, byte[] blockArray, BiomeGenBase[] biomeArray)
public ReplaceBiomeBlocks(IChunkProvider chunkProvider, int chunkX, int chunkZ, Block[] blockArray, BiomeGenBase[] biomeArray)
{
super(chunkProvider);
this.chunkX = chunkX;
@@ -10,20 +10,19 @@ import net.minecraftforge.common.MinecraftForge;
public class DeferredBiomeDecorator extends BiomeDecorator {
private BiomeDecorator wrapped;
public DeferredBiomeDecorator(BiomeGenBase biomeGenBase, BiomeDecorator wrappedOriginal)
public DeferredBiomeDecorator(BiomeDecorator wrappedOriginal)
{
super(biomeGenBase);
this.wrapped = wrappedOriginal;
}
@Override
public void decorate(World par1World, Random par2Random, int par3, int par4)
public void func_150512_a(World par1World, Random par2Random, BiomeGenBase biome, int par3, int par4)
{
fireCreateEventAndReplace();
fireCreateEventAndReplace(biome);
// On first call to decorate, we fire and substitute ourselves, if we haven't already done so
biome.theBiomeDecorator.decorate(par1World, par2Random, par3, par4);
biome.theBiomeDecorator.func_150512_a(par1World, par2Random, biome, par3, par4);
}
public void fireCreateEventAndReplace()
public void fireCreateEventAndReplace(BiomeGenBase biome)
{
// Copy any configuration from us to the real instance.
wrapped.bigMushroomsPerChunk = bigMushroomsPerChunk;
@@ -47,7 +47,7 @@ public class OreGenEvent extends Event
@HasResult
public static class GenerateMinable extends OreGenEvent
{
public static enum EventType { COAL, DIAMOND, DIRT, GOLD, GRAVEL, IRON, LAPIS, REDSTONE, CUSTOM }
public static enum EventType { COAL, DIAMOND, DIRT, GOLD, GRAVEL, IRON, LAPIS, REDSTONE, QUARTZ, CUSTOM }
public final EventType type;
public final WorldGenerator generator;
@@ -4,12 +4,12 @@ import java.util.ArrayList;
import cpw.mods.fml.common.eventhandler.Cancelable;
import cpw.mods.fml.common.eventhandler.Event;
import net.minecraft.block.Block;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeHooks;
public class BlockEvent extends Event {
public final int x;
@@ -73,14 +73,14 @@ public class BlockEvent extends Event {
super(x, y, z, world, block, blockMetadata);
this.player = player;
if (block == null || !player.canHarvestBlock(block) || // Handle empty block or player unable to break block scenario
if (block == null || !ForgeHooks.canHarvestBlock(block, player, blockMetadata) || // Handle empty block or player unable to break block scenario
block.canSilkHarvest(world, player, x, y, z, blockMetadata) && EnchantmentHelper.getSilkTouchModifier(player)) // If the block is being silk harvested, the exp dropped is 0
{
this.exp = 0;
}
else
{
int meta = block.getDamageValue(world, x, y, z);
int meta = block.func_149643_k(world, x, y, z);
int bonusLevel = EnchantmentHelper.getFortuneModifier(player);
this.exp = block.getExpDrop(world, meta, bonusLevel);
}
@@ -3,7 +3,6 @@ package net.minecraftforge.event.world;
import cpw.mods.fml.common.eventhandler.Event;
import net.minecraft.world.ChunkCoordIntPair;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.server.management.PlayerInstance;
import net.minecraft.world.WorldServer;
public class ChunkWatchEvent extends Event
@@ -8,7 +8,7 @@ import cpw.mods.fml.common.eventhandler.Event;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.world.World;
import net.minecraft.world.biome.SpawnListEntry;
import net.minecraft.world.biome.BiomeGenBase.SpawnListEntry;
public class WorldEvent extends Event
{
@@ -4,7 +4,6 @@ package net.minecraftforge.fluids;
import java.util.Map;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraftforge.common.network.ForgePacket;
import com.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap;
@@ -12,7 +11,7 @@ import com.google.common.io.ByteArrayDataInput;
import com.google.common.io.ByteArrayDataOutput;
import com.google.common.io.ByteStreams;
public class FluidIdMapPacket extends ForgePacket
public class FluidIdMapPacket// extends ForgePacket
{
/*
private BiMap<String, Integer> fluidIds = HashBiMap.create();
@@ -18,7 +18,7 @@ public class RenderBlockFluid implements ISimpleBlockRenderingHandler
{
@Override public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {}
@Override public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { return false; }
@Override public boolean shouldRender3DInInventory() { return false; }
@Override public boolean shouldRender3DInInventory(int modelId) { return false; }
@Override public int getRenderId() { return 0; }
/*
public static RenderBlockFluid instance = new RenderBlockFluid();
@@ -131,7 +131,13 @@ public class OreDictionary
new ItemStack(Blocks.stonebrick),
new ItemStack(Blocks.stone_slab),
new ItemStack(Blocks.stone_stairs),
new ItemStack(Blocks.cobblestone_wall)
new ItemStack(Blocks.cobblestone_wall),
new ItemStack(Blocks.oak_stairs),
new ItemStack(Blocks.spruce_stairs),
new ItemStack(Blocks.birch_stairs),
new ItemStack(Blocks.jungle_stairs),
new ItemStack(Blocks.acacia_stairs),
new ItemStack(Blocks.dark_oak_stairs)
};
List recipes = CraftingManager.getInstance().getRecipeList();