More work on misc things.

This commit is contained in:
LexManos 2016-03-03 02:57:38 -08:00
parent f821759c21
commit 8a506022d7
12 changed files with 497 additions and 448 deletions

View file

@ -188,7 +188,15 @@
} }
protected ItemStack createStackedBlock(IBlockState state) protected ItemStack createStackedBlock(IBlockState state)
@@ -844,6 +864,1175 @@ @@ -747,6 +767,7 @@
entityIn.motionY = 0.0D;
}
+ @Deprecated // Forge: Use more sensitive version below: getPickBlock
public ItemStack func_185473_a(World p_185473_1_, BlockPos p_185473_2_, IBlockState p_185473_3_)
{
return new ItemStack(Item.getItemFromBlock(this), 1, this.damageDropped(p_185473_3_));
@@ -844,6 +865,1162 @@
return "Block{" + blockRegistry.getNameForObject(this) + "}"; return "Block{" + blockRegistry.getNameForObject(this) + "}";
} }
@ -788,22 +796,9 @@
+ * @param target The full target the player is looking at + * @param target The full target the player is looking at
+ * @return A ItemStack to add to the player's inventory, Null if nothing should be added. + * @return A ItemStack to add to the player's inventory, Null if nothing should be added.
+ */ + */
+ public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) + public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player)
+ { + {
+ return getPickBlock(target, world, pos); + return func_185473_a(world, pos, state);
+ }
+ @Deprecated
+ public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos)
+ {
+ Item item = getItem(world, pos);
+
+ if (item == null)
+ {
+ return null;
+ }
+
+ Block block = item instanceof ItemBlock && !isFlowerPot() ? Block.getBlockFromItem(item) : this;
+ return new ItemStack(item, 1, block.getDamageValue(world, pos));
+ } + }
+ +
+ /** + /**
@ -846,7 +841,7 @@
+ * @return True to prevent vanilla digging particles form spawning. + * @return True to prevent vanilla digging particles form spawning.
+ */ + */
+ @SideOnly(Side.CLIENT) + @SideOnly(Side.CLIENT)
+ public boolean addHitEffects(World worldObj, MovingObjectPosition target, net.minecraft.client.particle.EffectRenderer effectRenderer) + public boolean addHitEffects(World worldObj, RayTraceResult target, net.minecraft.client.particle.EffectRenderer effectRenderer)
+ { + {
+ return false; + return false;
+ } + }

View file

@ -8,6 +8,19 @@
this.isDemo = gameConfig.gameInfo.isDemo; this.isDemo = gameConfig.gameInfo.isDemo;
this.displayWidth = gameConfig.displayInfo.width > 0 ? gameConfig.displayInfo.width : 1; this.displayWidth = gameConfig.displayInfo.width > 0 ? gameConfig.displayInfo.width : 1;
this.displayHeight = gameConfig.displayInfo.height > 0 ? gameConfig.displayInfo.height : 1; this.displayHeight = gameConfig.displayInfo.height > 0 ? gameConfig.displayInfo.height : 1;
@@ -432,10 +431,10 @@
this.mcResourceManager = new SimpleReloadableResourceManager(this.metadataSerializer_);
this.mcLanguageManager = new LanguageManager(this.metadataSerializer_, this.gameSettings.language);
this.mcResourceManager.registerReloadListener(this.mcLanguageManager);
- this.refreshResources();
+ net.minecraftforge.fml.client.FMLClientHandler.instance().beginMinecraftLoading(this, this.defaultResourcePacks, this.mcResourceManager);
this.renderEngine = new TextureManager(this.mcResourceManager);
this.mcResourceManager.registerReloadListener(this.renderEngine);
- this.drawSplashScreen(this.renderEngine);
+ net.minecraftforge.fml.client.SplashProgress.drawVanillaScreen(this.renderEngine);
this.skinManager = new SkinManager(this.renderEngine, new File(this.fileAssets, "skins"), this.sessionService);
this.saveLoader = new AnvilSaveConverter(new File(this.mcDataDir, "saves"), this.field_184131_U);
this.mcSoundHandler = new SoundHandler(this.mcResourceManager, this.gameSettings);
@@ -469,6 +468,8 @@ @@ -469,6 +468,8 @@
} }
}); });
@ -17,7 +30,62 @@
this.checkGLError("Pre startup"); this.checkGLError("Pre startup");
GlStateManager.enableTexture2D(); GlStateManager.enableTexture2D();
GlStateManager.shadeModel(7425); GlStateManager.shadeModel(7425);
@@ -692,21 +693,23 @@ @@ -482,19 +483,23 @@
GlStateManager.loadIdentity();
GlStateManager.matrixMode(5888);
this.checkGLError("Startup");
- this.textureMapBlocks = new TextureMap("textures");
+ bar.step("Loading Texture Map");
+ this.textureMapBlocks = new TextureMap("textures", true);
this.textureMapBlocks.setMipmapLevels(this.gameSettings.mipmapLevels);
this.renderEngine.loadTickableTexture(TextureMap.locationBlocksTexture, this.textureMapBlocks);
this.renderEngine.bindTexture(TextureMap.locationBlocksTexture);
this.textureMapBlocks.setBlurMipmapDirect(false, this.gameSettings.mipmapLevels > 0);
+ bar.step("Loading Model Manager");
this.modelManager = new ModelManager(this.textureMapBlocks);
this.mcResourceManager.registerReloadListener(this.modelManager);
this.field_184127_aH = BlockColors.func_186723_a();
this.field_184128_aI = ItemColors.func_186729_a(this.field_184127_aH);
+ bar.step("Loading Item Renderer");
this.renderItem = new RenderItem(this.renderEngine, this.modelManager, this.field_184128_aI);
this.renderManager = new RenderManager(this.renderEngine, this.renderItem);
this.itemRenderer = new ItemRenderer(this);
this.mcResourceManager.registerReloadListener(this.renderItem);
+ bar.step("Loading Entity Renderer");
this.entityRenderer = new EntityRenderer(this, this.mcResourceManager);
this.mcResourceManager.registerReloadListener(this.entityRenderer);
this.blockRenderDispatcher = new BlockRendererDispatcher(this.modelManager.getBlockModelShapes(), this.field_184127_aH);
@@ -504,23 +509,26 @@
this.guiAchievement = new GuiAchievement(this);
GlStateManager.viewport(0, 0, this.displayWidth, this.displayHeight);
this.effectRenderer = new EffectRenderer(this.theWorld, this.renderEngine);
+ net.minecraftforge.fml.common.ProgressManager.pop(bar);
+ net.minecraftforge.fml.client.FMLClientHandler.instance().finishMinecraftLoading();
this.checkGLError("Post startup");
- this.ingameGUI = new GuiIngame(this);
+ this.ingameGUI = new net.minecraftforge.client.GuiIngameForge(this);
if (this.serverName != null)
{
- this.displayGuiScreen(new GuiConnecting(new GuiMainMenu(), this, this.serverName, this.serverPort));
+ net.minecraftforge.fml.client.FMLClientHandler.instance().connectToServerAtStartup(this.serverName, this.serverPort);
}
else
{
this.displayGuiScreen(new GuiMainMenu());
}
- this.renderEngine.deleteTexture(this.mojangLogo);
+ net.minecraftforge.fml.client.SplashProgress.clearVanillaResources(renderEngine, mojangLogo);
this.mojangLogo = null;
this.loadingScreen = new LoadingScreenRenderer(this);
this.field_184132_p = new DebugRenderer(this);
+ net.minecraftforge.fml.client.FMLClientHandler.instance().onInitializationComplete();
if (this.gameSettings.fullScreen && !this.fullscreen)
{
this.toggleFullscreen();
@@ -692,21 +700,23 @@
File file2 = new File(file1, "crash-" + (new SimpleDateFormat("yyyy-MM-dd_HH.mm.ss")).format(new Date()) + "-client.txt"); File file2 = new File(file1, "crash-" + (new SimpleDateFormat("yyyy-MM-dd_HH.mm.ss")).format(new Date()) + "-client.txt");
Bootstrap.printToSYSOUT(crashReportIn.getCompleteReport()); Bootstrap.printToSYSOUT(crashReportIn.getCompleteReport());
@ -44,7 +112,7 @@
} }
public boolean isUnicode() public boolean isUnicode()
@@ -899,11 +902,6 @@ @@ -899,11 +909,6 @@
public void displayGuiScreen(GuiScreen guiScreenIn) public void displayGuiScreen(GuiScreen guiScreenIn)
{ {
@ -56,7 +124,25 @@
if (guiScreenIn == null && this.theWorld == null) if (guiScreenIn == null && this.theWorld == null)
{ {
guiScreenIn = new GuiMainMenu(); guiScreenIn = new GuiMainMenu();
@@ -1051,9 +1049,11 @@ @@ -913,6 +918,17 @@
guiScreenIn = new GuiGameOver((ITextComponent)null);
}
+ GuiScreen old = this.currentScreen;
+ net.minecraftforge.client.event.GuiOpenEvent event = new net.minecraftforge.client.event.GuiOpenEvent(guiScreenIn);
+
+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return;
+
+ guiScreenIn = event.gui;
+ if (old != null && guiScreenIn != old)
+ {
+ old.onGuiClosed();
+ }
+
if (guiScreenIn instanceof GuiMainMenu || guiScreenIn instanceof GuiMultiplayer)
{
this.gameSettings.showDebugInfo = false;
@@ -1051,9 +1067,11 @@
if (!this.skipRenderWorld) if (!this.skipRenderWorld)
{ {
@ -68,7 +154,28 @@
} }
this.mcProfiler.endSection(); this.mcProfiler.endSection();
@@ -1623,6 +1623,8 @@ @@ -1393,9 +1411,9 @@
{
BlockPos blockpos = this.objectMouseOver.getBlockPos();
- if (this.theWorld.getBlockState(blockpos).func_185904_a() != Material.air && this.playerController.onPlayerDamageBlock(blockpos, this.objectMouseOver.sideHit))
+ if (!this.theWorld.isAirBlock(blockpos) && this.playerController.onPlayerDamageBlock(blockpos, this.objectMouseOver.sideHit))
{
- this.effectRenderer.addBlockHitEffects(blockpos, this.objectMouseOver.sideHit);
+ this.effectRenderer.addBlockHitEffects(blockpos, this.objectMouseOver);
this.thePlayer.func_184609_a(EnumHand.MAIN_HAND);
}
}
@@ -1429,7 +1447,7 @@
case BLOCK:
BlockPos blockpos = this.objectMouseOver.getBlockPos();
- if (this.theWorld.getBlockState(blockpos).func_185904_a() != Material.air)
+ if (!this.theWorld.isAirBlock(blockpos))
{
this.playerController.clickBlock(blockpos, this.objectMouseOver.sideHit);
break;
@@ -1623,6 +1641,8 @@
--this.rightClickDelayTimer; --this.rightClickDelayTimer;
} }
@ -77,7 +184,7 @@
this.mcProfiler.startSection("gui"); this.mcProfiler.startSection("gui");
if (!this.isGamePaused) if (!this.isGamePaused)
@@ -1734,6 +1736,7 @@ @@ -1734,6 +1754,7 @@
this.joinPlayerCounter = 0; this.joinPlayerCounter = 0;
this.theWorld.joinEntityInSurroundings(this.thePlayer); this.theWorld.joinEntityInSurroundings(this.thePlayer);
} }
@ -85,7 +192,15 @@
} }
this.mcProfiler.endStartSection("gameRenderer"); this.mcProfiler.endStartSection("gameRenderer");
@@ -1926,6 +1929,7 @@ @@ -1821,6 +1842,7 @@
this.myNetworkManager.processReceivedPackets();
}
+ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPostClientTick();
this.mcProfiler.endSection();
this.systemTime = getSystemTime();
}
@@ -1926,6 +1948,7 @@
this.gameSettings.showLagometer = this.gameSettings.showDebugInfo && GuiScreen.isAltKeyDown(); this.gameSettings.showLagometer = this.gameSettings.showDebugInfo && GuiScreen.isAltKeyDown();
} }
} }
@ -93,7 +208,24 @@
} }
} }
@@ -2273,6 +2277,12 @@ @@ -2166,6 +2189,8 @@
{
while (Mouse.next())
{
+ if (net.minecraftforge.client.ForgeHooksClient.postMouseEvent()) continue;
+
int i = Mouse.getEventButton();
KeyBinding.setKeyBindState(i - 100, Mouse.getEventButtonState());
@@ -2231,6 +2256,7 @@
public void launchIntegratedServer(String folderName, String worldName, WorldSettings worldSettingsIn)
{
+ net.minecraftforge.fml.client.FMLClientHandler.instance().startIntegratedServer(folderName, worldName, worldSettingsIn);
this.loadWorld((WorldClient)null);
System.gc();
ISaveHandler isavehandler = this.saveLoader.getSaveLoader(folderName, false);
@@ -2273,6 +2299,12 @@
while (!this.theIntegratedServer.serverIsInRunLoop()) while (!this.theIntegratedServer.serverIsInRunLoop())
{ {
@ -106,7 +238,24 @@
String s = this.theIntegratedServer.getUserMessage(); String s = this.theIntegratedServer.getUserMessage();
if (s != null) if (s != null)
@@ -2310,6 +2320,8 @@ @@ -2298,8 +2330,14 @@
SocketAddress socketaddress = this.theIntegratedServer.getNetworkSystem().addLocalEndpoint();
NetworkManager networkmanager = NetworkManager.provideLocalClient(socketaddress);
networkmanager.setNetHandler(new NetHandlerLoginClient(networkmanager, this, (GuiScreen)null));
- networkmanager.sendPacket(new C00Handshake(107, socketaddress.toString(), 0, EnumConnectionState.LOGIN));
- networkmanager.sendPacket(new CPacketLoginStart(this.getSession().getProfile()));
+ networkmanager.sendPacket(new C00Handshake(107, socketaddress.toString(), 0, EnumConnectionState.LOGIN, true));
+ com.mojang.authlib.GameProfile gameProfile = this.getSession().getProfile();
+ if (!this.getSession().hasCachedProperties())
+ {
+ gameProfile = sessionService.fillProfileProperties(gameProfile, true); //Forge: Fill profile properties upon game load. Fixes MC-52974.
+ this.getSession().setProperties(gameProfile.getProperties());
+ }
+ networkmanager.sendPacket(new CPacketLoginStart(gameProfile));
this.myNetworkManager = networkmanager;
}
@@ -2310,6 +2348,8 @@
public void loadWorld(WorldClient worldClientIn, String loadingMessage) public void loadWorld(WorldClient worldClientIn, String loadingMessage)
{ {
@ -115,7 +264,26 @@
if (worldClientIn == null) if (worldClientIn == null)
{ {
NetHandlerPlayClient nethandlerplayclient = this.getNetHandler(); NetHandlerPlayClient nethandlerplayclient = this.getNetHandler();
@@ -2345,6 +2357,7 @@ @@ -2322,6 +2362,18 @@
if (this.theIntegratedServer != null && this.theIntegratedServer.isAnvilFileSet())
{
this.theIntegratedServer.initiateShutdown();
+ if (loadingScreen != null)
+ {
+ this.loadingScreen.displayLoadingString(I18n.format("forge.client.shutdown.internal"));
+ }
+ while (!theIntegratedServer.isServerStopped())
+ {
+ try
+ {
+ Thread.sleep(10);
+ }
+ catch (InterruptedException ie) {}
+ }
}
this.theIntegratedServer = null;
@@ -2345,6 +2397,7 @@
this.ingameGUI.func_181029_i(); this.ingameGUI.func_181029_i();
this.setServerData((ServerData)null); this.setServerData((ServerData)null);
this.integratedServerIsRunning = false; this.integratedServerIsRunning = false;
@ -123,3 +291,186 @@
} }
this.mcSoundHandler.stopSounds(); this.mcSoundHandler.stopSounds();
@@ -2461,159 +2514,8 @@
{
if (this.objectMouseOver != null && this.objectMouseOver.typeOfHit != RayTraceResult.Type.MISS)
{
- boolean flag = this.thePlayer.capabilities.isCreativeMode;
- TileEntity tileentity = null;
- ItemStack itemstack;
-
- if (this.objectMouseOver.typeOfHit == RayTraceResult.Type.BLOCK)
- {
- BlockPos blockpos = this.objectMouseOver.getBlockPos();
- IBlockState iblockstate = this.theWorld.getBlockState(blockpos);
- Block block = iblockstate.getBlock();
-
- if (iblockstate.func_185904_a() == Material.air)
- {
- return;
- }
-
- itemstack = block.func_185473_a(this.theWorld, blockpos, iblockstate);
-
- if (itemstack == null)
- {
- return;
- }
-
- if (flag && GuiScreen.isCtrlKeyDown() && block.hasTileEntity())
- {
- tileentity = this.theWorld.getTileEntity(blockpos);
- }
- }
- else
- {
- if (this.objectMouseOver.typeOfHit != RayTraceResult.Type.ENTITY || this.objectMouseOver.entityHit == null || !flag)
- {
- return;
- }
-
- if (this.objectMouseOver.entityHit instanceof EntityPainting)
- {
- itemstack = new ItemStack(Items.painting);
- }
- else if (this.objectMouseOver.entityHit instanceof EntityLeashKnot)
- {
- itemstack = new ItemStack(Items.lead);
- }
- else if (this.objectMouseOver.entityHit instanceof EntityItemFrame)
- {
- EntityItemFrame entityitemframe = (EntityItemFrame)this.objectMouseOver.entityHit;
- ItemStack itemstack1 = entityitemframe.getDisplayedItem();
-
- if (itemstack1 == null)
- {
- itemstack = new ItemStack(Items.item_frame);
- }
- else
- {
- itemstack = ItemStack.copyItemStack(itemstack1);
- }
- }
- else if (this.objectMouseOver.entityHit instanceof EntityMinecart)
- {
- EntityMinecart entityminecart = (EntityMinecart)this.objectMouseOver.entityHit;
- Item item;
-
- switch (entityminecart.func_184264_v())
- {
- case FURNACE:
- item = Items.furnace_minecart;
- break;
- case CHEST:
- item = Items.chest_minecart;
- break;
- case TNT:
- item = Items.tnt_minecart;
- break;
- case HOPPER:
- item = Items.hopper_minecart;
- break;
- case COMMAND_BLOCK:
- item = Items.command_block_minecart;
- break;
- default:
- item = Items.minecart;
- }
-
- itemstack = new ItemStack(item);
- }
- else if (this.objectMouseOver.entityHit instanceof EntityBoat)
- {
- itemstack = new ItemStack(((EntityBoat)this.objectMouseOver.entityHit).func_184455_j());
- }
- else if (this.objectMouseOver.entityHit instanceof EntityArmorStand)
- {
- itemstack = new ItemStack(Items.armor_stand);
- }
- else if (this.objectMouseOver.entityHit instanceof EntityEnderCrystal)
- {
- itemstack = new ItemStack(Items.field_185158_cP);
- }
- else
- {
- String s = EntityList.getEntityString(this.objectMouseOver.entityHit);
-
- if (!EntityList.entityEggs.containsKey(s))
- {
- return;
- }
-
- itemstack = new ItemStack(Items.spawn_egg);
- ItemMonsterPlacer.func_185078_a(itemstack, s);
- }
- }
-
- if (itemstack.getItem() == null)
- {
- String s1 = "";
-
- if (this.objectMouseOver.typeOfHit == RayTraceResult.Type.BLOCK)
- {
- s1 = ((ResourceLocation)Block.blockRegistry.getNameForObject(this.theWorld.getBlockState(this.objectMouseOver.getBlockPos()).getBlock())).toString();
- }
- else if (this.objectMouseOver.typeOfHit == RayTraceResult.Type.ENTITY)
- {
- s1 = EntityList.getEntityString(this.objectMouseOver.entityHit);
- }
-
- logger.warn("Picking on: [{}] {} gave null item", new Object[] {this.objectMouseOver.typeOfHit, s1});
- }
- else
- {
- InventoryPlayer inventoryplayer = this.thePlayer.inventory;
-
- if (tileentity != null)
- {
- this.func_184119_a(itemstack, tileentity);
- }
-
- int i = inventoryplayer.func_184429_b(itemstack);
-
- if (flag)
- {
- inventoryplayer.func_184434_a(itemstack);
- this.playerController.sendSlotPacket(this.thePlayer.func_184586_b(EnumHand.MAIN_HAND), 36 + inventoryplayer.currentItem);
- }
- else if (i != -1)
- {
- if (InventoryPlayer.func_184435_e(i))
- {
- inventoryplayer.currentItem = i;
- }
- else
- {
- this.playerController.func_187100_a(i);
- }
- }
- }
+ net.minecraftforge.common.ForgeHooks.onPickBlock(this.objectMouseOver, this.thePlayer, this.theWorld);
+ // We delete this code wholly instead of commenting it out, to make sure we detect changes in it between MC versions
}
}
@@ -2909,18 +2811,8 @@
public static int getGLMaximumTextureSize()
{
- for (int i = 16384; i > 0; i >>= 1)
- {
- GlStateManager.func_187419_a(32868, 0, 6408, i, i, 0, 6408, 5121, (IntBuffer)null);
- int j = GlStateManager.func_187411_c(32868, 0, 4096);
-
- if (j != 0)
- {
- return i;
- }
- }
-
- return -1;
+ //Forge we redirect this to our code which caches the value before any splash screen stuff is done.
+ return net.minecraftforge.fml.client.SplashProgress.getMaxTextureSize();
}
public boolean isSnooperEnabled()

View file

@ -1,10 +1,11 @@
++++ REJECTED PATCH 1 --- ../src-base/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java
+++ ../src-work/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java
@@ -67,7 +67,7 @@
inetaddress = InetAddress.getByName(ip); inetaddress = InetAddress.getByName(ip);
GuiConnecting.this.networkManager = NetworkManager.func_181124_a(inetaddress, port, GuiConnecting.this.mc.gameSettings.func_181148_f()); GuiConnecting.this.networkManager = NetworkManager.func_181124_a(inetaddress, port, GuiConnecting.this.mc.gameSettings.func_181148_f());
GuiConnecting.this.networkManager.setNetHandler(new NetHandlerLoginClient(GuiConnecting.this.networkManager, GuiConnecting.this.mc, GuiConnecting.this.previousGuiScreen)); GuiConnecting.this.networkManager.setNetHandler(new NetHandlerLoginClient(GuiConnecting.this.networkManager, GuiConnecting.this.mc, GuiConnecting.this.previousGuiScreen));
- GuiConnecting.this.networkManager.sendPacket(new C00Handshake(47, ip, port, EnumConnectionState.LOGIN)); - GuiConnecting.this.networkManager.sendPacket(new C00Handshake(107, ip, port, EnumConnectionState.LOGIN));
+ GuiConnecting.this.networkManager.sendPacket(new C00Handshake(47, ip, port, EnumConnectionState.LOGIN, true)); + GuiConnecting.this.networkManager.sendPacket(new C00Handshake(107, ip, port, EnumConnectionState.LOGIN, true));
GuiConnecting.this.networkManager.sendPacket(new C00PacketLoginStart(GuiConnecting.this.mc.getSession().getProfile())); GuiConnecting.this.networkManager.sendPacket(new CPacketLoginStart(GuiConnecting.this.mc.getSession().getProfile()));
} }
catch (UnknownHostException unknownhostexception) catch (UnknownHostException unknownhostexception)
++++ END PATCH

View file

@ -1,14 +1,24 @@
--- ../src-base/minecraft/net/minecraft/client/particle/EffectRenderer.java --- ../src-base/minecraft/net/minecraft/client/particle/EffectRenderer.java
+++ ../src-work/minecraft/net/minecraft/client/particle/EffectRenderer.java +++ ../src-work/minecraft/net/minecraft/client/particle/EffectRenderer.java
@@ -460,4 +460,13 @@ @@ -3,6 +3,9 @@
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Queues;
+
+import akka.actor.FSM.State;
+
import java.util.ArrayDeque;
import java.util.Iterator;
import java.util.List;
@@ -460,4 +463,13 @@
return "" + i; return "" + i;
} }
+ +
+ public void addBlockHitEffects(BlockPos pos, net.minecraft.util.MovingObjectPosition target) + public void addBlockHitEffects(BlockPos pos, net.minecraft.util.math.RayTraceResult target)
+ { + {
+ Block block = worldObj.getBlockState(pos).getBlock(); + IBlockState state = worldObj.getBlockState(pos);
+ if (block != null && !block.addHitEffects(worldObj, target, this)) + if (state != null && !state.getBlock().addHitEffects(state, worldObj, target, this))
+ { + {
+ addBlockHitEffects(pos, target.sideHit); + addBlockHitEffects(pos, target.sideHit);
+ } + }

View file

@ -70,7 +70,7 @@
{ {
if (!this.worldObj.isRemote && !this.isDead) if (!this.worldObj.isRemote && !this.isDead)
{ {
+ if (!net.minecraftforge.common.ForgeHooks.onTravelToDimension(this, dimensionId)) return; + if (!net.minecraftforge.common.ForgeHooks.onTravelToDimension(this, p_184204_1_)) return null;
this.worldObj.theProfiler.startSection("changeDimension"); this.worldObj.theProfiler.startSection("changeDimension");
MinecraftServer minecraftserver = this.func_184102_h(); MinecraftServer minecraftserver = this.func_184102_h();
int i = this.dimension; int i = this.dimension;
@ -83,7 +83,7 @@
} }
public boolean verifyExplosion(Explosion explosionIn, World worldIn, BlockPos pos, IBlockState blockStateIn, float p_174816_5_) public boolean verifyExplosion(Explosion explosionIn, World worldIn, BlockPos pos, IBlockState blockStateIn, float p_174816_5_)
@@ -2662,6 +2695,211 @@ @@ -2662,6 +2695,210 @@
EnchantmentHelper.applyArthropodEnchantments(entityLivingBaseIn, entityIn); EnchantmentHelper.applyArthropodEnchantments(entityLivingBaseIn, entityIn);
} }
@ -117,7 +117,7 @@
+ * @param target The full target the player is looking at + * @param target The full target the player is looking at
+ * @return A ItemStack to add to the player's inventory, Null if nothing should be added. + * @return A ItemStack to add to the player's inventory, Null if nothing should be added.
+ */ + */
+ public ItemStack getPickedResult(MovingObjectPosition target) + public ItemStack getPickedResult(RayTraceResult target)
+ { + {
+ if (this instanceof net.minecraft.entity.item.EntityPainting) + if (this instanceof net.minecraft.entity.item.EntityPainting)
+ { + {
@ -145,24 +145,23 @@
+ } + }
+ else if (this instanceof net.minecraft.entity.item.EntityBoat) + else if (this instanceof net.minecraft.entity.item.EntityBoat)
+ { + {
+ return new ItemStack(net.minecraft.init.Items.boat); + return new ItemStack(((EntityBoat)this).func_184455_j());
+ } + }
+ else if (this instanceof net.minecraft.entity.item.EntityArmorStand) + else if (this instanceof net.minecraft.entity.item.EntityArmorStand)
+ { + {
+ return new ItemStack(net.minecraft.init.Items.armor_stand); + return new ItemStack(net.minecraft.init.Items.armor_stand);
+ } + }
+ else if (this instanceof net.minecraft.entity.item.EntityEnderCrystal)
+ {
+ return new ItemStack(net.minecraft.init.Items.field_185158_cP);
+ }
+ else + else
+ { + {
+ int id = EntityList.getEntityID(this);
+ if (id > 0 && EntityList.entityEggs.containsKey(id))
+ {
+ return new ItemStack(net.minecraft.init.Items.spawn_egg, 1, id);
+ }
+ String name = EntityList.getEntityString(this); + String name = EntityList.getEntityString(this);
+ if (name != null && net.minecraftforge.fml.common.registry.EntityRegistry.getEggs().containsKey(name)) + if (EntityList.entityEggs.containsKey(name))
+ { + {
+ ItemStack stack = new ItemStack(net.minecraft.init.Items.spawn_egg); + ItemStack stack = new ItemStack(net.minecraft.init.Items.spawn_egg);
+ stack.setTagInfo("entity_name", new net.minecraft.nbt.NBTTagString(name)); + net.minecraft.item.ItemMonsterPlacer.func_185078_a(stack, name);
+ return stack; + return stack;
+ } + }
+ } + }

View file

@ -55,7 +55,7 @@
} }
+ //Forge: Enable formated text for colors in console. + //Forge: Enable formated text for colors in console.
+ @Override public void addChatMessage(net.minecraft.util.IChatComponent message) { logger.info(message.getFormattedText()); } + @Override public void addChatMessage(net.minecraft.util.text.ITextComponent message) { logger.info(message.getFormattedText()); }
+ +
protected boolean convertFiles() throws IOException protected boolean convertFiles() throws IOException
{ {

View file

@ -1,100 +1,3 @@
++++ REJECTED PATCH 2
this.mcResourceManager = new SimpleReloadableResourceManager(this.metadataSerializer_);
this.mcLanguageManager = new LanguageManager(this.metadataSerializer_, this.gameSettings.language);
this.mcResourceManager.registerReloadListener(this.mcLanguageManager);
- this.refreshResources();
+ net.minecraftforge.fml.client.FMLClientHandler.instance().beginMinecraftLoading(this, this.defaultResourcePacks, this.mcResourceManager);
this.renderEngine = new TextureManager(this.mcResourceManager);
this.mcResourceManager.registerReloadListener(this.renderEngine);
- this.drawSplashScreen(this.renderEngine);
+ net.minecraftforge.fml.client.SplashProgress.drawVanillaScreen(this.renderEngine);
this.initStream();
this.skinManager = new SkinManager(this.renderEngine, new File(this.fileAssets, "skins"), this.sessionService);
this.saveLoader = new AnvilSaveConverter(new File(this.mcDataDir, "saves"));
++++ END PATCH
++++ REJECTED PATCH 4
GlStateManager.loadIdentity();
GlStateManager.matrixMode(5888);
this.checkGLError("Startup");
- this.textureMapBlocks = new TextureMap("textures");
+ bar.step("Loading Texture Map");
+ this.textureMapBlocks = new TextureMap("textures",true);
this.textureMapBlocks.setMipmapLevels(this.gameSettings.mipmapLevels);
this.renderEngine.loadTickableTexture(TextureMap.locationBlocksTexture, this.textureMapBlocks);
this.renderEngine.bindTexture(TextureMap.locationBlocksTexture);
this.textureMapBlocks.setBlurMipmapDirect(false, this.gameSettings.mipmapLevels > 0);
+ bar.step("Loading Model Manager");
this.modelManager = new ModelManager(this.textureMapBlocks);
this.mcResourceManager.registerReloadListener(this.modelManager);
+ bar.step("Loading Item Renderer");
this.renderItem = new RenderItem(this.renderEngine, this.modelManager);
this.renderManager = new RenderManager(this.renderEngine, this.renderItem);
this.itemRenderer = new ItemRenderer(this);
this.mcResourceManager.registerReloadListener(this.renderItem);
+ bar.step("Loading Entity Renderer");
this.entityRenderer = new EntityRenderer(this, this.mcResourceManager);
this.mcResourceManager.registerReloadListener(this.entityRenderer);
this.blockRenderDispatcher = new BlockRendererDispatcher(this.modelManager.getBlockModelShapes(), this.gameSettings);
++++ END PATCH
++++ REJECTED PATCH 5
this.guiAchievement = new GuiAchievement(this);
GlStateManager.viewport(0, 0, this.displayWidth, this.displayHeight);
this.effectRenderer = new EffectRenderer(this.theWorld, this.renderEngine);
+ net.minecraftforge.fml.common.ProgressManager.pop(bar);
+ net.minecraftforge.fml.client.FMLClientHandler.instance().finishMinecraftLoading();
this.checkGLError("Post startup");
- this.ingameGUI = new GuiIngame(this);
+ this.ingameGUI = new net.minecraftforge.client.GuiIngameForge(this);
if (this.serverName != null)
{
- this.displayGuiScreen(new GuiConnecting(new GuiMainMenu(), this, this.serverName, this.serverPort));
+ net.minecraftforge.fml.client.FMLClientHandler.instance().connectToServerAtStartup(this.serverName, this.serverPort);
}
else
{
this.displayGuiScreen(new GuiMainMenu());
}
- this.renderEngine.deleteTexture(this.mojangLogo);
+ net.minecraftforge.fml.client.SplashProgress.clearVanillaResources(renderEngine, mojangLogo);
this.mojangLogo = null;
this.loadingScreen = new LoadingScreenRenderer(this);
+ net.minecraftforge.fml.client.FMLClientHandler.instance().onInitializationComplete();
if (this.gameSettings.fullScreen && !this.fullscreen)
{
this.toggleFullscreen();
++++ END PATCH
++++ REJECTED PATCH 8
guiScreenIn = new GuiGameOver();
}
+ GuiScreen old = this.currentScreen;
+ net.minecraftforge.client.event.GuiOpenEvent event = new net.minecraftforge.client.event.GuiOpenEvent(guiScreenIn);
+
+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return;
+
+ guiScreenIn = event.gui;
+ if (old != null && guiScreenIn != old)
+ {
+ old.onGuiClosed();
+ }
+
if (guiScreenIn instanceof GuiMainMenu)
{
this.gameSettings.showDebugInfo = false;
++++ END PATCH
++++ REJECTED PATCH 10
if (this.theWorld.getBlockState(blockpos).getBlock().getMaterial() != Material.air && this.playerController.onPlayerDamageBlock(blockpos, this.objectMouseOver.sideHit))
{
- this.effectRenderer.addBlockHitEffects(blockpos, this.objectMouseOver.sideHit);
+ this.effectRenderer.addBlockHitEffects(blockpos, this.objectMouseOver);
this.thePlayer.swingItem();
}
}
++++ END PATCH
++++ REJECTED PATCH 11 ++++ REJECTED PATCH 11
case BLOCK: case BLOCK:
BlockPos blockpos = this.objectMouseOver.getBlockPos(); BlockPos blockpos = this.objectMouseOver.getBlockPos();
@ -128,220 +31,3 @@
this.entityRenderer.itemRenderer.resetEquippedProgress2(); this.entityRenderer.itemRenderer.resetEquippedProgress2();
} }
++++ END PATCH ++++ END PATCH
++++ REJECTED PATCH 14
while (Mouse.next())
{
+ if (net.minecraftforge.client.ForgeHooksClient.postMouseEvent()) continue;
+
int i = Mouse.getEventButton();
KeyBinding.setKeyBindState(i - 100, Mouse.getEventButtonState());
++++ END PATCH
++++ REJECTED PATCH 17
this.myNetworkManager.processReceivedPackets();
}
+ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPostClientTick();
+
this.mcProfiler.endSection();
this.systemTime = getSystemTime();
}
public void launchIntegratedServer(String folderName, String worldName, WorldSettings worldSettingsIn)
{
+ net.minecraftforge.fml.client.FMLClientHandler.instance().startIntegratedServer(folderName, worldName, worldSettingsIn);
this.loadWorld((WorldClient)null);
System.gc();
ISaveHandler isavehandler = this.saveLoader.getSaveLoader(folderName, false);
++++ END PATCH
++++ REJECTED PATCH 19
SocketAddress socketaddress = this.theIntegratedServer.getNetworkSystem().addLocalEndpoint();
NetworkManager networkmanager = NetworkManager.provideLocalClient(socketaddress);
networkmanager.setNetHandler(new NetHandlerLoginClient(networkmanager, this, (GuiScreen)null));
- networkmanager.sendPacket(new C00Handshake(47, socketaddress.toString(), 0, EnumConnectionState.LOGIN));
- networkmanager.sendPacket(new C00PacketLoginStart(this.getSession().getProfile()));
+ networkmanager.sendPacket(new C00Handshake(47, socketaddress.toString(), 0, EnumConnectionState.LOGIN, true));
+ com.mojang.authlib.GameProfile gameProfile = this.getSession().getProfile();
+ if (!this.getSession().hasCachedProperties())
+ {
+ gameProfile = sessionService.fillProfileProperties(gameProfile, true); //Forge: Fill profile properties upon game load. Fixes MC-52974.
+ this.getSession().setProperties(gameProfile.getProperties());
+ }
+ networkmanager.sendPacket(new C00PacketLoginStart(gameProfile));
this.myNetworkManager = networkmanager;
}
++++ END PATCH
++++ REJECTED PATCH 21
{
this.theIntegratedServer.initiateShutdown();
this.theIntegratedServer.setStaticInstance();
+ if (loadingScreen != null)
+ {
+ this.loadingScreen.displayLoadingString(I18n.format("forge.client.shutdown.internal"));
+ }
+ while (!theIntegratedServer.isServerStopped())
+ {
+ try
+ {
+ Thread.sleep(10);
+ }
+ catch (InterruptedException ie) {}
+ }
}
this.theIntegratedServer = null;
++++ END PATCH
++++ REJECTED PATCH 23
if (this.objectMouseOver != null)
{
boolean flag = this.thePlayer.capabilities.isCreativeMode;
- int i = 0;
- boolean flag1 = false;
- TileEntity tileentity = null;
- Item item;
-
- if (this.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
- {
- BlockPos blockpos = this.objectMouseOver.getBlockPos();
- Block block = this.theWorld.getBlockState(blockpos).getBlock();
-
- if (block.getMaterial() == Material.air)
- {
- return;
- }
-
- item = block.getItem(this.theWorld, blockpos);
-
- if (item == null)
- {
- return;
- }
-
- if (flag && GuiScreen.isCtrlKeyDown())
- {
- tileentity = this.theWorld.getTileEntity(blockpos);
- }
-
- Block block1 = item instanceof ItemBlock && !block.isFlowerPot() ? Block.getBlockFromItem(item) : block;
- i = block1.getDamageValue(this.theWorld, blockpos);
- flag1 = item.getHasSubtypes();
- }
- else
- {
- if (this.objectMouseOver.typeOfHit != MovingObjectPosition.MovingObjectType.ENTITY || this.objectMouseOver.entityHit == null || !flag)
- {
- return;
- }
-
- if (this.objectMouseOver.entityHit instanceof EntityPainting)
- {
- item = Items.painting;
- }
- else if (this.objectMouseOver.entityHit instanceof EntityLeashKnot)
- {
- item = Items.lead;
- }
- else if (this.objectMouseOver.entityHit instanceof EntityItemFrame)
- {
- EntityItemFrame entityitemframe = (EntityItemFrame)this.objectMouseOver.entityHit;
- ItemStack itemstack = entityitemframe.getDisplayedItem();
-
- if (itemstack == null)
- {
- item = Items.item_frame;
- }
- else
- {
- item = itemstack.getItem();
- i = itemstack.getMetadata();
- flag1 = true;
- }
- }
- else if (this.objectMouseOver.entityHit instanceof EntityMinecart)
- {
- EntityMinecart entityminecart = (EntityMinecart)this.objectMouseOver.entityHit;
-
- switch (entityminecart.getMinecartType())
- {
- case FURNACE:
- item = Items.furnace_minecart;
- break;
- case CHEST:
- item = Items.chest_minecart;
- break;
- case TNT:
- item = Items.tnt_minecart;
- break;
- case HOPPER:
- item = Items.hopper_minecart;
- break;
- case COMMAND_BLOCK:
- item = Items.command_block_minecart;
- break;
- default:
- item = Items.minecart;
- }
- }
- else if (this.objectMouseOver.entityHit instanceof EntityBoat)
- {
- item = Items.boat;
- }
- else if (this.objectMouseOver.entityHit instanceof EntityArmorStand)
- {
- item = Items.armor_stand;
- }
- else
- {
- item = Items.spawn_egg;
- i = EntityList.getEntityID(this.objectMouseOver.entityHit);
- flag1 = true;
-
- if (!EntityList.entityEggs.containsKey(Integer.valueOf(i)))
- {
- return;
- }
- }
- }
-
InventoryPlayer inventoryplayer = this.thePlayer.inventory;
- if (tileentity == null)
- {
- inventoryplayer.setCurrentItem(item, i, flag1, flag);
- }
- else
- {
- ItemStack itemstack1 = this.func_181036_a(item, i, tileentity);
- inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, itemstack1);
- }
-
+ if (!net.minecraftforge.common.ForgeHooks.onPickBlock(this.objectMouseOver, this.thePlayer, this.theWorld)) return;
+ // We delete this code wholly instead of commenting it out, to make sure we detect changes in it between MC versions
if (flag)
{
int j = this.thePlayer.inventoryContainer.inventorySlots.size() - 9 + inventoryplayer.currentItem;
++++ END PATCH
++++ REJECTED PATCH 24
public static int getGLMaximumTextureSize()
{
- for (int i = 16384; i > 0; i >>= 1)
- {
- GL11.glTexImage2D(GL11.GL_PROXY_TEXTURE_2D, 0, GL11.GL_RGBA, i, i, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, (ByteBuffer)((ByteBuffer)null));
- int j = GL11.glGetTexLevelParameteri(GL11.GL_PROXY_TEXTURE_2D, 0, GL11.GL_TEXTURE_WIDTH);
-
- if (j != 0)
- {
- return i;
- }
- }
-
- return -1;
+ //Forge we redirect this to our code which caches the value before any splash screen stuff is done.
+ return net.minecraftforge.fml.client.SplashProgress.getMaxTextureSize();
}
public boolean isSnooperEnabled()
++++ END PATCH

View file

@ -32,6 +32,8 @@ import com.google.common.collect.Maps;
import com.google.common.collect.Multimap; import com.google.common.collect.Multimap;
import com.google.common.collect.SetMultimap; import com.google.common.collect.SetMultimap;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.FMLLog; import net.minecraftforge.fml.common.FMLLog;
import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.ModContainer; import net.minecraftforge.fml.common.ModContainer;
@ -42,7 +44,7 @@ import net.minecraft.world.ChunkCoordIntPair;
import net.minecraft.nbt.CompressedStreamTools; import net.minecraft.nbt.CompressedStreamTools;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.util.ClassInheritanceMultiMap; import net.minecraft.util.ClassInheritanceMultiMap;
import net.minecraft.util.MathHelper; import net.minecraft.util.math.MathHelper;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList; import net.minecraft.nbt.NBTTagList;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -552,7 +554,7 @@ public class ForgeChunkManager
forcedChunks.remove(world); forcedChunks.remove(world);
dormantChunkCache.remove(world); dormantChunkCache.remove(world);
// integrated server is shutting down // integrated server is shutting down
if (!MinecraftServer.getServer().isServerRunning()) if (FMLCommonHandler.instance().getMinecraftServerInstance().isServerRunning())
{ {
playerTickets.clear(); playerTickets.clear();
tickets.clear(); tickets.clear();

View file

@ -22,13 +22,23 @@ import net.minecraft.block.Block;
import net.minecraft.block.BlockLiquid; import net.minecraft.block.BlockLiquid;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.GuiScreen;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLeashKnot;
import net.minecraft.entity.EntityList;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityArmorStand;
import net.minecraft.entity.item.EntityBoat;
import net.minecraft.entity.item.EntityEnderCrystal;
import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.item.EntityItemFrame;
import net.minecraft.entity.item.EntityMinecart;
import net.minecraft.entity.item.EntityMinecartContainer; import net.minecraft.entity.item.EntityMinecartContainer;
import net.minecraft.entity.item.EntityPainting;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.init.Items; import net.minecraft.init.Items;
import net.minecraft.inventory.Container; import net.minecraft.inventory.Container;
@ -39,6 +49,7 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemAxe; import net.minecraft.item.ItemAxe;
import net.minecraft.item.ItemBucket; import net.minecraft.item.ItemBucket;
import net.minecraft.item.ItemMonsterPlacer;
import net.minecraft.item.ItemPickaxe; import net.minecraft.item.ItemPickaxe;
import net.minecraft.item.ItemSpade; import net.minecraft.item.ItemSpade;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -55,10 +66,12 @@ import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand; import net.minecraft.util.EnumHand;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.WeightedRandom; import net.minecraft.util.WeightedRandom;
import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentString; import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.text.TextFormatting; import net.minecraft.util.text.TextFormatting;
@ -89,6 +102,7 @@ import net.minecraftforge.event.entity.player.PlayerOpenContainerEvent;
import net.minecraftforge.event.world.BlockEvent; import net.minecraftforge.event.world.BlockEvent;
import net.minecraftforge.event.world.NoteBlockEvent; import net.minecraftforge.event.world.NoteBlockEvent;
import net.minecraftforge.fluids.IFluidBlock; import net.minecraftforge.fluids.IFluidBlock;
import net.minecraftforge.fml.common.FMLLog;
import net.minecraftforge.fml.common.eventhandler.Event; import net.minecraftforge.fml.common.eventhandler.Event;
import net.minecraftforge.fml.relauncher.ReflectionHelper; import net.minecraftforge.fml.relauncher.ReflectionHelper;
@ -247,76 +261,70 @@ public class ForgeHooks
/** /**
* Called when a player uses 'pick block', calls new Entity and Block hooks. * Called when a player uses 'pick block', calls new Entity and Block hooks.
*/ */
public static boolean onPickBlock(MovingObjectPosition target, EntityPlayer player, World world) public static boolean onPickBlock(RayTraceResult target, EntityPlayer player, World world)
{ {
/* /*
int i = 0;
boolean flag1 = false;
TileEntity tileentity = null; TileEntity tileentity = null;
Item item; ItemStack itemstack;
if (this.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) if (this.objectMouseOver.typeOfHit == RayTraceResult.Type.BLOCK)
{ {
BlockPos blockpos = this.objectMouseOver.getBlockPos(); BlockPos blockpos = this.objectMouseOver.getBlockPos();
Block block = this.theWorld.getBlockState(blockpos).getBlock(); IBlockState iblockstate = this.theWorld.getBlockState(blockpos);
Block block = iblockstate.getBlock();
if (block.getMaterial() == Material.air) if (iblockstate.func_185904_a() == Material.air)
{ {
return; return;
} }
item = block.getItem(this.theWorld, blockpos); itemstack = block.func_185473_a(this.theWorld, blockpos, iblockstate);
if (item == null) if (itemstack == null)
{ {
return; return;
} }
if (flag && GuiScreen.isCtrlKeyDown()) if (flag && GuiScreen.isCtrlKeyDown() && block.hasTileEntity())
{ {
tileentity = this.theWorld.getTileEntity(blockpos); tileentity = this.theWorld.getTileEntity(blockpos);
} }
Block block1 = item instanceof ItemBlock && !block.isFlowerPot() ? Block.getBlockFromItem(item) : block;
i = block1.getDamageValue(this.theWorld, blockpos);
flag1 = item.getHasSubtypes();
} }
else else
{ {
if (this.objectMouseOver.typeOfHit != MovingObjectPosition.MovingObjectType.ENTITY || this.objectMouseOver.entityHit == null || !flag) if (this.objectMouseOver.typeOfHit != RayTraceResult.Type.ENTITY || this.objectMouseOver.entityHit == null || !flag)
{ {
return; return;
} }
if (this.objectMouseOver.entityHit instanceof EntityPainting) if (this.objectMouseOver.entityHit instanceof EntityPainting)
{ {
item = Items.painting; itemstack = new ItemStack(Items.painting);
} }
else if (this.objectMouseOver.entityHit instanceof EntityLeashKnot) else if (this.objectMouseOver.entityHit instanceof EntityLeashKnot)
{ {
item = Items.lead; itemstack = new ItemStack(Items.lead);
} }
else if (this.objectMouseOver.entityHit instanceof EntityItemFrame) else if (this.objectMouseOver.entityHit instanceof EntityItemFrame)
{ {
EntityItemFrame entityitemframe = (EntityItemFrame)this.objectMouseOver.entityHit; EntityItemFrame entityitemframe = (EntityItemFrame)this.objectMouseOver.entityHit;
ItemStack itemstack = entityitemframe.getDisplayedItem(); ItemStack itemstack1 = entityitemframe.getDisplayedItem();
if (itemstack == null) if (itemstack1 == null)
{ {
item = Items.item_frame; itemstack = new ItemStack(Items.item_frame);
} }
else else
{ {
item = itemstack.getItem(); itemstack = ItemStack.copyItemStack(itemstack1);
i = itemstack.getMetadata();
flag1 = true;
} }
} }
else if (this.objectMouseOver.entityHit instanceof EntityMinecart) else if (this.objectMouseOver.entityHit instanceof EntityMinecart)
{ {
EntityMinecart entityminecart = (EntityMinecart)this.objectMouseOver.entityHit; EntityMinecart entityminecart = (EntityMinecart)this.objectMouseOver.entityHit;
Item item;
switch (entityminecart.getMinecartType()) switch (entityminecart.func_184264_v())
{ {
case FURNACE: case FURNACE:
item = Items.furnace_minecart; item = Items.furnace_minecart;
@ -336,61 +344,56 @@ public class ForgeHooks
default: default:
item = Items.minecart; item = Items.minecart;
} }
itemstack = new ItemStack(item);
} }
else if (this.objectMouseOver.entityHit instanceof EntityBoat) else if (this.objectMouseOver.entityHit instanceof EntityBoat)
{ {
item = Items.boat; itemstack = new ItemStack(((EntityBoat)this.objectMouseOver.entityHit).func_184455_j());
} }
else if (this.objectMouseOver.entityHit instanceof EntityArmorStand) else if (this.objectMouseOver.entityHit instanceof EntityArmorStand)
{ {
item = Items.armor_stand; itemstack = new ItemStack(Items.armor_stand);
}
else if (this.objectMouseOver.entityHit instanceof EntityEnderCrystal)
{
itemstack = new ItemStack(Items.field_185158_cP);
} }
else else
{ {
item = Items.spawn_egg; String s = EntityList.getEntityString(this.objectMouseOver.entityHit);
i = EntityList.getEntityID(this.objectMouseOver.entityHit);
flag1 = true;
if (!EntityList.entityEggs.containsKey(Integer.valueOf(i))) if (!EntityList.entityEggs.containsKey(s))
{ {
return; return;
} }
}
}
InventoryPlayer inventoryplayer = this.thePlayer.inventory; itemstack = new ItemStack(Items.spawn_egg);
ItemMonsterPlacer.func_185078_a(itemstack, s);
if (tileentity == null)
{
inventoryplayer.setCurrentItem(item, i, flag1, flag);
} }
else
{
ItemStack itemstack1 = this.func_181036_a(item, i, tileentity);
inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, itemstack1);
} }
*/ */
ItemStack result = null; ItemStack result = null;
boolean isCreative = player.capabilities.isCreativeMode; boolean isCreative = player.capabilities.isCreativeMode;
TileEntity te = null; TileEntity te = null;
if (target.typeOfHit == MovingObjectType.BLOCK) if (target.typeOfHit == RayTraceResult.Type.BLOCK)
{ {
IBlockState state = world.getBlockState(target.getBlockPos()); IBlockState state = world.getBlockState(target.getBlockPos());
if (state.getBlock().isAir(world, target.getBlockPos())) if (state.getBlock().isAir(state, world, target.getBlockPos()))
{ {
return false; return false;
} }
if (isCreative && GuiScreen.isCtrlKeyDown()) if (isCreative && GuiScreen.isCtrlKeyDown() && state.getBlock().hasTileEntity(state))
te = world.getTileEntity(target.getBlockPos()); te = world.getTileEntity(target.getBlockPos());
result = state.getBlock().getPickBlock(target, world, target.getBlockPos(), player); result = state.getBlock().getPickBlock(state, target, world, target.getBlockPos(), player);
} }
else else
{ {
if (target.typeOfHit != MovingObjectType.ENTITY || target.entityHit == null || !isCreative) if (target.typeOfHit != RayTraceResult.Type.ENTITY || target.entityHit == null || !isCreative)
{ {
return false; return false;
} }
@ -403,45 +406,45 @@ public class ForgeHooks
return false; return false;
} }
if (result.getItem() == null)
{
String s1 = "";
if (target.typeOfHit == RayTraceResult.Type.BLOCK)
{
s1 = ((ResourceLocation)Block.blockRegistry.getNameForObject(world.getBlockState(target.getBlockPos()).getBlock())).toString();
}
else if (target.typeOfHit == RayTraceResult.Type.ENTITY)
{
s1 = EntityList.getEntityString(target.entityHit);
}
FMLLog.warning("Picking on: [%s] %s gave null item", target.typeOfHit, s1);
return true;
}
if (te != null) if (te != null)
{ {
NBTTagCompound nbt = new NBTTagCompound(); Minecraft.getMinecraft().func_184119_a(result, te);
te.writeToNBT(nbt);
result.setTagInfo("BlockEntityTag", nbt);
NBTTagCompound display = new NBTTagCompound();
result.setTagInfo("display", display);
NBTTagList lore = new NBTTagList();
display.setTag("Lore", lore);
lore.appendTag(new NBTTagString("(+NBT)"));
} }
for (int x = 0; x < 9; x++) if (isCreative)
{ {
ItemStack stack = player.inventory.getStackInSlot(x); player.inventory.func_184434_a(result);
if (stack != null && stack.isItemEqual(result) && ItemStack.areItemStackTagsEqual(stack, result)) Minecraft.getMinecraft().playerController.sendSlotPacket(player.func_184586_b(EnumHand.MAIN_HAND), 36 + player.inventory.currentItem);
{
player.inventory.currentItem = x;
return true; return true;
} }
} int slot = player.inventory.func_184429_b(result);
if (slot != -1)
if (!isCreative)
{ {
return false; if (InventoryPlayer.func_184435_e(slot))
}
int slot = player.inventory.getFirstEmptyStack();
if (slot < 0 || slot >= 9)
{
slot = player.inventory.currentItem;
}
player.inventory.setInventorySlotContents(slot, result);
player.inventory.currentItem = slot; player.inventory.currentItem = slot;
else
Minecraft.getMinecraft().playerController.func_187100_a(slot);
return true; return true;
} }
return false;
}
//Optifine Helper Functions u.u, these are here specifically for Optifine //Optifine Helper Functions u.u, these are here specifically for Optifine
//Note: When using Optfine, these methods are invoked using reflection, which //Note: When using Optfine, these methods are invoked using reflection, which

View file

@ -74,6 +74,7 @@ import javax.imageio.stream.ImageInputStream;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.texture.TextureManager; import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.resources.DefaultResourcePack; import net.minecraft.client.resources.DefaultResourcePack;
import net.minecraft.client.resources.FileResourcePack; import net.minecraft.client.resources.FileResourcePack;
@ -502,8 +503,8 @@ public class SplashProgress
if (max_texture_size != -1) return max_texture_size; if (max_texture_size != -1) return max_texture_size;
for (int i = 0x4000; i > 0; i >>= 1) for (int i = 0x4000; i > 0; i >>= 1)
{ {
GL11.glTexImage2D(GL11.GL_PROXY_TEXTURE_2D, 0, GL11.GL_RGBA, i, i, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, (ByteBuffer)null); GlStateManager.func_187419_a(GL11.GL_PROXY_TEXTURE_2D, 0, GL11.GL_RGBA, i, i, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, (IntBuffer)null);
if (GL11.glGetTexLevelParameteri(GL11.GL_PROXY_TEXTURE_2D, 0, GL11.GL_TEXTURE_WIDTH) != 0) if (GlStateManager.func_187411_c(GL11.GL_PROXY_TEXTURE_2D, 0, GL11.GL_TEXTURE_WIDTH) != 0)
{ {
max_texture_size = i; max_texture_size = i;
return i; return i;

View file

@ -14,11 +14,11 @@ import java.util.List;
import org.apache.logging.log4j.Level; import org.apache.logging.log4j.Level;
import net.minecraft.network.EnumPacketDirection; import net.minecraft.network.EnumPacketDirection;
import net.minecraft.network.NettyVarint21FrameDecoder;
import net.minecraft.network.NettyVarint21FrameEncoder;
import net.minecraft.network.NetworkManager; import net.minecraft.network.NetworkManager;
import net.minecraft.network.Packet; import net.minecraft.network.Packet;
import net.minecraft.network.PacketBuffer; import net.minecraft.network.PacketBuffer;
import net.minecraft.util.MessageDeserializer2;
import net.minecraft.util.MessageSerializer2;
import net.minecraftforge.fml.common.FMLLog; import net.minecraftforge.fml.common.FMLLog;
public class PacketLoggingHandler public class PacketLoggingHandler
@ -60,7 +60,7 @@ public class PacketLoggingHandler
} }
else else
{ {
pipeline.replace("splitter", "splitter", new MessageDeserializer2() pipeline.replace("splitter", "splitter", new NettyVarint21FrameDecoder()
{ {
String prefix = (direction == EnumPacketDirection.SERVERBOUND ? "SERVER: C->S" : "CLIENT: S->C"); String prefix = (direction == EnumPacketDirection.SERVERBOUND ? "SERVER: C->S" : "CLIENT: S->C");
@Override @Override
@ -77,7 +77,7 @@ public class PacketLoggingHandler
} }
} }
}); });
pipeline.replace("prepender", "prepender", new MessageSerializer2() pipeline.replace("prepender", "prepender", new NettyVarint21FrameEncoder()
{ {
String prefix = (direction == EnumPacketDirection.SERVERBOUND ? "SERVER: S->C" : "CLIENT: C->S"); String prefix = (direction == EnumPacketDirection.SERVERBOUND ? "SERVER: S->C" : "CLIENT: C->S");
@Override @Override

View file

@ -185,6 +185,7 @@ public net.minecraft.client.Minecraft field_71446_o # textureManager
public net.minecraft.client.Minecraft field_110450_ap # mcDefaultResourcePack public net.minecraft.client.Minecraft field_110450_ap # mcDefaultResourcePack
public net.minecraft.client.Minecraft func_71370_a(II)V # resize public net.minecraft.client.Minecraft func_71370_a(II)V # resize
public net.minecraft.client.Minecraft func_180510_a(Lnet/minecraft/client/renderer/texture/TextureManager;)V # drawSplashScreen public net.minecraft.client.Minecraft func_180510_a(Lnet/minecraft/client/renderer/texture/TextureManager;)V # drawSplashScreen
public net.minecraft.client.Minecraft func_184119_a(Lnet/minecraft/item/ItemStack;Lnet/minecraft/tileentity/TileEntity;)Lnet/minecraft/item/ItemStack; # storeTEInStack
## ItemBlock ## ItemBlock
public net.minecraft.item.ItemBlock field_150939_a public net.minecraft.item.ItemBlock field_150939_a
## DedicatedServer ## DedicatedServer