Some work on 1.7, waiting for Abrar to fix a few things.

This commit is contained in:
Lex Manos 2013-12-09 21:59:12 -08:00
parent d4e7a5c68e
commit 521b8a16c4
18 changed files with 245 additions and 487 deletions

View File

@ -9,10 +9,11 @@ import net.minecraft.command.CommandHandler;
import net.minecraft.command.ICommand;
import net.minecraft.command.ICommandSender;
import net.minecraft.command.WrongUsageException;
import net.minecraft.util.ChatMessageComponent;
import net.minecraft.util.ChatComponentTranslation;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.CommandEvent;
import cpw.mods.fml.client.FMLClientHandler;
import net.minecraft.util.EnumChatFormatting;
import static net.minecraft.util.EnumChatFormatting.*;
/**
@ -73,20 +74,20 @@ public class ClientCommandHandler extends CommandHandler
}
else
{
sender.sendChatToPlayer(format("commands.generic.permission").setColor(RED));
sender.func_145747_a(format(RED, "commands.generic.permission"));
}
}
catch (WrongUsageException wue)
{
sender.sendChatToPlayer(format("commands.generic.usage", format(wue.getMessage(), wue.getErrorOjbects())).setColor(RED));
sender.func_145747_a(format(RED, "commands.generic.usage", format(RED, wue.getMessage(), wue.getErrorOjbects())));
}
catch (CommandException ce)
{
sender.sendChatToPlayer(format(ce.getMessage(), ce.getErrorOjbects()).setColor(RED));
sender.func_145747_a(format(RED, ce.getMessage(), ce.getErrorOjbects()));
}
catch (Throwable t)
{
sender.sendChatToPlayer(format("commands.generic.exception").setColor(RED));
sender.func_145747_a(format(RED, "commands.generic.exception"));
t.printStackTrace();
}
@ -94,14 +95,11 @@ public class ClientCommandHandler extends CommandHandler
}
//Couple of helpers because the mcp names are stupid and long...
private ChatMessageComponent format(String str, Object... args)
private ChatComponentTranslation format(EnumChatFormatting color, String str, Object... args)
{
return ChatMessageComponent.createFromTranslationWithSubstitutions(str, args);
}
private ChatMessageComponent format(String str)
{
return ChatMessageComponent.createFromTranslationKey(str);
ChatComponentTranslation ret = new ChatComponentTranslation(str, args);
ret.func_150256_b().func_150238_a(color);
return ret;
}
public void autoComplete(String leftOfCursor, String full)

View File

@ -1,8 +1,8 @@
package net.minecraftforge.client;
import net.minecraft.world.EnumGameType;
import net.minecraft.util.EnumOS;
import net.minecraft.client.settings.EnumOptions;
import net.minecraft.util.Util.EnumOS;
import net.minecraft.world.WorldSettings.GameType;
import net.minecraft.client.settings.GameSettings.Options;
import net.minecraft.item.EnumRarity;
import net.minecraftforge.common.EnumHelper;
@ -11,20 +11,20 @@ public class EnumHelperClient extends EnumHelper
private static Class[][] clentTypes =
{
{EnumGameType.class, int.class, String.class},
{EnumOptions.class, String.class, boolean.class, boolean.class},
{GameType.class, int.class, String.class},
{Options.class, String.class, boolean.class, boolean.class},
{EnumOS.class},
{EnumRarity.class, int.class, String.class}
};
public static EnumGameType addGameType(String name, int id, String displayName)
public static GameType addGameType(String name, int id, String displayName)
{
return addEnum(EnumGameType.class, name, id, displayName);
return addEnum(GameType.class, name, id, displayName);
}
public static EnumOptions addOptions(String name, String langName, boolean isSlider, boolean isToggle)
public static Options addOptions(String name, String langName, boolean isSlider, boolean isToggle)
{
return addEnum(EnumOptions.class, name, langName, isSlider, isToggle);
return addEnum(Options.class, name, langName, isSlider, isToggle);
}
public static EnumOS addOS2(String name)

View File

@ -9,6 +9,7 @@ import javax.imageio.ImageIO;
import net.minecraftforge.client.event.MouseEvent;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraftforge.client.event.FOVUpdateEvent;
import org.lwjgl.LWJGLException;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.GL11;
@ -17,14 +18,15 @@ import org.lwjgl.opengl.PixelFormat;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.client.registry.RenderingRegistry;
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;
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.ItemStack;
import net.minecraft.util.MathHelper;
@ -59,12 +61,6 @@ public class ForgeHooksClient
return FMLClientHandler.instance().getClient().renderEngine;
}
@Deprecated
public static String getArmorTexture(Entity entity, ItemStack armor, String _default, int slot, int layer, String type)
{
return getArmorTexture(entity, armor, _default, slot, type);
}
public static String getArmorTexture(Entity entity, ItemStack armor, String _default, int slot, String type)
{
String result = armor.getItem().getArmorTexture(armor, entity, slot, type);
@ -251,8 +247,8 @@ public class ForgeHooksClient
{
MinecraftForge.EVENT_BUS.post(new TextureStitchEvent.Post(map));
FluidRegistry.WATER.setIcons(BlockFluid.getFluidIcon("water_still"), BlockFluid.getFluidIcon("water_flow"));
FluidRegistry.LAVA.setIcons(BlockFluid.getFluidIcon("lava_still"), BlockFluid.getFluidIcon("lava_flow"));
FluidRegistry.WATER.setIcons(BlockLiquid.func_149803_e("water_still"), BlockLiquid.func_149803_e("water_flow"));
FluidRegistry.LAVA.setIcons(BlockLiquid.func_149803_e("lava_still"), BlockLiquid.func_149803_e("lava_flow"));
}
/**
@ -347,7 +343,7 @@ public class ForgeHooksClient
private static boolean skyInit;
private static int skyRGBMultiplier;
public static int getSkyBlendColour(World world, int playerX, int playerZ)
public static int getSkyBlendColour(World world, int playerX, int playerY, int playerZ)
{
if (playerX == skyX && playerZ == skyZ && skyInit)
{
@ -367,7 +363,7 @@ public class ForgeHooksClient
for (int z = -distance; z <= distance; ++z)
{
BiomeGenBase biome = world.getBiomeGenForCoords(playerX + x, playerZ + z);
int colour = biome.getSkyColorByTemp(biome.getFloatTemperature());
int colour = biome.getSkyColorByTemp(biome.func_150564_a(playerX + x, playerY, playerZ + z));
r += (colour & 0xFF0000) >> 16;
g += (colour & 0x00FF00) >> 8;
b += colour & 0x0000FF;

View File

@ -1,128 +0,0 @@
package net.minecraftforge.client;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.Minecraft;
import net.minecraft.client.settings.GameSettings;
import net.minecraft.client.gui.GuiControls;
import net.minecraft.client.gui.GuiSlot;
import net.minecraft.client.settings.KeyBinding;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.ResourceLocation;
public class GuiControlsScrollPanel extends GuiSlot
{
protected static final ResourceLocation WIDGITS = new ResourceLocation("textures/gui/widgets.png");
private GuiControls controls;
private GameSettings options;
private Minecraft mc;
private String[] message;
private int _mouseX;
private int _mouseY;
private int selected = -1;
public GuiControlsScrollPanel(GuiControls controls, GameSettings options, Minecraft mc)
{
super(mc, controls.width, controls.height, 16, (controls.height - 32) + 4, 25);
this.controls = controls;
this.options = options;
this.mc = mc;
}
@Override
protected int getSize()
{
return options.keyBindings.length;
}
@Override
protected void elementClicked(int i, boolean flag)
{
if (!flag)
{
if (selected == -1)
{
selected = i;
}
else
{
options.setKeyBinding(selected, -100);
selected = -1;
KeyBinding.resetKeyBindingArrayAndHash();
}
}
}
@Override
protected boolean isSelected(int i)
{
return false;
}
@Override
protected void drawBackground() {}
@Override
public void drawScreen(int mX, int mY, float f)
{
_mouseX = mX;
_mouseY = mY;
if (selected != -1 && !Mouse.isButtonDown(0) && Mouse.getDWheel() == 0)
{
if (Mouse.next() && Mouse.getEventButtonState())
{
options.setKeyBinding(selected, -100 + Mouse.getEventButton());
selected = -1;
KeyBinding.resetKeyBindingArrayAndHash();
}
}
super.drawScreen(mX, mY, f);
}
@Override
protected void drawSlot(int index, int xPosition, int yPosition, int l, Tessellator tessellator)
{
int width = 70;
int height = 20;
xPosition -= 20;
boolean flag = _mouseX >= xPosition && _mouseY >= yPosition && _mouseX < xPosition + width && _mouseY < yPosition + height;
int k = (flag ? 2 : 1);
mc.renderEngine.bindTexture(WIDGITS);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
controls.drawTexturedModalRect(xPosition, yPosition, 0, 46 + k * 20, width / 2, height);
controls.drawTexturedModalRect(xPosition + width / 2, yPosition, 200 - width / 2, 46 + k * 20, width / 2, height);
controls.drawString(mc.fontRenderer, options.getKeyBindingDescription(index), xPosition + width + 4, yPosition + 6, 0xFFFFFFFF);
boolean conflict = false;
for (int x = 0; x < options.keyBindings.length; x++)
{
if (x != index && options.keyBindings[x].keyCode == options.keyBindings[index].keyCode)
{
conflict = true;
break;
}
}
String str = (conflict ? EnumChatFormatting.RED : "") + options.getOptionDisplayString(index);
str = (index == selected ? EnumChatFormatting.WHITE + "> " + EnumChatFormatting.YELLOW + "??? " + EnumChatFormatting.WHITE + "<" : str);
controls.drawCenteredString(mc.fontRenderer, str, xPosition + (width / 2), yPosition + (height - 8) / 2, 0xFFFFFFFF);
}
public boolean keyTyped(char c, int i)
{
if (selected != -1)
{
options.setKeyBinding(selected, i);
selected = -1;
KeyBinding.resetKeyBindingArrayAndHash();
return false;
}
return true;
}
}

View File

@ -14,15 +14,18 @@ import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.GuiIngame;
import net.minecraft.client.gui.GuiPlayerInfo;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.multiplayer.NetClientHandler;
import net.minecraft.client.network.NetHandlerPlayClient;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.crash.CallableMinecraftVersion;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.attributes.AttributeInstance;
import net.minecraft.entity.ai.attributes.IAttributeInstance;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.scoreboard.Score;
@ -78,7 +81,7 @@ public class GuiIngameForge extends GuiIngame
private ScaledResolution res = null;
private FontRenderer fontrenderer = null;
private RenderGameOverlayEvent eventParent;
private static final String MC_VERSION = (new CallableMinecraftVersion(null)).minecraftVersion();
private static final String MC_VERSION = "1.7.2";
public GuiIngameForge(Minecraft mc)
{
@ -111,7 +114,7 @@ public class GuiIngameForge extends GuiIngame
}
else
{
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
OpenGlHelper.func_148821_a(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0);
}
if (renderHelmet) renderHelmet(res, partialTicks, hasScreen, mouseX, mouseY);
@ -162,7 +165,7 @@ public class GuiIngameForge extends GuiIngame
}
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
OpenGlHelper.func_148821_a(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0);
GL11.glDisable(GL11.GL_ALPHA_TEST);
renderChat(width, height);
@ -217,8 +220,9 @@ public class GuiIngameForge extends GuiIngame
if (pre(CROSSHAIRS)) return;
bind(Gui.icons);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_ONE_MINUS_DST_COLOR, GL11.GL_ONE_MINUS_SRC_COLOR);
OpenGlHelper.func_148821_a(GL11.GL_ONE_MINUS_DST_COLOR, GL11.GL_ONE_MINUS_SRC_COLOR, 1, 0);
drawTexturedModalRect(width / 2 - 7, height / 2 - 7, 0, 0, 16, 16);
OpenGlHelper.func_148821_a(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0);
GL11.glDisable(GL11.GL_BLEND);
post(CROSSHAIRS);
}
@ -228,7 +232,9 @@ public class GuiIngameForge extends GuiIngame
{
if (pre(BOSSHEALTH)) return;
mc.mcProfiler.startSection("bossHealth");
GL11.glEnable(GL11.GL_BLEND);
super.renderBossHealth();
GL11.glDisable(GL11.GL_BLEND);
mc.mcProfiler.endSection();
post(BOSSHEALTH);
}
@ -241,7 +247,7 @@ public class GuiIngameForge extends GuiIngame
if (this.mc.gameSettings.thirdPersonView == 0 && itemstack != null && itemstack.getItem() != null)
{
if (itemstack.itemID == Block.pumpkin.blockID)
if (itemstack.getItem() == Item.func_150898_a(Blocks.pumpkin))
{
renderPumpkinBlur(res.getScaledWidth(), res.getScaledHeight());
}
@ -259,6 +265,7 @@ public class GuiIngameForge extends GuiIngame
if (pre(ARMOR)) return;
mc.mcProfiler.startSection("armor");
GL11.glEnable(GL11.GL_BLEND);
int left = width / 2 - 91;
int top = height - left_height;
@ -281,6 +288,7 @@ public class GuiIngameForge extends GuiIngame
}
left_height += 10;
GL11.glDisable(GL11.GL_BLEND);
mc.mcProfiler.endSection();
post(ARMOR);
}
@ -303,10 +311,11 @@ public class GuiIngameForge extends GuiIngame
{
if (pre(AIR)) return;
mc.mcProfiler.startSection("air");
GL11.glEnable(GL11.GL_BLEND);
int left = width / 2 + 91;
int top = height - right_height;
if (mc.thePlayer.isInsideOfMaterial(Material.water))
if (mc.thePlayer.isInsideOfMaterial(Material.field_151586_h))
{
int air = mc.thePlayer.getAir();
int full = MathHelper.ceiling_double_int((double)(air - 2) * 10.0D / 300.0D);
@ -319,6 +328,7 @@ public class GuiIngameForge extends GuiIngame
right_height += 10;
}
GL11.glDisable(GL11.GL_BLEND);
mc.mcProfiler.endSection();
post(AIR);
}
@ -328,6 +338,7 @@ public class GuiIngameForge extends GuiIngame
bind(icons);
if (pre(HEALTH)) return;
mc.mcProfiler.startSection("health");
GL11.glEnable(GL11.GL_BLEND);
boolean highlight = mc.thePlayer.hurtResistantTime / 3 % 2 == 1;
@ -336,7 +347,7 @@ public class GuiIngameForge extends GuiIngame
highlight = false;
}
AttributeInstance attrMaxHealth = this.mc.thePlayer.getEntityAttribute(SharedMonsterAttributes.maxHealth);
IAttributeInstance attrMaxHealth = this.mc.thePlayer.getEntityAttribute(SharedMonsterAttributes.maxHealth);
int health = MathHelper.ceiling_float_int(mc.thePlayer.getHealth());
int healthLast = MathHelper.ceiling_float_int(mc.thePlayer.prevHealth);
float healthMax = (float)attrMaxHealth.getAttributeValue();
@ -402,6 +413,7 @@ public class GuiIngameForge extends GuiIngame
}
}
GL11.glDisable(GL11.GL_BLEND);
mc.mcProfiler.endSection();
post(HEALTH);
}
@ -411,6 +423,7 @@ public class GuiIngameForge extends GuiIngame
if (pre(FOOD)) return;
mc.mcProfiler.startSection("food");
GL11.glEnable(GL11.GL_BLEND);
int left = width / 2 + 91;
int top = height - right_height;
right_height += 10;
@ -455,6 +468,7 @@ public class GuiIngameForge extends GuiIngame
else if (idx == level)
drawTexturedModalRect(x, y, icon + 45, 27, 9, 9);
}
GL11.glDisable(GL11.GL_BLEND);
mc.mcProfiler.endSection();
post(FOOD);
}
@ -577,7 +591,7 @@ public class GuiIngameForge extends GuiIngame
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
OpenGlHelper.func_148821_a(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0);
FontRenderer font = highlightingItemStack.getItem().getFontRenderer(highlightingItemStack);
if (font != null)
{
@ -609,11 +623,11 @@ public class GuiIngameForge extends GuiIngame
long time = mc.theWorld.getTotalWorldTime();
if (time >= 120500L)
{
right.add(StatCollector.translateToLocal("demo.demoExpired"));
right.add(I18n.getStringParams("demo.demoExpired"));
}
else
{
right.add(String.format(StatCollector.translateToLocal("demo.remainingTime"), StringUtils.ticksToElapsedTime((int)(120500L - time))));
right.add(I18n.getStringParams("demo.remainingTime", StringUtils.ticksToElapsedTime((int)(120500L - time))));
}
}
@ -664,10 +678,15 @@ public class GuiIngameForge extends GuiIngame
}
left.add(String.format("ws: %.3f, fs: %.3f, g: %b, fl: %d", mc.thePlayer.capabilities.getWalkSpeed(), mc.thePlayer.capabilities.getFlySpeed(), mc.thePlayer.onGround, mc.theWorld.getHeightValue(x, z)));
right.add(null);
for (String s : FMLCommonHandler.instance().getBrandings().subList(1, FMLCommonHandler.instance().getBrandings().size()))
if (mc.entityRenderer != null && mc.entityRenderer.func_147702_a())
{
right.add(s);
left.add(String.format("shader: %s", mc.entityRenderer.func_147706_e().func_148022_b()));
}
right.add(null);
for (String brand : FMLCommonHandler.instance().getBrandings(false))
{
right.add(brand);
}
GL11.glPopMatrix();
mc.mcProfiler.endSection();
@ -710,7 +729,7 @@ public class GuiIngameForge extends GuiIngame
GL11.glPushMatrix();
GL11.glTranslatef((float)(width / 2), (float)(height - 48), 0.0F);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
OpenGlHelper.func_148821_a(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0);
int color = (recordIsPlaying ? Color.HSBtoRGB(hue / 50.0F, 0.7F, 0.6F) & WHITE : WHITE);
fontrenderer.drawString(recordPlaying, -fontrenderer.getStringWidth(recordPlaying) / 2, -4, color | (opacity << 24));
GL11.glDisable(GL11.GL_BLEND);
@ -730,7 +749,7 @@ public class GuiIngameForge extends GuiIngame
GL11.glPushMatrix();
GL11.glTranslatef((float)event.posX, (float)event.posY, 0.0F);
persistantChatGUI.drawChat(updateCounter);
persistantChatGUI.func_146230_a(updateCounter);
GL11.glPopMatrix();
post(CHAT);
@ -741,14 +760,14 @@ public class GuiIngameForge extends GuiIngame
protected void renderPlayerList(int width, int height)
{
ScoreObjective scoreobjective = this.mc.theWorld.getScoreboard().func_96539_a(0);
NetClientHandler handler = mc.thePlayer.sendQueue;
NetHandlerPlayClient handler = mc.thePlayer.sendQueue;
if (mc.gameSettings.keyBindPlayerList.pressed && (!mc.isIntegratedServerRunning() || handler.playerInfoList.size() > 1 || scoreobjective != null))
if (mc.gameSettings.keyBindPlayerList.func_151470_d() && (!mc.isIntegratedServerRunning() || handler.field_147303_b.size() > 1 || scoreobjective != null))
{
if (pre(PLAYER_LIST)) return;
this.mc.mcProfiler.startSection("playerList");
List players = handler.playerInfoList;
int maxPlayers = handler.currentServerMaxPlayers;
List players = handler.field_147303_b;
int maxPlayers = handler.field_147304_c;
int rows = maxPlayers;
int columns = 1;
@ -829,6 +848,7 @@ public class GuiIngameForge extends GuiIngame
int left_align = width / 2 + 91;
mc.mcProfiler.endStartSection("mountHealth");
GL11.glEnable(GL11.GL_BLEND);
EntityLivingBase mount = (EntityLivingBase)tmp;
int health = (int)Math.ceil((double)mount.getHealth());
float healthMax = mount.getMaxHealth();
@ -861,6 +881,7 @@ public class GuiIngameForge extends GuiIngame
right_height += 10;
}
GL11.glDisable(GL11.GL_BLEND);
post(HEALTHMOUNT);
}

View File

@ -31,12 +31,9 @@ public abstract class RenderPlayerEvent extends PlayerEvent
public abstract static class Specials extends RenderPlayerEvent
{
@Deprecated
public final float partialTicks;
public Specials(EntityPlayer player, RenderPlayer renderer, float partialTicks)
{
super(player, renderer, partialTicks);
this.partialTicks = partialTicks;
}
@Cancelable
@ -62,14 +59,11 @@ public abstract class RenderPlayerEvent extends PlayerEvent
*/
public int result = -1;
public final int slot;
@Deprecated
public final float partialTick;
public final ItemStack stack;
public SetArmorModel(EntityPlayer player, RenderPlayer renderer, int slot, float partialTick, ItemStack stack)
{
super(player, renderer, partialTick);
this.slot = slot;
this.partialTick = partialTick;
this.stack = stack;
}
}

View File

@ -2,6 +2,7 @@ package net.minecraftforge.common;
import java.util.*;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.WeightedRandom;
@ -9,6 +10,12 @@ import net.minecraft.util.WeightedRandomChestContent;
import net.minecraft.world.WorldServer;
import net.minecraft.world.gen.feature.WorldGenDungeons;
import net.minecraft.world.gen.structure.*;
import net.minecraft.world.gen.structure.ComponentScatteredFeaturePieces.DesertPyramid;
import net.minecraft.world.gen.structure.ComponentScatteredFeaturePieces.JunglePyramid;
import net.minecraft.world.gen.structure.StructureStrongholdPieces.ChestCorridor;
import net.minecraft.world.gen.structure.StructureStrongholdPieces.Library;
import net.minecraft.world.gen.structure.StructureStrongholdPieces.RoomCrossing;
import net.minecraft.world.gen.structure.StructureVillagePieces.House2;
import net.minecraftforge.oredict.OreDictionary;
public class ChestGenHooks
@ -41,18 +48,18 @@ public class ChestGenHooks
hasInit = true;
addInfo(MINESHAFT_CORRIDOR, StructureMineshaftPieces.mineshaftChestContents, 3, 7);
addInfo(PYRAMID_DESERT_CHEST, ComponentScatteredFeatureDesertPyramid.itemsToGenerateInTemple, 2, 7);
addInfo(PYRAMID_JUNGLE_CHEST, ComponentScatteredFeatureJunglePyramid.junglePyramidsChestContents, 2, 7);
addInfo(PYRAMID_JUNGLE_DISPENSER, ComponentScatteredFeatureJunglePyramid.junglePyramidsDispenserContents, 2, 2);
addInfo(STRONGHOLD_CORRIDOR, ComponentStrongholdChestCorridor.strongholdChestContents, 2, 4);
addInfo(STRONGHOLD_LIBRARY, ComponentStrongholdLibrary.strongholdLibraryChestContents, 1, 5);
addInfo(STRONGHOLD_CROSSING, ComponentStrongholdRoomCrossing.strongholdRoomCrossingChestContents, 1, 5);
addInfo(VILLAGE_BLACKSMITH, ComponentVillageHouse2.villageBlacksmithChestContents, 3, 9);
addInfo(BONUS_CHEST, WorldServer.bonusChestContent, 10, 10);
addInfo(DUNGEON_CHEST, WorldGenDungeons.field_111189_a, 8, 8);
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(Item.enchantedBook, 1, 0);
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);
@ -177,7 +184,7 @@ public class ChestGenHooks
while(itr.hasNext())
{
WeightedRandomChestContent cont = itr.next();
if (item.isItemEqual(cont.theItemId) || (item.getItemDamage() == OreDictionary.WILDCARD_VALUE && item.itemID == cont.theItemId.itemID))
if (item.isItemEqual(cont.theItemId) || (item.getItemDamage() == OreDictionary.WILDCARD_VALUE && item.getItem() == cont.theItemId.getItem()))
{
itr.remove();
}

View File

@ -46,13 +46,7 @@ import cpw.mods.fml.relauncher.FMLInjectionData;
*/
public class Configuration
{
private static boolean[] configMarkers = new boolean[Item.itemsList.length];
private static final int ITEM_SHIFT = 256;
private static final int MAX_BLOCKS = 4096;
public static final String CATEGORY_GENERAL = "general";
public static final String CATEGORY_BLOCK = "block";
public static final String CATEGORY_ITEM = "item";
public static final String ALLOWED_CHARS = "._-";
public static final String DEFAULT_ENCODING = "UTF-8";
public static final String CATEGORY_SPLITTER = ".";
@ -75,7 +69,6 @@ public class Configuration
static
{
Arrays.fill(configMarkers, false);
NEW_LINE = System.getProperty("line.separator");
}
@ -107,127 +100,6 @@ public class Configuration
this.caseSensitiveCustomCategories = caseSensitiveCustomCategories;
}
/**
* Gets or create a block id property. If the block id property key is
* already in the configuration, then it will be used. Otherwise,
* defaultId will be used, except if already taken, in which case this
* will try to determine a free default id.
*/
public Property getBlock(String key, int defaultID) { return getBlock(CATEGORY_BLOCK, key, defaultID, null); }
public Property getBlock(String key, int defaultID, String comment) { return getBlock(CATEGORY_BLOCK, key, defaultID, comment); }
public Property getBlock(String category, String key, int defaultID) { return getBlockInternal(category, key, defaultID, null, 256, Block.blocksList.length); }
public Property getBlock(String category, String key, int defaultID, String comment) { return getBlockInternal(category, key, defaultID, comment, 256, Block.blocksList.length); }
/**
* Special version of getBlock to be used when you want to garentee the ID you get is below 256
* This should ONLY be used by mods who do low level terrain generation, or ones that add new
* biomes.
* EXA: ExtraBiomesXL
*
* Specifically, if your block is used BEFORE the Chunk is created, and placed in the terrain byte array directly.
* If you add a new biome and you set the top/filler block, they need to be <256, nothing else.
*
* If you're adding a new ore, DON'T call this function.
*
* Normal mods such as '50 new ores' do not need to be below 256 so should use the normal getBlock
*/
public Property getTerrainBlock(String category, String key, int defaultID, String comment)
{
return getBlockInternal(category, key, defaultID, comment, 0, 256);
}
private Property getBlockInternal(String category, String key, int defaultID, String comment, int lower, int upper)
{
Property prop = get(category, key, -1, comment);
if (prop.getInt() != -1)
{
configMarkers[prop.getInt()] = true;
return prop;
}
else
{
if (defaultID < lower)
{
FMLLog.warning(
"Mod attempted to get a block ID with a default in the Terrain Generation section, " +
"mod authors should make sure there defaults are above 256 unless explicitly needed " +
"for terrain generation. Most ores do not need to be below 256.");
FMLLog.warning("Config \"%s\" Category: \"%s\" Key: \"%s\" Default: %d", fileName, category, key, defaultID);
defaultID = upper - 1;
}
if (Block.blocksList[defaultID] == null && !configMarkers[defaultID])
{
prop.set(defaultID);
configMarkers[defaultID] = true;
return prop;
}
else
{
for (int j = upper - 1; j > 0; j--)
{
if (Block.blocksList[j] == null && !configMarkers[j])
{
prop.set(j);
configMarkers[j] = true;
return prop;
}
}
throw new RuntimeException("No more block ids available for " + key);
}
}
}
public Property getItem(String key, int defaultID) { return getItem(CATEGORY_ITEM, key, defaultID, null); }
public Property getItem(String key, int defaultID, String comment) { return getItem(CATEGORY_ITEM, key, defaultID, comment); }
public Property getItem(String category, String key, int defaultID) { return getItem(category, key, defaultID, null); }
public Property getItem(String category, String key, int defaultID, String comment)
{
Property prop = get(category, key, -1, comment);
int defaultShift = defaultID + ITEM_SHIFT;
if (prop.getInt() != -1)
{
configMarkers[prop.getInt() + ITEM_SHIFT] = true;
return prop;
}
else
{
if (defaultID < MAX_BLOCKS - ITEM_SHIFT)
{
FMLLog.warning(
"Mod attempted to get a item ID with a default value in the block ID section, " +
"mod authors should make sure there defaults are above %d unless explicitly needed " +
"so that all block ids are free to store blocks.", MAX_BLOCKS - ITEM_SHIFT);
FMLLog.warning("Config \"%s\" Category: \"%s\" Key: \"%s\" Default: %d", fileName, category, key, defaultID);
}
if (Item.itemsList[defaultShift] == null && !configMarkers[defaultShift] && defaultShift >= Block.blocksList.length)
{
prop.set(defaultID);
configMarkers[defaultShift] = true;
return prop;
}
else
{
for (int x = Item.itemsList.length - 1; x >= ITEM_SHIFT; x--)
{
if (Item.itemsList[x] == null && !configMarkers[x])
{
prop.set(x - ITEM_SHIFT);
configMarkers[x] = true;
return prop;
}
}
throw new RuntimeException("No more item ids available for " + key);
}
}
}
public Property get(String category, String key, int defaultValue)
{
return get(category, key, defaultValue, null);

View File

@ -10,7 +10,6 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.WeightedRandom;
import net.minecraft.util.WeightedRandomChestContent;
import net.minecraft.util.WeightedRandomItem;
import static net.minecraftforge.common.ChestGenHooks.DUNGEON_CHEST;
@ -86,7 +85,7 @@ public class DungeonHooks
}
public static class DungeonMob extends WeightedRandomItem
public static class DungeonMob extends WeightedRandom.Item
{
public String type;
public DungeonMob(int weight, String type)

View File

@ -5,21 +5,20 @@ import java.util.*;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.FMLLog;
import net.minecraft.block.EnumMobType;
import net.minecraft.block.BlockPressurePlate.Sensitivity;
import net.minecraft.block.material.Material;
import net.minecraft.enchantment.EnumEnchantmentType;
import net.minecraft.entity.Entity.EnumEntitySize;
import net.minecraft.entity.EnumCreatureAttribute;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.entity.EnumEntitySize;
import net.minecraft.entity.player.EnumStatus;
import net.minecraft.entity.item.EntityPainting.EnumArt;
import net.minecraft.entity.player.EntityPlayer.EnumStatus;
import net.minecraft.item.EnumAction;
import net.minecraft.item.EnumArmorMaterial;
import net.minecraft.item.EnumToolMaterial;
import net.minecraft.util.EnumArt;
import net.minecraft.util.EnumMovingObjectType;
import net.minecraft.item.Item.ToolMaterial;
import net.minecraft.item.ItemArmor.ArmorMaterial;
import net.minecraft.util.MovingObjectPosition.MovingObjectType;
import net.minecraft.world.EnumSkyBlock;
import net.minecraft.world.gen.structure.EnumDoor;
import net.minecraft.world.gen.structure.StructureStrongholdPieces.Stronghold.Door;
import net.minecraftforge.classloading.FMLForgePlugin;
public class EnumHelper
@ -35,27 +34,27 @@ public class EnumHelper
private static Class[][] commonTypes =
{
{EnumAction.class},
{EnumArmorMaterial.class, int.class, int[].class, int.class},
{ArmorMaterial.class, int.class, int[].class, int.class},
{EnumArt.class, String.class, int.class, int.class, int.class, int.class},
{EnumCreatureAttribute.class},
{EnumCreatureType.class, Class.class, int.class, Material.class, boolean.class},
{EnumDoor.class},
{Door.class},
{EnumEnchantmentType.class},
{EnumEntitySize.class},
{EnumMobType.class},
{EnumMovingObjectType.class},
{Sensitivity.class},
{MovingObjectType.class},
{EnumSkyBlock.class, int.class},
{EnumStatus.class},
{EnumToolMaterial.class, int.class, int.class, float.class, float.class, int.class}
{ToolMaterial.class, int.class, int.class, float.class, float.class, int.class}
};
public static EnumAction addAction(String name)
{
return addEnum(EnumAction.class, name);
}
public static EnumArmorMaterial addArmorMaterial(String name, int durability, int[] reductionAmounts, int enchantability)
public static ArmorMaterial addArmorMaterial(String name, int durability, int[] reductionAmounts, int enchantability)
{
return addEnum(EnumArmorMaterial.class, name, durability, reductionAmounts, enchantability);
return addEnum(ArmorMaterial.class, name, durability, reductionAmounts, enchantability);
}
public static EnumArt addArt(String name, String tile, int sizeX, int sizeY, int offsetX, int offsetY)
{
@ -69,9 +68,9 @@ public class EnumHelper
{
return addEnum(EnumCreatureType.class, name, typeClass, maxNumber, material, peaceful);
}
public static EnumDoor addDoor(String name)
public static Door addDoor(String name)
{
return addEnum(EnumDoor.class, name);
return addEnum(Door.class, name);
}
public static EnumEnchantmentType addEnchantmentType(String name)
{
@ -81,18 +80,13 @@ public class EnumHelper
{
return addEnum(EnumEntitySize.class, name);
}
public static EnumMobType addMobType(String name)
public static Sensitivity addSensitivity(String name)
{
return addEnum(EnumMobType.class, name);
return addEnum(Sensitivity.class, name);
}
public static EnumMovingObjectType addMovingObjectType(String name)
public static MovingObjectType addMovingObjectType(String name)
{
if (!isSetup)
{
setup();
}
return addEnum(EnumMovingObjectType.class, name);
return addEnum(MovingObjectType.class, name);
}
public static EnumSkyBlock addSkyBlock(String name, int lightValue)
{
@ -102,9 +96,9 @@ public class EnumHelper
{
return addEnum(EnumStatus.class, name);
}
public static EnumToolMaterial addToolMaterial(String name, int harvestLevel, int maxUses, float efficiency, float damage, int enchantability)
public static ToolMaterial addToolMaterial(String name, int harvestLevel, int maxUses, float efficiency, float damage, int enchantability)
{
return addEnum(EnumToolMaterial.class, name, harvestLevel, maxUses, efficiency, damage, enchantability);
return addEnum(ToolMaterial.class, name, harvestLevel, maxUses, efficiency, damage, enchantability);
}
private static void setup()
@ -185,6 +179,7 @@ public class EnumHelper
public static <T extends Enum<? >> T addEnum(Class<T> enumType, String enumName, Object... paramValues)
{
setup();
return addEnum(commonTypes, enumType, enumName, paramValues);
}

View File

@ -1,48 +1,41 @@
package net.minecraftforge.common;
import com.mojang.authlib.GameProfile;
import cpw.mods.fml.common.FMLCommonHandler;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemInWorldManager;
import net.minecraft.network.packet.Packet204ClientInfo;
import net.minecraft.network.play.client.C15PacketClientSettings;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.management.ItemInWorldManager;
import net.minecraft.stats.StatBase;
import net.minecraft.util.ChatMessageComponent;
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.util.DamageSource;
import net.minecraft.util.IChatComponent;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
//Preliminary, simple Fake Player class
public class FakePlayer extends EntityPlayerMP
{
public FakePlayer(World world, String name)
public FakePlayer(WorldServer world, GameProfile name)
{
super(FMLCommonHandler.instance().getMinecraftServerInstance(), world, name, new ItemInWorldManager(world));
}
public void sendChatToPlayer(String s){}
public boolean canCommandSenderUseCommand(int i, String s){ return false; }
public ChunkCoordinates getPlayerCoordinates()
@Override public boolean canCommandSenderUseCommand(int i, String s){ return false; }
@Override public ChunkCoordinates getPlayerCoordinates()
{
return new ChunkCoordinates(0,0,0);
}
@Override
public void sendChatToPlayer(ChatMessageComponent chatmessagecomponent){}
@Override
public void addStat(StatBase par1StatBase, int par2){}
@Override
public void openGui(Object mod, int modGuiId, World world, int x, int y, int z){}
@Override
public boolean isEntityInvulnerable(){ return true; }
@Override
public boolean canAttackPlayer(EntityPlayer player){ return false; }
@Override
public void onDeath(DamageSource source){ return; }
@Override
public void onUpdate(){ return; }
@Override
public void travelToDimension(int dim){ return; }
@Override
public void updateClientInfo(Packet204ClientInfo pkt){ return; }
@Override public void func_146105_b(IChatComponent chatmessagecomponent){}
@Override public void addStat(StatBase par1StatBase, int par2){}
@Override public void openGui(Object mod, int modGuiId, World world, int x, int y, int z){}
@Override public boolean isEntityInvulnerable(){ return true; }
@Override public boolean canAttackPlayer(EntityPlayer player){ return false; }
@Override public void onDeath(DamageSource source){ return; }
@Override public void onUpdate(){ return; }
@Override public void travelToDimension(int dim){ return; }
@Override public void func_147100_a(C15PacketClientSettings pkt){ return; }
}

View File

@ -1,19 +1,27 @@
package net.minecraftforge.common;
import java.util.Map;
import java.util.UUID;
import com.google.common.collect.Maps;
import com.mojang.authlib.GameProfile;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
//To be expanded for generic Mod fake players?
public class FakePlayerFactory
{
private static GameProfile MINECRAFT = new GameProfile("41C82C87-7AfB-4024-BA57-13D2C99CAE77", "[Minecraft]");
// Map of all active fake player usernames to their entities
private static java.util.Map<String, FakePlayer> fakePlayers = new java.util.HashMap<String, FakePlayer>();
private static Map<GameProfile, FakePlayer> fakePlayers = Maps.newHashMap();
private static FakePlayer MINECRAFT_PLAYER = null;
public static FakePlayer getMinecraft(World world)
public static FakePlayer getMinecraft(WorldServer world)
{
if (MINECRAFT_PLAYER == null)
{
MINECRAFT_PLAYER = FakePlayerFactory.get(world, "[Minecraft]");
MINECRAFT_PLAYER = FakePlayerFactory.get(world, MINECRAFT);
}
return MINECRAFT_PLAYER;
}
@ -21,7 +29,7 @@ public class FakePlayerFactory
/**
* Get a fake player with a given username
*/
public static FakePlayer get(World world, String username)
public static FakePlayer get(WorldServer world, GameProfile username)
{
if (!fakePlayers.containsKey(username))
{

View File

@ -6,7 +6,7 @@ import java.util.Map;
import com.google.common.collect.Maps;
import net.minecraft.block.Block;
import net.minecraft.util.Icon;
import net.minecraft.util.IIcon;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDummyContainer;
@ -41,8 +41,8 @@ public class Fluid
protected String unlocalizedName;
/** The Icons for this fluid. */
protected Icon stillIcon;
protected Icon flowingIcon;
protected IIcon stillIcon;
protected IIcon flowingIcon;
/**
* The light level emitted by this fluid.
@ -92,11 +92,11 @@ public class Fluid
protected EnumRarity rarity = EnumRarity.common;
/**
* If there is a Block implementation of the Fluid, the BlockID is linked here.
* If there is a Block implementation of the Fluid, the Block is linked here.
*
* The default value of -1 should remain for any Fluid without a Block implementation.
* The default value of null should remain for any Fluid without a Block implementation.
*/
protected int blockID = -1;
protected Block block = null;
public Fluid(String fluidName)
{
@ -110,32 +110,27 @@ public class Fluid
return this;
}
public Fluid setBlockID(int blockID)
public Fluid setBlock(Block block)
{
if (this.blockID == -1 || this.blockID == blockID)
if (this.block == null || this.block == block)
{
this.blockID = blockID;
this.block = block;
}
else if (!ForgeDummyContainer.forceDuplicateFluidBlockCrash)
{
FMLLog.warning("A mod has attempted to assign BlockID " + blockID + " to the Fluid '" + fluidName + "' but this Fluid has already been linked to BlockID "
+ this.blockID + ". Configure your mods to prevent this from happening.");
FMLLog.warning("A mod has attempted to assign Block " + block + " to the Fluid '" + fluidName + "' but this Fluid has already been linked to BlockID "
+ this.block + ". Configure your mods to prevent this from happening.");
}
else
{
FMLLog.severe("A mod has attempted to assign BlockID " + blockID + " to the Fluid '" + fluidName + "' but this Fluid has already been linked to BlockID "
+ this.blockID + ". Configure your mods to prevent this from happening.");
throw new LoaderException(new RuntimeException("A mod has attempted to assign BlockID " + blockID + " to the Fluid '" + fluidName
+ "' but this Fluid has already been linked to BlockID " + this.blockID + ". Configure your mods to prevent this from happening."));
FMLLog.severe("A mod has attempted to assign BlockID " + block + " to the Fluid '" + fluidName + "' but this Fluid has already been linked to BlockID "
+ this.block + ". Configure your mods to prevent this from happening.");
throw new LoaderException(new RuntimeException("A mod has attempted to assign BlockID " + block + " to the Fluid '" + fluidName
+ "' but this Fluid has already been linked to BlockID " + this.block + ". Configure your mods to prevent this from happening."));
}
return this;
}
public Fluid setBlockID(Block block)
{
return setBlockID(block.blockID);
}
public Fluid setLuminosity(int luminosity)
{
this.luminosity = luminosity;
@ -182,14 +177,14 @@ public class Fluid
return FluidRegistry.getFluidID(this.fluidName);
}
public final int getBlockID()
public final Block getBlock()
{
return blockID;
return block;
}
public final boolean canBePlacedInWorld()
{
return blockID != -1;
return block != null;
}
/**
@ -253,36 +248,36 @@ public class Fluid
return 0xFFFFFF;
}
public final Fluid setStillIcon(Icon stillIcon)
public final Fluid setStillIcon(IIcon stillIcon)
{
this.stillIcon = stillIcon;
return this;
}
public final Fluid setFlowingIcon(Icon flowingIcon)
public final Fluid setFlowingIcon(IIcon flowingIcon)
{
this.flowingIcon = flowingIcon;
return this;
}
public final Fluid setIcons(Icon stillIcon, Icon flowingIcon)
public final Fluid setIcons(IIcon stillIcon, IIcon flowingIcon)
{
return this.setStillIcon(stillIcon).setFlowingIcon(flowingIcon);
}
public final Fluid setIcons(Icon commonIcon)
public final Fluid setIcons(IIcon commonIcon)
{
return this.setStillIcon(commonIcon).setFlowingIcon(commonIcon);
}
public Icon getIcon(){ return getStillIcon(); }
public IIcon getIcon(){ return getStillIcon(); }
public Icon getStillIcon()
public IIcon getStillIcon()
{
return this.stillIcon;
}
public Icon getFlowingIcon()
public IIcon getFlowingIcon()
{
return this.flowingIcon;
}
@ -295,7 +290,7 @@ public class Fluid
public boolean isGaseous(FluidStack stack){ return isGaseous(); }
public EnumRarity getRarity(FluidStack stack){ return getRarity(); }
public int getColor(FluidStack stack){ return getColor(); }
public Icon getIcon(FluidStack stack){ return getIcon(); }
public IIcon getIcon(FluidStack stack){ return getIcon(); }
/* World-based Accessors */
public int getLuminosity(World world, int x, int y, int z){ return getLuminosity(); }
public int getDensity(World world, int x, int y, int z){ return getDensity(); }
@ -304,7 +299,7 @@ public class Fluid
public boolean isGaseous(World world, int x, int y, int z){ return isGaseous(); }
public EnumRarity getRarity(World world, int x, int y, int z){ return getRarity(); }
public int getColor(World world, int x, int y, int z){ return getColor(); }
public Icon getIcon(World world, int x, int y, int z){ return getIcon(); }
public IIcon getIcon(World world, int x, int y, int z){ return getIcon(); }
private static Map<String, String> legacyNames = Maps.newHashMap();
static String convertLegacyName(String fluidName)

View File

@ -8,6 +8,8 @@ import java.util.Map;
import java.util.Map.Entry;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
@ -24,7 +26,6 @@ public class OreDictionary
private static HashMap<String, Integer> oreIDs = new HashMap<String, Integer>();
private static HashMap<Integer, ArrayList<ItemStack>> oreStacks = new HashMap<Integer, ArrayList<ItemStack>>();
/**
* Minecraft changed from -1 to Short.MAX_VALUE in 1.5 release for the "block wildcard". Use this in case it
* changes again.
@ -39,48 +40,53 @@ public class OreDictionary
{
if (!hasInit)
{
registerOre("logWood", new ItemStack(Block.wood, 1, WILDCARD_VALUE));
registerOre("plankWood", new ItemStack(Block.planks, 1, WILDCARD_VALUE));
registerOre("slabWood", new ItemStack(Block.woodSingleSlab, 1, WILDCARD_VALUE));
registerOre("stairWood", Block.stairsWoodOak);
registerOre("stairWood", Block.stairsWoodBirch);
registerOre("stairWood", Block.stairsWoodJungle);
registerOre("stairWood", Block.stairsWoodSpruce);
registerOre("stickWood", Item.stick);
registerOre("treeSapling", new ItemStack(Block.sapling, 1, WILDCARD_VALUE));
registerOre("treeLeaves", new ItemStack(Block.leaves, 1, WILDCARD_VALUE));
registerOre("oreGold", Block.oreGold);
registerOre("oreIron", Block.oreIron);
registerOre("oreLapis", Block.oreLapis);
registerOre("oreDiamond", Block.oreDiamond);
registerOre("oreRedstone", Block.oreRedstone);
registerOre("oreEmerald", Block.oreEmerald);
registerOre("oreQuartz", Block.oreNetherQuartz);
registerOre("stone", Block.stone);
registerOre("cobblestone", Block.cobblestone);
registerOre("record", Item.record13);
registerOre("record", Item.recordCat);
registerOre("record", Item.recordBlocks);
registerOre("record", Item.recordChirp);
registerOre("record", Item.recordFar);
registerOre("record", Item.recordMall);
registerOre("record", Item.recordMellohi);
registerOre("record", Item.recordStal);
registerOre("record", Item.recordStrad);
registerOre("record", Item.recordWard);
registerOre("record", Item.record11);
registerOre("record", Item.recordWait);
registerOre("logWood", new ItemStack(Blocks.log, 1, WILDCARD_VALUE));
registerOre("logWood", new ItemStack(Blocks.log2, 1, WILDCARD_VALUE));
registerOre("plankWood", new ItemStack(Blocks.planks, 1, WILDCARD_VALUE));
registerOre("slabWood", new ItemStack(Blocks.wooden_slab, 1, WILDCARD_VALUE));
registerOre("stairWood", Blocks.oak_stairs);
registerOre("stairWood", Blocks.spruce_stairs);
registerOre("stairWood", Blocks.birch_stairs);
registerOre("stairWood", Blocks.jungle_stairs);
registerOre("stairWood", Blocks.acacia_stairs);
registerOre("stairWood", Blocks.dark_oak_stairs);
registerOre("stickWood", Items.stick);
registerOre("treeSapling", new ItemStack(Blocks.sapling, 1, WILDCARD_VALUE));
registerOre("treeLeaves", new ItemStack(Blocks.leaves, 1, WILDCARD_VALUE));
registerOre("treeLeaves", new ItemStack(Blocks.leaves2, 1, WILDCARD_VALUE));
registerOre("oreGold", Blocks.gold_ore);
registerOre("oreIron", Blocks.iron_ore);
registerOre("oreLapis", Blocks.lapis_ore);
registerOre("oreDiamond", Blocks.diamond_ore);
registerOre("oreRedstone", Blocks.redstone_ore);
registerOre("oreEmerald", Blocks.emerald_ore);
registerOre("oreQuartz", Blocks.quartz_ore);
registerOre("oreCoal", Blocks.coal_ore);
registerOre("stone", Blocks.stone);
registerOre("cobblestone", Blocks.cobblestone);
registerOre("record", Items.record_13);
registerOre("record", Items.record_cat);
registerOre("record", Items.record_blocks);
registerOre("record", Items.record_chirp);
registerOre("record", Items.record_far);
registerOre("record", Items.record_mall);
registerOre("record", Items.record_mellohi);
registerOre("record", Items.record_stal);
registerOre("record", Items.record_strad);
registerOre("record", Items.record_ward);
registerOre("record", Items.record_11);
registerOre("record", Items.record_wait);
}
// Build our list of items to replace with ore tags
Map<ItemStack, String> replacements = new HashMap<ItemStack, String>();
replacements.put(new ItemStack(Item.stick), "stickWood");
replacements.put(new ItemStack(Block.planks), "plankWood");
replacements.put(new ItemStack(Block.planks, 1, WILDCARD_VALUE), "plankWood");
replacements.put(new ItemStack(Block.stone), "stone");
replacements.put(new ItemStack(Block.stone, 1, WILDCARD_VALUE), "stone");
replacements.put(new ItemStack(Block.cobblestone), "cobblestone");
replacements.put(new ItemStack(Block.cobblestone, 1, WILDCARD_VALUE), "cobblestone");
replacements.put(new ItemStack(Items.stick), "stickWood");
replacements.put(new ItemStack(Blocks.planks), "plankWood");
replacements.put(new ItemStack(Blocks.planks, 1, WILDCARD_VALUE), "plankWood");
replacements.put(new ItemStack(Blocks.stone), "stone");
replacements.put(new ItemStack(Blocks.stone, 1, WILDCARD_VALUE), "stone");
replacements.put(new ItemStack(Blocks.cobblestone), "cobblestone");
replacements.put(new ItemStack(Blocks.cobblestone, 1, WILDCARD_VALUE), "cobblestone");
// Register dyes
String[] dyes =
@ -105,7 +111,7 @@ public class OreDictionary
for(int i = 0; i < 16; i++)
{
ItemStack dye = new ItemStack(Item.dyePowder, 1, i);
ItemStack dye = new ItemStack(Items.dye, 1, i);
if (!hasInit)
{
registerOre(dyes[i], dye);
@ -119,12 +125,12 @@ public class OreDictionary
// Ignore recipes for the following items
ItemStack[] exclusions = new ItemStack[]
{
new ItemStack(Block.blockLapis),
new ItemStack(Item.cookie),
new ItemStack(Block.stoneBrick),
new ItemStack(Block.stoneSingleSlab),
new ItemStack(Block.stairsCobblestone),
new ItemStack(Block.cobblestoneWall)
new ItemStack(Blocks.lapis_block),
new ItemStack(Items.cookie),
new ItemStack(Blocks.stonebrick),
new ItemStack(Blocks.stone_slab),
new ItemStack(Blocks.stone_stairs),
new ItemStack(Blocks.cobblestone_wall)
};
List recipes = CraftingManager.getInstance().getRecipeList();
@ -230,7 +236,7 @@ public class OreDictionary
{
for(ItemStack target : ore.getValue())
{
if(itemStack.itemID == target.itemID && (target.getItemDamage() == WILDCARD_VALUE || itemStack.getItemDamage() == target.getItemDamage()))
if(itemStack.getItem() == target.getItem() && (target.getItemDamage() == WILDCARD_VALUE || itemStack.getItemDamage() == target.getItemDamage()))
{
return ore.getKey();
}
@ -300,7 +306,7 @@ public class OreDictionary
{
return false;
}
return (target.itemID == input.itemID && ((target.getItemDamage() == WILDCARD_VALUE && !strict) || target.getItemDamage() == input.getItemDamage()));
return (target.getItem() == input.getItem() && ((target.getItemDamage() == WILDCARD_VALUE && !strict) || target.getItemDamage() == input.getItemDamage()));
}
//Convenience functions that make for cleaner code mod side. They all drill down to registerOre(String, int, ItemStack)

View File

@ -243,7 +243,7 @@ public class ShapedOreRecipe implements IRecipe
{
return false;
}
return (target.itemID == input.itemID && (target.getItemDamage() == OreDictionary.WILDCARD_VALUE|| target.getItemDamage() == input.getItemDamage()));
return (target.getItem() == input.getItem() && (target.getItemDamage() == OreDictionary.WILDCARD_VALUE|| target.getItemDamage() == input.getItemDamage()));
}
public ShapedOreRecipe setMirrored(boolean mirror)

View File

@ -137,7 +137,7 @@ public class ShapelessOreRecipe implements IRecipe
private boolean checkItemEquals(ItemStack target, ItemStack input)
{
return (target.itemID == input.itemID && (target.getItemDamage() == OreDictionary.WILDCARD_VALUE || target.getItemDamage() == input.getItemDamage()));
return (target.getItem() == input.getItem() && (target.getItemDamage() == OreDictionary.WILDCARD_VALUE || target.getItemDamage() == input.getItemDamage()));
}
/**

View File

@ -10,7 +10,7 @@ import net.minecraft.command.ICommand;
import net.minecraft.command.ICommandSender;
import net.minecraft.command.WrongUsageException;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.ChatMessageComponent;
import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.world.ChunkCoordIntPair;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
@ -97,7 +97,7 @@ public class ForgeCommand extends CommandBase {
{
ForgeTimeTracker.tileEntityTrackingDuration = duration;
ForgeTimeTracker.tileEntityTracking = true;
sender.sendChatToPlayer(ChatMessageComponent.createFromTranslationWithSubstitutions("commands.forge.tracking.te.enabled", duration));
sender.func_145747_a(new ChatComponentTranslation("commands.forge.tracking.te.enabled", duration));
}
private void doTPSLog(ICommandSender sender, String[] args)
@ -120,17 +120,17 @@ public class ForgeCommand extends CommandBase {
{
double worldTickTime = ForgeCommand.mean(this.server.worldTickTimes.get(dimId)) * 1.0E-6D;
double worldTPS = Math.min(1000.0/worldTickTime, 20);
sender.sendChatToPlayer(ChatMessageComponent.createFromTranslationWithSubstitutions("commands.forge.tps.summary",String.format("Dim %d", dimId), timeFormatter.format(worldTickTime), timeFormatter.format(worldTPS)));
sender.func_145747_a(new ChatComponentTranslation("commands.forge.tps.summary",String.format("Dim %d", dimId), timeFormatter.format(worldTickTime), timeFormatter.format(worldTPS)));
}
double meanTickTime = ForgeCommand.mean(this.server.tickTimeArray) * 1.0E-6D;
double meanTPS = Math.min(1000.0/meanTickTime, 20);
sender.sendChatToPlayer(ChatMessageComponent.createFromTranslationWithSubstitutions("commands.forge.tps.summary","Overall", timeFormatter.format(meanTickTime), timeFormatter.format(meanTPS)));
sender.func_145747_a(new ChatComponentTranslation("commands.forge.tps.summary","Overall", timeFormatter.format(meanTickTime), timeFormatter.format(meanTPS)));
}
else
{
double worldTickTime = ForgeCommand.mean(this.server.worldTickTimes.get(dim)) * 1.0E-6D;
double worldTPS = Math.min(1000.0/worldTickTime, 20);
sender.sendChatToPlayer(ChatMessageComponent.createFromTranslationWithSubstitutions("commands.forge.tps.summary",String.format("Dim %d", dim), timeFormatter.format(worldTickTime), timeFormatter.format(worldTPS)));
sender.func_145747_a(new ChatComponentTranslation("commands.forge.tps.summary",String.format("Dim %d", dim), timeFormatter.format(worldTickTime), timeFormatter.format(worldTPS)));
}
}

View File

@ -73,13 +73,13 @@
public net.minecraft.util.WeightedRandomChestContent.*
public net.minecraft.world.WorldServer.field_73069_S
public net.minecraft.world.gen.structure.StructureMineshaftPieces.field_78818_a
public net.minecraft.world.gen.structure.ComponentScatteredFeaturePieces.DesertPyramid.field_74941_i
public net.minecraft.world.gen.structure.ComponentScatteredFeaturePieces.JunglePyramid.field_74943_l
public net.minecraft.world.gen.structure.ComponentScatteredFeaturePieces.JunglePyramid.field_74944_m
public net.minecraft.world.gen.structure.StructureStrongholdPieces.ChestCorridor.field_75003_a
public net.minecraft.world.gen.structure.StructureStrongholdPieces.Library.field_75007_b
public net.minecraft.world.gen.structure.StructureStrongholdPieces.RoomCrossing.field_75014_c
public net.minecraft.world.gen.structure.StructureVillagePieces.House2.field_74918_a
public net.minecraft.world.gen.structure.ComponentScatteredFeaturePieces$DesertPyramid.field_74941_i
public net.minecraft.world.gen.structure.ComponentScatteredFeaturePieces$JunglePyramid.field_74943_l
public net.minecraft.world.gen.structure.ComponentScatteredFeaturePieces$JunglePyramid.field_74944_m
public net.minecraft.world.gen.structure.StructureStrongholdPieces$ChestCorridor.field_75003_a
public net.minecraft.world.gen.structure.StructureStrongholdPieces$Library.field_75007_b
public net.minecraft.world.gen.structure.StructureStrongholdPieces$RoomCrossing.field_75014_c
public net.minecraft.world.gen.structure.StructureVillagePieces$House2.field_74918_a
public net.minecraft.world.gen.feature.WorldGenDungeons.field_111189_a
# AnvilChunkLoader.chunkSaveLocation
#public aee.d #FD:AnvilChunkLoader/field_75825_d
@ -103,11 +103,11 @@ public net.minecraft.world.gen.feature.WorldGenDungeons.field_111189_a
# MapGenVillage
#public-f aiw.e #FD:MapGenVillage/field_75055_e #villageSpawnBiomes
# ShapedRecipes
#public+f aai.d #FD:ShapedRecipes/field_77574_d #recipeItems
#public+f aai.b #FD:ShapedRecipes/field_77576_b #recipeWidth
#public+f aai.c #FD:ShapedRecipes/field_77577_c #recipeHeight
public+f net.minecraft.item.crafting.ShapedRecipes.field_77574_d #recipeItems
public+f net.minecraft.item.crafting.ShapedRecipes.field_77576_b #recipeWidth
public+f net.minecraft.item.crafting.ShapedRecipes.field_77577_c #recipeHeight
# ShapelessRecipes
#public aaj.b #FD:ShapelessRecipes/field_77579_b #recipeItems
public net.minecraft.item.crafting.ShapelessRecipes.field_77579_b #recipeItems
# GuiContainer
#protected awy.a(Lwe;)V #MD:GuiContainer/func_74192_a #drawSlotInventory
# ContainerPlayer
@ -116,7 +116,7 @@ public net.minecraft.world.gen.feature.WorldGenDungeons.field_111189_a
#protected anf.n(Labw;III)V #MD:BlockButton/func_82535_o #checkActivation
#protected-f anf.a #FD:BlockButton/field_82537_a #sensible
# BiomeDecorator
#public acu.* #FD:BiomeDecorator/* # All private -> protected
public net.minecraft.world.biome.BiomeDecorator.*
# CreativeTabs
#public-f ww.a #FD:CreativeTabs/field_78032_a # creativeTabArray non-final
# Packet
@ -158,3 +158,5 @@ protected net.minecraft.client.gui.GuiIngame.*()
# MapGenStructureIO
#public air.b(Ljava/lang/Class;Ljava/lang/String;)V #MD:MapGenStructureIO/func_143034_b #registerStart
#public air.a(Ljava/lang/Class;Ljava/lang/String;)V #MD:MapGenStructureIO/func_143031_a #registerPiece
# Stronghold
public net.minecraft.world.gen.structure.StructureStrongholdPieces$Stronghold