diff --git a/src/net/minecraft/client/Minecraft.java b/src/net/minecraft/client/Minecraft.java new file mode 100644 index 0000000..ef08182 --- /dev/null +++ b/src/net/minecraft/client/Minecraft.java @@ -0,0 +1,1540 @@ +package net.minecraft.client; + +import java.awt.BorderLayout; +import java.awt.Canvas; +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.Frame; +import java.awt.Graphics; +import java.io.File; +import net.minecraft.src.AchievementList; +import net.minecraft.src.AxisAlignedBB; +import net.minecraft.src.Block; +import net.minecraft.src.ChunkCoordinates; +import net.minecraft.src.ChunkProviderLoadOrGenerate; +import net.minecraft.src.ColorizerFoliage; +import net.minecraft.src.ColorizerGrass; +import net.minecraft.src.ColorizerWater; +import net.minecraft.src.EffectRenderer; +import net.minecraft.src.EntityClientPlayerMP; +import net.minecraft.src.EntityLiving; +import net.minecraft.src.EntityPlayer; +import net.minecraft.src.EntityPlayerSP; +import net.minecraft.src.EntityRenderer; +import net.minecraft.src.EnumMovingObjectType; +import net.minecraft.src.EnumOS2; +import net.minecraft.src.EnumOSMappingHelper; +import net.minecraft.src.EnumOptions; +import net.minecraft.src.FontRenderer; +import net.minecraft.src.GLAllocation; +import net.minecraft.src.GameSettings; +import net.minecraft.src.GameWindowListener; +import net.minecraft.src.GuiAchievement; +import net.minecraft.src.GuiChat; +import net.minecraft.src.GuiConflictWarning; +import net.minecraft.src.GuiConnecting; +import net.minecraft.src.GuiErrorScreen; +import net.minecraft.src.GuiGameOver; +import net.minecraft.src.GuiIngame; +import net.minecraft.src.GuiIngameMenu; +import net.minecraft.src.GuiInventory; +import net.minecraft.src.GuiMainMenu; +import net.minecraft.src.GuiScreen; +import net.minecraft.src.GuiSleepMP; +import net.minecraft.src.GuiUnused; +import net.minecraft.src.IChunkProvider; +import net.minecraft.src.ISaveFormat; +import net.minecraft.src.ISaveHandler; +import net.minecraft.src.ItemRenderer; +import net.minecraft.src.ItemStack; +import net.minecraft.src.LoadingScreenRenderer; +import net.minecraft.src.MathHelper; +import net.minecraft.src.MinecraftError; +import net.minecraft.src.MinecraftException; +import net.minecraft.src.MinecraftImpl; +import net.minecraft.src.ModelBiped; +import net.minecraft.src.MouseHelper; +import net.minecraft.src.MovementInputFromOptions; +import net.minecraft.src.MovingObjectPosition; +import net.minecraft.src.NetClientHandler; +import net.minecraft.src.OpenGlCapsChecker; +import net.minecraft.src.PlayerController; +import net.minecraft.src.PlayerControllerTest; +import net.minecraft.src.RenderBlocks; +import net.minecraft.src.RenderEngine; +import net.minecraft.src.RenderGlobal; +import net.minecraft.src.RenderManager; +import net.minecraft.src.SaveConverterMcRegion; +import net.minecraft.src.ScaledResolution; +import net.minecraft.src.ScreenShotHelper; +import net.minecraft.src.Session; +import net.minecraft.src.SoundManager; +import net.minecraft.src.StatFileWriter; +import net.minecraft.src.StatList; +import net.minecraft.src.StatStringFormatKeyInv; +import net.minecraft.src.Teleporter; +import net.minecraft.src.Tessellator; +import net.minecraft.src.TextureCompassFX; +import net.minecraft.src.TextureFlamesFX; +import net.minecraft.src.TextureLavaFX; +import net.minecraft.src.TextureLavaFlowFX; +import net.minecraft.src.TexturePackList; +import net.minecraft.src.TexturePortalFX; +import net.minecraft.src.TextureWatchFX; +import net.minecraft.src.TextureWaterFX; +import net.minecraft.src.TextureWaterFlowFX; +import net.minecraft.src.ThreadCheckHasPaid; +import net.minecraft.src.ThreadDownloadResources; +import net.minecraft.src.ThreadSleepForever; +import net.minecraft.src.Timer; +import net.minecraft.src.UnexpectedThrowable; +import net.minecraft.src.Vec3D; +import net.minecraft.src.World; +import net.minecraft.src.WorldProvider; +import net.minecraft.src.WorldRenderer; +import org.lwjgl.LWJGLException; +import org.lwjgl.input.Controllers; +import org.lwjgl.input.Keyboard; +import org.lwjgl.input.Mouse; +import org.lwjgl.opengl.Display; +import org.lwjgl.opengl.DisplayMode; +import org.lwjgl.opengl.GL11; +import org.lwjgl.util.glu.GLU; + +public abstract class Minecraft implements Runnable { + public static byte[] field_28006_b = new byte[10485760]; + private static Minecraft theMinecraft; + public PlayerController playerController; + private boolean fullscreen = false; + private boolean hasCrashed = false; + public int displayWidth; + public int displayHeight; + private OpenGlCapsChecker glCapabilities; + private Timer timer = new Timer(20.0F); + public World theWorld; + public RenderGlobal renderGlobal; + public EntityPlayerSP thePlayer; + public EntityLiving renderViewEntity; + public EffectRenderer effectRenderer; + public Session session = null; + public String minecraftUri; + public Canvas mcCanvas; + public boolean hideQuitButton = true; + public volatile boolean isGamePaused = false; + public RenderEngine renderEngine; + public FontRenderer fontRenderer; + public GuiScreen currentScreen = null; + public LoadingScreenRenderer loadingScreen = new LoadingScreenRenderer(this); + public EntityRenderer entityRenderer; + private ThreadDownloadResources downloadResourcesThread; + private int ticksRan = 0; + private int leftClickCounter = 0; + private int tempDisplayWidth; + private int tempDisplayHeight; + public GuiAchievement guiAchievement = new GuiAchievement(this); + public GuiIngame ingameGUI; + public boolean skipRenderWorld = false; + public ModelBiped field_9242_w = new ModelBiped(0.0F); + public MovingObjectPosition objectMouseOver = null; + public GameSettings gameSettings; + protected MinecraftApplet mcApplet; + public SoundManager sndManager = new SoundManager(); + public MouseHelper mouseHelper; + public TexturePackList texturePackList; + private File mcDataDir; + private ISaveFormat saveLoader; + public static long[] frameTimes = new long[512]; + public static long[] tickTimes = new long[512]; + public static int numRecordedFrameTimes = 0; + public static long hasPaidCheckTime = 0L; + public StatFileWriter statFileWriter; + private String serverName; + private int serverPort; + private TextureWaterFX textureWaterFX = new TextureWaterFX(); + private TextureLavaFX textureLavaFX = new TextureLavaFX(); + private static File minecraftDir = null; + public volatile boolean running = true; + public String debug = ""; + boolean isTakingScreenshot = false; + long prevFrameTime = -1L; + public boolean inGameHasFocus = false; + private int mouseTicksRan = 0; + public boolean isRaining = false; + long systemTime = System.currentTimeMillis(); + private int joinPlayerCounter = 0; + + public Minecraft(Component var1, Canvas var2, MinecraftApplet var3, int var4, int var5, boolean var6) { + StatList.func_27360_a(); + this.tempDisplayHeight = var5; + this.fullscreen = var6; + this.mcApplet = var3; + new ThreadSleepForever(this, "Timer hack thread"); + this.mcCanvas = var2; + this.displayWidth = var4; + this.displayHeight = var5; + this.fullscreen = var6; + if(var3 == null || "true".equals(var3.getParameter("stand-alone"))) { + this.hideQuitButton = false; + } + + theMinecraft = this; + } + + public void onMinecraftCrash(UnexpectedThrowable var1) { + this.hasCrashed = true; + this.displayUnexpectedThrowable(var1); + } + + public abstract void displayUnexpectedThrowable(UnexpectedThrowable var1); + + public void setServer(String var1, int var2) { + this.serverName = var1; + this.serverPort = var2; + } + + public void startGame() throws LWJGLException { + if(this.mcCanvas != null) { + Graphics var1 = this.mcCanvas.getGraphics(); + if(var1 != null) { + var1.setColor(Color.BLACK); + var1.fillRect(0, 0, this.displayWidth, this.displayHeight); + var1.dispose(); + } + + Display.setParent(this.mcCanvas); + } else if(this.fullscreen) { + Display.setFullscreen(true); + this.displayWidth = Display.getDisplayMode().getWidth(); + this.displayHeight = Display.getDisplayMode().getHeight(); + if(this.displayWidth <= 0) { + this.displayWidth = 1; + } + + if(this.displayHeight <= 0) { + this.displayHeight = 1; + } + } else { + Display.setDisplayMode(new DisplayMode(this.displayWidth, this.displayHeight)); + } + + Display.setTitle("Minecraft Minecraft Beta 1.7.3"); + + try { + Display.create(); + } catch (LWJGLException var6) { + var6.printStackTrace(); + + try { + Thread.sleep(1000L); + } catch (InterruptedException var5) { + } + + Display.create(); + } + + this.mcDataDir = getMinecraftDir(); + this.saveLoader = new SaveConverterMcRegion(new File(this.mcDataDir, "saves")); + this.gameSettings = new GameSettings(this, this.mcDataDir); + this.texturePackList = new TexturePackList(this, this.mcDataDir); + this.renderEngine = new RenderEngine(this.texturePackList, this.gameSettings); + this.fontRenderer = new FontRenderer(this.gameSettings, "/font/default.png", this.renderEngine); + ColorizerWater.func_28182_a(this.renderEngine.func_28149_a("/misc/watercolor.png")); + ColorizerGrass.func_28181_a(this.renderEngine.func_28149_a("/misc/grasscolor.png")); + ColorizerFoliage.func_28152_a(this.renderEngine.func_28149_a("/misc/foliagecolor.png")); + this.entityRenderer = new EntityRenderer(this); + RenderManager.instance.itemRenderer = new ItemRenderer(this); + this.statFileWriter = new StatFileWriter(this.session, this.mcDataDir); + AchievementList.openInventory.setStatStringFormatter(new StatStringFormatKeyInv(this)); + this.loadScreen(); + Keyboard.create(); + Mouse.create(); + this.mouseHelper = new MouseHelper(this.mcCanvas); + + try { + Controllers.create(); + } catch (Exception var4) { + var4.printStackTrace(); + } + + this.checkGLError("Pre startup"); + GL11.glEnable(GL11.GL_TEXTURE_2D); + GL11.glShadeModel(GL11.GL_SMOOTH); + GL11.glClearDepth(1.0D); + GL11.glEnable(GL11.GL_DEPTH_TEST); + GL11.glDepthFunc(GL11.GL_LEQUAL); + GL11.glEnable(GL11.GL_ALPHA_TEST); + GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); + GL11.glCullFace(GL11.GL_BACK); + GL11.glMatrixMode(GL11.GL_PROJECTION); + GL11.glLoadIdentity(); + GL11.glMatrixMode(GL11.GL_MODELVIEW); + this.checkGLError("Startup"); + this.glCapabilities = new OpenGlCapsChecker(); + this.sndManager.loadSoundSettings(this.gameSettings); + this.renderEngine.registerTextureFX(this.textureLavaFX); + this.renderEngine.registerTextureFX(this.textureWaterFX); + this.renderEngine.registerTextureFX(new TexturePortalFX()); + this.renderEngine.registerTextureFX(new TextureCompassFX(this)); + this.renderEngine.registerTextureFX(new TextureWatchFX(this)); + this.renderEngine.registerTextureFX(new TextureWaterFlowFX()); + this.renderEngine.registerTextureFX(new TextureLavaFlowFX()); + this.renderEngine.registerTextureFX(new TextureFlamesFX(0)); + this.renderEngine.registerTextureFX(new TextureFlamesFX(1)); + this.renderGlobal = new RenderGlobal(this, this.renderEngine); + GL11.glViewport(0, 0, this.displayWidth, this.displayHeight); + this.effectRenderer = new EffectRenderer(this.theWorld, this.renderEngine); + + try { + this.downloadResourcesThread = new ThreadDownloadResources(this.mcDataDir, this); + this.downloadResourcesThread.start(); + } catch (Exception var3) { + } + + this.checkGLError("Post startup"); + this.ingameGUI = new GuiIngame(this); + if(this.serverName != null) { + this.displayGuiScreen(new GuiConnecting(this, this.serverName, this.serverPort)); + } else { + this.displayGuiScreen(new GuiMainMenu()); + } + + } + + private void loadScreen() throws LWJGLException { + ScaledResolution var1 = new ScaledResolution(this.gameSettings, this.displayWidth, this.displayHeight); + GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT | GL11.GL_COLOR_BUFFER_BIT); + GL11.glMatrixMode(GL11.GL_PROJECTION); + GL11.glLoadIdentity(); + GL11.glOrtho(0.0D, var1.field_25121_a, var1.field_25120_b, 0.0D, 1000.0D, 3000.0D); + GL11.glMatrixMode(GL11.GL_MODELVIEW); + GL11.glLoadIdentity(); + GL11.glTranslatef(0.0F, 0.0F, -2000.0F); + GL11.glViewport(0, 0, this.displayWidth, this.displayHeight); + GL11.glClearColor(0.0F, 0.0F, 0.0F, 0.0F); + Tessellator var2 = Tessellator.instance; + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glEnable(GL11.GL_TEXTURE_2D); + GL11.glDisable(GL11.GL_FOG); + GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.renderEngine.getTexture("/title/mojang.png")); + var2.startDrawingQuads(); + var2.setColorOpaque_I(16777215); + var2.addVertexWithUV(0.0D, (double)this.displayHeight, 0.0D, 0.0D, 0.0D); + var2.addVertexWithUV((double)this.displayWidth, (double)this.displayHeight, 0.0D, 0.0D, 0.0D); + var2.addVertexWithUV((double)this.displayWidth, 0.0D, 0.0D, 0.0D, 0.0D); + var2.addVertexWithUV(0.0D, 0.0D, 0.0D, 0.0D, 0.0D); + var2.draw(); + short var3 = 256; + short var4 = 256; + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + var2.setColorOpaque_I(16777215); + this.func_6274_a((var1.getScaledWidth() - var3) / 2, (var1.getScaledHeight() - var4) / 2, 0, 0, var3, var4); + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glDisable(GL11.GL_FOG); + GL11.glEnable(GL11.GL_ALPHA_TEST); + GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); + Display.swapBuffers(); + } + + public void func_6274_a(int var1, int var2, int var3, int var4, int var5, int var6) { + float var7 = 0.00390625F; + float var8 = 0.00390625F; + Tessellator var9 = Tessellator.instance; + var9.startDrawingQuads(); + var9.addVertexWithUV((double)(var1 + 0), (double)(var2 + var6), 0.0D, (double)((float)(var3 + 0) * var7), (double)((float)(var4 + var6) * var8)); + var9.addVertexWithUV((double)(var1 + var5), (double)(var2 + var6), 0.0D, (double)((float)(var3 + var5) * var7), (double)((float)(var4 + var6) * var8)); + var9.addVertexWithUV((double)(var1 + var5), (double)(var2 + 0), 0.0D, (double)((float)(var3 + var5) * var7), (double)((float)(var4 + 0) * var8)); + var9.addVertexWithUV((double)(var1 + 0), (double)(var2 + 0), 0.0D, (double)((float)(var3 + 0) * var7), (double)((float)(var4 + 0) * var8)); + var9.draw(); + } + + public static File getMinecraftDir() { + if(minecraftDir == null) { + minecraftDir = getAppDir("minecraft"); + } + + return minecraftDir; + } + + public static File getAppDir(String var0) { + String var1 = System.getProperty("user.home", "."); + File var2; + switch(EnumOSMappingHelper.enumOSMappingArray[getOs().ordinal()]) { + case 1: + case 2: + var2 = new File(var1, '.' + var0 + '/'); + break; + case 3: + String var3 = System.getenv("APPDATA"); + if(var3 != null) { + var2 = new File(var3, "." + var0 + '/'); + } else { + var2 = new File(var1, '.' + var0 + '/'); + } + break; + case 4: + var2 = new File(var1, "Library/Application Support/" + var0); + break; + default: + var2 = new File(var1, var0 + '/'); + } + + if(!var2.exists() && !var2.mkdirs()) { + throw new RuntimeException("The working directory could not be created: " + var2); + } else { + return var2; + } + } + + private static EnumOS2 getOs() { + String var0 = System.getProperty("os.name").toLowerCase(); + return var0.contains("win") ? EnumOS2.windows : (var0.contains("mac") ? EnumOS2.macos : (var0.contains("solaris") ? EnumOS2.solaris : (var0.contains("sunos") ? EnumOS2.solaris : (var0.contains("linux") ? EnumOS2.linux : (var0.contains("unix") ? EnumOS2.linux : EnumOS2.unknown))))); + } + + public ISaveFormat getSaveLoader() { + return this.saveLoader; + } + + public void displayGuiScreen(GuiScreen var1) { + if(!(this.currentScreen instanceof GuiUnused)) { + if(this.currentScreen != null) { + this.currentScreen.onGuiClosed(); + } + + if(var1 instanceof GuiMainMenu) { + this.statFileWriter.func_27175_b(); + } + + this.statFileWriter.syncStats(); + if(var1 == null && this.theWorld == null) { + var1 = new GuiMainMenu(); + } else if(var1 == null && this.thePlayer.health <= 0) { + var1 = new GuiGameOver(); + } + + if(var1 instanceof GuiMainMenu) { + this.ingameGUI.clearChatMessages(); + } + + this.currentScreen = (GuiScreen)var1; + if(var1 != null) { + this.setIngameNotInFocus(); + ScaledResolution var2 = new ScaledResolution(this.gameSettings, this.displayWidth, this.displayHeight); + int var3 = var2.getScaledWidth(); + int var4 = var2.getScaledHeight(); + ((GuiScreen)var1).setWorldAndResolution(this, var3, var4); + this.skipRenderWorld = false; + } else { + this.setIngameFocus(); + } + + } + } + + private void checkGLError(String var1) { + int var2 = GL11.glGetError(); + if(var2 != 0) { + String var3 = GLU.gluErrorString(var2); + System.out.println("########## GL ERROR ##########"); + System.out.println("@ " + var1); + System.out.println(var2 + ": " + var3); + } + + } + + public void shutdownMinecraftApplet() { + try { + this.statFileWriter.func_27175_b(); + this.statFileWriter.syncStats(); + if(this.mcApplet != null) { + this.mcApplet.clearApplet(); + } + + try { + if(this.downloadResourcesThread != null) { + this.downloadResourcesThread.closeMinecraft(); + } + } catch (Exception var9) { + } + + System.out.println("Stopping!"); + + try { + this.changeWorld1((World)null); + } catch (Throwable var8) { + } + + try { + GLAllocation.deleteTexturesAndDisplayLists(); + } catch (Throwable var7) { + } + + this.sndManager.closeMinecraft(); + Mouse.destroy(); + Keyboard.destroy(); + } finally { + Display.destroy(); + if(!this.hasCrashed) { + System.exit(0); + } + + } + + System.gc(); + } + + public void run() { + this.running = true; + + try { + this.startGame(); + } catch (Exception var17) { + var17.printStackTrace(); + this.onMinecraftCrash(new UnexpectedThrowable("Failed to start game", var17)); + return; + } + + try { + long var1 = System.currentTimeMillis(); + int var3 = 0; + + while(this.running) { + try { + if(this.mcApplet != null && !this.mcApplet.isActive()) { + break; + } + + AxisAlignedBB.clearBoundingBoxPool(); + Vec3D.initialize(); + if(this.mcCanvas == null && Display.isCloseRequested()) { + this.shutdown(); + } + + if(this.isGamePaused && this.theWorld != null) { + float var4 = this.timer.renderPartialTicks; + this.timer.updateTimer(); + this.timer.renderPartialTicks = var4; + } else { + this.timer.updateTimer(); + } + + long var23 = System.nanoTime(); + + for(int var6 = 0; var6 < this.timer.elapsedTicks; ++var6) { + ++this.ticksRan; + + try { + this.runTick(); + } catch (MinecraftException var16) { + this.theWorld = null; + this.changeWorld1((World)null); + this.displayGuiScreen(new GuiConflictWarning()); + } + } + + long var24 = System.nanoTime() - var23; + this.checkGLError("Pre render"); + RenderBlocks.fancyGrass = this.gameSettings.fancyGraphics; + this.sndManager.func_338_a(this.thePlayer, this.timer.renderPartialTicks); + GL11.glEnable(GL11.GL_TEXTURE_2D); + if(this.theWorld != null) { + this.theWorld.updatingLighting(); + } + + if(!Keyboard.isKeyDown(Keyboard.KEY_F7)) { + Display.update(); + } + + if(this.thePlayer != null && this.thePlayer.isEntityInsideOpaqueBlock()) { + this.gameSettings.thirdPersonView = false; + } + + if(!this.skipRenderWorld) { + if(this.playerController != null) { + this.playerController.setPartialTime(this.timer.renderPartialTicks); + } + + this.entityRenderer.updateCameraAndRender(this.timer.renderPartialTicks); + } + + if(!Display.isActive()) { + if(this.fullscreen) { + this.toggleFullscreen(); + } + + Thread.sleep(10L); + } + + if(this.gameSettings.showDebugInfo) { + this.displayDebugInfo(var24); + } else { + this.prevFrameTime = System.nanoTime(); + } + + this.guiAchievement.updateAchievementWindow(); + Thread.yield(); + if(Keyboard.isKeyDown(Keyboard.KEY_F7)) { + Display.update(); + } + + this.screenshotListener(); + if(this.mcCanvas != null && !this.fullscreen && (this.mcCanvas.getWidth() != this.displayWidth || this.mcCanvas.getHeight() != this.displayHeight)) { + this.displayWidth = this.mcCanvas.getWidth(); + this.displayHeight = this.mcCanvas.getHeight(); + if(this.displayWidth <= 0) { + this.displayWidth = 1; + } + + if(this.displayHeight <= 0) { + this.displayHeight = 1; + } + + this.resize(this.displayWidth, this.displayHeight); + } + + this.checkGLError("Post render"); + ++var3; + + for(this.isGamePaused = !this.isMultiplayerWorld() && this.currentScreen != null && this.currentScreen.doesGuiPauseGame(); System.currentTimeMillis() >= var1 + 1000L; var3 = 0) { + this.debug = var3 + " fps, " + WorldRenderer.chunksUpdated + " chunk updates"; + WorldRenderer.chunksUpdated = 0; + var1 += 1000L; + } + } catch (MinecraftException var18) { + this.theWorld = null; + this.changeWorld1((World)null); + this.displayGuiScreen(new GuiConflictWarning()); + } catch (OutOfMemoryError var19) { + this.func_28002_e(); + this.displayGuiScreen(new GuiErrorScreen()); + System.gc(); + } + } + } catch (MinecraftError var20) { + } catch (Throwable var21) { + this.func_28002_e(); + var21.printStackTrace(); + this.onMinecraftCrash(new UnexpectedThrowable("Unexpected error", var21)); + } finally { + this.shutdownMinecraftApplet(); + } + + } + + public void func_28002_e() { + try { + field_28006_b = new byte[0]; + this.renderGlobal.func_28137_f(); + } catch (Throwable var4) { + } + + try { + System.gc(); + AxisAlignedBB.func_28196_a(); + Vec3D.func_28215_a(); + } catch (Throwable var3) { + } + + try { + System.gc(); + this.changeWorld1((World)null); + } catch (Throwable var2) { + } + + System.gc(); + } + + private void screenshotListener() { + if(Keyboard.isKeyDown(Keyboard.KEY_F2)) { + if(!this.isTakingScreenshot) { + this.isTakingScreenshot = true; + this.ingameGUI.addChatMessage(ScreenShotHelper.saveScreenshot(minecraftDir, this.displayWidth, this.displayHeight)); + } + } else { + this.isTakingScreenshot = false; + } + + } + + private void displayDebugInfo(long var1) { + long var3 = 16666666L; + if(this.prevFrameTime == -1L) { + this.prevFrameTime = System.nanoTime(); + } + + long var5 = System.nanoTime(); + tickTimes[numRecordedFrameTimes & frameTimes.length - 1] = var1; + frameTimes[numRecordedFrameTimes++ & frameTimes.length - 1] = var5 - this.prevFrameTime; + this.prevFrameTime = var5; + GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT); + GL11.glMatrixMode(GL11.GL_PROJECTION); + GL11.glLoadIdentity(); + GL11.glOrtho(0.0D, (double)this.displayWidth, (double)this.displayHeight, 0.0D, 1000.0D, 3000.0D); + GL11.glMatrixMode(GL11.GL_MODELVIEW); + GL11.glLoadIdentity(); + GL11.glTranslatef(0.0F, 0.0F, -2000.0F); + GL11.glLineWidth(1.0F); + GL11.glDisable(GL11.GL_TEXTURE_2D); + Tessellator var7 = Tessellator.instance; + var7.startDrawing(7); + int var8 = (int)(var3 / 200000L); + var7.setColorOpaque_I(536870912); + var7.addVertex(0.0D, (double)(this.displayHeight - var8), 0.0D); + var7.addVertex(0.0D, (double)this.displayHeight, 0.0D); + var7.addVertex((double)frameTimes.length, (double)this.displayHeight, 0.0D); + var7.addVertex((double)frameTimes.length, (double)(this.displayHeight - var8), 0.0D); + var7.setColorOpaque_I(538968064); + var7.addVertex(0.0D, (double)(this.displayHeight - var8 * 2), 0.0D); + var7.addVertex(0.0D, (double)(this.displayHeight - var8), 0.0D); + var7.addVertex((double)frameTimes.length, (double)(this.displayHeight - var8), 0.0D); + var7.addVertex((double)frameTimes.length, (double)(this.displayHeight - var8 * 2), 0.0D); + var7.draw(); + long var9 = 0L; + + int var11; + for(var11 = 0; var11 < frameTimes.length; ++var11) { + var9 += frameTimes[var11]; + } + + var11 = (int)(var9 / 200000L / (long)frameTimes.length); + var7.startDrawing(7); + var7.setColorOpaque_I(541065216); + var7.addVertex(0.0D, (double)(this.displayHeight - var11), 0.0D); + var7.addVertex(0.0D, (double)this.displayHeight, 0.0D); + var7.addVertex((double)frameTimes.length, (double)this.displayHeight, 0.0D); + var7.addVertex((double)frameTimes.length, (double)(this.displayHeight - var11), 0.0D); + var7.draw(); + var7.startDrawing(1); + + for(int var12 = 0; var12 < frameTimes.length; ++var12) { + int var13 = (var12 - numRecordedFrameTimes & frameTimes.length - 1) * 255 / frameTimes.length; + int var14 = var13 * var13 / 255; + var14 = var14 * var14 / 255; + int var15 = var14 * var14 / 255; + var15 = var15 * var15 / 255; + if(frameTimes[var12] > var3) { + var7.setColorOpaque_I(-16777216 + var14 * 65536); + } else { + var7.setColorOpaque_I(-16777216 + var14 * 256); + } + + long var16 = frameTimes[var12] / 200000L; + long var18 = tickTimes[var12] / 200000L; + var7.addVertex((double)((float)var12 + 0.5F), (double)((float)((long)this.displayHeight - var16) + 0.5F), 0.0D); + var7.addVertex((double)((float)var12 + 0.5F), (double)((float)this.displayHeight + 0.5F), 0.0D); + var7.setColorOpaque_I(-16777216 + var14 * 65536 + var14 * 256 + var14 * 1); + var7.addVertex((double)((float)var12 + 0.5F), (double)((float)((long)this.displayHeight - var16) + 0.5F), 0.0D); + var7.addVertex((double)((float)var12 + 0.5F), (double)((float)((long)this.displayHeight - (var16 - var18)) + 0.5F), 0.0D); + } + + var7.draw(); + GL11.glEnable(GL11.GL_TEXTURE_2D); + } + + public void shutdown() { + this.running = false; + } + + public void setIngameFocus() { + if(Display.isActive()) { + if(!this.inGameHasFocus) { + this.inGameHasFocus = true; + this.mouseHelper.grabMouseCursor(); + this.displayGuiScreen((GuiScreen)null); + this.leftClickCounter = 10000; + this.mouseTicksRan = this.ticksRan + 10000; + } + } + } + + public void setIngameNotInFocus() { + if(this.inGameHasFocus) { + if(this.thePlayer != null) { + this.thePlayer.resetPlayerKeyState(); + } + + this.inGameHasFocus = false; + this.mouseHelper.ungrabMouseCursor(); + } + } + + public void displayInGameMenu() { + if(this.currentScreen == null) { + this.displayGuiScreen(new GuiIngameMenu()); + } + } + + private void func_6254_a(int var1, boolean var2) { + if(!this.playerController.field_1064_b) { + if(!var2) { + this.leftClickCounter = 0; + } + + if(var1 != 0 || this.leftClickCounter <= 0) { + if(var2 && this.objectMouseOver != null && this.objectMouseOver.typeOfHit == EnumMovingObjectType.TILE && var1 == 0) { + int var3 = this.objectMouseOver.blockX; + int var4 = this.objectMouseOver.blockY; + int var5 = this.objectMouseOver.blockZ; + this.playerController.sendBlockRemoving(var3, var4, var5, this.objectMouseOver.sideHit); + this.effectRenderer.addBlockHitEffects(var3, var4, var5, this.objectMouseOver.sideHit); + } else { + this.playerController.resetBlockRemoving(); + } + + } + } + } + + private void clickMouse(int var1) { + if(var1 != 0 || this.leftClickCounter <= 0) { + if(var1 == 0) { + this.thePlayer.swingItem(); + } + + boolean var2 = true; + if(this.objectMouseOver == null) { + if(var1 == 0 && !(this.playerController instanceof PlayerControllerTest)) { + this.leftClickCounter = 10; + } + } else if(this.objectMouseOver.typeOfHit == EnumMovingObjectType.ENTITY) { + if(var1 == 0) { + this.playerController.attackEntity(this.thePlayer, this.objectMouseOver.entityHit); + } + + if(var1 == 1) { + this.playerController.interactWithEntity(this.thePlayer, this.objectMouseOver.entityHit); + } + } else if(this.objectMouseOver.typeOfHit == EnumMovingObjectType.TILE) { + int var3 = this.objectMouseOver.blockX; + int var4 = this.objectMouseOver.blockY; + int var5 = this.objectMouseOver.blockZ; + int var6 = this.objectMouseOver.sideHit; + if(var1 == 0) { + this.playerController.clickBlock(var3, var4, var5, this.objectMouseOver.sideHit); + } else { + ItemStack var7 = this.thePlayer.inventory.getCurrentItem(); + int var8 = var7 != null ? var7.stackSize : 0; + if(this.playerController.sendPlaceBlock(this.thePlayer, this.theWorld, var7, var3, var4, var5, var6)) { + var2 = false; + this.thePlayer.swingItem(); + } + + if(var7 == null) { + return; + } + + if(var7.stackSize == 0) { + this.thePlayer.inventory.mainInventory[this.thePlayer.inventory.currentItem] = null; + } else if(var7.stackSize != var8) { + this.entityRenderer.itemRenderer.func_9449_b(); + } + } + } + + if(var2 && var1 == 1) { + ItemStack var9 = this.thePlayer.inventory.getCurrentItem(); + if(var9 != null && this.playerController.sendUseItem(this.thePlayer, this.theWorld, var9)) { + this.entityRenderer.itemRenderer.func_9450_c(); + } + } + + } + } + + public void toggleFullscreen() { + try { + this.fullscreen = !this.fullscreen; + if(this.fullscreen) { + Display.setDisplayMode(Display.getDesktopDisplayMode()); + this.displayWidth = Display.getDisplayMode().getWidth(); + this.displayHeight = Display.getDisplayMode().getHeight(); + if(this.displayWidth <= 0) { + this.displayWidth = 1; + } + + if(this.displayHeight <= 0) { + this.displayHeight = 1; + } + } else { + if(this.mcCanvas != null) { + this.displayWidth = this.mcCanvas.getWidth(); + this.displayHeight = this.mcCanvas.getHeight(); + } else { + this.displayWidth = this.tempDisplayWidth; + this.displayHeight = this.tempDisplayHeight; + } + + if(this.displayWidth <= 0) { + this.displayWidth = 1; + } + + if(this.displayHeight <= 0) { + this.displayHeight = 1; + } + } + + if(this.currentScreen != null) { + this.resize(this.displayWidth, this.displayHeight); + } + + Display.setFullscreen(this.fullscreen); + Display.update(); + } catch (Exception var2) { + var2.printStackTrace(); + } + + } + + private void resize(int var1, int var2) { + if(var1 <= 0) { + var1 = 1; + } + + if(var2 <= 0) { + var2 = 1; + } + + this.displayWidth = var1; + this.displayHeight = var2; + if(this.currentScreen != null) { + ScaledResolution var3 = new ScaledResolution(this.gameSettings, var1, var2); + int var4 = var3.getScaledWidth(); + int var5 = var3.getScaledHeight(); + this.currentScreen.setWorldAndResolution(this, var4, var5); + } + + } + + private void clickMiddleMouseButton() { + if(this.objectMouseOver != null) { + int var1 = this.theWorld.getBlockId(this.objectMouseOver.blockX, this.objectMouseOver.blockY, this.objectMouseOver.blockZ); + if(var1 == Block.grass.blockID) { + var1 = Block.dirt.blockID; + } + + if(var1 == Block.stairDouble.blockID) { + var1 = Block.stairSingle.blockID; + } + + if(var1 == Block.bedrock.blockID) { + var1 = Block.stone.blockID; + } + + this.thePlayer.inventory.setCurrentItem(var1, this.playerController instanceof PlayerControllerTest); + } + + } + + private void func_28001_B() { + (new ThreadCheckHasPaid(this)).start(); + } + + public void runTick() { + if(this.ticksRan == 6000) { + this.func_28001_B(); + } + + this.statFileWriter.func_27178_d(); + this.ingameGUI.updateTick(); + this.entityRenderer.getMouseOver(1.0F); + int var3; + if(this.thePlayer != null) { + IChunkProvider var1 = this.theWorld.getIChunkProvider(); + if(var1 instanceof ChunkProviderLoadOrGenerate) { + ChunkProviderLoadOrGenerate var2 = (ChunkProviderLoadOrGenerate)var1; + var3 = MathHelper.floor_float((float)((int)this.thePlayer.posX)) >> 4; + int var4 = MathHelper.floor_float((float)((int)this.thePlayer.posZ)) >> 4; + var2.setCurrentChunkOver(var3, var4); + } + } + + if(!this.isGamePaused && this.theWorld != null) { + this.playerController.updateController(); + } + + GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.renderEngine.getTexture("/terrain.png")); + if(!this.isGamePaused) { + this.renderEngine.updateDynamicTextures(); + } + + if(this.currentScreen == null && this.thePlayer != null) { + if(this.thePlayer.health <= 0) { + this.displayGuiScreen((GuiScreen)null); + } else if(this.thePlayer.isPlayerSleeping() && this.theWorld != null && this.theWorld.multiplayerWorld) { + this.displayGuiScreen(new GuiSleepMP()); + } + } else if(this.currentScreen != null && this.currentScreen instanceof GuiSleepMP && !this.thePlayer.isPlayerSleeping()) { + this.displayGuiScreen((GuiScreen)null); + } + + if(this.currentScreen != null) { + this.leftClickCounter = 10000; + this.mouseTicksRan = this.ticksRan + 10000; + } + + if(this.currentScreen != null) { + this.currentScreen.handleInput(); + if(this.currentScreen != null) { + this.currentScreen.field_25091_h.func_25088_a(); + this.currentScreen.updateScreen(); + } + } + + if(this.currentScreen == null || this.currentScreen.field_948_f) { + label301: + while(true) { + while(true) { + while(true) { + long var5; + do { + if(!Mouse.next()) { + if(this.leftClickCounter > 0) { + --this.leftClickCounter; + } + + while(true) { + while(true) { + do { + if(!Keyboard.next()) { + if(this.currentScreen == null) { + if(Mouse.isButtonDown(0) && (float)(this.ticksRan - this.mouseTicksRan) >= this.timer.ticksPerSecond / 4.0F && this.inGameHasFocus) { + this.clickMouse(0); + this.mouseTicksRan = this.ticksRan; + } + + if(Mouse.isButtonDown(1) && (float)(this.ticksRan - this.mouseTicksRan) >= this.timer.ticksPerSecond / 4.0F && this.inGameHasFocus) { + this.clickMouse(1); + this.mouseTicksRan = this.ticksRan; + } + } + + this.func_6254_a(0, this.currentScreen == null && Mouse.isButtonDown(0) && this.inGameHasFocus); + break label301; + } + + this.thePlayer.handleKeyPress(Keyboard.getEventKey(), Keyboard.getEventKeyState()); + } while(!Keyboard.getEventKeyState()); + + if(Keyboard.getEventKey() == Keyboard.KEY_F11) { + this.toggleFullscreen(); + } else { + if(this.currentScreen != null) { + this.currentScreen.handleKeyboardInput(); + } else { + if(Keyboard.getEventKey() == Keyboard.KEY_ESCAPE) { + this.displayInGameMenu(); + } + + if(Keyboard.getEventKey() == Keyboard.KEY_S && Keyboard.isKeyDown(Keyboard.KEY_F3)) { + this.forceReload(); + } + + if(Keyboard.getEventKey() == Keyboard.KEY_F1) { + this.gameSettings.hideGUI = !this.gameSettings.hideGUI; + } + + if(Keyboard.getEventKey() == Keyboard.KEY_F3) { + this.gameSettings.showDebugInfo = !this.gameSettings.showDebugInfo; + } + + if(Keyboard.getEventKey() == Keyboard.KEY_F5) { + this.gameSettings.thirdPersonView = !this.gameSettings.thirdPersonView; + } + + if(Keyboard.getEventKey() == Keyboard.KEY_F8) { + this.gameSettings.smoothCamera = !this.gameSettings.smoothCamera; + } + + if(Keyboard.getEventKey() == this.gameSettings.keyBindInventory.keyCode) { + this.displayGuiScreen(new GuiInventory(this.thePlayer)); + } + + if(Keyboard.getEventKey() == this.gameSettings.keyBindDrop.keyCode) { + this.thePlayer.dropCurrentItem(); + } + + if(this.isMultiplayerWorld() && Keyboard.getEventKey() == this.gameSettings.keyBindChat.keyCode) { + this.displayGuiScreen(new GuiChat()); + } + } + + for(int var6 = 0; var6 < 9; ++var6) { + if(Keyboard.getEventKey() == Keyboard.KEY_1 + var6) { + this.thePlayer.inventory.currentItem = var6; + } + } + + if(Keyboard.getEventKey() == this.gameSettings.keyBindToggleFog.keyCode) { + this.gameSettings.setOptionValue(EnumOptions.RENDER_DISTANCE, !Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) && !Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) ? 1 : -1); + } + } + } + } + } + + var5 = System.currentTimeMillis() - this.systemTime; + } while(var5 > 200L); + + var3 = Mouse.getEventDWheel(); + if(var3 != 0) { + this.thePlayer.inventory.changeCurrentItem(var3); + if(this.gameSettings.field_22275_C) { + if(var3 > 0) { + var3 = 1; + } + + if(var3 < 0) { + var3 = -1; + } + + this.gameSettings.field_22272_F += (float)var3 * 0.25F; + } + } + + if(this.currentScreen == null) { + if(!this.inGameHasFocus && Mouse.getEventButtonState()) { + this.setIngameFocus(); + } else { + if(Mouse.getEventButton() == 0 && Mouse.getEventButtonState()) { + this.clickMouse(0); + this.mouseTicksRan = this.ticksRan; + } + + if(Mouse.getEventButton() == 1 && Mouse.getEventButtonState()) { + this.clickMouse(1); + this.mouseTicksRan = this.ticksRan; + } + + if(Mouse.getEventButton() == 2 && Mouse.getEventButtonState()) { + this.clickMiddleMouseButton(); + } + } + } else if(this.currentScreen != null) { + this.currentScreen.handleMouseInput(); + } + } + } + } + } + + if(this.theWorld != null) { + if(this.thePlayer != null) { + ++this.joinPlayerCounter; + if(this.joinPlayerCounter == 30) { + this.joinPlayerCounter = 0; + this.theWorld.joinEntityInSurroundings(this.thePlayer); + } + } + + this.theWorld.difficultySetting = this.gameSettings.difficulty; + if(this.theWorld.multiplayerWorld) { + this.theWorld.difficultySetting = 3; + } + + if(!this.isGamePaused) { + this.entityRenderer.updateRenderer(); + } + + if(!this.isGamePaused) { + this.renderGlobal.updateClouds(); + } + + if(!this.isGamePaused) { + if(this.theWorld.field_27172_i > 0) { + --this.theWorld.field_27172_i; + } + + this.theWorld.updateEntities(); + } + + if(!this.isGamePaused || this.isMultiplayerWorld()) { + this.theWorld.setAllowedMobSpawns(this.gameSettings.difficulty > 0, true); + this.theWorld.tick(); + } + + if(!this.isGamePaused && this.theWorld != null) { + this.theWorld.randomDisplayUpdates(MathHelper.floor_double(this.thePlayer.posX), MathHelper.floor_double(this.thePlayer.posY), MathHelper.floor_double(this.thePlayer.posZ)); + } + + if(!this.isGamePaused) { + this.effectRenderer.updateEffects(); + } + } + + this.systemTime = System.currentTimeMillis(); + } + + private void forceReload() { + System.out.println("FORCING RELOAD!"); + this.sndManager = new SoundManager(); + this.sndManager.loadSoundSettings(this.gameSettings); + this.downloadResourcesThread.reloadResources(); + } + + public boolean isMultiplayerWorld() { + return this.theWorld != null && this.theWorld.multiplayerWorld; + } + + public void startWorld(String var1, String var2, long var3) { + this.changeWorld1((World)null); + System.gc(); + if(this.saveLoader.isOldMapFormat(var1)) { + this.convertMapFormat(var1, var2); + } else { + ISaveHandler var5 = this.saveLoader.getSaveLoader(var1, false); + World var6 = null; + var6 = new World(var5, var2, var3); + if(var6.isNewWorld) { + this.statFileWriter.readStat(StatList.createWorldStat, 1); + this.statFileWriter.readStat(StatList.startGameStat, 1); + this.changeWorld2(var6, "Generating level"); + } else { + this.statFileWriter.readStat(StatList.loadWorldStat, 1); + this.statFileWriter.readStat(StatList.startGameStat, 1); + this.changeWorld2(var6, "Loading level"); + } + } + + } + + public void usePortal() { + System.out.println("Toggling dimension!!"); + if(this.thePlayer.dimension == -1) { + this.thePlayer.dimension = 0; + } else { + this.thePlayer.dimension = -1; + } + + this.theWorld.setEntityDead(this.thePlayer); + this.thePlayer.isDead = false; + double var1 = this.thePlayer.posX; + double var3 = this.thePlayer.posZ; + double var5 = 8.0D; + World var7; + if(this.thePlayer.dimension == -1) { + var1 /= var5; + var3 /= var5; + this.thePlayer.setLocationAndAngles(var1, this.thePlayer.posY, var3, this.thePlayer.rotationYaw, this.thePlayer.rotationPitch); + if(this.thePlayer.isEntityAlive()) { + this.theWorld.updateEntityWithOptionalForce(this.thePlayer, false); + } + + var7 = null; + var7 = new World(this.theWorld, WorldProvider.getProviderForDimension(-1)); + this.changeWorld(var7, "Entering the Nether", this.thePlayer); + } else { + var1 *= var5; + var3 *= var5; + this.thePlayer.setLocationAndAngles(var1, this.thePlayer.posY, var3, this.thePlayer.rotationYaw, this.thePlayer.rotationPitch); + if(this.thePlayer.isEntityAlive()) { + this.theWorld.updateEntityWithOptionalForce(this.thePlayer, false); + } + + var7 = null; + var7 = new World(this.theWorld, WorldProvider.getProviderForDimension(0)); + this.changeWorld(var7, "Leaving the Nether", this.thePlayer); + } + + this.thePlayer.worldObj = this.theWorld; + if(this.thePlayer.isEntityAlive()) { + this.thePlayer.setLocationAndAngles(var1, this.thePlayer.posY, var3, this.thePlayer.rotationYaw, this.thePlayer.rotationPitch); + this.theWorld.updateEntityWithOptionalForce(this.thePlayer, false); + (new Teleporter()).func_4107_a(this.theWorld, this.thePlayer); + } + + } + + public void changeWorld1(World var1) { + this.changeWorld2(var1, ""); + } + + public void changeWorld2(World var1, String var2) { + this.changeWorld(var1, var2, (EntityPlayer)null); + } + + public void changeWorld(World var1, String var2, EntityPlayer var3) { + this.statFileWriter.func_27175_b(); + this.statFileWriter.syncStats(); + this.renderViewEntity = null; + this.loadingScreen.printText(var2); + this.loadingScreen.displayLoadingString(""); + this.sndManager.playStreaming((String)null, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F); + if(this.theWorld != null) { + this.theWorld.saveWorldIndirectly(this.loadingScreen); + } + + this.theWorld = var1; + if(var1 != null) { + this.playerController.func_717_a(var1); + if(!this.isMultiplayerWorld()) { + if(var3 == null) { + this.thePlayer = (EntityPlayerSP)var1.func_4085_a(EntityPlayerSP.class); + } + } else if(this.thePlayer != null) { + this.thePlayer.preparePlayerToSpawn(); + if(var1 != null) { + var1.entityJoinedWorld(this.thePlayer); + } + } + + if(!var1.multiplayerWorld) { + this.func_6255_d(var2); + } + + if(this.thePlayer == null) { + this.thePlayer = (EntityPlayerSP)this.playerController.createPlayer(var1); + this.thePlayer.preparePlayerToSpawn(); + this.playerController.flipPlayer(this.thePlayer); + } + + this.thePlayer.movementInput = new MovementInputFromOptions(this.gameSettings); + if(this.renderGlobal != null) { + this.renderGlobal.changeWorld(var1); + } + + if(this.effectRenderer != null) { + this.effectRenderer.clearEffects(var1); + } + + this.playerController.func_6473_b(this.thePlayer); + if(var3 != null) { + var1.emptyMethod1(); + } + + IChunkProvider var4 = var1.getIChunkProvider(); + if(var4 instanceof ChunkProviderLoadOrGenerate) { + ChunkProviderLoadOrGenerate var5 = (ChunkProviderLoadOrGenerate)var4; + int var6 = MathHelper.floor_float((float)((int)this.thePlayer.posX)) >> 4; + int var7 = MathHelper.floor_float((float)((int)this.thePlayer.posZ)) >> 4; + var5.setCurrentChunkOver(var6, var7); + } + + var1.spawnPlayerWithLoadedChunks(this.thePlayer); + if(var1.isNewWorld) { + var1.saveWorldIndirectly(this.loadingScreen); + } + + this.renderViewEntity = this.thePlayer; + } else { + this.thePlayer = null; + } + + System.gc(); + this.systemTime = 0L; + } + + private void convertMapFormat(String var1, String var2) { + this.loadingScreen.printText("Converting World to " + this.saveLoader.func_22178_a()); + this.loadingScreen.displayLoadingString("This may take a while :)"); + this.saveLoader.convertMapFormat(var1, this.loadingScreen); + this.startWorld(var1, var2, 0L); + } + + private void func_6255_d(String var1) { + this.loadingScreen.printText(var1); + this.loadingScreen.displayLoadingString("Building terrain"); + short var2 = 128; + int var3 = 0; + int var4 = var2 * 2 / 16 + 1; + var4 *= var4; + IChunkProvider var5 = this.theWorld.getIChunkProvider(); + ChunkCoordinates var6 = this.theWorld.getSpawnPoint(); + if(this.thePlayer != null) { + var6.x = (int)this.thePlayer.posX; + var6.z = (int)this.thePlayer.posZ; + } + + if(var5 instanceof ChunkProviderLoadOrGenerate) { + ChunkProviderLoadOrGenerate var7 = (ChunkProviderLoadOrGenerate)var5; + var7.setCurrentChunkOver(var6.x >> 4, var6.z >> 4); + } + + for(int var10 = -var2; var10 <= var2; var10 += 16) { + for(int var8 = -var2; var8 <= var2; var8 += 16) { + this.loadingScreen.setLoadingProgress(var3++ * 100 / var4); + this.theWorld.getBlockId(var6.x + var10, 64, var6.z + var8); + + while(this.theWorld.updatingLighting()) { + } + } + } + + this.loadingScreen.displayLoadingString("Simulating world for a bit"); + boolean var9 = true; + this.theWorld.func_656_j(); + } + + public void installResource(String var1, File var2) { + int var3 = var1.indexOf("/"); + String var4 = var1.substring(0, var3); + var1 = var1.substring(var3 + 1); + if(var4.equalsIgnoreCase("sound")) { + this.sndManager.addSound(var1, var2); + } else if(var4.equalsIgnoreCase("newsound")) { + this.sndManager.addSound(var1, var2); + } else if(var4.equalsIgnoreCase("streaming")) { + this.sndManager.addStreaming(var1, var2); + } else if(var4.equalsIgnoreCase("music")) { + this.sndManager.addMusic(var1, var2); + } else if(var4.equalsIgnoreCase("newmusic")) { + this.sndManager.addMusic(var1, var2); + } + + } + + public OpenGlCapsChecker getOpenGlCapsChecker() { + return this.glCapabilities; + } + + public String func_6241_m() { + return this.renderGlobal.getDebugInfoRenders(); + } + + public String func_6262_n() { + return this.renderGlobal.getDebugInfoEntities(); + } + + public String func_21002_o() { + return this.theWorld.func_21119_g(); + } + + public String func_6245_o() { + return "P: " + this.effectRenderer.getStatistics() + ". T: " + this.theWorld.func_687_d(); + } + + public void respawn(boolean var1, int var2) { + if(!this.theWorld.multiplayerWorld && !this.theWorld.worldProvider.canRespawnHere()) { + this.usePortal(); + } + + ChunkCoordinates var3 = null; + ChunkCoordinates var4 = null; + boolean var5 = true; + if(this.thePlayer != null && !var1) { + var3 = this.thePlayer.getPlayerSpawnCoordinate(); + if(var3 != null) { + var4 = EntityPlayer.func_25060_a(this.theWorld, var3); + if(var4 == null) { + this.thePlayer.addChatMessage("tile.bed.notValid"); + } + } + } + + if(var4 == null) { + var4 = this.theWorld.getSpawnPoint(); + var5 = false; + } + + IChunkProvider var6 = this.theWorld.getIChunkProvider(); + if(var6 instanceof ChunkProviderLoadOrGenerate) { + ChunkProviderLoadOrGenerate var7 = (ChunkProviderLoadOrGenerate)var6; + var7.setCurrentChunkOver(var4.x >> 4, var4.z >> 4); + } + + this.theWorld.setSpawnLocation(); + this.theWorld.updateEntityList(); + int var8 = 0; + if(this.thePlayer != null) { + var8 = this.thePlayer.entityId; + this.theWorld.setEntityDead(this.thePlayer); + } + + this.renderViewEntity = null; + this.thePlayer = (EntityPlayerSP)this.playerController.createPlayer(this.theWorld); + this.thePlayer.dimension = var2; + this.renderViewEntity = this.thePlayer; + this.thePlayer.preparePlayerToSpawn(); + if(var5) { + this.thePlayer.setPlayerSpawnCoordinate(var3); + this.thePlayer.setLocationAndAngles((double)((float)var4.x + 0.5F), (double)((float)var4.y + 0.1F), (double)((float)var4.z + 0.5F), 0.0F, 0.0F); + } + + this.playerController.flipPlayer(this.thePlayer); + this.theWorld.spawnPlayerWithLoadedChunks(this.thePlayer); + this.thePlayer.movementInput = new MovementInputFromOptions(this.gameSettings); + this.thePlayer.entityId = var8; + this.thePlayer.func_6420_o(); + this.playerController.func_6473_b(this.thePlayer); + this.func_6255_d("Respawning"); + if(this.currentScreen instanceof GuiGameOver) { + this.displayGuiScreen((GuiScreen)null); + } + + } + + public static void func_6269_a(String var0, String var1) { + startMainThread(var0, var1, (String)null); + } + + public static void startMainThread(String var0, String var1, String var2) { + boolean var3 = false; + Frame var5 = new Frame("Minecraft"); + Canvas var6 = new Canvas(); + var5.setLayout(new BorderLayout()); + var5.add(var6, "Center"); + var6.setPreferredSize(new Dimension(854, 480)); + var5.pack(); + var5.setLocationRelativeTo((Component)null); + MinecraftImpl var7 = new MinecraftImpl(var5, var6, (MinecraftApplet)null, 854, 480, var3, var5); + Thread var8 = new Thread(var7, "Minecraft main thread"); + var8.setPriority(10); + var7.minecraftUri = "www.minecraft.net"; + if(var0 != null && var1 != null) { + var7.session = new Session(var0, var1); + } else { + var7.session = new Session("Player" + System.currentTimeMillis() % 1000L, ""); + } + + if(var2 != null) { + String[] var9 = var2.split(":"); + var7.setServer(var9[0], Integer.parseInt(var9[1])); + } + + var5.setVisible(true); + var5.addWindowListener(new GameWindowListener(var7, var8)); + var8.start(); + } + + public NetClientHandler getSendQueue() { + return this.thePlayer instanceof EntityClientPlayerMP ? ((EntityClientPlayerMP)this.thePlayer).sendQueue : null; + } + + public static void main(String[] var0) { + String var1 = null; + String var2 = null; + var1 = "Player" + System.currentTimeMillis() % 1000L; + if(var0.length > 0) { + var1 = var0[0]; + } + + var2 = "-"; + if(var0.length > 1) { + var2 = var0[1]; + } + + func_6269_a(var1, var2); + } + + public static boolean isGuiEnabled() { + return theMinecraft == null || !theMinecraft.gameSettings.hideGUI; + } + + public static boolean isFancyGraphicsEnabled() { + return theMinecraft != null && theMinecraft.gameSettings.fancyGraphics; + } + + public static boolean isAmbientOcclusionEnabled() { + return theMinecraft != null && theMinecraft.gameSettings.ambientOcclusion; + } + + public static boolean isDebugInfoEnabled() { + return theMinecraft != null && theMinecraft.gameSettings.showDebugInfo; + } + + public boolean lineIsCommand(String var1) { + if(var1.startsWith("/")) { + } + + return false; + } +} diff --git a/src/net/minecraft/client/MinecraftApplet.java b/src/net/minecraft/client/MinecraftApplet.java new file mode 100644 index 0000000..105bc0b --- /dev/null +++ b/src/net/minecraft/client/MinecraftApplet.java @@ -0,0 +1,104 @@ +package net.minecraft.client; + +import java.applet.Applet; +import java.awt.BorderLayout; +import java.awt.Canvas; +import net.minecraft.src.CanvasMinecraftApplet; +import net.minecraft.src.MinecraftAppletImpl; +import net.minecraft.src.Session; + +public class MinecraftApplet extends Applet { + private Canvas mcCanvas; + private Minecraft mc; + private Thread mcThread = null; + + public void init() { + this.mcCanvas = new CanvasMinecraftApplet(this); + boolean var1 = false; + if(this.getParameter("fullscreen") != null) { + var1 = this.getParameter("fullscreen").equalsIgnoreCase("true"); + } + + this.mc = new MinecraftAppletImpl(this, this, this.mcCanvas, this, this.getWidth(), this.getHeight(), var1); + this.mc.minecraftUri = this.getDocumentBase().getHost(); + if(this.getDocumentBase().getPort() > 0) { + this.mc.minecraftUri = this.mc.minecraftUri + ":" + this.getDocumentBase().getPort(); + } + + if(this.getParameter("username") != null && this.getParameter("sessionid") != null) { + this.mc.session = new Session(this.getParameter("username"), this.getParameter("sessionid")); + System.out.println("Setting user: " + this.mc.session.username + ", " + this.mc.session.sessionId); + if(this.getParameter("mppass") != null) { + this.mc.session.mpPassParameter = this.getParameter("mppass"); + } + } else { + this.mc.session = new Session("Player", ""); + } + + if(this.getParameter("server") != null && this.getParameter("port") != null) { + this.mc.setServer(this.getParameter("server"), Integer.parseInt(this.getParameter("port"))); + } + + this.mc.hideQuitButton = true; + this.setLayout(new BorderLayout()); + this.add(this.mcCanvas, "Center"); + this.mcCanvas.setFocusable(true); + this.validate(); + } + + public void startMainThread() { + if(this.mcThread == null) { + this.mcThread = new Thread(this.mc, "Minecraft main thread"); + this.mcThread.start(); + } + } + + public void start() { + if(this.mc != null) { + this.mc.isGamePaused = false; + } + + } + + public void stop() { + if(this.mc != null) { + this.mc.isGamePaused = true; + } + + } + + public void destroy() { + this.shutdown(); + } + + public void shutdown() { + if(this.mcThread != null) { + this.mc.shutdown(); + + try { + this.mcThread.join(10000L); + } catch (InterruptedException var4) { + try { + this.mc.shutdownMinecraftApplet(); + } catch (Exception var3) { + var3.printStackTrace(); + } + } + + this.mcThread = null; + } + } + + public void clearApplet() { + this.mcCanvas = null; + this.mc = null; + this.mcThread = null; + + try { + this.removeAll(); + this.validate(); + } catch (Exception var2) { + } + + } +} diff --git a/src/net/minecraft/isom/IsomPreviewApplet.java b/src/net/minecraft/isom/IsomPreviewApplet.java new file mode 100644 index 0000000..d501596 --- /dev/null +++ b/src/net/minecraft/isom/IsomPreviewApplet.java @@ -0,0 +1,22 @@ +package net.minecraft.isom; + +import java.applet.Applet; +import java.awt.BorderLayout; +import net.minecraft.src.CanvasIsomPreview; + +public class IsomPreviewApplet extends Applet { + private CanvasIsomPreview a = new CanvasIsomPreview(); + + public IsomPreviewApplet() { + this.setLayout(new BorderLayout()); + this.add(this.a, "Center"); + } + + public void start() { + this.a.func_1272_b(); + } + + public void stop() { + this.a.exit(); + } +} diff --git a/src/net/minecraft/src/Achievement.java b/src/net/minecraft/src/Achievement.java new file mode 100644 index 0000000..9fe52c2 --- /dev/null +++ b/src/net/minecraft/src/Achievement.java @@ -0,0 +1,85 @@ +package net.minecraft.src; + +public class Achievement extends StatBase { + public final int displayColumn; + public final int displayRow; + public final Achievement parentAchievement; + private final String achievementDescription; + private IStatStringFormat statStringFormatter; + public final ItemStack theItemStack; + private boolean isSpecial; + + public Achievement(int var1, String var2, int var3, int var4, Item var5, Achievement var6) { + this(var1, var2, var3, var4, new ItemStack(var5), var6); + } + + public Achievement(int var1, String var2, int var3, int var4, Block var5, Achievement var6) { + this(var1, var2, var3, var4, new ItemStack(var5), var6); + } + + public Achievement(int var1, String var2, int var3, int var4, ItemStack var5, Achievement var6) { + super(5242880 + var1, StatCollector.translateToLocal("achievement." + var2)); + this.theItemStack = var5; + this.achievementDescription = StatCollector.translateToLocal("achievement." + var2 + ".desc"); + this.displayColumn = var3; + this.displayRow = var4; + if(var3 < AchievementList.minDisplayColumn) { + AchievementList.minDisplayColumn = var3; + } + + if(var4 < AchievementList.minDisplayRow) { + AchievementList.minDisplayRow = var4; + } + + if(var3 > AchievementList.maxDisplayColumn) { + AchievementList.maxDisplayColumn = var3; + } + + if(var4 > AchievementList.maxDisplayRow) { + AchievementList.maxDisplayRow = var4; + } + + this.parentAchievement = var6; + } + + public Achievement func_27089_a() { + this.field_27088_g = true; + return this; + } + + public Achievement setSpecial() { + this.isSpecial = true; + return this; + } + + public Achievement registerAchievement() { + super.registerStat(); + AchievementList.achievementList.add(this); + return this; + } + + public boolean func_25067_a() { + return true; + } + + public String getDescription() { + return this.statStringFormatter != null ? this.statStringFormatter.formatString(this.achievementDescription) : this.achievementDescription; + } + + public Achievement setStatStringFormatter(IStatStringFormat var1) { + this.statStringFormatter = var1; + return this; + } + + public boolean getSpecial() { + return this.isSpecial; + } + + public StatBase registerStat() { + return this.registerAchievement(); + } + + public StatBase func_27082_h() { + return this.func_27089_a(); + } +} diff --git a/src/net/minecraft/src/AchievementList.java b/src/net/minecraft/src/AchievementList.java new file mode 100644 index 0000000..ea0f992 --- /dev/null +++ b/src/net/minecraft/src/AchievementList.java @@ -0,0 +1,35 @@ +package net.minecraft.src; + +import java.util.ArrayList; +import java.util.List; + +public class AchievementList { + public static int minDisplayColumn; + public static int minDisplayRow; + public static int maxDisplayColumn; + public static int maxDisplayRow; + public static List achievementList = new ArrayList(); + public static Achievement openInventory = (new Achievement(0, "openInventory", 0, 0, Item.book, (Achievement)null)).func_27089_a().registerAchievement(); + public static Achievement mineWood = (new Achievement(1, "mineWood", 2, 1, Block.wood, openInventory)).registerAchievement(); + public static Achievement buildWorkBench = (new Achievement(2, "buildWorkBench", 4, -1, Block.workbench, mineWood)).registerAchievement(); + public static Achievement buildPickaxe = (new Achievement(3, "buildPickaxe", 4, 2, Item.pickaxeWood, buildWorkBench)).registerAchievement(); + public static Achievement buildFurnace = (new Achievement(4, "buildFurnace", 3, 4, Block.stoneOvenActive, buildPickaxe)).registerAchievement(); + public static Achievement acquireIron = (new Achievement(5, "acquireIron", 1, 4, Item.ingotIron, buildFurnace)).registerAchievement(); + public static Achievement buildHoe = (new Achievement(6, "buildHoe", 2, -3, Item.hoeWood, buildWorkBench)).registerAchievement(); + public static Achievement makeBread = (new Achievement(7, "makeBread", -1, -3, Item.bread, buildHoe)).registerAchievement(); + public static Achievement bakeCake = (new Achievement(8, "bakeCake", 0, -5, Item.cake, buildHoe)).registerAchievement(); + public static Achievement buildBetterPickaxe = (new Achievement(9, "buildBetterPickaxe", 6, 2, Item.pickaxeStone, buildPickaxe)).registerAchievement(); + public static Achievement cookFish = (new Achievement(10, "cookFish", 2, 6, Item.fishCooked, buildFurnace)).registerAchievement(); + public static Achievement onARail = (new Achievement(11, "onARail", 2, 3, Block.rail, acquireIron)).setSpecial().registerAchievement(); + public static Achievement buildSword = (new Achievement(12, "buildSword", 6, -1, Item.swordWood, buildWorkBench)).registerAchievement(); + public static Achievement killEnemy = (new Achievement(13, "killEnemy", 8, -1, Item.bone, buildSword)).registerAchievement(); + public static Achievement killCow = (new Achievement(14, "killCow", 7, -3, Item.leather, buildSword)).registerAchievement(); + public static Achievement flyPig = (new Achievement(15, "flyPig", 8, -4, Item.saddle, killCow)).setSpecial().registerAchievement(); + + public static void func_27374_a() { + } + + static { + System.out.println(achievementList.size() + " achievements"); + } +} diff --git a/src/net/minecraft/src/AchievementMap.java b/src/net/minecraft/src/AchievementMap.java new file mode 100644 index 0000000..288f0f5 --- /dev/null +++ b/src/net/minecraft/src/AchievementMap.java @@ -0,0 +1,36 @@ +package net.minecraft.src; + +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.util.HashMap; +import java.util.Map; + +public class AchievementMap { + public static AchievementMap instance = new AchievementMap(); + private Map guidMap = new HashMap(); + + private AchievementMap() { + try { + BufferedReader var1 = new BufferedReader(new InputStreamReader(AchievementMap.class.getResourceAsStream("/achievement/map.txt"))); + + while(true) { + String var2 = var1.readLine(); + if(var2 == null) { + var1.close(); + break; + } + + String[] var3 = var2.split(","); + int var4 = Integer.parseInt(var3[0]); + this.guidMap.put(Integer.valueOf(var4), var3[1]); + } + } catch (Exception var5) { + var5.printStackTrace(); + } + + } + + public static String getGuid(int var0) { + return (String)instance.guidMap.get(Integer.valueOf(var0)); + } +} diff --git a/src/net/minecraft/src/AxisAlignedBB.java b/src/net/minecraft/src/AxisAlignedBB.java new file mode 100644 index 0000000..8190995 --- /dev/null +++ b/src/net/minecraft/src/AxisAlignedBB.java @@ -0,0 +1,336 @@ +package net.minecraft.src; + +import java.util.ArrayList; +import java.util.List; + +public class AxisAlignedBB { + private static List boundingBoxes = new ArrayList(); + private static int numBoundingBoxesInUse = 0; + public double minX; + public double minY; + public double minZ; + public double maxX; + public double maxY; + public double maxZ; + + public static AxisAlignedBB getBoundingBox(double var0, double var2, double var4, double var6, double var8, double var10) { + return new AxisAlignedBB(var0, var2, var4, var6, var8, var10); + } + + public static void func_28196_a() { + boundingBoxes.clear(); + numBoundingBoxesInUse = 0; + } + + public static void clearBoundingBoxPool() { + numBoundingBoxesInUse = 0; + } + + public static AxisAlignedBB getBoundingBoxFromPool(double var0, double var2, double var4, double var6, double var8, double var10) { + if(numBoundingBoxesInUse >= boundingBoxes.size()) { + boundingBoxes.add(getBoundingBox(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D)); + } + + return ((AxisAlignedBB)boundingBoxes.get(numBoundingBoxesInUse++)).setBounds(var0, var2, var4, var6, var8, var10); + } + + private AxisAlignedBB(double var1, double var3, double var5, double var7, double var9, double var11) { + this.minX = var1; + this.minY = var3; + this.minZ = var5; + this.maxX = var7; + this.maxY = var9; + this.maxZ = var11; + } + + public AxisAlignedBB setBounds(double var1, double var3, double var5, double var7, double var9, double var11) { + this.minX = var1; + this.minY = var3; + this.minZ = var5; + this.maxX = var7; + this.maxY = var9; + this.maxZ = var11; + return this; + } + + public AxisAlignedBB addCoord(double var1, double var3, double var5) { + double var7 = this.minX; + double var9 = this.minY; + double var11 = this.minZ; + double var13 = this.maxX; + double var15 = this.maxY; + double var17 = this.maxZ; + if(var1 < 0.0D) { + var7 += var1; + } + + if(var1 > 0.0D) { + var13 += var1; + } + + if(var3 < 0.0D) { + var9 += var3; + } + + if(var3 > 0.0D) { + var15 += var3; + } + + if(var5 < 0.0D) { + var11 += var5; + } + + if(var5 > 0.0D) { + var17 += var5; + } + + return getBoundingBoxFromPool(var7, var9, var11, var13, var15, var17); + } + + public AxisAlignedBB expand(double var1, double var3, double var5) { + double var7 = this.minX - var1; + double var9 = this.minY - var3; + double var11 = this.minZ - var5; + double var13 = this.maxX + var1; + double var15 = this.maxY + var3; + double var17 = this.maxZ + var5; + return getBoundingBoxFromPool(var7, var9, var11, var13, var15, var17); + } + + public AxisAlignedBB getOffsetBoundingBox(double var1, double var3, double var5) { + return getBoundingBoxFromPool(this.minX + var1, this.minY + var3, this.minZ + var5, this.maxX + var1, this.maxY + var3, this.maxZ + var5); + } + + public double calculateXOffset(AxisAlignedBB var1, double var2) { + if(var1.maxY > this.minY && var1.minY < this.maxY) { + if(var1.maxZ > this.minZ && var1.minZ < this.maxZ) { + double var4; + if(var2 > 0.0D && var1.maxX <= this.minX) { + var4 = this.minX - var1.maxX; + if(var4 < var2) { + var2 = var4; + } + } + + if(var2 < 0.0D && var1.minX >= this.maxX) { + var4 = this.maxX - var1.minX; + if(var4 > var2) { + var2 = var4; + } + } + + return var2; + } else { + return var2; + } + } else { + return var2; + } + } + + public double calculateYOffset(AxisAlignedBB var1, double var2) { + if(var1.maxX > this.minX && var1.minX < this.maxX) { + if(var1.maxZ > this.minZ && var1.minZ < this.maxZ) { + double var4; + if(var2 > 0.0D && var1.maxY <= this.minY) { + var4 = this.minY - var1.maxY; + if(var4 < var2) { + var2 = var4; + } + } + + if(var2 < 0.0D && var1.minY >= this.maxY) { + var4 = this.maxY - var1.minY; + if(var4 > var2) { + var2 = var4; + } + } + + return var2; + } else { + return var2; + } + } else { + return var2; + } + } + + public double calculateZOffset(AxisAlignedBB var1, double var2) { + if(var1.maxX > this.minX && var1.minX < this.maxX) { + if(var1.maxY > this.minY && var1.minY < this.maxY) { + double var4; + if(var2 > 0.0D && var1.maxZ <= this.minZ) { + var4 = this.minZ - var1.maxZ; + if(var4 < var2) { + var2 = var4; + } + } + + if(var2 < 0.0D && var1.minZ >= this.maxZ) { + var4 = this.maxZ - var1.minZ; + if(var4 > var2) { + var2 = var4; + } + } + + return var2; + } else { + return var2; + } + } else { + return var2; + } + } + + public boolean intersectsWith(AxisAlignedBB var1) { + return var1.maxX > this.minX && var1.minX < this.maxX ? (var1.maxY > this.minY && var1.minY < this.maxY ? var1.maxZ > this.minZ && var1.minZ < this.maxZ : false) : false; + } + + public AxisAlignedBB offset(double var1, double var3, double var5) { + this.minX += var1; + this.minY += var3; + this.minZ += var5; + this.maxX += var1; + this.maxY += var3; + this.maxZ += var5; + return this; + } + + public boolean isVecInside(Vec3D var1) { + return var1.xCoord > this.minX && var1.xCoord < this.maxX ? (var1.yCoord > this.minY && var1.yCoord < this.maxY ? var1.zCoord > this.minZ && var1.zCoord < this.maxZ : false) : false; + } + + public double getAverageEdgeLength() { + double var1 = this.maxX - this.minX; + double var3 = this.maxY - this.minY; + double var5 = this.maxZ - this.minZ; + return (var1 + var3 + var5) / 3.0D; + } + + public AxisAlignedBB func_28195_e(double var1, double var3, double var5) { + double var7 = this.minX + var1; + double var9 = this.minY + var3; + double var11 = this.minZ + var5; + double var13 = this.maxX - var1; + double var15 = this.maxY - var3; + double var17 = this.maxZ - var5; + return getBoundingBoxFromPool(var7, var9, var11, var13, var15, var17); + } + + public AxisAlignedBB copy() { + return getBoundingBoxFromPool(this.minX, this.minY, this.minZ, this.maxX, this.maxY, this.maxZ); + } + + public MovingObjectPosition func_1169_a(Vec3D var1, Vec3D var2) { + Vec3D var3 = var1.getIntermediateWithXValue(var2, this.minX); + Vec3D var4 = var1.getIntermediateWithXValue(var2, this.maxX); + Vec3D var5 = var1.getIntermediateWithYValue(var2, this.minY); + Vec3D var6 = var1.getIntermediateWithYValue(var2, this.maxY); + Vec3D var7 = var1.getIntermediateWithZValue(var2, this.minZ); + Vec3D var8 = var1.getIntermediateWithZValue(var2, this.maxZ); + if(!this.isVecInYZ(var3)) { + var3 = null; + } + + if(!this.isVecInYZ(var4)) { + var4 = null; + } + + if(!this.isVecInXZ(var5)) { + var5 = null; + } + + if(!this.isVecInXZ(var6)) { + var6 = null; + } + + if(!this.isVecInXY(var7)) { + var7 = null; + } + + if(!this.isVecInXY(var8)) { + var8 = null; + } + + Vec3D var9 = null; + if(var3 != null && (var9 == null || var1.squareDistanceTo(var3) < var1.squareDistanceTo(var9))) { + var9 = var3; + } + + if(var4 != null && (var9 == null || var1.squareDistanceTo(var4) < var1.squareDistanceTo(var9))) { + var9 = var4; + } + + if(var5 != null && (var9 == null || var1.squareDistanceTo(var5) < var1.squareDistanceTo(var9))) { + var9 = var5; + } + + if(var6 != null && (var9 == null || var1.squareDistanceTo(var6) < var1.squareDistanceTo(var9))) { + var9 = var6; + } + + if(var7 != null && (var9 == null || var1.squareDistanceTo(var7) < var1.squareDistanceTo(var9))) { + var9 = var7; + } + + if(var8 != null && (var9 == null || var1.squareDistanceTo(var8) < var1.squareDistanceTo(var9))) { + var9 = var8; + } + + if(var9 == null) { + return null; + } else { + byte var10 = -1; + if(var9 == var3) { + var10 = 4; + } + + if(var9 == var4) { + var10 = 5; + } + + if(var9 == var5) { + var10 = 0; + } + + if(var9 == var6) { + var10 = 1; + } + + if(var9 == var7) { + var10 = 2; + } + + if(var9 == var8) { + var10 = 3; + } + + return new MovingObjectPosition(0, 0, 0, var10, var9); + } + } + + private boolean isVecInYZ(Vec3D var1) { + return var1 == null ? false : var1.yCoord >= this.minY && var1.yCoord <= this.maxY && var1.zCoord >= this.minZ && var1.zCoord <= this.maxZ; + } + + private boolean isVecInXZ(Vec3D var1) { + return var1 == null ? false : var1.xCoord >= this.minX && var1.xCoord <= this.maxX && var1.zCoord >= this.minZ && var1.zCoord <= this.maxZ; + } + + private boolean isVecInXY(Vec3D var1) { + return var1 == null ? false : var1.xCoord >= this.minX && var1.xCoord <= this.maxX && var1.yCoord >= this.minY && var1.yCoord <= this.maxY; + } + + public void setBB(AxisAlignedBB var1) { + this.minX = var1.minX; + this.minY = var1.minY; + this.minZ = var1.minZ; + this.maxX = var1.maxX; + this.maxY = var1.maxY; + this.maxZ = var1.maxZ; + } + + public String toString() { + return "box[" + this.minX + ", " + this.minY + ", " + this.minZ + " -> " + this.maxX + ", " + this.maxY + ", " + this.maxZ + "]"; + } +} diff --git a/src/net/minecraft/src/BiomeGenBase.java b/src/net/minecraft/src/BiomeGenBase.java new file mode 100644 index 0000000..60bc33d --- /dev/null +++ b/src/net/minecraft/src/BiomeGenBase.java @@ -0,0 +1,126 @@ +package net.minecraft.src; + +import java.awt.Color; +import java.util.ArrayList; +import java.util.List; +import java.util.Random; + +public class BiomeGenBase { + public static final BiomeGenBase rainforest = (new BiomeGenRainforest()).setColor(588342).setBiomeName("Rainforest").func_4124_a(2094168); + public static final BiomeGenBase swampland = (new BiomeGenSwamp()).setColor(522674).setBiomeName("Swampland").func_4124_a(9154376); + public static final BiomeGenBase seasonalForest = (new BiomeGenBase()).setColor(10215459).setBiomeName("Seasonal Forest"); + public static final BiomeGenBase forest = (new BiomeGenForest()).setColor(353825).setBiomeName("Forest").func_4124_a(5159473); + public static final BiomeGenBase savanna = (new BiomeGenDesert()).setColor(14278691).setBiomeName("Savanna"); + public static final BiomeGenBase shrubland = (new BiomeGenBase()).setColor(10595616).setBiomeName("Shrubland"); + public static final BiomeGenBase taiga = (new BiomeGenTaiga()).setColor(3060051).setBiomeName("Taiga").setEnableSnow().func_4124_a(8107825); + public static final BiomeGenBase desert = (new BiomeGenDesert()).setColor(16421912).setBiomeName("Desert").setDisableRain(); + public static final BiomeGenBase plains = (new BiomeGenDesert()).setColor(16767248).setBiomeName("Plains"); + public static final BiomeGenBase iceDesert = (new BiomeGenDesert()).setColor(16772499).setBiomeName("Ice Desert").setEnableSnow().setDisableRain().func_4124_a(12899129); + public static final BiomeGenBase tundra = (new BiomeGenBase()).setColor(5762041).setBiomeName("Tundra").setEnableSnow().func_4124_a(12899129); + public static final BiomeGenBase hell = (new BiomeGenHell()).setColor(16711680).setBiomeName("Hell").setDisableRain(); + public static final BiomeGenBase sky = (new BiomeGenSky()).setColor(8421631).setBiomeName("Sky").setDisableRain(); + public String biomeName; + public int color; + public byte topBlock = (byte)Block.grass.blockID; + public byte fillerBlock = (byte)Block.dirt.blockID; + public int field_6502_q = 5169201; + protected List spawnableMonsterList = new ArrayList(); + protected List spawnableCreatureList = new ArrayList(); + protected List spawnableWaterCreatureList = new ArrayList(); + private boolean enableSnow; + private boolean enableRain = true; + private static BiomeGenBase[] biomeLookupTable = new BiomeGenBase[4096]; + + protected BiomeGenBase() { + this.spawnableMonsterList.add(new SpawnListEntry(EntitySpider.class, 10)); + this.spawnableMonsterList.add(new SpawnListEntry(EntityZombie.class, 10)); + this.spawnableMonsterList.add(new SpawnListEntry(EntitySkeleton.class, 10)); + this.spawnableMonsterList.add(new SpawnListEntry(EntityCreeper.class, 10)); + this.spawnableMonsterList.add(new SpawnListEntry(EntitySlime.class, 10)); + this.spawnableCreatureList.add(new SpawnListEntry(EntitySheep.class, 12)); + this.spawnableCreatureList.add(new SpawnListEntry(EntityPig.class, 10)); + this.spawnableCreatureList.add(new SpawnListEntry(EntityChicken.class, 10)); + this.spawnableCreatureList.add(new SpawnListEntry(EntityCow.class, 8)); + this.spawnableWaterCreatureList.add(new SpawnListEntry(EntitySquid.class, 10)); + } + + private BiomeGenBase setDisableRain() { + this.enableRain = false; + return this; + } + + public static void generateBiomeLookup() { + for(int var0 = 0; var0 < 64; ++var0) { + for(int var1 = 0; var1 < 64; ++var1) { + biomeLookupTable[var0 + var1 * 64] = getBiome((float)var0 / 63.0F, (float)var1 / 63.0F); + } + } + + desert.topBlock = desert.fillerBlock = (byte)Block.sand.blockID; + iceDesert.topBlock = iceDesert.fillerBlock = (byte)Block.sand.blockID; + } + + public WorldGenerator getRandomWorldGenForTrees(Random var1) { + return (WorldGenerator)(var1.nextInt(10) == 0 ? new WorldGenBigTree() : new WorldGenTrees()); + } + + protected BiomeGenBase setEnableSnow() { + this.enableSnow = true; + return this; + } + + protected BiomeGenBase setBiomeName(String var1) { + this.biomeName = var1; + return this; + } + + protected BiomeGenBase func_4124_a(int var1) { + this.field_6502_q = var1; + return this; + } + + protected BiomeGenBase setColor(int var1) { + this.color = var1; + return this; + } + + public static BiomeGenBase getBiomeFromLookup(double var0, double var2) { + int var4 = (int)(var0 * 63.0D); + int var5 = (int)(var2 * 63.0D); + return biomeLookupTable[var4 + var5 * 64]; + } + + public static BiomeGenBase getBiome(float var0, float var1) { + var1 *= var0; + return var0 < 0.1F ? tundra : (var1 < 0.2F ? (var0 < 0.5F ? tundra : (var0 < 0.95F ? savanna : desert)) : (var1 > 0.5F && var0 < 0.7F ? swampland : (var0 < 0.5F ? taiga : (var0 < 0.97F ? (var1 < 0.35F ? shrubland : forest) : (var1 < 0.45F ? plains : (var1 < 0.9F ? seasonalForest : rainforest)))))); + } + + public int getSkyColorByTemp(float var1) { + var1 /= 3.0F; + if(var1 < -1.0F) { + var1 = -1.0F; + } + + if(var1 > 1.0F) { + var1 = 1.0F; + } + + return Color.getHSBColor(224.0F / 360.0F - var1 * 0.05F, 0.5F + var1 * 0.1F, 1.0F).getRGB(); + } + + public List getSpawnableList(EnumCreatureType var1) { + return var1 == EnumCreatureType.monster ? this.spawnableMonsterList : (var1 == EnumCreatureType.creature ? this.spawnableCreatureList : (var1 == EnumCreatureType.waterCreature ? this.spawnableWaterCreatureList : null)); + } + + public boolean getEnableSnow() { + return this.enableSnow; + } + + public boolean canSpawnLightningBolt() { + return this.enableSnow ? false : this.enableRain; + } + + static { + generateBiomeLookup(); + } +} diff --git a/src/net/minecraft/src/BiomeGenDesert.java b/src/net/minecraft/src/BiomeGenDesert.java new file mode 100644 index 0000000..61a44f5 --- /dev/null +++ b/src/net/minecraft/src/BiomeGenDesert.java @@ -0,0 +1,4 @@ +package net.minecraft.src; + +public class BiomeGenDesert extends BiomeGenBase { +} diff --git a/src/net/minecraft/src/BiomeGenForest.java b/src/net/minecraft/src/BiomeGenForest.java new file mode 100644 index 0000000..e6cad32 --- /dev/null +++ b/src/net/minecraft/src/BiomeGenForest.java @@ -0,0 +1,13 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BiomeGenForest extends BiomeGenBase { + public BiomeGenForest() { + this.spawnableCreatureList.add(new SpawnListEntry(EntityWolf.class, 2)); + } + + public WorldGenerator getRandomWorldGenForTrees(Random var1) { + return (WorldGenerator)(var1.nextInt(5) == 0 ? new WorldGenForest() : (var1.nextInt(3) == 0 ? new WorldGenBigTree() : new WorldGenTrees())); + } +} diff --git a/src/net/minecraft/src/BiomeGenHell.java b/src/net/minecraft/src/BiomeGenHell.java new file mode 100644 index 0000000..97a8169 --- /dev/null +++ b/src/net/minecraft/src/BiomeGenHell.java @@ -0,0 +1,11 @@ +package net.minecraft.src; + +public class BiomeGenHell extends BiomeGenBase { + public BiomeGenHell() { + this.spawnableMonsterList.clear(); + this.spawnableCreatureList.clear(); + this.spawnableWaterCreatureList.clear(); + this.spawnableMonsterList.add(new SpawnListEntry(EntityGhast.class, 10)); + this.spawnableMonsterList.add(new SpawnListEntry(EntityPigZombie.class, 10)); + } +} diff --git a/src/net/minecraft/src/BiomeGenRainforest.java b/src/net/minecraft/src/BiomeGenRainforest.java new file mode 100644 index 0000000..ffe53de --- /dev/null +++ b/src/net/minecraft/src/BiomeGenRainforest.java @@ -0,0 +1,9 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BiomeGenRainforest extends BiomeGenBase { + public WorldGenerator getRandomWorldGenForTrees(Random var1) { + return (WorldGenerator)(var1.nextInt(3) == 0 ? new WorldGenBigTree() : new WorldGenTrees()); + } +} diff --git a/src/net/minecraft/src/BiomeGenSky.java b/src/net/minecraft/src/BiomeGenSky.java new file mode 100644 index 0000000..b40dbfb --- /dev/null +++ b/src/net/minecraft/src/BiomeGenSky.java @@ -0,0 +1,14 @@ +package net.minecraft.src; + +public class BiomeGenSky extends BiomeGenBase { + public BiomeGenSky() { + this.spawnableMonsterList.clear(); + this.spawnableCreatureList.clear(); + this.spawnableWaterCreatureList.clear(); + this.spawnableCreatureList.add(new SpawnListEntry(EntityChicken.class, 10)); + } + + public int getSkyColorByTemp(float var1) { + return 12632319; + } +} diff --git a/src/net/minecraft/src/BiomeGenSwamp.java b/src/net/minecraft/src/BiomeGenSwamp.java new file mode 100644 index 0000000..d2452a0 --- /dev/null +++ b/src/net/minecraft/src/BiomeGenSwamp.java @@ -0,0 +1,4 @@ +package net.minecraft.src; + +public class BiomeGenSwamp extends BiomeGenBase { +} diff --git a/src/net/minecraft/src/BiomeGenTaiga.java b/src/net/minecraft/src/BiomeGenTaiga.java new file mode 100644 index 0000000..d38a85b --- /dev/null +++ b/src/net/minecraft/src/BiomeGenTaiga.java @@ -0,0 +1,13 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BiomeGenTaiga extends BiomeGenBase { + public BiomeGenTaiga() { + this.spawnableCreatureList.add(new SpawnListEntry(EntityWolf.class, 2)); + } + + public WorldGenerator getRandomWorldGenForTrees(Random var1) { + return (WorldGenerator)(var1.nextInt(3) == 0 ? new WorldGenTaiga1() : new WorldGenTaiga2()); + } +} diff --git a/src/net/minecraft/src/Block.java b/src/net/minecraft/src/Block.java new file mode 100644 index 0000000..eb1e969 --- /dev/null +++ b/src/net/minecraft/src/Block.java @@ -0,0 +1,581 @@ +package net.minecraft.src; + +import java.util.ArrayList; +import java.util.Random; + +public class Block { + public static final StepSound soundPowderFootstep = new StepSound("stone", 1.0F, 1.0F); + public static final StepSound soundWoodFootstep = new StepSound("wood", 1.0F, 1.0F); + public static final StepSound soundGravelFootstep = new StepSound("gravel", 1.0F, 1.0F); + public static final StepSound soundGrassFootstep = new StepSound("grass", 1.0F, 1.0F); + public static final StepSound soundStoneFootstep = new StepSound("stone", 1.0F, 1.0F); + public static final StepSound soundMetalFootstep = new StepSound("stone", 1.0F, 1.5F); + public static final StepSound soundGlassFootstep = new StepSoundStone("stone", 1.0F, 1.0F); + public static final StepSound soundClothFootstep = new StepSound("cloth", 1.0F, 1.0F); + public static final StepSound soundSandFootstep = new StepSoundSand("sand", 1.0F, 1.0F); + public static final Block[] blocksList = new Block[256]; + public static final boolean[] tickOnLoad = new boolean[256]; + public static final boolean[] opaqueCubeLookup = new boolean[256]; + public static final boolean[] isBlockContainer = new boolean[256]; + public static final int[] lightOpacity = new int[256]; + public static final boolean[] canBlockGrass = new boolean[256]; + public static final int[] lightValue = new int[256]; + public static final boolean[] field_28032_t = new boolean[256]; + public static final Block stone = (new BlockStone(1, 1)).setHardness(1.5F).setResistance(10.0F).setStepSound(soundStoneFootstep).setBlockName("stone"); + public static final BlockGrass grass = (BlockGrass)(new BlockGrass(2)).setHardness(0.6F).setStepSound(soundGrassFootstep).setBlockName("grass"); + public static final Block dirt = (new BlockDirt(3, 2)).setHardness(0.5F).setStepSound(soundGravelFootstep).setBlockName("dirt"); + public static final Block cobblestone = (new Block(4, 16, Material.rock)).setHardness(2.0F).setResistance(10.0F).setStepSound(soundStoneFootstep).setBlockName("stonebrick"); + public static final Block planks = (new Block(5, 4, Material.wood)).setHardness(2.0F).setResistance(5.0F).setStepSound(soundWoodFootstep).setBlockName("wood").disableNeighborNotifyOnMetadataChange(); + public static final Block sapling = (new BlockSapling(6, 15)).setHardness(0.0F).setStepSound(soundGrassFootstep).setBlockName("sapling").disableNeighborNotifyOnMetadataChange(); + public static final Block bedrock = (new Block(7, 17, Material.rock)).setBlockUnbreakable().setResistance(6000000.0F).setStepSound(soundStoneFootstep).setBlockName("bedrock").disableStats(); + public static final Block waterMoving = (new BlockFlowing(8, Material.water)).setHardness(100.0F).setLightOpacity(3).setBlockName("water").disableStats().disableNeighborNotifyOnMetadataChange(); + public static final Block waterStill = (new BlockStationary(9, Material.water)).setHardness(100.0F).setLightOpacity(3).setBlockName("water").disableStats().disableNeighborNotifyOnMetadataChange(); + public static final Block lavaMoving = (new BlockFlowing(10, Material.lava)).setHardness(0.0F).setLightValue(1.0F).setLightOpacity(255).setBlockName("lava").disableStats().disableNeighborNotifyOnMetadataChange(); + public static final Block lavaStill = (new BlockStationary(11, Material.lava)).setHardness(100.0F).setLightValue(1.0F).setLightOpacity(255).setBlockName("lava").disableStats().disableNeighborNotifyOnMetadataChange(); + public static final Block sand = (new BlockSand(12, 18)).setHardness(0.5F).setStepSound(soundSandFootstep).setBlockName("sand"); + public static final Block gravel = (new BlockGravel(13, 19)).setHardness(0.6F).setStepSound(soundGravelFootstep).setBlockName("gravel"); + public static final Block oreGold = (new BlockOre(14, 32)).setHardness(3.0F).setResistance(5.0F).setStepSound(soundStoneFootstep).setBlockName("oreGold"); + public static final Block oreIron = (new BlockOre(15, 33)).setHardness(3.0F).setResistance(5.0F).setStepSound(soundStoneFootstep).setBlockName("oreIron"); + public static final Block oreCoal = (new BlockOre(16, 34)).setHardness(3.0F).setResistance(5.0F).setStepSound(soundStoneFootstep).setBlockName("oreCoal"); + public static final Block wood = (new BlockLog(17)).setHardness(2.0F).setStepSound(soundWoodFootstep).setBlockName("log").disableNeighborNotifyOnMetadataChange(); + public static final BlockLeaves leaves = (BlockLeaves)(new BlockLeaves(18, 52)).setHardness(0.2F).setLightOpacity(1).setStepSound(soundGrassFootstep).setBlockName("leaves").disableStats().disableNeighborNotifyOnMetadataChange(); + public static final Block sponge = (new BlockSponge(19)).setHardness(0.6F).setStepSound(soundGrassFootstep).setBlockName("sponge"); + public static final Block glass = (new BlockGlass(20, 49, Material.glass, false)).setHardness(0.3F).setStepSound(soundGlassFootstep).setBlockName("glass"); + public static final Block oreLapis = (new BlockOre(21, 160)).setHardness(3.0F).setResistance(5.0F).setStepSound(soundStoneFootstep).setBlockName("oreLapis"); + public static final Block blockLapis = (new Block(22, 144, Material.rock)).setHardness(3.0F).setResistance(5.0F).setStepSound(soundStoneFootstep).setBlockName("blockLapis"); + public static final Block dispenser = (new BlockDispenser(23)).setHardness(3.5F).setStepSound(soundStoneFootstep).setBlockName("dispenser").disableNeighborNotifyOnMetadataChange(); + public static final Block sandStone = (new BlockSandStone(24)).setStepSound(soundStoneFootstep).setHardness(0.8F).setBlockName("sandStone"); + public static final Block musicBlock = (new BlockNote(25)).setHardness(0.8F).setBlockName("musicBlock").disableNeighborNotifyOnMetadataChange(); + public static final Block blockBed = (new BlockBed(26)).setHardness(0.2F).setBlockName("bed").disableStats().disableNeighborNotifyOnMetadataChange(); + public static final Block railPowered = (new BlockRail(27, 179, true)).setHardness(0.7F).setStepSound(soundMetalFootstep).setBlockName("goldenRail").disableNeighborNotifyOnMetadataChange(); + public static final Block railDetector = (new BlockDetectorRail(28, 195)).setHardness(0.7F).setStepSound(soundMetalFootstep).setBlockName("detectorRail").disableNeighborNotifyOnMetadataChange(); + public static final Block pistonStickyBase = (new BlockPistonBase(29, 106, true)).setBlockName("pistonStickyBase").disableNeighborNotifyOnMetadataChange(); + public static final Block web = (new BlockWeb(30, 11)).setLightOpacity(1).setHardness(4.0F).setBlockName("web"); + public static final BlockTallGrass tallGrass = (BlockTallGrass)(new BlockTallGrass(31, 39)).setHardness(0.0F).setStepSound(soundGrassFootstep).setBlockName("tallgrass"); + public static final BlockDeadBush deadBush = (BlockDeadBush)(new BlockDeadBush(32, 55)).setHardness(0.0F).setStepSound(soundGrassFootstep).setBlockName("deadbush"); + public static final Block pistonBase = (new BlockPistonBase(33, 107, false)).setBlockName("pistonBase").disableNeighborNotifyOnMetadataChange(); + public static final BlockPistonExtension pistonExtension = (BlockPistonExtension)(new BlockPistonExtension(34, 107)).disableNeighborNotifyOnMetadataChange(); + public static final Block cloth = (new BlockCloth()).setHardness(0.8F).setStepSound(soundClothFootstep).setBlockName("cloth").disableNeighborNotifyOnMetadataChange(); + public static final BlockPistonMoving pistonMoving = new BlockPistonMoving(36); + public static final BlockFlower plantYellow = (BlockFlower)(new BlockFlower(37, 13)).setHardness(0.0F).setStepSound(soundGrassFootstep).setBlockName("flower"); + public static final BlockFlower plantRed = (BlockFlower)(new BlockFlower(38, 12)).setHardness(0.0F).setStepSound(soundGrassFootstep).setBlockName("rose"); + public static final BlockFlower mushroomBrown = (BlockFlower)(new BlockMushroom(39, 29)).setHardness(0.0F).setStepSound(soundGrassFootstep).setLightValue(2.0F / 16.0F).setBlockName("mushroom"); + public static final BlockFlower mushroomRed = (BlockFlower)(new BlockMushroom(40, 28)).setHardness(0.0F).setStepSound(soundGrassFootstep).setBlockName("mushroom"); + public static final Block blockGold = (new BlockOreStorage(41, 23)).setHardness(3.0F).setResistance(10.0F).setStepSound(soundMetalFootstep).setBlockName("blockGold"); + public static final Block blockSteel = (new BlockOreStorage(42, 22)).setHardness(5.0F).setResistance(10.0F).setStepSound(soundMetalFootstep).setBlockName("blockIron"); + public static final Block stairDouble = (new BlockStep(43, true)).setHardness(2.0F).setResistance(10.0F).setStepSound(soundStoneFootstep).setBlockName("stoneSlab"); + public static final Block stairSingle = (new BlockStep(44, false)).setHardness(2.0F).setResistance(10.0F).setStepSound(soundStoneFootstep).setBlockName("stoneSlab"); + public static final Block brick = (new Block(45, 7, Material.rock)).setHardness(2.0F).setResistance(10.0F).setStepSound(soundStoneFootstep).setBlockName("brick"); + public static final Block tnt = (new BlockTNT(46, 8)).setHardness(0.0F).setStepSound(soundGrassFootstep).setBlockName("tnt"); + public static final Block bookShelf = (new BlockBookshelf(47, 35)).setHardness(1.5F).setStepSound(soundWoodFootstep).setBlockName("bookshelf"); + public static final Block cobblestoneMossy = (new Block(48, 36, Material.rock)).setHardness(2.0F).setResistance(10.0F).setStepSound(soundStoneFootstep).setBlockName("stoneMoss"); + public static final Block obsidian = (new BlockObsidian(49, 37)).setHardness(10.0F).setResistance(2000.0F).setStepSound(soundStoneFootstep).setBlockName("obsidian"); + public static final Block torchWood = (new BlockTorch(50, 80)).setHardness(0.0F).setLightValue(15.0F / 16.0F).setStepSound(soundWoodFootstep).setBlockName("torch").disableNeighborNotifyOnMetadataChange(); + public static final BlockFire fire = (BlockFire)(new BlockFire(51, 31)).setHardness(0.0F).setLightValue(1.0F).setStepSound(soundWoodFootstep).setBlockName("fire").disableStats().disableNeighborNotifyOnMetadataChange(); + public static final Block mobSpawner = (new BlockMobSpawner(52, 65)).setHardness(5.0F).setStepSound(soundMetalFootstep).setBlockName("mobSpawner").disableStats(); + public static final Block stairCompactPlanks = (new BlockStairs(53, planks)).setBlockName("stairsWood").disableNeighborNotifyOnMetadataChange(); + public static final Block chest = (new BlockChest(54)).setHardness(2.5F).setStepSound(soundWoodFootstep).setBlockName("chest").disableNeighborNotifyOnMetadataChange(); + public static final Block redstoneWire = (new BlockRedstoneWire(55, 164)).setHardness(0.0F).setStepSound(soundPowderFootstep).setBlockName("redstoneDust").disableStats().disableNeighborNotifyOnMetadataChange(); + public static final Block oreDiamond = (new BlockOre(56, 50)).setHardness(3.0F).setResistance(5.0F).setStepSound(soundStoneFootstep).setBlockName("oreDiamond"); + public static final Block blockDiamond = (new BlockOreStorage(57, 24)).setHardness(5.0F).setResistance(10.0F).setStepSound(soundMetalFootstep).setBlockName("blockDiamond"); + public static final Block workbench = (new BlockWorkbench(58)).setHardness(2.5F).setStepSound(soundWoodFootstep).setBlockName("workbench"); + public static final Block crops = (new BlockCrops(59, 88)).setHardness(0.0F).setStepSound(soundGrassFootstep).setBlockName("crops").disableStats().disableNeighborNotifyOnMetadataChange(); + public static final Block tilledField = (new BlockFarmland(60)).setHardness(0.6F).setStepSound(soundGravelFootstep).setBlockName("farmland"); + public static final Block stoneOvenIdle = (new BlockFurnace(61, false)).setHardness(3.5F).setStepSound(soundStoneFootstep).setBlockName("furnace").disableNeighborNotifyOnMetadataChange(); + public static final Block stoneOvenActive = (new BlockFurnace(62, true)).setHardness(3.5F).setStepSound(soundStoneFootstep).setLightValue(14.0F / 16.0F).setBlockName("furnace").disableNeighborNotifyOnMetadataChange(); + public static final Block signPost = (new BlockSign(63, TileEntitySign.class, true)).setHardness(1.0F).setStepSound(soundWoodFootstep).setBlockName("sign").disableStats().disableNeighborNotifyOnMetadataChange(); + public static final Block doorWood = (new BlockDoor(64, Material.wood)).setHardness(3.0F).setStepSound(soundWoodFootstep).setBlockName("doorWood").disableStats().disableNeighborNotifyOnMetadataChange(); + public static final Block ladder = (new BlockLadder(65, 83)).setHardness(0.4F).setStepSound(soundWoodFootstep).setBlockName("ladder").disableNeighborNotifyOnMetadataChange(); + public static final Block rail = (new BlockRail(66, 128, false)).setHardness(0.7F).setStepSound(soundMetalFootstep).setBlockName("rail").disableNeighborNotifyOnMetadataChange(); + public static final Block stairCompactCobblestone = (new BlockStairs(67, cobblestone)).setBlockName("stairsStone").disableNeighborNotifyOnMetadataChange(); + public static final Block signWall = (new BlockSign(68, TileEntitySign.class, false)).setHardness(1.0F).setStepSound(soundWoodFootstep).setBlockName("sign").disableStats().disableNeighborNotifyOnMetadataChange(); + public static final Block lever = (new BlockLever(69, 96)).setHardness(0.5F).setStepSound(soundWoodFootstep).setBlockName("lever").disableNeighborNotifyOnMetadataChange(); + public static final Block pressurePlateStone = (new BlockPressurePlate(70, stone.blockIndexInTexture, EnumMobType.mobs, Material.rock)).setHardness(0.5F).setStepSound(soundStoneFootstep).setBlockName("pressurePlate").disableNeighborNotifyOnMetadataChange(); + public static final Block doorSteel = (new BlockDoor(71, Material.iron)).setHardness(5.0F).setStepSound(soundMetalFootstep).setBlockName("doorIron").disableStats().disableNeighborNotifyOnMetadataChange(); + public static final Block pressurePlatePlanks = (new BlockPressurePlate(72, planks.blockIndexInTexture, EnumMobType.everything, Material.wood)).setHardness(0.5F).setStepSound(soundWoodFootstep).setBlockName("pressurePlate").disableNeighborNotifyOnMetadataChange(); + public static final Block oreRedstone = (new BlockRedstoneOre(73, 51, false)).setHardness(3.0F).setResistance(5.0F).setStepSound(soundStoneFootstep).setBlockName("oreRedstone").disableNeighborNotifyOnMetadataChange(); + public static final Block oreRedstoneGlowing = (new BlockRedstoneOre(74, 51, true)).setLightValue(10.0F / 16.0F).setHardness(3.0F).setResistance(5.0F).setStepSound(soundStoneFootstep).setBlockName("oreRedstone").disableNeighborNotifyOnMetadataChange(); + public static final Block torchRedstoneIdle = (new BlockRedstoneTorch(75, 115, false)).setHardness(0.0F).setStepSound(soundWoodFootstep).setBlockName("notGate").disableNeighborNotifyOnMetadataChange(); + public static final Block torchRedstoneActive = (new BlockRedstoneTorch(76, 99, true)).setHardness(0.0F).setLightValue(0.5F).setStepSound(soundWoodFootstep).setBlockName("notGate").disableNeighborNotifyOnMetadataChange(); + public static final Block button = (new BlockButton(77, stone.blockIndexInTexture)).setHardness(0.5F).setStepSound(soundStoneFootstep).setBlockName("button").disableNeighborNotifyOnMetadataChange(); + public static final Block snow = (new BlockSnow(78, 66)).setHardness(0.1F).setStepSound(soundClothFootstep).setBlockName("snow"); + public static final Block ice = (new BlockIce(79, 67)).setHardness(0.5F).setLightOpacity(3).setStepSound(soundGlassFootstep).setBlockName("ice"); + public static final Block blockSnow = (new BlockSnowBlock(80, 66)).setHardness(0.2F).setStepSound(soundClothFootstep).setBlockName("snow"); + public static final Block cactus = (new BlockCactus(81, 70)).setHardness(0.4F).setStepSound(soundClothFootstep).setBlockName("cactus"); + public static final Block blockClay = (new BlockClay(82, 72)).setHardness(0.6F).setStepSound(soundGravelFootstep).setBlockName("clay"); + public static final Block reed = (new BlockReed(83, 73)).setHardness(0.0F).setStepSound(soundGrassFootstep).setBlockName("reeds").disableStats(); + public static final Block jukebox = (new BlockJukeBox(84, 74)).setHardness(2.0F).setResistance(10.0F).setStepSound(soundStoneFootstep).setBlockName("jukebox").disableNeighborNotifyOnMetadataChange(); + public static final Block fence = (new BlockFence(85, 4)).setHardness(2.0F).setResistance(5.0F).setStepSound(soundWoodFootstep).setBlockName("fence").disableNeighborNotifyOnMetadataChange(); + public static final Block pumpkin = (new BlockPumpkin(86, 102, false)).setHardness(1.0F).setStepSound(soundWoodFootstep).setBlockName("pumpkin").disableNeighborNotifyOnMetadataChange(); + public static final Block netherrack = (new BlockNetherrack(87, 103)).setHardness(0.4F).setStepSound(soundStoneFootstep).setBlockName("hellrock"); + public static final Block slowSand = (new BlockSoulSand(88, 104)).setHardness(0.5F).setStepSound(soundSandFootstep).setBlockName("hellsand"); + public static final Block glowStone = (new BlockGlowStone(89, 105, Material.rock)).setHardness(0.3F).setStepSound(soundGlassFootstep).setLightValue(1.0F).setBlockName("lightgem"); + public static final BlockPortal portal = (BlockPortal)(new BlockPortal(90, 14)).setHardness(-1.0F).setStepSound(soundGlassFootstep).setLightValue(12.0F / 16.0F).setBlockName("portal"); + public static final Block pumpkinLantern = (new BlockPumpkin(91, 102, true)).setHardness(1.0F).setStepSound(soundWoodFootstep).setLightValue(1.0F).setBlockName("litpumpkin").disableNeighborNotifyOnMetadataChange(); + public static final Block cake = (new BlockCake(92, 121)).setHardness(0.5F).setStepSound(soundClothFootstep).setBlockName("cake").disableStats().disableNeighborNotifyOnMetadataChange(); + public static final Block redstoneRepeaterIdle = (new BlockRedstoneRepeater(93, false)).setHardness(0.0F).setStepSound(soundWoodFootstep).setBlockName("diode").disableStats().disableNeighborNotifyOnMetadataChange(); + public static final Block redstoneRepeaterActive = (new BlockRedstoneRepeater(94, true)).setHardness(0.0F).setLightValue(10.0F / 16.0F).setStepSound(soundWoodFootstep).setBlockName("diode").disableStats().disableNeighborNotifyOnMetadataChange(); + public static final Block lockedChest = (new BlockLockedChest(95)).setHardness(0.0F).setLightValue(1.0F).setStepSound(soundWoodFootstep).setBlockName("lockedchest").setTickOnLoad(true).disableNeighborNotifyOnMetadataChange(); + public static final Block trapdoor = (new BlockTrapDoor(96, Material.wood)).setHardness(3.0F).setStepSound(soundWoodFootstep).setBlockName("trapdoor").disableStats().disableNeighborNotifyOnMetadataChange(); + public int blockIndexInTexture; + public final int blockID; + protected float blockHardness; + protected float blockResistance; + protected boolean blockConstructorCalled; + protected boolean enableStats; + public double minX; + public double minY; + public double minZ; + public double maxX; + public double maxY; + public double maxZ; + public StepSound stepSound; + public float blockParticleGravity; + public final Material blockMaterial; + public float slipperiness; + private String blockName; + + protected Block(int var1, Material var2) { + this.blockConstructorCalled = true; + this.enableStats = true; + this.stepSound = soundPowderFootstep; + this.blockParticleGravity = 1.0F; + this.slipperiness = 0.6F; + if(blocksList[var1] != null) { + throw new IllegalArgumentException("Slot " + var1 + " is already occupied by " + blocksList[var1] + " when adding " + this); + } else { + this.blockMaterial = var2; + blocksList[var1] = this; + this.blockID = var1; + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + opaqueCubeLookup[var1] = this.isOpaqueCube(); + lightOpacity[var1] = this.isOpaqueCube() ? 255 : 0; + canBlockGrass[var1] = !var2.getCanBlockGrass(); + isBlockContainer[var1] = false; + } + } + + protected Block disableNeighborNotifyOnMetadataChange() { + field_28032_t[this.blockID] = true; + return this; + } + + protected void initializeBlock() { + } + + protected Block(int var1, int var2, Material var3) { + this(var1, var3); + this.blockIndexInTexture = var2; + } + + protected Block setStepSound(StepSound var1) { + this.stepSound = var1; + return this; + } + + protected Block setLightOpacity(int var1) { + lightOpacity[this.blockID] = var1; + return this; + } + + protected Block setLightValue(float var1) { + lightValue[this.blockID] = (int)(15.0F * var1); + return this; + } + + protected Block setResistance(float var1) { + this.blockResistance = var1 * 3.0F; + return this; + } + + public boolean renderAsNormalBlock() { + return true; + } + + public int getRenderType() { + return 0; + } + + protected Block setHardness(float var1) { + this.blockHardness = var1; + if(this.blockResistance < var1 * 5.0F) { + this.blockResistance = var1 * 5.0F; + } + + return this; + } + + protected Block setBlockUnbreakable() { + this.setHardness(-1.0F); + return this; + } + + public float getHardness() { + return this.blockHardness; + } + + protected Block setTickOnLoad(boolean var1) { + tickOnLoad[this.blockID] = var1; + return this; + } + + public void setBlockBounds(float var1, float var2, float var3, float var4, float var5, float var6) { + this.minX = (double)var1; + this.minY = (double)var2; + this.minZ = (double)var3; + this.maxX = (double)var4; + this.maxY = (double)var5; + this.maxZ = (double)var6; + } + + public float getBlockBrightness(IBlockAccess var1, int var2, int var3, int var4) { + return var1.getBrightness(var2, var3, var4, lightValue[this.blockID]); + } + + public boolean shouldSideBeRendered(IBlockAccess var1, int var2, int var3, int var4, int var5) { + return var5 == 0 && this.minY > 0.0D ? true : (var5 == 1 && this.maxY < 1.0D ? true : (var5 == 2 && this.minZ > 0.0D ? true : (var5 == 3 && this.maxZ < 1.0D ? true : (var5 == 4 && this.minX > 0.0D ? true : (var5 == 5 && this.maxX < 1.0D ? true : !var1.isBlockOpaqueCube(var2, var3, var4)))))); + } + + public boolean getIsBlockSolid(IBlockAccess var1, int var2, int var3, int var4, int var5) { + return var1.getBlockMaterial(var2, var3, var4).isSolid(); + } + + public int getBlockTexture(IBlockAccess var1, int var2, int var3, int var4, int var5) { + return this.getBlockTextureFromSideAndMetadata(var5, var1.getBlockMetadata(var2, var3, var4)); + } + + public int getBlockTextureFromSideAndMetadata(int var1, int var2) { + return this.getBlockTextureFromSide(var1); + } + + public int getBlockTextureFromSide(int var1) { + return this.blockIndexInTexture; + } + + public AxisAlignedBB getSelectedBoundingBoxFromPool(World var1, int var2, int var3, int var4) { + return AxisAlignedBB.getBoundingBoxFromPool((double)var2 + this.minX, (double)var3 + this.minY, (double)var4 + this.minZ, (double)var2 + this.maxX, (double)var3 + this.maxY, (double)var4 + this.maxZ); + } + + public void getCollidingBoundingBoxes(World var1, int var2, int var3, int var4, AxisAlignedBB var5, ArrayList var6) { + AxisAlignedBB var7 = this.getCollisionBoundingBoxFromPool(var1, var2, var3, var4); + if(var7 != null && var5.intersectsWith(var7)) { + var6.add(var7); + } + + } + + public AxisAlignedBB getCollisionBoundingBoxFromPool(World var1, int var2, int var3, int var4) { + return AxisAlignedBB.getBoundingBoxFromPool((double)var2 + this.minX, (double)var3 + this.minY, (double)var4 + this.minZ, (double)var2 + this.maxX, (double)var3 + this.maxY, (double)var4 + this.maxZ); + } + + public boolean isOpaqueCube() { + return true; + } + + public boolean canCollideCheck(int var1, boolean var2) { + return this.isCollidable(); + } + + public boolean isCollidable() { + return true; + } + + public void updateTick(World var1, int var2, int var3, int var4, Random var5) { + } + + public void randomDisplayTick(World var1, int var2, int var3, int var4, Random var5) { + } + + public void onBlockDestroyedByPlayer(World var1, int var2, int var3, int var4, int var5) { + } + + public void onNeighborBlockChange(World var1, int var2, int var3, int var4, int var5) { + } + + public int tickRate() { + return 10; + } + + public void onBlockAdded(World var1, int var2, int var3, int var4) { + } + + public void onBlockRemoval(World var1, int var2, int var3, int var4) { + } + + public int quantityDropped(Random var1) { + return 1; + } + + public int idDropped(int var1, Random var2) { + return this.blockID; + } + + public float blockStrength(EntityPlayer var1) { + return this.blockHardness < 0.0F ? 0.0F : (!var1.canHarvestBlock(this) ? 1.0F / this.blockHardness / 100.0F : var1.getCurrentPlayerStrVsBlock(this) / this.blockHardness / 30.0F); + } + + public final void dropBlockAsItem(World var1, int var2, int var3, int var4, int var5) { + this.dropBlockAsItemWithChance(var1, var2, var3, var4, var5, 1.0F); + } + + public void dropBlockAsItemWithChance(World var1, int var2, int var3, int var4, int var5, float var6) { + if(!var1.multiplayerWorld) { + int var7 = this.quantityDropped(var1.rand); + + for(int var8 = 0; var8 < var7; ++var8) { + if(var1.rand.nextFloat() <= var6) { + int var9 = this.idDropped(var5, var1.rand); + if(var9 > 0) { + this.dropBlockAsItem_do(var1, var2, var3, var4, new ItemStack(var9, 1, this.damageDropped(var5))); + } + } + } + + } + } + + protected void dropBlockAsItem_do(World var1, int var2, int var3, int var4, ItemStack var5) { + if(!var1.multiplayerWorld) { + float var6 = 0.7F; + double var7 = (double)(var1.rand.nextFloat() * var6) + (double)(1.0F - var6) * 0.5D; + double var9 = (double)(var1.rand.nextFloat() * var6) + (double)(1.0F - var6) * 0.5D; + double var11 = (double)(var1.rand.nextFloat() * var6) + (double)(1.0F - var6) * 0.5D; + EntityItem var13 = new EntityItem(var1, (double)var2 + var7, (double)var3 + var9, (double)var4 + var11, var5); + var13.delayBeforeCanPickup = 10; + var1.entityJoinedWorld(var13); + } + } + + protected int damageDropped(int var1) { + return 0; + } + + public float getExplosionResistance(Entity var1) { + return this.blockResistance / 5.0F; + } + + public MovingObjectPosition collisionRayTrace(World var1, int var2, int var3, int var4, Vec3D var5, Vec3D var6) { + this.setBlockBoundsBasedOnState(var1, var2, var3, var4); + var5 = var5.addVector((double)(-var2), (double)(-var3), (double)(-var4)); + var6 = var6.addVector((double)(-var2), (double)(-var3), (double)(-var4)); + Vec3D var7 = var5.getIntermediateWithXValue(var6, this.minX); + Vec3D var8 = var5.getIntermediateWithXValue(var6, this.maxX); + Vec3D var9 = var5.getIntermediateWithYValue(var6, this.minY); + Vec3D var10 = var5.getIntermediateWithYValue(var6, this.maxY); + Vec3D var11 = var5.getIntermediateWithZValue(var6, this.minZ); + Vec3D var12 = var5.getIntermediateWithZValue(var6, this.maxZ); + if(!this.isVecInsideYZBounds(var7)) { + var7 = null; + } + + if(!this.isVecInsideYZBounds(var8)) { + var8 = null; + } + + if(!this.isVecInsideXZBounds(var9)) { + var9 = null; + } + + if(!this.isVecInsideXZBounds(var10)) { + var10 = null; + } + + if(!this.isVecInsideXYBounds(var11)) { + var11 = null; + } + + if(!this.isVecInsideXYBounds(var12)) { + var12 = null; + } + + Vec3D var13 = null; + if(var7 != null && (var13 == null || var5.distanceTo(var7) < var5.distanceTo(var13))) { + var13 = var7; + } + + if(var8 != null && (var13 == null || var5.distanceTo(var8) < var5.distanceTo(var13))) { + var13 = var8; + } + + if(var9 != null && (var13 == null || var5.distanceTo(var9) < var5.distanceTo(var13))) { + var13 = var9; + } + + if(var10 != null && (var13 == null || var5.distanceTo(var10) < var5.distanceTo(var13))) { + var13 = var10; + } + + if(var11 != null && (var13 == null || var5.distanceTo(var11) < var5.distanceTo(var13))) { + var13 = var11; + } + + if(var12 != null && (var13 == null || var5.distanceTo(var12) < var5.distanceTo(var13))) { + var13 = var12; + } + + if(var13 == null) { + return null; + } else { + byte var14 = -1; + if(var13 == var7) { + var14 = 4; + } + + if(var13 == var8) { + var14 = 5; + } + + if(var13 == var9) { + var14 = 0; + } + + if(var13 == var10) { + var14 = 1; + } + + if(var13 == var11) { + var14 = 2; + } + + if(var13 == var12) { + var14 = 3; + } + + return new MovingObjectPosition(var2, var3, var4, var14, var13.addVector((double)var2, (double)var3, (double)var4)); + } + } + + private boolean isVecInsideYZBounds(Vec3D var1) { + return var1 == null ? false : var1.yCoord >= this.minY && var1.yCoord <= this.maxY && var1.zCoord >= this.minZ && var1.zCoord <= this.maxZ; + } + + private boolean isVecInsideXZBounds(Vec3D var1) { + return var1 == null ? false : var1.xCoord >= this.minX && var1.xCoord <= this.maxX && var1.zCoord >= this.minZ && var1.zCoord <= this.maxZ; + } + + private boolean isVecInsideXYBounds(Vec3D var1) { + return var1 == null ? false : var1.xCoord >= this.minX && var1.xCoord <= this.maxX && var1.yCoord >= this.minY && var1.yCoord <= this.maxY; + } + + public void onBlockDestroyedByExplosion(World var1, int var2, int var3, int var4) { + } + + public int getRenderBlockPass() { + return 0; + } + + public boolean canPlaceBlockOnSide(World var1, int var2, int var3, int var4, int var5) { + return this.canPlaceBlockAt(var1, var2, var3, var4); + } + + public boolean canPlaceBlockAt(World var1, int var2, int var3, int var4) { + int var5 = var1.getBlockId(var2, var3, var4); + return var5 == 0 || blocksList[var5].blockMaterial.getIsGroundCover(); + } + + public boolean blockActivated(World var1, int var2, int var3, int var4, EntityPlayer var5) { + return false; + } + + public void onEntityWalking(World var1, int var2, int var3, int var4, Entity var5) { + } + + public void onBlockPlaced(World var1, int var2, int var3, int var4, int var5) { + } + + public void onBlockClicked(World var1, int var2, int var3, int var4, EntityPlayer var5) { + } + + public void velocityToAddToEntity(World var1, int var2, int var3, int var4, Entity var5, Vec3D var6) { + } + + public void setBlockBoundsBasedOnState(IBlockAccess var1, int var2, int var3, int var4) { + } + + public int getRenderColor(int var1) { + return 16777215; + } + + public int colorMultiplier(IBlockAccess var1, int var2, int var3, int var4) { + return 16777215; + } + + public boolean isPoweringTo(IBlockAccess var1, int var2, int var3, int var4, int var5) { + return false; + } + + public boolean canProvidePower() { + return false; + } + + public void onEntityCollidedWithBlock(World var1, int var2, int var3, int var4, Entity var5) { + } + + public boolean isIndirectlyPoweringTo(World var1, int var2, int var3, int var4, int var5) { + return false; + } + + public void setBlockBoundsForItemRender() { + } + + public void harvestBlock(World var1, EntityPlayer var2, int var3, int var4, int var5, int var6) { + var2.addStat(StatList.mineBlockStatArray[this.blockID], 1); + this.dropBlockAsItem(var1, var3, var4, var5, var6); + } + + public boolean canBlockStay(World var1, int var2, int var3, int var4) { + return true; + } + + public void onBlockPlacedBy(World var1, int var2, int var3, int var4, EntityLiving var5) { + } + + public Block setBlockName(String var1) { + this.blockName = "tile." + var1; + return this; + } + + public String translateBlockName() { + return StatCollector.translateToLocal(this.getBlockName() + ".name"); + } + + public String getBlockName() { + return this.blockName; + } + + public void playBlock(World var1, int var2, int var3, int var4, int var5, int var6) { + } + + public boolean getEnableStats() { + return this.enableStats; + } + + protected Block disableStats() { + this.enableStats = false; + return this; + } + + public int getMobilityFlag() { + return this.blockMaterial.getMaterialMobility(); + } + + static { + Item.itemsList[cloth.blockID] = (new ItemCloth(cloth.blockID - 256)).setItemName("cloth"); + Item.itemsList[wood.blockID] = (new ItemLog(wood.blockID - 256)).setItemName("log"); + Item.itemsList[stairSingle.blockID] = (new ItemSlab(stairSingle.blockID - 256)).setItemName("stoneSlab"); + Item.itemsList[sapling.blockID] = (new ItemSapling(sapling.blockID - 256)).setItemName("sapling"); + Item.itemsList[leaves.blockID] = (new ItemLeaves(leaves.blockID - 256)).setItemName("leaves"); + Item.itemsList[pistonBase.blockID] = new ItemPiston(pistonBase.blockID - 256); + Item.itemsList[pistonStickyBase.blockID] = new ItemPiston(pistonStickyBase.blockID - 256); + + for(int var0 = 0; var0 < 256; ++var0) { + if(blocksList[var0] != null && Item.itemsList[var0] == null) { + Item.itemsList[var0] = new ItemBlock(var0 - 256); + blocksList[var0].initializeBlock(); + } + } + + canBlockGrass[0] = true; + StatList.func_25154_a(); + } +} diff --git a/src/net/minecraft/src/BlockBed.java b/src/net/minecraft/src/BlockBed.java new file mode 100644 index 0000000..0dbfe00 --- /dev/null +++ b/src/net/minecraft/src/BlockBed.java @@ -0,0 +1,194 @@ +package net.minecraft.src; + +import java.util.Iterator; +import java.util.Random; + +public class BlockBed extends Block { + public static final int[][] headBlockToFootBlockMap = new int[][]{{0, 1}, {-1, 0}, {0, -1}, {1, 0}}; + + public BlockBed(int var1) { + super(var1, 134, Material.cloth); + this.setBounds(); + } + + public boolean blockActivated(World var1, int var2, int var3, int var4, EntityPlayer var5) { + if(var1.multiplayerWorld) { + return true; + } else { + int var6 = var1.getBlockMetadata(var2, var3, var4); + if(!isBlockFootOfBed(var6)) { + int var7 = getDirectionFromMetadata(var6); + var2 += headBlockToFootBlockMap[var7][0]; + var4 += headBlockToFootBlockMap[var7][1]; + if(var1.getBlockId(var2, var3, var4) != this.blockID) { + return true; + } + + var6 = var1.getBlockMetadata(var2, var3, var4); + } + + if(!var1.worldProvider.canRespawnHere()) { + double var16 = (double)var2 + 0.5D; + double var17 = (double)var3 + 0.5D; + double var11 = (double)var4 + 0.5D; + var1.setBlockWithNotify(var2, var3, var4, 0); + int var13 = getDirectionFromMetadata(var6); + var2 += headBlockToFootBlockMap[var13][0]; + var4 += headBlockToFootBlockMap[var13][1]; + if(var1.getBlockId(var2, var3, var4) == this.blockID) { + var1.setBlockWithNotify(var2, var3, var4, 0); + var16 = (var16 + (double)var2 + 0.5D) / 2.0D; + var17 = (var17 + (double)var3 + 0.5D) / 2.0D; + var11 = (var11 + (double)var4 + 0.5D) / 2.0D; + } + + var1.newExplosion((Entity)null, (double)((float)var2 + 0.5F), (double)((float)var3 + 0.5F), (double)((float)var4 + 0.5F), 5.0F, true); + return true; + } else { + if(isBedOccupied(var6)) { + EntityPlayer var14 = null; + Iterator var8 = var1.playerEntities.iterator(); + + while(var8.hasNext()) { + EntityPlayer var9 = (EntityPlayer)var8.next(); + if(var9.isPlayerSleeping()) { + ChunkCoordinates var10 = var9.bedChunkCoordinates; + if(var10.x == var2 && var10.y == var3 && var10.z == var4) { + var14 = var9; + } + } + } + + if(var14 != null) { + var5.addChatMessage("tile.bed.occupied"); + return true; + } + + setBedOccupied(var1, var2, var3, var4, false); + } + + EnumStatus var15 = var5.sleepInBedAt(var2, var3, var4); + if(var15 == EnumStatus.OK) { + setBedOccupied(var1, var2, var3, var4, true); + return true; + } else { + if(var15 == EnumStatus.NOT_POSSIBLE_NOW) { + var5.addChatMessage("tile.bed.noSleep"); + } + + return true; + } + } + } + } + + public int getBlockTextureFromSideAndMetadata(int var1, int var2) { + if(var1 == 0) { + return Block.planks.blockIndexInTexture; + } else { + int var3 = getDirectionFromMetadata(var2); + int var4 = ModelBed.bedDirection[var3][var1]; + return isBlockFootOfBed(var2) ? (var4 == 2 ? this.blockIndexInTexture + 2 + 16 : (var4 != 5 && var4 != 4 ? this.blockIndexInTexture + 1 : this.blockIndexInTexture + 1 + 16)) : (var4 == 3 ? this.blockIndexInTexture - 1 + 16 : (var4 != 5 && var4 != 4 ? this.blockIndexInTexture : this.blockIndexInTexture + 16)); + } + } + + public int getRenderType() { + return 14; + } + + public boolean renderAsNormalBlock() { + return false; + } + + public boolean isOpaqueCube() { + return false; + } + + public void setBlockBoundsBasedOnState(IBlockAccess var1, int var2, int var3, int var4) { + this.setBounds(); + } + + public void onNeighborBlockChange(World var1, int var2, int var3, int var4, int var5) { + int var6 = var1.getBlockMetadata(var2, var3, var4); + int var7 = getDirectionFromMetadata(var6); + if(isBlockFootOfBed(var6)) { + if(var1.getBlockId(var2 - headBlockToFootBlockMap[var7][0], var3, var4 - headBlockToFootBlockMap[var7][1]) != this.blockID) { + var1.setBlockWithNotify(var2, var3, var4, 0); + } + } else if(var1.getBlockId(var2 + headBlockToFootBlockMap[var7][0], var3, var4 + headBlockToFootBlockMap[var7][1]) != this.blockID) { + var1.setBlockWithNotify(var2, var3, var4, 0); + if(!var1.multiplayerWorld) { + this.dropBlockAsItem(var1, var2, var3, var4, var6); + } + } + + } + + public int idDropped(int var1, Random var2) { + return isBlockFootOfBed(var1) ? 0 : Item.bed.shiftedIndex; + } + + private void setBounds() { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 9.0F / 16.0F, 1.0F); + } + + public static int getDirectionFromMetadata(int var0) { + return var0 & 3; + } + + public static boolean isBlockFootOfBed(int var0) { + return (var0 & 8) != 0; + } + + public static boolean isBedOccupied(int var0) { + return (var0 & 4) != 0; + } + + public static void setBedOccupied(World var0, int var1, int var2, int var3, boolean var4) { + int var5 = var0.getBlockMetadata(var1, var2, var3); + if(var4) { + var5 |= 4; + } else { + var5 &= -5; + } + + var0.setBlockMetadataWithNotify(var1, var2, var3, var5); + } + + public static ChunkCoordinates getNearestEmptyChunkCoordinates(World var0, int var1, int var2, int var3, int var4) { + int var5 = var0.getBlockMetadata(var1, var2, var3); + int var6 = getDirectionFromMetadata(var5); + + for(int var7 = 0; var7 <= 1; ++var7) { + int var8 = var1 - headBlockToFootBlockMap[var6][0] * var7 - 1; + int var9 = var3 - headBlockToFootBlockMap[var6][1] * var7 - 1; + int var10 = var8 + 2; + int var11 = var9 + 2; + + for(int var12 = var8; var12 <= var10; ++var12) { + for(int var13 = var9; var13 <= var11; ++var13) { + if(var0.isBlockNormalCube(var12, var2 - 1, var13) && var0.isAirBlock(var12, var2, var13) && var0.isAirBlock(var12, var2 + 1, var13)) { + if(var4 <= 0) { + return new ChunkCoordinates(var12, var2, var13); + } + + --var4; + } + } + } + } + + return null; + } + + public void dropBlockAsItemWithChance(World var1, int var2, int var3, int var4, int var5, float var6) { + if(!isBlockFootOfBed(var5)) { + super.dropBlockAsItemWithChance(var1, var2, var3, var4, var5, var6); + } + + } + + public int getMobilityFlag() { + return 1; + } +} diff --git a/src/net/minecraft/src/BlockBookshelf.java b/src/net/minecraft/src/BlockBookshelf.java new file mode 100644 index 0000000..35e3631 --- /dev/null +++ b/src/net/minecraft/src/BlockBookshelf.java @@ -0,0 +1,17 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockBookshelf extends Block { + public BlockBookshelf(int var1, int var2) { + super(var1, var2, Material.wood); + } + + public int getBlockTextureFromSide(int var1) { + return var1 <= 1 ? 4 : this.blockIndexInTexture; + } + + public int quantityDropped(Random var1) { + return 0; + } +} diff --git a/src/net/minecraft/src/BlockBreakable.java b/src/net/minecraft/src/BlockBreakable.java new file mode 100644 index 0000000..08a871f --- /dev/null +++ b/src/net/minecraft/src/BlockBreakable.java @@ -0,0 +1,19 @@ +package net.minecraft.src; + +public class BlockBreakable extends Block { + private boolean localFlag; + + protected BlockBreakable(int var1, int var2, Material var3, boolean var4) { + super(var1, var2, var3); + this.localFlag = var4; + } + + public boolean isOpaqueCube() { + return false; + } + + public boolean shouldSideBeRendered(IBlockAccess var1, int var2, int var3, int var4, int var5) { + int var6 = var1.getBlockId(var2, var3, var4); + return !this.localFlag && var6 == this.blockID ? false : super.shouldSideBeRendered(var1, var2, var3, var4, var5); + } +} diff --git a/src/net/minecraft/src/BlockButton.java b/src/net/minecraft/src/BlockButton.java new file mode 100644 index 0000000..be32afb --- /dev/null +++ b/src/net/minecraft/src/BlockButton.java @@ -0,0 +1,222 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockButton extends Block { + protected BlockButton(int var1, int var2) { + super(var1, var2, Material.circuits); + this.setTickOnLoad(true); + } + + public AxisAlignedBB getCollisionBoundingBoxFromPool(World var1, int var2, int var3, int var4) { + return null; + } + + public int tickRate() { + return 20; + } + + public boolean isOpaqueCube() { + return false; + } + + public boolean renderAsNormalBlock() { + return false; + } + + public boolean canPlaceBlockOnSide(World var1, int var2, int var3, int var4, int var5) { + return var5 == 2 && var1.isBlockNormalCube(var2, var3, var4 + 1) ? true : (var5 == 3 && var1.isBlockNormalCube(var2, var3, var4 - 1) ? true : (var5 == 4 && var1.isBlockNormalCube(var2 + 1, var3, var4) ? true : var5 == 5 && var1.isBlockNormalCube(var2 - 1, var3, var4))); + } + + public boolean canPlaceBlockAt(World var1, int var2, int var3, int var4) { + return var1.isBlockNormalCube(var2 - 1, var3, var4) ? true : (var1.isBlockNormalCube(var2 + 1, var3, var4) ? true : (var1.isBlockNormalCube(var2, var3, var4 - 1) ? true : var1.isBlockNormalCube(var2, var3, var4 + 1))); + } + + public void onBlockPlaced(World var1, int var2, int var3, int var4, int var5) { + int var6 = var1.getBlockMetadata(var2, var3, var4); + int var7 = var6 & 8; + var6 &= 7; + if(var5 == 2 && var1.isBlockNormalCube(var2, var3, var4 + 1)) { + var6 = 4; + } else if(var5 == 3 && var1.isBlockNormalCube(var2, var3, var4 - 1)) { + var6 = 3; + } else if(var5 == 4 && var1.isBlockNormalCube(var2 + 1, var3, var4)) { + var6 = 2; + } else if(var5 == 5 && var1.isBlockNormalCube(var2 - 1, var3, var4)) { + var6 = 1; + } else { + var6 = this.getOrientation(var1, var2, var3, var4); + } + + var1.setBlockMetadataWithNotify(var2, var3, var4, var6 + var7); + } + + private int getOrientation(World var1, int var2, int var3, int var4) { + return var1.isBlockNormalCube(var2 - 1, var3, var4) ? 1 : (var1.isBlockNormalCube(var2 + 1, var3, var4) ? 2 : (var1.isBlockNormalCube(var2, var3, var4 - 1) ? 3 : (var1.isBlockNormalCube(var2, var3, var4 + 1) ? 4 : 1))); + } + + public void onNeighborBlockChange(World var1, int var2, int var3, int var4, int var5) { + if(this.func_305_h(var1, var2, var3, var4)) { + int var6 = var1.getBlockMetadata(var2, var3, var4) & 7; + boolean var7 = false; + if(!var1.isBlockNormalCube(var2 - 1, var3, var4) && var6 == 1) { + var7 = true; + } + + if(!var1.isBlockNormalCube(var2 + 1, var3, var4) && var6 == 2) { + var7 = true; + } + + if(!var1.isBlockNormalCube(var2, var3, var4 - 1) && var6 == 3) { + var7 = true; + } + + if(!var1.isBlockNormalCube(var2, var3, var4 + 1) && var6 == 4) { + var7 = true; + } + + if(var7) { + this.dropBlockAsItem(var1, var2, var3, var4, var1.getBlockMetadata(var2, var3, var4)); + var1.setBlockWithNotify(var2, var3, var4, 0); + } + } + + } + + private boolean func_305_h(World var1, int var2, int var3, int var4) { + if(!this.canPlaceBlockAt(var1, var2, var3, var4)) { + this.dropBlockAsItem(var1, var2, var3, var4, var1.getBlockMetadata(var2, var3, var4)); + var1.setBlockWithNotify(var2, var3, var4, 0); + return false; + } else { + return true; + } + } + + public void setBlockBoundsBasedOnState(IBlockAccess var1, int var2, int var3, int var4) { + int var5 = var1.getBlockMetadata(var2, var3, var4); + int var6 = var5 & 7; + boolean var7 = (var5 & 8) > 0; + float var8 = 6.0F / 16.0F; + float var9 = 10.0F / 16.0F; + float var10 = 3.0F / 16.0F; + float var11 = 2.0F / 16.0F; + if(var7) { + var11 = 1.0F / 16.0F; + } + + if(var6 == 1) { + this.setBlockBounds(0.0F, var8, 0.5F - var10, var11, var9, 0.5F + var10); + } else if(var6 == 2) { + this.setBlockBounds(1.0F - var11, var8, 0.5F - var10, 1.0F, var9, 0.5F + var10); + } else if(var6 == 3) { + this.setBlockBounds(0.5F - var10, var8, 0.0F, 0.5F + var10, var9, var11); + } else if(var6 == 4) { + this.setBlockBounds(0.5F - var10, var8, 1.0F - var11, 0.5F + var10, var9, 1.0F); + } + + } + + public void onBlockClicked(World var1, int var2, int var3, int var4, EntityPlayer var5) { + this.blockActivated(var1, var2, var3, var4, var5); + } + + public boolean blockActivated(World var1, int var2, int var3, int var4, EntityPlayer var5) { + int var6 = var1.getBlockMetadata(var2, var3, var4); + int var7 = var6 & 7; + int var8 = 8 - (var6 & 8); + if(var8 == 0) { + return true; + } else { + var1.setBlockMetadataWithNotify(var2, var3, var4, var7 + var8); + var1.markBlocksDirty(var2, var3, var4, var2, var3, var4); + var1.playSoundEffect((double)var2 + 0.5D, (double)var3 + 0.5D, (double)var4 + 0.5D, "random.click", 0.3F, 0.6F); + var1.notifyBlocksOfNeighborChange(var2, var3, var4, this.blockID); + if(var7 == 1) { + var1.notifyBlocksOfNeighborChange(var2 - 1, var3, var4, this.blockID); + } else if(var7 == 2) { + var1.notifyBlocksOfNeighborChange(var2 + 1, var3, var4, this.blockID); + } else if(var7 == 3) { + var1.notifyBlocksOfNeighborChange(var2, var3, var4 - 1, this.blockID); + } else if(var7 == 4) { + var1.notifyBlocksOfNeighborChange(var2, var3, var4 + 1, this.blockID); + } else { + var1.notifyBlocksOfNeighborChange(var2, var3 - 1, var4, this.blockID); + } + + var1.scheduleBlockUpdate(var2, var3, var4, this.blockID, this.tickRate()); + return true; + } + } + + public void onBlockRemoval(World var1, int var2, int var3, int var4) { + int var5 = var1.getBlockMetadata(var2, var3, var4); + if((var5 & 8) > 0) { + var1.notifyBlocksOfNeighborChange(var2, var3, var4, this.blockID); + int var6 = var5 & 7; + if(var6 == 1) { + var1.notifyBlocksOfNeighborChange(var2 - 1, var3, var4, this.blockID); + } else if(var6 == 2) { + var1.notifyBlocksOfNeighborChange(var2 + 1, var3, var4, this.blockID); + } else if(var6 == 3) { + var1.notifyBlocksOfNeighborChange(var2, var3, var4 - 1, this.blockID); + } else if(var6 == 4) { + var1.notifyBlocksOfNeighborChange(var2, var3, var4 + 1, this.blockID); + } else { + var1.notifyBlocksOfNeighborChange(var2, var3 - 1, var4, this.blockID); + } + } + + super.onBlockRemoval(var1, var2, var3, var4); + } + + public boolean isPoweringTo(IBlockAccess var1, int var2, int var3, int var4, int var5) { + return (var1.getBlockMetadata(var2, var3, var4) & 8) > 0; + } + + public boolean isIndirectlyPoweringTo(World var1, int var2, int var3, int var4, int var5) { + int var6 = var1.getBlockMetadata(var2, var3, var4); + if((var6 & 8) == 0) { + return false; + } else { + int var7 = var6 & 7; + return var7 == 5 && var5 == 1 ? true : (var7 == 4 && var5 == 2 ? true : (var7 == 3 && var5 == 3 ? true : (var7 == 2 && var5 == 4 ? true : var7 == 1 && var5 == 5))); + } + } + + public boolean canProvidePower() { + return true; + } + + public void updateTick(World var1, int var2, int var3, int var4, Random var5) { + if(!var1.multiplayerWorld) { + int var6 = var1.getBlockMetadata(var2, var3, var4); + if((var6 & 8) != 0) { + var1.setBlockMetadataWithNotify(var2, var3, var4, var6 & 7); + var1.notifyBlocksOfNeighborChange(var2, var3, var4, this.blockID); + int var7 = var6 & 7; + if(var7 == 1) { + var1.notifyBlocksOfNeighborChange(var2 - 1, var3, var4, this.blockID); + } else if(var7 == 2) { + var1.notifyBlocksOfNeighborChange(var2 + 1, var3, var4, this.blockID); + } else if(var7 == 3) { + var1.notifyBlocksOfNeighborChange(var2, var3, var4 - 1, this.blockID); + } else if(var7 == 4) { + var1.notifyBlocksOfNeighborChange(var2, var3, var4 + 1, this.blockID); + } else { + var1.notifyBlocksOfNeighborChange(var2, var3 - 1, var4, this.blockID); + } + + var1.playSoundEffect((double)var2 + 0.5D, (double)var3 + 0.5D, (double)var4 + 0.5D, "random.click", 0.3F, 0.5F); + var1.markBlocksDirty(var2, var3, var4, var2, var3, var4); + } + } + } + + public void setBlockBoundsForItemRender() { + float var1 = 3.0F / 16.0F; + float var2 = 2.0F / 16.0F; + float var3 = 2.0F / 16.0F; + this.setBlockBounds(0.5F - var1, 0.5F - var2, 0.5F - var3, 0.5F + var1, 0.5F + var2, 0.5F + var3); + } +} diff --git a/src/net/minecraft/src/BlockCactus.java b/src/net/minecraft/src/BlockCactus.java new file mode 100644 index 0000000..5dccb69 --- /dev/null +++ b/src/net/minecraft/src/BlockCactus.java @@ -0,0 +1,86 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockCactus extends Block { + protected BlockCactus(int var1, int var2) { + super(var1, var2, Material.cactus); + this.setTickOnLoad(true); + } + + public void updateTick(World var1, int var2, int var3, int var4, Random var5) { + if(var1.isAirBlock(var2, var3 + 1, var4)) { + int var6; + for(var6 = 1; var1.getBlockId(var2, var3 - var6, var4) == this.blockID; ++var6) { + } + + if(var6 < 3) { + int var7 = var1.getBlockMetadata(var2, var3, var4); + if(var7 == 15) { + var1.setBlockWithNotify(var2, var3 + 1, var4, this.blockID); + var1.setBlockMetadataWithNotify(var2, var3, var4, 0); + } else { + var1.setBlockMetadataWithNotify(var2, var3, var4, var7 + 1); + } + } + } + + } + + public AxisAlignedBB getCollisionBoundingBoxFromPool(World var1, int var2, int var3, int var4) { + float var5 = 1.0F / 16.0F; + return AxisAlignedBB.getBoundingBoxFromPool((double)((float)var2 + var5), (double)var3, (double)((float)var4 + var5), (double)((float)(var2 + 1) - var5), (double)((float)(var3 + 1) - var5), (double)((float)(var4 + 1) - var5)); + } + + public AxisAlignedBB getSelectedBoundingBoxFromPool(World var1, int var2, int var3, int var4) { + float var5 = 1.0F / 16.0F; + return AxisAlignedBB.getBoundingBoxFromPool((double)((float)var2 + var5), (double)var3, (double)((float)var4 + var5), (double)((float)(var2 + 1) - var5), (double)(var3 + 1), (double)((float)(var4 + 1) - var5)); + } + + public int getBlockTextureFromSide(int var1) { + return var1 == 1 ? this.blockIndexInTexture - 1 : (var1 == 0 ? this.blockIndexInTexture + 1 : this.blockIndexInTexture); + } + + public boolean renderAsNormalBlock() { + return false; + } + + public boolean isOpaqueCube() { + return false; + } + + public int getRenderType() { + return 13; + } + + public boolean canPlaceBlockAt(World var1, int var2, int var3, int var4) { + return !super.canPlaceBlockAt(var1, var2, var3, var4) ? false : this.canBlockStay(var1, var2, var3, var4); + } + + public void onNeighborBlockChange(World var1, int var2, int var3, int var4, int var5) { + if(!this.canBlockStay(var1, var2, var3, var4)) { + this.dropBlockAsItem(var1, var2, var3, var4, var1.getBlockMetadata(var2, var3, var4)); + var1.setBlockWithNotify(var2, var3, var4, 0); + } + + } + + public boolean canBlockStay(World var1, int var2, int var3, int var4) { + if(var1.getBlockMaterial(var2 - 1, var3, var4).isSolid()) { + return false; + } else if(var1.getBlockMaterial(var2 + 1, var3, var4).isSolid()) { + return false; + } else if(var1.getBlockMaterial(var2, var3, var4 - 1).isSolid()) { + return false; + } else if(var1.getBlockMaterial(var2, var3, var4 + 1).isSolid()) { + return false; + } else { + int var5 = var1.getBlockId(var2, var3 - 1, var4); + return var5 == Block.cactus.blockID || var5 == Block.sand.blockID; + } + } + + public void onEntityCollidedWithBlock(World var1, int var2, int var3, int var4, Entity var5) { + var5.attackEntityFrom((Entity)null, 1); + } +} diff --git a/src/net/minecraft/src/BlockCake.java b/src/net/minecraft/src/BlockCake.java new file mode 100644 index 0000000..f04945d --- /dev/null +++ b/src/net/minecraft/src/BlockCake.java @@ -0,0 +1,103 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockCake extends Block { + protected BlockCake(int var1, int var2) { + super(var1, var2, Material.cakeMaterial); + this.setTickOnLoad(true); + } + + public void setBlockBoundsBasedOnState(IBlockAccess var1, int var2, int var3, int var4) { + int var5 = var1.getBlockMetadata(var2, var3, var4); + float var6 = 1.0F / 16.0F; + float var7 = (float)(1 + var5 * 2) / 16.0F; + float var8 = 0.5F; + this.setBlockBounds(var7, 0.0F, var6, 1.0F - var6, var8, 1.0F - var6); + } + + public void setBlockBoundsForItemRender() { + float var1 = 1.0F / 16.0F; + float var2 = 0.5F; + this.setBlockBounds(var1, 0.0F, var1, 1.0F - var1, var2, 1.0F - var1); + } + + public AxisAlignedBB getCollisionBoundingBoxFromPool(World var1, int var2, int var3, int var4) { + int var5 = var1.getBlockMetadata(var2, var3, var4); + float var6 = 1.0F / 16.0F; + float var7 = (float)(1 + var5 * 2) / 16.0F; + float var8 = 0.5F; + return AxisAlignedBB.getBoundingBoxFromPool((double)((float)var2 + var7), (double)var3, (double)((float)var4 + var6), (double)((float)(var2 + 1) - var6), (double)((float)var3 + var8 - var6), (double)((float)(var4 + 1) - var6)); + } + + public AxisAlignedBB getSelectedBoundingBoxFromPool(World var1, int var2, int var3, int var4) { + int var5 = var1.getBlockMetadata(var2, var3, var4); + float var6 = 1.0F / 16.0F; + float var7 = (float)(1 + var5 * 2) / 16.0F; + float var8 = 0.5F; + return AxisAlignedBB.getBoundingBoxFromPool((double)((float)var2 + var7), (double)var3, (double)((float)var4 + var6), (double)((float)(var2 + 1) - var6), (double)((float)var3 + var8), (double)((float)(var4 + 1) - var6)); + } + + public int getBlockTextureFromSideAndMetadata(int var1, int var2) { + return var1 == 1 ? this.blockIndexInTexture : (var1 == 0 ? this.blockIndexInTexture + 3 : (var2 > 0 && var1 == 4 ? this.blockIndexInTexture + 2 : this.blockIndexInTexture + 1)); + } + + public int getBlockTextureFromSide(int var1) { + return var1 == 1 ? this.blockIndexInTexture : (var1 == 0 ? this.blockIndexInTexture + 3 : this.blockIndexInTexture + 1); + } + + public boolean renderAsNormalBlock() { + return false; + } + + public boolean isOpaqueCube() { + return false; + } + + public boolean blockActivated(World var1, int var2, int var3, int var4, EntityPlayer var5) { + this.eatCakeSlice(var1, var2, var3, var4, var5); + return true; + } + + public void onBlockClicked(World var1, int var2, int var3, int var4, EntityPlayer var5) { + this.eatCakeSlice(var1, var2, var3, var4, var5); + } + + private void eatCakeSlice(World var1, int var2, int var3, int var4, EntityPlayer var5) { + if(var5.health < 20) { + var5.heal(3); + int var6 = var1.getBlockMetadata(var2, var3, var4) + 1; + if(var6 >= 6) { + var1.setBlockWithNotify(var2, var3, var4, 0); + } else { + var1.setBlockMetadataWithNotify(var2, var3, var4, var6); + var1.markBlockAsNeedsUpdate(var2, var3, var4); + } + } + + } + + public boolean canPlaceBlockAt(World var1, int var2, int var3, int var4) { + return !super.canPlaceBlockAt(var1, var2, var3, var4) ? false : this.canBlockStay(var1, var2, var3, var4); + } + + public void onNeighborBlockChange(World var1, int var2, int var3, int var4, int var5) { + if(!this.canBlockStay(var1, var2, var3, var4)) { + this.dropBlockAsItem(var1, var2, var3, var4, var1.getBlockMetadata(var2, var3, var4)); + var1.setBlockWithNotify(var2, var3, var4, 0); + } + + } + + public boolean canBlockStay(World var1, int var2, int var3, int var4) { + return var1.getBlockMaterial(var2, var3 - 1, var4).isSolid(); + } + + public int quantityDropped(Random var1) { + return 0; + } + + public int idDropped(int var1, Random var2) { + return 0; + } +} diff --git a/src/net/minecraft/src/BlockChest.java b/src/net/minecraft/src/BlockChest.java new file mode 100644 index 0000000..85e1426 --- /dev/null +++ b/src/net/minecraft/src/BlockChest.java @@ -0,0 +1,200 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockChest extends BlockContainer { + private Random random = new Random(); + + protected BlockChest(int var1) { + super(var1, Material.wood); + this.blockIndexInTexture = 26; + } + + public int getBlockTexture(IBlockAccess var1, int var2, int var3, int var4, int var5) { + if(var5 == 1) { + return this.blockIndexInTexture - 1; + } else if(var5 == 0) { + return this.blockIndexInTexture - 1; + } else { + int var6 = var1.getBlockId(var2, var3, var4 - 1); + int var7 = var1.getBlockId(var2, var3, var4 + 1); + int var8 = var1.getBlockId(var2 - 1, var3, var4); + int var9 = var1.getBlockId(var2 + 1, var3, var4); + int var10; + int var11; + int var12; + byte var13; + if(var6 != this.blockID && var7 != this.blockID) { + if(var8 != this.blockID && var9 != this.blockID) { + byte var14 = 3; + if(Block.opaqueCubeLookup[var6] && !Block.opaqueCubeLookup[var7]) { + var14 = 3; + } + + if(Block.opaqueCubeLookup[var7] && !Block.opaqueCubeLookup[var6]) { + var14 = 2; + } + + if(Block.opaqueCubeLookup[var8] && !Block.opaqueCubeLookup[var9]) { + var14 = 5; + } + + if(Block.opaqueCubeLookup[var9] && !Block.opaqueCubeLookup[var8]) { + var14 = 4; + } + + return var5 == var14 ? this.blockIndexInTexture + 1 : this.blockIndexInTexture; + } else if(var5 != 4 && var5 != 5) { + var10 = 0; + if(var8 == this.blockID) { + var10 = -1; + } + + var11 = var1.getBlockId(var8 == this.blockID ? var2 - 1 : var2 + 1, var3, var4 - 1); + var12 = var1.getBlockId(var8 == this.blockID ? var2 - 1 : var2 + 1, var3, var4 + 1); + if(var5 == 3) { + var10 = -1 - var10; + } + + var13 = 3; + if((Block.opaqueCubeLookup[var6] || Block.opaqueCubeLookup[var11]) && !Block.opaqueCubeLookup[var7] && !Block.opaqueCubeLookup[var12]) { + var13 = 3; + } + + if((Block.opaqueCubeLookup[var7] || Block.opaqueCubeLookup[var12]) && !Block.opaqueCubeLookup[var6] && !Block.opaqueCubeLookup[var11]) { + var13 = 2; + } + + return (var5 == var13 ? this.blockIndexInTexture + 16 : this.blockIndexInTexture + 32) + var10; + } else { + return this.blockIndexInTexture; + } + } else if(var5 != 2 && var5 != 3) { + var10 = 0; + if(var6 == this.blockID) { + var10 = -1; + } + + var11 = var1.getBlockId(var2 - 1, var3, var6 == this.blockID ? var4 - 1 : var4 + 1); + var12 = var1.getBlockId(var2 + 1, var3, var6 == this.blockID ? var4 - 1 : var4 + 1); + if(var5 == 4) { + var10 = -1 - var10; + } + + var13 = 5; + if((Block.opaqueCubeLookup[var8] || Block.opaqueCubeLookup[var11]) && !Block.opaqueCubeLookup[var9] && !Block.opaqueCubeLookup[var12]) { + var13 = 5; + } + + if((Block.opaqueCubeLookup[var9] || Block.opaqueCubeLookup[var12]) && !Block.opaqueCubeLookup[var8] && !Block.opaqueCubeLookup[var11]) { + var13 = 4; + } + + return (var5 == var13 ? this.blockIndexInTexture + 16 : this.blockIndexInTexture + 32) + var10; + } else { + return this.blockIndexInTexture; + } + } + } + + public int getBlockTextureFromSide(int var1) { + return var1 == 1 ? this.blockIndexInTexture - 1 : (var1 == 0 ? this.blockIndexInTexture - 1 : (var1 == 3 ? this.blockIndexInTexture + 1 : this.blockIndexInTexture)); + } + + public boolean canPlaceBlockAt(World var1, int var2, int var3, int var4) { + int var5 = 0; + if(var1.getBlockId(var2 - 1, var3, var4) == this.blockID) { + ++var5; + } + + if(var1.getBlockId(var2 + 1, var3, var4) == this.blockID) { + ++var5; + } + + if(var1.getBlockId(var2, var3, var4 - 1) == this.blockID) { + ++var5; + } + + if(var1.getBlockId(var2, var3, var4 + 1) == this.blockID) { + ++var5; + } + + return var5 > 1 ? false : (this.isThereANeighborChest(var1, var2 - 1, var3, var4) ? false : (this.isThereANeighborChest(var1, var2 + 1, var3, var4) ? false : (this.isThereANeighborChest(var1, var2, var3, var4 - 1) ? false : !this.isThereANeighborChest(var1, var2, var3, var4 + 1)))); + } + + private boolean isThereANeighborChest(World var1, int var2, int var3, int var4) { + return var1.getBlockId(var2, var3, var4) != this.blockID ? false : (var1.getBlockId(var2 - 1, var3, var4) == this.blockID ? true : (var1.getBlockId(var2 + 1, var3, var4) == this.blockID ? true : (var1.getBlockId(var2, var3, var4 - 1) == this.blockID ? true : var1.getBlockId(var2, var3, var4 + 1) == this.blockID))); + } + + public void onBlockRemoval(World var1, int var2, int var3, int var4) { + TileEntityChest var5 = (TileEntityChest)var1.getBlockTileEntity(var2, var3, var4); + + for(int var6 = 0; var6 < var5.getSizeInventory(); ++var6) { + ItemStack var7 = var5.getStackInSlot(var6); + if(var7 != null) { + float var8 = this.random.nextFloat() * 0.8F + 0.1F; + float var9 = this.random.nextFloat() * 0.8F + 0.1F; + float var10 = this.random.nextFloat() * 0.8F + 0.1F; + + while(var7.stackSize > 0) { + int var11 = this.random.nextInt(21) + 10; + if(var11 > var7.stackSize) { + var11 = var7.stackSize; + } + + var7.stackSize -= var11; + EntityItem var12 = new EntityItem(var1, (double)((float)var2 + var8), (double)((float)var3 + var9), (double)((float)var4 + var10), new ItemStack(var7.itemID, var11, var7.getItemDamage())); + float var13 = 0.05F; + var12.motionX = (double)((float)this.random.nextGaussian() * var13); + var12.motionY = (double)((float)this.random.nextGaussian() * var13 + 0.2F); + var12.motionZ = (double)((float)this.random.nextGaussian() * var13); + var1.entityJoinedWorld(var12); + } + } + } + + super.onBlockRemoval(var1, var2, var3, var4); + } + + public boolean blockActivated(World var1, int var2, int var3, int var4, EntityPlayer var5) { + Object var6 = (TileEntityChest)var1.getBlockTileEntity(var2, var3, var4); + if(var1.isBlockNormalCube(var2, var3 + 1, var4)) { + return true; + } else if(var1.getBlockId(var2 - 1, var3, var4) == this.blockID && var1.isBlockNormalCube(var2 - 1, var3 + 1, var4)) { + return true; + } else if(var1.getBlockId(var2 + 1, var3, var4) == this.blockID && var1.isBlockNormalCube(var2 + 1, var3 + 1, var4)) { + return true; + } else if(var1.getBlockId(var2, var3, var4 - 1) == this.blockID && var1.isBlockNormalCube(var2, var3 + 1, var4 - 1)) { + return true; + } else if(var1.getBlockId(var2, var3, var4 + 1) == this.blockID && var1.isBlockNormalCube(var2, var3 + 1, var4 + 1)) { + return true; + } else { + if(var1.getBlockId(var2 - 1, var3, var4) == this.blockID) { + var6 = new InventoryLargeChest("Large chest", (TileEntityChest)var1.getBlockTileEntity(var2 - 1, var3, var4), (IInventory)var6); + } + + if(var1.getBlockId(var2 + 1, var3, var4) == this.blockID) { + var6 = new InventoryLargeChest("Large chest", (IInventory)var6, (TileEntityChest)var1.getBlockTileEntity(var2 + 1, var3, var4)); + } + + if(var1.getBlockId(var2, var3, var4 - 1) == this.blockID) { + var6 = new InventoryLargeChest("Large chest", (TileEntityChest)var1.getBlockTileEntity(var2, var3, var4 - 1), (IInventory)var6); + } + + if(var1.getBlockId(var2, var3, var4 + 1) == this.blockID) { + var6 = new InventoryLargeChest("Large chest", (IInventory)var6, (TileEntityChest)var1.getBlockTileEntity(var2, var3, var4 + 1)); + } + + if(var1.multiplayerWorld) { + return true; + } else { + var5.displayGUIChest((IInventory)var6); + return true; + } + } + } + + protected TileEntity getBlockEntity() { + return new TileEntityChest(); + } +} diff --git a/src/net/minecraft/src/BlockClay.java b/src/net/minecraft/src/BlockClay.java new file mode 100644 index 0000000..f936209 --- /dev/null +++ b/src/net/minecraft/src/BlockClay.java @@ -0,0 +1,17 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockClay extends Block { + public BlockClay(int var1, int var2) { + super(var1, var2, Material.clay); + } + + public int idDropped(int var1, Random var2) { + return Item.clay.shiftedIndex; + } + + public int quantityDropped(Random var1) { + return 4; + } +} diff --git a/src/net/minecraft/src/BlockCloth.java b/src/net/minecraft/src/BlockCloth.java new file mode 100644 index 0000000..c4aaee9 --- /dev/null +++ b/src/net/minecraft/src/BlockCloth.java @@ -0,0 +1,28 @@ +package net.minecraft.src; + +public class BlockCloth extends Block { + public BlockCloth() { + super(35, 64, Material.cloth); + } + + public int getBlockTextureFromSideAndMetadata(int var1, int var2) { + if(var2 == 0) { + return this.blockIndexInTexture; + } else { + var2 = ~(var2 & 15); + return 113 + ((var2 & 8) >> 3) + (var2 & 7) * 16; + } + } + + protected int damageDropped(int var1) { + return var1; + } + + public static int func_21034_c(int var0) { + return ~var0 & 15; + } + + public static int func_21035_d(int var0) { + return ~var0 & 15; + } +} diff --git a/src/net/minecraft/src/BlockContainer.java b/src/net/minecraft/src/BlockContainer.java new file mode 100644 index 0000000..02d9afc --- /dev/null +++ b/src/net/minecraft/src/BlockContainer.java @@ -0,0 +1,25 @@ +package net.minecraft.src; + +public abstract class BlockContainer extends Block { + protected BlockContainer(int var1, Material var2) { + super(var1, var2); + isBlockContainer[var1] = true; + } + + protected BlockContainer(int var1, int var2, Material var3) { + super(var1, var2, var3); + isBlockContainer[var1] = true; + } + + public void onBlockAdded(World var1, int var2, int var3, int var4) { + super.onBlockAdded(var1, var2, var3, var4); + var1.setBlockTileEntity(var2, var3, var4, this.getBlockEntity()); + } + + public void onBlockRemoval(World var1, int var2, int var3, int var4) { + super.onBlockRemoval(var1, var2, var3, var4); + var1.removeBlockTileEntity(var2, var3, var4); + } + + protected abstract TileEntity getBlockEntity(); +} diff --git a/src/net/minecraft/src/BlockCrops.java b/src/net/minecraft/src/BlockCrops.java new file mode 100644 index 0000000..5b0b150 --- /dev/null +++ b/src/net/minecraft/src/BlockCrops.java @@ -0,0 +1,114 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockCrops extends BlockFlower { + protected BlockCrops(int var1, int var2) { + super(var1, var2); + this.blockIndexInTexture = var2; + this.setTickOnLoad(true); + float var3 = 0.5F; + this.setBlockBounds(0.5F - var3, 0.0F, 0.5F - var3, 0.5F + var3, 0.25F, 0.5F + var3); + } + + protected boolean canThisPlantGrowOnThisBlockID(int var1) { + return var1 == Block.tilledField.blockID; + } + + public void updateTick(World var1, int var2, int var3, int var4, Random var5) { + super.updateTick(var1, var2, var3, var4, var5); + if(var1.getBlockLightValue(var2, var3 + 1, var4) >= 9) { + int var6 = var1.getBlockMetadata(var2, var3, var4); + if(var6 < 7) { + float var7 = this.getGrowthRate(var1, var2, var3, var4); + if(var5.nextInt((int)(100.0F / var7)) == 0) { + ++var6; + var1.setBlockMetadataWithNotify(var2, var3, var4, var6); + } + } + } + + } + + public void fertilize(World var1, int var2, int var3, int var4) { + var1.setBlockMetadataWithNotify(var2, var3, var4, 7); + } + + private float getGrowthRate(World var1, int var2, int var3, int var4) { + float var5 = 1.0F; + int var6 = var1.getBlockId(var2, var3, var4 - 1); + int var7 = var1.getBlockId(var2, var3, var4 + 1); + int var8 = var1.getBlockId(var2 - 1, var3, var4); + int var9 = var1.getBlockId(var2 + 1, var3, var4); + int var10 = var1.getBlockId(var2 - 1, var3, var4 - 1); + int var11 = var1.getBlockId(var2 + 1, var3, var4 - 1); + int var12 = var1.getBlockId(var2 + 1, var3, var4 + 1); + int var13 = var1.getBlockId(var2 - 1, var3, var4 + 1); + boolean var14 = var8 == this.blockID || var9 == this.blockID; + boolean var15 = var6 == this.blockID || var7 == this.blockID; + boolean var16 = var10 == this.blockID || var11 == this.blockID || var12 == this.blockID || var13 == this.blockID; + + for(int var17 = var2 - 1; var17 <= var2 + 1; ++var17) { + for(int var18 = var4 - 1; var18 <= var4 + 1; ++var18) { + int var19 = var1.getBlockId(var17, var3 - 1, var18); + float var20 = 0.0F; + if(var19 == Block.tilledField.blockID) { + var20 = 1.0F; + if(var1.getBlockMetadata(var17, var3 - 1, var18) > 0) { + var20 = 3.0F; + } + } + + if(var17 != var2 || var18 != var4) { + var20 /= 4.0F; + } + + var5 += var20; + } + } + + if(var16 || var14 && var15) { + var5 /= 2.0F; + } + + return var5; + } + + public int getBlockTextureFromSideAndMetadata(int var1, int var2) { + if(var2 < 0) { + var2 = 7; + } + + return this.blockIndexInTexture + var2; + } + + public int getRenderType() { + return 6; + } + + public void dropBlockAsItemWithChance(World var1, int var2, int var3, int var4, int var5, float var6) { + super.dropBlockAsItemWithChance(var1, var2, var3, var4, var5, var6); + if(!var1.multiplayerWorld) { + for(int var7 = 0; var7 < 3; ++var7) { + if(var1.rand.nextInt(15) <= var5) { + float var8 = 0.7F; + float var9 = var1.rand.nextFloat() * var8 + (1.0F - var8) * 0.5F; + float var10 = var1.rand.nextFloat() * var8 + (1.0F - var8) * 0.5F; + float var11 = var1.rand.nextFloat() * var8 + (1.0F - var8) * 0.5F; + EntityItem var12 = new EntityItem(var1, (double)((float)var2 + var9), (double)((float)var3 + var10), (double)((float)var4 + var11), new ItemStack(Item.seeds)); + var12.delayBeforeCanPickup = 10; + var1.entityJoinedWorld(var12); + } + } + + } + } + + public int idDropped(int var1, Random var2) { + return var1 == 7 ? Item.wheat.shiftedIndex : -1; + } + + public int quantityDropped(Random var1) { + return 1; + } +} diff --git a/src/net/minecraft/src/BlockDeadBush.java b/src/net/minecraft/src/BlockDeadBush.java new file mode 100644 index 0000000..ecc45fd --- /dev/null +++ b/src/net/minecraft/src/BlockDeadBush.java @@ -0,0 +1,23 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockDeadBush extends BlockFlower { + protected BlockDeadBush(int var1, int var2) { + super(var1, var2); + float var3 = 0.4F; + this.setBlockBounds(0.5F - var3, 0.0F, 0.5F - var3, 0.5F + var3, 0.8F, 0.5F + var3); + } + + protected boolean canThisPlantGrowOnThisBlockID(int var1) { + return var1 == Block.sand.blockID; + } + + public int getBlockTextureFromSideAndMetadata(int var1, int var2) { + return this.blockIndexInTexture; + } + + public int idDropped(int var1, Random var2) { + return -1; + } +} diff --git a/src/net/minecraft/src/BlockDetectorRail.java b/src/net/minecraft/src/BlockDetectorRail.java new file mode 100644 index 0000000..0cba249 --- /dev/null +++ b/src/net/minecraft/src/BlockDetectorRail.java @@ -0,0 +1,74 @@ +package net.minecraft.src; + +import java.util.List; +import java.util.Random; + +public class BlockDetectorRail extends BlockRail { + public BlockDetectorRail(int var1, int var2) { + super(var1, var2, true); + this.setTickOnLoad(true); + } + + public int tickRate() { + return 20; + } + + public boolean canProvidePower() { + return true; + } + + public void onEntityCollidedWithBlock(World var1, int var2, int var3, int var4, Entity var5) { + if(!var1.multiplayerWorld) { + int var6 = var1.getBlockMetadata(var2, var3, var4); + if((var6 & 8) == 0) { + this.setStateIfMinecartInteractsWithRail(var1, var2, var3, var4, var6); + } + } + } + + public void updateTick(World var1, int var2, int var3, int var4, Random var5) { + if(!var1.multiplayerWorld) { + int var6 = var1.getBlockMetadata(var2, var3, var4); + if((var6 & 8) != 0) { + this.setStateIfMinecartInteractsWithRail(var1, var2, var3, var4, var6); + } + } + } + + public boolean isPoweringTo(IBlockAccess var1, int var2, int var3, int var4, int var5) { + return (var1.getBlockMetadata(var2, var3, var4) & 8) != 0; + } + + public boolean isIndirectlyPoweringTo(World var1, int var2, int var3, int var4, int var5) { + return (var1.getBlockMetadata(var2, var3, var4) & 8) == 0 ? false : var5 == 1; + } + + private void setStateIfMinecartInteractsWithRail(World var1, int var2, int var3, int var4, int var5) { + boolean var6 = (var5 & 8) != 0; + boolean var7 = false; + float var8 = 2.0F / 16.0F; + List var9 = var1.getEntitiesWithinAABB(EntityMinecart.class, AxisAlignedBB.getBoundingBoxFromPool((double)((float)var2 + var8), (double)var3, (double)((float)var4 + var8), (double)((float)(var2 + 1) - var8), (double)var3 + 0.25D, (double)((float)(var4 + 1) - var8))); + if(var9.size() > 0) { + var7 = true; + } + + if(var7 && !var6) { + var1.setBlockMetadataWithNotify(var2, var3, var4, var5 | 8); + var1.notifyBlocksOfNeighborChange(var2, var3, var4, this.blockID); + var1.notifyBlocksOfNeighborChange(var2, var3 - 1, var4, this.blockID); + var1.markBlocksDirty(var2, var3, var4, var2, var3, var4); + } + + if(!var7 && var6) { + var1.setBlockMetadataWithNotify(var2, var3, var4, var5 & 7); + var1.notifyBlocksOfNeighborChange(var2, var3, var4, this.blockID); + var1.notifyBlocksOfNeighborChange(var2, var3 - 1, var4, this.blockID); + var1.markBlocksDirty(var2, var3, var4, var2, var3, var4); + } + + if(var7) { + var1.scheduleBlockUpdate(var2, var3, var4, this.blockID, this.tickRate()); + } + + } +} diff --git a/src/net/minecraft/src/BlockDirt.java b/src/net/minecraft/src/BlockDirt.java new file mode 100644 index 0000000..4deab61 --- /dev/null +++ b/src/net/minecraft/src/BlockDirt.java @@ -0,0 +1,7 @@ +package net.minecraft.src; + +public class BlockDirt extends Block { + protected BlockDirt(int var1, int var2) { + super(var1, var2, Material.ground); + } +} diff --git a/src/net/minecraft/src/BlockDispenser.java b/src/net/minecraft/src/BlockDispenser.java new file mode 100644 index 0000000..1ebec38 --- /dev/null +++ b/src/net/minecraft/src/BlockDispenser.java @@ -0,0 +1,204 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockDispenser extends BlockContainer { + private Random random = new Random(); + + protected BlockDispenser(int var1) { + super(var1, Material.rock); + this.blockIndexInTexture = 45; + } + + public int tickRate() { + return 4; + } + + public int idDropped(int var1, Random var2) { + return Block.dispenser.blockID; + } + + public void onBlockAdded(World var1, int var2, int var3, int var4) { + super.onBlockAdded(var1, var2, var3, var4); + this.setDispenserDefaultDirection(var1, var2, var3, var4); + } + + private void setDispenserDefaultDirection(World var1, int var2, int var3, int var4) { + if(!var1.multiplayerWorld) { + int var5 = var1.getBlockId(var2, var3, var4 - 1); + int var6 = var1.getBlockId(var2, var3, var4 + 1); + int var7 = var1.getBlockId(var2 - 1, var3, var4); + int var8 = var1.getBlockId(var2 + 1, var3, var4); + byte var9 = 3; + if(Block.opaqueCubeLookup[var5] && !Block.opaqueCubeLookup[var6]) { + var9 = 3; + } + + if(Block.opaqueCubeLookup[var6] && !Block.opaqueCubeLookup[var5]) { + var9 = 2; + } + + if(Block.opaqueCubeLookup[var7] && !Block.opaqueCubeLookup[var8]) { + var9 = 5; + } + + if(Block.opaqueCubeLookup[var8] && !Block.opaqueCubeLookup[var7]) { + var9 = 4; + } + + var1.setBlockMetadataWithNotify(var2, var3, var4, var9); + } + } + + public int getBlockTexture(IBlockAccess var1, int var2, int var3, int var4, int var5) { + if(var5 == 1) { + return this.blockIndexInTexture + 17; + } else if(var5 == 0) { + return this.blockIndexInTexture + 17; + } else { + int var6 = var1.getBlockMetadata(var2, var3, var4); + return var5 != var6 ? this.blockIndexInTexture : this.blockIndexInTexture + 1; + } + } + + public int getBlockTextureFromSide(int var1) { + return var1 == 1 ? this.blockIndexInTexture + 17 : (var1 == 0 ? this.blockIndexInTexture + 17 : (var1 == 3 ? this.blockIndexInTexture + 1 : this.blockIndexInTexture)); + } + + public boolean blockActivated(World var1, int var2, int var3, int var4, EntityPlayer var5) { + if(var1.multiplayerWorld) { + return true; + } else { + TileEntityDispenser var6 = (TileEntityDispenser)var1.getBlockTileEntity(var2, var3, var4); + var5.displayGUIDispenser(var6); + return true; + } + } + + private void dispenseItem(World var1, int var2, int var3, int var4, Random var5) { + int var6 = var1.getBlockMetadata(var2, var3, var4); + byte var9 = 0; + byte var10 = 0; + if(var6 == 3) { + var10 = 1; + } else if(var6 == 2) { + var10 = -1; + } else if(var6 == 5) { + var9 = 1; + } else { + var9 = -1; + } + + TileEntityDispenser var11 = (TileEntityDispenser)var1.getBlockTileEntity(var2, var3, var4); + ItemStack var12 = var11.getRandomStackFromInventory(); + double var13 = (double)var2 + (double)var9 * 0.6D + 0.5D; + double var15 = (double)var3 + 0.5D; + double var17 = (double)var4 + (double)var10 * 0.6D + 0.5D; + if(var12 == null) { + var1.func_28106_e(1001, var2, var3, var4, 0); + } else { + if(var12.itemID == Item.arrow.shiftedIndex) { + EntityArrow var19 = new EntityArrow(var1, var13, var15, var17); + var19.setArrowHeading((double)var9, (double)0.1F, (double)var10, 1.1F, 6.0F); + var19.doesArrowBelongToPlayer = true; + var1.entityJoinedWorld(var19); + var1.func_28106_e(1002, var2, var3, var4, 0); + } else if(var12.itemID == Item.egg.shiftedIndex) { + EntityEgg var22 = new EntityEgg(var1, var13, var15, var17); + var22.setEggHeading((double)var9, (double)0.1F, (double)var10, 1.1F, 6.0F); + var1.entityJoinedWorld(var22); + var1.func_28106_e(1002, var2, var3, var4, 0); + } else if(var12.itemID == Item.snowball.shiftedIndex) { + EntitySnowball var23 = new EntitySnowball(var1, var13, var15, var17); + var23.setSnowballHeading((double)var9, (double)0.1F, (double)var10, 1.1F, 6.0F); + var1.entityJoinedWorld(var23); + var1.func_28106_e(1002, var2, var3, var4, 0); + } else { + EntityItem var24 = new EntityItem(var1, var13, var15 - 0.3D, var17, var12); + double var20 = var5.nextDouble() * 0.1D + 0.2D; + var24.motionX = (double)var9 * var20; + var24.motionY = (double)0.2F; + var24.motionZ = (double)var10 * var20; + var24.motionX += var5.nextGaussian() * (double)0.0075F * 6.0D; + var24.motionY += var5.nextGaussian() * (double)0.0075F * 6.0D; + var24.motionZ += var5.nextGaussian() * (double)0.0075F * 6.0D; + var1.entityJoinedWorld(var24); + var1.func_28106_e(1000, var2, var3, var4, 0); + } + + var1.func_28106_e(2000, var2, var3, var4, var9 + 1 + (var10 + 1) * 3); + } + + } + + public void onNeighborBlockChange(World var1, int var2, int var3, int var4, int var5) { + if(var5 > 0 && Block.blocksList[var5].canProvidePower()) { + boolean var6 = var1.isBlockIndirectlyGettingPowered(var2, var3, var4) || var1.isBlockIndirectlyGettingPowered(var2, var3 + 1, var4); + if(var6) { + var1.scheduleBlockUpdate(var2, var3, var4, this.blockID, this.tickRate()); + } + } + + } + + public void updateTick(World var1, int var2, int var3, int var4, Random var5) { + if(var1.isBlockIndirectlyGettingPowered(var2, var3, var4) || var1.isBlockIndirectlyGettingPowered(var2, var3 + 1, var4)) { + this.dispenseItem(var1, var2, var3, var4, var5); + } + + } + + protected TileEntity getBlockEntity() { + return new TileEntityDispenser(); + } + + public void onBlockPlacedBy(World var1, int var2, int var3, int var4, EntityLiving var5) { + int var6 = MathHelper.floor_double((double)(var5.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; + if(var6 == 0) { + var1.setBlockMetadataWithNotify(var2, var3, var4, 2); + } + + if(var6 == 1) { + var1.setBlockMetadataWithNotify(var2, var3, var4, 5); + } + + if(var6 == 2) { + var1.setBlockMetadataWithNotify(var2, var3, var4, 3); + } + + if(var6 == 3) { + var1.setBlockMetadataWithNotify(var2, var3, var4, 4); + } + + } + + public void onBlockRemoval(World var1, int var2, int var3, int var4) { + TileEntityDispenser var5 = (TileEntityDispenser)var1.getBlockTileEntity(var2, var3, var4); + + for(int var6 = 0; var6 < var5.getSizeInventory(); ++var6) { + ItemStack var7 = var5.getStackInSlot(var6); + if(var7 != null) { + float var8 = this.random.nextFloat() * 0.8F + 0.1F; + float var9 = this.random.nextFloat() * 0.8F + 0.1F; + float var10 = this.random.nextFloat() * 0.8F + 0.1F; + + while(var7.stackSize > 0) { + int var11 = this.random.nextInt(21) + 10; + if(var11 > var7.stackSize) { + var11 = var7.stackSize; + } + + var7.stackSize -= var11; + EntityItem var12 = new EntityItem(var1, (double)((float)var2 + var8), (double)((float)var3 + var9), (double)((float)var4 + var10), new ItemStack(var7.itemID, var11, var7.getItemDamage())); + float var13 = 0.05F; + var12.motionX = (double)((float)this.random.nextGaussian() * var13); + var12.motionY = (double)((float)this.random.nextGaussian() * var13 + 0.2F); + var12.motionZ = (double)((float)this.random.nextGaussian() * var13); + var1.entityJoinedWorld(var12); + } + } + } + + super.onBlockRemoval(var1, var2, var3, var4); + } +} diff --git a/src/net/minecraft/src/BlockDoor.java b/src/net/minecraft/src/BlockDoor.java new file mode 100644 index 0000000..bec8cf5 --- /dev/null +++ b/src/net/minecraft/src/BlockDoor.java @@ -0,0 +1,195 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockDoor extends Block { + protected BlockDoor(int var1, Material var2) { + super(var1, var2); + this.blockIndexInTexture = 97; + if(var2 == Material.iron) { + ++this.blockIndexInTexture; + } + + float var3 = 0.5F; + float var4 = 1.0F; + this.setBlockBounds(0.5F - var3, 0.0F, 0.5F - var3, 0.5F + var3, var4, 0.5F + var3); + } + + public int getBlockTextureFromSideAndMetadata(int var1, int var2) { + if(var1 != 0 && var1 != 1) { + int var3 = this.getState(var2); + if((var3 == 0 || var3 == 2) ^ var1 <= 3) { + return this.blockIndexInTexture; + } else { + int var4 = var3 / 2 + (var1 & 1 ^ var3); + var4 += (var2 & 4) / 4; + int var5 = this.blockIndexInTexture - (var2 & 8) * 2; + if((var4 & 1) != 0) { + var5 = -var5; + } + + return var5; + } + } else { + return this.blockIndexInTexture; + } + } + + public boolean isOpaqueCube() { + return false; + } + + public boolean renderAsNormalBlock() { + return false; + } + + public int getRenderType() { + return 7; + } + + public AxisAlignedBB getSelectedBoundingBoxFromPool(World var1, int var2, int var3, int var4) { + this.setBlockBoundsBasedOnState(var1, var2, var3, var4); + return super.getSelectedBoundingBoxFromPool(var1, var2, var3, var4); + } + + public AxisAlignedBB getCollisionBoundingBoxFromPool(World var1, int var2, int var3, int var4) { + this.setBlockBoundsBasedOnState(var1, var2, var3, var4); + return super.getCollisionBoundingBoxFromPool(var1, var2, var3, var4); + } + + public void setBlockBoundsBasedOnState(IBlockAccess var1, int var2, int var3, int var4) { + this.setDoorRotation(this.getState(var1.getBlockMetadata(var2, var3, var4))); + } + + public void setDoorRotation(int var1) { + float var2 = 3.0F / 16.0F; + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 2.0F, 1.0F); + if(var1 == 0) { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, var2); + } + + if(var1 == 1) { + this.setBlockBounds(1.0F - var2, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + } + + if(var1 == 2) { + this.setBlockBounds(0.0F, 0.0F, 1.0F - var2, 1.0F, 1.0F, 1.0F); + } + + if(var1 == 3) { + this.setBlockBounds(0.0F, 0.0F, 0.0F, var2, 1.0F, 1.0F); + } + + } + + public void onBlockClicked(World var1, int var2, int var3, int var4, EntityPlayer var5) { + this.blockActivated(var1, var2, var3, var4, var5); + } + + public boolean blockActivated(World var1, int var2, int var3, int var4, EntityPlayer var5) { + if(this.blockMaterial == Material.iron) { + return true; + } else { + int var6 = var1.getBlockMetadata(var2, var3, var4); + if((var6 & 8) != 0) { + if(var1.getBlockId(var2, var3 - 1, var4) == this.blockID) { + this.blockActivated(var1, var2, var3 - 1, var4, var5); + } + + return true; + } else { + if(var1.getBlockId(var2, var3 + 1, var4) == this.blockID) { + var1.setBlockMetadataWithNotify(var2, var3 + 1, var4, (var6 ^ 4) + 8); + } + + var1.setBlockMetadataWithNotify(var2, var3, var4, var6 ^ 4); + var1.markBlocksDirty(var2, var3 - 1, var4, var2, var3, var4); + var1.func_28107_a(var5, 1003, var2, var3, var4, 0); + return true; + } + } + } + + public void onPoweredBlockChange(World var1, int var2, int var3, int var4, boolean var5) { + int var6 = var1.getBlockMetadata(var2, var3, var4); + if((var6 & 8) != 0) { + if(var1.getBlockId(var2, var3 - 1, var4) == this.blockID) { + this.onPoweredBlockChange(var1, var2, var3 - 1, var4, var5); + } + + } else { + boolean var7 = (var1.getBlockMetadata(var2, var3, var4) & 4) > 0; + if(var7 != var5) { + if(var1.getBlockId(var2, var3 + 1, var4) == this.blockID) { + var1.setBlockMetadataWithNotify(var2, var3 + 1, var4, (var6 ^ 4) + 8); + } + + var1.setBlockMetadataWithNotify(var2, var3, var4, var6 ^ 4); + var1.markBlocksDirty(var2, var3 - 1, var4, var2, var3, var4); + var1.func_28107_a((EntityPlayer)null, 1003, var2, var3, var4, 0); + } + } + } + + public void onNeighborBlockChange(World var1, int var2, int var3, int var4, int var5) { + int var6 = var1.getBlockMetadata(var2, var3, var4); + if((var6 & 8) != 0) { + if(var1.getBlockId(var2, var3 - 1, var4) != this.blockID) { + var1.setBlockWithNotify(var2, var3, var4, 0); + } + + if(var5 > 0 && Block.blocksList[var5].canProvidePower()) { + this.onNeighborBlockChange(var1, var2, var3 - 1, var4, var5); + } + } else { + boolean var7 = false; + if(var1.getBlockId(var2, var3 + 1, var4) != this.blockID) { + var1.setBlockWithNotify(var2, var3, var4, 0); + var7 = true; + } + + if(!var1.isBlockNormalCube(var2, var3 - 1, var4)) { + var1.setBlockWithNotify(var2, var3, var4, 0); + var7 = true; + if(var1.getBlockId(var2, var3 + 1, var4) == this.blockID) { + var1.setBlockWithNotify(var2, var3 + 1, var4, 0); + } + } + + if(var7) { + if(!var1.multiplayerWorld) { + this.dropBlockAsItem(var1, var2, var3, var4, var6); + } + } else if(var5 > 0 && Block.blocksList[var5].canProvidePower()) { + boolean var8 = var1.isBlockIndirectlyGettingPowered(var2, var3, var4) || var1.isBlockIndirectlyGettingPowered(var2, var3 + 1, var4); + this.onPoweredBlockChange(var1, var2, var3, var4, var8); + } + } + + } + + public int idDropped(int var1, Random var2) { + return (var1 & 8) != 0 ? 0 : (this.blockMaterial == Material.iron ? Item.doorSteel.shiftedIndex : Item.doorWood.shiftedIndex); + } + + public MovingObjectPosition collisionRayTrace(World var1, int var2, int var3, int var4, Vec3D var5, Vec3D var6) { + this.setBlockBoundsBasedOnState(var1, var2, var3, var4); + return super.collisionRayTrace(var1, var2, var3, var4, var5, var6); + } + + public int getState(int var1) { + return (var1 & 4) == 0 ? var1 - 1 & 3 : var1 & 3; + } + + public boolean canPlaceBlockAt(World var1, int var2, int var3, int var4) { + return var3 >= 127 ? false : var1.isBlockNormalCube(var2, var3 - 1, var4) && super.canPlaceBlockAt(var1, var2, var3, var4) && super.canPlaceBlockAt(var1, var2, var3 + 1, var4); + } + + public static boolean isOpen(int var0) { + return (var0 & 4) != 0; + } + + public int getMobilityFlag() { + return 1; + } +} diff --git a/src/net/minecraft/src/BlockFarmland.java b/src/net/minecraft/src/BlockFarmland.java new file mode 100644 index 0000000..a722ca8 --- /dev/null +++ b/src/net/minecraft/src/BlockFarmland.java @@ -0,0 +1,93 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockFarmland extends Block { + protected BlockFarmland(int var1) { + super(var1, Material.ground); + this.blockIndexInTexture = 87; + this.setTickOnLoad(true); + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 15.0F / 16.0F, 1.0F); + this.setLightOpacity(255); + } + + public AxisAlignedBB getCollisionBoundingBoxFromPool(World var1, int var2, int var3, int var4) { + return AxisAlignedBB.getBoundingBoxFromPool((double)(var2 + 0), (double)(var3 + 0), (double)(var4 + 0), (double)(var2 + 1), (double)(var3 + 1), (double)(var4 + 1)); + } + + public boolean isOpaqueCube() { + return false; + } + + public boolean renderAsNormalBlock() { + return false; + } + + public int getBlockTextureFromSideAndMetadata(int var1, int var2) { + return var1 == 1 && var2 > 0 ? this.blockIndexInTexture - 1 : (var1 == 1 ? this.blockIndexInTexture : 2); + } + + public void updateTick(World var1, int var2, int var3, int var4, Random var5) { + if(var5.nextInt(5) == 0) { + if(!this.isWaterNearby(var1, var2, var3, var4) && !var1.canBlockBeRainedOn(var2, var3 + 1, var4)) { + int var6 = var1.getBlockMetadata(var2, var3, var4); + if(var6 > 0) { + var1.setBlockMetadataWithNotify(var2, var3, var4, var6 - 1); + } else if(!this.isCropsNearby(var1, var2, var3, var4)) { + var1.setBlockWithNotify(var2, var3, var4, Block.dirt.blockID); + } + } else { + var1.setBlockMetadataWithNotify(var2, var3, var4, 7); + } + } + + } + + public void onEntityWalking(World var1, int var2, int var3, int var4, Entity var5) { + if(var1.rand.nextInt(4) == 0) { + var1.setBlockWithNotify(var2, var3, var4, Block.dirt.blockID); + } + + } + + private boolean isCropsNearby(World var1, int var2, int var3, int var4) { + byte var5 = 0; + + for(int var6 = var2 - var5; var6 <= var2 + var5; ++var6) { + for(int var7 = var4 - var5; var7 <= var4 + var5; ++var7) { + if(var1.getBlockId(var6, var3 + 1, var7) == Block.crops.blockID) { + return true; + } + } + } + + return false; + } + + private boolean isWaterNearby(World var1, int var2, int var3, int var4) { + for(int var5 = var2 - 4; var5 <= var2 + 4; ++var5) { + for(int var6 = var3; var6 <= var3 + 1; ++var6) { + for(int var7 = var4 - 4; var7 <= var4 + 4; ++var7) { + if(var1.getBlockMaterial(var5, var6, var7) == Material.water) { + return true; + } + } + } + } + + return false; + } + + public void onNeighborBlockChange(World var1, int var2, int var3, int var4, int var5) { + super.onNeighborBlockChange(var1, var2, var3, var4, var5); + Material var6 = var1.getBlockMaterial(var2, var3 + 1, var4); + if(var6.isSolid()) { + var1.setBlockWithNotify(var2, var3, var4, Block.dirt.blockID); + } + + } + + public int idDropped(int var1, Random var2) { + return Block.dirt.idDropped(0, var2); + } +} diff --git a/src/net/minecraft/src/BlockFence.java b/src/net/minecraft/src/BlockFence.java new file mode 100644 index 0000000..fcb0cf7 --- /dev/null +++ b/src/net/minecraft/src/BlockFence.java @@ -0,0 +1,27 @@ +package net.minecraft.src; + +public class BlockFence extends Block { + public BlockFence(int var1, int var2) { + super(var1, var2, Material.wood); + } + + public boolean canPlaceBlockAt(World var1, int var2, int var3, int var4) { + return var1.getBlockId(var2, var3 - 1, var4) == this.blockID ? true : (!var1.getBlockMaterial(var2, var3 - 1, var4).isSolid() ? false : super.canPlaceBlockAt(var1, var2, var3, var4)); + } + + public AxisAlignedBB getCollisionBoundingBoxFromPool(World var1, int var2, int var3, int var4) { + return AxisAlignedBB.getBoundingBoxFromPool((double)var2, (double)var3, (double)var4, (double)(var2 + 1), (double)((float)var3 + 1.5F), (double)(var4 + 1)); + } + + public boolean isOpaqueCube() { + return false; + } + + public boolean renderAsNormalBlock() { + return false; + } + + public int getRenderType() { + return 11; + } +} diff --git a/src/net/minecraft/src/BlockFire.java b/src/net/minecraft/src/BlockFire.java new file mode 100644 index 0000000..74963ef --- /dev/null +++ b/src/net/minecraft/src/BlockFire.java @@ -0,0 +1,253 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockFire extends Block { + private int[] chanceToEncourageFire = new int[256]; + private int[] abilityToCatchFire = new int[256]; + + protected BlockFire(int var1, int var2) { + super(var1, var2, Material.fire); + this.setTickOnLoad(true); + } + + public void initializeBlock() { + this.setBurnRate(Block.planks.blockID, 5, 20); + this.setBurnRate(Block.fence.blockID, 5, 20); + this.setBurnRate(Block.stairCompactPlanks.blockID, 5, 20); + this.setBurnRate(Block.wood.blockID, 5, 5); + this.setBurnRate(Block.leaves.blockID, 30, 60); + this.setBurnRate(Block.bookShelf.blockID, 30, 20); + this.setBurnRate(Block.tnt.blockID, 15, 100); + this.setBurnRate(Block.tallGrass.blockID, 60, 100); + this.setBurnRate(Block.cloth.blockID, 30, 60); + } + + private void setBurnRate(int var1, int var2, int var3) { + this.chanceToEncourageFire[var1] = var2; + this.abilityToCatchFire[var1] = var3; + } + + public AxisAlignedBB getCollisionBoundingBoxFromPool(World var1, int var2, int var3, int var4) { + return null; + } + + public boolean isOpaqueCube() { + return false; + } + + public boolean renderAsNormalBlock() { + return false; + } + + public int getRenderType() { + return 3; + } + + public int quantityDropped(Random var1) { + return 0; + } + + public int tickRate() { + return 40; + } + + public void updateTick(World var1, int var2, int var3, int var4, Random var5) { + boolean var6 = var1.getBlockId(var2, var3 - 1, var4) == Block.netherrack.blockID; + if(!this.canPlaceBlockAt(var1, var2, var3, var4)) { + var1.setBlockWithNotify(var2, var3, var4, 0); + } + + if(var6 || !var1.func_27161_C() || !var1.canBlockBeRainedOn(var2, var3, var4) && !var1.canBlockBeRainedOn(var2 - 1, var3, var4) && !var1.canBlockBeRainedOn(var2 + 1, var3, var4) && !var1.canBlockBeRainedOn(var2, var3, var4 - 1) && !var1.canBlockBeRainedOn(var2, var3, var4 + 1)) { + int var7 = var1.getBlockMetadata(var2, var3, var4); + if(var7 < 15) { + var1.setBlockMetadata(var2, var3, var4, var7 + var5.nextInt(3) / 2); + } + + var1.scheduleBlockUpdate(var2, var3, var4, this.blockID, this.tickRate()); + if(!var6 && !this.func_263_h(var1, var2, var3, var4)) { + if(!var1.isBlockNormalCube(var2, var3 - 1, var4) || var7 > 3) { + var1.setBlockWithNotify(var2, var3, var4, 0); + } + + } else if(!var6 && !this.canBlockCatchFire(var1, var2, var3 - 1, var4) && var7 == 15 && var5.nextInt(4) == 0) { + var1.setBlockWithNotify(var2, var3, var4, 0); + } else { + this.tryToCatchBlockOnFire(var1, var2 + 1, var3, var4, 300, var5, var7); + this.tryToCatchBlockOnFire(var1, var2 - 1, var3, var4, 300, var5, var7); + this.tryToCatchBlockOnFire(var1, var2, var3 - 1, var4, 250, var5, var7); + this.tryToCatchBlockOnFire(var1, var2, var3 + 1, var4, 250, var5, var7); + this.tryToCatchBlockOnFire(var1, var2, var3, var4 - 1, 300, var5, var7); + this.tryToCatchBlockOnFire(var1, var2, var3, var4 + 1, 300, var5, var7); + + for(int var8 = var2 - 1; var8 <= var2 + 1; ++var8) { + for(int var9 = var4 - 1; var9 <= var4 + 1; ++var9) { + for(int var10 = var3 - 1; var10 <= var3 + 4; ++var10) { + if(var8 != var2 || var10 != var3 || var9 != var4) { + int var11 = 100; + if(var10 > var3 + 1) { + var11 += (var10 - (var3 + 1)) * 100; + } + + int var12 = this.getChanceOfNeighborsEncouragingFire(var1, var8, var10, var9); + if(var12 > 0) { + int var13 = (var12 + 40) / (var7 + 30); + if(var13 > 0 && var5.nextInt(var11) <= var13 && (!var1.func_27161_C() || !var1.canBlockBeRainedOn(var8, var10, var9)) && !var1.canBlockBeRainedOn(var8 - 1, var10, var4) && !var1.canBlockBeRainedOn(var8 + 1, var10, var9) && !var1.canBlockBeRainedOn(var8, var10, var9 - 1) && !var1.canBlockBeRainedOn(var8, var10, var9 + 1)) { + int var14 = var7 + var5.nextInt(5) / 4; + if(var14 > 15) { + var14 = 15; + } + + var1.setBlockAndMetadataWithNotify(var8, var10, var9, this.blockID, var14); + } + } + } + } + } + } + + } + } else { + var1.setBlockWithNotify(var2, var3, var4, 0); + } + } + + private void tryToCatchBlockOnFire(World var1, int var2, int var3, int var4, int var5, Random var6, int var7) { + int var8 = this.abilityToCatchFire[var1.getBlockId(var2, var3, var4)]; + if(var6.nextInt(var5) < var8) { + boolean var9 = var1.getBlockId(var2, var3, var4) == Block.tnt.blockID; + if(var6.nextInt(var7 + 10) < 5 && !var1.canBlockBeRainedOn(var2, var3, var4)) { + int var10 = var7 + var6.nextInt(5) / 4; + if(var10 > 15) { + var10 = 15; + } + + var1.setBlockAndMetadataWithNotify(var2, var3, var4, this.blockID, var10); + } else { + var1.setBlockWithNotify(var2, var3, var4, 0); + } + + if(var9) { + Block.tnt.onBlockDestroyedByPlayer(var1, var2, var3, var4, 1); + } + } + + } + + private boolean func_263_h(World var1, int var2, int var3, int var4) { + return this.canBlockCatchFire(var1, var2 + 1, var3, var4) ? true : (this.canBlockCatchFire(var1, var2 - 1, var3, var4) ? true : (this.canBlockCatchFire(var1, var2, var3 - 1, var4) ? true : (this.canBlockCatchFire(var1, var2, var3 + 1, var4) ? true : (this.canBlockCatchFire(var1, var2, var3, var4 - 1) ? true : this.canBlockCatchFire(var1, var2, var3, var4 + 1))))); + } + + private int getChanceOfNeighborsEncouragingFire(World var1, int var2, int var3, int var4) { + byte var5 = 0; + if(!var1.isAirBlock(var2, var3, var4)) { + return 0; + } else { + int var6 = this.getChanceToEncourageFire(var1, var2 + 1, var3, var4, var5); + var6 = this.getChanceToEncourageFire(var1, var2 - 1, var3, var4, var6); + var6 = this.getChanceToEncourageFire(var1, var2, var3 - 1, var4, var6); + var6 = this.getChanceToEncourageFire(var1, var2, var3 + 1, var4, var6); + var6 = this.getChanceToEncourageFire(var1, var2, var3, var4 - 1, var6); + var6 = this.getChanceToEncourageFire(var1, var2, var3, var4 + 1, var6); + return var6; + } + } + + public boolean isCollidable() { + return false; + } + + public boolean canBlockCatchFire(IBlockAccess var1, int var2, int var3, int var4) { + return this.chanceToEncourageFire[var1.getBlockId(var2, var3, var4)] > 0; + } + + public int getChanceToEncourageFire(World var1, int var2, int var3, int var4, int var5) { + int var6 = this.chanceToEncourageFire[var1.getBlockId(var2, var3, var4)]; + return var6 > var5 ? var6 : var5; + } + + public boolean canPlaceBlockAt(World var1, int var2, int var3, int var4) { + return var1.isBlockNormalCube(var2, var3 - 1, var4) || this.func_263_h(var1, var2, var3, var4); + } + + public void onNeighborBlockChange(World var1, int var2, int var3, int var4, int var5) { + if(!var1.isBlockNormalCube(var2, var3 - 1, var4) && !this.func_263_h(var1, var2, var3, var4)) { + var1.setBlockWithNotify(var2, var3, var4, 0); + } + } + + public void onBlockAdded(World var1, int var2, int var3, int var4) { + if(var1.getBlockId(var2, var3 - 1, var4) != Block.obsidian.blockID || !Block.portal.tryToCreatePortal(var1, var2, var3, var4)) { + if(!var1.isBlockNormalCube(var2, var3 - 1, var4) && !this.func_263_h(var1, var2, var3, var4)) { + var1.setBlockWithNotify(var2, var3, var4, 0); + } else { + var1.scheduleBlockUpdate(var2, var3, var4, this.blockID, this.tickRate()); + } + } + } + + public void randomDisplayTick(World var1, int var2, int var3, int var4, Random var5) { + if(var5.nextInt(24) == 0) { + var1.playSoundEffect((double)((float)var2 + 0.5F), (double)((float)var3 + 0.5F), (double)((float)var4 + 0.5F), "fire.fire", 1.0F + var5.nextFloat(), var5.nextFloat() * 0.7F + 0.3F); + } + + int var6; + float var7; + float var8; + float var9; + if(!var1.isBlockNormalCube(var2, var3 - 1, var4) && !Block.fire.canBlockCatchFire(var1, var2, var3 - 1, var4)) { + if(Block.fire.canBlockCatchFire(var1, var2 - 1, var3, var4)) { + for(var6 = 0; var6 < 2; ++var6) { + var7 = (float)var2 + var5.nextFloat() * 0.1F; + var8 = (float)var3 + var5.nextFloat(); + var9 = (float)var4 + var5.nextFloat(); + var1.spawnParticle("largesmoke", (double)var7, (double)var8, (double)var9, 0.0D, 0.0D, 0.0D); + } + } + + if(Block.fire.canBlockCatchFire(var1, var2 + 1, var3, var4)) { + for(var6 = 0; var6 < 2; ++var6) { + var7 = (float)(var2 + 1) - var5.nextFloat() * 0.1F; + var8 = (float)var3 + var5.nextFloat(); + var9 = (float)var4 + var5.nextFloat(); + var1.spawnParticle("largesmoke", (double)var7, (double)var8, (double)var9, 0.0D, 0.0D, 0.0D); + } + } + + if(Block.fire.canBlockCatchFire(var1, var2, var3, var4 - 1)) { + for(var6 = 0; var6 < 2; ++var6) { + var7 = (float)var2 + var5.nextFloat(); + var8 = (float)var3 + var5.nextFloat(); + var9 = (float)var4 + var5.nextFloat() * 0.1F; + var1.spawnParticle("largesmoke", (double)var7, (double)var8, (double)var9, 0.0D, 0.0D, 0.0D); + } + } + + if(Block.fire.canBlockCatchFire(var1, var2, var3, var4 + 1)) { + for(var6 = 0; var6 < 2; ++var6) { + var7 = (float)var2 + var5.nextFloat(); + var8 = (float)var3 + var5.nextFloat(); + var9 = (float)(var4 + 1) - var5.nextFloat() * 0.1F; + var1.spawnParticle("largesmoke", (double)var7, (double)var8, (double)var9, 0.0D, 0.0D, 0.0D); + } + } + + if(Block.fire.canBlockCatchFire(var1, var2, var3 + 1, var4)) { + for(var6 = 0; var6 < 2; ++var6) { + var7 = (float)var2 + var5.nextFloat(); + var8 = (float)(var3 + 1) - var5.nextFloat() * 0.1F; + var9 = (float)var4 + var5.nextFloat(); + var1.spawnParticle("largesmoke", (double)var7, (double)var8, (double)var9, 0.0D, 0.0D, 0.0D); + } + } + } else { + for(var6 = 0; var6 < 3; ++var6) { + var7 = (float)var2 + var5.nextFloat(); + var8 = (float)var3 + var5.nextFloat() * 0.5F + 0.5F; + var9 = (float)var4 + var5.nextFloat(); + var1.spawnParticle("largesmoke", (double)var7, (double)var8, (double)var9, 0.0D, 0.0D, 0.0D); + } + } + + } +} diff --git a/src/net/minecraft/src/BlockFlower.java b/src/net/minecraft/src/BlockFlower.java new file mode 100644 index 0000000..f590c67 --- /dev/null +++ b/src/net/minecraft/src/BlockFlower.java @@ -0,0 +1,58 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockFlower extends Block { + protected BlockFlower(int var1, int var2) { + super(var1, Material.plants); + this.blockIndexInTexture = var2; + this.setTickOnLoad(true); + float var3 = 0.2F; + this.setBlockBounds(0.5F - var3, 0.0F, 0.5F - var3, 0.5F + var3, var3 * 3.0F, 0.5F + var3); + } + + public boolean canPlaceBlockAt(World var1, int var2, int var3, int var4) { + return super.canPlaceBlockAt(var1, var2, var3, var4) && this.canThisPlantGrowOnThisBlockID(var1.getBlockId(var2, var3 - 1, var4)); + } + + protected boolean canThisPlantGrowOnThisBlockID(int var1) { + return var1 == Block.grass.blockID || var1 == Block.dirt.blockID || var1 == Block.tilledField.blockID; + } + + public void onNeighborBlockChange(World var1, int var2, int var3, int var4, int var5) { + super.onNeighborBlockChange(var1, var2, var3, var4, var5); + this.func_268_h(var1, var2, var3, var4); + } + + public void updateTick(World var1, int var2, int var3, int var4, Random var5) { + this.func_268_h(var1, var2, var3, var4); + } + + protected final void func_268_h(World var1, int var2, int var3, int var4) { + if(!this.canBlockStay(var1, var2, var3, var4)) { + this.dropBlockAsItem(var1, var2, var3, var4, var1.getBlockMetadata(var2, var3, var4)); + var1.setBlockWithNotify(var2, var3, var4, 0); + } + + } + + public boolean canBlockStay(World var1, int var2, int var3, int var4) { + return (var1.getFullBlockLightValue(var2, var3, var4) >= 8 || var1.canBlockSeeTheSky(var2, var3, var4)) && this.canThisPlantGrowOnThisBlockID(var1.getBlockId(var2, var3 - 1, var4)); + } + + public AxisAlignedBB getCollisionBoundingBoxFromPool(World var1, int var2, int var3, int var4) { + return null; + } + + public boolean isOpaqueCube() { + return false; + } + + public boolean renderAsNormalBlock() { + return false; + } + + public int getRenderType() { + return 1; + } +} diff --git a/src/net/minecraft/src/BlockFlowing.java b/src/net/minecraft/src/BlockFlowing.java new file mode 100644 index 0000000..c008957 --- /dev/null +++ b/src/net/minecraft/src/BlockFlowing.java @@ -0,0 +1,263 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockFlowing extends BlockFluid { + int numAdjacentSources = 0; + boolean[] isOptimalFlowDirection = new boolean[4]; + int[] flowCost = new int[4]; + + protected BlockFlowing(int var1, Material var2) { + super(var1, var2); + } + + private void func_30003_j(World var1, int var2, int var3, int var4) { + int var5 = var1.getBlockMetadata(var2, var3, var4); + var1.setBlockAndMetadata(var2, var3, var4, this.blockID + 1, var5); + var1.markBlocksDirty(var2, var3, var4, var2, var3, var4); + var1.markBlockNeedsUpdate(var2, var3, var4); + } + + public void updateTick(World var1, int var2, int var3, int var4, Random var5) { + int var6 = this.getFlowDecay(var1, var2, var3, var4); + byte var7 = 1; + if(this.blockMaterial == Material.lava && !var1.worldProvider.isHellWorld) { + var7 = 2; + } + + boolean var8 = true; + int var10; + if(var6 > 0) { + byte var9 = -100; + this.numAdjacentSources = 0; + int var12 = this.getSmallestFlowDecay(var1, var2 - 1, var3, var4, var9); + var12 = this.getSmallestFlowDecay(var1, var2 + 1, var3, var4, var12); + var12 = this.getSmallestFlowDecay(var1, var2, var3, var4 - 1, var12); + var12 = this.getSmallestFlowDecay(var1, var2, var3, var4 + 1, var12); + var10 = var12 + var7; + if(var10 >= 8 || var12 < 0) { + var10 = -1; + } + + if(this.getFlowDecay(var1, var2, var3 + 1, var4) >= 0) { + int var11 = this.getFlowDecay(var1, var2, var3 + 1, var4); + if(var11 >= 8) { + var10 = var11; + } else { + var10 = var11 + 8; + } + } + + if(this.numAdjacentSources >= 2 && this.blockMaterial == Material.water) { + if(var1.getBlockMaterial(var2, var3 - 1, var4).isSolid()) { + var10 = 0; + } else if(var1.getBlockMaterial(var2, var3 - 1, var4) == this.blockMaterial && var1.getBlockMetadata(var2, var3, var4) == 0) { + var10 = 0; + } + } + + if(this.blockMaterial == Material.lava && var6 < 8 && var10 < 8 && var10 > var6 && var5.nextInt(4) != 0) { + var10 = var6; + var8 = false; + } + + if(var10 != var6) { + var6 = var10; + if(var10 < 0) { + var1.setBlockWithNotify(var2, var3, var4, 0); + } else { + var1.setBlockMetadataWithNotify(var2, var3, var4, var10); + var1.scheduleBlockUpdate(var2, var3, var4, this.blockID, this.tickRate()); + var1.notifyBlocksOfNeighborChange(var2, var3, var4, this.blockID); + } + } else if(var8) { + this.func_30003_j(var1, var2, var3, var4); + } + } else { + this.func_30003_j(var1, var2, var3, var4); + } + + if(this.liquidCanDisplaceBlock(var1, var2, var3 - 1, var4)) { + if(var6 >= 8) { + var1.setBlockAndMetadataWithNotify(var2, var3 - 1, var4, this.blockID, var6); + } else { + var1.setBlockAndMetadataWithNotify(var2, var3 - 1, var4, this.blockID, var6 + 8); + } + } else if(var6 >= 0 && (var6 == 0 || this.blockBlocksFlow(var1, var2, var3 - 1, var4))) { + boolean[] var13 = this.getOptimalFlowDirections(var1, var2, var3, var4); + var10 = var6 + var7; + if(var6 >= 8) { + var10 = 1; + } + + if(var10 >= 8) { + return; + } + + if(var13[0]) { + this.flowIntoBlock(var1, var2 - 1, var3, var4, var10); + } + + if(var13[1]) { + this.flowIntoBlock(var1, var2 + 1, var3, var4, var10); + } + + if(var13[2]) { + this.flowIntoBlock(var1, var2, var3, var4 - 1, var10); + } + + if(var13[3]) { + this.flowIntoBlock(var1, var2, var3, var4 + 1, var10); + } + } + + } + + private void flowIntoBlock(World var1, int var2, int var3, int var4, int var5) { + if(this.liquidCanDisplaceBlock(var1, var2, var3, var4)) { + int var6 = var1.getBlockId(var2, var3, var4); + if(var6 > 0) { + if(this.blockMaterial == Material.lava) { + this.triggerLavaMixEffects(var1, var2, var3, var4); + } else { + Block.blocksList[var6].dropBlockAsItem(var1, var2, var3, var4, var1.getBlockMetadata(var2, var3, var4)); + } + } + + var1.setBlockAndMetadataWithNotify(var2, var3, var4, this.blockID, var5); + } + + } + + private int calculateFlowCost(World var1, int var2, int var3, int var4, int var5, int var6) { + int var7 = 1000; + + for(int var8 = 0; var8 < 4; ++var8) { + if((var8 != 0 || var6 != 1) && (var8 != 1 || var6 != 0) && (var8 != 2 || var6 != 3) && (var8 != 3 || var6 != 2)) { + int var9 = var2; + int var11 = var4; + if(var8 == 0) { + var9 = var2 - 1; + } + + if(var8 == 1) { + ++var9; + } + + if(var8 == 2) { + var11 = var4 - 1; + } + + if(var8 == 3) { + ++var11; + } + + if(!this.blockBlocksFlow(var1, var9, var3, var11) && (var1.getBlockMaterial(var9, var3, var11) != this.blockMaterial || var1.getBlockMetadata(var9, var3, var11) != 0)) { + if(!this.blockBlocksFlow(var1, var9, var3 - 1, var11)) { + return var5; + } + + if(var5 < 4) { + int var12 = this.calculateFlowCost(var1, var9, var3, var11, var5 + 1, var8); + if(var12 < var7) { + var7 = var12; + } + } + } + } + } + + return var7; + } + + private boolean[] getOptimalFlowDirections(World var1, int var2, int var3, int var4) { + int var5; + int var6; + for(var5 = 0; var5 < 4; ++var5) { + this.flowCost[var5] = 1000; + var6 = var2; + int var8 = var4; + if(var5 == 0) { + var6 = var2 - 1; + } + + if(var5 == 1) { + ++var6; + } + + if(var5 == 2) { + var8 = var4 - 1; + } + + if(var5 == 3) { + ++var8; + } + + if(!this.blockBlocksFlow(var1, var6, var3, var8) && (var1.getBlockMaterial(var6, var3, var8) != this.blockMaterial || var1.getBlockMetadata(var6, var3, var8) != 0)) { + if(!this.blockBlocksFlow(var1, var6, var3 - 1, var8)) { + this.flowCost[var5] = 0; + } else { + this.flowCost[var5] = this.calculateFlowCost(var1, var6, var3, var8, 1, var5); + } + } + } + + var5 = this.flowCost[0]; + + for(var6 = 1; var6 < 4; ++var6) { + if(this.flowCost[var6] < var5) { + var5 = this.flowCost[var6]; + } + } + + for(var6 = 0; var6 < 4; ++var6) { + this.isOptimalFlowDirection[var6] = this.flowCost[var6] == var5; + } + + return this.isOptimalFlowDirection; + } + + private boolean blockBlocksFlow(World var1, int var2, int var3, int var4) { + int var5 = var1.getBlockId(var2, var3, var4); + if(var5 != Block.doorWood.blockID && var5 != Block.doorSteel.blockID && var5 != Block.signPost.blockID && var5 != Block.ladder.blockID && var5 != Block.reed.blockID) { + if(var5 == 0) { + return false; + } else { + Material var6 = Block.blocksList[var5].blockMaterial; + return var6.getIsSolid(); + } + } else { + return true; + } + } + + protected int getSmallestFlowDecay(World var1, int var2, int var3, int var4, int var5) { + int var6 = this.getFlowDecay(var1, var2, var3, var4); + if(var6 < 0) { + return var5; + } else { + if(var6 == 0) { + ++this.numAdjacentSources; + } + + if(var6 >= 8) { + var6 = 0; + } + + return var5 >= 0 && var6 >= var5 ? var5 : var6; + } + } + + private boolean liquidCanDisplaceBlock(World var1, int var2, int var3, int var4) { + Material var5 = var1.getBlockMaterial(var2, var3, var4); + return var5 == this.blockMaterial ? false : (var5 == Material.lava ? false : !this.blockBlocksFlow(var1, var2, var3, var4)); + } + + public void onBlockAdded(World var1, int var2, int var3, int var4) { + super.onBlockAdded(var1, var2, var3, var4); + if(var1.getBlockId(var2, var3, var4) == this.blockID) { + var1.scheduleBlockUpdate(var2, var3, var4, this.blockID, this.tickRate()); + } + + } +} diff --git a/src/net/minecraft/src/BlockFluid.java b/src/net/minecraft/src/BlockFluid.java new file mode 100644 index 0000000..87a8112 --- /dev/null +++ b/src/net/minecraft/src/BlockFluid.java @@ -0,0 +1,278 @@ +package net.minecraft.src; + +import java.util.Random; + +public abstract class BlockFluid extends Block { + protected BlockFluid(int var1, Material var2) { + super(var1, (var2 == Material.lava ? 14 : 12) * 16 + 13, var2); + float var3 = 0.0F; + float var4 = 0.0F; + this.setBlockBounds(0.0F + var4, 0.0F + var3, 0.0F + var4, 1.0F + var4, 1.0F + var3, 1.0F + var4); + this.setTickOnLoad(true); + } + + public int colorMultiplier(IBlockAccess var1, int var2, int var3, int var4) { + return 16777215; + } + + public static float getPercentAir(int var0) { + if(var0 >= 8) { + var0 = 0; + } + + float var1 = (float)(var0 + 1) / 9.0F; + return var1; + } + + public int getBlockTextureFromSide(int var1) { + return var1 != 0 && var1 != 1 ? this.blockIndexInTexture + 1 : this.blockIndexInTexture; + } + + protected int getFlowDecay(World var1, int var2, int var3, int var4) { + return var1.getBlockMaterial(var2, var3, var4) != this.blockMaterial ? -1 : var1.getBlockMetadata(var2, var3, var4); + } + + protected int getEffectiveFlowDecay(IBlockAccess var1, int var2, int var3, int var4) { + if(var1.getBlockMaterial(var2, var3, var4) != this.blockMaterial) { + return -1; + } else { + int var5 = var1.getBlockMetadata(var2, var3, var4); + if(var5 >= 8) { + var5 = 0; + } + + return var5; + } + } + + public boolean renderAsNormalBlock() { + return false; + } + + public boolean isOpaqueCube() { + return false; + } + + public boolean canCollideCheck(int var1, boolean var2) { + return var2 && var1 == 0; + } + + public boolean getIsBlockSolid(IBlockAccess var1, int var2, int var3, int var4, int var5) { + Material var6 = var1.getBlockMaterial(var2, var3, var4); + return var6 == this.blockMaterial ? false : (var6 == Material.ice ? false : (var5 == 1 ? true : super.getIsBlockSolid(var1, var2, var3, var4, var5))); + } + + public boolean shouldSideBeRendered(IBlockAccess var1, int var2, int var3, int var4, int var5) { + Material var6 = var1.getBlockMaterial(var2, var3, var4); + return var6 == this.blockMaterial ? false : (var6 == Material.ice ? false : (var5 == 1 ? true : super.shouldSideBeRendered(var1, var2, var3, var4, var5))); + } + + public AxisAlignedBB getCollisionBoundingBoxFromPool(World var1, int var2, int var3, int var4) { + return null; + } + + public int getRenderType() { + return 4; + } + + public int idDropped(int var1, Random var2) { + return 0; + } + + public int quantityDropped(Random var1) { + return 0; + } + + private Vec3D getFlowVector(IBlockAccess var1, int var2, int var3, int var4) { + Vec3D var5 = Vec3D.createVector(0.0D, 0.0D, 0.0D); + int var6 = this.getEffectiveFlowDecay(var1, var2, var3, var4); + + for(int var7 = 0; var7 < 4; ++var7) { + int var8 = var2; + int var10 = var4; + if(var7 == 0) { + var8 = var2 - 1; + } + + if(var7 == 1) { + var10 = var4 - 1; + } + + if(var7 == 2) { + ++var8; + } + + if(var7 == 3) { + ++var10; + } + + int var11 = this.getEffectiveFlowDecay(var1, var8, var3, var10); + int var12; + if(var11 < 0) { + if(!var1.getBlockMaterial(var8, var3, var10).getIsSolid()) { + var11 = this.getEffectiveFlowDecay(var1, var8, var3 - 1, var10); + if(var11 >= 0) { + var12 = var11 - (var6 - 8); + var5 = var5.addVector((double)((var8 - var2) * var12), (double)((var3 - var3) * var12), (double)((var10 - var4) * var12)); + } + } + } else if(var11 >= 0) { + var12 = var11 - var6; + var5 = var5.addVector((double)((var8 - var2) * var12), (double)((var3 - var3) * var12), (double)((var10 - var4) * var12)); + } + } + + if(var1.getBlockMetadata(var2, var3, var4) >= 8) { + boolean var13 = false; + if(var13 || this.getIsBlockSolid(var1, var2, var3, var4 - 1, 2)) { + var13 = true; + } + + if(var13 || this.getIsBlockSolid(var1, var2, var3, var4 + 1, 3)) { + var13 = true; + } + + if(var13 || this.getIsBlockSolid(var1, var2 - 1, var3, var4, 4)) { + var13 = true; + } + + if(var13 || this.getIsBlockSolid(var1, var2 + 1, var3, var4, 5)) { + var13 = true; + } + + if(var13 || this.getIsBlockSolid(var1, var2, var3 + 1, var4 - 1, 2)) { + var13 = true; + } + + if(var13 || this.getIsBlockSolid(var1, var2, var3 + 1, var4 + 1, 3)) { + var13 = true; + } + + if(var13 || this.getIsBlockSolid(var1, var2 - 1, var3 + 1, var4, 4)) { + var13 = true; + } + + if(var13 || this.getIsBlockSolid(var1, var2 + 1, var3 + 1, var4, 5)) { + var13 = true; + } + + if(var13) { + var5 = var5.normalize().addVector(0.0D, -6.0D, 0.0D); + } + } + + var5 = var5.normalize(); + return var5; + } + + public void velocityToAddToEntity(World var1, int var2, int var3, int var4, Entity var5, Vec3D var6) { + Vec3D var7 = this.getFlowVector(var1, var2, var3, var4); + var6.xCoord += var7.xCoord; + var6.yCoord += var7.yCoord; + var6.zCoord += var7.zCoord; + } + + public int tickRate() { + return this.blockMaterial == Material.water ? 5 : (this.blockMaterial == Material.lava ? 30 : 0); + } + + public float getBlockBrightness(IBlockAccess var1, int var2, int var3, int var4) { + float var5 = var1.getLightBrightness(var2, var3, var4); + float var6 = var1.getLightBrightness(var2, var3 + 1, var4); + return var5 > var6 ? var5 : var6; + } + + public void updateTick(World var1, int var2, int var3, int var4, Random var5) { + super.updateTick(var1, var2, var3, var4, var5); + } + + public int getRenderBlockPass() { + return this.blockMaterial == Material.water ? 1 : 0; + } + + public void randomDisplayTick(World var1, int var2, int var3, int var4, Random var5) { + if(this.blockMaterial == Material.water && var5.nextInt(64) == 0) { + int var6 = var1.getBlockMetadata(var2, var3, var4); + if(var6 > 0 && var6 < 8) { + var1.playSoundEffect((double)((float)var2 + 0.5F), (double)((float)var3 + 0.5F), (double)((float)var4 + 0.5F), "liquid.water", var5.nextFloat() * 0.25F + 12.0F / 16.0F, var5.nextFloat() * 1.0F + 0.5F); + } + } + + if(this.blockMaterial == Material.lava && var1.getBlockMaterial(var2, var3 + 1, var4) == Material.air && !var1.isBlockOpaqueCube(var2, var3 + 1, var4) && var5.nextInt(100) == 0) { + double var12 = (double)((float)var2 + var5.nextFloat()); + double var8 = (double)var3 + this.maxY; + double var10 = (double)((float)var4 + var5.nextFloat()); + var1.spawnParticle("lava", var12, var8, var10, 0.0D, 0.0D, 0.0D); + } + + } + + public static double func_293_a(IBlockAccess var0, int var1, int var2, int var3, Material var4) { + Vec3D var5 = null; + if(var4 == Material.water) { + var5 = ((BlockFluid)Block.waterMoving).getFlowVector(var0, var1, var2, var3); + } + + if(var4 == Material.lava) { + var5 = ((BlockFluid)Block.lavaMoving).getFlowVector(var0, var1, var2, var3); + } + + return var5.xCoord == 0.0D && var5.zCoord == 0.0D ? -1000.0D : Math.atan2(var5.zCoord, var5.xCoord) - Math.PI * 0.5D; + } + + public void onBlockAdded(World var1, int var2, int var3, int var4) { + this.checkForHarden(var1, var2, var3, var4); + } + + public void onNeighborBlockChange(World var1, int var2, int var3, int var4, int var5) { + this.checkForHarden(var1, var2, var3, var4); + } + + private void checkForHarden(World var1, int var2, int var3, int var4) { + if(var1.getBlockId(var2, var3, var4) == this.blockID) { + if(this.blockMaterial == Material.lava) { + boolean var5 = false; + if(var5 || var1.getBlockMaterial(var2, var3, var4 - 1) == Material.water) { + var5 = true; + } + + if(var5 || var1.getBlockMaterial(var2, var3, var4 + 1) == Material.water) { + var5 = true; + } + + if(var5 || var1.getBlockMaterial(var2 - 1, var3, var4) == Material.water) { + var5 = true; + } + + if(var5 || var1.getBlockMaterial(var2 + 1, var3, var4) == Material.water) { + var5 = true; + } + + if(var5 || var1.getBlockMaterial(var2, var3 + 1, var4) == Material.water) { + var5 = true; + } + + if(var5) { + int var6 = var1.getBlockMetadata(var2, var3, var4); + if(var6 == 0) { + var1.setBlockWithNotify(var2, var3, var4, Block.obsidian.blockID); + } else if(var6 <= 4) { + var1.setBlockWithNotify(var2, var3, var4, Block.cobblestone.blockID); + } + + this.triggerLavaMixEffects(var1, var2, var3, var4); + } + } + + } + } + + protected void triggerLavaMixEffects(World var1, int var2, int var3, int var4) { + var1.playSoundEffect((double)((float)var2 + 0.5F), (double)((float)var3 + 0.5F), (double)((float)var4 + 0.5F), "random.fizz", 0.5F, 2.6F + (var1.rand.nextFloat() - var1.rand.nextFloat()) * 0.8F); + + for(int var5 = 0; var5 < 8; ++var5) { + var1.spawnParticle("largesmoke", (double)var2 + Math.random(), (double)var3 + 1.2D, (double)var4 + Math.random(), 0.0D, 0.0D, 0.0D); + } + + } +} diff --git a/src/net/minecraft/src/BlockFurnace.java b/src/net/minecraft/src/BlockFurnace.java new file mode 100644 index 0000000..107fb42 --- /dev/null +++ b/src/net/minecraft/src/BlockFurnace.java @@ -0,0 +1,173 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockFurnace extends BlockContainer { + private Random furnaceRand = new Random(); + private final boolean isActive; + private static boolean keepFurnaceInventory = false; + + protected BlockFurnace(int var1, boolean var2) { + super(var1, Material.rock); + this.isActive = var2; + this.blockIndexInTexture = 45; + } + + public int idDropped(int var1, Random var2) { + return Block.stoneOvenIdle.blockID; + } + + public void onBlockAdded(World var1, int var2, int var3, int var4) { + super.onBlockAdded(var1, var2, var3, var4); + this.setDefaultDirection(var1, var2, var3, var4); + } + + private void setDefaultDirection(World var1, int var2, int var3, int var4) { + if(!var1.multiplayerWorld) { + int var5 = var1.getBlockId(var2, var3, var4 - 1); + int var6 = var1.getBlockId(var2, var3, var4 + 1); + int var7 = var1.getBlockId(var2 - 1, var3, var4); + int var8 = var1.getBlockId(var2 + 1, var3, var4); + byte var9 = 3; + if(Block.opaqueCubeLookup[var5] && !Block.opaqueCubeLookup[var6]) { + var9 = 3; + } + + if(Block.opaqueCubeLookup[var6] && !Block.opaqueCubeLookup[var5]) { + var9 = 2; + } + + if(Block.opaqueCubeLookup[var7] && !Block.opaqueCubeLookup[var8]) { + var9 = 5; + } + + if(Block.opaqueCubeLookup[var8] && !Block.opaqueCubeLookup[var7]) { + var9 = 4; + } + + var1.setBlockMetadataWithNotify(var2, var3, var4, var9); + } + } + + public int getBlockTexture(IBlockAccess var1, int var2, int var3, int var4, int var5) { + if(var5 == 1) { + return this.blockIndexInTexture + 17; + } else if(var5 == 0) { + return this.blockIndexInTexture + 17; + } else { + int var6 = var1.getBlockMetadata(var2, var3, var4); + return var5 != var6 ? this.blockIndexInTexture : (this.isActive ? this.blockIndexInTexture + 16 : this.blockIndexInTexture - 1); + } + } + + public void randomDisplayTick(World var1, int var2, int var3, int var4, Random var5) { + if(this.isActive) { + int var6 = var1.getBlockMetadata(var2, var3, var4); + float var7 = (float)var2 + 0.5F; + float var8 = (float)var3 + 0.0F + var5.nextFloat() * 6.0F / 16.0F; + float var9 = (float)var4 + 0.5F; + float var10 = 0.52F; + float var11 = var5.nextFloat() * 0.6F - 0.3F; + if(var6 == 4) { + var1.spawnParticle("smoke", (double)(var7 - var10), (double)var8, (double)(var9 + var11), 0.0D, 0.0D, 0.0D); + var1.spawnParticle("flame", (double)(var7 - var10), (double)var8, (double)(var9 + var11), 0.0D, 0.0D, 0.0D); + } else if(var6 == 5) { + var1.spawnParticle("smoke", (double)(var7 + var10), (double)var8, (double)(var9 + var11), 0.0D, 0.0D, 0.0D); + var1.spawnParticle("flame", (double)(var7 + var10), (double)var8, (double)(var9 + var11), 0.0D, 0.0D, 0.0D); + } else if(var6 == 2) { + var1.spawnParticle("smoke", (double)(var7 + var11), (double)var8, (double)(var9 - var10), 0.0D, 0.0D, 0.0D); + var1.spawnParticle("flame", (double)(var7 + var11), (double)var8, (double)(var9 - var10), 0.0D, 0.0D, 0.0D); + } else if(var6 == 3) { + var1.spawnParticle("smoke", (double)(var7 + var11), (double)var8, (double)(var9 + var10), 0.0D, 0.0D, 0.0D); + var1.spawnParticle("flame", (double)(var7 + var11), (double)var8, (double)(var9 + var10), 0.0D, 0.0D, 0.0D); + } + + } + } + + public int getBlockTextureFromSide(int var1) { + return var1 == 1 ? this.blockIndexInTexture + 17 : (var1 == 0 ? this.blockIndexInTexture + 17 : (var1 == 3 ? this.blockIndexInTexture - 1 : this.blockIndexInTexture)); + } + + public boolean blockActivated(World var1, int var2, int var3, int var4, EntityPlayer var5) { + if(var1.multiplayerWorld) { + return true; + } else { + TileEntityFurnace var6 = (TileEntityFurnace)var1.getBlockTileEntity(var2, var3, var4); + var5.displayGUIFurnace(var6); + return true; + } + } + + public static void updateFurnaceBlockState(boolean var0, World var1, int var2, int var3, int var4) { + int var5 = var1.getBlockMetadata(var2, var3, var4); + TileEntity var6 = var1.getBlockTileEntity(var2, var3, var4); + keepFurnaceInventory = true; + if(var0) { + var1.setBlockWithNotify(var2, var3, var4, Block.stoneOvenActive.blockID); + } else { + var1.setBlockWithNotify(var2, var3, var4, Block.stoneOvenIdle.blockID); + } + + keepFurnaceInventory = false; + var1.setBlockMetadataWithNotify(var2, var3, var4, var5); + var6.func_31004_j(); + var1.setBlockTileEntity(var2, var3, var4, var6); + } + + protected TileEntity getBlockEntity() { + return new TileEntityFurnace(); + } + + public void onBlockPlacedBy(World var1, int var2, int var3, int var4, EntityLiving var5) { + int var6 = MathHelper.floor_double((double)(var5.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; + if(var6 == 0) { + var1.setBlockMetadataWithNotify(var2, var3, var4, 2); + } + + if(var6 == 1) { + var1.setBlockMetadataWithNotify(var2, var3, var4, 5); + } + + if(var6 == 2) { + var1.setBlockMetadataWithNotify(var2, var3, var4, 3); + } + + if(var6 == 3) { + var1.setBlockMetadataWithNotify(var2, var3, var4, 4); + } + + } + + public void onBlockRemoval(World var1, int var2, int var3, int var4) { + if(!keepFurnaceInventory) { + TileEntityFurnace var5 = (TileEntityFurnace)var1.getBlockTileEntity(var2, var3, var4); + + for(int var6 = 0; var6 < var5.getSizeInventory(); ++var6) { + ItemStack var7 = var5.getStackInSlot(var6); + if(var7 != null) { + float var8 = this.furnaceRand.nextFloat() * 0.8F + 0.1F; + float var9 = this.furnaceRand.nextFloat() * 0.8F + 0.1F; + float var10 = this.furnaceRand.nextFloat() * 0.8F + 0.1F; + + while(var7.stackSize > 0) { + int var11 = this.furnaceRand.nextInt(21) + 10; + if(var11 > var7.stackSize) { + var11 = var7.stackSize; + } + + var7.stackSize -= var11; + EntityItem var12 = new EntityItem(var1, (double)((float)var2 + var8), (double)((float)var3 + var9), (double)((float)var4 + var10), new ItemStack(var7.itemID, var11, var7.getItemDamage())); + float var13 = 0.05F; + var12.motionX = (double)((float)this.furnaceRand.nextGaussian() * var13); + var12.motionY = (double)((float)this.furnaceRand.nextGaussian() * var13 + 0.2F); + var12.motionZ = (double)((float)this.furnaceRand.nextGaussian() * var13); + var1.entityJoinedWorld(var12); + } + } + } + } + + super.onBlockRemoval(var1, var2, var3, var4); + } +} diff --git a/src/net/minecraft/src/BlockGlass.java b/src/net/minecraft/src/BlockGlass.java new file mode 100644 index 0000000..db42e0b --- /dev/null +++ b/src/net/minecraft/src/BlockGlass.java @@ -0,0 +1,17 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockGlass extends BlockBreakable { + public BlockGlass(int var1, int var2, Material var3, boolean var4) { + super(var1, var2, var3, var4); + } + + public int quantityDropped(Random var1) { + return 0; + } + + public int getRenderBlockPass() { + return 0; + } +} diff --git a/src/net/minecraft/src/BlockGlowStone.java b/src/net/minecraft/src/BlockGlowStone.java new file mode 100644 index 0000000..c9dd83a --- /dev/null +++ b/src/net/minecraft/src/BlockGlowStone.java @@ -0,0 +1,17 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockGlowStone extends Block { + public BlockGlowStone(int var1, int var2, Material var3) { + super(var1, var2, var3); + } + + public int quantityDropped(Random var1) { + return 2 + var1.nextInt(3); + } + + public int idDropped(int var1, Random var2) { + return Item.lightStoneDust.shiftedIndex; + } +} diff --git a/src/net/minecraft/src/BlockGrass.java b/src/net/minecraft/src/BlockGrass.java new file mode 100644 index 0000000..32861bc --- /dev/null +++ b/src/net/minecraft/src/BlockGrass.java @@ -0,0 +1,54 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockGrass extends Block { + protected BlockGrass(int var1) { + super(var1, Material.grassMaterial); + this.blockIndexInTexture = 3; + this.setTickOnLoad(true); + } + + public int getBlockTexture(IBlockAccess var1, int var2, int var3, int var4, int var5) { + if(var5 == 1) { + return 0; + } else if(var5 == 0) { + return 2; + } else { + Material var6 = var1.getBlockMaterial(var2, var3 + 1, var4); + return var6 != Material.snow && var6 != Material.builtSnow ? 3 : 68; + } + } + + public int colorMultiplier(IBlockAccess var1, int var2, int var3, int var4) { + var1.getWorldChunkManager().func_4069_a(var2, var4, 1, 1); + double var5 = var1.getWorldChunkManager().temperature[0]; + double var7 = var1.getWorldChunkManager().humidity[0]; + return ColorizerGrass.getGrassColor(var5, var7); + } + + public void updateTick(World var1, int var2, int var3, int var4, Random var5) { + if(!var1.multiplayerWorld) { + if(var1.getBlockLightValue(var2, var3 + 1, var4) < 4 && Block.lightOpacity[var1.getBlockId(var2, var3 + 1, var4)] > 2) { + if(var5.nextInt(4) != 0) { + return; + } + + var1.setBlockWithNotify(var2, var3, var4, Block.dirt.blockID); + } else if(var1.getBlockLightValue(var2, var3 + 1, var4) >= 9) { + int var6 = var2 + var5.nextInt(3) - 1; + int var7 = var3 + var5.nextInt(5) - 3; + int var8 = var4 + var5.nextInt(3) - 1; + int var9 = var1.getBlockId(var6, var7 + 1, var8); + if(var1.getBlockId(var6, var7, var8) == Block.dirt.blockID && var1.getBlockLightValue(var6, var7 + 1, var8) >= 4 && Block.lightOpacity[var9] <= 2) { + var1.setBlockWithNotify(var6, var7, var8, Block.grass.blockID); + } + } + + } + } + + public int idDropped(int var1, Random var2) { + return Block.dirt.idDropped(0, var2); + } +} diff --git a/src/net/minecraft/src/BlockGravel.java b/src/net/minecraft/src/BlockGravel.java new file mode 100644 index 0000000..f9b8601 --- /dev/null +++ b/src/net/minecraft/src/BlockGravel.java @@ -0,0 +1,13 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockGravel extends BlockSand { + public BlockGravel(int var1, int var2) { + super(var1, var2); + } + + public int idDropped(int var1, Random var2) { + return var2.nextInt(10) == 0 ? Item.flint.shiftedIndex : this.blockID; + } +} diff --git a/src/net/minecraft/src/BlockIce.java b/src/net/minecraft/src/BlockIce.java new file mode 100644 index 0000000..2b2f608 --- /dev/null +++ b/src/net/minecraft/src/BlockIce.java @@ -0,0 +1,44 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockIce extends BlockBreakable { + public BlockIce(int var1, int var2) { + super(var1, var2, Material.ice, false); + this.slipperiness = 0.98F; + this.setTickOnLoad(true); + } + + public int getRenderBlockPass() { + return 1; + } + + public boolean shouldSideBeRendered(IBlockAccess var1, int var2, int var3, int var4, int var5) { + return super.shouldSideBeRendered(var1, var2, var3, var4, 1 - var5); + } + + public void harvestBlock(World var1, EntityPlayer var2, int var3, int var4, int var5, int var6) { + super.harvestBlock(var1, var2, var3, var4, var5, var6); + Material var7 = var1.getBlockMaterial(var3, var4 - 1, var5); + if(var7.getIsSolid() || var7.getIsLiquid()) { + var1.setBlockWithNotify(var3, var4, var5, Block.waterMoving.blockID); + } + + } + + public int quantityDropped(Random var1) { + return 0; + } + + public void updateTick(World var1, int var2, int var3, int var4, Random var5) { + if(var1.getSavedLightValue(EnumSkyBlock.Block, var2, var3, var4) > 11 - Block.lightOpacity[this.blockID]) { + this.dropBlockAsItem(var1, var2, var3, var4, var1.getBlockMetadata(var2, var3, var4)); + var1.setBlockWithNotify(var2, var3, var4, Block.waterStill.blockID); + } + + } + + public int getMobilityFlag() { + return 0; + } +} diff --git a/src/net/minecraft/src/BlockJukeBox.java b/src/net/minecraft/src/BlockJukeBox.java new file mode 100644 index 0000000..6d12d36 --- /dev/null +++ b/src/net/minecraft/src/BlockJukeBox.java @@ -0,0 +1,65 @@ +package net.minecraft.src; + +public class BlockJukeBox extends BlockContainer { + protected BlockJukeBox(int var1, int var2) { + super(var1, var2, Material.wood); + } + + public int getBlockTextureFromSide(int var1) { + return this.blockIndexInTexture + (var1 == 1 ? 1 : 0); + } + + public boolean blockActivated(World var1, int var2, int var3, int var4, EntityPlayer var5) { + if(var1.getBlockMetadata(var2, var3, var4) == 0) { + return false; + } else { + this.func_28038_b_(var1, var2, var3, var4); + return true; + } + } + + public void ejectRecord(World var1, int var2, int var3, int var4, int var5) { + if(!var1.multiplayerWorld) { + TileEntityRecordPlayer var6 = (TileEntityRecordPlayer)var1.getBlockTileEntity(var2, var3, var4); + var6.record = var5; + var6.onInventoryChanged(); + var1.setBlockMetadataWithNotify(var2, var3, var4, 1); + } + } + + public void func_28038_b_(World var1, int var2, int var3, int var4) { + if(!var1.multiplayerWorld) { + TileEntityRecordPlayer var5 = (TileEntityRecordPlayer)var1.getBlockTileEntity(var2, var3, var4); + int var6 = var5.record; + if(var6 != 0) { + var1.func_28106_e(1005, var2, var3, var4, 0); + var1.playRecord((String)null, var2, var3, var4); + var5.record = 0; + var5.onInventoryChanged(); + var1.setBlockMetadataWithNotify(var2, var3, var4, 0); + float var8 = 0.7F; + double var9 = (double)(var1.rand.nextFloat() * var8) + (double)(1.0F - var8) * 0.5D; + double var11 = (double)(var1.rand.nextFloat() * var8) + (double)(1.0F - var8) * 0.2D + 0.6D; + double var13 = (double)(var1.rand.nextFloat() * var8) + (double)(1.0F - var8) * 0.5D; + EntityItem var15 = new EntityItem(var1, (double)var2 + var9, (double)var3 + var11, (double)var4 + var13, new ItemStack(var6, 1, 0)); + var15.delayBeforeCanPickup = 10; + var1.entityJoinedWorld(var15); + } + } + } + + public void onBlockRemoval(World var1, int var2, int var3, int var4) { + this.func_28038_b_(var1, var2, var3, var4); + super.onBlockRemoval(var1, var2, var3, var4); + } + + public void dropBlockAsItemWithChance(World var1, int var2, int var3, int var4, int var5, float var6) { + if(!var1.multiplayerWorld) { + super.dropBlockAsItemWithChance(var1, var2, var3, var4, var5, var6); + } + } + + protected TileEntity getBlockEntity() { + return new TileEntityRecordPlayer(); + } +} diff --git a/src/net/minecraft/src/BlockLadder.java b/src/net/minecraft/src/BlockLadder.java new file mode 100644 index 0000000..a443155 --- /dev/null +++ b/src/net/minecraft/src/BlockLadder.java @@ -0,0 +1,121 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockLadder extends Block { + protected BlockLadder(int var1, int var2) { + super(var1, var2, Material.circuits); + } + + public AxisAlignedBB getCollisionBoundingBoxFromPool(World var1, int var2, int var3, int var4) { + int var5 = var1.getBlockMetadata(var2, var3, var4); + float var6 = 2.0F / 16.0F; + if(var5 == 2) { + this.setBlockBounds(0.0F, 0.0F, 1.0F - var6, 1.0F, 1.0F, 1.0F); + } + + if(var5 == 3) { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, var6); + } + + if(var5 == 4) { + this.setBlockBounds(1.0F - var6, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + } + + if(var5 == 5) { + this.setBlockBounds(0.0F, 0.0F, 0.0F, var6, 1.0F, 1.0F); + } + + return super.getCollisionBoundingBoxFromPool(var1, var2, var3, var4); + } + + public AxisAlignedBB getSelectedBoundingBoxFromPool(World var1, int var2, int var3, int var4) { + int var5 = var1.getBlockMetadata(var2, var3, var4); + float var6 = 2.0F / 16.0F; + if(var5 == 2) { + this.setBlockBounds(0.0F, 0.0F, 1.0F - var6, 1.0F, 1.0F, 1.0F); + } + + if(var5 == 3) { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, var6); + } + + if(var5 == 4) { + this.setBlockBounds(1.0F - var6, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + } + + if(var5 == 5) { + this.setBlockBounds(0.0F, 0.0F, 0.0F, var6, 1.0F, 1.0F); + } + + return super.getSelectedBoundingBoxFromPool(var1, var2, var3, var4); + } + + public boolean isOpaqueCube() { + return false; + } + + public boolean renderAsNormalBlock() { + return false; + } + + public int getRenderType() { + return 8; + } + + public boolean canPlaceBlockAt(World var1, int var2, int var3, int var4) { + return var1.isBlockNormalCube(var2 - 1, var3, var4) ? true : (var1.isBlockNormalCube(var2 + 1, var3, var4) ? true : (var1.isBlockNormalCube(var2, var3, var4 - 1) ? true : var1.isBlockNormalCube(var2, var3, var4 + 1))); + } + + public void onBlockPlaced(World var1, int var2, int var3, int var4, int var5) { + int var6 = var1.getBlockMetadata(var2, var3, var4); + if((var6 == 0 || var5 == 2) && var1.isBlockNormalCube(var2, var3, var4 + 1)) { + var6 = 2; + } + + if((var6 == 0 || var5 == 3) && var1.isBlockNormalCube(var2, var3, var4 - 1)) { + var6 = 3; + } + + if((var6 == 0 || var5 == 4) && var1.isBlockNormalCube(var2 + 1, var3, var4)) { + var6 = 4; + } + + if((var6 == 0 || var5 == 5) && var1.isBlockNormalCube(var2 - 1, var3, var4)) { + var6 = 5; + } + + var1.setBlockMetadataWithNotify(var2, var3, var4, var6); + } + + public void onNeighborBlockChange(World var1, int var2, int var3, int var4, int var5) { + int var6 = var1.getBlockMetadata(var2, var3, var4); + boolean var7 = false; + if(var6 == 2 && var1.isBlockNormalCube(var2, var3, var4 + 1)) { + var7 = true; + } + + if(var6 == 3 && var1.isBlockNormalCube(var2, var3, var4 - 1)) { + var7 = true; + } + + if(var6 == 4 && var1.isBlockNormalCube(var2 + 1, var3, var4)) { + var7 = true; + } + + if(var6 == 5 && var1.isBlockNormalCube(var2 - 1, var3, var4)) { + var7 = true; + } + + if(!var7) { + this.dropBlockAsItem(var1, var2, var3, var4, var6); + var1.setBlockWithNotify(var2, var3, var4, 0); + } + + super.onNeighborBlockChange(var1, var2, var3, var4, var5); + } + + public int quantityDropped(Random var1) { + return 1; + } +} diff --git a/src/net/minecraft/src/BlockLeaves.java b/src/net/minecraft/src/BlockLeaves.java new file mode 100644 index 0000000..37db199 --- /dev/null +++ b/src/net/minecraft/src/BlockLeaves.java @@ -0,0 +1,189 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockLeaves extends BlockLeavesBase { + private int baseIndexInPNG; + int[] adjacentTreeBlocks; + + protected BlockLeaves(int var1, int var2) { + super(var1, var2, Material.leaves, false); + this.baseIndexInPNG = var2; + this.setTickOnLoad(true); + } + + public int getRenderColor(int var1) { + return (var1 & 1) == 1 ? ColorizerFoliage.getFoliageColorPine() : ((var1 & 2) == 2 ? ColorizerFoliage.getFoliageColorBirch() : ColorizerFoliage.func_31073_c()); + } + + public int colorMultiplier(IBlockAccess var1, int var2, int var3, int var4) { + int var5 = var1.getBlockMetadata(var2, var3, var4); + if((var5 & 1) == 1) { + return ColorizerFoliage.getFoliageColorPine(); + } else if((var5 & 2) == 2) { + return ColorizerFoliage.getFoliageColorBirch(); + } else { + var1.getWorldChunkManager().func_4069_a(var2, var4, 1, 1); + double var6 = var1.getWorldChunkManager().temperature[0]; + double var8 = var1.getWorldChunkManager().humidity[0]; + return ColorizerFoliage.getFoliageColor(var6, var8); + } + } + + public void onBlockRemoval(World var1, int var2, int var3, int var4) { + byte var5 = 1; + int var6 = var5 + 1; + if(var1.checkChunksExist(var2 - var6, var3 - var6, var4 - var6, var2 + var6, var3 + var6, var4 + var6)) { + for(int var7 = -var5; var7 <= var5; ++var7) { + for(int var8 = -var5; var8 <= var5; ++var8) { + for(int var9 = -var5; var9 <= var5; ++var9) { + int var10 = var1.getBlockId(var2 + var7, var3 + var8, var4 + var9); + if(var10 == Block.leaves.blockID) { + int var11 = var1.getBlockMetadata(var2 + var7, var3 + var8, var4 + var9); + var1.setBlockMetadata(var2 + var7, var3 + var8, var4 + var9, var11 | 8); + } + } + } + } + } + + } + + public void updateTick(World var1, int var2, int var3, int var4, Random var5) { + if(!var1.multiplayerWorld) { + int var6 = var1.getBlockMetadata(var2, var3, var4); + if((var6 & 8) != 0) { + byte var7 = 4; + int var8 = var7 + 1; + byte var9 = 32; + int var10 = var9 * var9; + int var11 = var9 / 2; + if(this.adjacentTreeBlocks == null) { + this.adjacentTreeBlocks = new int[var9 * var9 * var9]; + } + + int var12; + if(var1.checkChunksExist(var2 - var8, var3 - var8, var4 - var8, var2 + var8, var3 + var8, var4 + var8)) { + var12 = -var7; + + label111: + while(true) { + int var13; + int var14; + int var15; + if(var12 > var7) { + var12 = 1; + + while(true) { + if(var12 > 4) { + break label111; + } + + for(var13 = -var7; var13 <= var7; ++var13) { + for(var14 = -var7; var14 <= var7; ++var14) { + for(var15 = -var7; var15 <= var7; ++var15) { + if(this.adjacentTreeBlocks[(var13 + var11) * var10 + (var14 + var11) * var9 + var15 + var11] == var12 - 1) { + if(this.adjacentTreeBlocks[(var13 + var11 - 1) * var10 + (var14 + var11) * var9 + var15 + var11] == -2) { + this.adjacentTreeBlocks[(var13 + var11 - 1) * var10 + (var14 + var11) * var9 + var15 + var11] = var12; + } + + if(this.adjacentTreeBlocks[(var13 + var11 + 1) * var10 + (var14 + var11) * var9 + var15 + var11] == -2) { + this.adjacentTreeBlocks[(var13 + var11 + 1) * var10 + (var14 + var11) * var9 + var15 + var11] = var12; + } + + if(this.adjacentTreeBlocks[(var13 + var11) * var10 + (var14 + var11 - 1) * var9 + var15 + var11] == -2) { + this.adjacentTreeBlocks[(var13 + var11) * var10 + (var14 + var11 - 1) * var9 + var15 + var11] = var12; + } + + if(this.adjacentTreeBlocks[(var13 + var11) * var10 + (var14 + var11 + 1) * var9 + var15 + var11] == -2) { + this.adjacentTreeBlocks[(var13 + var11) * var10 + (var14 + var11 + 1) * var9 + var15 + var11] = var12; + } + + if(this.adjacentTreeBlocks[(var13 + var11) * var10 + (var14 + var11) * var9 + (var15 + var11 - 1)] == -2) { + this.adjacentTreeBlocks[(var13 + var11) * var10 + (var14 + var11) * var9 + (var15 + var11 - 1)] = var12; + } + + if(this.adjacentTreeBlocks[(var13 + var11) * var10 + (var14 + var11) * var9 + var15 + var11 + 1] == -2) { + this.adjacentTreeBlocks[(var13 + var11) * var10 + (var14 + var11) * var9 + var15 + var11 + 1] = var12; + } + } + } + } + } + + ++var12; + } + } + + for(var13 = -var7; var13 <= var7; ++var13) { + for(var14 = -var7; var14 <= var7; ++var14) { + var15 = var1.getBlockId(var2 + var12, var3 + var13, var4 + var14); + if(var15 == Block.wood.blockID) { + this.adjacentTreeBlocks[(var12 + var11) * var10 + (var13 + var11) * var9 + var14 + var11] = 0; + } else if(var15 == Block.leaves.blockID) { + this.adjacentTreeBlocks[(var12 + var11) * var10 + (var13 + var11) * var9 + var14 + var11] = -2; + } else { + this.adjacentTreeBlocks[(var12 + var11) * var10 + (var13 + var11) * var9 + var14 + var11] = -1; + } + } + } + + ++var12; + } + } + + var12 = this.adjacentTreeBlocks[var11 * var10 + var11 * var9 + var11]; + if(var12 >= 0) { + var1.setBlockMetadata(var2, var3, var4, var6 & -9); + } else { + this.removeLeaves(var1, var2, var3, var4); + } + } + + } + } + + private void removeLeaves(World var1, int var2, int var3, int var4) { + this.dropBlockAsItem(var1, var2, var3, var4, var1.getBlockMetadata(var2, var3, var4)); + var1.setBlockWithNotify(var2, var3, var4, 0); + } + + public int quantityDropped(Random var1) { + return var1.nextInt(20) == 0 ? 1 : 0; + } + + public int idDropped(int var1, Random var2) { + return Block.sapling.blockID; + } + + public void harvestBlock(World var1, EntityPlayer var2, int var3, int var4, int var5, int var6) { + if(!var1.multiplayerWorld && var2.getCurrentEquippedItem() != null && var2.getCurrentEquippedItem().itemID == Item.shears.shiftedIndex) { + var2.addStat(StatList.mineBlockStatArray[this.blockID], 1); + this.dropBlockAsItem_do(var1, var3, var4, var5, new ItemStack(Block.leaves.blockID, 1, var6 & 3)); + } else { + super.harvestBlock(var1, var2, var3, var4, var5, var6); + } + + } + + protected int damageDropped(int var1) { + return var1 & 3; + } + + public boolean isOpaqueCube() { + return !this.graphicsLevel; + } + + public int getBlockTextureFromSideAndMetadata(int var1, int var2) { + return (var2 & 3) == 1 ? this.blockIndexInTexture + 80 : this.blockIndexInTexture; + } + + public void setGraphicsLevel(boolean var1) { + this.graphicsLevel = var1; + this.blockIndexInTexture = this.baseIndexInPNG + (var1 ? 0 : 1); + } + + public void onEntityWalking(World var1, int var2, int var3, int var4, Entity var5) { + super.onEntityWalking(var1, var2, var3, var4, var5); + } +} diff --git a/src/net/minecraft/src/BlockLeavesBase.java b/src/net/minecraft/src/BlockLeavesBase.java new file mode 100644 index 0000000..d50b477 --- /dev/null +++ b/src/net/minecraft/src/BlockLeavesBase.java @@ -0,0 +1,19 @@ +package net.minecraft.src; + +public class BlockLeavesBase extends Block { + protected boolean graphicsLevel; + + protected BlockLeavesBase(int var1, int var2, Material var3, boolean var4) { + super(var1, var2, var3); + this.graphicsLevel = var4; + } + + public boolean isOpaqueCube() { + return false; + } + + public boolean shouldSideBeRendered(IBlockAccess var1, int var2, int var3, int var4, int var5) { + int var6 = var1.getBlockId(var2, var3, var4); + return !this.graphicsLevel && var6 == this.blockID ? false : super.shouldSideBeRendered(var1, var2, var3, var4, var5); + } +} diff --git a/src/net/minecraft/src/BlockLever.java b/src/net/minecraft/src/BlockLever.java new file mode 100644 index 0000000..140f6c6 --- /dev/null +++ b/src/net/minecraft/src/BlockLever.java @@ -0,0 +1,198 @@ +package net.minecraft.src; + +public class BlockLever extends Block { + protected BlockLever(int var1, int var2) { + super(var1, var2, Material.circuits); + } + + public AxisAlignedBB getCollisionBoundingBoxFromPool(World var1, int var2, int var3, int var4) { + return null; + } + + public boolean isOpaqueCube() { + return false; + } + + public boolean renderAsNormalBlock() { + return false; + } + + public int getRenderType() { + return 12; + } + + public boolean canPlaceBlockOnSide(World var1, int var2, int var3, int var4, int var5) { + return var5 == 1 && var1.isBlockNormalCube(var2, var3 - 1, var4) ? true : (var5 == 2 && var1.isBlockNormalCube(var2, var3, var4 + 1) ? true : (var5 == 3 && var1.isBlockNormalCube(var2, var3, var4 - 1) ? true : (var5 == 4 && var1.isBlockNormalCube(var2 + 1, var3, var4) ? true : var5 == 5 && var1.isBlockNormalCube(var2 - 1, var3, var4)))); + } + + public boolean canPlaceBlockAt(World var1, int var2, int var3, int var4) { + return var1.isBlockNormalCube(var2 - 1, var3, var4) ? true : (var1.isBlockNormalCube(var2 + 1, var3, var4) ? true : (var1.isBlockNormalCube(var2, var3, var4 - 1) ? true : (var1.isBlockNormalCube(var2, var3, var4 + 1) ? true : var1.isBlockNormalCube(var2, var3 - 1, var4)))); + } + + public void onBlockPlaced(World var1, int var2, int var3, int var4, int var5) { + int var6 = var1.getBlockMetadata(var2, var3, var4); + int var7 = var6 & 8; + var6 &= 7; + var6 = -1; + if(var5 == 1 && var1.isBlockNormalCube(var2, var3 - 1, var4)) { + var6 = 5 + var1.rand.nextInt(2); + } + + if(var5 == 2 && var1.isBlockNormalCube(var2, var3, var4 + 1)) { + var6 = 4; + } + + if(var5 == 3 && var1.isBlockNormalCube(var2, var3, var4 - 1)) { + var6 = 3; + } + + if(var5 == 4 && var1.isBlockNormalCube(var2 + 1, var3, var4)) { + var6 = 2; + } + + if(var5 == 5 && var1.isBlockNormalCube(var2 - 1, var3, var4)) { + var6 = 1; + } + + if(var6 == -1) { + this.dropBlockAsItem(var1, var2, var3, var4, var1.getBlockMetadata(var2, var3, var4)); + var1.setBlockWithNotify(var2, var3, var4, 0); + } else { + var1.setBlockMetadataWithNotify(var2, var3, var4, var6 + var7); + } + } + + public void onNeighborBlockChange(World var1, int var2, int var3, int var4, int var5) { + if(this.checkIfAttachedToBlock(var1, var2, var3, var4)) { + int var6 = var1.getBlockMetadata(var2, var3, var4) & 7; + boolean var7 = false; + if(!var1.isBlockNormalCube(var2 - 1, var3, var4) && var6 == 1) { + var7 = true; + } + + if(!var1.isBlockNormalCube(var2 + 1, var3, var4) && var6 == 2) { + var7 = true; + } + + if(!var1.isBlockNormalCube(var2, var3, var4 - 1) && var6 == 3) { + var7 = true; + } + + if(!var1.isBlockNormalCube(var2, var3, var4 + 1) && var6 == 4) { + var7 = true; + } + + if(!var1.isBlockNormalCube(var2, var3 - 1, var4) && var6 == 5) { + var7 = true; + } + + if(!var1.isBlockNormalCube(var2, var3 - 1, var4) && var6 == 6) { + var7 = true; + } + + if(var7) { + this.dropBlockAsItem(var1, var2, var3, var4, var1.getBlockMetadata(var2, var3, var4)); + var1.setBlockWithNotify(var2, var3, var4, 0); + } + } + + } + + private boolean checkIfAttachedToBlock(World var1, int var2, int var3, int var4) { + if(!this.canPlaceBlockAt(var1, var2, var3, var4)) { + this.dropBlockAsItem(var1, var2, var3, var4, var1.getBlockMetadata(var2, var3, var4)); + var1.setBlockWithNotify(var2, var3, var4, 0); + return false; + } else { + return true; + } + } + + public void setBlockBoundsBasedOnState(IBlockAccess var1, int var2, int var3, int var4) { + int var5 = var1.getBlockMetadata(var2, var3, var4) & 7; + float var6 = 3.0F / 16.0F; + if(var5 == 1) { + this.setBlockBounds(0.0F, 0.2F, 0.5F - var6, var6 * 2.0F, 0.8F, 0.5F + var6); + } else if(var5 == 2) { + this.setBlockBounds(1.0F - var6 * 2.0F, 0.2F, 0.5F - var6, 1.0F, 0.8F, 0.5F + var6); + } else if(var5 == 3) { + this.setBlockBounds(0.5F - var6, 0.2F, 0.0F, 0.5F + var6, 0.8F, var6 * 2.0F); + } else if(var5 == 4) { + this.setBlockBounds(0.5F - var6, 0.2F, 1.0F - var6 * 2.0F, 0.5F + var6, 0.8F, 1.0F); + } else { + var6 = 0.25F; + this.setBlockBounds(0.5F - var6, 0.0F, 0.5F - var6, 0.5F + var6, 0.6F, 0.5F + var6); + } + + } + + public void onBlockClicked(World var1, int var2, int var3, int var4, EntityPlayer var5) { + this.blockActivated(var1, var2, var3, var4, var5); + } + + public boolean blockActivated(World var1, int var2, int var3, int var4, EntityPlayer var5) { + if(var1.multiplayerWorld) { + return true; + } else { + int var6 = var1.getBlockMetadata(var2, var3, var4); + int var7 = var6 & 7; + int var8 = 8 - (var6 & 8); + var1.setBlockMetadataWithNotify(var2, var3, var4, var7 + var8); + var1.markBlocksDirty(var2, var3, var4, var2, var3, var4); + var1.playSoundEffect((double)var2 + 0.5D, (double)var3 + 0.5D, (double)var4 + 0.5D, "random.click", 0.3F, var8 > 0 ? 0.6F : 0.5F); + var1.notifyBlocksOfNeighborChange(var2, var3, var4, this.blockID); + if(var7 == 1) { + var1.notifyBlocksOfNeighborChange(var2 - 1, var3, var4, this.blockID); + } else if(var7 == 2) { + var1.notifyBlocksOfNeighborChange(var2 + 1, var3, var4, this.blockID); + } else if(var7 == 3) { + var1.notifyBlocksOfNeighborChange(var2, var3, var4 - 1, this.blockID); + } else if(var7 == 4) { + var1.notifyBlocksOfNeighborChange(var2, var3, var4 + 1, this.blockID); + } else { + var1.notifyBlocksOfNeighborChange(var2, var3 - 1, var4, this.blockID); + } + + return true; + } + } + + public void onBlockRemoval(World var1, int var2, int var3, int var4) { + int var5 = var1.getBlockMetadata(var2, var3, var4); + if((var5 & 8) > 0) { + var1.notifyBlocksOfNeighborChange(var2, var3, var4, this.blockID); + int var6 = var5 & 7; + if(var6 == 1) { + var1.notifyBlocksOfNeighborChange(var2 - 1, var3, var4, this.blockID); + } else if(var6 == 2) { + var1.notifyBlocksOfNeighborChange(var2 + 1, var3, var4, this.blockID); + } else if(var6 == 3) { + var1.notifyBlocksOfNeighborChange(var2, var3, var4 - 1, this.blockID); + } else if(var6 == 4) { + var1.notifyBlocksOfNeighborChange(var2, var3, var4 + 1, this.blockID); + } else { + var1.notifyBlocksOfNeighborChange(var2, var3 - 1, var4, this.blockID); + } + } + + super.onBlockRemoval(var1, var2, var3, var4); + } + + public boolean isPoweringTo(IBlockAccess var1, int var2, int var3, int var4, int var5) { + return (var1.getBlockMetadata(var2, var3, var4) & 8) > 0; + } + + public boolean isIndirectlyPoweringTo(World var1, int var2, int var3, int var4, int var5) { + int var6 = var1.getBlockMetadata(var2, var3, var4); + if((var6 & 8) == 0) { + return false; + } else { + int var7 = var6 & 7; + return var7 == 6 && var5 == 1 ? true : (var7 == 5 && var5 == 1 ? true : (var7 == 4 && var5 == 2 ? true : (var7 == 3 && var5 == 3 ? true : (var7 == 2 && var5 == 4 ? true : var7 == 1 && var5 == 5)))); + } + } + + public boolean canProvidePower() { + return true; + } +} diff --git a/src/net/minecraft/src/BlockLockedChest.java b/src/net/minecraft/src/BlockLockedChest.java new file mode 100644 index 0000000..687ca34 --- /dev/null +++ b/src/net/minecraft/src/BlockLockedChest.java @@ -0,0 +1,53 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockLockedChest extends Block { + protected BlockLockedChest(int var1) { + super(var1, Material.wood); + this.blockIndexInTexture = 26; + } + + public int getBlockTexture(IBlockAccess var1, int var2, int var3, int var4, int var5) { + if(var5 == 1) { + return this.blockIndexInTexture - 1; + } else if(var5 == 0) { + return this.blockIndexInTexture - 1; + } else { + int var6 = var1.getBlockId(var2, var3, var4 - 1); + int var7 = var1.getBlockId(var2, var3, var4 + 1); + int var8 = var1.getBlockId(var2 - 1, var3, var4); + int var9 = var1.getBlockId(var2 + 1, var3, var4); + byte var10 = 3; + if(Block.opaqueCubeLookup[var6] && !Block.opaqueCubeLookup[var7]) { + var10 = 3; + } + + if(Block.opaqueCubeLookup[var7] && !Block.opaqueCubeLookup[var6]) { + var10 = 2; + } + + if(Block.opaqueCubeLookup[var8] && !Block.opaqueCubeLookup[var9]) { + var10 = 5; + } + + if(Block.opaqueCubeLookup[var9] && !Block.opaqueCubeLookup[var8]) { + var10 = 4; + } + + return var5 == var10 ? this.blockIndexInTexture + 1 : this.blockIndexInTexture; + } + } + + public int getBlockTextureFromSide(int var1) { + return var1 == 1 ? this.blockIndexInTexture - 1 : (var1 == 0 ? this.blockIndexInTexture - 1 : (var1 == 3 ? this.blockIndexInTexture + 1 : this.blockIndexInTexture)); + } + + public boolean canPlaceBlockAt(World var1, int var2, int var3, int var4) { + return true; + } + + public void updateTick(World var1, int var2, int var3, int var4, Random var5) { + var1.setBlockWithNotify(var2, var3, var4, 0); + } +} diff --git a/src/net/minecraft/src/BlockLog.java b/src/net/minecraft/src/BlockLog.java new file mode 100644 index 0000000..1058f64 --- /dev/null +++ b/src/net/minecraft/src/BlockLog.java @@ -0,0 +1,51 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockLog extends Block { + protected BlockLog(int var1) { + super(var1, Material.wood); + this.blockIndexInTexture = 20; + } + + public int quantityDropped(Random var1) { + return 1; + } + + public int idDropped(int var1, Random var2) { + return Block.wood.blockID; + } + + public void harvestBlock(World var1, EntityPlayer var2, int var3, int var4, int var5, int var6) { + super.harvestBlock(var1, var2, var3, var4, var5, var6); + } + + public void onBlockRemoval(World var1, int var2, int var3, int var4) { + byte var5 = 4; + int var6 = var5 + 1; + if(var1.checkChunksExist(var2 - var6, var3 - var6, var4 - var6, var2 + var6, var3 + var6, var4 + var6)) { + for(int var7 = -var5; var7 <= var5; ++var7) { + for(int var8 = -var5; var8 <= var5; ++var8) { + for(int var9 = -var5; var9 <= var5; ++var9) { + int var10 = var1.getBlockId(var2 + var7, var3 + var8, var4 + var9); + if(var10 == Block.leaves.blockID) { + int var11 = var1.getBlockMetadata(var2 + var7, var3 + var8, var4 + var9); + if((var11 & 8) == 0) { + var1.setBlockMetadata(var2 + var7, var3 + var8, var4 + var9, var11 | 8); + } + } + } + } + } + } + + } + + public int getBlockTextureFromSideAndMetadata(int var1, int var2) { + return var1 == 1 ? 21 : (var1 == 0 ? 21 : (var2 == 1 ? 116 : (var2 == 2 ? 117 : 20))); + } + + protected int damageDropped(int var1) { + return var1; + } +} diff --git a/src/net/minecraft/src/BlockMobSpawner.java b/src/net/minecraft/src/BlockMobSpawner.java new file mode 100644 index 0000000..25b8ff0 --- /dev/null +++ b/src/net/minecraft/src/BlockMobSpawner.java @@ -0,0 +1,25 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockMobSpawner extends BlockContainer { + protected BlockMobSpawner(int var1, int var2) { + super(var1, var2, Material.rock); + } + + protected TileEntity getBlockEntity() { + return new TileEntityMobSpawner(); + } + + public int idDropped(int var1, Random var2) { + return 0; + } + + public int quantityDropped(Random var1) { + return 0; + } + + public boolean isOpaqueCube() { + return false; + } +} diff --git a/src/net/minecraft/src/BlockMushroom.java b/src/net/minecraft/src/BlockMushroom.java new file mode 100644 index 0000000..ba3ff3c --- /dev/null +++ b/src/net/minecraft/src/BlockMushroom.java @@ -0,0 +1,36 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockMushroom extends BlockFlower { + protected BlockMushroom(int var1, int var2) { + super(var1, var2); + float var3 = 0.2F; + this.setBlockBounds(0.5F - var3, 0.0F, 0.5F - var3, 0.5F + var3, var3 * 2.0F, 0.5F + var3); + this.setTickOnLoad(true); + } + + public void updateTick(World var1, int var2, int var3, int var4, Random var5) { + if(var5.nextInt(100) == 0) { + int var6 = var2 + var5.nextInt(3) - 1; + int var7 = var3 + var5.nextInt(2) - var5.nextInt(2); + int var8 = var4 + var5.nextInt(3) - 1; + if(var1.isAirBlock(var6, var7, var8) && this.canBlockStay(var1, var6, var7, var8)) { + int var10000 = var2 + (var5.nextInt(3) - 1); + var10000 = var4 + (var5.nextInt(3) - 1); + if(var1.isAirBlock(var6, var7, var8) && this.canBlockStay(var1, var6, var7, var8)) { + var1.setBlockWithNotify(var6, var7, var8, this.blockID); + } + } + } + + } + + protected boolean canThisPlantGrowOnThisBlockID(int var1) { + return Block.opaqueCubeLookup[var1]; + } + + public boolean canBlockStay(World var1, int var2, int var3, int var4) { + return var3 >= 0 && var3 < 128 ? var1.getFullBlockLightValue(var2, var3, var4) < 13 && this.canThisPlantGrowOnThisBlockID(var1.getBlockId(var2, var3 - 1, var4)) : false; + } +} diff --git a/src/net/minecraft/src/BlockNetherrack.java b/src/net/minecraft/src/BlockNetherrack.java new file mode 100644 index 0000000..871eb66 --- /dev/null +++ b/src/net/minecraft/src/BlockNetherrack.java @@ -0,0 +1,7 @@ +package net.minecraft.src; + +public class BlockNetherrack extends Block { + public BlockNetherrack(int var1, int var2) { + super(var1, var2, Material.rock); + } +} diff --git a/src/net/minecraft/src/BlockNote.java b/src/net/minecraft/src/BlockNote.java new file mode 100644 index 0000000..c19da65 --- /dev/null +++ b/src/net/minecraft/src/BlockNote.java @@ -0,0 +1,71 @@ +package net.minecraft.src; + +public class BlockNote extends BlockContainer { + public BlockNote(int var1) { + super(var1, 74, Material.wood); + } + + public int getBlockTextureFromSide(int var1) { + return this.blockIndexInTexture; + } + + public void onNeighborBlockChange(World var1, int var2, int var3, int var4, int var5) { + if(var5 > 0 && Block.blocksList[var5].canProvidePower()) { + boolean var6 = var1.isBlockGettingPowered(var2, var3, var4); + TileEntityNote var7 = (TileEntityNote)var1.getBlockTileEntity(var2, var3, var4); + if(var7.previousRedstoneState != var6) { + if(var6) { + var7.triggerNote(var1, var2, var3, var4); + } + + var7.previousRedstoneState = var6; + } + } + + } + + public boolean blockActivated(World var1, int var2, int var3, int var4, EntityPlayer var5) { + if(var1.multiplayerWorld) { + return true; + } else { + TileEntityNote var6 = (TileEntityNote)var1.getBlockTileEntity(var2, var3, var4); + var6.changePitch(); + var6.triggerNote(var1, var2, var3, var4); + return true; + } + } + + public void onBlockClicked(World var1, int var2, int var3, int var4, EntityPlayer var5) { + if(!var1.multiplayerWorld) { + TileEntityNote var6 = (TileEntityNote)var1.getBlockTileEntity(var2, var3, var4); + var6.triggerNote(var1, var2, var3, var4); + } + } + + protected TileEntity getBlockEntity() { + return new TileEntityNote(); + } + + public void playBlock(World var1, int var2, int var3, int var4, int var5, int var6) { + float var7 = (float)Math.pow(2.0D, (double)(var6 - 12) / 12.0D); + String var8 = "harp"; + if(var5 == 1) { + var8 = "bd"; + } + + if(var5 == 2) { + var8 = "snare"; + } + + if(var5 == 3) { + var8 = "hat"; + } + + if(var5 == 4) { + var8 = "bassattack"; + } + + var1.playSoundEffect((double)var2 + 0.5D, (double)var3 + 0.5D, (double)var4 + 0.5D, "note." + var8, 3.0F, var7); + var1.spawnParticle("note", (double)var2 + 0.5D, (double)var3 + 1.2D, (double)var4 + 0.5D, (double)var6 / 24.0D, 0.0D, 0.0D); + } +} diff --git a/src/net/minecraft/src/BlockObsidian.java b/src/net/minecraft/src/BlockObsidian.java new file mode 100644 index 0000000..bb6bcf1 --- /dev/null +++ b/src/net/minecraft/src/BlockObsidian.java @@ -0,0 +1,17 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockObsidian extends BlockStone { + public BlockObsidian(int var1, int var2) { + super(var1, var2); + } + + public int quantityDropped(Random var1) { + return 1; + } + + public int idDropped(int var1, Random var2) { + return Block.obsidian.blockID; + } +} diff --git a/src/net/minecraft/src/BlockOre.java b/src/net/minecraft/src/BlockOre.java new file mode 100644 index 0000000..21b0a11 --- /dev/null +++ b/src/net/minecraft/src/BlockOre.java @@ -0,0 +1,21 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockOre extends Block { + public BlockOre(int var1, int var2) { + super(var1, var2, Material.rock); + } + + public int idDropped(int var1, Random var2) { + return this.blockID == Block.oreCoal.blockID ? Item.coal.shiftedIndex : (this.blockID == Block.oreDiamond.blockID ? Item.diamond.shiftedIndex : (this.blockID == Block.oreLapis.blockID ? Item.dyePowder.shiftedIndex : this.blockID)); + } + + public int quantityDropped(Random var1) { + return this.blockID == Block.oreLapis.blockID ? 4 + var1.nextInt(5) : 1; + } + + protected int damageDropped(int var1) { + return this.blockID == Block.oreLapis.blockID ? 4 : 0; + } +} diff --git a/src/net/minecraft/src/BlockOreStorage.java b/src/net/minecraft/src/BlockOreStorage.java new file mode 100644 index 0000000..6041795 --- /dev/null +++ b/src/net/minecraft/src/BlockOreStorage.java @@ -0,0 +1,12 @@ +package net.minecraft.src; + +public class BlockOreStorage extends Block { + public BlockOreStorage(int var1, int var2) { + super(var1, Material.iron); + this.blockIndexInTexture = var2; + } + + public int getBlockTextureFromSide(int var1) { + return this.blockIndexInTexture; + } +} diff --git a/src/net/minecraft/src/BlockPistonBase.java b/src/net/minecraft/src/BlockPistonBase.java new file mode 100644 index 0000000..ad776f0 --- /dev/null +++ b/src/net/minecraft/src/BlockPistonBase.java @@ -0,0 +1,329 @@ +package net.minecraft.src; + +import java.util.ArrayList; + +public class BlockPistonBase extends Block { + private boolean isSticky; + private boolean field_31048_b; + + public BlockPistonBase(int var1, int var2, boolean var3) { + super(var1, var2, Material.field_31067_B); + this.isSticky = var3; + this.setStepSound(soundStoneFootstep); + this.setHardness(0.5F); + } + + public int func_31040_i() { + return this.isSticky ? 106 : 107; + } + + public int getBlockTextureFromSideAndMetadata(int var1, int var2) { + int var3 = func_31044_d(var2); + return var3 > 5 ? this.blockIndexInTexture : (var1 == var3 ? (!isPowered(var2) && this.minX <= 0.0D && this.minY <= 0.0D && this.minZ <= 0.0D && this.maxX >= 1.0D && this.maxY >= 1.0D && this.maxZ >= 1.0D ? this.blockIndexInTexture : 110) : (var1 == PistonBlockTextures.field_31057_a[var3] ? 109 : 108)); + } + + public int getRenderType() { + return 16; + } + + public boolean isOpaqueCube() { + return false; + } + + public boolean blockActivated(World var1, int var2, int var3, int var4, EntityPlayer var5) { + return false; + } + + public void onBlockPlacedBy(World var1, int var2, int var3, int var4, EntityLiving var5) { + int var6 = func_31039_c(var1, var2, var3, var4, (EntityPlayer)var5); + var1.setBlockMetadataWithNotify(var2, var3, var4, var6); + if(!var1.multiplayerWorld) { + this.func_31043_h(var1, var2, var3, var4); + } + + } + + public void onNeighborBlockChange(World var1, int var2, int var3, int var4, int var5) { + if(!var1.multiplayerWorld && !this.field_31048_b) { + this.func_31043_h(var1, var2, var3, var4); + } + + } + + public void onBlockAdded(World var1, int var2, int var3, int var4) { + if(!var1.multiplayerWorld && var1.getBlockTileEntity(var2, var3, var4) == null) { + this.func_31043_h(var1, var2, var3, var4); + } + + } + + private void func_31043_h(World var1, int var2, int var3, int var4) { + int var5 = var1.getBlockMetadata(var2, var3, var4); + int var6 = func_31044_d(var5); + boolean var7 = this.func_31041_f(var1, var2, var3, var4, var6); + if(var5 != 7) { + if(var7 && !isPowered(var5)) { + if(func_31045_h(var1, var2, var3, var4, var6)) { + var1.setBlockMetadata(var2, var3, var4, var6 | 8); + var1.playNoteAt(var2, var3, var4, 0, var6); + } + } else if(!var7 && isPowered(var5)) { + var1.setBlockMetadata(var2, var3, var4, var6); + var1.playNoteAt(var2, var3, var4, 1, var6); + } + + } + } + + private boolean func_31041_f(World var1, int var2, int var3, int var4, int var5) { + return var5 != 0 && var1.isBlockIndirectlyProvidingPowerTo(var2, var3 - 1, var4, 0) ? true : (var5 != 1 && var1.isBlockIndirectlyProvidingPowerTo(var2, var3 + 1, var4, 1) ? true : (var5 != 2 && var1.isBlockIndirectlyProvidingPowerTo(var2, var3, var4 - 1, 2) ? true : (var5 != 3 && var1.isBlockIndirectlyProvidingPowerTo(var2, var3, var4 + 1, 3) ? true : (var5 != 5 && var1.isBlockIndirectlyProvidingPowerTo(var2 + 1, var3, var4, 5) ? true : (var5 != 4 && var1.isBlockIndirectlyProvidingPowerTo(var2 - 1, var3, var4, 4) ? true : (var1.isBlockIndirectlyProvidingPowerTo(var2, var3, var4, 0) ? true : (var1.isBlockIndirectlyProvidingPowerTo(var2, var3 + 2, var4, 1) ? true : (var1.isBlockIndirectlyProvidingPowerTo(var2, var3 + 1, var4 - 1, 2) ? true : (var1.isBlockIndirectlyProvidingPowerTo(var2, var3 + 1, var4 + 1, 3) ? true : (var1.isBlockIndirectlyProvidingPowerTo(var2 - 1, var3 + 1, var4, 4) ? true : var1.isBlockIndirectlyProvidingPowerTo(var2 + 1, var3 + 1, var4, 5))))))))))); + } + + public void playBlock(World var1, int var2, int var3, int var4, int var5, int var6) { + this.field_31048_b = true; + if(var5 == 0) { + if(this.func_31047_i(var1, var2, var3, var4, var6)) { + var1.setBlockMetadataWithNotify(var2, var3, var4, var6 | 8); + var1.playSoundEffect((double)var2 + 0.5D, (double)var3 + 0.5D, (double)var4 + 0.5D, "tile.piston.out", 0.5F, var1.rand.nextFloat() * 0.25F + 0.6F); + } + } else if(var5 == 1) { + TileEntity var8 = var1.getBlockTileEntity(var2 + PistonBlockTextures.field_31056_b[var6], var3 + PistonBlockTextures.field_31059_c[var6], var4 + PistonBlockTextures.field_31058_d[var6]); + if(var8 != null && var8 instanceof TileEntityPiston) { + ((TileEntityPiston)var8).func_31011_l(); + } + + var1.setBlockAndMetadata(var2, var3, var4, Block.pistonMoving.blockID, var6); + var1.setBlockTileEntity(var2, var3, var4, BlockPistonMoving.func_31036_a(this.blockID, var6, var6, false, true)); + if(this.isSticky) { + int var9 = var2 + PistonBlockTextures.field_31056_b[var6] * 2; + int var10 = var3 + PistonBlockTextures.field_31059_c[var6] * 2; + int var11 = var4 + PistonBlockTextures.field_31058_d[var6] * 2; + int var12 = var1.getBlockId(var9, var10, var11); + int var13 = var1.getBlockMetadata(var9, var10, var11); + boolean var14 = false; + if(var12 == Block.pistonMoving.blockID) { + TileEntity var15 = var1.getBlockTileEntity(var9, var10, var11); + if(var15 != null && var15 instanceof TileEntityPiston) { + TileEntityPiston var16 = (TileEntityPiston)var15; + if(var16.func_31009_d() == var6 && var16.func_31015_b()) { + var16.func_31011_l(); + var12 = var16.getStoredBlockID(); + var13 = var16.getBlockMetadata(); + var14 = true; + } + } + } + + if(var14 || var12 <= 0 || !canPushBlock(var12, var1, var9, var10, var11, false) || Block.blocksList[var12].getMobilityFlag() != 0 && var12 != Block.pistonBase.blockID && var12 != Block.pistonStickyBase.blockID) { + if(!var14) { + this.field_31048_b = false; + var1.setBlockWithNotify(var2 + PistonBlockTextures.field_31056_b[var6], var3 + PistonBlockTextures.field_31059_c[var6], var4 + PistonBlockTextures.field_31058_d[var6], 0); + this.field_31048_b = true; + } + } else { + this.field_31048_b = false; + var1.setBlockWithNotify(var9, var10, var11, 0); + this.field_31048_b = true; + var2 += PistonBlockTextures.field_31056_b[var6]; + var3 += PistonBlockTextures.field_31059_c[var6]; + var4 += PistonBlockTextures.field_31058_d[var6]; + var1.setBlockAndMetadata(var2, var3, var4, Block.pistonMoving.blockID, var13); + var1.setBlockTileEntity(var2, var3, var4, BlockPistonMoving.func_31036_a(var12, var13, var6, false, false)); + } + } else { + this.field_31048_b = false; + var1.setBlockWithNotify(var2 + PistonBlockTextures.field_31056_b[var6], var3 + PistonBlockTextures.field_31059_c[var6], var4 + PistonBlockTextures.field_31058_d[var6], 0); + this.field_31048_b = true; + } + + var1.playSoundEffect((double)var2 + 0.5D, (double)var3 + 0.5D, (double)var4 + 0.5D, "tile.piston.in", 0.5F, var1.rand.nextFloat() * 0.15F + 0.6F); + } + + this.field_31048_b = false; + } + + public void setBlockBoundsBasedOnState(IBlockAccess var1, int var2, int var3, int var4) { + int var5 = var1.getBlockMetadata(var2, var3, var4); + if(isPowered(var5)) { + switch(func_31044_d(var5)) { + case 0: + this.setBlockBounds(0.0F, 0.25F, 0.0F, 1.0F, 1.0F, 1.0F); + break; + case 1: + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 12.0F / 16.0F, 1.0F); + break; + case 2: + this.setBlockBounds(0.0F, 0.0F, 0.25F, 1.0F, 1.0F, 1.0F); + break; + case 3: + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 12.0F / 16.0F); + break; + case 4: + this.setBlockBounds(0.25F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + break; + case 5: + this.setBlockBounds(0.0F, 0.0F, 0.0F, 12.0F / 16.0F, 1.0F, 1.0F); + } + } else { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + } + + } + + public void setBlockBoundsForItemRender() { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + } + + public void getCollidingBoundingBoxes(World var1, int var2, int var3, int var4, AxisAlignedBB var5, ArrayList var6) { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + super.getCollidingBoundingBoxes(var1, var2, var3, var4, var5, var6); + } + + public boolean renderAsNormalBlock() { + return false; + } + + public static int func_31044_d(int var0) { + return var0 & 7; + } + + public static boolean isPowered(int var0) { + return (var0 & 8) != 0; + } + + private static int func_31039_c(World var0, int var1, int var2, int var3, EntityPlayer var4) { + if(MathHelper.abs((float)var4.posX - (float)var1) < 2.0F && MathHelper.abs((float)var4.posZ - (float)var3) < 2.0F) { + double var5 = var4.posY + 1.82D - (double)var4.yOffset; + if(var5 - (double)var2 > 2.0D) { + return 1; + } + + if((double)var2 - var5 > 0.0D) { + return 0; + } + } + + int var7 = MathHelper.floor_double((double)(var4.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; + return var7 == 0 ? 2 : (var7 == 1 ? 5 : (var7 == 2 ? 3 : (var7 == 3 ? 4 : 0))); + } + + private static boolean canPushBlock(int var0, World var1, int var2, int var3, int var4, boolean var5) { + if(var0 == Block.obsidian.blockID) { + return false; + } else { + if(var0 != Block.pistonBase.blockID && var0 != Block.pistonStickyBase.blockID) { + if(Block.blocksList[var0].getHardness() == -1.0F) { + return false; + } + + if(Block.blocksList[var0].getMobilityFlag() == 2) { + return false; + } + + if(!var5 && Block.blocksList[var0].getMobilityFlag() == 1) { + return false; + } + } else if(isPowered(var1.getBlockMetadata(var2, var3, var4))) { + return false; + } + + TileEntity var6 = var1.getBlockTileEntity(var2, var3, var4); + return var6 == null; + } + } + + private static boolean func_31045_h(World var0, int var1, int var2, int var3, int var4) { + int var5 = var1 + PistonBlockTextures.field_31056_b[var4]; + int var6 = var2 + PistonBlockTextures.field_31059_c[var4]; + int var7 = var3 + PistonBlockTextures.field_31058_d[var4]; + int var8 = 0; + + while(true) { + if(var8 < 13) { + if(var6 <= 0 || var6 >= 127) { + return false; + } + + int var9 = var0.getBlockId(var5, var6, var7); + if(var9 != 0) { + if(!canPushBlock(var9, var0, var5, var6, var7, true)) { + return false; + } + + if(Block.blocksList[var9].getMobilityFlag() != 1) { + if(var8 == 12) { + return false; + } + + var5 += PistonBlockTextures.field_31056_b[var4]; + var6 += PistonBlockTextures.field_31059_c[var4]; + var7 += PistonBlockTextures.field_31058_d[var4]; + ++var8; + continue; + } + } + } + + return true; + } + } + + private boolean func_31047_i(World var1, int var2, int var3, int var4, int var5) { + int var6 = var2 + PistonBlockTextures.field_31056_b[var5]; + int var7 = var3 + PistonBlockTextures.field_31059_c[var5]; + int var8 = var4 + PistonBlockTextures.field_31058_d[var5]; + int var9 = 0; + + while(true) { + int var10; + if(var9 < 13) { + if(var7 <= 0 || var7 >= 127) { + return false; + } + + var10 = var1.getBlockId(var6, var7, var8); + if(var10 != 0) { + if(!canPushBlock(var10, var1, var6, var7, var8, true)) { + return false; + } + + if(Block.blocksList[var10].getMobilityFlag() != 1) { + if(var9 == 12) { + return false; + } + + var6 += PistonBlockTextures.field_31056_b[var5]; + var7 += PistonBlockTextures.field_31059_c[var5]; + var8 += PistonBlockTextures.field_31058_d[var5]; + ++var9; + continue; + } + + Block.blocksList[var10].dropBlockAsItem(var1, var6, var7, var8, var1.getBlockMetadata(var6, var7, var8)); + var1.setBlockWithNotify(var6, var7, var8, 0); + } + } + + while(var6 != var2 || var7 != var3 || var8 != var4) { + var9 = var6 - PistonBlockTextures.field_31056_b[var5]; + var10 = var7 - PistonBlockTextures.field_31059_c[var5]; + int var11 = var8 - PistonBlockTextures.field_31058_d[var5]; + int var12 = var1.getBlockId(var9, var10, var11); + int var13 = var1.getBlockMetadata(var9, var10, var11); + if(var12 == this.blockID && var9 == var2 && var10 == var3 && var11 == var4) { + var1.setBlockAndMetadata(var6, var7, var8, Block.pistonMoving.blockID, var5 | (this.isSticky ? 8 : 0)); + var1.setBlockTileEntity(var6, var7, var8, BlockPistonMoving.func_31036_a(Block.pistonExtension.blockID, var5 | (this.isSticky ? 8 : 0), var5, true, false)); + } else { + var1.setBlockAndMetadata(var6, var7, var8, Block.pistonMoving.blockID, var13); + var1.setBlockTileEntity(var6, var7, var8, BlockPistonMoving.func_31036_a(var12, var13, var5, true, false)); + } + + var6 = var9; + var7 = var10; + var8 = var11; + } + + return true; + } + } +} diff --git a/src/net/minecraft/src/BlockPistonExtension.java b/src/net/minecraft/src/BlockPistonExtension.java new file mode 100644 index 0000000..d18ba09 --- /dev/null +++ b/src/net/minecraft/src/BlockPistonExtension.java @@ -0,0 +1,151 @@ +package net.minecraft.src; + +import java.util.ArrayList; +import java.util.Random; + +public class BlockPistonExtension extends Block { + private int field_31053_a = -1; + + public BlockPistonExtension(int var1, int var2) { + super(var1, var2, Material.field_31067_B); + this.setStepSound(soundStoneFootstep); + this.setHardness(0.5F); + } + + public void func_31052_a_(int var1) { + this.field_31053_a = var1; + } + + public void func_31051_a() { + this.field_31053_a = -1; + } + + public void onBlockRemoval(World var1, int var2, int var3, int var4) { + super.onBlockRemoval(var1, var2, var3, var4); + int var5 = var1.getBlockMetadata(var2, var3, var4); + int var6 = PistonBlockTextures.field_31057_a[func_31050_c(var5)]; + var2 += PistonBlockTextures.field_31056_b[var6]; + var3 += PistonBlockTextures.field_31059_c[var6]; + var4 += PistonBlockTextures.field_31058_d[var6]; + int var7 = var1.getBlockId(var2, var3, var4); + if(var7 == Block.pistonBase.blockID || var7 == Block.pistonStickyBase.blockID) { + var5 = var1.getBlockMetadata(var2, var3, var4); + if(BlockPistonBase.isPowered(var5)) { + Block.blocksList[var7].dropBlockAsItem(var1, var2, var3, var4, var5); + var1.setBlockWithNotify(var2, var3, var4, 0); + } + } + + } + + public int getBlockTextureFromSideAndMetadata(int var1, int var2) { + int var3 = func_31050_c(var2); + return var1 == var3 ? (this.field_31053_a >= 0 ? this.field_31053_a : ((var2 & 8) != 0 ? this.blockIndexInTexture - 1 : this.blockIndexInTexture)) : (var1 == PistonBlockTextures.field_31057_a[var3] ? 107 : 108); + } + + public int getRenderType() { + return 17; + } + + public boolean isOpaqueCube() { + return false; + } + + public boolean renderAsNormalBlock() { + return false; + } + + public boolean canPlaceBlockAt(World var1, int var2, int var3, int var4) { + return false; + } + + public boolean canPlaceBlockOnSide(World var1, int var2, int var3, int var4, int var5) { + return false; + } + + public int quantityDropped(Random var1) { + return 0; + } + + public void getCollidingBoundingBoxes(World var1, int var2, int var3, int var4, AxisAlignedBB var5, ArrayList var6) { + int var7 = var1.getBlockMetadata(var2, var3, var4); + switch(func_31050_c(var7)) { + case 0: + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.25F, 1.0F); + super.getCollidingBoundingBoxes(var1, var2, var3, var4, var5, var6); + this.setBlockBounds(6.0F / 16.0F, 0.25F, 6.0F / 16.0F, 10.0F / 16.0F, 1.0F, 10.0F / 16.0F); + super.getCollidingBoundingBoxes(var1, var2, var3, var4, var5, var6); + break; + case 1: + this.setBlockBounds(0.0F, 12.0F / 16.0F, 0.0F, 1.0F, 1.0F, 1.0F); + super.getCollidingBoundingBoxes(var1, var2, var3, var4, var5, var6); + this.setBlockBounds(6.0F / 16.0F, 0.0F, 6.0F / 16.0F, 10.0F / 16.0F, 12.0F / 16.0F, 10.0F / 16.0F); + super.getCollidingBoundingBoxes(var1, var2, var3, var4, var5, var6); + break; + case 2: + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 0.25F); + super.getCollidingBoundingBoxes(var1, var2, var3, var4, var5, var6); + this.setBlockBounds(0.25F, 6.0F / 16.0F, 0.25F, 12.0F / 16.0F, 10.0F / 16.0F, 1.0F); + super.getCollidingBoundingBoxes(var1, var2, var3, var4, var5, var6); + break; + case 3: + this.setBlockBounds(0.0F, 0.0F, 12.0F / 16.0F, 1.0F, 1.0F, 1.0F); + super.getCollidingBoundingBoxes(var1, var2, var3, var4, var5, var6); + this.setBlockBounds(0.25F, 6.0F / 16.0F, 0.0F, 12.0F / 16.0F, 10.0F / 16.0F, 12.0F / 16.0F); + super.getCollidingBoundingBoxes(var1, var2, var3, var4, var5, var6); + break; + case 4: + this.setBlockBounds(0.0F, 0.0F, 0.0F, 0.25F, 1.0F, 1.0F); + super.getCollidingBoundingBoxes(var1, var2, var3, var4, var5, var6); + this.setBlockBounds(6.0F / 16.0F, 0.25F, 0.25F, 10.0F / 16.0F, 12.0F / 16.0F, 1.0F); + super.getCollidingBoundingBoxes(var1, var2, var3, var4, var5, var6); + break; + case 5: + this.setBlockBounds(12.0F / 16.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + super.getCollidingBoundingBoxes(var1, var2, var3, var4, var5, var6); + this.setBlockBounds(0.0F, 6.0F / 16.0F, 0.25F, 12.0F / 16.0F, 10.0F / 16.0F, 12.0F / 16.0F); + super.getCollidingBoundingBoxes(var1, var2, var3, var4, var5, var6); + } + + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + } + + public void setBlockBoundsBasedOnState(IBlockAccess var1, int var2, int var3, int var4) { + int var5 = var1.getBlockMetadata(var2, var3, var4); + switch(func_31050_c(var5)) { + case 0: + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.25F, 1.0F); + break; + case 1: + this.setBlockBounds(0.0F, 12.0F / 16.0F, 0.0F, 1.0F, 1.0F, 1.0F); + break; + case 2: + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 0.25F); + break; + case 3: + this.setBlockBounds(0.0F, 0.0F, 12.0F / 16.0F, 1.0F, 1.0F, 1.0F); + break; + case 4: + this.setBlockBounds(0.0F, 0.0F, 0.0F, 0.25F, 1.0F, 1.0F); + break; + case 5: + this.setBlockBounds(12.0F / 16.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + } + + } + + public void onNeighborBlockChange(World var1, int var2, int var3, int var4, int var5) { + int var6 = func_31050_c(var1.getBlockMetadata(var2, var3, var4)); + int var7 = var1.getBlockId(var2 - PistonBlockTextures.field_31056_b[var6], var3 - PistonBlockTextures.field_31059_c[var6], var4 - PistonBlockTextures.field_31058_d[var6]); + if(var7 != Block.pistonBase.blockID && var7 != Block.pistonStickyBase.blockID) { + var1.setBlockWithNotify(var2, var3, var4, 0); + } else { + Block.blocksList[var7].onNeighborBlockChange(var1, var2 - PistonBlockTextures.field_31056_b[var6], var3 - PistonBlockTextures.field_31059_c[var6], var4 - PistonBlockTextures.field_31058_d[var6], var5); + } + + } + + public static int func_31050_c(int var0) { + return var0 & 7; + } +} diff --git a/src/net/minecraft/src/BlockPistonMoving.java b/src/net/minecraft/src/BlockPistonMoving.java new file mode 100644 index 0000000..74235bb --- /dev/null +++ b/src/net/minecraft/src/BlockPistonMoving.java @@ -0,0 +1,142 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockPistonMoving extends BlockContainer { + public BlockPistonMoving(int var1) { + super(var1, Material.field_31067_B); + this.setHardness(-1.0F); + } + + protected TileEntity getBlockEntity() { + return null; + } + + public void onBlockAdded(World var1, int var2, int var3, int var4) { + } + + public void onBlockRemoval(World var1, int var2, int var3, int var4) { + TileEntity var5 = var1.getBlockTileEntity(var2, var3, var4); + if(var5 != null && var5 instanceof TileEntityPiston) { + ((TileEntityPiston)var5).func_31011_l(); + } else { + super.onBlockRemoval(var1, var2, var3, var4); + } + + } + + public boolean canPlaceBlockAt(World var1, int var2, int var3, int var4) { + return false; + } + + public boolean canPlaceBlockOnSide(World var1, int var2, int var3, int var4, int var5) { + return false; + } + + public int getRenderType() { + return -1; + } + + public boolean isOpaqueCube() { + return false; + } + + public boolean renderAsNormalBlock() { + return false; + } + + public boolean blockActivated(World var1, int var2, int var3, int var4, EntityPlayer var5) { + if(!var1.multiplayerWorld && var1.getBlockTileEntity(var2, var3, var4) == null) { + var1.setBlockWithNotify(var2, var3, var4, 0); + return true; + } else { + return false; + } + } + + public int idDropped(int var1, Random var2) { + return 0; + } + + public void dropBlockAsItemWithChance(World var1, int var2, int var3, int var4, int var5, float var6) { + if(!var1.multiplayerWorld) { + TileEntityPiston var7 = this.func_31034_c(var1, var2, var3, var4); + if(var7 != null) { + Block.blocksList[var7.getStoredBlockID()].dropBlockAsItem(var1, var2, var3, var4, var7.getBlockMetadata()); + } + } + } + + public void onNeighborBlockChange(World var1, int var2, int var3, int var4, int var5) { + if(!var1.multiplayerWorld && var1.getBlockTileEntity(var2, var3, var4) == null) { + } + + } + + public static TileEntity func_31036_a(int var0, int var1, int var2, boolean var3, boolean var4) { + return new TileEntityPiston(var0, var1, var2, var3, var4); + } + + public AxisAlignedBB getCollisionBoundingBoxFromPool(World var1, int var2, int var3, int var4) { + TileEntityPiston var5 = this.func_31034_c(var1, var2, var3, var4); + if(var5 == null) { + return null; + } else { + float var6 = var5.func_31008_a(0.0F); + if(var5.func_31015_b()) { + var6 = 1.0F - var6; + } + + return this.func_31035_a(var1, var2, var3, var4, var5.getStoredBlockID(), var6, var5.func_31009_d()); + } + } + + public void setBlockBoundsBasedOnState(IBlockAccess var1, int var2, int var3, int var4) { + TileEntityPiston var5 = this.func_31034_c(var1, var2, var3, var4); + if(var5 != null) { + Block var6 = Block.blocksList[var5.getStoredBlockID()]; + if(var6 == null || var6 == this) { + return; + } + + var6.setBlockBoundsBasedOnState(var1, var2, var3, var4); + float var7 = var5.func_31008_a(0.0F); + if(var5.func_31015_b()) { + var7 = 1.0F - var7; + } + + int var8 = var5.func_31009_d(); + this.minX = var6.minX - (double)((float)PistonBlockTextures.field_31056_b[var8] * var7); + this.minY = var6.minY - (double)((float)PistonBlockTextures.field_31059_c[var8] * var7); + this.minZ = var6.minZ - (double)((float)PistonBlockTextures.field_31058_d[var8] * var7); + this.maxX = var6.maxX - (double)((float)PistonBlockTextures.field_31056_b[var8] * var7); + this.maxY = var6.maxY - (double)((float)PistonBlockTextures.field_31059_c[var8] * var7); + this.maxZ = var6.maxZ - (double)((float)PistonBlockTextures.field_31058_d[var8] * var7); + } + + } + + public AxisAlignedBB func_31035_a(World var1, int var2, int var3, int var4, int var5, float var6, int var7) { + if(var5 != 0 && var5 != this.blockID) { + AxisAlignedBB var8 = Block.blocksList[var5].getCollisionBoundingBoxFromPool(var1, var2, var3, var4); + if(var8 == null) { + return null; + } else { + var8.minX -= (double)((float)PistonBlockTextures.field_31056_b[var7] * var6); + var8.maxX -= (double)((float)PistonBlockTextures.field_31056_b[var7] * var6); + var8.minY -= (double)((float)PistonBlockTextures.field_31059_c[var7] * var6); + var8.maxY -= (double)((float)PistonBlockTextures.field_31059_c[var7] * var6); + var8.minZ -= (double)((float)PistonBlockTextures.field_31058_d[var7] * var6); + var8.maxZ -= (double)((float)PistonBlockTextures.field_31058_d[var7] * var6); + return var8; + } + } else { + return null; + } + } + + private TileEntityPiston func_31034_c(IBlockAccess var1, int var2, int var3, int var4) { + TileEntity var5 = var1.getBlockTileEntity(var2, var3, var4); + return var5 != null && var5 instanceof TileEntityPiston ? (TileEntityPiston)var5 : null; + } +} diff --git a/src/net/minecraft/src/BlockPortal.java b/src/net/minecraft/src/BlockPortal.java new file mode 100644 index 0000000..4e93d3c --- /dev/null +++ b/src/net/minecraft/src/BlockPortal.java @@ -0,0 +1,177 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockPortal extends BlockBreakable { + public BlockPortal(int var1, int var2) { + super(var1, var2, Material.portal, false); + } + + public AxisAlignedBB getCollisionBoundingBoxFromPool(World var1, int var2, int var3, int var4) { + return null; + } + + public void setBlockBoundsBasedOnState(IBlockAccess var1, int var2, int var3, int var4) { + float var5; + float var6; + if(var1.getBlockId(var2 - 1, var3, var4) != this.blockID && var1.getBlockId(var2 + 1, var3, var4) != this.blockID) { + var5 = 2.0F / 16.0F; + var6 = 0.5F; + this.setBlockBounds(0.5F - var5, 0.0F, 0.5F - var6, 0.5F + var5, 1.0F, 0.5F + var6); + } else { + var5 = 0.5F; + var6 = 2.0F / 16.0F; + this.setBlockBounds(0.5F - var5, 0.0F, 0.5F - var6, 0.5F + var5, 1.0F, 0.5F + var6); + } + + } + + public boolean isOpaqueCube() { + return false; + } + + public boolean renderAsNormalBlock() { + return false; + } + + public boolean tryToCreatePortal(World var1, int var2, int var3, int var4) { + byte var5 = 0; + byte var6 = 0; + if(var1.getBlockId(var2 - 1, var3, var4) == Block.obsidian.blockID || var1.getBlockId(var2 + 1, var3, var4) == Block.obsidian.blockID) { + var5 = 1; + } + + if(var1.getBlockId(var2, var3, var4 - 1) == Block.obsidian.blockID || var1.getBlockId(var2, var3, var4 + 1) == Block.obsidian.blockID) { + var6 = 1; + } + + if(var5 == var6) { + return false; + } else { + if(var1.getBlockId(var2 - var5, var3, var4 - var6) == 0) { + var2 -= var5; + var4 -= var6; + } + + int var7; + int var8; + for(var7 = -1; var7 <= 2; ++var7) { + for(var8 = -1; var8 <= 3; ++var8) { + boolean var9 = var7 == -1 || var7 == 2 || var8 == -1 || var8 == 3; + if(var7 != -1 && var7 != 2 || var8 != -1 && var8 != 3) { + int var10 = var1.getBlockId(var2 + var5 * var7, var3 + var8, var4 + var6 * var7); + if(var9) { + if(var10 != Block.obsidian.blockID) { + return false; + } + } else if(var10 != 0 && var10 != Block.fire.blockID) { + return false; + } + } + } + } + + var1.editingBlocks = true; + + for(var7 = 0; var7 < 2; ++var7) { + for(var8 = 0; var8 < 3; ++var8) { + var1.setBlockWithNotify(var2 + var5 * var7, var3 + var8, var4 + var6 * var7, Block.portal.blockID); + } + } + + var1.editingBlocks = false; + return true; + } + } + + public void onNeighborBlockChange(World var1, int var2, int var3, int var4, int var5) { + byte var6 = 0; + byte var7 = 1; + if(var1.getBlockId(var2 - 1, var3, var4) == this.blockID || var1.getBlockId(var2 + 1, var3, var4) == this.blockID) { + var6 = 1; + var7 = 0; + } + + int var8; + for(var8 = var3; var1.getBlockId(var2, var8 - 1, var4) == this.blockID; --var8) { + } + + if(var1.getBlockId(var2, var8 - 1, var4) != Block.obsidian.blockID) { + var1.setBlockWithNotify(var2, var3, var4, 0); + } else { + int var9; + for(var9 = 1; var9 < 4 && var1.getBlockId(var2, var8 + var9, var4) == this.blockID; ++var9) { + } + + if(var9 == 3 && var1.getBlockId(var2, var8 + var9, var4) == Block.obsidian.blockID) { + boolean var10 = var1.getBlockId(var2 - 1, var3, var4) == this.blockID || var1.getBlockId(var2 + 1, var3, var4) == this.blockID; + boolean var11 = var1.getBlockId(var2, var3, var4 - 1) == this.blockID || var1.getBlockId(var2, var3, var4 + 1) == this.blockID; + if(var10 && var11) { + var1.setBlockWithNotify(var2, var3, var4, 0); + } else if((var1.getBlockId(var2 + var6, var3, var4 + var7) != Block.obsidian.blockID || var1.getBlockId(var2 - var6, var3, var4 - var7) != this.blockID) && (var1.getBlockId(var2 - var6, var3, var4 - var7) != Block.obsidian.blockID || var1.getBlockId(var2 + var6, var3, var4 + var7) != this.blockID)) { + var1.setBlockWithNotify(var2, var3, var4, 0); + } + } else { + var1.setBlockWithNotify(var2, var3, var4, 0); + } + } + } + + public boolean shouldSideBeRendered(IBlockAccess var1, int var2, int var3, int var4, int var5) { + if(var1.getBlockId(var2, var3, var4) == this.blockID) { + return false; + } else { + boolean var6 = var1.getBlockId(var2 - 1, var3, var4) == this.blockID && var1.getBlockId(var2 - 2, var3, var4) != this.blockID; + boolean var7 = var1.getBlockId(var2 + 1, var3, var4) == this.blockID && var1.getBlockId(var2 + 2, var3, var4) != this.blockID; + boolean var8 = var1.getBlockId(var2, var3, var4 - 1) == this.blockID && var1.getBlockId(var2, var3, var4 - 2) != this.blockID; + boolean var9 = var1.getBlockId(var2, var3, var4 + 1) == this.blockID && var1.getBlockId(var2, var3, var4 + 2) != this.blockID; + boolean var10 = var6 || var7; + boolean var11 = var8 || var9; + return var10 && var5 == 4 ? true : (var10 && var5 == 5 ? true : (var11 && var5 == 2 ? true : var11 && var5 == 3)); + } + } + + public int quantityDropped(Random var1) { + return 0; + } + + public int getRenderBlockPass() { + return 1; + } + + public void onEntityCollidedWithBlock(World var1, int var2, int var3, int var4, Entity var5) { + if(var5.ridingEntity == null && var5.riddenByEntity == null) { + var5.setInPortal(); + } + + } + + public void randomDisplayTick(World var1, int var2, int var3, int var4, Random var5) { + if(var5.nextInt(100) == 0) { + var1.playSoundEffect((double)var2 + 0.5D, (double)var3 + 0.5D, (double)var4 + 0.5D, "portal.portal", 1.0F, var5.nextFloat() * 0.4F + 0.8F); + } + + for(int var6 = 0; var6 < 4; ++var6) { + double var7 = (double)((float)var2 + var5.nextFloat()); + double var9 = (double)((float)var3 + var5.nextFloat()); + double var11 = (double)((float)var4 + var5.nextFloat()); + double var13 = 0.0D; + double var15 = 0.0D; + double var17 = 0.0D; + int var19 = var5.nextInt(2) * 2 - 1; + var13 = ((double)var5.nextFloat() - 0.5D) * 0.5D; + var15 = ((double)var5.nextFloat() - 0.5D) * 0.5D; + var17 = ((double)var5.nextFloat() - 0.5D) * 0.5D; + if(var1.getBlockId(var2 - 1, var3, var4) != this.blockID && var1.getBlockId(var2 + 1, var3, var4) != this.blockID) { + var7 = (double)var2 + 0.5D + 0.25D * (double)var19; + var13 = (double)(var5.nextFloat() * 2.0F * (float)var19); + } else { + var11 = (double)var4 + 0.5D + 0.25D * (double)var19; + var17 = (double)(var5.nextFloat() * 2.0F * (float)var19); + } + + var1.spawnParticle("portal", var7, var9, var11, var13, var15, var17); + } + + } +} diff --git a/src/net/minecraft/src/BlockPressurePlate.java b/src/net/minecraft/src/BlockPressurePlate.java new file mode 100644 index 0000000..460f084 --- /dev/null +++ b/src/net/minecraft/src/BlockPressurePlate.java @@ -0,0 +1,155 @@ +package net.minecraft.src; + +import java.util.List; +import java.util.Random; + +public class BlockPressurePlate extends Block { + private EnumMobType triggerMobType; + + protected BlockPressurePlate(int var1, int var2, EnumMobType var3, Material var4) { + super(var1, var2, var4); + this.triggerMobType = var3; + this.setTickOnLoad(true); + float var5 = 1.0F / 16.0F; + this.setBlockBounds(var5, 0.0F, var5, 1.0F - var5, 0.03125F, 1.0F - var5); + } + + public int tickRate() { + return 20; + } + + public AxisAlignedBB getCollisionBoundingBoxFromPool(World var1, int var2, int var3, int var4) { + return null; + } + + public boolean isOpaqueCube() { + return false; + } + + public boolean renderAsNormalBlock() { + return false; + } + + public boolean canPlaceBlockAt(World var1, int var2, int var3, int var4) { + return var1.isBlockNormalCube(var2, var3 - 1, var4); + } + + public void onBlockAdded(World var1, int var2, int var3, int var4) { + } + + public void onNeighborBlockChange(World var1, int var2, int var3, int var4, int var5) { + boolean var6 = false; + if(!var1.isBlockNormalCube(var2, var3 - 1, var4)) { + var6 = true; + } + + if(var6) { + this.dropBlockAsItem(var1, var2, var3, var4, var1.getBlockMetadata(var2, var3, var4)); + var1.setBlockWithNotify(var2, var3, var4, 0); + } + + } + + public void updateTick(World var1, int var2, int var3, int var4, Random var5) { + if(!var1.multiplayerWorld) { + if(var1.getBlockMetadata(var2, var3, var4) != 0) { + this.setStateIfMobInteractsWithPlate(var1, var2, var3, var4); + } + } + } + + public void onEntityCollidedWithBlock(World var1, int var2, int var3, int var4, Entity var5) { + if(!var1.multiplayerWorld) { + if(var1.getBlockMetadata(var2, var3, var4) != 1) { + this.setStateIfMobInteractsWithPlate(var1, var2, var3, var4); + } + } + } + + private void setStateIfMobInteractsWithPlate(World var1, int var2, int var3, int var4) { + boolean var5 = var1.getBlockMetadata(var2, var3, var4) == 1; + boolean var6 = false; + float var7 = 2.0F / 16.0F; + List var8 = null; + if(this.triggerMobType == EnumMobType.everything) { + var8 = var1.getEntitiesWithinAABBExcludingEntity((Entity)null, AxisAlignedBB.getBoundingBoxFromPool((double)((float)var2 + var7), (double)var3, (double)((float)var4 + var7), (double)((float)(var2 + 1) - var7), (double)var3 + 0.25D, (double)((float)(var4 + 1) - var7))); + } + + if(this.triggerMobType == EnumMobType.mobs) { + var8 = var1.getEntitiesWithinAABB(EntityLiving.class, AxisAlignedBB.getBoundingBoxFromPool((double)((float)var2 + var7), (double)var3, (double)((float)var4 + var7), (double)((float)(var2 + 1) - var7), (double)var3 + 0.25D, (double)((float)(var4 + 1) - var7))); + } + + if(this.triggerMobType == EnumMobType.players) { + var8 = var1.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBoxFromPool((double)((float)var2 + var7), (double)var3, (double)((float)var4 + var7), (double)((float)(var2 + 1) - var7), (double)var3 + 0.25D, (double)((float)(var4 + 1) - var7))); + } + + if(var8.size() > 0) { + var6 = true; + } + + if(var6 && !var5) { + var1.setBlockMetadataWithNotify(var2, var3, var4, 1); + var1.notifyBlocksOfNeighborChange(var2, var3, var4, this.blockID); + var1.notifyBlocksOfNeighborChange(var2, var3 - 1, var4, this.blockID); + var1.markBlocksDirty(var2, var3, var4, var2, var3, var4); + var1.playSoundEffect((double)var2 + 0.5D, (double)var3 + 0.1D, (double)var4 + 0.5D, "random.click", 0.3F, 0.6F); + } + + if(!var6 && var5) { + var1.setBlockMetadataWithNotify(var2, var3, var4, 0); + var1.notifyBlocksOfNeighborChange(var2, var3, var4, this.blockID); + var1.notifyBlocksOfNeighborChange(var2, var3 - 1, var4, this.blockID); + var1.markBlocksDirty(var2, var3, var4, var2, var3, var4); + var1.playSoundEffect((double)var2 + 0.5D, (double)var3 + 0.1D, (double)var4 + 0.5D, "random.click", 0.3F, 0.5F); + } + + if(var6) { + var1.scheduleBlockUpdate(var2, var3, var4, this.blockID, this.tickRate()); + } + + } + + public void onBlockRemoval(World var1, int var2, int var3, int var4) { + int var5 = var1.getBlockMetadata(var2, var3, var4); + if(var5 > 0) { + var1.notifyBlocksOfNeighborChange(var2, var3, var4, this.blockID); + var1.notifyBlocksOfNeighborChange(var2, var3 - 1, var4, this.blockID); + } + + super.onBlockRemoval(var1, var2, var3, var4); + } + + public void setBlockBoundsBasedOnState(IBlockAccess var1, int var2, int var3, int var4) { + boolean var5 = var1.getBlockMetadata(var2, var3, var4) == 1; + float var6 = 1.0F / 16.0F; + if(var5) { + this.setBlockBounds(var6, 0.0F, var6, 1.0F - var6, 0.03125F, 1.0F - var6); + } else { + this.setBlockBounds(var6, 0.0F, var6, 1.0F - var6, 1.0F / 16.0F, 1.0F - var6); + } + + } + + public boolean isPoweringTo(IBlockAccess var1, int var2, int var3, int var4, int var5) { + return var1.getBlockMetadata(var2, var3, var4) > 0; + } + + public boolean isIndirectlyPoweringTo(World var1, int var2, int var3, int var4, int var5) { + return var1.getBlockMetadata(var2, var3, var4) == 0 ? false : var5 == 1; + } + + public boolean canProvidePower() { + return true; + } + + public void setBlockBoundsForItemRender() { + float var1 = 0.5F; + float var2 = 2.0F / 16.0F; + float var3 = 0.5F; + this.setBlockBounds(0.5F - var1, 0.5F - var2, 0.5F - var3, 0.5F + var1, 0.5F + var2, 0.5F + var3); + } + + public int getMobilityFlag() { + return 1; + } +} diff --git a/src/net/minecraft/src/BlockPumpkin.java b/src/net/minecraft/src/BlockPumpkin.java new file mode 100644 index 0000000..57ca0b9 --- /dev/null +++ b/src/net/minecraft/src/BlockPumpkin.java @@ -0,0 +1,45 @@ +package net.minecraft.src; + +public class BlockPumpkin extends Block { + private boolean blockType; + + protected BlockPumpkin(int var1, int var2, boolean var3) { + super(var1, Material.pumpkin); + this.blockIndexInTexture = var2; + this.setTickOnLoad(true); + this.blockType = var3; + } + + public int getBlockTextureFromSideAndMetadata(int var1, int var2) { + if(var1 == 1) { + return this.blockIndexInTexture; + } else if(var1 == 0) { + return this.blockIndexInTexture; + } else { + int var3 = this.blockIndexInTexture + 1 + 16; + if(this.blockType) { + ++var3; + } + + return var2 == 2 && var1 == 2 ? var3 : (var2 == 3 && var1 == 5 ? var3 : (var2 == 0 && var1 == 3 ? var3 : (var2 == 1 && var1 == 4 ? var3 : this.blockIndexInTexture + 16))); + } + } + + public int getBlockTextureFromSide(int var1) { + return var1 == 1 ? this.blockIndexInTexture : (var1 == 0 ? this.blockIndexInTexture : (var1 == 3 ? this.blockIndexInTexture + 1 + 16 : this.blockIndexInTexture + 16)); + } + + public void onBlockAdded(World var1, int var2, int var3, int var4) { + super.onBlockAdded(var1, var2, var3, var4); + } + + public boolean canPlaceBlockAt(World var1, int var2, int var3, int var4) { + int var5 = var1.getBlockId(var2, var3, var4); + return (var5 == 0 || Block.blocksList[var5].blockMaterial.getIsGroundCover()) && var1.isBlockNormalCube(var2, var3 - 1, var4); + } + + public void onBlockPlacedBy(World var1, int var2, int var3, int var4, EntityLiving var5) { + int var6 = MathHelper.floor_double((double)(var5.rotationYaw * 4.0F / 360.0F) + 2.5D) & 3; + var1.setBlockMetadataWithNotify(var2, var3, var4, var6); + } +} diff --git a/src/net/minecraft/src/BlockRail.java b/src/net/minecraft/src/BlockRail.java new file mode 100644 index 0000000..677f470 --- /dev/null +++ b/src/net/minecraft/src/BlockRail.java @@ -0,0 +1,250 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockRail extends Block { + private final boolean isPowered; + + public static final boolean isRailBlockAt(World var0, int var1, int var2, int var3) { + int var4 = var0.getBlockId(var1, var2, var3); + return var4 == Block.rail.blockID || var4 == Block.railPowered.blockID || var4 == Block.railDetector.blockID; + } + + public static final boolean isRailBlock(int var0) { + return var0 == Block.rail.blockID || var0 == Block.railPowered.blockID || var0 == Block.railDetector.blockID; + } + + protected BlockRail(int var1, int var2, boolean var3) { + super(var1, var2, Material.circuits); + this.isPowered = var3; + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 2.0F / 16.0F, 1.0F); + } + + public boolean getIsPowered() { + return this.isPowered; + } + + public AxisAlignedBB getCollisionBoundingBoxFromPool(World var1, int var2, int var3, int var4) { + return null; + } + + public boolean isOpaqueCube() { + return false; + } + + public MovingObjectPosition collisionRayTrace(World var1, int var2, int var3, int var4, Vec3D var5, Vec3D var6) { + this.setBlockBoundsBasedOnState(var1, var2, var3, var4); + return super.collisionRayTrace(var1, var2, var3, var4, var5, var6); + } + + public void setBlockBoundsBasedOnState(IBlockAccess var1, int var2, int var3, int var4) { + int var5 = var1.getBlockMetadata(var2, var3, var4); + if(var5 >= 2 && var5 <= 5) { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 10.0F / 16.0F, 1.0F); + } else { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 2.0F / 16.0F, 1.0F); + } + + } + + public int getBlockTextureFromSideAndMetadata(int var1, int var2) { + if(this.isPowered) { + if(this.blockID == Block.railPowered.blockID && (var2 & 8) == 0) { + return this.blockIndexInTexture - 16; + } + } else if(var2 >= 6) { + return this.blockIndexInTexture - 16; + } + + return this.blockIndexInTexture; + } + + public boolean renderAsNormalBlock() { + return false; + } + + public int getRenderType() { + return 9; + } + + public int quantityDropped(Random var1) { + return 1; + } + + public boolean canPlaceBlockAt(World var1, int var2, int var3, int var4) { + return var1.isBlockNormalCube(var2, var3 - 1, var4); + } + + public void onBlockAdded(World var1, int var2, int var3, int var4) { + if(!var1.multiplayerWorld) { + this.func_4031_h(var1, var2, var3, var4, true); + } + + } + + public void onNeighborBlockChange(World var1, int var2, int var3, int var4, int var5) { + if(!var1.multiplayerWorld) { + int var6 = var1.getBlockMetadata(var2, var3, var4); + int var7 = var6; + if(this.isPowered) { + var7 = var6 & 7; + } + + boolean var8 = false; + if(!var1.isBlockNormalCube(var2, var3 - 1, var4)) { + var8 = true; + } + + if(var7 == 2 && !var1.isBlockNormalCube(var2 + 1, var3, var4)) { + var8 = true; + } + + if(var7 == 3 && !var1.isBlockNormalCube(var2 - 1, var3, var4)) { + var8 = true; + } + + if(var7 == 4 && !var1.isBlockNormalCube(var2, var3, var4 - 1)) { + var8 = true; + } + + if(var7 == 5 && !var1.isBlockNormalCube(var2, var3, var4 + 1)) { + var8 = true; + } + + if(var8) { + this.dropBlockAsItem(var1, var2, var3, var4, var1.getBlockMetadata(var2, var3, var4)); + var1.setBlockWithNotify(var2, var3, var4, 0); + } else if(this.blockID == Block.railPowered.blockID) { + boolean var9 = var1.isBlockIndirectlyGettingPowered(var2, var3, var4) || var1.isBlockIndirectlyGettingPowered(var2, var3 + 1, var4); + var9 = var9 || this.func_27044_a(var1, var2, var3, var4, var6, true, 0) || this.func_27044_a(var1, var2, var3, var4, var6, false, 0); + boolean var10 = false; + if(var9 && (var6 & 8) == 0) { + var1.setBlockMetadataWithNotify(var2, var3, var4, var7 | 8); + var10 = true; + } else if(!var9 && (var6 & 8) != 0) { + var1.setBlockMetadataWithNotify(var2, var3, var4, var7); + var10 = true; + } + + if(var10) { + var1.notifyBlocksOfNeighborChange(var2, var3 - 1, var4, this.blockID); + if(var7 == 2 || var7 == 3 || var7 == 4 || var7 == 5) { + var1.notifyBlocksOfNeighborChange(var2, var3 + 1, var4, this.blockID); + } + } + } else if(var5 > 0 && Block.blocksList[var5].canProvidePower() && !this.isPowered && RailLogic.getNAdjacentTracks(new RailLogic(this, var1, var2, var3, var4)) == 3) { + this.func_4031_h(var1, var2, var3, var4, false); + } + + } + } + + private void func_4031_h(World var1, int var2, int var3, int var4, boolean var5) { + if(!var1.multiplayerWorld) { + (new RailLogic(this, var1, var2, var3, var4)).func_792_a(var1.isBlockIndirectlyGettingPowered(var2, var3, var4), var5); + } + } + + private boolean func_27044_a(World var1, int var2, int var3, int var4, int var5, boolean var6, int var7) { + if(var7 >= 8) { + return false; + } else { + int var8 = var5 & 7; + boolean var9 = true; + switch(var8) { + case 0: + if(var6) { + ++var4; + } else { + --var4; + } + break; + case 1: + if(var6) { + --var2; + } else { + ++var2; + } + break; + case 2: + if(var6) { + --var2; + } else { + ++var2; + ++var3; + var9 = false; + } + + var8 = 1; + break; + case 3: + if(var6) { + --var2; + ++var3; + var9 = false; + } else { + ++var2; + } + + var8 = 1; + break; + case 4: + if(var6) { + ++var4; + } else { + --var4; + ++var3; + var9 = false; + } + + var8 = 0; + break; + case 5: + if(var6) { + ++var4; + ++var3; + var9 = false; + } else { + --var4; + } + + var8 = 0; + } + + return this.func_27043_a(var1, var2, var3, var4, var6, var7, var8) ? true : var9 && this.func_27043_a(var1, var2, var3 - 1, var4, var6, var7, var8); + } + } + + private boolean func_27043_a(World var1, int var2, int var3, int var4, boolean var5, int var6, int var7) { + int var8 = var1.getBlockId(var2, var3, var4); + if(var8 == Block.railPowered.blockID) { + int var9 = var1.getBlockMetadata(var2, var3, var4); + int var10 = var9 & 7; + if(var7 == 1 && (var10 == 0 || var10 == 4 || var10 == 5)) { + return false; + } + + if(var7 == 0 && (var10 == 1 || var10 == 2 || var10 == 3)) { + return false; + } + + if((var9 & 8) != 0) { + if(!var1.isBlockIndirectlyGettingPowered(var2, var3, var4) && !var1.isBlockIndirectlyGettingPowered(var2, var3 + 1, var4)) { + return this.func_27044_a(var1, var2, var3, var4, var9, var5, var6 + 1); + } + + return true; + } + } + + return false; + } + + public int getMobilityFlag() { + return 0; + } + + static boolean isPoweredBlockRail(BlockRail var0) { + return var0.isPowered; + } +} diff --git a/src/net/minecraft/src/BlockRedstoneOre.java b/src/net/minecraft/src/BlockRedstoneOre.java new file mode 100644 index 0000000..f72bcc8 --- /dev/null +++ b/src/net/minecraft/src/BlockRedstoneOre.java @@ -0,0 +1,104 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockRedstoneOre extends Block { + private boolean field_468_a; + + public BlockRedstoneOre(int var1, int var2, boolean var3) { + super(var1, var2, Material.rock); + if(var3) { + this.setTickOnLoad(true); + } + + this.field_468_a = var3; + } + + public int tickRate() { + return 30; + } + + public void onBlockClicked(World var1, int var2, int var3, int var4, EntityPlayer var5) { + this.func_320_h(var1, var2, var3, var4); + super.onBlockClicked(var1, var2, var3, var4, var5); + } + + public void onEntityWalking(World var1, int var2, int var3, int var4, Entity var5) { + this.func_320_h(var1, var2, var3, var4); + super.onEntityWalking(var1, var2, var3, var4, var5); + } + + public boolean blockActivated(World var1, int var2, int var3, int var4, EntityPlayer var5) { + this.func_320_h(var1, var2, var3, var4); + return super.blockActivated(var1, var2, var3, var4, var5); + } + + private void func_320_h(World var1, int var2, int var3, int var4) { + this.func_319_i(var1, var2, var3, var4); + if(this.blockID == Block.oreRedstone.blockID) { + var1.setBlockWithNotify(var2, var3, var4, Block.oreRedstoneGlowing.blockID); + } + + } + + public void updateTick(World var1, int var2, int var3, int var4, Random var5) { + if(this.blockID == Block.oreRedstoneGlowing.blockID) { + var1.setBlockWithNotify(var2, var3, var4, Block.oreRedstone.blockID); + } + + } + + public int idDropped(int var1, Random var2) { + return Item.redstone.shiftedIndex; + } + + public int quantityDropped(Random var1) { + return 4 + var1.nextInt(2); + } + + public void randomDisplayTick(World var1, int var2, int var3, int var4, Random var5) { + if(this.field_468_a) { + this.func_319_i(var1, var2, var3, var4); + } + + } + + private void func_319_i(World var1, int var2, int var3, int var4) { + Random var5 = var1.rand; + double var6 = 1.0D / 16.0D; + + for(int var8 = 0; var8 < 6; ++var8) { + double var9 = (double)((float)var2 + var5.nextFloat()); + double var11 = (double)((float)var3 + var5.nextFloat()); + double var13 = (double)((float)var4 + var5.nextFloat()); + if(var8 == 0 && !var1.isBlockOpaqueCube(var2, var3 + 1, var4)) { + var11 = (double)(var3 + 1) + var6; + } + + if(var8 == 1 && !var1.isBlockOpaqueCube(var2, var3 - 1, var4)) { + var11 = (double)(var3 + 0) - var6; + } + + if(var8 == 2 && !var1.isBlockOpaqueCube(var2, var3, var4 + 1)) { + var13 = (double)(var4 + 1) + var6; + } + + if(var8 == 3 && !var1.isBlockOpaqueCube(var2, var3, var4 - 1)) { + var13 = (double)(var4 + 0) - var6; + } + + if(var8 == 4 && !var1.isBlockOpaqueCube(var2 + 1, var3, var4)) { + var9 = (double)(var2 + 1) + var6; + } + + if(var8 == 5 && !var1.isBlockOpaqueCube(var2 - 1, var3, var4)) { + var9 = (double)(var2 + 0) - var6; + } + + if(var9 < (double)var2 || var9 > (double)(var2 + 1) || var11 < 0.0D || var11 > (double)(var3 + 1) || var13 < (double)var4 || var13 > (double)(var4 + 1)) { + var1.spawnParticle("reddust", var9, var11, var13, 0.0D, 0.0D, 0.0D); + } + } + + } +} diff --git a/src/net/minecraft/src/BlockRedstoneRepeater.java b/src/net/minecraft/src/BlockRedstoneRepeater.java new file mode 100644 index 0000000..a65198e --- /dev/null +++ b/src/net/minecraft/src/BlockRedstoneRepeater.java @@ -0,0 +1,186 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockRedstoneRepeater extends Block { + public static final double[] field_22024_a = new double[]{-0.0625D, 1.0D / 16.0D, 0.1875D, 0.3125D}; + private static final int[] field_22023_b = new int[]{1, 2, 3, 4}; + private final boolean isRepeaterPowered; + + protected BlockRedstoneRepeater(int var1, boolean var2) { + super(var1, 6, Material.circuits); + this.isRepeaterPowered = var2; + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 2.0F / 16.0F, 1.0F); + } + + public boolean renderAsNormalBlock() { + return false; + } + + public boolean canPlaceBlockAt(World var1, int var2, int var3, int var4) { + return !var1.isBlockNormalCube(var2, var3 - 1, var4) ? false : super.canPlaceBlockAt(var1, var2, var3, var4); + } + + public boolean canBlockStay(World var1, int var2, int var3, int var4) { + return !var1.isBlockNormalCube(var2, var3 - 1, var4) ? false : super.canBlockStay(var1, var2, var3, var4); + } + + public void updateTick(World var1, int var2, int var3, int var4, Random var5) { + int var6 = var1.getBlockMetadata(var2, var3, var4); + boolean var7 = this.func_22022_g(var1, var2, var3, var4, var6); + if(this.isRepeaterPowered && !var7) { + var1.setBlockAndMetadataWithNotify(var2, var3, var4, Block.redstoneRepeaterIdle.blockID, var6); + } else if(!this.isRepeaterPowered) { + var1.setBlockAndMetadataWithNotify(var2, var3, var4, Block.redstoneRepeaterActive.blockID, var6); + if(!var7) { + int var8 = (var6 & 12) >> 2; + var1.scheduleBlockUpdate(var2, var3, var4, Block.redstoneRepeaterActive.blockID, field_22023_b[var8] * 2); + } + } + + } + + public int getBlockTextureFromSideAndMetadata(int var1, int var2) { + return var1 == 0 ? (this.isRepeaterPowered ? 99 : 115) : (var1 == 1 ? (this.isRepeaterPowered ? 147 : 131) : 5); + } + + public boolean shouldSideBeRendered(IBlockAccess var1, int var2, int var3, int var4, int var5) { + return var5 != 0 && var5 != 1; + } + + public int getRenderType() { + return 15; + } + + public int getBlockTextureFromSide(int var1) { + return this.getBlockTextureFromSideAndMetadata(var1, 0); + } + + public boolean isIndirectlyPoweringTo(World var1, int var2, int var3, int var4, int var5) { + return this.isPoweringTo(var1, var2, var3, var4, var5); + } + + public boolean isPoweringTo(IBlockAccess var1, int var2, int var3, int var4, int var5) { + if(!this.isRepeaterPowered) { + return false; + } else { + int var6 = var1.getBlockMetadata(var2, var3, var4) & 3; + return var6 == 0 && var5 == 3 ? true : (var6 == 1 && var5 == 4 ? true : (var6 == 2 && var5 == 2 ? true : var6 == 3 && var5 == 5)); + } + } + + public void onNeighborBlockChange(World var1, int var2, int var3, int var4, int var5) { + if(!this.canBlockStay(var1, var2, var3, var4)) { + this.dropBlockAsItem(var1, var2, var3, var4, var1.getBlockMetadata(var2, var3, var4)); + var1.setBlockWithNotify(var2, var3, var4, 0); + } else { + int var6 = var1.getBlockMetadata(var2, var3, var4); + boolean var7 = this.func_22022_g(var1, var2, var3, var4, var6); + int var8 = (var6 & 12) >> 2; + if(this.isRepeaterPowered && !var7) { + var1.scheduleBlockUpdate(var2, var3, var4, this.blockID, field_22023_b[var8] * 2); + } else if(!this.isRepeaterPowered && var7) { + var1.scheduleBlockUpdate(var2, var3, var4, this.blockID, field_22023_b[var8] * 2); + } + + } + } + + private boolean func_22022_g(World var1, int var2, int var3, int var4, int var5) { + int var6 = var5 & 3; + switch(var6) { + case 0: + return var1.isBlockIndirectlyProvidingPowerTo(var2, var3, var4 + 1, 3) || var1.getBlockId(var2, var3, var4 + 1) == Block.redstoneWire.blockID && var1.getBlockMetadata(var2, var3, var4 + 1) > 0; + case 1: + return var1.isBlockIndirectlyProvidingPowerTo(var2 - 1, var3, var4, 4) || var1.getBlockId(var2 - 1, var3, var4) == Block.redstoneWire.blockID && var1.getBlockMetadata(var2 - 1, var3, var4) > 0; + case 2: + return var1.isBlockIndirectlyProvidingPowerTo(var2, var3, var4 - 1, 2) || var1.getBlockId(var2, var3, var4 - 1) == Block.redstoneWire.blockID && var1.getBlockMetadata(var2, var3, var4 - 1) > 0; + case 3: + return var1.isBlockIndirectlyProvidingPowerTo(var2 + 1, var3, var4, 5) || var1.getBlockId(var2 + 1, var3, var4) == Block.redstoneWire.blockID && var1.getBlockMetadata(var2 + 1, var3, var4) > 0; + default: + return false; + } + } + + public boolean blockActivated(World var1, int var2, int var3, int var4, EntityPlayer var5) { + int var6 = var1.getBlockMetadata(var2, var3, var4); + int var7 = (var6 & 12) >> 2; + var7 = var7 + 1 << 2 & 12; + var1.setBlockMetadataWithNotify(var2, var3, var4, var7 | var6 & 3); + return true; + } + + public boolean canProvidePower() { + return false; + } + + public void onBlockPlacedBy(World var1, int var2, int var3, int var4, EntityLiving var5) { + int var6 = ((MathHelper.floor_double((double)(var5.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3) + 2) % 4; + var1.setBlockMetadataWithNotify(var2, var3, var4, var6); + boolean var7 = this.func_22022_g(var1, var2, var3, var4, var6); + if(var7) { + var1.scheduleBlockUpdate(var2, var3, var4, this.blockID, 1); + } + + } + + public void onBlockAdded(World var1, int var2, int var3, int var4) { + var1.notifyBlocksOfNeighborChange(var2 + 1, var3, var4, this.blockID); + var1.notifyBlocksOfNeighborChange(var2 - 1, var3, var4, this.blockID); + var1.notifyBlocksOfNeighborChange(var2, var3, var4 + 1, this.blockID); + var1.notifyBlocksOfNeighborChange(var2, var3, var4 - 1, this.blockID); + var1.notifyBlocksOfNeighborChange(var2, var3 - 1, var4, this.blockID); + var1.notifyBlocksOfNeighborChange(var2, var3 + 1, var4, this.blockID); + } + + public boolean isOpaqueCube() { + return false; + } + + public int idDropped(int var1, Random var2) { + return Item.redstoneRepeater.shiftedIndex; + } + + public void randomDisplayTick(World var1, int var2, int var3, int var4, Random var5) { + if(this.isRepeaterPowered) { + int var6 = var1.getBlockMetadata(var2, var3, var4); + double var7 = (double)((float)var2 + 0.5F) + (double)(var5.nextFloat() - 0.5F) * 0.2D; + double var9 = (double)((float)var3 + 0.4F) + (double)(var5.nextFloat() - 0.5F) * 0.2D; + double var11 = (double)((float)var4 + 0.5F) + (double)(var5.nextFloat() - 0.5F) * 0.2D; + double var13 = 0.0D; + double var15 = 0.0D; + if(var5.nextInt(2) == 0) { + switch(var6 & 3) { + case 0: + var15 = -0.3125D; + break; + case 1: + var13 = 0.3125D; + break; + case 2: + var15 = 0.3125D; + break; + case 3: + var13 = -0.3125D; + } + } else { + int var17 = (var6 & 12) >> 2; + switch(var6 & 3) { + case 0: + var15 = field_22024_a[var17]; + break; + case 1: + var13 = -field_22024_a[var17]; + break; + case 2: + var15 = -field_22024_a[var17]; + break; + case 3: + var13 = field_22024_a[var17]; + } + } + + var1.spawnParticle("reddust", var7 + var13, var9, var11 + var15, 0.0D, 0.0D, 0.0D); + } + } +} diff --git a/src/net/minecraft/src/BlockRedstoneTorch.java b/src/net/minecraft/src/BlockRedstoneTorch.java new file mode 100644 index 0000000..adfdb6a --- /dev/null +++ b/src/net/minecraft/src/BlockRedstoneTorch.java @@ -0,0 +1,153 @@ +package net.minecraft.src; + +import java.util.ArrayList; +import java.util.List; +import java.util.Random; + +public class BlockRedstoneTorch extends BlockTorch { + private boolean torchActive = false; + private static List torchUpdates = new ArrayList(); + + public int getBlockTextureFromSideAndMetadata(int var1, int var2) { + return var1 == 1 ? Block.redstoneWire.getBlockTextureFromSideAndMetadata(var1, var2) : super.getBlockTextureFromSideAndMetadata(var1, var2); + } + + private boolean checkForBurnout(World var1, int var2, int var3, int var4, boolean var5) { + if(var5) { + torchUpdates.add(new RedstoneUpdateInfo(var2, var3, var4, var1.getWorldTime())); + } + + int var6 = 0; + + for(int var7 = 0; var7 < torchUpdates.size(); ++var7) { + RedstoneUpdateInfo var8 = (RedstoneUpdateInfo)torchUpdates.get(var7); + if(var8.x == var2 && var8.y == var3 && var8.z == var4) { + ++var6; + if(var6 >= 8) { + return true; + } + } + } + + return false; + } + + protected BlockRedstoneTorch(int var1, int var2, boolean var3) { + super(var1, var2); + this.torchActive = var3; + this.setTickOnLoad(true); + } + + public int tickRate() { + return 2; + } + + public void onBlockAdded(World var1, int var2, int var3, int var4) { + if(var1.getBlockMetadata(var2, var3, var4) == 0) { + super.onBlockAdded(var1, var2, var3, var4); + } + + if(this.torchActive) { + var1.notifyBlocksOfNeighborChange(var2, var3 - 1, var4, this.blockID); + var1.notifyBlocksOfNeighborChange(var2, var3 + 1, var4, this.blockID); + var1.notifyBlocksOfNeighborChange(var2 - 1, var3, var4, this.blockID); + var1.notifyBlocksOfNeighborChange(var2 + 1, var3, var4, this.blockID); + var1.notifyBlocksOfNeighborChange(var2, var3, var4 - 1, this.blockID); + var1.notifyBlocksOfNeighborChange(var2, var3, var4 + 1, this.blockID); + } + + } + + public void onBlockRemoval(World var1, int var2, int var3, int var4) { + if(this.torchActive) { + var1.notifyBlocksOfNeighborChange(var2, var3 - 1, var4, this.blockID); + var1.notifyBlocksOfNeighborChange(var2, var3 + 1, var4, this.blockID); + var1.notifyBlocksOfNeighborChange(var2 - 1, var3, var4, this.blockID); + var1.notifyBlocksOfNeighborChange(var2 + 1, var3, var4, this.blockID); + var1.notifyBlocksOfNeighborChange(var2, var3, var4 - 1, this.blockID); + var1.notifyBlocksOfNeighborChange(var2, var3, var4 + 1, this.blockID); + } + + } + + public boolean isPoweringTo(IBlockAccess var1, int var2, int var3, int var4, int var5) { + if(!this.torchActive) { + return false; + } else { + int var6 = var1.getBlockMetadata(var2, var3, var4); + return var6 == 5 && var5 == 1 ? false : (var6 == 3 && var5 == 3 ? false : (var6 == 4 && var5 == 2 ? false : (var6 == 1 && var5 == 5 ? false : var6 != 2 || var5 != 4))); + } + } + + private boolean func_30002_h(World var1, int var2, int var3, int var4) { + int var5 = var1.getBlockMetadata(var2, var3, var4); + return var5 == 5 && var1.isBlockIndirectlyProvidingPowerTo(var2, var3 - 1, var4, 0) ? true : (var5 == 3 && var1.isBlockIndirectlyProvidingPowerTo(var2, var3, var4 - 1, 2) ? true : (var5 == 4 && var1.isBlockIndirectlyProvidingPowerTo(var2, var3, var4 + 1, 3) ? true : (var5 == 1 && var1.isBlockIndirectlyProvidingPowerTo(var2 - 1, var3, var4, 4) ? true : var5 == 2 && var1.isBlockIndirectlyProvidingPowerTo(var2 + 1, var3, var4, 5)))); + } + + public void updateTick(World var1, int var2, int var3, int var4, Random var5) { + boolean var6 = this.func_30002_h(var1, var2, var3, var4); + + while(torchUpdates.size() > 0 && var1.getWorldTime() - ((RedstoneUpdateInfo)torchUpdates.get(0)).updateTime > 100L) { + torchUpdates.remove(0); + } + + if(this.torchActive) { + if(var6) { + var1.setBlockAndMetadataWithNotify(var2, var3, var4, Block.torchRedstoneIdle.blockID, var1.getBlockMetadata(var2, var3, var4)); + if(this.checkForBurnout(var1, var2, var3, var4, true)) { + var1.playSoundEffect((double)((float)var2 + 0.5F), (double)((float)var3 + 0.5F), (double)((float)var4 + 0.5F), "random.fizz", 0.5F, 2.6F + (var1.rand.nextFloat() - var1.rand.nextFloat()) * 0.8F); + + for(int var7 = 0; var7 < 5; ++var7) { + double var8 = (double)var2 + var5.nextDouble() * 0.6D + 0.2D; + double var10 = (double)var3 + var5.nextDouble() * 0.6D + 0.2D; + double var12 = (double)var4 + var5.nextDouble() * 0.6D + 0.2D; + var1.spawnParticle("smoke", var8, var10, var12, 0.0D, 0.0D, 0.0D); + } + } + } + } else if(!var6 && !this.checkForBurnout(var1, var2, var3, var4, false)) { + var1.setBlockAndMetadataWithNotify(var2, var3, var4, Block.torchRedstoneActive.blockID, var1.getBlockMetadata(var2, var3, var4)); + } + + } + + public void onNeighborBlockChange(World var1, int var2, int var3, int var4, int var5) { + super.onNeighborBlockChange(var1, var2, var3, var4, var5); + var1.scheduleBlockUpdate(var2, var3, var4, this.blockID, this.tickRate()); + } + + public boolean isIndirectlyPoweringTo(World var1, int var2, int var3, int var4, int var5) { + return var5 == 0 ? this.isPoweringTo(var1, var2, var3, var4, var5) : false; + } + + public int idDropped(int var1, Random var2) { + return Block.torchRedstoneActive.blockID; + } + + public boolean canProvidePower() { + return true; + } + + public void randomDisplayTick(World var1, int var2, int var3, int var4, Random var5) { + if(this.torchActive) { + int var6 = var1.getBlockMetadata(var2, var3, var4); + double var7 = (double)((float)var2 + 0.5F) + (double)(var5.nextFloat() - 0.5F) * 0.2D; + double var9 = (double)((float)var3 + 0.7F) + (double)(var5.nextFloat() - 0.5F) * 0.2D; + double var11 = (double)((float)var4 + 0.5F) + (double)(var5.nextFloat() - 0.5F) * 0.2D; + double var13 = (double)0.22F; + double var15 = (double)0.27F; + if(var6 == 1) { + var1.spawnParticle("reddust", var7 - var15, var9 + var13, var11, 0.0D, 0.0D, 0.0D); + } else if(var6 == 2) { + var1.spawnParticle("reddust", var7 + var15, var9 + var13, var11, 0.0D, 0.0D, 0.0D); + } else if(var6 == 3) { + var1.spawnParticle("reddust", var7, var9 + var13, var11 - var15, 0.0D, 0.0D, 0.0D); + } else if(var6 == 4) { + var1.spawnParticle("reddust", var7, var9 + var13, var11 + var15, 0.0D, 0.0D, 0.0D); + } else { + var1.spawnParticle("reddust", var7, var9, var11, 0.0D, 0.0D, 0.0D); + } + + } + } +} diff --git a/src/net/minecraft/src/BlockRedstoneWire.java b/src/net/minecraft/src/BlockRedstoneWire.java new file mode 100644 index 0000000..e011628 --- /dev/null +++ b/src/net/minecraft/src/BlockRedstoneWire.java @@ -0,0 +1,371 @@ +package net.minecraft.src; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.Random; +import java.util.Set; + +public class BlockRedstoneWire extends Block { + private boolean wiresProvidePower = true; + private Set field_21031_b = new HashSet(); + + public BlockRedstoneWire(int var1, int var2) { + super(var1, var2, Material.circuits); + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F / 16.0F, 1.0F); + } + + public int getBlockTextureFromSideAndMetadata(int var1, int var2) { + return this.blockIndexInTexture; + } + + public AxisAlignedBB getCollisionBoundingBoxFromPool(World var1, int var2, int var3, int var4) { + return null; + } + + public boolean isOpaqueCube() { + return false; + } + + public boolean renderAsNormalBlock() { + return false; + } + + public int getRenderType() { + return 5; + } + + public int colorMultiplier(IBlockAccess var1, int var2, int var3, int var4) { + return 8388608; + } + + public boolean canPlaceBlockAt(World var1, int var2, int var3, int var4) { + return var1.isBlockNormalCube(var2, var3 - 1, var4); + } + + private void updateAndPropagateCurrentStrength(World var1, int var2, int var3, int var4) { + this.func_21030_a(var1, var2, var3, var4, var2, var3, var4); + ArrayList var5 = new ArrayList(this.field_21031_b); + this.field_21031_b.clear(); + + for(int var6 = 0; var6 < var5.size(); ++var6) { + ChunkPosition var7 = (ChunkPosition)var5.get(var6); + var1.notifyBlocksOfNeighborChange(var7.x, var7.y, var7.z, this.blockID); + } + + } + + private void func_21030_a(World var1, int var2, int var3, int var4, int var5, int var6, int var7) { + int var8 = var1.getBlockMetadata(var2, var3, var4); + int var9 = 0; + this.wiresProvidePower = false; + boolean var10 = var1.isBlockIndirectlyGettingPowered(var2, var3, var4); + this.wiresProvidePower = true; + int var11; + int var12; + int var13; + if(var10) { + var9 = 15; + } else { + for(var11 = 0; var11 < 4; ++var11) { + var12 = var2; + var13 = var4; + if(var11 == 0) { + var12 = var2 - 1; + } + + if(var11 == 1) { + ++var12; + } + + if(var11 == 2) { + var13 = var4 - 1; + } + + if(var11 == 3) { + ++var13; + } + + if(var12 != var5 || var3 != var6 || var13 != var7) { + var9 = this.getMaxCurrentStrength(var1, var12, var3, var13, var9); + } + + if(var1.isBlockNormalCube(var12, var3, var13) && !var1.isBlockNormalCube(var2, var3 + 1, var4)) { + if(var12 != var5 || var3 + 1 != var6 || var13 != var7) { + var9 = this.getMaxCurrentStrength(var1, var12, var3 + 1, var13, var9); + } + } else if(!var1.isBlockNormalCube(var12, var3, var13) && (var12 != var5 || var3 - 1 != var6 || var13 != var7)) { + var9 = this.getMaxCurrentStrength(var1, var12, var3 - 1, var13, var9); + } + } + + if(var9 > 0) { + --var9; + } else { + var9 = 0; + } + } + + if(var8 != var9) { + var1.editingBlocks = true; + var1.setBlockMetadataWithNotify(var2, var3, var4, var9); + var1.markBlocksDirty(var2, var3, var4, var2, var3, var4); + var1.editingBlocks = false; + + for(var11 = 0; var11 < 4; ++var11) { + var12 = var2; + var13 = var4; + int var14 = var3 - 1; + if(var11 == 0) { + var12 = var2 - 1; + } + + if(var11 == 1) { + ++var12; + } + + if(var11 == 2) { + var13 = var4 - 1; + } + + if(var11 == 3) { + ++var13; + } + + if(var1.isBlockNormalCube(var12, var3, var13)) { + var14 += 2; + } + + boolean var15 = false; + int var16 = this.getMaxCurrentStrength(var1, var12, var3, var13, -1); + var9 = var1.getBlockMetadata(var2, var3, var4); + if(var9 > 0) { + --var9; + } + + if(var16 >= 0 && var16 != var9) { + this.func_21030_a(var1, var12, var3, var13, var2, var3, var4); + } + + var16 = this.getMaxCurrentStrength(var1, var12, var14, var13, -1); + var9 = var1.getBlockMetadata(var2, var3, var4); + if(var9 > 0) { + --var9; + } + + if(var16 >= 0 && var16 != var9) { + this.func_21030_a(var1, var12, var14, var13, var2, var3, var4); + } + } + + if(var8 == 0 || var9 == 0) { + this.field_21031_b.add(new ChunkPosition(var2, var3, var4)); + this.field_21031_b.add(new ChunkPosition(var2 - 1, var3, var4)); + this.field_21031_b.add(new ChunkPosition(var2 + 1, var3, var4)); + this.field_21031_b.add(new ChunkPosition(var2, var3 - 1, var4)); + this.field_21031_b.add(new ChunkPosition(var2, var3 + 1, var4)); + this.field_21031_b.add(new ChunkPosition(var2, var3, var4 - 1)); + this.field_21031_b.add(new ChunkPosition(var2, var3, var4 + 1)); + } + } + + } + + private void notifyWireNeighborsOfNeighborChange(World var1, int var2, int var3, int var4) { + if(var1.getBlockId(var2, var3, var4) == this.blockID) { + var1.notifyBlocksOfNeighborChange(var2, var3, var4, this.blockID); + var1.notifyBlocksOfNeighborChange(var2 - 1, var3, var4, this.blockID); + var1.notifyBlocksOfNeighborChange(var2 + 1, var3, var4, this.blockID); + var1.notifyBlocksOfNeighborChange(var2, var3, var4 - 1, this.blockID); + var1.notifyBlocksOfNeighborChange(var2, var3, var4 + 1, this.blockID); + var1.notifyBlocksOfNeighborChange(var2, var3 - 1, var4, this.blockID); + var1.notifyBlocksOfNeighborChange(var2, var3 + 1, var4, this.blockID); + } + } + + public void onBlockAdded(World var1, int var2, int var3, int var4) { + super.onBlockAdded(var1, var2, var3, var4); + if(!var1.multiplayerWorld) { + this.updateAndPropagateCurrentStrength(var1, var2, var3, var4); + var1.notifyBlocksOfNeighborChange(var2, var3 + 1, var4, this.blockID); + var1.notifyBlocksOfNeighborChange(var2, var3 - 1, var4, this.blockID); + this.notifyWireNeighborsOfNeighborChange(var1, var2 - 1, var3, var4); + this.notifyWireNeighborsOfNeighborChange(var1, var2 + 1, var3, var4); + this.notifyWireNeighborsOfNeighborChange(var1, var2, var3, var4 - 1); + this.notifyWireNeighborsOfNeighborChange(var1, var2, var3, var4 + 1); + if(var1.isBlockNormalCube(var2 - 1, var3, var4)) { + this.notifyWireNeighborsOfNeighborChange(var1, var2 - 1, var3 + 1, var4); + } else { + this.notifyWireNeighborsOfNeighborChange(var1, var2 - 1, var3 - 1, var4); + } + + if(var1.isBlockNormalCube(var2 + 1, var3, var4)) { + this.notifyWireNeighborsOfNeighborChange(var1, var2 + 1, var3 + 1, var4); + } else { + this.notifyWireNeighborsOfNeighborChange(var1, var2 + 1, var3 - 1, var4); + } + + if(var1.isBlockNormalCube(var2, var3, var4 - 1)) { + this.notifyWireNeighborsOfNeighborChange(var1, var2, var3 + 1, var4 - 1); + } else { + this.notifyWireNeighborsOfNeighborChange(var1, var2, var3 - 1, var4 - 1); + } + + if(var1.isBlockNormalCube(var2, var3, var4 + 1)) { + this.notifyWireNeighborsOfNeighborChange(var1, var2, var3 + 1, var4 + 1); + } else { + this.notifyWireNeighborsOfNeighborChange(var1, var2, var3 - 1, var4 + 1); + } + + } + } + + public void onBlockRemoval(World var1, int var2, int var3, int var4) { + super.onBlockRemoval(var1, var2, var3, var4); + if(!var1.multiplayerWorld) { + var1.notifyBlocksOfNeighborChange(var2, var3 + 1, var4, this.blockID); + var1.notifyBlocksOfNeighborChange(var2, var3 - 1, var4, this.blockID); + this.updateAndPropagateCurrentStrength(var1, var2, var3, var4); + this.notifyWireNeighborsOfNeighborChange(var1, var2 - 1, var3, var4); + this.notifyWireNeighborsOfNeighborChange(var1, var2 + 1, var3, var4); + this.notifyWireNeighborsOfNeighborChange(var1, var2, var3, var4 - 1); + this.notifyWireNeighborsOfNeighborChange(var1, var2, var3, var4 + 1); + if(var1.isBlockNormalCube(var2 - 1, var3, var4)) { + this.notifyWireNeighborsOfNeighborChange(var1, var2 - 1, var3 + 1, var4); + } else { + this.notifyWireNeighborsOfNeighborChange(var1, var2 - 1, var3 - 1, var4); + } + + if(var1.isBlockNormalCube(var2 + 1, var3, var4)) { + this.notifyWireNeighborsOfNeighborChange(var1, var2 + 1, var3 + 1, var4); + } else { + this.notifyWireNeighborsOfNeighborChange(var1, var2 + 1, var3 - 1, var4); + } + + if(var1.isBlockNormalCube(var2, var3, var4 - 1)) { + this.notifyWireNeighborsOfNeighborChange(var1, var2, var3 + 1, var4 - 1); + } else { + this.notifyWireNeighborsOfNeighborChange(var1, var2, var3 - 1, var4 - 1); + } + + if(var1.isBlockNormalCube(var2, var3, var4 + 1)) { + this.notifyWireNeighborsOfNeighborChange(var1, var2, var3 + 1, var4 + 1); + } else { + this.notifyWireNeighborsOfNeighborChange(var1, var2, var3 - 1, var4 + 1); + } + + } + } + + private int getMaxCurrentStrength(World var1, int var2, int var3, int var4, int var5) { + if(var1.getBlockId(var2, var3, var4) != this.blockID) { + return var5; + } else { + int var6 = var1.getBlockMetadata(var2, var3, var4); + return var6 > var5 ? var6 : var5; + } + } + + public void onNeighborBlockChange(World var1, int var2, int var3, int var4, int var5) { + if(!var1.multiplayerWorld) { + int var6 = var1.getBlockMetadata(var2, var3, var4); + boolean var7 = this.canPlaceBlockAt(var1, var2, var3, var4); + if(!var7) { + this.dropBlockAsItem(var1, var2, var3, var4, var6); + var1.setBlockWithNotify(var2, var3, var4, 0); + } else { + this.updateAndPropagateCurrentStrength(var1, var2, var3, var4); + } + + super.onNeighborBlockChange(var1, var2, var3, var4, var5); + } + } + + public int idDropped(int var1, Random var2) { + return Item.redstone.shiftedIndex; + } + + public boolean isIndirectlyPoweringTo(World var1, int var2, int var3, int var4, int var5) { + return !this.wiresProvidePower ? false : this.isPoweringTo(var1, var2, var3, var4, var5); + } + + public boolean isPoweringTo(IBlockAccess var1, int var2, int var3, int var4, int var5) { + if(!this.wiresProvidePower) { + return false; + } else if(var1.getBlockMetadata(var2, var3, var4) == 0) { + return false; + } else if(var5 == 1) { + return true; + } else { + boolean var6 = isPowerProviderOrWire(var1, var2 - 1, var3, var4, 1) || !var1.isBlockNormalCube(var2 - 1, var3, var4) && isPowerProviderOrWire(var1, var2 - 1, var3 - 1, var4, -1); + boolean var7 = isPowerProviderOrWire(var1, var2 + 1, var3, var4, 3) || !var1.isBlockNormalCube(var2 + 1, var3, var4) && isPowerProviderOrWire(var1, var2 + 1, var3 - 1, var4, -1); + boolean var8 = isPowerProviderOrWire(var1, var2, var3, var4 - 1, 2) || !var1.isBlockNormalCube(var2, var3, var4 - 1) && isPowerProviderOrWire(var1, var2, var3 - 1, var4 - 1, -1); + boolean var9 = isPowerProviderOrWire(var1, var2, var3, var4 + 1, 0) || !var1.isBlockNormalCube(var2, var3, var4 + 1) && isPowerProviderOrWire(var1, var2, var3 - 1, var4 + 1, -1); + if(!var1.isBlockNormalCube(var2, var3 + 1, var4)) { + if(var1.isBlockNormalCube(var2 - 1, var3, var4) && isPowerProviderOrWire(var1, var2 - 1, var3 + 1, var4, -1)) { + var6 = true; + } + + if(var1.isBlockNormalCube(var2 + 1, var3, var4) && isPowerProviderOrWire(var1, var2 + 1, var3 + 1, var4, -1)) { + var7 = true; + } + + if(var1.isBlockNormalCube(var2, var3, var4 - 1) && isPowerProviderOrWire(var1, var2, var3 + 1, var4 - 1, -1)) { + var8 = true; + } + + if(var1.isBlockNormalCube(var2, var3, var4 + 1) && isPowerProviderOrWire(var1, var2, var3 + 1, var4 + 1, -1)) { + var9 = true; + } + } + + return !var8 && !var7 && !var6 && !var9 && var5 >= 2 && var5 <= 5 ? true : (var5 == 2 && var8 && !var6 && !var7 ? true : (var5 == 3 && var9 && !var6 && !var7 ? true : (var5 == 4 && var6 && !var8 && !var9 ? true : var5 == 5 && var7 && !var8 && !var9))); + } + } + + public boolean canProvidePower() { + return this.wiresProvidePower; + } + + public void randomDisplayTick(World var1, int var2, int var3, int var4, Random var5) { + int var6 = var1.getBlockMetadata(var2, var3, var4); + if(var6 > 0) { + double var7 = (double)var2 + 0.5D + ((double)var5.nextFloat() - 0.5D) * 0.2D; + double var9 = (double)((float)var3 + 1.0F / 16.0F); + double var11 = (double)var4 + 0.5D + ((double)var5.nextFloat() - 0.5D) * 0.2D; + float var13 = (float)var6 / 15.0F; + float var14 = var13 * 0.6F + 0.4F; + if(var6 == 0) { + var14 = 0.0F; + } + + float var15 = var13 * var13 * 0.7F - 0.5F; + float var16 = var13 * var13 * 0.6F - 0.7F; + if(var15 < 0.0F) { + var15 = 0.0F; + } + + if(var16 < 0.0F) { + var16 = 0.0F; + } + + var1.spawnParticle("reddust", var7, var9, var11, (double)var14, (double)var15, (double)var16); + } + + } + + public static boolean isPowerProviderOrWire(IBlockAccess var0, int var1, int var2, int var3, int var4) { + int var5 = var0.getBlockId(var1, var2, var3); + if(var5 == Block.redstoneWire.blockID) { + return true; + } else if(var5 == 0) { + return false; + } else if(Block.blocksList[var5].canProvidePower()) { + return true; + } else if(var5 != Block.redstoneRepeaterIdle.blockID && var5 != Block.redstoneRepeaterActive.blockID) { + return false; + } else { + int var6 = var0.getBlockMetadata(var1, var2, var3); + return var4 == ModelBed.field_22279_b[var6 & 3]; + } + } +} diff --git a/src/net/minecraft/src/BlockReed.java b/src/net/minecraft/src/BlockReed.java new file mode 100644 index 0000000..8b7bc0b --- /dev/null +++ b/src/net/minecraft/src/BlockReed.java @@ -0,0 +1,73 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockReed extends Block { + protected BlockReed(int var1, int var2) { + super(var1, Material.plants); + this.blockIndexInTexture = var2; + float var3 = 6.0F / 16.0F; + this.setBlockBounds(0.5F - var3, 0.0F, 0.5F - var3, 0.5F + var3, 1.0F, 0.5F + var3); + this.setTickOnLoad(true); + } + + public void updateTick(World var1, int var2, int var3, int var4, Random var5) { + if(var1.isAirBlock(var2, var3 + 1, var4)) { + int var6; + for(var6 = 1; var1.getBlockId(var2, var3 - var6, var4) == this.blockID; ++var6) { + } + + if(var6 < 3) { + int var7 = var1.getBlockMetadata(var2, var3, var4); + if(var7 == 15) { + var1.setBlockWithNotify(var2, var3 + 1, var4, this.blockID); + var1.setBlockMetadataWithNotify(var2, var3, var4, 0); + } else { + var1.setBlockMetadataWithNotify(var2, var3, var4, var7 + 1); + } + } + } + + } + + public boolean canPlaceBlockAt(World var1, int var2, int var3, int var4) { + int var5 = var1.getBlockId(var2, var3 - 1, var4); + return var5 == this.blockID ? true : (var5 != Block.grass.blockID && var5 != Block.dirt.blockID ? false : (var1.getBlockMaterial(var2 - 1, var3 - 1, var4) == Material.water ? true : (var1.getBlockMaterial(var2 + 1, var3 - 1, var4) == Material.water ? true : (var1.getBlockMaterial(var2, var3 - 1, var4 - 1) == Material.water ? true : var1.getBlockMaterial(var2, var3 - 1, var4 + 1) == Material.water)))); + } + + public void onNeighborBlockChange(World var1, int var2, int var3, int var4, int var5) { + this.checkBlockCoordValid(var1, var2, var3, var4); + } + + protected final void checkBlockCoordValid(World var1, int var2, int var3, int var4) { + if(!this.canBlockStay(var1, var2, var3, var4)) { + this.dropBlockAsItem(var1, var2, var3, var4, var1.getBlockMetadata(var2, var3, var4)); + var1.setBlockWithNotify(var2, var3, var4, 0); + } + + } + + public boolean canBlockStay(World var1, int var2, int var3, int var4) { + return this.canPlaceBlockAt(var1, var2, var3, var4); + } + + public AxisAlignedBB getCollisionBoundingBoxFromPool(World var1, int var2, int var3, int var4) { + return null; + } + + public int idDropped(int var1, Random var2) { + return Item.reed.shiftedIndex; + } + + public boolean isOpaqueCube() { + return false; + } + + public boolean renderAsNormalBlock() { + return false; + } + + public int getRenderType() { + return 1; + } +} diff --git a/src/net/minecraft/src/BlockSand.java b/src/net/minecraft/src/BlockSand.java new file mode 100644 index 0000000..e615245 --- /dev/null +++ b/src/net/minecraft/src/BlockSand.java @@ -0,0 +1,60 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockSand extends Block { + public static boolean fallInstantly = false; + + public BlockSand(int var1, int var2) { + super(var1, var2, Material.sand); + } + + public void onBlockAdded(World var1, int var2, int var3, int var4) { + var1.scheduleBlockUpdate(var2, var3, var4, this.blockID, this.tickRate()); + } + + public void onNeighborBlockChange(World var1, int var2, int var3, int var4, int var5) { + var1.scheduleBlockUpdate(var2, var3, var4, this.blockID, this.tickRate()); + } + + public void updateTick(World var1, int var2, int var3, int var4, Random var5) { + this.tryToFall(var1, var2, var3, var4); + } + + private void tryToFall(World var1, int var2, int var3, int var4) { + if(canFallBelow(var1, var2, var3 - 1, var4) && var3 >= 0) { + byte var8 = 32; + if(!fallInstantly && var1.checkChunksExist(var2 - var8, var3 - var8, var4 - var8, var2 + var8, var3 + var8, var4 + var8)) { + EntityFallingSand var9 = new EntityFallingSand(var1, (double)((float)var2 + 0.5F), (double)((float)var3 + 0.5F), (double)((float)var4 + 0.5F), this.blockID); + var1.entityJoinedWorld(var9); + } else { + var1.setBlockWithNotify(var2, var3, var4, 0); + + while(canFallBelow(var1, var2, var3 - 1, var4) && var3 > 0) { + --var3; + } + + if(var3 > 0) { + var1.setBlockWithNotify(var2, var3, var4, this.blockID); + } + } + } + + } + + public int tickRate() { + return 3; + } + + public static boolean canFallBelow(World var0, int var1, int var2, int var3) { + int var4 = var0.getBlockId(var1, var2, var3); + if(var4 == 0) { + return true; + } else if(var4 == Block.fire.blockID) { + return true; + } else { + Material var5 = Block.blocksList[var4].blockMaterial; + return var5 == Material.water ? true : var5 == Material.lava; + } + } +} diff --git a/src/net/minecraft/src/BlockSandStone.java b/src/net/minecraft/src/BlockSandStone.java new file mode 100644 index 0000000..84b6dd1 --- /dev/null +++ b/src/net/minecraft/src/BlockSandStone.java @@ -0,0 +1,11 @@ +package net.minecraft.src; + +public class BlockSandStone extends Block { + public BlockSandStone(int var1) { + super(var1, 192, Material.rock); + } + + public int getBlockTextureFromSide(int var1) { + return var1 == 1 ? this.blockIndexInTexture - 16 : (var1 == 0 ? this.blockIndexInTexture + 16 : this.blockIndexInTexture); + } +} diff --git a/src/net/minecraft/src/BlockSapling.java b/src/net/minecraft/src/BlockSapling.java new file mode 100644 index 0000000..2aa956f --- /dev/null +++ b/src/net/minecraft/src/BlockSapling.java @@ -0,0 +1,56 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockSapling extends BlockFlower { + protected BlockSapling(int var1, int var2) { + super(var1, var2); + float var3 = 0.4F; + this.setBlockBounds(0.5F - var3, 0.0F, 0.5F - var3, 0.5F + var3, var3 * 2.0F, 0.5F + var3); + } + + public void updateTick(World var1, int var2, int var3, int var4, Random var5) { + if(!var1.multiplayerWorld) { + super.updateTick(var1, var2, var3, var4, var5); + if(var1.getBlockLightValue(var2, var3 + 1, var4) >= 9 && var5.nextInt(30) == 0) { + int var6 = var1.getBlockMetadata(var2, var3, var4); + if((var6 & 8) == 0) { + var1.setBlockMetadataWithNotify(var2, var3, var4, var6 | 8); + } else { + this.growTree(var1, var2, var3, var4, var5); + } + } + + } + } + + public int getBlockTextureFromSideAndMetadata(int var1, int var2) { + var2 &= 3; + return var2 == 1 ? 63 : (var2 == 2 ? 79 : super.getBlockTextureFromSideAndMetadata(var1, var2)); + } + + public void growTree(World var1, int var2, int var3, int var4, Random var5) { + int var6 = var1.getBlockMetadata(var2, var3, var4) & 3; + var1.setBlock(var2, var3, var4, 0); + Object var7 = null; + if(var6 == 1) { + var7 = new WorldGenTaiga2(); + } else if(var6 == 2) { + var7 = new WorldGenForest(); + } else { + var7 = new WorldGenTrees(); + if(var5.nextInt(10) == 0) { + var7 = new WorldGenBigTree(); + } + } + + if(!((WorldGenerator)var7).generate(var1, var5, var2, var3, var4)) { + var1.setBlockAndMetadata(var2, var3, var4, this.blockID, var6); + } + + } + + protected int damageDropped(int var1) { + return var1 & 3; + } +} diff --git a/src/net/minecraft/src/BlockSign.java b/src/net/minecraft/src/BlockSign.java new file mode 100644 index 0000000..dfebcac --- /dev/null +++ b/src/net/minecraft/src/BlockSign.java @@ -0,0 +1,113 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockSign extends BlockContainer { + private Class signEntityClass; + private boolean isFreestanding; + + protected BlockSign(int var1, Class var2, boolean var3) { + super(var1, Material.wood); + this.isFreestanding = var3; + this.blockIndexInTexture = 4; + this.signEntityClass = var2; + float var4 = 0.25F; + float var5 = 1.0F; + this.setBlockBounds(0.5F - var4, 0.0F, 0.5F - var4, 0.5F + var4, var5, 0.5F + var4); + } + + public AxisAlignedBB getCollisionBoundingBoxFromPool(World var1, int var2, int var3, int var4) { + return null; + } + + public AxisAlignedBB getSelectedBoundingBoxFromPool(World var1, int var2, int var3, int var4) { + this.setBlockBoundsBasedOnState(var1, var2, var3, var4); + return super.getSelectedBoundingBoxFromPool(var1, var2, var3, var4); + } + + public void setBlockBoundsBasedOnState(IBlockAccess var1, int var2, int var3, int var4) { + if(!this.isFreestanding) { + int var5 = var1.getBlockMetadata(var2, var3, var4); + float var6 = 9.0F / 32.0F; + float var7 = 25.0F / 32.0F; + float var8 = 0.0F; + float var9 = 1.0F; + float var10 = 2.0F / 16.0F; + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + if(var5 == 2) { + this.setBlockBounds(var8, var6, 1.0F - var10, var9, var7, 1.0F); + } + + if(var5 == 3) { + this.setBlockBounds(var8, var6, 0.0F, var9, var7, var10); + } + + if(var5 == 4) { + this.setBlockBounds(1.0F - var10, var6, var8, 1.0F, var7, var9); + } + + if(var5 == 5) { + this.setBlockBounds(0.0F, var6, var8, var10, var7, var9); + } + + } + } + + public int getRenderType() { + return -1; + } + + public boolean renderAsNormalBlock() { + return false; + } + + public boolean isOpaqueCube() { + return false; + } + + protected TileEntity getBlockEntity() { + try { + return (TileEntity)this.signEntityClass.newInstance(); + } catch (Exception var2) { + throw new RuntimeException(var2); + } + } + + public int idDropped(int var1, Random var2) { + return Item.sign.shiftedIndex; + } + + public void onNeighborBlockChange(World var1, int var2, int var3, int var4, int var5) { + boolean var6 = false; + if(this.isFreestanding) { + if(!var1.getBlockMaterial(var2, var3 - 1, var4).isSolid()) { + var6 = true; + } + } else { + int var7 = var1.getBlockMetadata(var2, var3, var4); + var6 = true; + if(var7 == 2 && var1.getBlockMaterial(var2, var3, var4 + 1).isSolid()) { + var6 = false; + } + + if(var7 == 3 && var1.getBlockMaterial(var2, var3, var4 - 1).isSolid()) { + var6 = false; + } + + if(var7 == 4 && var1.getBlockMaterial(var2 + 1, var3, var4).isSolid()) { + var6 = false; + } + + if(var7 == 5 && var1.getBlockMaterial(var2 - 1, var3, var4).isSolid()) { + var6 = false; + } + } + + if(var6) { + this.dropBlockAsItem(var1, var2, var3, var4, var1.getBlockMetadata(var2, var3, var4)); + var1.setBlockWithNotify(var2, var3, var4, 0); + } + + super.onNeighborBlockChange(var1, var2, var3, var4, var5); + } +} diff --git a/src/net/minecraft/src/BlockSnow.java b/src/net/minecraft/src/BlockSnow.java new file mode 100644 index 0000000..1496409 --- /dev/null +++ b/src/net/minecraft/src/BlockSnow.java @@ -0,0 +1,82 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockSnow extends Block { + protected BlockSnow(int var1, int var2) { + super(var1, var2, Material.snow); + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 2.0F / 16.0F, 1.0F); + this.setTickOnLoad(true); + } + + public AxisAlignedBB getCollisionBoundingBoxFromPool(World var1, int var2, int var3, int var4) { + int var5 = var1.getBlockMetadata(var2, var3, var4) & 7; + return var5 >= 3 ? AxisAlignedBB.getBoundingBoxFromPool((double)var2 + this.minX, (double)var3 + this.minY, (double)var4 + this.minZ, (double)var2 + this.maxX, (double)((float)var3 + 0.5F), (double)var4 + this.maxZ) : null; + } + + public boolean isOpaqueCube() { + return false; + } + + public boolean renderAsNormalBlock() { + return false; + } + + public void setBlockBoundsBasedOnState(IBlockAccess var1, int var2, int var3, int var4) { + int var5 = var1.getBlockMetadata(var2, var3, var4) & 7; + float var6 = (float)(2 * (1 + var5)) / 16.0F; + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, var6, 1.0F); + } + + public boolean canPlaceBlockAt(World var1, int var2, int var3, int var4) { + int var5 = var1.getBlockId(var2, var3 - 1, var4); + return var5 != 0 && Block.blocksList[var5].isOpaqueCube() ? var1.getBlockMaterial(var2, var3 - 1, var4).getIsSolid() : false; + } + + public void onNeighborBlockChange(World var1, int var2, int var3, int var4, int var5) { + this.func_314_h(var1, var2, var3, var4); + } + + private boolean func_314_h(World var1, int var2, int var3, int var4) { + if(!this.canPlaceBlockAt(var1, var2, var3, var4)) { + this.dropBlockAsItem(var1, var2, var3, var4, var1.getBlockMetadata(var2, var3, var4)); + var1.setBlockWithNotify(var2, var3, var4, 0); + return false; + } else { + return true; + } + } + + public void harvestBlock(World var1, EntityPlayer var2, int var3, int var4, int var5, int var6) { + int var7 = Item.snowball.shiftedIndex; + float var8 = 0.7F; + double var9 = (double)(var1.rand.nextFloat() * var8) + (double)(1.0F - var8) * 0.5D; + double var11 = (double)(var1.rand.nextFloat() * var8) + (double)(1.0F - var8) * 0.5D; + double var13 = (double)(var1.rand.nextFloat() * var8) + (double)(1.0F - var8) * 0.5D; + EntityItem var15 = new EntityItem(var1, (double)var3 + var9, (double)var4 + var11, (double)var5 + var13, new ItemStack(var7, 1, 0)); + var15.delayBeforeCanPickup = 10; + var1.entityJoinedWorld(var15); + var1.setBlockWithNotify(var3, var4, var5, 0); + var2.addStat(StatList.mineBlockStatArray[this.blockID], 1); + } + + public int idDropped(int var1, Random var2) { + return Item.snowball.shiftedIndex; + } + + public int quantityDropped(Random var1) { + return 0; + } + + public void updateTick(World var1, int var2, int var3, int var4, Random var5) { + if(var1.getSavedLightValue(EnumSkyBlock.Block, var2, var3, var4) > 11) { + this.dropBlockAsItem(var1, var2, var3, var4, var1.getBlockMetadata(var2, var3, var4)); + var1.setBlockWithNotify(var2, var3, var4, 0); + } + + } + + public boolean shouldSideBeRendered(IBlockAccess var1, int var2, int var3, int var4, int var5) { + return var5 == 1 ? true : super.shouldSideBeRendered(var1, var2, var3, var4, var5); + } +} diff --git a/src/net/minecraft/src/BlockSnowBlock.java b/src/net/minecraft/src/BlockSnowBlock.java new file mode 100644 index 0000000..484d3db --- /dev/null +++ b/src/net/minecraft/src/BlockSnowBlock.java @@ -0,0 +1,26 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockSnowBlock extends Block { + protected BlockSnowBlock(int var1, int var2) { + super(var1, var2, Material.builtSnow); + this.setTickOnLoad(true); + } + + public int idDropped(int var1, Random var2) { + return Item.snowball.shiftedIndex; + } + + public int quantityDropped(Random var1) { + return 4; + } + + public void updateTick(World var1, int var2, int var3, int var4, Random var5) { + if(var1.getSavedLightValue(EnumSkyBlock.Block, var2, var3, var4) > 11) { + this.dropBlockAsItem(var1, var2, var3, var4, var1.getBlockMetadata(var2, var3, var4)); + var1.setBlockWithNotify(var2, var3, var4, 0); + } + + } +} diff --git a/src/net/minecraft/src/BlockSoulSand.java b/src/net/minecraft/src/BlockSoulSand.java new file mode 100644 index 0000000..5d60d2a --- /dev/null +++ b/src/net/minecraft/src/BlockSoulSand.java @@ -0,0 +1,17 @@ +package net.minecraft.src; + +public class BlockSoulSand extends Block { + public BlockSoulSand(int var1, int var2) { + super(var1, var2, Material.sand); + } + + public AxisAlignedBB getCollisionBoundingBoxFromPool(World var1, int var2, int var3, int var4) { + float var5 = 2.0F / 16.0F; + return AxisAlignedBB.getBoundingBoxFromPool((double)var2, (double)var3, (double)var4, (double)(var2 + 1), (double)((float)(var3 + 1) - var5), (double)(var4 + 1)); + } + + public void onEntityCollidedWithBlock(World var1, int var2, int var3, int var4, Entity var5) { + var5.motionX *= 0.4D; + var5.motionZ *= 0.4D; + } +} diff --git a/src/net/minecraft/src/BlockSponge.java b/src/net/minecraft/src/BlockSponge.java new file mode 100644 index 0000000..5e6c41d --- /dev/null +++ b/src/net/minecraft/src/BlockSponge.java @@ -0,0 +1,35 @@ +package net.minecraft.src; + +public class BlockSponge extends Block { + protected BlockSponge(int var1) { + super(var1, Material.sponge); + this.blockIndexInTexture = 48; + } + + public void onBlockAdded(World var1, int var2, int var3, int var4) { + byte var5 = 2; + + for(int var6 = var2 - var5; var6 <= var2 + var5; ++var6) { + for(int var7 = var3 - var5; var7 <= var3 + var5; ++var7) { + for(int var8 = var4 - var5; var8 <= var4 + var5; ++var8) { + if(var1.getBlockMaterial(var6, var7, var8) == Material.water) { + } + } + } + } + + } + + public void onBlockRemoval(World var1, int var2, int var3, int var4) { + byte var5 = 2; + + for(int var6 = var2 - var5; var6 <= var2 + var5; ++var6) { + for(int var7 = var3 - var5; var7 <= var3 + var5; ++var7) { + for(int var8 = var4 - var5; var8 <= var4 + var5; ++var8) { + var1.notifyBlocksOfNeighborChange(var6, var7, var8, var1.getBlockId(var6, var7, var8)); + } + } + } + + } +} diff --git a/src/net/minecraft/src/BlockStairs.java b/src/net/minecraft/src/BlockStairs.java new file mode 100644 index 0000000..6b3d289 --- /dev/null +++ b/src/net/minecraft/src/BlockStairs.java @@ -0,0 +1,185 @@ +package net.minecraft.src; + +import java.util.ArrayList; +import java.util.Random; + +public class BlockStairs extends Block { + private Block modelBlock; + + protected BlockStairs(int var1, Block var2) { + super(var1, var2.blockIndexInTexture, var2.blockMaterial); + this.modelBlock = var2; + this.setHardness(var2.blockHardness); + this.setResistance(var2.blockResistance / 3.0F); + this.setStepSound(var2.stepSound); + this.setLightOpacity(255); + } + + public void setBlockBoundsBasedOnState(IBlockAccess var1, int var2, int var3, int var4) { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + } + + public AxisAlignedBB getCollisionBoundingBoxFromPool(World var1, int var2, int var3, int var4) { + return super.getCollisionBoundingBoxFromPool(var1, var2, var3, var4); + } + + public boolean isOpaqueCube() { + return false; + } + + public boolean renderAsNormalBlock() { + return false; + } + + public int getRenderType() { + return 10; + } + + public boolean shouldSideBeRendered(IBlockAccess var1, int var2, int var3, int var4, int var5) { + return super.shouldSideBeRendered(var1, var2, var3, var4, var5); + } + + public void getCollidingBoundingBoxes(World var1, int var2, int var3, int var4, AxisAlignedBB var5, ArrayList var6) { + int var7 = var1.getBlockMetadata(var2, var3, var4); + if(var7 == 0) { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 0.5F, 0.5F, 1.0F); + super.getCollidingBoundingBoxes(var1, var2, var3, var4, var5, var6); + this.setBlockBounds(0.5F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + super.getCollidingBoundingBoxes(var1, var2, var3, var4, var5, var6); + } else if(var7 == 1) { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 0.5F, 1.0F, 1.0F); + super.getCollidingBoundingBoxes(var1, var2, var3, var4, var5, var6); + this.setBlockBounds(0.5F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F); + super.getCollidingBoundingBoxes(var1, var2, var3, var4, var5, var6); + } else if(var7 == 2) { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 0.5F); + super.getCollidingBoundingBoxes(var1, var2, var3, var4, var5, var6); + this.setBlockBounds(0.0F, 0.0F, 0.5F, 1.0F, 1.0F, 1.0F); + super.getCollidingBoundingBoxes(var1, var2, var3, var4, var5, var6); + } else if(var7 == 3) { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 0.5F); + super.getCollidingBoundingBoxes(var1, var2, var3, var4, var5, var6); + this.setBlockBounds(0.0F, 0.0F, 0.5F, 1.0F, 0.5F, 1.0F); + super.getCollidingBoundingBoxes(var1, var2, var3, var4, var5, var6); + } + + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + } + + public void randomDisplayTick(World var1, int var2, int var3, int var4, Random var5) { + this.modelBlock.randomDisplayTick(var1, var2, var3, var4, var5); + } + + public void onBlockClicked(World var1, int var2, int var3, int var4, EntityPlayer var5) { + this.modelBlock.onBlockClicked(var1, var2, var3, var4, var5); + } + + public void onBlockDestroyedByPlayer(World var1, int var2, int var3, int var4, int var5) { + this.modelBlock.onBlockDestroyedByPlayer(var1, var2, var3, var4, var5); + } + + public float getBlockBrightness(IBlockAccess var1, int var2, int var3, int var4) { + return this.modelBlock.getBlockBrightness(var1, var2, var3, var4); + } + + public float getExplosionResistance(Entity var1) { + return this.modelBlock.getExplosionResistance(var1); + } + + public int getRenderBlockPass() { + return this.modelBlock.getRenderBlockPass(); + } + + public int idDropped(int var1, Random var2) { + return this.modelBlock.idDropped(var1, var2); + } + + public int quantityDropped(Random var1) { + return this.modelBlock.quantityDropped(var1); + } + + public int getBlockTextureFromSideAndMetadata(int var1, int var2) { + return this.modelBlock.getBlockTextureFromSideAndMetadata(var1, var2); + } + + public int getBlockTextureFromSide(int var1) { + return this.modelBlock.getBlockTextureFromSide(var1); + } + + public int getBlockTexture(IBlockAccess var1, int var2, int var3, int var4, int var5) { + return this.modelBlock.getBlockTexture(var1, var2, var3, var4, var5); + } + + public int tickRate() { + return this.modelBlock.tickRate(); + } + + public AxisAlignedBB getSelectedBoundingBoxFromPool(World var1, int var2, int var3, int var4) { + return this.modelBlock.getSelectedBoundingBoxFromPool(var1, var2, var3, var4); + } + + public void velocityToAddToEntity(World var1, int var2, int var3, int var4, Entity var5, Vec3D var6) { + this.modelBlock.velocityToAddToEntity(var1, var2, var3, var4, var5, var6); + } + + public boolean isCollidable() { + return this.modelBlock.isCollidable(); + } + + public boolean canCollideCheck(int var1, boolean var2) { + return this.modelBlock.canCollideCheck(var1, var2); + } + + public boolean canPlaceBlockAt(World var1, int var2, int var3, int var4) { + return this.modelBlock.canPlaceBlockAt(var1, var2, var3, var4); + } + + public void onBlockAdded(World var1, int var2, int var3, int var4) { + this.onNeighborBlockChange(var1, var2, var3, var4, 0); + this.modelBlock.onBlockAdded(var1, var2, var3, var4); + } + + public void onBlockRemoval(World var1, int var2, int var3, int var4) { + this.modelBlock.onBlockRemoval(var1, var2, var3, var4); + } + + public void dropBlockAsItemWithChance(World var1, int var2, int var3, int var4, int var5, float var6) { + this.modelBlock.dropBlockAsItemWithChance(var1, var2, var3, var4, var5, var6); + } + + public void onEntityWalking(World var1, int var2, int var3, int var4, Entity var5) { + this.modelBlock.onEntityWalking(var1, var2, var3, var4, var5); + } + + public void updateTick(World var1, int var2, int var3, int var4, Random var5) { + this.modelBlock.updateTick(var1, var2, var3, var4, var5); + } + + public boolean blockActivated(World var1, int var2, int var3, int var4, EntityPlayer var5) { + return this.modelBlock.blockActivated(var1, var2, var3, var4, var5); + } + + public void onBlockDestroyedByExplosion(World var1, int var2, int var3, int var4) { + this.modelBlock.onBlockDestroyedByExplosion(var1, var2, var3, var4); + } + + public void onBlockPlacedBy(World var1, int var2, int var3, int var4, EntityLiving var5) { + int var6 = MathHelper.floor_double((double)(var5.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; + if(var6 == 0) { + var1.setBlockMetadataWithNotify(var2, var3, var4, 2); + } + + if(var6 == 1) { + var1.setBlockMetadataWithNotify(var2, var3, var4, 1); + } + + if(var6 == 2) { + var1.setBlockMetadataWithNotify(var2, var3, var4, 3); + } + + if(var6 == 3) { + var1.setBlockMetadataWithNotify(var2, var3, var4, 0); + } + + } +} diff --git a/src/net/minecraft/src/BlockStationary.java b/src/net/minecraft/src/BlockStationary.java new file mode 100644 index 0000000..27737d5 --- /dev/null +++ b/src/net/minecraft/src/BlockStationary.java @@ -0,0 +1,57 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockStationary extends BlockFluid { + protected BlockStationary(int var1, Material var2) { + super(var1, var2); + this.setTickOnLoad(false); + if(var2 == Material.lava) { + this.setTickOnLoad(true); + } + + } + + public void onNeighborBlockChange(World var1, int var2, int var3, int var4, int var5) { + super.onNeighborBlockChange(var1, var2, var3, var4, var5); + if(var1.getBlockId(var2, var3, var4) == this.blockID) { + this.func_30004_j(var1, var2, var3, var4); + } + + } + + private void func_30004_j(World var1, int var2, int var3, int var4) { + int var5 = var1.getBlockMetadata(var2, var3, var4); + var1.editingBlocks = true; + var1.setBlockAndMetadata(var2, var3, var4, this.blockID - 1, var5); + var1.markBlocksDirty(var2, var3, var4, var2, var3, var4); + var1.scheduleBlockUpdate(var2, var3, var4, this.blockID - 1, this.tickRate()); + var1.editingBlocks = false; + } + + public void updateTick(World var1, int var2, int var3, int var4, Random var5) { + if(this.blockMaterial == Material.lava) { + int var6 = var5.nextInt(3); + + for(int var7 = 0; var7 < var6; ++var7) { + var2 += var5.nextInt(3) - 1; + ++var3; + var4 += var5.nextInt(3) - 1; + int var8 = var1.getBlockId(var2, var3, var4); + if(var8 == 0) { + if(this.func_301_k(var1, var2 - 1, var3, var4) || this.func_301_k(var1, var2 + 1, var3, var4) || this.func_301_k(var1, var2, var3, var4 - 1) || this.func_301_k(var1, var2, var3, var4 + 1) || this.func_301_k(var1, var2, var3 - 1, var4) || this.func_301_k(var1, var2, var3 + 1, var4)) { + var1.setBlockWithNotify(var2, var3, var4, Block.fire.blockID); + return; + } + } else if(Block.blocksList[var8].blockMaterial.getIsSolid()) { + return; + } + } + } + + } + + private boolean func_301_k(World var1, int var2, int var3, int var4) { + return var1.getBlockMaterial(var2, var3, var4).getBurning(); + } +} diff --git a/src/net/minecraft/src/BlockStep.java b/src/net/minecraft/src/BlockStep.java new file mode 100644 index 0000000..67f72a0 --- /dev/null +++ b/src/net/minecraft/src/BlockStep.java @@ -0,0 +1,71 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockStep extends Block { + public static final String[] field_22037_a = new String[]{"stone", "sand", "wood", "cobble"}; + private boolean blockType; + + public BlockStep(int var1, boolean var2) { + super(var1, 6, Material.rock); + this.blockType = var2; + if(!var2) { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F); + } + + this.setLightOpacity(255); + } + + public int getBlockTextureFromSideAndMetadata(int var1, int var2) { + return var2 == 0 ? (var1 <= 1 ? 6 : 5) : (var2 == 1 ? (var1 == 0 ? 208 : (var1 == 1 ? 176 : 192)) : (var2 == 2 ? 4 : (var2 == 3 ? 16 : 6))); + } + + public int getBlockTextureFromSide(int var1) { + return this.getBlockTextureFromSideAndMetadata(var1, 0); + } + + public boolean isOpaqueCube() { + return this.blockType; + } + + public void onBlockAdded(World var1, int var2, int var3, int var4) { + if(this != Block.stairSingle) { + super.onBlockAdded(var1, var2, var3, var4); + } + + int var5 = var1.getBlockId(var2, var3 - 1, var4); + int var6 = var1.getBlockMetadata(var2, var3, var4); + int var7 = var1.getBlockMetadata(var2, var3 - 1, var4); + if(var6 == var7) { + if(var5 == stairSingle.blockID) { + var1.setBlockWithNotify(var2, var3, var4, 0); + var1.setBlockAndMetadataWithNotify(var2, var3 - 1, var4, Block.stairDouble.blockID, var6); + } + + } + } + + public int idDropped(int var1, Random var2) { + return Block.stairSingle.blockID; + } + + public int quantityDropped(Random var1) { + return this.blockType ? 2 : 1; + } + + protected int damageDropped(int var1) { + return var1; + } + + public boolean renderAsNormalBlock() { + return this.blockType; + } + + public boolean shouldSideBeRendered(IBlockAccess var1, int var2, int var3, int var4, int var5) { + if(this != Block.stairSingle) { + super.shouldSideBeRendered(var1, var2, var3, var4, var5); + } + + return var5 == 1 ? true : (!super.shouldSideBeRendered(var1, var2, var3, var4, var5) ? false : (var5 == 0 ? true : var1.getBlockId(var2, var3, var4) != this.blockID)); + } +} diff --git a/src/net/minecraft/src/BlockStone.java b/src/net/minecraft/src/BlockStone.java new file mode 100644 index 0000000..5b460b7 --- /dev/null +++ b/src/net/minecraft/src/BlockStone.java @@ -0,0 +1,13 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockStone extends Block { + public BlockStone(int var1, int var2) { + super(var1, var2, Material.rock); + } + + public int idDropped(int var1, Random var2) { + return Block.cobblestone.blockID; + } +} diff --git a/src/net/minecraft/src/BlockTNT.java b/src/net/minecraft/src/BlockTNT.java new file mode 100644 index 0000000..6ca8cdc --- /dev/null +++ b/src/net/minecraft/src/BlockTNT.java @@ -0,0 +1,65 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockTNT extends Block { + public BlockTNT(int var1, int var2) { + super(var1, var2, Material.tnt); + } + + public int getBlockTextureFromSide(int var1) { + return var1 == 0 ? this.blockIndexInTexture + 2 : (var1 == 1 ? this.blockIndexInTexture + 1 : this.blockIndexInTexture); + } + + public void onBlockAdded(World var1, int var2, int var3, int var4) { + super.onBlockAdded(var1, var2, var3, var4); + if(var1.isBlockIndirectlyGettingPowered(var2, var3, var4)) { + this.onBlockDestroyedByPlayer(var1, var2, var3, var4, 1); + var1.setBlockWithNotify(var2, var3, var4, 0); + } + + } + + public void onNeighborBlockChange(World var1, int var2, int var3, int var4, int var5) { + if(var5 > 0 && Block.blocksList[var5].canProvidePower() && var1.isBlockIndirectlyGettingPowered(var2, var3, var4)) { + this.onBlockDestroyedByPlayer(var1, var2, var3, var4, 1); + var1.setBlockWithNotify(var2, var3, var4, 0); + } + + } + + public int quantityDropped(Random var1) { + return 0; + } + + public void onBlockDestroyedByExplosion(World var1, int var2, int var3, int var4) { + EntityTNTPrimed var5 = new EntityTNTPrimed(var1, (double)((float)var2 + 0.5F), (double)((float)var3 + 0.5F), (double)((float)var4 + 0.5F)); + var5.fuse = var1.rand.nextInt(var5.fuse / 4) + var5.fuse / 8; + var1.entityJoinedWorld(var5); + } + + public void onBlockDestroyedByPlayer(World var1, int var2, int var3, int var4, int var5) { + if(!var1.multiplayerWorld) { + if((var5 & 1) == 0) { + this.dropBlockAsItem_do(var1, var2, var3, var4, new ItemStack(Block.tnt.blockID, 1, 0)); + } else { + EntityTNTPrimed var6 = new EntityTNTPrimed(var1, (double)((float)var2 + 0.5F), (double)((float)var3 + 0.5F), (double)((float)var4 + 0.5F)); + var1.entityJoinedWorld(var6); + var1.playSoundAtEntity(var6, "random.fuse", 1.0F, 1.0F); + } + + } + } + + public void onBlockClicked(World var1, int var2, int var3, int var4, EntityPlayer var5) { + if(var5.getCurrentEquippedItem() != null && var5.getCurrentEquippedItem().itemID == Item.flintAndSteel.shiftedIndex) { + var1.setBlockMetadata(var2, var3, var4, 1); + } + + super.onBlockClicked(var1, var2, var3, var4, var5); + } + + public boolean blockActivated(World var1, int var2, int var3, int var4, EntityPlayer var5) { + return super.blockActivated(var1, var2, var3, var4, var5); + } +} diff --git a/src/net/minecraft/src/BlockTallGrass.java b/src/net/minecraft/src/BlockTallGrass.java new file mode 100644 index 0000000..e5b2e45 --- /dev/null +++ b/src/net/minecraft/src/BlockTallGrass.java @@ -0,0 +1,36 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockTallGrass extends BlockFlower { + protected BlockTallGrass(int var1, int var2) { + super(var1, var2); + float var3 = 0.4F; + this.setBlockBounds(0.5F - var3, 0.0F, 0.5F - var3, 0.5F + var3, 0.8F, 0.5F + var3); + } + + public int getBlockTextureFromSideAndMetadata(int var1, int var2) { + return var2 == 1 ? this.blockIndexInTexture : (var2 == 2 ? this.blockIndexInTexture + 16 + 1 : (var2 == 0 ? this.blockIndexInTexture + 16 : this.blockIndexInTexture)); + } + + public int colorMultiplier(IBlockAccess var1, int var2, int var3, int var4) { + int var5 = var1.getBlockMetadata(var2, var3, var4); + if(var5 == 0) { + return 16777215; + } else { + long var6 = (long)(var2 * 3129871 + var4 * 6129781 + var3); + var6 = var6 * var6 * 42317861L + var6 * 11L; + var2 = (int)((long)var2 + (var6 >> 14 & 31L)); + var3 = (int)((long)var3 + (var6 >> 19 & 31L)); + var4 = (int)((long)var4 + (var6 >> 24 & 31L)); + var1.getWorldChunkManager().func_4069_a(var2, var4, 1, 1); + double var8 = var1.getWorldChunkManager().temperature[0]; + double var10 = var1.getWorldChunkManager().humidity[0]; + return ColorizerGrass.getGrassColor(var8, var10); + } + } + + public int idDropped(int var1, Random var2) { + return var2.nextInt(8) == 0 ? Item.seeds.shiftedIndex : -1; + } +} diff --git a/src/net/minecraft/src/BlockTorch.java b/src/net/minecraft/src/BlockTorch.java new file mode 100644 index 0000000..edebfff --- /dev/null +++ b/src/net/minecraft/src/BlockTorch.java @@ -0,0 +1,170 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockTorch extends Block { + protected BlockTorch(int var1, int var2) { + super(var1, var2, Material.circuits); + this.setTickOnLoad(true); + } + + public AxisAlignedBB getCollisionBoundingBoxFromPool(World var1, int var2, int var3, int var4) { + return null; + } + + public boolean isOpaqueCube() { + return false; + } + + public boolean renderAsNormalBlock() { + return false; + } + + public int getRenderType() { + return 2; + } + + private boolean func_31032_h(World var1, int var2, int var3, int var4) { + return var1.isBlockNormalCube(var2, var3, var4) || var1.getBlockId(var2, var3, var4) == Block.fence.blockID; + } + + public boolean canPlaceBlockAt(World var1, int var2, int var3, int var4) { + return var1.isBlockNormalCube(var2 - 1, var3, var4) ? true : (var1.isBlockNormalCube(var2 + 1, var3, var4) ? true : (var1.isBlockNormalCube(var2, var3, var4 - 1) ? true : (var1.isBlockNormalCube(var2, var3, var4 + 1) ? true : this.func_31032_h(var1, var2, var3 - 1, var4)))); + } + + public void onBlockPlaced(World var1, int var2, int var3, int var4, int var5) { + int var6 = var1.getBlockMetadata(var2, var3, var4); + if(var5 == 1 && this.func_31032_h(var1, var2, var3 - 1, var4)) { + var6 = 5; + } + + if(var5 == 2 && var1.isBlockNormalCube(var2, var3, var4 + 1)) { + var6 = 4; + } + + if(var5 == 3 && var1.isBlockNormalCube(var2, var3, var4 - 1)) { + var6 = 3; + } + + if(var5 == 4 && var1.isBlockNormalCube(var2 + 1, var3, var4)) { + var6 = 2; + } + + if(var5 == 5 && var1.isBlockNormalCube(var2 - 1, var3, var4)) { + var6 = 1; + } + + var1.setBlockMetadataWithNotify(var2, var3, var4, var6); + } + + public void updateTick(World var1, int var2, int var3, int var4, Random var5) { + super.updateTick(var1, var2, var3, var4, var5); + if(var1.getBlockMetadata(var2, var3, var4) == 0) { + this.onBlockAdded(var1, var2, var3, var4); + } + + } + + public void onBlockAdded(World var1, int var2, int var3, int var4) { + if(var1.isBlockNormalCube(var2 - 1, var3, var4)) { + var1.setBlockMetadataWithNotify(var2, var3, var4, 1); + } else if(var1.isBlockNormalCube(var2 + 1, var3, var4)) { + var1.setBlockMetadataWithNotify(var2, var3, var4, 2); + } else if(var1.isBlockNormalCube(var2, var3, var4 - 1)) { + var1.setBlockMetadataWithNotify(var2, var3, var4, 3); + } else if(var1.isBlockNormalCube(var2, var3, var4 + 1)) { + var1.setBlockMetadataWithNotify(var2, var3, var4, 4); + } else if(this.func_31032_h(var1, var2, var3 - 1, var4)) { + var1.setBlockMetadataWithNotify(var2, var3, var4, 5); + } + + this.dropTorchIfCantStay(var1, var2, var3, var4); + } + + public void onNeighborBlockChange(World var1, int var2, int var3, int var4, int var5) { + if(this.dropTorchIfCantStay(var1, var2, var3, var4)) { + int var6 = var1.getBlockMetadata(var2, var3, var4); + boolean var7 = false; + if(!var1.isBlockNormalCube(var2 - 1, var3, var4) && var6 == 1) { + var7 = true; + } + + if(!var1.isBlockNormalCube(var2 + 1, var3, var4) && var6 == 2) { + var7 = true; + } + + if(!var1.isBlockNormalCube(var2, var3, var4 - 1) && var6 == 3) { + var7 = true; + } + + if(!var1.isBlockNormalCube(var2, var3, var4 + 1) && var6 == 4) { + var7 = true; + } + + if(!this.func_31032_h(var1, var2, var3 - 1, var4) && var6 == 5) { + var7 = true; + } + + if(var7) { + this.dropBlockAsItem(var1, var2, var3, var4, var1.getBlockMetadata(var2, var3, var4)); + var1.setBlockWithNotify(var2, var3, var4, 0); + } + } + + } + + private boolean dropTorchIfCantStay(World var1, int var2, int var3, int var4) { + if(!this.canPlaceBlockAt(var1, var2, var3, var4)) { + this.dropBlockAsItem(var1, var2, var3, var4, var1.getBlockMetadata(var2, var3, var4)); + var1.setBlockWithNotify(var2, var3, var4, 0); + return false; + } else { + return true; + } + } + + public MovingObjectPosition collisionRayTrace(World var1, int var2, int var3, int var4, Vec3D var5, Vec3D var6) { + int var7 = var1.getBlockMetadata(var2, var3, var4) & 7; + float var8 = 0.15F; + if(var7 == 1) { + this.setBlockBounds(0.0F, 0.2F, 0.5F - var8, var8 * 2.0F, 0.8F, 0.5F + var8); + } else if(var7 == 2) { + this.setBlockBounds(1.0F - var8 * 2.0F, 0.2F, 0.5F - var8, 1.0F, 0.8F, 0.5F + var8); + } else if(var7 == 3) { + this.setBlockBounds(0.5F - var8, 0.2F, 0.0F, 0.5F + var8, 0.8F, var8 * 2.0F); + } else if(var7 == 4) { + this.setBlockBounds(0.5F - var8, 0.2F, 1.0F - var8 * 2.0F, 0.5F + var8, 0.8F, 1.0F); + } else { + var8 = 0.1F; + this.setBlockBounds(0.5F - var8, 0.0F, 0.5F - var8, 0.5F + var8, 0.6F, 0.5F + var8); + } + + return super.collisionRayTrace(var1, var2, var3, var4, var5, var6); + } + + public void randomDisplayTick(World var1, int var2, int var3, int var4, Random var5) { + int var6 = var1.getBlockMetadata(var2, var3, var4); + double var7 = (double)((float)var2 + 0.5F); + double var9 = (double)((float)var3 + 0.7F); + double var11 = (double)((float)var4 + 0.5F); + double var13 = (double)0.22F; + double var15 = (double)0.27F; + if(var6 == 1) { + var1.spawnParticle("smoke", var7 - var15, var9 + var13, var11, 0.0D, 0.0D, 0.0D); + var1.spawnParticle("flame", var7 - var15, var9 + var13, var11, 0.0D, 0.0D, 0.0D); + } else if(var6 == 2) { + var1.spawnParticle("smoke", var7 + var15, var9 + var13, var11, 0.0D, 0.0D, 0.0D); + var1.spawnParticle("flame", var7 + var15, var9 + var13, var11, 0.0D, 0.0D, 0.0D); + } else if(var6 == 3) { + var1.spawnParticle("smoke", var7, var9 + var13, var11 - var15, 0.0D, 0.0D, 0.0D); + var1.spawnParticle("flame", var7, var9 + var13, var11 - var15, 0.0D, 0.0D, 0.0D); + } else if(var6 == 4) { + var1.spawnParticle("smoke", var7, var9 + var13, var11 + var15, 0.0D, 0.0D, 0.0D); + var1.spawnParticle("flame", var7, var9 + var13, var11 + var15, 0.0D, 0.0D, 0.0D); + } else { + var1.spawnParticle("smoke", var7, var9, var11, 0.0D, 0.0D, 0.0D); + var1.spawnParticle("flame", var7, var9, var11, 0.0D, 0.0D, 0.0D); + } + + } +} diff --git a/src/net/minecraft/src/BlockTrapDoor.java b/src/net/minecraft/src/BlockTrapDoor.java new file mode 100644 index 0000000..bbbcf49 --- /dev/null +++ b/src/net/minecraft/src/BlockTrapDoor.java @@ -0,0 +1,183 @@ +package net.minecraft.src; + +public class BlockTrapDoor extends Block { + protected BlockTrapDoor(int var1, Material var2) { + super(var1, var2); + this.blockIndexInTexture = 84; + if(var2 == Material.iron) { + ++this.blockIndexInTexture; + } + + float var3 = 0.5F; + float var4 = 1.0F; + this.setBlockBounds(0.5F - var3, 0.0F, 0.5F - var3, 0.5F + var3, var4, 0.5F + var3); + } + + public boolean isOpaqueCube() { + return false; + } + + public boolean renderAsNormalBlock() { + return false; + } + + public int getRenderType() { + return 0; + } + + public AxisAlignedBB getSelectedBoundingBoxFromPool(World var1, int var2, int var3, int var4) { + this.setBlockBoundsBasedOnState(var1, var2, var3, var4); + return super.getSelectedBoundingBoxFromPool(var1, var2, var3, var4); + } + + public AxisAlignedBB getCollisionBoundingBoxFromPool(World var1, int var2, int var3, int var4) { + this.setBlockBoundsBasedOnState(var1, var2, var3, var4); + return super.getCollisionBoundingBoxFromPool(var1, var2, var3, var4); + } + + public void setBlockBoundsBasedOnState(IBlockAccess var1, int var2, int var3, int var4) { + this.setBlockBoundsForBlockRender(var1.getBlockMetadata(var2, var3, var4)); + } + + public void setBlockBoundsForItemRender() { + float var1 = 3.0F / 16.0F; + this.setBlockBounds(0.0F, 0.5F - var1 / 2.0F, 0.0F, 1.0F, 0.5F + var1 / 2.0F, 1.0F); + } + + public void setBlockBoundsForBlockRender(int var1) { + float var2 = 3.0F / 16.0F; + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, var2, 1.0F); + if(isTrapdoorOpen(var1)) { + if((var1 & 3) == 0) { + this.setBlockBounds(0.0F, 0.0F, 1.0F - var2, 1.0F, 1.0F, 1.0F); + } + + if((var1 & 3) == 1) { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, var2); + } + + if((var1 & 3) == 2) { + this.setBlockBounds(1.0F - var2, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + } + + if((var1 & 3) == 3) { + this.setBlockBounds(0.0F, 0.0F, 0.0F, var2, 1.0F, 1.0F); + } + } + + } + + public void onBlockClicked(World var1, int var2, int var3, int var4, EntityPlayer var5) { + this.blockActivated(var1, var2, var3, var4, var5); + } + + public boolean blockActivated(World var1, int var2, int var3, int var4, EntityPlayer var5) { + if(this.blockMaterial == Material.iron) { + return true; + } else { + int var6 = var1.getBlockMetadata(var2, var3, var4); + var1.setBlockMetadataWithNotify(var2, var3, var4, var6 ^ 4); + var1.func_28107_a(var5, 1003, var2, var3, var4, 0); + return true; + } + } + + public void onPoweredBlockChange(World var1, int var2, int var3, int var4, boolean var5) { + int var6 = var1.getBlockMetadata(var2, var3, var4); + boolean var7 = (var6 & 4) > 0; + if(var7 != var5) { + var1.setBlockMetadataWithNotify(var2, var3, var4, var6 ^ 4); + var1.func_28107_a((EntityPlayer)null, 1003, var2, var3, var4, 0); + } + } + + public void onNeighborBlockChange(World var1, int var2, int var3, int var4, int var5) { + if(!var1.multiplayerWorld) { + int var6 = var1.getBlockMetadata(var2, var3, var4); + int var7 = var2; + int var8 = var4; + if((var6 & 3) == 0) { + var8 = var4 + 1; + } + + if((var6 & 3) == 1) { + --var8; + } + + if((var6 & 3) == 2) { + var7 = var2 + 1; + } + + if((var6 & 3) == 3) { + --var7; + } + + if(!var1.isBlockNormalCube(var7, var3, var8)) { + var1.setBlockWithNotify(var2, var3, var4, 0); + this.dropBlockAsItem(var1, var2, var3, var4, var6); + } + + if(var5 > 0 && Block.blocksList[var5].canProvidePower()) { + boolean var9 = var1.isBlockIndirectlyGettingPowered(var2, var3, var4); + this.onPoweredBlockChange(var1, var2, var3, var4, var9); + } + + } + } + + public MovingObjectPosition collisionRayTrace(World var1, int var2, int var3, int var4, Vec3D var5, Vec3D var6) { + this.setBlockBoundsBasedOnState(var1, var2, var3, var4); + return super.collisionRayTrace(var1, var2, var3, var4, var5, var6); + } + + public void onBlockPlaced(World var1, int var2, int var3, int var4, int var5) { + byte var6 = 0; + if(var5 == 2) { + var6 = 0; + } + + if(var5 == 3) { + var6 = 1; + } + + if(var5 == 4) { + var6 = 2; + } + + if(var5 == 5) { + var6 = 3; + } + + var1.setBlockMetadataWithNotify(var2, var3, var4, var6); + } + + public boolean canPlaceBlockOnSide(World var1, int var2, int var3, int var4, int var5) { + if(var5 == 0) { + return false; + } else if(var5 == 1) { + return false; + } else { + if(var5 == 2) { + ++var4; + } + + if(var5 == 3) { + --var4; + } + + if(var5 == 4) { + ++var2; + } + + if(var5 == 5) { + --var2; + } + + return var1.isBlockNormalCube(var2, var3, var4); + } + } + + public static boolean isTrapdoorOpen(int var0) { + return (var0 & 4) != 0; + } +} diff --git a/src/net/minecraft/src/BlockWeb.java b/src/net/minecraft/src/BlockWeb.java new file mode 100644 index 0000000..b78e03d --- /dev/null +++ b/src/net/minecraft/src/BlockWeb.java @@ -0,0 +1,33 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockWeb extends Block { + public BlockWeb(int var1, int var2) { + super(var1, var2, Material.field_31068_A); + } + + public void onEntityCollidedWithBlock(World var1, int var2, int var3, int var4, Entity var5) { + var5.isInWeb = true; + } + + public boolean isOpaqueCube() { + return false; + } + + public AxisAlignedBB getCollisionBoundingBoxFromPool(World var1, int var2, int var3, int var4) { + return null; + } + + public int getRenderType() { + return 1; + } + + public boolean renderAsNormalBlock() { + return false; + } + + public int idDropped(int var1, Random var2) { + return Item.silk.shiftedIndex; + } +} diff --git a/src/net/minecraft/src/BlockWorkbench.java b/src/net/minecraft/src/BlockWorkbench.java new file mode 100644 index 0000000..ea8a195 --- /dev/null +++ b/src/net/minecraft/src/BlockWorkbench.java @@ -0,0 +1,21 @@ +package net.minecraft.src; + +public class BlockWorkbench extends Block { + protected BlockWorkbench(int var1) { + super(var1, Material.wood); + this.blockIndexInTexture = 59; + } + + public int getBlockTextureFromSide(int var1) { + return var1 == 1 ? this.blockIndexInTexture - 16 : (var1 == 0 ? Block.planks.getBlockTextureFromSide(0) : (var1 != 2 && var1 != 4 ? this.blockIndexInTexture : this.blockIndexInTexture + 1)); + } + + public boolean blockActivated(World var1, int var2, int var3, int var4, EntityPlayer var5) { + if(var1.multiplayerWorld) { + return true; + } else { + var5.displayWorkbenchGUI(var2, var3, var4); + return true; + } + } +} diff --git a/src/net/minecraft/src/CanvasCrashReport.java b/src/net/minecraft/src/CanvasCrashReport.java new file mode 100644 index 0000000..f87c1ac --- /dev/null +++ b/src/net/minecraft/src/CanvasCrashReport.java @@ -0,0 +1,11 @@ +package net.minecraft.src; + +import java.awt.Canvas; +import java.awt.Dimension; + +class CanvasCrashReport extends Canvas { + public CanvasCrashReport(int var1) { + this.setPreferredSize(new Dimension(var1, var1)); + this.setMinimumSize(new Dimension(var1, var1)); + } +} diff --git a/src/net/minecraft/src/CanvasIsomPreview.java b/src/net/minecraft/src/CanvasIsomPreview.java new file mode 100644 index 0000000..0636ffc --- /dev/null +++ b/src/net/minecraft/src/CanvasIsomPreview.java @@ -0,0 +1,380 @@ +package net.minecraft.src; + +import java.awt.Canvas; +import java.awt.Color; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Rectangle; +import java.awt.RenderingHints; +import java.awt.event.KeyEvent; +import java.awt.event.KeyListener; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.awt.event.MouseMotionListener; +import java.awt.geom.AffineTransform; +import java.awt.image.BufferStrategy; +import java.awt.image.ImageObserver; +import java.io.File; +import java.util.Collections; +import java.util.LinkedList; +import java.util.List; +import java.util.Random; + +public class CanvasIsomPreview extends Canvas implements KeyListener, MouseListener, MouseMotionListener, Runnable { + private int field_1793_a = 0; + private int zoomLevel = 2; + private boolean displayHelpText = true; + private World worldObj; + private File dataFolder = this.getMinecraftDir(); + private boolean running = true; + private List imageBufferList = Collections.synchronizedList(new LinkedList()); + private IsoImageBuffer[][] imageBuffers = new IsoImageBuffer[64][64]; + private int field_1785_i; + private int field_1784_j; + private int xPosition; + private int yPosition; + + public File getMinecraftDir() { + if(this.dataFolder == null) { + this.dataFolder = this.getAppDir("minecraft"); + } + + return this.dataFolder; + } + + public File getAppDir(String var1) { + String var2 = System.getProperty("user.home", "."); + File var3; + switch(OsMap.field_1193_a[getOs().ordinal()]) { + case 1: + case 2: + var3 = new File(var2, '.' + var1 + '/'); + break; + case 3: + String var4 = System.getenv("APPDATA"); + if(var4 != null) { + var3 = new File(var4, "." + var1 + '/'); + } else { + var3 = new File(var2, '.' + var1 + '/'); + } + break; + case 4: + var3 = new File(var2, "Library/Application Support/" + var1); + break; + default: + var3 = new File(var2, var1 + '/'); + } + + if(!var3.exists() && !var3.mkdirs()) { + throw new RuntimeException("The working directory could not be created: " + var3); + } else { + return var3; + } + } + + private static EnumOS1 getOs() { + String var0 = System.getProperty("os.name").toLowerCase(); + return var0.contains("win") ? EnumOS1.windows : (var0.contains("mac") ? EnumOS1.macos : (var0.contains("solaris") ? EnumOS1.solaris : (var0.contains("sunos") ? EnumOS1.solaris : (var0.contains("linux") ? EnumOS1.linux : (var0.contains("unix") ? EnumOS1.linux : EnumOS1.unknown))))); + } + + public CanvasIsomPreview() { + for(int var1 = 0; var1 < 64; ++var1) { + for(int var2 = 0; var2 < 64; ++var2) { + this.imageBuffers[var1][var2] = new IsoImageBuffer((World)null, var1, var2); + } + } + + this.addMouseListener(this); + this.addMouseMotionListener(this); + this.addKeyListener(this); + this.setFocusable(true); + this.requestFocus(); + this.setBackground(Color.red); + } + + public void loadWorld(String var1) { + this.field_1785_i = this.field_1784_j = 0; + this.worldObj = new World(new SaveHandler(new File(this.dataFolder, "saves"), var1, false), var1, (new Random()).nextLong()); + this.worldObj.skylightSubtracted = 0; + List var2 = this.imageBufferList; + synchronized(var2) { + this.imageBufferList.clear(); + + for(int var3 = 0; var3 < 64; ++var3) { + for(int var4 = 0; var4 < 64; ++var4) { + this.imageBuffers[var3][var4].func_888_a(this.worldObj, var3, var4); + } + } + + } + } + + private void setTimeOfDay(int var1) { + List var2 = this.imageBufferList; + synchronized(var2) { + this.worldObj.skylightSubtracted = var1; + this.imageBufferList.clear(); + + for(int var3 = 0; var3 < 64; ++var3) { + for(int var4 = 0; var4 < 64; ++var4) { + this.imageBuffers[var3][var4].func_888_a(this.worldObj, var3, var4); + } + } + + } + } + + public void func_1272_b() { + (new ThreadRunIsoClient(this)).start(); + + for(int var1 = 0; var1 < 8; ++var1) { + (new Thread(this)).start(); + } + + } + + public void exit() { + this.running = false; + } + + private IsoImageBuffer getImageBuffer(int var1, int var2) { + int var3 = var1 & 63; + int var4 = var2 & 63; + IsoImageBuffer var5 = this.imageBuffers[var3][var4]; + if(var5.field_1354_c == var1 && var5.field_1353_d == var2) { + return var5; + } else { + List var6 = this.imageBufferList; + synchronized(var6) { + this.imageBufferList.remove(var5); + } + + var5.func_889_a(var1, var2); + return var5; + } + } + + public void run() { + TerrainTextureManager var1 = new TerrainTextureManager(); + + while(this.running) { + IsoImageBuffer var2 = null; + List var3 = this.imageBufferList; + synchronized(var3) { + if(this.imageBufferList.size() > 0) { + var2 = (IsoImageBuffer)this.imageBufferList.remove(0); + } + } + + if(var2 != null) { + if(this.field_1793_a - var2.field_1350_g < 2) { + var1.func_799_a(var2); + this.repaint(); + } else { + var2.field_1349_h = false; + } + } + + try { + Thread.sleep(2L); + } catch (InterruptedException var5) { + var5.printStackTrace(); + } + } + + } + + public void update(Graphics var1) { + } + + public void paint(Graphics var1) { + } + + public void showNextBuffer() { + BufferStrategy var1 = this.getBufferStrategy(); + if(var1 == null) { + this.createBufferStrategy(2); + } else { + this.drawScreen((Graphics2D)var1.getDrawGraphics()); + var1.show(); + } + } + + public void drawScreen(Graphics2D var1) { + ++this.field_1793_a; + AffineTransform var2 = var1.getTransform(); + var1.setClip(0, 0, this.getWidth(), this.getHeight()); + var1.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR); + var1.translate(this.getWidth() / 2, this.getHeight() / 2); + var1.scale((double)this.zoomLevel, (double)this.zoomLevel); + var1.translate(this.field_1785_i, this.field_1784_j); + if(this.worldObj != null) { + ChunkCoordinates var3 = this.worldObj.getSpawnPoint(); + var1.translate(-(var3.x + var3.z), -(-var3.x + var3.z) + 64); + } + + Rectangle var17 = var1.getClipBounds(); + var1.setColor(new Color(-15724512)); + var1.fillRect(var17.x, var17.y, var17.width, var17.height); + byte var4 = 16; + byte var5 = 3; + int var6 = var17.x / var4 / 2 - 2 - var5; + int var7 = (var17.x + var17.width) / var4 / 2 + 1 + var5; + int var8 = var17.y / var4 - 1 - var5 * 2; + int var9 = (var17.y + var17.height + 16 + 128) / var4 + 1 + var5 * 2; + + int var10; + for(var10 = var8; var10 <= var9; ++var10) { + for(int var11 = var6; var11 <= var7; ++var11) { + int var12 = var11 - (var10 >> 1); + int var13 = var11 + (var10 + 1 >> 1); + IsoImageBuffer var14 = this.getImageBuffer(var12, var13); + var14.field_1350_g = this.field_1793_a; + if(!var14.field_1352_e) { + if(!var14.field_1349_h) { + var14.field_1349_h = true; + this.imageBufferList.add(var14); + } + } else { + var14.field_1349_h = false; + if(!var14.field_1351_f) { + int var15 = var11 * var4 * 2 + (var10 & 1) * var4; + int var16 = var10 * var4 - 128 - 16; + var1.drawImage(var14.field_1348_a, var15, var16, (ImageObserver)null); + } + } + } + } + + if(this.displayHelpText) { + var1.setTransform(var2); + var10 = this.getHeight() - 32 - 4; + var1.setColor(new Color(Integer.MIN_VALUE, true)); + var1.fillRect(4, this.getHeight() - 32 - 4, this.getWidth() - 8, 32); + var1.setColor(Color.WHITE); + String var18 = "F1 - F5: load levels | 0-9: Set time of day | Space: return to spawn | Double click: zoom | Escape: hide this text"; + var1.drawString(var18, this.getWidth() / 2 - var1.getFontMetrics().stringWidth(var18) / 2, var10 + 20); + } + + var1.dispose(); + } + + public void mouseDragged(MouseEvent var1) { + int var2 = var1.getX() / this.zoomLevel; + int var3 = var1.getY() / this.zoomLevel; + this.field_1785_i += var2 - this.xPosition; + this.field_1784_j += var3 - this.yPosition; + this.xPosition = var2; + this.yPosition = var3; + this.repaint(); + } + + public void mouseMoved(MouseEvent var1) { + } + + public void mouseClicked(MouseEvent var1) { + if(var1.getClickCount() == 2) { + this.zoomLevel = 3 - this.zoomLevel; + this.repaint(); + } + + } + + public void mouseEntered(MouseEvent var1) { + } + + public void mouseExited(MouseEvent var1) { + } + + public void mousePressed(MouseEvent var1) { + int var2 = var1.getX() / this.zoomLevel; + int var3 = var1.getY() / this.zoomLevel; + this.xPosition = var2; + this.yPosition = var3; + } + + public void mouseReleased(MouseEvent var1) { + } + + public void keyPressed(KeyEvent var1) { + if(var1.getKeyCode() == 48) { + this.setTimeOfDay(11); + } + + if(var1.getKeyCode() == 49) { + this.setTimeOfDay(10); + } + + if(var1.getKeyCode() == 50) { + this.setTimeOfDay(9); + } + + if(var1.getKeyCode() == 51) { + this.setTimeOfDay(7); + } + + if(var1.getKeyCode() == 52) { + this.setTimeOfDay(6); + } + + if(var1.getKeyCode() == 53) { + this.setTimeOfDay(5); + } + + if(var1.getKeyCode() == 54) { + this.setTimeOfDay(3); + } + + if(var1.getKeyCode() == 55) { + this.setTimeOfDay(2); + } + + if(var1.getKeyCode() == 56) { + this.setTimeOfDay(1); + } + + if(var1.getKeyCode() == 57) { + this.setTimeOfDay(0); + } + + if(var1.getKeyCode() == 112) { + this.loadWorld("World1"); + } + + if(var1.getKeyCode() == 113) { + this.loadWorld("World2"); + } + + if(var1.getKeyCode() == 114) { + this.loadWorld("World3"); + } + + if(var1.getKeyCode() == 115) { + this.loadWorld("World4"); + } + + if(var1.getKeyCode() == 116) { + this.loadWorld("World5"); + } + + if(var1.getKeyCode() == 32) { + this.field_1785_i = this.field_1784_j = 0; + } + + if(var1.getKeyCode() == 27) { + this.displayHelpText = !this.displayHelpText; + } + + this.repaint(); + } + + public void keyReleased(KeyEvent var1) { + } + + public void keyTyped(KeyEvent var1) { + } + + static boolean isRunning(CanvasIsomPreview var0) { + return var0.running; + } +} diff --git a/src/net/minecraft/src/CanvasMinecraftApplet.java b/src/net/minecraft/src/CanvasMinecraftApplet.java new file mode 100644 index 0000000..7ff3469 --- /dev/null +++ b/src/net/minecraft/src/CanvasMinecraftApplet.java @@ -0,0 +1,22 @@ +package net.minecraft.src; + +import java.awt.Canvas; +import net.minecraft.client.MinecraftApplet; + +public class CanvasMinecraftApplet extends Canvas { + final MinecraftApplet mcApplet; + + public CanvasMinecraftApplet(MinecraftApplet var1) { + this.mcApplet = var1; + } + + public synchronized void addNotify() { + super.addNotify(); + this.mcApplet.startMainThread(); + } + + public synchronized void removeNotify() { + this.mcApplet.shutdown(); + super.removeNotify(); + } +} diff --git a/src/net/minecraft/src/CanvasMojangLogo.java b/src/net/minecraft/src/CanvasMojangLogo.java new file mode 100644 index 0000000..12186b1 --- /dev/null +++ b/src/net/minecraft/src/CanvasMojangLogo.java @@ -0,0 +1,29 @@ +package net.minecraft.src; + +import java.awt.Canvas; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.image.BufferedImage; +import java.awt.image.ImageObserver; +import java.io.IOException; +import javax.imageio.ImageIO; + +class CanvasMojangLogo extends Canvas { + private BufferedImage logo; + + public CanvasMojangLogo() { + try { + this.logo = ImageIO.read(PanelCrashReport.class.getResource("/gui/logo.png")); + } catch (IOException var2) { + } + + byte var1 = 100; + this.setPreferredSize(new Dimension(var1, var1)); + this.setMinimumSize(new Dimension(var1, var1)); + } + + public void paint(Graphics var1) { + super.paint(var1); + var1.drawImage(this.logo, this.getWidth() / 2 - this.logo.getWidth() / 2, 32, (ImageObserver)null); + } +} diff --git a/src/net/minecraft/src/ChatAllowedCharacters.java b/src/net/minecraft/src/ChatAllowedCharacters.java new file mode 100644 index 0000000..a3ceb2c --- /dev/null +++ b/src/net/minecraft/src/ChatAllowedCharacters.java @@ -0,0 +1,33 @@ +package net.minecraft.src; + +import java.io.BufferedReader; +import java.io.InputStreamReader; + +public class ChatAllowedCharacters { + public static final String allowedCharacters = getAllowedCharacters(); + public static final char[] allowedCharactersArray = new char[]{'/', '\n', '\r', '\t', '\u0000', '\f', '`', '?', '*', '\\', '<', '>', '|', '\"', ':'}; + + private static String getAllowedCharacters() { + String var0 = ""; + + try { + BufferedReader var1 = new BufferedReader(new InputStreamReader(ChatAllowedCharacters.class.getResourceAsStream("/font.txt"), "UTF-8")); + String var2 = ""; + + while(true) { + var2 = var1.readLine(); + if(var2 == null) { + var1.close(); + break; + } + + if(!var2.startsWith("#")) { + var0 = var0 + var2; + } + } + } catch (Exception var3) { + } + + return var0; + } +} diff --git a/src/net/minecraft/src/ChatLine.java b/src/net/minecraft/src/ChatLine.java new file mode 100644 index 0000000..350b023 --- /dev/null +++ b/src/net/minecraft/src/ChatLine.java @@ -0,0 +1,11 @@ +package net.minecraft.src; + +public class ChatLine { + public String message; + public int updateCounter; + + public ChatLine(String var1) { + this.message = var1; + this.updateCounter = 0; + } +} diff --git a/src/net/minecraft/src/Chunk.java b/src/net/minecraft/src/Chunk.java new file mode 100644 index 0000000..d9d7684 --- /dev/null +++ b/src/net/minecraft/src/Chunk.java @@ -0,0 +1,605 @@ +package net.minecraft.src; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Random; + +public class Chunk { + public static boolean isLit; + public byte[] blocks; + public boolean isChunkLoaded; + public World worldObj; + public NibbleArray data; + public NibbleArray skylightMap; + public NibbleArray blocklightMap; + public byte[] heightMap; + public int lowestBlockHeight; + public final int xPosition; + public final int zPosition; + public Map chunkTileEntityMap; + public List[] entities; + public boolean isTerrainPopulated; + public boolean isModified; + public boolean neverSave; + public boolean hasEntities; + public long lastSaveTime; + + public Chunk(World var1, int var2, int var3) { + this.chunkTileEntityMap = new HashMap(); + this.entities = new List[8]; + this.isTerrainPopulated = false; + this.isModified = false; + this.hasEntities = false; + this.lastSaveTime = 0L; + this.worldObj = var1; + this.xPosition = var2; + this.zPosition = var3; + this.heightMap = new byte[256]; + + for(int var4 = 0; var4 < this.entities.length; ++var4) { + this.entities[var4] = new ArrayList(); + } + + } + + public Chunk(World var1, byte[] var2, int var3, int var4) { + this(var1, var3, var4); + this.blocks = var2; + this.data = new NibbleArray(var2.length); + this.skylightMap = new NibbleArray(var2.length); + this.blocklightMap = new NibbleArray(var2.length); + } + + public boolean isAtLocation(int var1, int var2) { + return var1 == this.xPosition && var2 == this.zPosition; + } + + public int getHeightValue(int var1, int var2) { + return this.heightMap[var2 << 4 | var1] & 255; + } + + public void func_1014_a() { + } + + public void generateHeightMap() { + int var1 = 127; + + for(int var2 = 0; var2 < 16; ++var2) { + for(int var3 = 0; var3 < 16; ++var3) { + int var4 = 127; + + for(int var5 = var2 << 11 | var3 << 7; var4 > 0 && Block.lightOpacity[this.blocks[var5 + var4 - 1] & 255] == 0; --var4) { + } + + this.heightMap[var3 << 4 | var2] = (byte)var4; + if(var4 < var1) { + var1 = var4; + } + } + } + + this.lowestBlockHeight = var1; + this.isModified = true; + } + + public void func_1024_c() { + int var1 = 127; + + int var2; + int var3; + for(var2 = 0; var2 < 16; ++var2) { + for(var3 = 0; var3 < 16; ++var3) { + int var4 = 127; + + int var5; + for(var5 = var2 << 11 | var3 << 7; var4 > 0 && Block.lightOpacity[this.blocks[var5 + var4 - 1] & 255] == 0; --var4) { + } + + this.heightMap[var3 << 4 | var2] = (byte)var4; + if(var4 < var1) { + var1 = var4; + } + + if(!this.worldObj.worldProvider.hasNoSky) { + int var6 = 15; + int var7 = 127; + + do { + var6 -= Block.lightOpacity[this.blocks[var5 + var7] & 255]; + if(var6 > 0) { + this.skylightMap.setNibble(var2, var7, var3, var6); + } + + --var7; + } while(var7 > 0 && var6 > 0); + } + } + } + + this.lowestBlockHeight = var1; + + for(var2 = 0; var2 < 16; ++var2) { + for(var3 = 0; var3 < 16; ++var3) { + this.func_996_c(var2, var3); + } + } + + this.isModified = true; + } + + public void func_4143_d() { + } + + private void func_996_c(int var1, int var2) { + int var3 = this.getHeightValue(var1, var2); + int var4 = this.xPosition * 16 + var1; + int var5 = this.zPosition * 16 + var2; + this.func_1020_f(var4 - 1, var5, var3); + this.func_1020_f(var4 + 1, var5, var3); + this.func_1020_f(var4, var5 - 1, var3); + this.func_1020_f(var4, var5 + 1, var3); + } + + private void func_1020_f(int var1, int var2, int var3) { + int var4 = this.worldObj.getHeightValue(var1, var2); + if(var4 > var3) { + this.worldObj.scheduleLightingUpdate(EnumSkyBlock.Sky, var1, var3, var2, var1, var4, var2); + this.isModified = true; + } else if(var4 < var3) { + this.worldObj.scheduleLightingUpdate(EnumSkyBlock.Sky, var1, var4, var2, var1, var3, var2); + this.isModified = true; + } + + } + + private void func_1003_g(int var1, int var2, int var3) { + int var4 = this.heightMap[var3 << 4 | var1] & 255; + int var5 = var4; + if(var2 > var4) { + var5 = var2; + } + + for(int var6 = var1 << 11 | var3 << 7; var5 > 0 && Block.lightOpacity[this.blocks[var6 + var5 - 1] & 255] == 0; --var5) { + } + + if(var5 != var4) { + this.worldObj.markBlocksDirtyVertical(var1, var3, var5, var4); + this.heightMap[var3 << 4 | var1] = (byte)var5; + int var7; + int var8; + int var9; + if(var5 < this.lowestBlockHeight) { + this.lowestBlockHeight = var5; + } else { + var7 = 127; + + for(var8 = 0; var8 < 16; ++var8) { + for(var9 = 0; var9 < 16; ++var9) { + if((this.heightMap[var9 << 4 | var8] & 255) < var7) { + var7 = this.heightMap[var9 << 4 | var8] & 255; + } + } + } + + this.lowestBlockHeight = var7; + } + + var7 = this.xPosition * 16 + var1; + var8 = this.zPosition * 16 + var3; + if(var5 < var4) { + for(var9 = var5; var9 < var4; ++var9) { + this.skylightMap.setNibble(var1, var9, var3, 15); + } + } else { + this.worldObj.scheduleLightingUpdate(EnumSkyBlock.Sky, var7, var4, var8, var7, var5, var8); + + for(var9 = var4; var9 < var5; ++var9) { + this.skylightMap.setNibble(var1, var9, var3, 0); + } + } + + var9 = 15; + + int var10; + for(var10 = var5; var5 > 0 && var9 > 0; this.skylightMap.setNibble(var1, var5, var3, var9)) { + --var5; + int var11 = Block.lightOpacity[this.getBlockID(var1, var5, var3)]; + if(var11 == 0) { + var11 = 1; + } + + var9 -= var11; + if(var9 < 0) { + var9 = 0; + } + } + + while(var5 > 0 && Block.lightOpacity[this.getBlockID(var1, var5 - 1, var3)] == 0) { + --var5; + } + + if(var5 != var10) { + this.worldObj.scheduleLightingUpdate(EnumSkyBlock.Sky, var7 - 1, var5, var8 - 1, var7 + 1, var10, var8 + 1); + } + + this.isModified = true; + } + } + + public int getBlockID(int var1, int var2, int var3) { + return this.blocks[var1 << 11 | var3 << 7 | var2] & 255; + } + + public boolean setBlockIDWithMetadata(int var1, int var2, int var3, int var4, int var5) { + byte var6 = (byte)var4; + int var7 = this.heightMap[var3 << 4 | var1] & 255; + int var8 = this.blocks[var1 << 11 | var3 << 7 | var2] & 255; + if(var8 == var4 && this.data.getNibble(var1, var2, var3) == var5) { + return false; + } else { + int var9 = this.xPosition * 16 + var1; + int var10 = this.zPosition * 16 + var3; + this.blocks[var1 << 11 | var3 << 7 | var2] = (byte)(var6 & 255); + if(var8 != 0 && !this.worldObj.multiplayerWorld) { + Block.blocksList[var8].onBlockRemoval(this.worldObj, var9, var2, var10); + } + + this.data.setNibble(var1, var2, var3, var5); + if(!this.worldObj.worldProvider.hasNoSky) { + if(Block.lightOpacity[var6 & 255] != 0) { + if(var2 >= var7) { + this.func_1003_g(var1, var2 + 1, var3); + } + } else if(var2 == var7 - 1) { + this.func_1003_g(var1, var2, var3); + } + + this.worldObj.scheduleLightingUpdate(EnumSkyBlock.Sky, var9, var2, var10, var9, var2, var10); + } + + this.worldObj.scheduleLightingUpdate(EnumSkyBlock.Block, var9, var2, var10, var9, var2, var10); + this.func_996_c(var1, var3); + this.data.setNibble(var1, var2, var3, var5); + if(var4 != 0) { + Block.blocksList[var4].onBlockAdded(this.worldObj, var9, var2, var10); + } + + this.isModified = true; + return true; + } + } + + public boolean setBlockID(int var1, int var2, int var3, int var4) { + byte var5 = (byte)var4; + int var6 = this.heightMap[var3 << 4 | var1] & 255; + int var7 = this.blocks[var1 << 11 | var3 << 7 | var2] & 255; + if(var7 == var4) { + return false; + } else { + int var8 = this.xPosition * 16 + var1; + int var9 = this.zPosition * 16 + var3; + this.blocks[var1 << 11 | var3 << 7 | var2] = (byte)(var5 & 255); + if(var7 != 0) { + Block.blocksList[var7].onBlockRemoval(this.worldObj, var8, var2, var9); + } + + this.data.setNibble(var1, var2, var3, 0); + if(Block.lightOpacity[var5 & 255] != 0) { + if(var2 >= var6) { + this.func_1003_g(var1, var2 + 1, var3); + } + } else if(var2 == var6 - 1) { + this.func_1003_g(var1, var2, var3); + } + + this.worldObj.scheduleLightingUpdate(EnumSkyBlock.Sky, var8, var2, var9, var8, var2, var9); + this.worldObj.scheduleLightingUpdate(EnumSkyBlock.Block, var8, var2, var9, var8, var2, var9); + this.func_996_c(var1, var3); + if(var4 != 0 && !this.worldObj.multiplayerWorld) { + Block.blocksList[var4].onBlockAdded(this.worldObj, var8, var2, var9); + } + + this.isModified = true; + return true; + } + } + + public int getBlockMetadata(int var1, int var2, int var3) { + return this.data.getNibble(var1, var2, var3); + } + + public void setBlockMetadata(int var1, int var2, int var3, int var4) { + this.isModified = true; + this.data.setNibble(var1, var2, var3, var4); + } + + public int getSavedLightValue(EnumSkyBlock var1, int var2, int var3, int var4) { + return var1 == EnumSkyBlock.Sky ? this.skylightMap.getNibble(var2, var3, var4) : (var1 == EnumSkyBlock.Block ? this.blocklightMap.getNibble(var2, var3, var4) : 0); + } + + public void setLightValue(EnumSkyBlock var1, int var2, int var3, int var4, int var5) { + this.isModified = true; + if(var1 == EnumSkyBlock.Sky) { + this.skylightMap.setNibble(var2, var3, var4, var5); + } else { + if(var1 != EnumSkyBlock.Block) { + return; + } + + this.blocklightMap.setNibble(var2, var3, var4, var5); + } + + } + + public int getBlockLightValue(int var1, int var2, int var3, int var4) { + int var5 = this.skylightMap.getNibble(var1, var2, var3); + if(var5 > 0) { + isLit = true; + } + + var5 -= var4; + int var6 = this.blocklightMap.getNibble(var1, var2, var3); + if(var6 > var5) { + var5 = var6; + } + + return var5; + } + + public void addEntity(Entity var1) { + this.hasEntities = true; + int var2 = MathHelper.floor_double(var1.posX / 16.0D); + int var3 = MathHelper.floor_double(var1.posZ / 16.0D); + if(var2 != this.xPosition || var3 != this.zPosition) { + System.out.println("Wrong location! " + var1); + Thread.dumpStack(); + } + + int var4 = MathHelper.floor_double(var1.posY / 16.0D); + if(var4 < 0) { + var4 = 0; + } + + if(var4 >= this.entities.length) { + var4 = this.entities.length - 1; + } + + var1.addedToChunk = true; + var1.chunkCoordX = this.xPosition; + var1.chunkCoordY = var4; + var1.chunkCoordZ = this.zPosition; + this.entities[var4].add(var1); + } + + public void removeEntity(Entity var1) { + this.removeEntityAtIndex(var1, var1.chunkCoordY); + } + + public void removeEntityAtIndex(Entity var1, int var2) { + if(var2 < 0) { + var2 = 0; + } + + if(var2 >= this.entities.length) { + var2 = this.entities.length - 1; + } + + this.entities[var2].remove(var1); + } + + public boolean canBlockSeeTheSky(int var1, int var2, int var3) { + return var2 >= (this.heightMap[var3 << 4 | var1] & 255); + } + + public TileEntity getChunkBlockTileEntity(int var1, int var2, int var3) { + ChunkPosition var4 = new ChunkPosition(var1, var2, var3); + TileEntity var5 = (TileEntity)this.chunkTileEntityMap.get(var4); + if(var5 == null) { + int var6 = this.getBlockID(var1, var2, var3); + if(!Block.isBlockContainer[var6]) { + return null; + } + + BlockContainer var7 = (BlockContainer)Block.blocksList[var6]; + var7.onBlockAdded(this.worldObj, this.xPosition * 16 + var1, var2, this.zPosition * 16 + var3); + var5 = (TileEntity)this.chunkTileEntityMap.get(var4); + } + + if(var5 != null && var5.func_31006_g()) { + this.chunkTileEntityMap.remove(var4); + return null; + } else { + return var5; + } + } + + public void addTileEntity(TileEntity var1) { + int var2 = var1.xCoord - this.xPosition * 16; + int var3 = var1.yCoord; + int var4 = var1.zCoord - this.zPosition * 16; + this.setChunkBlockTileEntity(var2, var3, var4, var1); + if(this.isChunkLoaded) { + this.worldObj.loadedTileEntityList.add(var1); + } + + } + + public void setChunkBlockTileEntity(int var1, int var2, int var3, TileEntity var4) { + ChunkPosition var5 = new ChunkPosition(var1, var2, var3); + var4.worldObj = this.worldObj; + var4.xCoord = this.xPosition * 16 + var1; + var4.yCoord = var2; + var4.zCoord = this.zPosition * 16 + var3; + if(this.getBlockID(var1, var2, var3) != 0 && Block.blocksList[this.getBlockID(var1, var2, var3)] instanceof BlockContainer) { + var4.func_31004_j(); + this.chunkTileEntityMap.put(var5, var4); + } else { + System.out.println("Attempted to place a tile entity where there was no entity tile!"); + } + } + + public void removeChunkBlockTileEntity(int var1, int var2, int var3) { + ChunkPosition var4 = new ChunkPosition(var1, var2, var3); + if(this.isChunkLoaded) { + TileEntity var5 = (TileEntity)this.chunkTileEntityMap.remove(var4); + if(var5 != null) { + var5.func_31005_i(); + } + } + + } + + public void onChunkLoad() { + this.isChunkLoaded = true; + this.worldObj.func_31054_a(this.chunkTileEntityMap.values()); + + for(int var1 = 0; var1 < this.entities.length; ++var1) { + this.worldObj.func_636_a(this.entities[var1]); + } + + } + + public void onChunkUnload() { + this.isChunkLoaded = false; + Iterator var1 = this.chunkTileEntityMap.values().iterator(); + + while(var1.hasNext()) { + TileEntity var2 = (TileEntity)var1.next(); + var2.func_31005_i(); + } + + for(int var3 = 0; var3 < this.entities.length; ++var3) { + this.worldObj.func_632_b(this.entities[var3]); + } + + } + + public void setChunkModified() { + this.isModified = true; + } + + public void getEntitiesWithinAABBForEntity(Entity var1, AxisAlignedBB var2, List var3) { + int var4 = MathHelper.floor_double((var2.minY - 2.0D) / 16.0D); + int var5 = MathHelper.floor_double((var2.maxY + 2.0D) / 16.0D); + if(var4 < 0) { + var4 = 0; + } + + if(var5 >= this.entities.length) { + var5 = this.entities.length - 1; + } + + for(int var6 = var4; var6 <= var5; ++var6) { + List var7 = this.entities[var6]; + + for(int var8 = 0; var8 < var7.size(); ++var8) { + Entity var9 = (Entity)var7.get(var8); + if(var9 != var1 && var9.boundingBox.intersectsWith(var2)) { + var3.add(var9); + } + } + } + + } + + public void getEntitiesOfTypeWithinAAAB(Class var1, AxisAlignedBB var2, List var3) { + int var4 = MathHelper.floor_double((var2.minY - 2.0D) / 16.0D); + int var5 = MathHelper.floor_double((var2.maxY + 2.0D) / 16.0D); + if(var4 < 0) { + var4 = 0; + } + + if(var5 >= this.entities.length) { + var5 = this.entities.length - 1; + } + + for(int var6 = var4; var6 <= var5; ++var6) { + List var7 = this.entities[var6]; + + for(int var8 = 0; var8 < var7.size(); ++var8) { + Entity var9 = (Entity)var7.get(var8); + if(var1.isAssignableFrom(var9.getClass()) && var9.boundingBox.intersectsWith(var2)) { + var3.add(var9); + } + } + } + + } + + public boolean needsSaving(boolean var1) { + if(this.neverSave) { + return false; + } else { + if(var1) { + if(this.hasEntities && this.worldObj.getWorldTime() != this.lastSaveTime) { + return true; + } + } else if(this.hasEntities && this.worldObj.getWorldTime() >= this.lastSaveTime + 600L) { + return true; + } + + return this.isModified; + } + } + + public int setChunkData(byte[] var1, int var2, int var3, int var4, int var5, int var6, int var7, int var8) { + int var9; + int var10; + int var11; + int var12; + for(var9 = var2; var9 < var5; ++var9) { + for(var10 = var4; var10 < var7; ++var10) { + var11 = var9 << 11 | var10 << 7 | var3; + var12 = var6 - var3; + System.arraycopy(var1, var8, this.blocks, var11, var12); + var8 += var12; + } + } + + this.generateHeightMap(); + + for(var9 = var2; var9 < var5; ++var9) { + for(var10 = var4; var10 < var7; ++var10) { + var11 = (var9 << 11 | var10 << 7 | var3) >> 1; + var12 = (var6 - var3) / 2; + System.arraycopy(var1, var8, this.data.data, var11, var12); + var8 += var12; + } + } + + for(var9 = var2; var9 < var5; ++var9) { + for(var10 = var4; var10 < var7; ++var10) { + var11 = (var9 << 11 | var10 << 7 | var3) >> 1; + var12 = (var6 - var3) / 2; + System.arraycopy(var1, var8, this.blocklightMap.data, var11, var12); + var8 += var12; + } + } + + for(var9 = var2; var9 < var5; ++var9) { + for(var10 = var4; var10 < var7; ++var10) { + var11 = (var9 << 11 | var10 << 7 | var3) >> 1; + var12 = (var6 - var3) / 2; + System.arraycopy(var1, var8, this.skylightMap.data, var11, var12); + var8 += var12; + } + } + + return var8; + } + + public Random func_997_a(long var1) { + return new Random(this.worldObj.getRandomSeed() + (long)(this.xPosition * this.xPosition * 4987142) + (long)(this.xPosition * 5947611) + (long)(this.zPosition * this.zPosition) * 4392871L + (long)(this.zPosition * 389711) ^ var1); + } + + public boolean func_21167_h() { + return false; + } + + public void func_25124_i() { + ChunkBlockMap.func_26002_a(this.blocks); + } +} diff --git a/src/net/minecraft/src/ChunkBlockMap.java b/src/net/minecraft/src/ChunkBlockMap.java new file mode 100644 index 0000000..f818a64 --- /dev/null +++ b/src/net/minecraft/src/ChunkBlockMap.java @@ -0,0 +1,28 @@ +package net.minecraft.src; + +public class ChunkBlockMap { + private static byte[] field_26003_a = new byte[256]; + + public static void func_26002_a(byte[] var0) { + for(int var1 = 0; var1 < var0.length; ++var1) { + var0[var1] = field_26003_a[var0[var1] & 255]; + } + + } + + static { + try { + for(int var0 = 0; var0 < 256; ++var0) { + byte var1 = (byte)var0; + if(var1 != 0 && Block.blocksList[var1 & 255] == null) { + var1 = 0; + } + + field_26003_a[var0] = var1; + } + } catch (Exception var2) { + var2.printStackTrace(); + } + + } +} diff --git a/src/net/minecraft/src/ChunkCache.java b/src/net/minecraft/src/ChunkCache.java new file mode 100644 index 0000000..a7295ad --- /dev/null +++ b/src/net/minecraft/src/ChunkCache.java @@ -0,0 +1,146 @@ +package net.minecraft.src; + +public class ChunkCache implements IBlockAccess { + private int chunkX; + private int chunkZ; + private Chunk[][] chunkArray; + private World worldObj; + + public ChunkCache(World var1, int var2, int var3, int var4, int var5, int var6, int var7) { + this.worldObj = var1; + this.chunkX = var2 >> 4; + this.chunkZ = var4 >> 4; + int var8 = var5 >> 4; + int var9 = var7 >> 4; + this.chunkArray = new Chunk[var8 - this.chunkX + 1][var9 - this.chunkZ + 1]; + + for(int var10 = this.chunkX; var10 <= var8; ++var10) { + for(int var11 = this.chunkZ; var11 <= var9; ++var11) { + this.chunkArray[var10 - this.chunkX][var11 - this.chunkZ] = var1.getChunkFromChunkCoords(var10, var11); + } + } + + } + + public int getBlockId(int var1, int var2, int var3) { + if(var2 < 0) { + return 0; + } else if(var2 >= 128) { + return 0; + } else { + int var4 = (var1 >> 4) - this.chunkX; + int var5 = (var3 >> 4) - this.chunkZ; + if(var4 >= 0 && var4 < this.chunkArray.length && var5 >= 0 && var5 < this.chunkArray[var4].length) { + Chunk var6 = this.chunkArray[var4][var5]; + return var6 == null ? 0 : var6.getBlockID(var1 & 15, var2, var3 & 15); + } else { + return 0; + } + } + } + + public TileEntity getBlockTileEntity(int var1, int var2, int var3) { + int var4 = (var1 >> 4) - this.chunkX; + int var5 = (var3 >> 4) - this.chunkZ; + return this.chunkArray[var4][var5].getChunkBlockTileEntity(var1 & 15, var2, var3 & 15); + } + + public float getBrightness(int var1, int var2, int var3, int var4) { + int var5 = this.getLightValue(var1, var2, var3); + if(var5 < var4) { + var5 = var4; + } + + return this.worldObj.worldProvider.lightBrightnessTable[var5]; + } + + public float getLightBrightness(int var1, int var2, int var3) { + return this.worldObj.worldProvider.lightBrightnessTable[this.getLightValue(var1, var2, var3)]; + } + + public int getLightValue(int var1, int var2, int var3) { + return this.getLightValueExt(var1, var2, var3, true); + } + + public int getLightValueExt(int var1, int var2, int var3, boolean var4) { + if(var1 >= -32000000 && var3 >= -32000000 && var1 < 32000000 && var3 <= 32000000) { + int var5; + int var6; + if(var4) { + var5 = this.getBlockId(var1, var2, var3); + if(var5 == Block.stairSingle.blockID || var5 == Block.tilledField.blockID || var5 == Block.stairCompactPlanks.blockID || var5 == Block.stairCompactCobblestone.blockID) { + var6 = this.getLightValueExt(var1, var2 + 1, var3, false); + int var7 = this.getLightValueExt(var1 + 1, var2, var3, false); + int var8 = this.getLightValueExt(var1 - 1, var2, var3, false); + int var9 = this.getLightValueExt(var1, var2, var3 + 1, false); + int var10 = this.getLightValueExt(var1, var2, var3 - 1, false); + if(var7 > var6) { + var6 = var7; + } + + if(var8 > var6) { + var6 = var8; + } + + if(var9 > var6) { + var6 = var9; + } + + if(var10 > var6) { + var6 = var10; + } + + return var6; + } + } + + if(var2 < 0) { + return 0; + } else if(var2 >= 128) { + var5 = 15 - this.worldObj.skylightSubtracted; + if(var5 < 0) { + var5 = 0; + } + + return var5; + } else { + var5 = (var1 >> 4) - this.chunkX; + var6 = (var3 >> 4) - this.chunkZ; + return this.chunkArray[var5][var6].getBlockLightValue(var1 & 15, var2, var3 & 15, this.worldObj.skylightSubtracted); + } + } else { + return 15; + } + } + + public int getBlockMetadata(int var1, int var2, int var3) { + if(var2 < 0) { + return 0; + } else if(var2 >= 128) { + return 0; + } else { + int var4 = (var1 >> 4) - this.chunkX; + int var5 = (var3 >> 4) - this.chunkZ; + return this.chunkArray[var4][var5].getBlockMetadata(var1 & 15, var2, var3 & 15); + } + } + + public Material getBlockMaterial(int var1, int var2, int var3) { + int var4 = this.getBlockId(var1, var2, var3); + return var4 == 0 ? Material.air : Block.blocksList[var4].blockMaterial; + } + + public WorldChunkManager getWorldChunkManager() { + return this.worldObj.getWorldChunkManager(); + } + + public boolean isBlockOpaqueCube(int var1, int var2, int var3) { + Block var4 = Block.blocksList[this.getBlockId(var1, var2, var3)]; + return var4 == null ? false : var4.isOpaqueCube(); + } + + public boolean isBlockNormalCube(int var1, int var2, int var3) { + Block var4 = Block.blocksList[this.getBlockId(var1, var2, var3)]; + return var4 == null ? false : var4.blockMaterial.getIsSolid() && var4.renderAsNormalBlock(); + } +} diff --git a/src/net/minecraft/src/ChunkCoordIntPair.java b/src/net/minecraft/src/ChunkCoordIntPair.java new file mode 100644 index 0000000..7129a64 --- /dev/null +++ b/src/net/minecraft/src/ChunkCoordIntPair.java @@ -0,0 +1,24 @@ +package net.minecraft.src; + +public class ChunkCoordIntPair { + public final int chunkXPos; + public final int chunkZPos; + + public ChunkCoordIntPair(int var1, int var2) { + this.chunkXPos = var1; + this.chunkZPos = var2; + } + + public static int chunkXZ2Int(int var0, int var1) { + return (var0 < 0 ? Integer.MIN_VALUE : 0) | (var0 & Short.MAX_VALUE) << 16 | (var1 < 0 ? -Short.MIN_VALUE : 0) | var1 & Short.MAX_VALUE; + } + + public int hashCode() { + return chunkXZ2Int(this.chunkXPos, this.chunkZPos); + } + + public boolean equals(Object var1) { + ChunkCoordIntPair var2 = (ChunkCoordIntPair)var1; + return var2.chunkXPos == this.chunkXPos && var2.chunkZPos == this.chunkZPos; + } +} diff --git a/src/net/minecraft/src/ChunkCoordinates.java b/src/net/minecraft/src/ChunkCoordinates.java new file mode 100644 index 0000000..c13c235 --- /dev/null +++ b/src/net/minecraft/src/ChunkCoordinates.java @@ -0,0 +1,50 @@ +package net.minecraft.src; + +public class ChunkCoordinates implements Comparable { + public int x; + public int y; + public int z; + + public ChunkCoordinates() { + } + + public ChunkCoordinates(int var1, int var2, int var3) { + this.x = var1; + this.y = var2; + this.z = var3; + } + + public ChunkCoordinates(ChunkCoordinates var1) { + this.x = var1.x; + this.y = var1.y; + this.z = var1.z; + } + + public boolean equals(Object var1) { + if(!(var1 instanceof ChunkCoordinates)) { + return false; + } else { + ChunkCoordinates var2 = (ChunkCoordinates)var1; + return this.x == var2.x && this.y == var2.y && this.z == var2.z; + } + } + + public int hashCode() { + return this.x + this.z << 8 + this.y << 16; + } + + public int compareChunkCoordinate(ChunkCoordinates var1) { + return this.y == var1.y ? (this.z == var1.z ? this.x - var1.x : this.z - var1.z) : this.y - var1.y; + } + + public double getSqDistanceTo(int var1, int var2, int var3) { + int var4 = this.x - var1; + int var5 = this.y - var2; + int var6 = this.z - var3; + return Math.sqrt((double)(var4 * var4 + var5 * var5 + var6 * var6)); + } + + public int compareTo(Object var1) { + return this.compareChunkCoordinate((ChunkCoordinates)var1); + } +} diff --git a/src/net/minecraft/src/ChunkFile.java b/src/net/minecraft/src/ChunkFile.java new file mode 100644 index 0000000..69c24f8 --- /dev/null +++ b/src/net/minecraft/src/ChunkFile.java @@ -0,0 +1,51 @@ +package net.minecraft.src; + +import java.io.File; +import java.util.regex.Matcher; + +class ChunkFile implements Comparable { + private final File field_22326_a; + private final int field_22325_b; + private final int field_22327_c; + + public ChunkFile(File var1) { + this.field_22326_a = var1; + Matcher var2 = ChunkFilePattern.field_22189_a.matcher(var1.getName()); + if(var2.matches()) { + this.field_22325_b = Integer.parseInt(var2.group(1), 36); + this.field_22327_c = Integer.parseInt(var2.group(2), 36); + } else { + this.field_22325_b = 0; + this.field_22327_c = 0; + } + + } + + public int func_22322_a(ChunkFile var1) { + int var2 = this.field_22325_b >> 5; + int var3 = var1.field_22325_b >> 5; + if(var2 == var3) { + int var4 = this.field_22327_c >> 5; + int var5 = var1.field_22327_c >> 5; + return var4 - var5; + } else { + return var2 - var3; + } + } + + public File func_22324_a() { + return this.field_22326_a; + } + + public int func_22323_b() { + return this.field_22325_b; + } + + public int func_22321_c() { + return this.field_22327_c; + } + + public int compareTo(Object var1) { + return this.func_22322_a((ChunkFile)var1); + } +} diff --git a/src/net/minecraft/src/ChunkFilePattern.java b/src/net/minecraft/src/ChunkFilePattern.java new file mode 100644 index 0000000..f310a8d --- /dev/null +++ b/src/net/minecraft/src/ChunkFilePattern.java @@ -0,0 +1,22 @@ +package net.minecraft.src; + +import java.io.File; +import java.io.FilenameFilter; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +class ChunkFilePattern implements FilenameFilter { + public static final Pattern field_22189_a = Pattern.compile("c\\.(-?[0-9a-z]+)\\.(-?[0-9a-z]+)\\.dat"); + + private ChunkFilePattern() { + } + + public boolean accept(File var1, String var2) { + Matcher var3 = field_22189_a.matcher(var2); + return var3.matches(); + } + + ChunkFilePattern(Empty2 var1) { + this(); + } +} diff --git a/src/net/minecraft/src/ChunkFolderPattern.java b/src/net/minecraft/src/ChunkFolderPattern.java new file mode 100644 index 0000000..9013c2a --- /dev/null +++ b/src/net/minecraft/src/ChunkFolderPattern.java @@ -0,0 +1,26 @@ +package net.minecraft.src; + +import java.io.File; +import java.io.FileFilter; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +class ChunkFolderPattern implements FileFilter { + public static final Pattern field_22392_a = Pattern.compile("[0-9a-z]|([0-9a-z][0-9a-z])"); + + private ChunkFolderPattern() { + } + + public boolean accept(File var1) { + if(var1.isDirectory()) { + Matcher var2 = field_22392_a.matcher(var1.getName()); + return var2.matches(); + } else { + return false; + } + } + + ChunkFolderPattern(Empty2 var1) { + this(); + } +} diff --git a/src/net/minecraft/src/ChunkLoader.java b/src/net/minecraft/src/ChunkLoader.java new file mode 100644 index 0000000..9ad25f8 --- /dev/null +++ b/src/net/minecraft/src/ChunkLoader.java @@ -0,0 +1,210 @@ +package net.minecraft.src; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.Iterator; + +public class ChunkLoader implements IChunkLoader { + private File saveDir; + private boolean createIfNecessary; + + public ChunkLoader(File var1, boolean var2) { + this.saveDir = var1; + this.createIfNecessary = var2; + } + + private File chunkFileForXZ(int var1, int var2) { + String var3 = "c." + Integer.toString(var1, 36) + "." + Integer.toString(var2, 36) + ".dat"; + String var4 = Integer.toString(var1 & 63, 36); + String var5 = Integer.toString(var2 & 63, 36); + File var6 = new File(this.saveDir, var4); + if(!var6.exists()) { + if(!this.createIfNecessary) { + return null; + } + + var6.mkdir(); + } + + var6 = new File(var6, var5); + if(!var6.exists()) { + if(!this.createIfNecessary) { + return null; + } + + var6.mkdir(); + } + + var6 = new File(var6, var3); + return !var6.exists() && !this.createIfNecessary ? null : var6; + } + + public Chunk loadChunk(World var1, int var2, int var3) throws IOException { + File var4 = this.chunkFileForXZ(var2, var3); + if(var4 != null && var4.exists()) { + try { + FileInputStream var5 = new FileInputStream(var4); + NBTTagCompound var6 = CompressedStreamTools.func_1138_a(var5); + if(!var6.hasKey("Level")) { + System.out.println("Chunk file at " + var2 + "," + var3 + " is missing level data, skipping"); + return null; + } + + if(!var6.getCompoundTag("Level").hasKey("Blocks")) { + System.out.println("Chunk file at " + var2 + "," + var3 + " is missing block data, skipping"); + return null; + } + + Chunk var7 = loadChunkIntoWorldFromCompound(var1, var6.getCompoundTag("Level")); + if(!var7.isAtLocation(var2, var3)) { + System.out.println("Chunk file at " + var2 + "," + var3 + " is in the wrong location; relocating. (Expected " + var2 + ", " + var3 + ", got " + var7.xPosition + ", " + var7.zPosition + ")"); + var6.setInteger("xPos", var2); + var6.setInteger("zPos", var3); + var7 = loadChunkIntoWorldFromCompound(var1, var6.getCompoundTag("Level")); + } + + var7.func_25124_i(); + return var7; + } catch (Exception var8) { + var8.printStackTrace(); + } + } + + return null; + } + + public void saveChunk(World var1, Chunk var2) throws IOException { + var1.checkSessionLock(); + File var3 = this.chunkFileForXZ(var2.xPosition, var2.zPosition); + if(var3.exists()) { + WorldInfo var4 = var1.getWorldInfo(); + var4.setSizeOnDisk(var4.getSizeOnDisk() - var3.length()); + } + + try { + File var10 = new File(this.saveDir, "tmp_chunk.dat"); + FileOutputStream var5 = new FileOutputStream(var10); + NBTTagCompound var6 = new NBTTagCompound(); + NBTTagCompound var7 = new NBTTagCompound(); + var6.setTag("Level", var7); + storeChunkInCompound(var2, var1, var7); + CompressedStreamTools.writeGzippedCompoundToOutputStream(var6, var5); + var5.close(); + if(var3.exists()) { + var3.delete(); + } + + var10.renameTo(var3); + WorldInfo var8 = var1.getWorldInfo(); + var8.setSizeOnDisk(var8.getSizeOnDisk() + var3.length()); + } catch (Exception var9) { + var9.printStackTrace(); + } + + } + + public static void storeChunkInCompound(Chunk var0, World var1, NBTTagCompound var2) { + var1.checkSessionLock(); + var2.setInteger("xPos", var0.xPosition); + var2.setInteger("zPos", var0.zPosition); + var2.setLong("LastUpdate", var1.getWorldTime()); + var2.setByteArray("Blocks", var0.blocks); + var2.setByteArray("Data", var0.data.data); + var2.setByteArray("SkyLight", var0.skylightMap.data); + var2.setByteArray("BlockLight", var0.blocklightMap.data); + var2.setByteArray("HeightMap", var0.heightMap); + var2.setBoolean("TerrainPopulated", var0.isTerrainPopulated); + var0.hasEntities = false; + NBTTagList var3 = new NBTTagList(); + + Iterator var5; + NBTTagCompound var7; + for(int var4 = 0; var4 < var0.entities.length; ++var4) { + var5 = var0.entities[var4].iterator(); + + while(var5.hasNext()) { + Entity var6 = (Entity)var5.next(); + var0.hasEntities = true; + var7 = new NBTTagCompound(); + if(var6.addEntityID(var7)) { + var3.setTag(var7); + } + } + } + + var2.setTag("Entities", var3); + NBTTagList var8 = new NBTTagList(); + var5 = var0.chunkTileEntityMap.values().iterator(); + + while(var5.hasNext()) { + TileEntity var9 = (TileEntity)var5.next(); + var7 = new NBTTagCompound(); + var9.writeToNBT(var7); + var8.setTag(var7); + } + + var2.setTag("TileEntities", var8); + } + + public static Chunk loadChunkIntoWorldFromCompound(World var0, NBTTagCompound var1) { + int var2 = var1.getInteger("xPos"); + int var3 = var1.getInteger("zPos"); + Chunk var4 = new Chunk(var0, var2, var3); + var4.blocks = var1.getByteArray("Blocks"); + var4.data = new NibbleArray(var1.getByteArray("Data")); + var4.skylightMap = new NibbleArray(var1.getByteArray("SkyLight")); + var4.blocklightMap = new NibbleArray(var1.getByteArray("BlockLight")); + var4.heightMap = var1.getByteArray("HeightMap"); + var4.isTerrainPopulated = var1.getBoolean("TerrainPopulated"); + if(!var4.data.isValid()) { + var4.data = new NibbleArray(var4.blocks.length); + } + + if(var4.heightMap == null || !var4.skylightMap.isValid()) { + var4.heightMap = new byte[256]; + var4.skylightMap = new NibbleArray(var4.blocks.length); + var4.func_1024_c(); + } + + if(!var4.blocklightMap.isValid()) { + var4.blocklightMap = new NibbleArray(var4.blocks.length); + var4.func_1014_a(); + } + + NBTTagList var5 = var1.getTagList("Entities"); + if(var5 != null) { + for(int var6 = 0; var6 < var5.tagCount(); ++var6) { + NBTTagCompound var7 = (NBTTagCompound)var5.tagAt(var6); + Entity var8 = EntityList.createEntityFromNBT(var7, var0); + var4.hasEntities = true; + if(var8 != null) { + var4.addEntity(var8); + } + } + } + + NBTTagList var10 = var1.getTagList("TileEntities"); + if(var10 != null) { + for(int var11 = 0; var11 < var10.tagCount(); ++var11) { + NBTTagCompound var12 = (NBTTagCompound)var10.tagAt(var11); + TileEntity var9 = TileEntity.createAndLoadEntity(var12); + if(var9 != null) { + var4.addTileEntity(var9); + } + } + } + + return var4; + } + + public void func_814_a() { + } + + public void saveExtraData() { + } + + public void saveExtraChunkData(World var1, Chunk var2) throws IOException { + } +} diff --git a/src/net/minecraft/src/ChunkPosition.java b/src/net/minecraft/src/ChunkPosition.java new file mode 100644 index 0000000..18bdfb0 --- /dev/null +++ b/src/net/minecraft/src/ChunkPosition.java @@ -0,0 +1,26 @@ +package net.minecraft.src; + +public class ChunkPosition { + public final int x; + public final int y; + public final int z; + + public ChunkPosition(int var1, int var2, int var3) { + this.x = var1; + this.y = var2; + this.z = var3; + } + + public boolean equals(Object var1) { + if(!(var1 instanceof ChunkPosition)) { + return false; + } else { + ChunkPosition var2 = (ChunkPosition)var1; + return var2.x == this.x && var2.y == this.y && var2.z == this.z; + } + } + + public int hashCode() { + return this.x * 8976890 + this.y * 981131 + this.z; + } +} diff --git a/src/net/minecraft/src/ChunkProvider.java b/src/net/minecraft/src/ChunkProvider.java new file mode 100644 index 0000000..4d24b42 --- /dev/null +++ b/src/net/minecraft/src/ChunkProvider.java @@ -0,0 +1,188 @@ +package net.minecraft.src; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +public class ChunkProvider implements IChunkProvider { + private Set droppedChunksSet = new HashSet(); + private Chunk field_28064_b; + private IChunkProvider chunkProvider; + private IChunkLoader chunkLoader; + private Map chunkMap = new HashMap(); + private List chunkList = new ArrayList(); + private World field_28066_g; + + public ChunkProvider(World var1, IChunkLoader var2, IChunkProvider var3) { + this.field_28064_b = new EmptyChunk(var1, new byte[-Short.MIN_VALUE], 0, 0); + this.field_28066_g = var1; + this.chunkLoader = var2; + this.chunkProvider = var3; + } + + public boolean chunkExists(int var1, int var2) { + return this.chunkMap.containsKey(Integer.valueOf(ChunkCoordIntPair.chunkXZ2Int(var1, var2))); + } + + public Chunk prepareChunk(int var1, int var2) { + int var3 = ChunkCoordIntPair.chunkXZ2Int(var1, var2); + this.droppedChunksSet.remove(Integer.valueOf(var3)); + Chunk var4 = (Chunk)this.chunkMap.get(Integer.valueOf(var3)); + if(var4 == null) { + var4 = this.loadChunkFromFile(var1, var2); + if(var4 == null) { + if(this.chunkProvider == null) { + var4 = this.field_28064_b; + } else { + var4 = this.chunkProvider.provideChunk(var1, var2); + } + } + + this.chunkMap.put(Integer.valueOf(var3), var4); + this.chunkList.add(var4); + if(var4 != null) { + var4.func_4143_d(); + var4.onChunkLoad(); + } + + if(!var4.isTerrainPopulated && this.chunkExists(var1 + 1, var2 + 1) && this.chunkExists(var1, var2 + 1) && this.chunkExists(var1 + 1, var2)) { + this.populate(this, var1, var2); + } + + if(this.chunkExists(var1 - 1, var2) && !this.provideChunk(var1 - 1, var2).isTerrainPopulated && this.chunkExists(var1 - 1, var2 + 1) && this.chunkExists(var1, var2 + 1) && this.chunkExists(var1 - 1, var2)) { + this.populate(this, var1 - 1, var2); + } + + if(this.chunkExists(var1, var2 - 1) && !this.provideChunk(var1, var2 - 1).isTerrainPopulated && this.chunkExists(var1 + 1, var2 - 1) && this.chunkExists(var1, var2 - 1) && this.chunkExists(var1 + 1, var2)) { + this.populate(this, var1, var2 - 1); + } + + if(this.chunkExists(var1 - 1, var2 - 1) && !this.provideChunk(var1 - 1, var2 - 1).isTerrainPopulated && this.chunkExists(var1 - 1, var2 - 1) && this.chunkExists(var1, var2 - 1) && this.chunkExists(var1 - 1, var2)) { + this.populate(this, var1 - 1, var2 - 1); + } + } + + return var4; + } + + public Chunk provideChunk(int var1, int var2) { + Chunk var3 = (Chunk)this.chunkMap.get(Integer.valueOf(ChunkCoordIntPair.chunkXZ2Int(var1, var2))); + return var3 == null ? this.prepareChunk(var1, var2) : var3; + } + + private Chunk loadChunkFromFile(int var1, int var2) { + if(this.chunkLoader == null) { + return null; + } else { + try { + Chunk var3 = this.chunkLoader.loadChunk(this.field_28066_g, var1, var2); + if(var3 != null) { + var3.lastSaveTime = this.field_28066_g.getWorldTime(); + } + + return var3; + } catch (Exception var4) { + var4.printStackTrace(); + return null; + } + } + } + + private void func_28063_a(Chunk var1) { + if(this.chunkLoader != null) { + try { + this.chunkLoader.saveExtraChunkData(this.field_28066_g, var1); + } catch (Exception var3) { + var3.printStackTrace(); + } + + } + } + + private void func_28062_b(Chunk var1) { + if(this.chunkLoader != null) { + try { + var1.lastSaveTime = this.field_28066_g.getWorldTime(); + this.chunkLoader.saveChunk(this.field_28066_g, var1); + } catch (IOException var3) { + var3.printStackTrace(); + } + + } + } + + public void populate(IChunkProvider var1, int var2, int var3) { + Chunk var4 = this.provideChunk(var2, var3); + if(!var4.isTerrainPopulated) { + var4.isTerrainPopulated = true; + if(this.chunkProvider != null) { + this.chunkProvider.populate(var1, var2, var3); + var4.setChunkModified(); + } + } + + } + + public boolean saveChunks(boolean var1, IProgressUpdate var2) { + int var3 = 0; + + for(int var4 = 0; var4 < this.chunkList.size(); ++var4) { + Chunk var5 = (Chunk)this.chunkList.get(var4); + if(var1 && !var5.neverSave) { + this.func_28063_a(var5); + } + + if(var5.needsSaving(var1)) { + this.func_28062_b(var5); + var5.isModified = false; + ++var3; + if(var3 == 24 && !var1) { + return false; + } + } + } + + if(var1) { + if(this.chunkLoader == null) { + return true; + } + + this.chunkLoader.saveExtraData(); + } + + return true; + } + + public boolean unload100OldestChunks() { + for(int var1 = 0; var1 < 100; ++var1) { + if(!this.droppedChunksSet.isEmpty()) { + Integer var2 = (Integer)this.droppedChunksSet.iterator().next(); + Chunk var3 = (Chunk)this.chunkMap.get(var2); + var3.onChunkUnload(); + this.func_28062_b(var3); + this.func_28063_a(var3); + this.droppedChunksSet.remove(var2); + this.chunkMap.remove(var2); + this.chunkList.remove(var3); + } + } + + if(this.chunkLoader != null) { + this.chunkLoader.func_814_a(); + } + + return this.chunkProvider.unload100OldestChunks(); + } + + public boolean canSave() { + return true; + } + + public String makeString() { + return "ServerChunkCache: " + this.chunkMap.size() + " Drop: " + this.droppedChunksSet.size(); + } +} diff --git a/src/net/minecraft/src/ChunkProviderClient.java b/src/net/minecraft/src/ChunkProviderClient.java new file mode 100644 index 0000000..6102ca5 --- /dev/null +++ b/src/net/minecraft/src/ChunkProviderClient.java @@ -0,0 +1,73 @@ +package net.minecraft.src; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class ChunkProviderClient implements IChunkProvider { + private Chunk blankChunk; + private Map chunkMapping = new HashMap(); + private List field_889_c = new ArrayList(); + private World worldObj; + + public ChunkProviderClient(World var1) { + this.blankChunk = new EmptyChunk(var1, new byte[-Short.MIN_VALUE], 0, 0); + this.worldObj = var1; + } + + public boolean chunkExists(int var1, int var2) { + if(this != null) { + return true; + } else { + ChunkCoordIntPair var3 = new ChunkCoordIntPair(var1, var2); + return this.chunkMapping.containsKey(var3); + } + } + + public void func_539_c(int var1, int var2) { + Chunk var3 = this.provideChunk(var1, var2); + if(!var3.func_21167_h()) { + var3.onChunkUnload(); + } + + this.chunkMapping.remove(new ChunkCoordIntPair(var1, var2)); + this.field_889_c.remove(var3); + } + + public Chunk prepareChunk(int var1, int var2) { + ChunkCoordIntPair var3 = new ChunkCoordIntPair(var1, var2); + byte[] var4 = new byte[-Short.MIN_VALUE]; + Chunk var5 = new Chunk(this.worldObj, var4, var1, var2); + Arrays.fill(var5.skylightMap.data, (byte)-1); + this.chunkMapping.put(var3, var5); + var5.isChunkLoaded = true; + return var5; + } + + public Chunk provideChunk(int var1, int var2) { + ChunkCoordIntPair var3 = new ChunkCoordIntPair(var1, var2); + Chunk var4 = (Chunk)this.chunkMapping.get(var3); + return var4 == null ? this.blankChunk : var4; + } + + public boolean saveChunks(boolean var1, IProgressUpdate var2) { + return true; + } + + public boolean unload100OldestChunks() { + return false; + } + + public boolean canSave() { + return false; + } + + public void populate(IChunkProvider var1, int var2, int var3) { + } + + public String makeString() { + return "MultiplayerChunkCache: " + this.chunkMapping.size(); + } +} diff --git a/src/net/minecraft/src/ChunkProviderGenerate.java b/src/net/minecraft/src/ChunkProviderGenerate.java new file mode 100644 index 0000000..345edc2 --- /dev/null +++ b/src/net/minecraft/src/ChunkProviderGenerate.java @@ -0,0 +1,620 @@ +package net.minecraft.src; + +import java.util.Random; + +public class ChunkProviderGenerate implements IChunkProvider { + private Random rand; + private NoiseGeneratorOctaves field_912_k; + private NoiseGeneratorOctaves field_911_l; + private NoiseGeneratorOctaves field_910_m; + private NoiseGeneratorOctaves field_909_n; + private NoiseGeneratorOctaves field_908_o; + public NoiseGeneratorOctaves field_922_a; + public NoiseGeneratorOctaves field_921_b; + public NoiseGeneratorOctaves mobSpawnerNoise; + private World worldObj; + private double[] field_4180_q; + private double[] sandNoise = new double[256]; + private double[] gravelNoise = new double[256]; + private double[] stoneNoise = new double[256]; + private MapGenBase field_902_u = new MapGenCaves(); + private BiomeGenBase[] biomesForGeneration; + double[] field_4185_d; + double[] field_4184_e; + double[] field_4183_f; + double[] field_4182_g; + double[] field_4181_h; + int[][] field_914_i = new int[32][32]; + private double[] generatedTemperatures; + + public ChunkProviderGenerate(World var1, long var2) { + this.worldObj = var1; + this.rand = new Random(var2); + this.field_912_k = new NoiseGeneratorOctaves(this.rand, 16); + this.field_911_l = new NoiseGeneratorOctaves(this.rand, 16); + this.field_910_m = new NoiseGeneratorOctaves(this.rand, 8); + this.field_909_n = new NoiseGeneratorOctaves(this.rand, 4); + this.field_908_o = new NoiseGeneratorOctaves(this.rand, 4); + this.field_922_a = new NoiseGeneratorOctaves(this.rand, 10); + this.field_921_b = new NoiseGeneratorOctaves(this.rand, 16); + this.mobSpawnerNoise = new NoiseGeneratorOctaves(this.rand, 8); + } + + public void generateTerrain(int var1, int var2, byte[] var3, BiomeGenBase[] var4, double[] var5) { + byte var6 = 4; + byte var7 = 64; + int var8 = var6 + 1; + byte var9 = 17; + int var10 = var6 + 1; + this.field_4180_q = this.func_4061_a(this.field_4180_q, var1 * var6, 0, var2 * var6, var8, var9, var10); + + for(int var11 = 0; var11 < var6; ++var11) { + for(int var12 = 0; var12 < var6; ++var12) { + for(int var13 = 0; var13 < 16; ++var13) { + double var14 = 0.125D; + double var16 = this.field_4180_q[((var11 + 0) * var10 + var12 + 0) * var9 + var13 + 0]; + double var18 = this.field_4180_q[((var11 + 0) * var10 + var12 + 1) * var9 + var13 + 0]; + double var20 = this.field_4180_q[((var11 + 1) * var10 + var12 + 0) * var9 + var13 + 0]; + double var22 = this.field_4180_q[((var11 + 1) * var10 + var12 + 1) * var9 + var13 + 0]; + double var24 = (this.field_4180_q[((var11 + 0) * var10 + var12 + 0) * var9 + var13 + 1] - var16) * var14; + double var26 = (this.field_4180_q[((var11 + 0) * var10 + var12 + 1) * var9 + var13 + 1] - var18) * var14; + double var28 = (this.field_4180_q[((var11 + 1) * var10 + var12 + 0) * var9 + var13 + 1] - var20) * var14; + double var30 = (this.field_4180_q[((var11 + 1) * var10 + var12 + 1) * var9 + var13 + 1] - var22) * var14; + + for(int var32 = 0; var32 < 8; ++var32) { + double var33 = 0.25D; + double var35 = var16; + double var37 = var18; + double var39 = (var20 - var16) * var33; + double var41 = (var22 - var18) * var33; + + for(int var43 = 0; var43 < 4; ++var43) { + int var44 = var43 + var11 * 4 << 11 | 0 + var12 * 4 << 7 | var13 * 8 + var32; + short var45 = 128; + double var46 = 0.25D; + double var48 = var35; + double var50 = (var37 - var35) * var46; + + for(int var52 = 0; var52 < 4; ++var52) { + double var53 = var5[(var11 * 4 + var43) * 16 + var12 * 4 + var52]; + int var55 = 0; + if(var13 * 8 + var32 < var7) { + if(var53 < 0.5D && var13 * 8 + var32 >= var7 - 1) { + var55 = Block.ice.blockID; + } else { + var55 = Block.waterStill.blockID; + } + } + + if(var48 > 0.0D) { + var55 = Block.stone.blockID; + } + + var3[var44] = (byte)var55; + var44 += var45; + var48 += var50; + } + + var35 += var39; + var37 += var41; + } + + var16 += var24; + var18 += var26; + var20 += var28; + var22 += var30; + } + } + } + } + + } + + public void replaceBlocksForBiome(int var1, int var2, byte[] var3, BiomeGenBase[] var4) { + byte var5 = 64; + double var6 = 1.0D / 32.0D; + this.sandNoise = this.field_909_n.generateNoiseOctaves(this.sandNoise, (double)(var1 * 16), (double)(var2 * 16), 0.0D, 16, 16, 1, var6, var6, 1.0D); + this.gravelNoise = this.field_909_n.generateNoiseOctaves(this.gravelNoise, (double)(var1 * 16), 109.0134D, (double)(var2 * 16), 16, 1, 16, var6, 1.0D, var6); + this.stoneNoise = this.field_908_o.generateNoiseOctaves(this.stoneNoise, (double)(var1 * 16), (double)(var2 * 16), 0.0D, 16, 16, 1, var6 * 2.0D, var6 * 2.0D, var6 * 2.0D); + + for(int var8 = 0; var8 < 16; ++var8) { + for(int var9 = 0; var9 < 16; ++var9) { + BiomeGenBase var10 = var4[var8 + var9 * 16]; + boolean var11 = this.sandNoise[var8 + var9 * 16] + this.rand.nextDouble() * 0.2D > 0.0D; + boolean var12 = this.gravelNoise[var8 + var9 * 16] + this.rand.nextDouble() * 0.2D > 3.0D; + int var13 = (int)(this.stoneNoise[var8 + var9 * 16] / 3.0D + 3.0D + this.rand.nextDouble() * 0.25D); + int var14 = -1; + byte var15 = var10.topBlock; + byte var16 = var10.fillerBlock; + + for(int var17 = 127; var17 >= 0; --var17) { + int var18 = (var9 * 16 + var8) * 128 + var17; + if(var17 <= 0 + this.rand.nextInt(5)) { + var3[var18] = (byte)Block.bedrock.blockID; + } else { + byte var19 = var3[var18]; + if(var19 == 0) { + var14 = -1; + } else if(var19 == Block.stone.blockID) { + if(var14 == -1) { + if(var13 <= 0) { + var15 = 0; + var16 = (byte)Block.stone.blockID; + } else if(var17 >= var5 - 4 && var17 <= var5 + 1) { + var15 = var10.topBlock; + var16 = var10.fillerBlock; + if(var12) { + var15 = 0; + } + + if(var12) { + var16 = (byte)Block.gravel.blockID; + } + + if(var11) { + var15 = (byte)Block.sand.blockID; + } + + if(var11) { + var16 = (byte)Block.sand.blockID; + } + } + + if(var17 < var5 && var15 == 0) { + var15 = (byte)Block.waterStill.blockID; + } + + var14 = var13; + if(var17 >= var5 - 1) { + var3[var18] = var15; + } else { + var3[var18] = var16; + } + } else if(var14 > 0) { + --var14; + var3[var18] = var16; + if(var14 == 0 && var16 == Block.sand.blockID) { + var14 = this.rand.nextInt(4); + var16 = (byte)Block.sandStone.blockID; + } + } + } + } + } + } + } + + } + + public Chunk prepareChunk(int var1, int var2) { + return this.provideChunk(var1, var2); + } + + public Chunk provideChunk(int var1, int var2) { + this.rand.setSeed((long)var1 * 341873128712L + (long)var2 * 132897987541L); + byte[] var3 = new byte[-Short.MIN_VALUE]; + Chunk var4 = new Chunk(this.worldObj, var3, var1, var2); + this.biomesForGeneration = this.worldObj.getWorldChunkManager().loadBlockGeneratorData(this.biomesForGeneration, var1 * 16, var2 * 16, 16, 16); + double[] var5 = this.worldObj.getWorldChunkManager().temperature; + this.generateTerrain(var1, var2, var3, this.biomesForGeneration, var5); + this.replaceBlocksForBiome(var1, var2, var3, this.biomesForGeneration); + this.field_902_u.func_867_a(this, this.worldObj, var1, var2, var3); + var4.func_1024_c(); + return var4; + } + + private double[] func_4061_a(double[] var1, int var2, int var3, int var4, int var5, int var6, int var7) { + if(var1 == null) { + var1 = new double[var5 * var6 * var7]; + } + + double var8 = 684.412D; + double var10 = 684.412D; + double[] var12 = this.worldObj.getWorldChunkManager().temperature; + double[] var13 = this.worldObj.getWorldChunkManager().humidity; + this.field_4182_g = this.field_922_a.func_4109_a(this.field_4182_g, var2, var4, var5, var7, 1.121D, 1.121D, 0.5D); + this.field_4181_h = this.field_921_b.func_4109_a(this.field_4181_h, var2, var4, var5, var7, 200.0D, 200.0D, 0.5D); + this.field_4185_d = this.field_910_m.generateNoiseOctaves(this.field_4185_d, (double)var2, (double)var3, (double)var4, var5, var6, var7, var8 / 80.0D, var10 / 160.0D, var8 / 80.0D); + this.field_4184_e = this.field_912_k.generateNoiseOctaves(this.field_4184_e, (double)var2, (double)var3, (double)var4, var5, var6, var7, var8, var10, var8); + this.field_4183_f = this.field_911_l.generateNoiseOctaves(this.field_4183_f, (double)var2, (double)var3, (double)var4, var5, var6, var7, var8, var10, var8); + int var14 = 0; + int var15 = 0; + int var16 = 16 / var5; + + for(int var17 = 0; var17 < var5; ++var17) { + int var18 = var17 * var16 + var16 / 2; + + for(int var19 = 0; var19 < var7; ++var19) { + int var20 = var19 * var16 + var16 / 2; + double var21 = var12[var18 * 16 + var20]; + double var23 = var13[var18 * 16 + var20] * var21; + double var25 = 1.0D - var23; + var25 *= var25; + var25 *= var25; + var25 = 1.0D - var25; + double var27 = (this.field_4182_g[var15] + 256.0D) / 512.0D; + var27 *= var25; + if(var27 > 1.0D) { + var27 = 1.0D; + } + + double var29 = this.field_4181_h[var15] / 8000.0D; + if(var29 < 0.0D) { + var29 = -var29 * 0.3D; + } + + var29 = var29 * 3.0D - 2.0D; + if(var29 < 0.0D) { + var29 /= 2.0D; + if(var29 < -1.0D) { + var29 = -1.0D; + } + + var29 /= 1.4D; + var29 /= 2.0D; + var27 = 0.0D; + } else { + if(var29 > 1.0D) { + var29 = 1.0D; + } + + var29 /= 8.0D; + } + + if(var27 < 0.0D) { + var27 = 0.0D; + } + + var27 += 0.5D; + var29 = var29 * (double)var6 / 16.0D; + double var31 = (double)var6 / 2.0D + var29 * 4.0D; + ++var15; + + for(int var33 = 0; var33 < var6; ++var33) { + double var34 = 0.0D; + double var36 = ((double)var33 - var31) * 12.0D / var27; + if(var36 < 0.0D) { + var36 *= 4.0D; + } + + double var38 = this.field_4184_e[var14] / 512.0D; + double var40 = this.field_4183_f[var14] / 512.0D; + double var42 = (this.field_4185_d[var14] / 10.0D + 1.0D) / 2.0D; + if(var42 < 0.0D) { + var34 = var38; + } else if(var42 > 1.0D) { + var34 = var40; + } else { + var34 = var38 + (var40 - var38) * var42; + } + + var34 -= var36; + if(var33 > var6 - 4) { + double var44 = (double)((float)(var33 - (var6 - 4)) / 3.0F); + var34 = var34 * (1.0D - var44) + -10.0D * var44; + } + + var1[var14] = var34; + ++var14; + } + } + } + + return var1; + } + + public boolean chunkExists(int var1, int var2) { + return true; + } + + public void populate(IChunkProvider var1, int var2, int var3) { + BlockSand.fallInstantly = true; + int var4 = var2 * 16; + int var5 = var3 * 16; + BiomeGenBase var6 = this.worldObj.getWorldChunkManager().getBiomeGenAt(var4 + 16, var5 + 16); + this.rand.setSeed(this.worldObj.getRandomSeed()); + long var7 = this.rand.nextLong() / 2L * 2L + 1L; + long var9 = this.rand.nextLong() / 2L * 2L + 1L; + this.rand.setSeed((long)var2 * var7 + (long)var3 * var9 ^ this.worldObj.getRandomSeed()); + double var11 = 0.25D; + int var13; + int var14; + int var15; + if(this.rand.nextInt(4) == 0) { + var13 = var4 + this.rand.nextInt(16) + 8; + var14 = this.rand.nextInt(128); + var15 = var5 + this.rand.nextInt(16) + 8; + (new WorldGenLakes(Block.waterStill.blockID)).generate(this.worldObj, this.rand, var13, var14, var15); + } + + if(this.rand.nextInt(8) == 0) { + var13 = var4 + this.rand.nextInt(16) + 8; + var14 = this.rand.nextInt(this.rand.nextInt(120) + 8); + var15 = var5 + this.rand.nextInt(16) + 8; + if(var14 < 64 || this.rand.nextInt(10) == 0) { + (new WorldGenLakes(Block.lavaStill.blockID)).generate(this.worldObj, this.rand, var13, var14, var15); + } + } + + int var16; + for(var13 = 0; var13 < 8; ++var13) { + var14 = var4 + this.rand.nextInt(16) + 8; + var15 = this.rand.nextInt(128); + var16 = var5 + this.rand.nextInt(16) + 8; + (new WorldGenDungeons()).generate(this.worldObj, this.rand, var14, var15, var16); + } + + for(var13 = 0; var13 < 10; ++var13) { + var14 = var4 + this.rand.nextInt(16); + var15 = this.rand.nextInt(128); + var16 = var5 + this.rand.nextInt(16); + (new WorldGenClay(32)).generate(this.worldObj, this.rand, var14, var15, var16); + } + + for(var13 = 0; var13 < 20; ++var13) { + var14 = var4 + this.rand.nextInt(16); + var15 = this.rand.nextInt(128); + var16 = var5 + this.rand.nextInt(16); + (new WorldGenMinable(Block.dirt.blockID, 32)).generate(this.worldObj, this.rand, var14, var15, var16); + } + + for(var13 = 0; var13 < 10; ++var13) { + var14 = var4 + this.rand.nextInt(16); + var15 = this.rand.nextInt(128); + var16 = var5 + this.rand.nextInt(16); + (new WorldGenMinable(Block.gravel.blockID, 32)).generate(this.worldObj, this.rand, var14, var15, var16); + } + + for(var13 = 0; var13 < 20; ++var13) { + var14 = var4 + this.rand.nextInt(16); + var15 = this.rand.nextInt(128); + var16 = var5 + this.rand.nextInt(16); + (new WorldGenMinable(Block.oreCoal.blockID, 16)).generate(this.worldObj, this.rand, var14, var15, var16); + } + + for(var13 = 0; var13 < 20; ++var13) { + var14 = var4 + this.rand.nextInt(16); + var15 = this.rand.nextInt(64); + var16 = var5 + this.rand.nextInt(16); + (new WorldGenMinable(Block.oreIron.blockID, 8)).generate(this.worldObj, this.rand, var14, var15, var16); + } + + for(var13 = 0; var13 < 2; ++var13) { + var14 = var4 + this.rand.nextInt(16); + var15 = this.rand.nextInt(32); + var16 = var5 + this.rand.nextInt(16); + (new WorldGenMinable(Block.oreGold.blockID, 8)).generate(this.worldObj, this.rand, var14, var15, var16); + } + + for(var13 = 0; var13 < 8; ++var13) { + var14 = var4 + this.rand.nextInt(16); + var15 = this.rand.nextInt(16); + var16 = var5 + this.rand.nextInt(16); + (new WorldGenMinable(Block.oreRedstone.blockID, 7)).generate(this.worldObj, this.rand, var14, var15, var16); + } + + for(var13 = 0; var13 < 1; ++var13) { + var14 = var4 + this.rand.nextInt(16); + var15 = this.rand.nextInt(16); + var16 = var5 + this.rand.nextInt(16); + (new WorldGenMinable(Block.oreDiamond.blockID, 7)).generate(this.worldObj, this.rand, var14, var15, var16); + } + + for(var13 = 0; var13 < 1; ++var13) { + var14 = var4 + this.rand.nextInt(16); + var15 = this.rand.nextInt(16) + this.rand.nextInt(16); + var16 = var5 + this.rand.nextInt(16); + (new WorldGenMinable(Block.oreLapis.blockID, 6)).generate(this.worldObj, this.rand, var14, var15, var16); + } + + var11 = 0.5D; + var13 = (int)((this.mobSpawnerNoise.func_806_a((double)var4 * var11, (double)var5 * var11) / 8.0D + this.rand.nextDouble() * 4.0D + 4.0D) / 3.0D); + var14 = 0; + if(this.rand.nextInt(10) == 0) { + ++var14; + } + + if(var6 == BiomeGenBase.forest) { + var14 += var13 + 5; + } + + if(var6 == BiomeGenBase.rainforest) { + var14 += var13 + 5; + } + + if(var6 == BiomeGenBase.seasonalForest) { + var14 += var13 + 2; + } + + if(var6 == BiomeGenBase.taiga) { + var14 += var13 + 5; + } + + if(var6 == BiomeGenBase.desert) { + var14 -= 20; + } + + if(var6 == BiomeGenBase.tundra) { + var14 -= 20; + } + + if(var6 == BiomeGenBase.plains) { + var14 -= 20; + } + + int var17; + for(var15 = 0; var15 < var14; ++var15) { + var16 = var4 + this.rand.nextInt(16) + 8; + var17 = var5 + this.rand.nextInt(16) + 8; + WorldGenerator var18 = var6.getRandomWorldGenForTrees(this.rand); + var18.func_517_a(1.0D, 1.0D, 1.0D); + var18.generate(this.worldObj, this.rand, var16, this.worldObj.getHeightValue(var16, var17), var17); + } + + byte var27 = 0; + if(var6 == BiomeGenBase.forest) { + var27 = 2; + } + + if(var6 == BiomeGenBase.seasonalForest) { + var27 = 4; + } + + if(var6 == BiomeGenBase.taiga) { + var27 = 2; + } + + if(var6 == BiomeGenBase.plains) { + var27 = 3; + } + + int var19; + int var25; + for(var16 = 0; var16 < var27; ++var16) { + var17 = var4 + this.rand.nextInt(16) + 8; + var25 = this.rand.nextInt(128); + var19 = var5 + this.rand.nextInt(16) + 8; + (new WorldGenFlowers(Block.plantYellow.blockID)).generate(this.worldObj, this.rand, var17, var25, var19); + } + + byte var28 = 0; + if(var6 == BiomeGenBase.forest) { + var28 = 2; + } + + if(var6 == BiomeGenBase.rainforest) { + var28 = 10; + } + + if(var6 == BiomeGenBase.seasonalForest) { + var28 = 2; + } + + if(var6 == BiomeGenBase.taiga) { + var28 = 1; + } + + if(var6 == BiomeGenBase.plains) { + var28 = 10; + } + + int var20; + int var21; + for(var17 = 0; var17 < var28; ++var17) { + byte var26 = 1; + if(var6 == BiomeGenBase.rainforest && this.rand.nextInt(3) != 0) { + var26 = 2; + } + + var19 = var4 + this.rand.nextInt(16) + 8; + var20 = this.rand.nextInt(128); + var21 = var5 + this.rand.nextInt(16) + 8; + (new WorldGenTallGrass(Block.tallGrass.blockID, var26)).generate(this.worldObj, this.rand, var19, var20, var21); + } + + var28 = 0; + if(var6 == BiomeGenBase.desert) { + var28 = 2; + } + + for(var17 = 0; var17 < var28; ++var17) { + var25 = var4 + this.rand.nextInt(16) + 8; + var19 = this.rand.nextInt(128); + var20 = var5 + this.rand.nextInt(16) + 8; + (new WorldGenDeadBush(Block.deadBush.blockID)).generate(this.worldObj, this.rand, var25, var19, var20); + } + + if(this.rand.nextInt(2) == 0) { + var17 = var4 + this.rand.nextInt(16) + 8; + var25 = this.rand.nextInt(128); + var19 = var5 + this.rand.nextInt(16) + 8; + (new WorldGenFlowers(Block.plantRed.blockID)).generate(this.worldObj, this.rand, var17, var25, var19); + } + + if(this.rand.nextInt(4) == 0) { + var17 = var4 + this.rand.nextInt(16) + 8; + var25 = this.rand.nextInt(128); + var19 = var5 + this.rand.nextInt(16) + 8; + (new WorldGenFlowers(Block.mushroomBrown.blockID)).generate(this.worldObj, this.rand, var17, var25, var19); + } + + if(this.rand.nextInt(8) == 0) { + var17 = var4 + this.rand.nextInt(16) + 8; + var25 = this.rand.nextInt(128); + var19 = var5 + this.rand.nextInt(16) + 8; + (new WorldGenFlowers(Block.mushroomRed.blockID)).generate(this.worldObj, this.rand, var17, var25, var19); + } + + for(var17 = 0; var17 < 10; ++var17) { + var25 = var4 + this.rand.nextInt(16) + 8; + var19 = this.rand.nextInt(128); + var20 = var5 + this.rand.nextInt(16) + 8; + (new WorldGenReed()).generate(this.worldObj, this.rand, var25, var19, var20); + } + + if(this.rand.nextInt(32) == 0) { + var17 = var4 + this.rand.nextInt(16) + 8; + var25 = this.rand.nextInt(128); + var19 = var5 + this.rand.nextInt(16) + 8; + (new WorldGenPumpkin()).generate(this.worldObj, this.rand, var17, var25, var19); + } + + var17 = 0; + if(var6 == BiomeGenBase.desert) { + var17 += 10; + } + + for(var25 = 0; var25 < var17; ++var25) { + var19 = var4 + this.rand.nextInt(16) + 8; + var20 = this.rand.nextInt(128); + var21 = var5 + this.rand.nextInt(16) + 8; + (new WorldGenCactus()).generate(this.worldObj, this.rand, var19, var20, var21); + } + + for(var25 = 0; var25 < 50; ++var25) { + var19 = var4 + this.rand.nextInt(16) + 8; + var20 = this.rand.nextInt(this.rand.nextInt(120) + 8); + var21 = var5 + this.rand.nextInt(16) + 8; + (new WorldGenLiquids(Block.waterMoving.blockID)).generate(this.worldObj, this.rand, var19, var20, var21); + } + + for(var25 = 0; var25 < 20; ++var25) { + var19 = var4 + this.rand.nextInt(16) + 8; + var20 = this.rand.nextInt(this.rand.nextInt(this.rand.nextInt(112) + 8) + 8); + var21 = var5 + this.rand.nextInt(16) + 8; + (new WorldGenLiquids(Block.lavaMoving.blockID)).generate(this.worldObj, this.rand, var19, var20, var21); + } + + this.generatedTemperatures = this.worldObj.getWorldChunkManager().getTemperatures(this.generatedTemperatures, var4 + 8, var5 + 8, 16, 16); + + for(var25 = var4 + 8; var25 < var4 + 8 + 16; ++var25) { + for(var19 = var5 + 8; var19 < var5 + 8 + 16; ++var19) { + var20 = var25 - (var4 + 8); + var21 = var19 - (var5 + 8); + int var22 = this.worldObj.findTopSolidBlock(var25, var19); + double var23 = this.generatedTemperatures[var20 * 16 + var21] - (double)(var22 - 64) / 64.0D * 0.3D; + if(var23 < 0.5D && var22 > 0 && var22 < 128 && this.worldObj.isAirBlock(var25, var22, var19) && this.worldObj.getBlockMaterial(var25, var22 - 1, var19).getIsSolid() && this.worldObj.getBlockMaterial(var25, var22 - 1, var19) != Material.ice) { + this.worldObj.setBlockWithNotify(var25, var22, var19, Block.snow.blockID); + } + } + } + + BlockSand.fallInstantly = false; + } + + public boolean saveChunks(boolean var1, IProgressUpdate var2) { + return true; + } + + public boolean unload100OldestChunks() { + return false; + } + + public boolean canSave() { + return true; + } + + public String makeString() { + return "RandomLevelSource"; + } +} diff --git a/src/net/minecraft/src/ChunkProviderHell.java b/src/net/minecraft/src/ChunkProviderHell.java new file mode 100644 index 0000000..2c860ff --- /dev/null +++ b/src/net/minecraft/src/ChunkProviderHell.java @@ -0,0 +1,376 @@ +package net.minecraft.src; + +import java.util.Random; + +public class ChunkProviderHell implements IChunkProvider { + private Random hellRNG; + private NoiseGeneratorOctaves field_4169_i; + private NoiseGeneratorOctaves field_4168_j; + private NoiseGeneratorOctaves field_4167_k; + private NoiseGeneratorOctaves field_4166_l; + private NoiseGeneratorOctaves field_4165_m; + public NoiseGeneratorOctaves field_4177_a; + public NoiseGeneratorOctaves field_4176_b; + private World worldObj; + private double[] field_4163_o; + private double[] field_4162_p = new double[256]; + private double[] field_4161_q = new double[256]; + private double[] field_4160_r = new double[256]; + private MapGenBase field_4159_s = new MapGenCavesHell(); + double[] field_4175_c; + double[] field_4174_d; + double[] field_4173_e; + double[] field_4172_f; + double[] field_4171_g; + + public ChunkProviderHell(World var1, long var2) { + this.worldObj = var1; + this.hellRNG = new Random(var2); + this.field_4169_i = new NoiseGeneratorOctaves(this.hellRNG, 16); + this.field_4168_j = new NoiseGeneratorOctaves(this.hellRNG, 16); + this.field_4167_k = new NoiseGeneratorOctaves(this.hellRNG, 8); + this.field_4166_l = new NoiseGeneratorOctaves(this.hellRNG, 4); + this.field_4165_m = new NoiseGeneratorOctaves(this.hellRNG, 4); + this.field_4177_a = new NoiseGeneratorOctaves(this.hellRNG, 10); + this.field_4176_b = new NoiseGeneratorOctaves(this.hellRNG, 16); + } + + public void func_4059_a(int var1, int var2, byte[] var3) { + byte var4 = 4; + byte var5 = 32; + int var6 = var4 + 1; + byte var7 = 17; + int var8 = var4 + 1; + this.field_4163_o = this.func_4057_a(this.field_4163_o, var1 * var4, 0, var2 * var4, var6, var7, var8); + + for(int var9 = 0; var9 < var4; ++var9) { + for(int var10 = 0; var10 < var4; ++var10) { + for(int var11 = 0; var11 < 16; ++var11) { + double var12 = 0.125D; + double var14 = this.field_4163_o[((var9 + 0) * var8 + var10 + 0) * var7 + var11 + 0]; + double var16 = this.field_4163_o[((var9 + 0) * var8 + var10 + 1) * var7 + var11 + 0]; + double var18 = this.field_4163_o[((var9 + 1) * var8 + var10 + 0) * var7 + var11 + 0]; + double var20 = this.field_4163_o[((var9 + 1) * var8 + var10 + 1) * var7 + var11 + 0]; + double var22 = (this.field_4163_o[((var9 + 0) * var8 + var10 + 0) * var7 + var11 + 1] - var14) * var12; + double var24 = (this.field_4163_o[((var9 + 0) * var8 + var10 + 1) * var7 + var11 + 1] - var16) * var12; + double var26 = (this.field_4163_o[((var9 + 1) * var8 + var10 + 0) * var7 + var11 + 1] - var18) * var12; + double var28 = (this.field_4163_o[((var9 + 1) * var8 + var10 + 1) * var7 + var11 + 1] - var20) * var12; + + for(int var30 = 0; var30 < 8; ++var30) { + double var31 = 0.25D; + double var33 = var14; + double var35 = var16; + double var37 = (var18 - var14) * var31; + double var39 = (var20 - var16) * var31; + + for(int var41 = 0; var41 < 4; ++var41) { + int var42 = var41 + var9 * 4 << 11 | 0 + var10 * 4 << 7 | var11 * 8 + var30; + short var43 = 128; + double var44 = 0.25D; + double var46 = var33; + double var48 = (var35 - var33) * var44; + + for(int var50 = 0; var50 < 4; ++var50) { + int var51 = 0; + if(var11 * 8 + var30 < var5) { + var51 = Block.lavaStill.blockID; + } + + if(var46 > 0.0D) { + var51 = Block.netherrack.blockID; + } + + var3[var42] = (byte)var51; + var42 += var43; + var46 += var48; + } + + var33 += var37; + var35 += var39; + } + + var14 += var22; + var16 += var24; + var18 += var26; + var20 += var28; + } + } + } + } + + } + + public void func_4058_b(int var1, int var2, byte[] var3) { + byte var4 = 64; + double var5 = 1.0D / 32.0D; + this.field_4162_p = this.field_4166_l.generateNoiseOctaves(this.field_4162_p, (double)(var1 * 16), (double)(var2 * 16), 0.0D, 16, 16, 1, var5, var5, 1.0D); + this.field_4161_q = this.field_4166_l.generateNoiseOctaves(this.field_4161_q, (double)(var1 * 16), 109.0134D, (double)(var2 * 16), 16, 1, 16, var5, 1.0D, var5); + this.field_4160_r = this.field_4165_m.generateNoiseOctaves(this.field_4160_r, (double)(var1 * 16), (double)(var2 * 16), 0.0D, 16, 16, 1, var5 * 2.0D, var5 * 2.0D, var5 * 2.0D); + + for(int var7 = 0; var7 < 16; ++var7) { + for(int var8 = 0; var8 < 16; ++var8) { + boolean var9 = this.field_4162_p[var7 + var8 * 16] + this.hellRNG.nextDouble() * 0.2D > 0.0D; + boolean var10 = this.field_4161_q[var7 + var8 * 16] + this.hellRNG.nextDouble() * 0.2D > 0.0D; + int var11 = (int)(this.field_4160_r[var7 + var8 * 16] / 3.0D + 3.0D + this.hellRNG.nextDouble() * 0.25D); + int var12 = -1; + byte var13 = (byte)Block.netherrack.blockID; + byte var14 = (byte)Block.netherrack.blockID; + + for(int var15 = 127; var15 >= 0; --var15) { + int var16 = (var8 * 16 + var7) * 128 + var15; + if(var15 >= 127 - this.hellRNG.nextInt(5)) { + var3[var16] = (byte)Block.bedrock.blockID; + } else if(var15 <= 0 + this.hellRNG.nextInt(5)) { + var3[var16] = (byte)Block.bedrock.blockID; + } else { + byte var17 = var3[var16]; + if(var17 == 0) { + var12 = -1; + } else if(var17 == Block.netherrack.blockID) { + if(var12 == -1) { + if(var11 <= 0) { + var13 = 0; + var14 = (byte)Block.netherrack.blockID; + } else if(var15 >= var4 - 4 && var15 <= var4 + 1) { + var13 = (byte)Block.netherrack.blockID; + var14 = (byte)Block.netherrack.blockID; + if(var10) { + var13 = (byte)Block.gravel.blockID; + } + + if(var10) { + var14 = (byte)Block.netherrack.blockID; + } + + if(var9) { + var13 = (byte)Block.slowSand.blockID; + } + + if(var9) { + var14 = (byte)Block.slowSand.blockID; + } + } + + if(var15 < var4 && var13 == 0) { + var13 = (byte)Block.lavaStill.blockID; + } + + var12 = var11; + if(var15 >= var4 - 1) { + var3[var16] = var13; + } else { + var3[var16] = var14; + } + } else if(var12 > 0) { + --var12; + var3[var16] = var14; + } + } + } + } + } + } + + } + + public Chunk prepareChunk(int var1, int var2) { + return this.provideChunk(var1, var2); + } + + public Chunk provideChunk(int var1, int var2) { + this.hellRNG.setSeed((long)var1 * 341873128712L + (long)var2 * 132897987541L); + byte[] var3 = new byte[-Short.MIN_VALUE]; + this.func_4059_a(var1, var2, var3); + this.func_4058_b(var1, var2, var3); + this.field_4159_s.func_867_a(this, this.worldObj, var1, var2, var3); + Chunk var4 = new Chunk(this.worldObj, var3, var1, var2); + return var4; + } + + private double[] func_4057_a(double[] var1, int var2, int var3, int var4, int var5, int var6, int var7) { + if(var1 == null) { + var1 = new double[var5 * var6 * var7]; + } + + double var8 = 684.412D; + double var10 = 2053.236D; + this.field_4172_f = this.field_4177_a.generateNoiseOctaves(this.field_4172_f, (double)var2, (double)var3, (double)var4, var5, 1, var7, 1.0D, 0.0D, 1.0D); + this.field_4171_g = this.field_4176_b.generateNoiseOctaves(this.field_4171_g, (double)var2, (double)var3, (double)var4, var5, 1, var7, 100.0D, 0.0D, 100.0D); + this.field_4175_c = this.field_4167_k.generateNoiseOctaves(this.field_4175_c, (double)var2, (double)var3, (double)var4, var5, var6, var7, var8 / 80.0D, var10 / 60.0D, var8 / 80.0D); + this.field_4174_d = this.field_4169_i.generateNoiseOctaves(this.field_4174_d, (double)var2, (double)var3, (double)var4, var5, var6, var7, var8, var10, var8); + this.field_4173_e = this.field_4168_j.generateNoiseOctaves(this.field_4173_e, (double)var2, (double)var3, (double)var4, var5, var6, var7, var8, var10, var8); + int var12 = 0; + int var13 = 0; + double[] var14 = new double[var6]; + + int var15; + for(var15 = 0; var15 < var6; ++var15) { + var14[var15] = Math.cos((double)var15 * Math.PI * 6.0D / (double)var6) * 2.0D; + double var16 = (double)var15; + if(var15 > var6 / 2) { + var16 = (double)(var6 - 1 - var15); + } + + if(var16 < 4.0D) { + var16 = 4.0D - var16; + var14[var15] -= var16 * var16 * var16 * 10.0D; + } + } + + for(var15 = 0; var15 < var5; ++var15) { + for(int var36 = 0; var36 < var7; ++var36) { + double var17 = (this.field_4172_f[var13] + 256.0D) / 512.0D; + if(var17 > 1.0D) { + var17 = 1.0D; + } + + double var19 = 0.0D; + double var21 = this.field_4171_g[var13] / 8000.0D; + if(var21 < 0.0D) { + var21 = -var21; + } + + var21 = var21 * 3.0D - 3.0D; + if(var21 < 0.0D) { + var21 /= 2.0D; + if(var21 < -1.0D) { + var21 = -1.0D; + } + + var21 /= 1.4D; + var21 /= 2.0D; + var17 = 0.0D; + } else { + if(var21 > 1.0D) { + var21 = 1.0D; + } + + var21 /= 6.0D; + } + + var17 += 0.5D; + var21 = var21 * (double)var6 / 16.0D; + ++var13; + + for(int var23 = 0; var23 < var6; ++var23) { + double var24 = 0.0D; + double var26 = var14[var23]; + double var28 = this.field_4174_d[var12] / 512.0D; + double var30 = this.field_4173_e[var12] / 512.0D; + double var32 = (this.field_4175_c[var12] / 10.0D + 1.0D) / 2.0D; + if(var32 < 0.0D) { + var24 = var28; + } else if(var32 > 1.0D) { + var24 = var30; + } else { + var24 = var28 + (var30 - var28) * var32; + } + + var24 -= var26; + double var34; + if(var23 > var6 - 4) { + var34 = (double)((float)(var23 - (var6 - 4)) / 3.0F); + var24 = var24 * (1.0D - var34) + -10.0D * var34; + } + + if((double)var23 < var19) { + var34 = (var19 - (double)var23) / 4.0D; + if(var34 < 0.0D) { + var34 = 0.0D; + } + + if(var34 > 1.0D) { + var34 = 1.0D; + } + + var24 = var24 * (1.0D - var34) + -10.0D * var34; + } + + var1[var12] = var24; + ++var12; + } + } + } + + return var1; + } + + public boolean chunkExists(int var1, int var2) { + return true; + } + + public void populate(IChunkProvider var1, int var2, int var3) { + BlockSand.fallInstantly = true; + int var4 = var2 * 16; + int var5 = var3 * 16; + + int var6; + int var7; + int var8; + int var9; + for(var6 = 0; var6 < 8; ++var6) { + var7 = var4 + this.hellRNG.nextInt(16) + 8; + var8 = this.hellRNG.nextInt(120) + 4; + var9 = var5 + this.hellRNG.nextInt(16) + 8; + (new WorldGenHellLava(Block.lavaMoving.blockID)).generate(this.worldObj, this.hellRNG, var7, var8, var9); + } + + var6 = this.hellRNG.nextInt(this.hellRNG.nextInt(10) + 1) + 1; + + int var10; + for(var7 = 0; var7 < var6; ++var7) { + var8 = var4 + this.hellRNG.nextInt(16) + 8; + var9 = this.hellRNG.nextInt(120) + 4; + var10 = var5 + this.hellRNG.nextInt(16) + 8; + (new WorldGenFire()).generate(this.worldObj, this.hellRNG, var8, var9, var10); + } + + var6 = this.hellRNG.nextInt(this.hellRNG.nextInt(10) + 1); + + for(var7 = 0; var7 < var6; ++var7) { + var8 = var4 + this.hellRNG.nextInt(16) + 8; + var9 = this.hellRNG.nextInt(120) + 4; + var10 = var5 + this.hellRNG.nextInt(16) + 8; + (new WorldGenGlowStone1()).generate(this.worldObj, this.hellRNG, var8, var9, var10); + } + + for(var7 = 0; var7 < 10; ++var7) { + var8 = var4 + this.hellRNG.nextInt(16) + 8; + var9 = this.hellRNG.nextInt(128); + var10 = var5 + this.hellRNG.nextInt(16) + 8; + (new WorldGenGlowStone2()).generate(this.worldObj, this.hellRNG, var8, var9, var10); + } + + if(this.hellRNG.nextInt(1) == 0) { + var7 = var4 + this.hellRNG.nextInt(16) + 8; + var8 = this.hellRNG.nextInt(128); + var9 = var5 + this.hellRNG.nextInt(16) + 8; + (new WorldGenFlowers(Block.mushroomBrown.blockID)).generate(this.worldObj, this.hellRNG, var7, var8, var9); + } + + if(this.hellRNG.nextInt(1) == 0) { + var7 = var4 + this.hellRNG.nextInt(16) + 8; + var8 = this.hellRNG.nextInt(128); + var9 = var5 + this.hellRNG.nextInt(16) + 8; + (new WorldGenFlowers(Block.mushroomRed.blockID)).generate(this.worldObj, this.hellRNG, var7, var8, var9); + } + + BlockSand.fallInstantly = false; + } + + public boolean saveChunks(boolean var1, IProgressUpdate var2) { + return true; + } + + public boolean unload100OldestChunks() { + return false; + } + + public boolean canSave() { + return true; + } + + public String makeString() { + return "HellRandomLevelSource"; + } +} diff --git a/src/net/minecraft/src/ChunkProviderLoadOrGenerate.java b/src/net/minecraft/src/ChunkProviderLoadOrGenerate.java new file mode 100644 index 0000000..0d12114 --- /dev/null +++ b/src/net/minecraft/src/ChunkProviderLoadOrGenerate.java @@ -0,0 +1,217 @@ +package net.minecraft.src; + +import java.io.IOException; + +public class ChunkProviderLoadOrGenerate implements IChunkProvider { + private Chunk blankChunk; + private IChunkProvider chunkProvider; + private IChunkLoader chunkLoader; + private Chunk[] chunks; + private World worldObj; + int lastQueriedChunkXPos; + int lastQueriedChunkZPos; + private Chunk lastQueriedChunk; + private int curChunkX; + private int curChunkY; + + public void setCurrentChunkOver(int var1, int var2) { + this.curChunkX = var1; + this.curChunkY = var2; + } + + public boolean canChunkExist(int var1, int var2) { + byte var3 = 15; + return var1 >= this.curChunkX - var3 && var2 >= this.curChunkY - var3 && var1 <= this.curChunkX + var3 && var2 <= this.curChunkY + var3; + } + + public boolean chunkExists(int var1, int var2) { + if(!this.canChunkExist(var1, var2)) { + return false; + } else if(var1 == this.lastQueriedChunkXPos && var2 == this.lastQueriedChunkZPos && this.lastQueriedChunk != null) { + return true; + } else { + int var3 = var1 & 31; + int var4 = var2 & 31; + int var5 = var3 + var4 * 32; + return this.chunks[var5] != null && (this.chunks[var5] == this.blankChunk || this.chunks[var5].isAtLocation(var1, var2)); + } + } + + public Chunk prepareChunk(int var1, int var2) { + return this.provideChunk(var1, var2); + } + + public Chunk provideChunk(int var1, int var2) { + if(var1 == this.lastQueriedChunkXPos && var2 == this.lastQueriedChunkZPos && this.lastQueriedChunk != null) { + return this.lastQueriedChunk; + } else if(!this.worldObj.findingSpawnPoint && !this.canChunkExist(var1, var2)) { + return this.blankChunk; + } else { + int var3 = var1 & 31; + int var4 = var2 & 31; + int var5 = var3 + var4 * 32; + if(!this.chunkExists(var1, var2)) { + if(this.chunks[var5] != null) { + this.chunks[var5].onChunkUnload(); + this.saveChunk(this.chunks[var5]); + this.saveExtraChunkData(this.chunks[var5]); + } + + Chunk var6 = this.func_542_c(var1, var2); + if(var6 == null) { + if(this.chunkProvider == null) { + var6 = this.blankChunk; + } else { + var6 = this.chunkProvider.provideChunk(var1, var2); + var6.func_25124_i(); + } + } + + this.chunks[var5] = var6; + var6.func_4143_d(); + if(this.chunks[var5] != null) { + this.chunks[var5].onChunkLoad(); + } + + if(!this.chunks[var5].isTerrainPopulated && this.chunkExists(var1 + 1, var2 + 1) && this.chunkExists(var1, var2 + 1) && this.chunkExists(var1 + 1, var2)) { + this.populate(this, var1, var2); + } + + if(this.chunkExists(var1 - 1, var2) && !this.provideChunk(var1 - 1, var2).isTerrainPopulated && this.chunkExists(var1 - 1, var2 + 1) && this.chunkExists(var1, var2 + 1) && this.chunkExists(var1 - 1, var2)) { + this.populate(this, var1 - 1, var2); + } + + if(this.chunkExists(var1, var2 - 1) && !this.provideChunk(var1, var2 - 1).isTerrainPopulated && this.chunkExists(var1 + 1, var2 - 1) && this.chunkExists(var1, var2 - 1) && this.chunkExists(var1 + 1, var2)) { + this.populate(this, var1, var2 - 1); + } + + if(this.chunkExists(var1 - 1, var2 - 1) && !this.provideChunk(var1 - 1, var2 - 1).isTerrainPopulated && this.chunkExists(var1 - 1, var2 - 1) && this.chunkExists(var1, var2 - 1) && this.chunkExists(var1 - 1, var2)) { + this.populate(this, var1 - 1, var2 - 1); + } + } + + this.lastQueriedChunkXPos = var1; + this.lastQueriedChunkZPos = var2; + this.lastQueriedChunk = this.chunks[var5]; + return this.chunks[var5]; + } + } + + private Chunk func_542_c(int var1, int var2) { + if(this.chunkLoader == null) { + return this.blankChunk; + } else { + try { + Chunk var3 = this.chunkLoader.loadChunk(this.worldObj, var1, var2); + if(var3 != null) { + var3.lastSaveTime = this.worldObj.getWorldTime(); + } + + return var3; + } catch (Exception var4) { + var4.printStackTrace(); + return this.blankChunk; + } + } + } + + private void saveExtraChunkData(Chunk var1) { + if(this.chunkLoader != null) { + try { + this.chunkLoader.saveExtraChunkData(this.worldObj, var1); + } catch (Exception var3) { + var3.printStackTrace(); + } + + } + } + + private void saveChunk(Chunk var1) { + if(this.chunkLoader != null) { + try { + var1.lastSaveTime = this.worldObj.getWorldTime(); + this.chunkLoader.saveChunk(this.worldObj, var1); + } catch (IOException var3) { + var3.printStackTrace(); + } + + } + } + + public void populate(IChunkProvider var1, int var2, int var3) { + Chunk var4 = this.provideChunk(var2, var3); + if(!var4.isTerrainPopulated) { + var4.isTerrainPopulated = true; + if(this.chunkProvider != null) { + this.chunkProvider.populate(var1, var2, var3); + var4.setChunkModified(); + } + } + + } + + public boolean saveChunks(boolean var1, IProgressUpdate var2) { + int var3 = 0; + int var4 = 0; + int var5; + if(var2 != null) { + for(var5 = 0; var5 < this.chunks.length; ++var5) { + if(this.chunks[var5] != null && this.chunks[var5].needsSaving(var1)) { + ++var4; + } + } + } + + var5 = 0; + + for(int var6 = 0; var6 < this.chunks.length; ++var6) { + if(this.chunks[var6] != null) { + if(var1 && !this.chunks[var6].neverSave) { + this.saveExtraChunkData(this.chunks[var6]); + } + + if(this.chunks[var6].needsSaving(var1)) { + this.saveChunk(this.chunks[var6]); + this.chunks[var6].isModified = false; + ++var3; + if(var3 == 2 && !var1) { + return false; + } + + if(var2 != null) { + ++var5; + if(var5 % 10 == 0) { + var2.setLoadingProgress(var5 * 100 / var4); + } + } + } + } + } + + if(var1) { + if(this.chunkLoader == null) { + return true; + } + + this.chunkLoader.saveExtraData(); + } + + return true; + } + + public boolean unload100OldestChunks() { + if(this.chunkLoader != null) { + this.chunkLoader.func_814_a(); + } + + return this.chunkProvider.unload100OldestChunks(); + } + + public boolean canSave() { + return true; + } + + public String makeString() { + return "ChunkCache: " + this.chunks.length; + } +} diff --git a/src/net/minecraft/src/ChunkProviderSky.java b/src/net/minecraft/src/ChunkProviderSky.java new file mode 100644 index 0000000..d32f783 --- /dev/null +++ b/src/net/minecraft/src/ChunkProviderSky.java @@ -0,0 +1,515 @@ +package net.minecraft.src; + +import java.util.Random; + +public class ChunkProviderSky implements IChunkProvider { + private Random field_28087_j; + private NoiseGeneratorOctaves field_28086_k; + private NoiseGeneratorOctaves field_28085_l; + private NoiseGeneratorOctaves field_28084_m; + private NoiseGeneratorOctaves field_28083_n; + private NoiseGeneratorOctaves field_28082_o; + public NoiseGeneratorOctaves field_28096_a; + public NoiseGeneratorOctaves field_28095_b; + public NoiseGeneratorOctaves field_28094_c; + private World field_28081_p; + private double[] field_28080_q; + private double[] field_28079_r = new double[256]; + private double[] field_28078_s = new double[256]; + private double[] field_28077_t = new double[256]; + private MapGenBase field_28076_u = new MapGenCaves(); + private BiomeGenBase[] field_28075_v; + double[] field_28093_d; + double[] field_28092_e; + double[] field_28091_f; + double[] field_28090_g; + double[] field_28089_h; + int[][] field_28088_i = new int[32][32]; + private double[] field_28074_w; + + public ChunkProviderSky(World var1, long var2) { + this.field_28081_p = var1; + this.field_28087_j = new Random(var2); + this.field_28086_k = new NoiseGeneratorOctaves(this.field_28087_j, 16); + this.field_28085_l = new NoiseGeneratorOctaves(this.field_28087_j, 16); + this.field_28084_m = new NoiseGeneratorOctaves(this.field_28087_j, 8); + this.field_28083_n = new NoiseGeneratorOctaves(this.field_28087_j, 4); + this.field_28082_o = new NoiseGeneratorOctaves(this.field_28087_j, 4); + this.field_28096_a = new NoiseGeneratorOctaves(this.field_28087_j, 10); + this.field_28095_b = new NoiseGeneratorOctaves(this.field_28087_j, 16); + this.field_28094_c = new NoiseGeneratorOctaves(this.field_28087_j, 8); + } + + public void func_28071_a(int var1, int var2, byte[] var3, BiomeGenBase[] var4, double[] var5) { + byte var6 = 2; + int var7 = var6 + 1; + byte var8 = 33; + int var9 = var6 + 1; + this.field_28080_q = this.func_28073_a(this.field_28080_q, var1 * var6, 0, var2 * var6, var7, var8, var9); + + for(int var10 = 0; var10 < var6; ++var10) { + for(int var11 = 0; var11 < var6; ++var11) { + for(int var12 = 0; var12 < 32; ++var12) { + double var13 = 0.25D; + double var15 = this.field_28080_q[((var10 + 0) * var9 + var11 + 0) * var8 + var12 + 0]; + double var17 = this.field_28080_q[((var10 + 0) * var9 + var11 + 1) * var8 + var12 + 0]; + double var19 = this.field_28080_q[((var10 + 1) * var9 + var11 + 0) * var8 + var12 + 0]; + double var21 = this.field_28080_q[((var10 + 1) * var9 + var11 + 1) * var8 + var12 + 0]; + double var23 = (this.field_28080_q[((var10 + 0) * var9 + var11 + 0) * var8 + var12 + 1] - var15) * var13; + double var25 = (this.field_28080_q[((var10 + 0) * var9 + var11 + 1) * var8 + var12 + 1] - var17) * var13; + double var27 = (this.field_28080_q[((var10 + 1) * var9 + var11 + 0) * var8 + var12 + 1] - var19) * var13; + double var29 = (this.field_28080_q[((var10 + 1) * var9 + var11 + 1) * var8 + var12 + 1] - var21) * var13; + + for(int var31 = 0; var31 < 4; ++var31) { + double var32 = 0.125D; + double var34 = var15; + double var36 = var17; + double var38 = (var19 - var15) * var32; + double var40 = (var21 - var17) * var32; + + for(int var42 = 0; var42 < 8; ++var42) { + int var43 = var42 + var10 * 8 << 11 | 0 + var11 * 8 << 7 | var12 * 4 + var31; + short var44 = 128; + double var45 = 0.125D; + double var47 = var34; + double var49 = (var36 - var34) * var45; + + for(int var51 = 0; var51 < 8; ++var51) { + int var52 = 0; + if(var47 > 0.0D) { + var52 = Block.stone.blockID; + } + + var3[var43] = (byte)var52; + var43 += var44; + var47 += var49; + } + + var34 += var38; + var36 += var40; + } + + var15 += var23; + var17 += var25; + var19 += var27; + var21 += var29; + } + } + } + } + + } + + public void func_28072_a(int var1, int var2, byte[] var3, BiomeGenBase[] var4) { + double var5 = 1.0D / 32.0D; + this.field_28079_r = this.field_28083_n.generateNoiseOctaves(this.field_28079_r, (double)(var1 * 16), (double)(var2 * 16), 0.0D, 16, 16, 1, var5, var5, 1.0D); + this.field_28078_s = this.field_28083_n.generateNoiseOctaves(this.field_28078_s, (double)(var1 * 16), 109.0134D, (double)(var2 * 16), 16, 1, 16, var5, 1.0D, var5); + this.field_28077_t = this.field_28082_o.generateNoiseOctaves(this.field_28077_t, (double)(var1 * 16), (double)(var2 * 16), 0.0D, 16, 16, 1, var5 * 2.0D, var5 * 2.0D, var5 * 2.0D); + + for(int var7 = 0; var7 < 16; ++var7) { + for(int var8 = 0; var8 < 16; ++var8) { + BiomeGenBase var9 = var4[var7 + var8 * 16]; + int var10 = (int)(this.field_28077_t[var7 + var8 * 16] / 3.0D + 3.0D + this.field_28087_j.nextDouble() * 0.25D); + int var11 = -1; + byte var12 = var9.topBlock; + byte var13 = var9.fillerBlock; + + for(int var14 = 127; var14 >= 0; --var14) { + int var15 = (var8 * 16 + var7) * 128 + var14; + byte var16 = var3[var15]; + if(var16 == 0) { + var11 = -1; + } else if(var16 == Block.stone.blockID) { + if(var11 == -1) { + if(var10 <= 0) { + var12 = 0; + var13 = (byte)Block.stone.blockID; + } + + var11 = var10; + if(var14 >= 0) { + var3[var15] = var12; + } else { + var3[var15] = var13; + } + } else if(var11 > 0) { + --var11; + var3[var15] = var13; + if(var11 == 0 && var13 == Block.sand.blockID) { + var11 = this.field_28087_j.nextInt(4); + var13 = (byte)Block.sandStone.blockID; + } + } + } + } + } + } + + } + + public Chunk prepareChunk(int var1, int var2) { + return this.provideChunk(var1, var2); + } + + public Chunk provideChunk(int var1, int var2) { + this.field_28087_j.setSeed((long)var1 * 341873128712L + (long)var2 * 132897987541L); + byte[] var3 = new byte[-Short.MIN_VALUE]; + Chunk var4 = new Chunk(this.field_28081_p, var3, var1, var2); + this.field_28075_v = this.field_28081_p.getWorldChunkManager().loadBlockGeneratorData(this.field_28075_v, var1 * 16, var2 * 16, 16, 16); + double[] var5 = this.field_28081_p.getWorldChunkManager().temperature; + this.func_28071_a(var1, var2, var3, this.field_28075_v, var5); + this.func_28072_a(var1, var2, var3, this.field_28075_v); + this.field_28076_u.func_867_a(this, this.field_28081_p, var1, var2, var3); + var4.func_1024_c(); + return var4; + } + + private double[] func_28073_a(double[] var1, int var2, int var3, int var4, int var5, int var6, int var7) { + if(var1 == null) { + var1 = new double[var5 * var6 * var7]; + } + + double var8 = 684.412D; + double var10 = 684.412D; + double[] var12 = this.field_28081_p.getWorldChunkManager().temperature; + double[] var13 = this.field_28081_p.getWorldChunkManager().humidity; + this.field_28090_g = this.field_28096_a.func_4109_a(this.field_28090_g, var2, var4, var5, var7, 1.121D, 1.121D, 0.5D); + this.field_28089_h = this.field_28095_b.func_4109_a(this.field_28089_h, var2, var4, var5, var7, 200.0D, 200.0D, 0.5D); + var8 *= 2.0D; + this.field_28093_d = this.field_28084_m.generateNoiseOctaves(this.field_28093_d, (double)var2, (double)var3, (double)var4, var5, var6, var7, var8 / 80.0D, var10 / 160.0D, var8 / 80.0D); + this.field_28092_e = this.field_28086_k.generateNoiseOctaves(this.field_28092_e, (double)var2, (double)var3, (double)var4, var5, var6, var7, var8, var10, var8); + this.field_28091_f = this.field_28085_l.generateNoiseOctaves(this.field_28091_f, (double)var2, (double)var3, (double)var4, var5, var6, var7, var8, var10, var8); + int var14 = 0; + int var15 = 0; + int var16 = 16 / var5; + + for(int var17 = 0; var17 < var5; ++var17) { + int var18 = var17 * var16 + var16 / 2; + + for(int var19 = 0; var19 < var7; ++var19) { + int var20 = var19 * var16 + var16 / 2; + double var21 = var12[var18 * 16 + var20]; + double var23 = var13[var18 * 16 + var20] * var21; + double var25 = 1.0D - var23; + var25 *= var25; + var25 *= var25; + var25 = 1.0D - var25; + double var27 = (this.field_28090_g[var15] + 256.0D) / 512.0D; + var27 *= var25; + if(var27 > 1.0D) { + var27 = 1.0D; + } + + double var29 = this.field_28089_h[var15] / 8000.0D; + if(var29 < 0.0D) { + var29 = -var29 * 0.3D; + } + + var29 = var29 * 3.0D - 2.0D; + if(var29 > 1.0D) { + var29 = 1.0D; + } + + var29 /= 8.0D; + var29 = 0.0D; + if(var27 < 0.0D) { + var27 = 0.0D; + } + + var27 += 0.5D; + var29 = var29 * (double)var6 / 16.0D; + ++var15; + double var31 = (double)var6 / 2.0D; + + for(int var33 = 0; var33 < var6; ++var33) { + double var34 = 0.0D; + double var36 = ((double)var33 - var31) * 8.0D / var27; + if(var36 < 0.0D) { + var36 *= -1.0D; + } + + double var38 = this.field_28092_e[var14] / 512.0D; + double var40 = this.field_28091_f[var14] / 512.0D; + double var42 = (this.field_28093_d[var14] / 10.0D + 1.0D) / 2.0D; + if(var42 < 0.0D) { + var34 = var38; + } else if(var42 > 1.0D) { + var34 = var40; + } else { + var34 = var38 + (var40 - var38) * var42; + } + + var34 -= 8.0D; + byte var44 = 32; + double var45; + if(var33 > var6 - var44) { + var45 = (double)((float)(var33 - (var6 - var44)) / ((float)var44 - 1.0F)); + var34 = var34 * (1.0D - var45) + -30.0D * var45; + } + + var44 = 8; + if(var33 < var44) { + var45 = (double)((float)(var44 - var33) / ((float)var44 - 1.0F)); + var34 = var34 * (1.0D - var45) + -30.0D * var45; + } + + var1[var14] = var34; + ++var14; + } + } + } + + return var1; + } + + public boolean chunkExists(int var1, int var2) { + return true; + } + + public void populate(IChunkProvider var1, int var2, int var3) { + BlockSand.fallInstantly = true; + int var4 = var2 * 16; + int var5 = var3 * 16; + BiomeGenBase var6 = this.field_28081_p.getWorldChunkManager().getBiomeGenAt(var4 + 16, var5 + 16); + this.field_28087_j.setSeed(this.field_28081_p.getRandomSeed()); + long var7 = this.field_28087_j.nextLong() / 2L * 2L + 1L; + long var9 = this.field_28087_j.nextLong() / 2L * 2L + 1L; + this.field_28087_j.setSeed((long)var2 * var7 + (long)var3 * var9 ^ this.field_28081_p.getRandomSeed()); + double var11 = 0.25D; + int var13; + int var14; + int var15; + if(this.field_28087_j.nextInt(4) == 0) { + var13 = var4 + this.field_28087_j.nextInt(16) + 8; + var14 = this.field_28087_j.nextInt(128); + var15 = var5 + this.field_28087_j.nextInt(16) + 8; + (new WorldGenLakes(Block.waterStill.blockID)).generate(this.field_28081_p, this.field_28087_j, var13, var14, var15); + } + + if(this.field_28087_j.nextInt(8) == 0) { + var13 = var4 + this.field_28087_j.nextInt(16) + 8; + var14 = this.field_28087_j.nextInt(this.field_28087_j.nextInt(120) + 8); + var15 = var5 + this.field_28087_j.nextInt(16) + 8; + if(var14 < 64 || this.field_28087_j.nextInt(10) == 0) { + (new WorldGenLakes(Block.lavaStill.blockID)).generate(this.field_28081_p, this.field_28087_j, var13, var14, var15); + } + } + + int var16; + for(var13 = 0; var13 < 8; ++var13) { + var14 = var4 + this.field_28087_j.nextInt(16) + 8; + var15 = this.field_28087_j.nextInt(128); + var16 = var5 + this.field_28087_j.nextInt(16) + 8; + (new WorldGenDungeons()).generate(this.field_28081_p, this.field_28087_j, var14, var15, var16); + } + + for(var13 = 0; var13 < 10; ++var13) { + var14 = var4 + this.field_28087_j.nextInt(16); + var15 = this.field_28087_j.nextInt(128); + var16 = var5 + this.field_28087_j.nextInt(16); + (new WorldGenClay(32)).generate(this.field_28081_p, this.field_28087_j, var14, var15, var16); + } + + for(var13 = 0; var13 < 20; ++var13) { + var14 = var4 + this.field_28087_j.nextInt(16); + var15 = this.field_28087_j.nextInt(128); + var16 = var5 + this.field_28087_j.nextInt(16); + (new WorldGenMinable(Block.dirt.blockID, 32)).generate(this.field_28081_p, this.field_28087_j, var14, var15, var16); + } + + for(var13 = 0; var13 < 10; ++var13) { + var14 = var4 + this.field_28087_j.nextInt(16); + var15 = this.field_28087_j.nextInt(128); + var16 = var5 + this.field_28087_j.nextInt(16); + (new WorldGenMinable(Block.gravel.blockID, 32)).generate(this.field_28081_p, this.field_28087_j, var14, var15, var16); + } + + for(var13 = 0; var13 < 20; ++var13) { + var14 = var4 + this.field_28087_j.nextInt(16); + var15 = this.field_28087_j.nextInt(128); + var16 = var5 + this.field_28087_j.nextInt(16); + (new WorldGenMinable(Block.oreCoal.blockID, 16)).generate(this.field_28081_p, this.field_28087_j, var14, var15, var16); + } + + for(var13 = 0; var13 < 20; ++var13) { + var14 = var4 + this.field_28087_j.nextInt(16); + var15 = this.field_28087_j.nextInt(64); + var16 = var5 + this.field_28087_j.nextInt(16); + (new WorldGenMinable(Block.oreIron.blockID, 8)).generate(this.field_28081_p, this.field_28087_j, var14, var15, var16); + } + + for(var13 = 0; var13 < 2; ++var13) { + var14 = var4 + this.field_28087_j.nextInt(16); + var15 = this.field_28087_j.nextInt(32); + var16 = var5 + this.field_28087_j.nextInt(16); + (new WorldGenMinable(Block.oreGold.blockID, 8)).generate(this.field_28081_p, this.field_28087_j, var14, var15, var16); + } + + for(var13 = 0; var13 < 8; ++var13) { + var14 = var4 + this.field_28087_j.nextInt(16); + var15 = this.field_28087_j.nextInt(16); + var16 = var5 + this.field_28087_j.nextInt(16); + (new WorldGenMinable(Block.oreRedstone.blockID, 7)).generate(this.field_28081_p, this.field_28087_j, var14, var15, var16); + } + + for(var13 = 0; var13 < 1; ++var13) { + var14 = var4 + this.field_28087_j.nextInt(16); + var15 = this.field_28087_j.nextInt(16); + var16 = var5 + this.field_28087_j.nextInt(16); + (new WorldGenMinable(Block.oreDiamond.blockID, 7)).generate(this.field_28081_p, this.field_28087_j, var14, var15, var16); + } + + for(var13 = 0; var13 < 1; ++var13) { + var14 = var4 + this.field_28087_j.nextInt(16); + var15 = this.field_28087_j.nextInt(16) + this.field_28087_j.nextInt(16); + var16 = var5 + this.field_28087_j.nextInt(16); + (new WorldGenMinable(Block.oreLapis.blockID, 6)).generate(this.field_28081_p, this.field_28087_j, var14, var15, var16); + } + + var11 = 0.5D; + var13 = (int)((this.field_28094_c.func_806_a((double)var4 * var11, (double)var5 * var11) / 8.0D + this.field_28087_j.nextDouble() * 4.0D + 4.0D) / 3.0D); + var14 = 0; + if(this.field_28087_j.nextInt(10) == 0) { + ++var14; + } + + if(var6 == BiomeGenBase.forest) { + var14 += var13 + 5; + } + + if(var6 == BiomeGenBase.rainforest) { + var14 += var13 + 5; + } + + if(var6 == BiomeGenBase.seasonalForest) { + var14 += var13 + 2; + } + + if(var6 == BiomeGenBase.taiga) { + var14 += var13 + 5; + } + + if(var6 == BiomeGenBase.desert) { + var14 -= 20; + } + + if(var6 == BiomeGenBase.tundra) { + var14 -= 20; + } + + if(var6 == BiomeGenBase.plains) { + var14 -= 20; + } + + int var17; + for(var15 = 0; var15 < var14; ++var15) { + var16 = var4 + this.field_28087_j.nextInt(16) + 8; + var17 = var5 + this.field_28087_j.nextInt(16) + 8; + WorldGenerator var18 = var6.getRandomWorldGenForTrees(this.field_28087_j); + var18.func_517_a(1.0D, 1.0D, 1.0D); + var18.generate(this.field_28081_p, this.field_28087_j, var16, this.field_28081_p.getHeightValue(var16, var17), var17); + } + + int var23; + for(var15 = 0; var15 < 2; ++var15) { + var16 = var4 + this.field_28087_j.nextInt(16) + 8; + var17 = this.field_28087_j.nextInt(128); + var23 = var5 + this.field_28087_j.nextInt(16) + 8; + (new WorldGenFlowers(Block.plantYellow.blockID)).generate(this.field_28081_p, this.field_28087_j, var16, var17, var23); + } + + if(this.field_28087_j.nextInt(2) == 0) { + var15 = var4 + this.field_28087_j.nextInt(16) + 8; + var16 = this.field_28087_j.nextInt(128); + var17 = var5 + this.field_28087_j.nextInt(16) + 8; + (new WorldGenFlowers(Block.plantRed.blockID)).generate(this.field_28081_p, this.field_28087_j, var15, var16, var17); + } + + if(this.field_28087_j.nextInt(4) == 0) { + var15 = var4 + this.field_28087_j.nextInt(16) + 8; + var16 = this.field_28087_j.nextInt(128); + var17 = var5 + this.field_28087_j.nextInt(16) + 8; + (new WorldGenFlowers(Block.mushroomBrown.blockID)).generate(this.field_28081_p, this.field_28087_j, var15, var16, var17); + } + + if(this.field_28087_j.nextInt(8) == 0) { + var15 = var4 + this.field_28087_j.nextInt(16) + 8; + var16 = this.field_28087_j.nextInt(128); + var17 = var5 + this.field_28087_j.nextInt(16) + 8; + (new WorldGenFlowers(Block.mushroomRed.blockID)).generate(this.field_28081_p, this.field_28087_j, var15, var16, var17); + } + + for(var15 = 0; var15 < 10; ++var15) { + var16 = var4 + this.field_28087_j.nextInt(16) + 8; + var17 = this.field_28087_j.nextInt(128); + var23 = var5 + this.field_28087_j.nextInt(16) + 8; + (new WorldGenReed()).generate(this.field_28081_p, this.field_28087_j, var16, var17, var23); + } + + if(this.field_28087_j.nextInt(32) == 0) { + var15 = var4 + this.field_28087_j.nextInt(16) + 8; + var16 = this.field_28087_j.nextInt(128); + var17 = var5 + this.field_28087_j.nextInt(16) + 8; + (new WorldGenPumpkin()).generate(this.field_28081_p, this.field_28087_j, var15, var16, var17); + } + + var15 = 0; + if(var6 == BiomeGenBase.desert) { + var15 += 10; + } + + int var19; + for(var16 = 0; var16 < var15; ++var16) { + var17 = var4 + this.field_28087_j.nextInt(16) + 8; + var23 = this.field_28087_j.nextInt(128); + var19 = var5 + this.field_28087_j.nextInt(16) + 8; + (new WorldGenCactus()).generate(this.field_28081_p, this.field_28087_j, var17, var23, var19); + } + + for(var16 = 0; var16 < 50; ++var16) { + var17 = var4 + this.field_28087_j.nextInt(16) + 8; + var23 = this.field_28087_j.nextInt(this.field_28087_j.nextInt(120) + 8); + var19 = var5 + this.field_28087_j.nextInt(16) + 8; + (new WorldGenLiquids(Block.waterMoving.blockID)).generate(this.field_28081_p, this.field_28087_j, var17, var23, var19); + } + + for(var16 = 0; var16 < 20; ++var16) { + var17 = var4 + this.field_28087_j.nextInt(16) + 8; + var23 = this.field_28087_j.nextInt(this.field_28087_j.nextInt(this.field_28087_j.nextInt(112) + 8) + 8); + var19 = var5 + this.field_28087_j.nextInt(16) + 8; + (new WorldGenLiquids(Block.lavaMoving.blockID)).generate(this.field_28081_p, this.field_28087_j, var17, var23, var19); + } + + this.field_28074_w = this.field_28081_p.getWorldChunkManager().getTemperatures(this.field_28074_w, var4 + 8, var5 + 8, 16, 16); + + for(var16 = var4 + 8; var16 < var4 + 8 + 16; ++var16) { + for(var17 = var5 + 8; var17 < var5 + 8 + 16; ++var17) { + var23 = var16 - (var4 + 8); + var19 = var17 - (var5 + 8); + int var20 = this.field_28081_p.findTopSolidBlock(var16, var17); + double var21 = this.field_28074_w[var23 * 16 + var19] - (double)(var20 - 64) / 64.0D * 0.3D; + if(var21 < 0.5D && var20 > 0 && var20 < 128 && this.field_28081_p.isAirBlock(var16, var20, var17) && this.field_28081_p.getBlockMaterial(var16, var20 - 1, var17).getIsSolid() && this.field_28081_p.getBlockMaterial(var16, var20 - 1, var17) != Material.ice) { + this.field_28081_p.setBlockWithNotify(var16, var20, var17, Block.snow.blockID); + } + } + } + + BlockSand.fallInstantly = false; + } + + public boolean saveChunks(boolean var1, IProgressUpdate var2) { + return true; + } + + public boolean unload100OldestChunks() { + return false; + } + + public boolean canSave() { + return true; + } + + public String makeString() { + return "RandomLevelSource"; + } +} diff --git a/src/net/minecraft/src/ClippingHelper.java b/src/net/minecraft/src/ClippingHelper.java new file mode 100644 index 0000000..356fa4f --- /dev/null +++ b/src/net/minecraft/src/ClippingHelper.java @@ -0,0 +1,18 @@ +package net.minecraft.src; + +public class ClippingHelper { + public float[][] frustum = new float[16][16]; + public float[] projectionMatrix = new float[16]; + public float[] modelviewMatrix = new float[16]; + public float[] clippingMatrix = new float[16]; + + public boolean isBoxInFrustum(double var1, double var3, double var5, double var7, double var9, double var11) { + for(int var13 = 0; var13 < 6; ++var13) { + if((double)this.frustum[var13][0] * var1 + (double)this.frustum[var13][1] * var3 + (double)this.frustum[var13][2] * var5 + (double)this.frustum[var13][3] <= 0.0D && (double)this.frustum[var13][0] * var7 + (double)this.frustum[var13][1] * var3 + (double)this.frustum[var13][2] * var5 + (double)this.frustum[var13][3] <= 0.0D && (double)this.frustum[var13][0] * var1 + (double)this.frustum[var13][1] * var9 + (double)this.frustum[var13][2] * var5 + (double)this.frustum[var13][3] <= 0.0D && (double)this.frustum[var13][0] * var7 + (double)this.frustum[var13][1] * var9 + (double)this.frustum[var13][2] * var5 + (double)this.frustum[var13][3] <= 0.0D && (double)this.frustum[var13][0] * var1 + (double)this.frustum[var13][1] * var3 + (double)this.frustum[var13][2] * var11 + (double)this.frustum[var13][3] <= 0.0D && (double)this.frustum[var13][0] * var7 + (double)this.frustum[var13][1] * var3 + (double)this.frustum[var13][2] * var11 + (double)this.frustum[var13][3] <= 0.0D && (double)this.frustum[var13][0] * var1 + (double)this.frustum[var13][1] * var9 + (double)this.frustum[var13][2] * var11 + (double)this.frustum[var13][3] <= 0.0D && (double)this.frustum[var13][0] * var7 + (double)this.frustum[var13][1] * var9 + (double)this.frustum[var13][2] * var11 + (double)this.frustum[var13][3] <= 0.0D) { + return false; + } + } + + return true; + } +} diff --git a/src/net/minecraft/src/ClippingHelperImpl.java b/src/net/minecraft/src/ClippingHelperImpl.java new file mode 100644 index 0000000..29e4cf4 --- /dev/null +++ b/src/net/minecraft/src/ClippingHelperImpl.java @@ -0,0 +1,82 @@ +package net.minecraft.src; + +import java.nio.FloatBuffer; +import org.lwjgl.opengl.GL11; + +public class ClippingHelperImpl extends ClippingHelper { + private static ClippingHelperImpl instance = new ClippingHelperImpl(); + private FloatBuffer projectionMatrixBuffer = GLAllocation.createDirectFloatBuffer(16); + private FloatBuffer modelviewMatrixBuffer = GLAllocation.createDirectFloatBuffer(16); + private FloatBuffer field_1691_h = GLAllocation.createDirectFloatBuffer(16); + + public static ClippingHelper getInstance() { + instance.init(); + return instance; + } + + private void normalize(float[][] var1, int var2) { + float var3 = MathHelper.sqrt_float(var1[var2][0] * var1[var2][0] + var1[var2][1] * var1[var2][1] + var1[var2][2] * var1[var2][2]); + var1[var2][0] /= var3; + var1[var2][1] /= var3; + var1[var2][2] /= var3; + var1[var2][3] /= var3; + } + + private void init() { + this.projectionMatrixBuffer.clear(); + this.modelviewMatrixBuffer.clear(); + this.field_1691_h.clear(); + GL11.glGetFloat(GL11.GL_PROJECTION_MATRIX, this.projectionMatrixBuffer); + GL11.glGetFloat(GL11.GL_MODELVIEW_MATRIX, this.modelviewMatrixBuffer); + this.projectionMatrixBuffer.flip().limit(16); + this.projectionMatrixBuffer.get(this.projectionMatrix); + this.modelviewMatrixBuffer.flip().limit(16); + this.modelviewMatrixBuffer.get(this.modelviewMatrix); + this.clippingMatrix[0] = this.modelviewMatrix[0] * this.projectionMatrix[0] + this.modelviewMatrix[1] * this.projectionMatrix[4] + this.modelviewMatrix[2] * this.projectionMatrix[8] + this.modelviewMatrix[3] * this.projectionMatrix[12]; + this.clippingMatrix[1] = this.modelviewMatrix[0] * this.projectionMatrix[1] + this.modelviewMatrix[1] * this.projectionMatrix[5] + this.modelviewMatrix[2] * this.projectionMatrix[9] + this.modelviewMatrix[3] * this.projectionMatrix[13]; + this.clippingMatrix[2] = this.modelviewMatrix[0] * this.projectionMatrix[2] + this.modelviewMatrix[1] * this.projectionMatrix[6] + this.modelviewMatrix[2] * this.projectionMatrix[10] + this.modelviewMatrix[3] * this.projectionMatrix[14]; + this.clippingMatrix[3] = this.modelviewMatrix[0] * this.projectionMatrix[3] + this.modelviewMatrix[1] * this.projectionMatrix[7] + this.modelviewMatrix[2] * this.projectionMatrix[11] + this.modelviewMatrix[3] * this.projectionMatrix[15]; + this.clippingMatrix[4] = this.modelviewMatrix[4] * this.projectionMatrix[0] + this.modelviewMatrix[5] * this.projectionMatrix[4] + this.modelviewMatrix[6] * this.projectionMatrix[8] + this.modelviewMatrix[7] * this.projectionMatrix[12]; + this.clippingMatrix[5] = this.modelviewMatrix[4] * this.projectionMatrix[1] + this.modelviewMatrix[5] * this.projectionMatrix[5] + this.modelviewMatrix[6] * this.projectionMatrix[9] + this.modelviewMatrix[7] * this.projectionMatrix[13]; + this.clippingMatrix[6] = this.modelviewMatrix[4] * this.projectionMatrix[2] + this.modelviewMatrix[5] * this.projectionMatrix[6] + this.modelviewMatrix[6] * this.projectionMatrix[10] + this.modelviewMatrix[7] * this.projectionMatrix[14]; + this.clippingMatrix[7] = this.modelviewMatrix[4] * this.projectionMatrix[3] + this.modelviewMatrix[5] * this.projectionMatrix[7] + this.modelviewMatrix[6] * this.projectionMatrix[11] + this.modelviewMatrix[7] * this.projectionMatrix[15]; + this.clippingMatrix[8] = this.modelviewMatrix[8] * this.projectionMatrix[0] + this.modelviewMatrix[9] * this.projectionMatrix[4] + this.modelviewMatrix[10] * this.projectionMatrix[8] + this.modelviewMatrix[11] * this.projectionMatrix[12]; + this.clippingMatrix[9] = this.modelviewMatrix[8] * this.projectionMatrix[1] + this.modelviewMatrix[9] * this.projectionMatrix[5] + this.modelviewMatrix[10] * this.projectionMatrix[9] + this.modelviewMatrix[11] * this.projectionMatrix[13]; + this.clippingMatrix[10] = this.modelviewMatrix[8] * this.projectionMatrix[2] + this.modelviewMatrix[9] * this.projectionMatrix[6] + this.modelviewMatrix[10] * this.projectionMatrix[10] + this.modelviewMatrix[11] * this.projectionMatrix[14]; + this.clippingMatrix[11] = this.modelviewMatrix[8] * this.projectionMatrix[3] + this.modelviewMatrix[9] * this.projectionMatrix[7] + this.modelviewMatrix[10] * this.projectionMatrix[11] + this.modelviewMatrix[11] * this.projectionMatrix[15]; + this.clippingMatrix[12] = this.modelviewMatrix[12] * this.projectionMatrix[0] + this.modelviewMatrix[13] * this.projectionMatrix[4] + this.modelviewMatrix[14] * this.projectionMatrix[8] + this.modelviewMatrix[15] * this.projectionMatrix[12]; + this.clippingMatrix[13] = this.modelviewMatrix[12] * this.projectionMatrix[1] + this.modelviewMatrix[13] * this.projectionMatrix[5] + this.modelviewMatrix[14] * this.projectionMatrix[9] + this.modelviewMatrix[15] * this.projectionMatrix[13]; + this.clippingMatrix[14] = this.modelviewMatrix[12] * this.projectionMatrix[2] + this.modelviewMatrix[13] * this.projectionMatrix[6] + this.modelviewMatrix[14] * this.projectionMatrix[10] + this.modelviewMatrix[15] * this.projectionMatrix[14]; + this.clippingMatrix[15] = this.modelviewMatrix[12] * this.projectionMatrix[3] + this.modelviewMatrix[13] * this.projectionMatrix[7] + this.modelviewMatrix[14] * this.projectionMatrix[11] + this.modelviewMatrix[15] * this.projectionMatrix[15]; + this.frustum[0][0] = this.clippingMatrix[3] - this.clippingMatrix[0]; + this.frustum[0][1] = this.clippingMatrix[7] - this.clippingMatrix[4]; + this.frustum[0][2] = this.clippingMatrix[11] - this.clippingMatrix[8]; + this.frustum[0][3] = this.clippingMatrix[15] - this.clippingMatrix[12]; + this.normalize(this.frustum, 0); + this.frustum[1][0] = this.clippingMatrix[3] + this.clippingMatrix[0]; + this.frustum[1][1] = this.clippingMatrix[7] + this.clippingMatrix[4]; + this.frustum[1][2] = this.clippingMatrix[11] + this.clippingMatrix[8]; + this.frustum[1][3] = this.clippingMatrix[15] + this.clippingMatrix[12]; + this.normalize(this.frustum, 1); + this.frustum[2][0] = this.clippingMatrix[3] + this.clippingMatrix[1]; + this.frustum[2][1] = this.clippingMatrix[7] + this.clippingMatrix[5]; + this.frustum[2][2] = this.clippingMatrix[11] + this.clippingMatrix[9]; + this.frustum[2][3] = this.clippingMatrix[15] + this.clippingMatrix[13]; + this.normalize(this.frustum, 2); + this.frustum[3][0] = this.clippingMatrix[3] - this.clippingMatrix[1]; + this.frustum[3][1] = this.clippingMatrix[7] - this.clippingMatrix[5]; + this.frustum[3][2] = this.clippingMatrix[11] - this.clippingMatrix[9]; + this.frustum[3][3] = this.clippingMatrix[15] - this.clippingMatrix[13]; + this.normalize(this.frustum, 3); + this.frustum[4][0] = this.clippingMatrix[3] - this.clippingMatrix[2]; + this.frustum[4][1] = this.clippingMatrix[7] - this.clippingMatrix[6]; + this.frustum[4][2] = this.clippingMatrix[11] - this.clippingMatrix[10]; + this.frustum[4][3] = this.clippingMatrix[15] - this.clippingMatrix[14]; + this.normalize(this.frustum, 4); + this.frustum[5][0] = this.clippingMatrix[3] + this.clippingMatrix[2]; + this.frustum[5][1] = this.clippingMatrix[7] + this.clippingMatrix[6]; + this.frustum[5][2] = this.clippingMatrix[11] + this.clippingMatrix[10]; + this.frustum[5][3] = this.clippingMatrix[15] + this.clippingMatrix[14]; + this.normalize(this.frustum, 5); + } +} diff --git a/src/net/minecraft/src/CodecMus.java b/src/net/minecraft/src/CodecMus.java new file mode 100644 index 0000000..ab78c96 --- /dev/null +++ b/src/net/minecraft/src/CodecMus.java @@ -0,0 +1,11 @@ +package net.minecraft.src; + +import java.io.IOException; +import java.io.InputStream; +import paulscode.sound.codecs.CodecJOrbis; + +public class CodecMus extends CodecJOrbis { + protected InputStream openInputStream() throws IOException { + return new MusInputStream(this, this.url, this.urlConnection.getInputStream()); + } +} diff --git a/src/net/minecraft/src/ColorizerFoliage.java b/src/net/minecraft/src/ColorizerFoliage.java new file mode 100644 index 0000000..d0d7691 --- /dev/null +++ b/src/net/minecraft/src/ColorizerFoliage.java @@ -0,0 +1,28 @@ +package net.minecraft.src; + +public class ColorizerFoliage { + private static int[] foliageBuffer = new int[65536]; + + public static void func_28152_a(int[] var0) { + foliageBuffer = var0; + } + + public static int getFoliageColor(double var0, double var2) { + var2 *= var0; + int var4 = (int)((1.0D - var0) * 255.0D); + int var5 = (int)((1.0D - var2) * 255.0D); + return foliageBuffer[var5 << 8 | var4]; + } + + public static int getFoliageColorPine() { + return 6396257; + } + + public static int getFoliageColorBirch() { + return 8431445; + } + + public static int func_31073_c() { + return 4764952; + } +} diff --git a/src/net/minecraft/src/ColorizerGrass.java b/src/net/minecraft/src/ColorizerGrass.java new file mode 100644 index 0000000..f034f68 --- /dev/null +++ b/src/net/minecraft/src/ColorizerGrass.java @@ -0,0 +1,16 @@ +package net.minecraft.src; + +public class ColorizerGrass { + private static int[] grassBuffer = new int[65536]; + + public static void func_28181_a(int[] var0) { + grassBuffer = var0; + } + + public static int getGrassColor(double var0, double var2) { + var2 *= var0; + int var4 = (int)((1.0D - var0) * 255.0D); + int var5 = (int)((1.0D - var2) * 255.0D); + return grassBuffer[var5 << 8 | var4]; + } +} diff --git a/src/net/minecraft/src/ColorizerWater.java b/src/net/minecraft/src/ColorizerWater.java new file mode 100644 index 0000000..0f2c12a --- /dev/null +++ b/src/net/minecraft/src/ColorizerWater.java @@ -0,0 +1,9 @@ +package net.minecraft.src; + +public class ColorizerWater { + private static int[] waterBuffer = new int[65536]; + + public static void func_28182_a(int[] var0) { + waterBuffer = var0; + } +} diff --git a/src/net/minecraft/src/CompressedStreamTools.java b/src/net/minecraft/src/CompressedStreamTools.java new file mode 100644 index 0000000..6d9fd20 --- /dev/null +++ b/src/net/minecraft/src/CompressedStreamTools.java @@ -0,0 +1,50 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataInputStream; +import java.io.DataOutput; +import java.io.DataOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.zip.GZIPInputStream; +import java.util.zip.GZIPOutputStream; + +public class CompressedStreamTools { + public static NBTTagCompound func_1138_a(InputStream var0) throws IOException { + DataInputStream var1 = new DataInputStream(new GZIPInputStream(var0)); + + NBTTagCompound var2; + try { + var2 = func_1141_a(var1); + } finally { + var1.close(); + } + + return var2; + } + + public static void writeGzippedCompoundToOutputStream(NBTTagCompound var0, OutputStream var1) throws IOException { + DataOutputStream var2 = new DataOutputStream(new GZIPOutputStream(var1)); + + try { + func_1139_a(var0, var2); + } finally { + var2.close(); + } + + } + + public static NBTTagCompound func_1141_a(DataInput var0) throws IOException { + NBTBase var1 = NBTBase.readTag(var0); + if(var1 instanceof NBTTagCompound) { + return (NBTTagCompound)var1; + } else { + throw new IOException("Root tag must be a named compound tag"); + } + } + + public static void func_1139_a(NBTTagCompound var0, DataOutput var1) throws IOException { + NBTBase.writeTag(var0, var1); + } +} diff --git a/src/net/minecraft/src/Container.java b/src/net/minecraft/src/Container.java new file mode 100644 index 0000000..0b35fa9 --- /dev/null +++ b/src/net/minecraft/src/Container.java @@ -0,0 +1,253 @@ +package net.minecraft.src; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +public abstract class Container { + public List field_20123_d = new ArrayList(); + public List slots = new ArrayList(); + public int windowId = 0; + private short field_20917_a = 0; + protected List field_20121_g = new ArrayList(); + private Set field_20918_b = new HashSet(); + + protected void addSlot(Slot var1) { + var1.slotNumber = this.slots.size(); + this.slots.add(var1); + this.field_20123_d.add((Object)null); + } + + public void updateCraftingResults() { + for(int var1 = 0; var1 < this.slots.size(); ++var1) { + ItemStack var2 = ((Slot)this.slots.get(var1)).getStack(); + ItemStack var3 = (ItemStack)this.field_20123_d.get(var1); + if(!ItemStack.areItemStacksEqual(var3, var2)) { + var3 = var2 == null ? null : var2.copy(); + this.field_20123_d.set(var1, var3); + + for(int var4 = 0; var4 < this.field_20121_g.size(); ++var4) { + ((ICrafting)this.field_20121_g.get(var4)).func_20159_a(this, var1, var3); + } + } + } + + } + + public Slot getSlot(int var1) { + return (Slot)this.slots.get(var1); + } + + public ItemStack getStackInSlot(int var1) { + Slot var2 = (Slot)this.slots.get(var1); + return var2 != null ? var2.getStack() : null; + } + + public ItemStack func_27280_a(int var1, int var2, boolean var3, EntityPlayer var4) { + ItemStack var5 = null; + if(var2 == 0 || var2 == 1) { + InventoryPlayer var6 = var4.inventory; + if(var1 == -999) { + if(var6.getItemStack() != null && var1 == -999) { + if(var2 == 0) { + var4.dropPlayerItem(var6.getItemStack()); + var6.setItemStack((ItemStack)null); + } + + if(var2 == 1) { + var4.dropPlayerItem(var6.getItemStack().splitStack(1)); + if(var6.getItemStack().stackSize == 0) { + var6.setItemStack((ItemStack)null); + } + } + } + } else { + int var10; + if(var3) { + ItemStack var7 = this.getStackInSlot(var1); + if(var7 != null) { + int var8 = var7.stackSize; + var5 = var7.copy(); + Slot var9 = (Slot)this.slots.get(var1); + if(var9 != null && var9.getStack() != null) { + var10 = var9.getStack().stackSize; + if(var10 < var8) { + this.func_27280_a(var1, var2, var3, var4); + } + } + } + } else { + Slot var12 = (Slot)this.slots.get(var1); + if(var12 != null) { + var12.onSlotChanged(); + ItemStack var13 = var12.getStack(); + ItemStack var14 = var6.getItemStack(); + if(var13 != null) { + var5 = var13.copy(); + } + + if(var13 == null) { + if(var14 != null && var12.isItemValid(var14)) { + var10 = var2 == 0 ? var14.stackSize : 1; + if(var10 > var12.getSlotStackLimit()) { + var10 = var12.getSlotStackLimit(); + } + + var12.putStack(var14.splitStack(var10)); + if(var14.stackSize == 0) { + var6.setItemStack((ItemStack)null); + } + } + } else if(var14 == null) { + var10 = var2 == 0 ? var13.stackSize : (var13.stackSize + 1) / 2; + ItemStack var11 = var12.decrStackSize(var10); + var6.setItemStack(var11); + if(var13.stackSize == 0) { + var12.putStack((ItemStack)null); + } + + var12.onPickupFromSlot(var6.getItemStack()); + } else if(var12.isItemValid(var14)) { + if(var13.itemID != var14.itemID || var13.getHasSubtypes() && var13.getItemDamage() != var14.getItemDamage()) { + if(var14.stackSize <= var12.getSlotStackLimit()) { + var12.putStack(var14); + var6.setItemStack(var13); + } + } else { + var10 = var2 == 0 ? var14.stackSize : 1; + if(var10 > var12.getSlotStackLimit() - var13.stackSize) { + var10 = var12.getSlotStackLimit() - var13.stackSize; + } + + if(var10 > var14.getMaxStackSize() - var13.stackSize) { + var10 = var14.getMaxStackSize() - var13.stackSize; + } + + var14.splitStack(var10); + if(var14.stackSize == 0) { + var6.setItemStack((ItemStack)null); + } + + var13.stackSize += var10; + } + } else if(var13.itemID == var14.itemID && var14.getMaxStackSize() > 1 && (!var13.getHasSubtypes() || var13.getItemDamage() == var14.getItemDamage())) { + var10 = var13.stackSize; + if(var10 > 0 && var10 + var14.stackSize <= var14.getMaxStackSize()) { + var14.stackSize += var10; + var13.splitStack(var10); + if(var13.stackSize == 0) { + var12.putStack((ItemStack)null); + } + + var12.onPickupFromSlot(var6.getItemStack()); + } + } + } + } + } + } + + return var5; + } + + public void onCraftGuiClosed(EntityPlayer var1) { + InventoryPlayer var2 = var1.inventory; + if(var2.getItemStack() != null) { + var1.dropPlayerItem(var2.getItemStack()); + var2.setItemStack((ItemStack)null); + } + + } + + public void onCraftMatrixChanged(IInventory var1) { + this.updateCraftingResults(); + } + + public void putStackInSlot(int var1, ItemStack var2) { + this.getSlot(var1).putStack(var2); + } + + public void putStacksInSlots(ItemStack[] var1) { + for(int var2 = 0; var2 < var1.length; ++var2) { + this.getSlot(var2).putStack(var1[var2]); + } + + } + + public void func_20112_a(int var1, int var2) { + } + + public short func_20111_a(InventoryPlayer var1) { + ++this.field_20917_a; + return this.field_20917_a; + } + + public void func_20113_a(short var1) { + } + + public void func_20110_b(short var1) { + } + + public abstract boolean isUsableByPlayer(EntityPlayer var1); + + protected void func_28125_a(ItemStack var1, int var2, int var3, boolean var4) { + int var5 = var2; + if(var4) { + var5 = var3 - 1; + } + + Slot var6; + ItemStack var7; + if(var1.isStackable()) { + while(var1.stackSize > 0 && (!var4 && var5 < var3 || var4 && var5 >= var2)) { + var6 = (Slot)this.slots.get(var5); + var7 = var6.getStack(); + if(var7 != null && var7.itemID == var1.itemID && (!var1.getHasSubtypes() || var1.getItemDamage() == var7.getItemDamage())) { + int var8 = var7.stackSize + var1.stackSize; + if(var8 <= var1.getMaxStackSize()) { + var1.stackSize = 0; + var7.stackSize = var8; + var6.onSlotChanged(); + } else if(var7.stackSize < var1.getMaxStackSize()) { + var1.stackSize -= var1.getMaxStackSize() - var7.stackSize; + var7.stackSize = var1.getMaxStackSize(); + var6.onSlotChanged(); + } + } + + if(var4) { + --var5; + } else { + ++var5; + } + } + } + + if(var1.stackSize > 0) { + if(var4) { + var5 = var3 - 1; + } else { + var5 = var2; + } + + while(!var4 && var5 < var3 || var4 && var5 >= var2) { + var6 = (Slot)this.slots.get(var5); + var7 = var6.getStack(); + if(var7 == null) { + var6.putStack(var1.copy()); + var6.onSlotChanged(); + var1.stackSize = 0; + break; + } + + if(var4) { + --var5; + } else { + ++var5; + } + } + } + + } +} diff --git a/src/net/minecraft/src/ContainerChest.java b/src/net/minecraft/src/ContainerChest.java new file mode 100644 index 0000000..358392f --- /dev/null +++ b/src/net/minecraft/src/ContainerChest.java @@ -0,0 +1,57 @@ +package net.minecraft.src; + +public class ContainerChest extends Container { + private IInventory field_20125_a; + private int field_27282_b; + + public ContainerChest(IInventory var1, IInventory var2) { + this.field_20125_a = var2; + this.field_27282_b = var2.getSizeInventory() / 9; + int var3 = (this.field_27282_b - 4) * 18; + + int var4; + int var5; + for(var4 = 0; var4 < this.field_27282_b; ++var4) { + for(var5 = 0; var5 < 9; ++var5) { + this.addSlot(new Slot(var2, var5 + var4 * 9, 8 + var5 * 18, 18 + var4 * 18)); + } + } + + for(var4 = 0; var4 < 3; ++var4) { + for(var5 = 0; var5 < 9; ++var5) { + this.addSlot(new Slot(var1, var5 + var4 * 9 + 9, 8 + var5 * 18, 103 + var4 * 18 + var3)); + } + } + + for(var4 = 0; var4 < 9; ++var4) { + this.addSlot(new Slot(var1, var4, 8 + var4 * 18, 161 + var3)); + } + + } + + public boolean isUsableByPlayer(EntityPlayer var1) { + return this.field_20125_a.canInteractWith(var1); + } + + public ItemStack getStackInSlot(int var1) { + ItemStack var2 = null; + Slot var3 = (Slot)this.slots.get(var1); + if(var3 != null && var3.getHasStack()) { + ItemStack var4 = var3.getStack(); + var2 = var4.copy(); + if(var1 < this.field_27282_b * 9) { + this.func_28125_a(var4, this.field_27282_b * 9, this.slots.size(), true); + } else { + this.func_28125_a(var4, 0, this.field_27282_b * 9, false); + } + + if(var4.stackSize == 0) { + var3.putStack((ItemStack)null); + } else { + var3.onSlotChanged(); + } + } + + return var2; + } +} diff --git a/src/net/minecraft/src/ContainerDispenser.java b/src/net/minecraft/src/ContainerDispenser.java new file mode 100644 index 0000000..55108cb --- /dev/null +++ b/src/net/minecraft/src/ContainerDispenser.java @@ -0,0 +1,32 @@ +package net.minecraft.src; + +public class ContainerDispenser extends Container { + private TileEntityDispenser field_21149_a; + + public ContainerDispenser(IInventory var1, TileEntityDispenser var2) { + this.field_21149_a = var2; + + int var3; + int var4; + for(var3 = 0; var3 < 3; ++var3) { + for(var4 = 0; var4 < 3; ++var4) { + this.addSlot(new Slot(var2, var4 + var3 * 3, 62 + var4 * 18, 17 + var3 * 18)); + } + } + + for(var3 = 0; var3 < 3; ++var3) { + for(var4 = 0; var4 < 9; ++var4) { + this.addSlot(new Slot(var1, var4 + var3 * 9 + 9, 8 + var4 * 18, 84 + var3 * 18)); + } + } + + for(var3 = 0; var3 < 9; ++var3) { + this.addSlot(new Slot(var1, var3, 8 + var3 * 18, 142)); + } + + } + + public boolean isUsableByPlayer(EntityPlayer var1) { + return this.field_21149_a.canInteractWith(var1); + } +} diff --git a/src/net/minecraft/src/ContainerFurnace.java b/src/net/minecraft/src/ContainerFurnace.java new file mode 100644 index 0000000..19a7ab9 --- /dev/null +++ b/src/net/minecraft/src/ContainerFurnace.java @@ -0,0 +1,101 @@ +package net.minecraft.src; + +public class ContainerFurnace extends Container { + private TileEntityFurnace furnace; + private int cookTime = 0; + private int burnTime = 0; + private int itemBurnTime = 0; + + public ContainerFurnace(InventoryPlayer var1, TileEntityFurnace var2) { + this.furnace = var2; + this.addSlot(new Slot(var2, 0, 56, 17)); + this.addSlot(new Slot(var2, 1, 56, 53)); + this.addSlot(new SlotFurnace(var1.player, var2, 2, 116, 35)); + + int var3; + for(var3 = 0; var3 < 3; ++var3) { + for(int var4 = 0; var4 < 9; ++var4) { + this.addSlot(new Slot(var1, var4 + var3 * 9 + 9, 8 + var4 * 18, 84 + var3 * 18)); + } + } + + for(var3 = 0; var3 < 9; ++var3) { + this.addSlot(new Slot(var1, var3, 8 + var3 * 18, 142)); + } + + } + + public void updateCraftingResults() { + super.updateCraftingResults(); + + for(int var1 = 0; var1 < this.field_20121_g.size(); ++var1) { + ICrafting var2 = (ICrafting)this.field_20121_g.get(var1); + if(this.cookTime != this.furnace.furnaceCookTime) { + var2.func_20158_a(this, 0, this.furnace.furnaceCookTime); + } + + if(this.burnTime != this.furnace.furnaceBurnTime) { + var2.func_20158_a(this, 1, this.furnace.furnaceBurnTime); + } + + if(this.itemBurnTime != this.furnace.currentItemBurnTime) { + var2.func_20158_a(this, 2, this.furnace.currentItemBurnTime); + } + } + + this.cookTime = this.furnace.furnaceCookTime; + this.burnTime = this.furnace.furnaceBurnTime; + this.itemBurnTime = this.furnace.currentItemBurnTime; + } + + public void func_20112_a(int var1, int var2) { + if(var1 == 0) { + this.furnace.furnaceCookTime = var2; + } + + if(var1 == 1) { + this.furnace.furnaceBurnTime = var2; + } + + if(var1 == 2) { + this.furnace.currentItemBurnTime = var2; + } + + } + + public boolean isUsableByPlayer(EntityPlayer var1) { + return this.furnace.canInteractWith(var1); + } + + public ItemStack getStackInSlot(int var1) { + ItemStack var2 = null; + Slot var3 = (Slot)this.slots.get(var1); + if(var3 != null && var3.getHasStack()) { + ItemStack var4 = var3.getStack(); + var2 = var4.copy(); + if(var1 == 2) { + this.func_28125_a(var4, 3, 39, true); + } else if(var1 >= 3 && var1 < 30) { + this.func_28125_a(var4, 30, 39, false); + } else if(var1 >= 30 && var1 < 39) { + this.func_28125_a(var4, 3, 30, false); + } else { + this.func_28125_a(var4, 3, 39, false); + } + + if(var4.stackSize == 0) { + var3.putStack((ItemStack)null); + } else { + var3.onSlotChanged(); + } + + if(var4.stackSize == var2.stackSize) { + return null; + } + + var3.onPickupFromSlot(var4); + } + + return var2; + } +} diff --git a/src/net/minecraft/src/ContainerPlayer.java b/src/net/minecraft/src/ContainerPlayer.java new file mode 100644 index 0000000..9e08539 --- /dev/null +++ b/src/net/minecraft/src/ContainerPlayer.java @@ -0,0 +1,96 @@ +package net.minecraft.src; + +public class ContainerPlayer extends Container { + public InventoryCrafting craftMatrix; + public IInventory craftResult; + public boolean isSinglePlayer; + + public ContainerPlayer(InventoryPlayer var1) { + this(var1, true); + } + + public ContainerPlayer(InventoryPlayer var1, boolean var2) { + this.craftMatrix = new InventoryCrafting(this, 2, 2); + this.craftResult = new InventoryCraftResult(); + this.isSinglePlayer = false; + this.isSinglePlayer = var2; + this.addSlot(new SlotCrafting(var1.player, this.craftMatrix, this.craftResult, 0, 144, 36)); + + int var3; + int var4; + for(var3 = 0; var3 < 2; ++var3) { + for(var4 = 0; var4 < 2; ++var4) { + this.addSlot(new Slot(this.craftMatrix, var4 + var3 * 2, 88 + var4 * 18, 26 + var3 * 18)); + } + } + + for(var3 = 0; var3 < 4; ++var3) { + this.addSlot(new SlotArmor(this, var1, var1.getSizeInventory() - 1 - var3, 8, 8 + var3 * 18, var3)); + } + + for(var3 = 0; var3 < 3; ++var3) { + for(var4 = 0; var4 < 9; ++var4) { + this.addSlot(new Slot(var1, var4 + (var3 + 1) * 9, 8 + var4 * 18, 84 + var3 * 18)); + } + } + + for(var3 = 0; var3 < 9; ++var3) { + this.addSlot(new Slot(var1, var3, 8 + var3 * 18, 142)); + } + + this.onCraftMatrixChanged(this.craftMatrix); + } + + public void onCraftMatrixChanged(IInventory var1) { + this.craftResult.setInventorySlotContents(0, CraftingManager.getInstance().findMatchingRecipe(this.craftMatrix)); + } + + public void onCraftGuiClosed(EntityPlayer var1) { + super.onCraftGuiClosed(var1); + + for(int var2 = 0; var2 < 4; ++var2) { + ItemStack var3 = this.craftMatrix.getStackInSlot(var2); + if(var3 != null) { + var1.dropPlayerItem(var3); + this.craftMatrix.setInventorySlotContents(var2, (ItemStack)null); + } + } + + } + + public boolean isUsableByPlayer(EntityPlayer var1) { + return true; + } + + public ItemStack getStackInSlot(int var1) { + ItemStack var2 = null; + Slot var3 = (Slot)this.slots.get(var1); + if(var3 != null && var3.getHasStack()) { + ItemStack var4 = var3.getStack(); + var2 = var4.copy(); + if(var1 == 0) { + this.func_28125_a(var4, 9, 45, true); + } else if(var1 >= 9 && var1 < 36) { + this.func_28125_a(var4, 36, 45, false); + } else if(var1 >= 36 && var1 < 45) { + this.func_28125_a(var4, 9, 36, false); + } else { + this.func_28125_a(var4, 9, 45, false); + } + + if(var4.stackSize == 0) { + var3.putStack((ItemStack)null); + } else { + var3.onSlotChanged(); + } + + if(var4.stackSize == var2.stackSize) { + return null; + } + + var3.onPickupFromSlot(var4); + } + + return var2; + } +} diff --git a/src/net/minecraft/src/ContainerWorkbench.java b/src/net/minecraft/src/ContainerWorkbench.java new file mode 100644 index 0000000..989ed64 --- /dev/null +++ b/src/net/minecraft/src/ContainerWorkbench.java @@ -0,0 +1,91 @@ +package net.minecraft.src; + +public class ContainerWorkbench extends Container { + public InventoryCrafting craftMatrix = new InventoryCrafting(this, 3, 3); + public IInventory craftResult = new InventoryCraftResult(); + private World field_20133_c; + private int field_20132_h; + private int field_20131_i; + private int field_20130_j; + + public ContainerWorkbench(InventoryPlayer var1, World var2, int var3, int var4, int var5) { + this.field_20133_c = var2; + this.field_20132_h = var3; + this.field_20131_i = var4; + this.field_20130_j = var5; + this.addSlot(new SlotCrafting(var1.player, this.craftMatrix, this.craftResult, 0, 124, 35)); + + int var6; + int var7; + for(var6 = 0; var6 < 3; ++var6) { + for(var7 = 0; var7 < 3; ++var7) { + this.addSlot(new Slot(this.craftMatrix, var7 + var6 * 3, 30 + var7 * 18, 17 + var6 * 18)); + } + } + + for(var6 = 0; var6 < 3; ++var6) { + for(var7 = 0; var7 < 9; ++var7) { + this.addSlot(new Slot(var1, var7 + var6 * 9 + 9, 8 + var7 * 18, 84 + var6 * 18)); + } + } + + for(var6 = 0; var6 < 9; ++var6) { + this.addSlot(new Slot(var1, var6, 8 + var6 * 18, 142)); + } + + this.onCraftMatrixChanged(this.craftMatrix); + } + + public void onCraftMatrixChanged(IInventory var1) { + this.craftResult.setInventorySlotContents(0, CraftingManager.getInstance().findMatchingRecipe(this.craftMatrix)); + } + + public void onCraftGuiClosed(EntityPlayer var1) { + super.onCraftGuiClosed(var1); + if(!this.field_20133_c.multiplayerWorld) { + for(int var2 = 0; var2 < 9; ++var2) { + ItemStack var3 = this.craftMatrix.getStackInSlot(var2); + if(var3 != null) { + var1.dropPlayerItem(var3); + } + } + + } + } + + public boolean isUsableByPlayer(EntityPlayer var1) { + return this.field_20133_c.getBlockId(this.field_20132_h, this.field_20131_i, this.field_20130_j) != Block.workbench.blockID ? false : var1.getDistanceSq((double)this.field_20132_h + 0.5D, (double)this.field_20131_i + 0.5D, (double)this.field_20130_j + 0.5D) <= 64.0D; + } + + public ItemStack getStackInSlot(int var1) { + ItemStack var2 = null; + Slot var3 = (Slot)this.slots.get(var1); + if(var3 != null && var3.getHasStack()) { + ItemStack var4 = var3.getStack(); + var2 = var4.copy(); + if(var1 == 0) { + this.func_28125_a(var4, 10, 46, true); + } else if(var1 >= 10 && var1 < 37) { + this.func_28125_a(var4, 37, 46, false); + } else if(var1 >= 37 && var1 < 46) { + this.func_28125_a(var4, 10, 37, false); + } else { + this.func_28125_a(var4, 10, 46, false); + } + + if(var4.stackSize == 0) { + var3.putStack((ItemStack)null); + } else { + var3.onSlotChanged(); + } + + if(var4.stackSize == var2.stackSize) { + return null; + } + + var3.onPickupFromSlot(var4); + } + + return var2; + } +} diff --git a/src/net/minecraft/src/CraftingManager.java b/src/net/minecraft/src/CraftingManager.java new file mode 100644 index 0000000..1177833 --- /dev/null +++ b/src/net/minecraft/src/CraftingManager.java @@ -0,0 +1,174 @@ +package net.minecraft.src; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; + +public class CraftingManager { + private static final CraftingManager instance = new CraftingManager(); + private List recipes = new ArrayList(); + + public static final CraftingManager getInstance() { + return instance; + } + + private CraftingManager() { + (new RecipesTools()).addRecipes(this); + (new RecipesWeapons()).addRecipes(this); + (new RecipesIngots()).addRecipes(this); + (new RecipesFood()).addRecipes(this); + (new RecipesCrafting()).addRecipes(this); + (new RecipesArmor()).addRecipes(this); + (new RecipesDyes()).addRecipes(this); + this.addRecipe(new ItemStack(Item.paper, 3), new Object[]{"###", Character.valueOf('#'), Item.reed}); + this.addRecipe(new ItemStack(Item.book, 1), new Object[]{"#", "#", "#", Character.valueOf('#'), Item.paper}); + this.addRecipe(new ItemStack(Block.fence, 2), new Object[]{"###", "###", Character.valueOf('#'), Item.stick}); + this.addRecipe(new ItemStack(Block.jukebox, 1), new Object[]{"###", "#X#", "###", Character.valueOf('#'), Block.planks, Character.valueOf('X'), Item.diamond}); + this.addRecipe(new ItemStack(Block.musicBlock, 1), new Object[]{"###", "#X#", "###", Character.valueOf('#'), Block.planks, Character.valueOf('X'), Item.redstone}); + this.addRecipe(new ItemStack(Block.bookShelf, 1), new Object[]{"###", "XXX", "###", Character.valueOf('#'), Block.planks, Character.valueOf('X'), Item.book}); + this.addRecipe(new ItemStack(Block.blockSnow, 1), new Object[]{"##", "##", Character.valueOf('#'), Item.snowball}); + this.addRecipe(new ItemStack(Block.blockClay, 1), new Object[]{"##", "##", Character.valueOf('#'), Item.clay}); + this.addRecipe(new ItemStack(Block.brick, 1), new Object[]{"##", "##", Character.valueOf('#'), Item.brick}); + this.addRecipe(new ItemStack(Block.glowStone, 1), new Object[]{"##", "##", Character.valueOf('#'), Item.lightStoneDust}); + this.addRecipe(new ItemStack(Block.cloth, 1), new Object[]{"##", "##", Character.valueOf('#'), Item.silk}); + this.addRecipe(new ItemStack(Block.tnt, 1), new Object[]{"X#X", "#X#", "X#X", Character.valueOf('X'), Item.gunpowder, Character.valueOf('#'), Block.sand}); + this.addRecipe(new ItemStack(Block.stairSingle, 3, 3), new Object[]{"###", Character.valueOf('#'), Block.cobblestone}); + this.addRecipe(new ItemStack(Block.stairSingle, 3, 0), new Object[]{"###", Character.valueOf('#'), Block.stone}); + this.addRecipe(new ItemStack(Block.stairSingle, 3, 1), new Object[]{"###", Character.valueOf('#'), Block.sandStone}); + this.addRecipe(new ItemStack(Block.stairSingle, 3, 2), new Object[]{"###", Character.valueOf('#'), Block.planks}); + this.addRecipe(new ItemStack(Block.ladder, 2), new Object[]{"# #", "###", "# #", Character.valueOf('#'), Item.stick}); + this.addRecipe(new ItemStack(Item.doorWood, 1), new Object[]{"##", "##", "##", Character.valueOf('#'), Block.planks}); + this.addRecipe(new ItemStack(Block.trapdoor, 2), new Object[]{"###", "###", Character.valueOf('#'), Block.planks}); + this.addRecipe(new ItemStack(Item.doorSteel, 1), new Object[]{"##", "##", "##", Character.valueOf('#'), Item.ingotIron}); + this.addRecipe(new ItemStack(Item.sign, 1), new Object[]{"###", "###", " X ", Character.valueOf('#'), Block.planks, Character.valueOf('X'), Item.stick}); + this.addRecipe(new ItemStack(Item.cake, 1), new Object[]{"AAA", "BEB", "CCC", Character.valueOf('A'), Item.bucketMilk, Character.valueOf('B'), Item.sugar, Character.valueOf('C'), Item.wheat, Character.valueOf('E'), Item.egg}); + this.addRecipe(new ItemStack(Item.sugar, 1), new Object[]{"#", Character.valueOf('#'), Item.reed}); + this.addRecipe(new ItemStack(Block.planks, 4), new Object[]{"#", Character.valueOf('#'), Block.wood}); + this.addRecipe(new ItemStack(Item.stick, 4), new Object[]{"#", "#", Character.valueOf('#'), Block.planks}); + this.addRecipe(new ItemStack(Block.torchWood, 4), new Object[]{"X", "#", Character.valueOf('X'), Item.coal, Character.valueOf('#'), Item.stick}); + this.addRecipe(new ItemStack(Block.torchWood, 4), new Object[]{"X", "#", Character.valueOf('X'), new ItemStack(Item.coal, 1, 1), Character.valueOf('#'), Item.stick}); + this.addRecipe(new ItemStack(Item.bowlEmpty, 4), new Object[]{"# #", " # ", Character.valueOf('#'), Block.planks}); + this.addRecipe(new ItemStack(Block.rail, 16), new Object[]{"X X", "X#X", "X X", Character.valueOf('X'), Item.ingotIron, Character.valueOf('#'), Item.stick}); + this.addRecipe(new ItemStack(Block.railPowered, 6), new Object[]{"X X", "X#X", "XRX", Character.valueOf('X'), Item.ingotGold, Character.valueOf('R'), Item.redstone, Character.valueOf('#'), Item.stick}); + this.addRecipe(new ItemStack(Block.railDetector, 6), new Object[]{"X X", "X#X", "XRX", Character.valueOf('X'), Item.ingotIron, Character.valueOf('R'), Item.redstone, Character.valueOf('#'), Block.pressurePlateStone}); + this.addRecipe(new ItemStack(Item.minecartEmpty, 1), new Object[]{"# #", "###", Character.valueOf('#'), Item.ingotIron}); + this.addRecipe(new ItemStack(Block.pumpkinLantern, 1), new Object[]{"A", "B", Character.valueOf('A'), Block.pumpkin, Character.valueOf('B'), Block.torchWood}); + this.addRecipe(new ItemStack(Item.minecartCrate, 1), new Object[]{"A", "B", Character.valueOf('A'), Block.chest, Character.valueOf('B'), Item.minecartEmpty}); + this.addRecipe(new ItemStack(Item.minecartPowered, 1), new Object[]{"A", "B", Character.valueOf('A'), Block.stoneOvenIdle, Character.valueOf('B'), Item.minecartEmpty}); + this.addRecipe(new ItemStack(Item.boat, 1), new Object[]{"# #", "###", Character.valueOf('#'), Block.planks}); + this.addRecipe(new ItemStack(Item.bucketEmpty, 1), new Object[]{"# #", " # ", Character.valueOf('#'), Item.ingotIron}); + this.addRecipe(new ItemStack(Item.flintAndSteel, 1), new Object[]{"A ", " B", Character.valueOf('A'), Item.ingotIron, Character.valueOf('B'), Item.flint}); + this.addRecipe(new ItemStack(Item.bread, 1), new Object[]{"###", Character.valueOf('#'), Item.wheat}); + this.addRecipe(new ItemStack(Block.stairCompactPlanks, 4), new Object[]{"# ", "## ", "###", Character.valueOf('#'), Block.planks}); + this.addRecipe(new ItemStack(Item.fishingRod, 1), new Object[]{" #", " #X", "# X", Character.valueOf('#'), Item.stick, Character.valueOf('X'), Item.silk}); + this.addRecipe(new ItemStack(Block.stairCompactCobblestone, 4), new Object[]{"# ", "## ", "###", Character.valueOf('#'), Block.cobblestone}); + this.addRecipe(new ItemStack(Item.painting, 1), new Object[]{"###", "#X#", "###", Character.valueOf('#'), Item.stick, Character.valueOf('X'), Block.cloth}); + this.addRecipe(new ItemStack(Item.appleGold, 1), new Object[]{"###", "#X#", "###", Character.valueOf('#'), Block.blockGold, Character.valueOf('X'), Item.appleRed}); + this.addRecipe(new ItemStack(Block.lever, 1), new Object[]{"X", "#", Character.valueOf('#'), Block.cobblestone, Character.valueOf('X'), Item.stick}); + this.addRecipe(new ItemStack(Block.torchRedstoneActive, 1), new Object[]{"X", "#", Character.valueOf('#'), Item.stick, Character.valueOf('X'), Item.redstone}); + this.addRecipe(new ItemStack(Item.redstoneRepeater, 1), new Object[]{"#X#", "III", Character.valueOf('#'), Block.torchRedstoneActive, Character.valueOf('X'), Item.redstone, Character.valueOf('I'), Block.stone}); + this.addRecipe(new ItemStack(Item.pocketSundial, 1), new Object[]{" # ", "#X#", " # ", Character.valueOf('#'), Item.ingotGold, Character.valueOf('X'), Item.redstone}); + this.addRecipe(new ItemStack(Item.compass, 1), new Object[]{" # ", "#X#", " # ", Character.valueOf('#'), Item.ingotIron, Character.valueOf('X'), Item.redstone}); + this.addRecipe(new ItemStack(Item.mapItem, 1), new Object[]{"###", "#X#", "###", Character.valueOf('#'), Item.paper, Character.valueOf('X'), Item.compass}); + this.addRecipe(new ItemStack(Block.button, 1), new Object[]{"#", "#", Character.valueOf('#'), Block.stone}); + this.addRecipe(new ItemStack(Block.pressurePlateStone, 1), new Object[]{"##", Character.valueOf('#'), Block.stone}); + this.addRecipe(new ItemStack(Block.pressurePlatePlanks, 1), new Object[]{"##", Character.valueOf('#'), Block.planks}); + this.addRecipe(new ItemStack(Block.dispenser, 1), new Object[]{"###", "#X#", "#R#", Character.valueOf('#'), Block.cobblestone, Character.valueOf('X'), Item.bow, Character.valueOf('R'), Item.redstone}); + this.addRecipe(new ItemStack(Block.pistonBase, 1), new Object[]{"TTT", "#X#", "#R#", Character.valueOf('#'), Block.cobblestone, Character.valueOf('X'), Item.ingotIron, Character.valueOf('R'), Item.redstone, Character.valueOf('T'), Block.planks}); + this.addRecipe(new ItemStack(Block.pistonStickyBase, 1), new Object[]{"S", "P", Character.valueOf('S'), Item.slimeBall, Character.valueOf('P'), Block.pistonBase}); + this.addRecipe(new ItemStack(Item.bed, 1), new Object[]{"###", "XXX", Character.valueOf('#'), Block.cloth, Character.valueOf('X'), Block.planks}); + Collections.sort(this.recipes, new RecipeSorter(this)); + System.out.println(this.recipes.size() + " recipes"); + } + + void addRecipe(ItemStack var1, Object... var2) { + String var3 = ""; + int var4 = 0; + int var5 = 0; + int var6 = 0; + if(var2[var4] instanceof String[]) { + String[] var11 = (String[])((String[])var2[var4++]); + + for(int var8 = 0; var8 < var11.length; ++var8) { + String var9 = var11[var8]; + ++var6; + var5 = var9.length(); + var3 = var3 + var9; + } + } else { + while(var2[var4] instanceof String) { + String var7 = (String)var2[var4++]; + ++var6; + var5 = var7.length(); + var3 = var3 + var7; + } + } + + HashMap var12; + for(var12 = new HashMap(); var4 < var2.length; var4 += 2) { + Character var13 = (Character)var2[var4]; + ItemStack var15 = null; + if(var2[var4 + 1] instanceof Item) { + var15 = new ItemStack((Item)var2[var4 + 1]); + } else if(var2[var4 + 1] instanceof Block) { + var15 = new ItemStack((Block)var2[var4 + 1], 1, -1); + } else if(var2[var4 + 1] instanceof ItemStack) { + var15 = (ItemStack)var2[var4 + 1]; + } + + var12.put(var13, var15); + } + + ItemStack[] var14 = new ItemStack[var5 * var6]; + + for(int var16 = 0; var16 < var5 * var6; ++var16) { + char var10 = var3.charAt(var16); + if(var12.containsKey(Character.valueOf(var10))) { + var14[var16] = ((ItemStack)var12.get(Character.valueOf(var10))).copy(); + } else { + var14[var16] = null; + } + } + + this.recipes.add(new ShapedRecipes(var5, var6, var14, var1)); + } + + void addShapelessRecipe(ItemStack var1, Object... var2) { + ArrayList var3 = new ArrayList(); + Object[] var4 = var2; + int var5 = var2.length; + + for(int var6 = 0; var6 < var5; ++var6) { + Object var7 = var4[var6]; + if(var7 instanceof ItemStack) { + var3.add(((ItemStack)var7).copy()); + } else if(var7 instanceof Item) { + var3.add(new ItemStack((Item)var7)); + } else { + if(!(var7 instanceof Block)) { + throw new RuntimeException("Invalid shapeless recipy!"); + } + + var3.add(new ItemStack((Block)var7)); + } + } + + this.recipes.add(new ShapelessRecipes(var1, var3)); + } + + public ItemStack findMatchingRecipe(InventoryCrafting var1) { + for(int var2 = 0; var2 < this.recipes.size(); ++var2) { + IRecipe var3 = (IRecipe)this.recipes.get(var2); + if(var3.matches(var1)) { + return var3.getCraftingResult(var1); + } + } + + return null; + } + + public List getRecipeList() { + return this.recipes; + } +} diff --git a/src/net/minecraft/src/DataWatcher.java b/src/net/minecraft/src/DataWatcher.java new file mode 100644 index 0000000..d9dd0e0 --- /dev/null +++ b/src/net/minecraft/src/DataWatcher.java @@ -0,0 +1,179 @@ +package net.minecraft.src; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +public class DataWatcher { + private static final HashMap dataTypes = new HashMap(); + private final Map watchedObjects = new HashMap(); + private boolean objectChanged; + + public void addObject(int var1, Object var2) { + Integer var3 = (Integer)dataTypes.get(var2.getClass()); + if(var3 == null) { + throw new IllegalArgumentException("Unknown data type: " + var2.getClass()); + } else if(var1 > 31) { + throw new IllegalArgumentException("Data value id is too big with " + var1 + "! (Max is " + 31 + ")"); + } else if(this.watchedObjects.containsKey(Integer.valueOf(var1))) { + throw new IllegalArgumentException("Duplicate id value for " + var1 + "!"); + } else { + WatchableObject var4 = new WatchableObject(var3.intValue(), var1, var2); + this.watchedObjects.put(Integer.valueOf(var1), var4); + } + } + + public byte getWatchableObjectByte(int var1) { + return ((Byte)((WatchableObject)this.watchedObjects.get(Integer.valueOf(var1))).getObject()).byteValue(); + } + + public int getWatchableObjectInt(int var1) { + return ((Integer)((WatchableObject)this.watchedObjects.get(Integer.valueOf(var1))).getObject()).intValue(); + } + + public String getWatchableObjectString(int var1) { + return (String)((WatchableObject)this.watchedObjects.get(Integer.valueOf(var1))).getObject(); + } + + public void updateObject(int var1, Object var2) { + WatchableObject var3 = (WatchableObject)this.watchedObjects.get(Integer.valueOf(var1)); + if(!var2.equals(var3.getObject())) { + var3.setObject(var2); + var3.setWatching(true); + this.objectChanged = true; + } + + } + + public static void writeObjectsInListToStream(List var0, DataOutputStream var1) throws IOException { + if(var0 != null) { + Iterator var2 = var0.iterator(); + + while(var2.hasNext()) { + WatchableObject var3 = (WatchableObject)var2.next(); + writeWatchableObject(var1, var3); + } + } + + var1.writeByte(127); + } + + public void writeWatchableObjects(DataOutputStream var1) throws IOException { + Iterator var2 = this.watchedObjects.values().iterator(); + + while(var2.hasNext()) { + WatchableObject var3 = (WatchableObject)var2.next(); + writeWatchableObject(var1, var3); + } + + var1.writeByte(127); + } + + private static void writeWatchableObject(DataOutputStream var0, WatchableObject var1) throws IOException { + int var2 = (var1.getObjectType() << 5 | var1.getDataValueId() & 31) & 255; + var0.writeByte(var2); + switch(var1.getObjectType()) { + case 0: + var0.writeByte(((Byte)var1.getObject()).byteValue()); + break; + case 1: + var0.writeShort(((Short)var1.getObject()).shortValue()); + break; + case 2: + var0.writeInt(((Integer)var1.getObject()).intValue()); + break; + case 3: + var0.writeFloat(((Float)var1.getObject()).floatValue()); + break; + case 4: + Packet.writeString((String)var1.getObject(), var0); + break; + case 5: + ItemStack var4 = (ItemStack)var1.getObject(); + var0.writeShort(var4.getItem().shiftedIndex); + var0.writeByte(var4.stackSize); + var0.writeShort(var4.getItemDamage()); + break; + case 6: + ChunkCoordinates var3 = (ChunkCoordinates)var1.getObject(); + var0.writeInt(var3.x); + var0.writeInt(var3.y); + var0.writeInt(var3.z); + } + + } + + public static List readWatchableObjects(DataInputStream var0) throws IOException { + ArrayList var1 = null; + + for(byte var2 = var0.readByte(); var2 != 127; var2 = var0.readByte()) { + if(var1 == null) { + var1 = new ArrayList(); + } + + int var3 = (var2 & 224) >> 5; + int var4 = var2 & 31; + WatchableObject var5 = null; + switch(var3) { + case 0: + var5 = new WatchableObject(var3, var4, Byte.valueOf(var0.readByte())); + break; + case 1: + var5 = new WatchableObject(var3, var4, Short.valueOf(var0.readShort())); + break; + case 2: + var5 = new WatchableObject(var3, var4, Integer.valueOf(var0.readInt())); + break; + case 3: + var5 = new WatchableObject(var3, var4, Float.valueOf(var0.readFloat())); + break; + case 4: + var5 = new WatchableObject(var3, var4, Packet.readString(var0, 64)); + break; + case 5: + short var9 = var0.readShort(); + byte var10 = var0.readByte(); + short var11 = var0.readShort(); + var5 = new WatchableObject(var3, var4, new ItemStack(var9, var10, var11)); + break; + case 6: + int var6 = var0.readInt(); + int var7 = var0.readInt(); + int var8 = var0.readInt(); + var5 = new WatchableObject(var3, var4, new ChunkCoordinates(var6, var7, var8)); + } + + var1.add(var5); + } + + return var1; + } + + public void updateWatchedObjectsFromList(List var1) { + Iterator var2 = var1.iterator(); + + while(var2.hasNext()) { + WatchableObject var3 = (WatchableObject)var2.next(); + WatchableObject var4 = (WatchableObject)this.watchedObjects.get(Integer.valueOf(var3.getDataValueId())); + if(var4 != null) { + var4.setObject(var3.getObject()); + } + } + + } + + static { + dataTypes.put(Byte.class, Integer.valueOf(0)); + dataTypes.put(Short.class, Integer.valueOf(1)); + dataTypes.put(Integer.class, Integer.valueOf(2)); + dataTypes.put(Float.class, Integer.valueOf(3)); + dataTypes.put(String.class, Integer.valueOf(4)); + dataTypes.put(ItemStack.class, Integer.valueOf(5)); + dataTypes.put(ChunkCoordinates.class, Integer.valueOf(6)); + } +} diff --git a/src/net/minecraft/src/EffectRenderer.java b/src/net/minecraft/src/EffectRenderer.java new file mode 100644 index 0000000..2a17b42 --- /dev/null +++ b/src/net/minecraft/src/EffectRenderer.java @@ -0,0 +1,170 @@ +package net.minecraft.src; + +import java.util.ArrayList; +import java.util.List; +import java.util.Random; +import org.lwjgl.opengl.GL11; + +public class EffectRenderer { + protected World worldObj; + private List[] fxLayers = new List[4]; + private RenderEngine renderer; + private Random rand = new Random(); + + public EffectRenderer(World var1, RenderEngine var2) { + if(var1 != null) { + this.worldObj = var1; + } + + this.renderer = var2; + + for(int var3 = 0; var3 < 4; ++var3) { + this.fxLayers[var3] = new ArrayList(); + } + + } + + public void addEffect(EntityFX var1) { + int var2 = var1.getFXLayer(); + if(this.fxLayers[var2].size() >= 4000) { + this.fxLayers[var2].remove(0); + } + + this.fxLayers[var2].add(var1); + } + + public void updateEffects() { + for(int var1 = 0; var1 < 4; ++var1) { + for(int var2 = 0; var2 < this.fxLayers[var1].size(); ++var2) { + EntityFX var3 = (EntityFX)this.fxLayers[var1].get(var2); + var3.onUpdate(); + if(var3.isDead) { + this.fxLayers[var1].remove(var2--); + } + } + } + + } + + public void renderParticles(Entity var1, float var2) { + float var3 = MathHelper.cos(var1.rotationYaw * (float)Math.PI / 180.0F); + float var4 = MathHelper.sin(var1.rotationYaw * (float)Math.PI / 180.0F); + float var5 = -var4 * MathHelper.sin(var1.rotationPitch * (float)Math.PI / 180.0F); + float var6 = var3 * MathHelper.sin(var1.rotationPitch * (float)Math.PI / 180.0F); + float var7 = MathHelper.cos(var1.rotationPitch * (float)Math.PI / 180.0F); + EntityFX.interpPosX = var1.lastTickPosX + (var1.posX - var1.lastTickPosX) * (double)var2; + EntityFX.interpPosY = var1.lastTickPosY + (var1.posY - var1.lastTickPosY) * (double)var2; + EntityFX.interpPosZ = var1.lastTickPosZ + (var1.posZ - var1.lastTickPosZ) * (double)var2; + + for(int var8 = 0; var8 < 3; ++var8) { + if(this.fxLayers[var8].size() != 0) { + int var9 = 0; + if(var8 == 0) { + var9 = this.renderer.getTexture("/particles.png"); + } + + if(var8 == 1) { + var9 = this.renderer.getTexture("/terrain.png"); + } + + if(var8 == 2) { + var9 = this.renderer.getTexture("/gui/items.png"); + } + + GL11.glBindTexture(GL11.GL_TEXTURE_2D, var9); + Tessellator var10 = Tessellator.instance; + var10.startDrawingQuads(); + + for(int var11 = 0; var11 < this.fxLayers[var8].size(); ++var11) { + EntityFX var12 = (EntityFX)this.fxLayers[var8].get(var11); + var12.renderParticle(var10, var2, var3, var7, var4, var5, var6); + } + + var10.draw(); + } + } + + } + + public void func_1187_b(Entity var1, float var2) { + byte var3 = 3; + if(this.fxLayers[var3].size() != 0) { + Tessellator var4 = Tessellator.instance; + + for(int var5 = 0; var5 < this.fxLayers[var3].size(); ++var5) { + EntityFX var6 = (EntityFX)this.fxLayers[var3].get(var5); + var6.renderParticle(var4, var2, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F); + } + + } + } + + public void clearEffects(World var1) { + this.worldObj = var1; + + for(int var2 = 0; var2 < 4; ++var2) { + this.fxLayers[var2].clear(); + } + + } + + public void addBlockDestroyEffects(int var1, int var2, int var3, int var4, int var5) { + if(var4 != 0) { + Block var6 = Block.blocksList[var4]; + byte var7 = 4; + + for(int var8 = 0; var8 < var7; ++var8) { + for(int var9 = 0; var9 < var7; ++var9) { + for(int var10 = 0; var10 < var7; ++var10) { + double var11 = (double)var1 + ((double)var8 + 0.5D) / (double)var7; + double var13 = (double)var2 + ((double)var9 + 0.5D) / (double)var7; + double var15 = (double)var3 + ((double)var10 + 0.5D) / (double)var7; + int var17 = this.rand.nextInt(6); + this.addEffect((new EntityDiggingFX(this.worldObj, var11, var13, var15, var11 - (double)var1 - 0.5D, var13 - (double)var2 - 0.5D, var15 - (double)var3 - 0.5D, var6, var17, var5)).func_4041_a(var1, var2, var3)); + } + } + } + + } + } + + public void addBlockHitEffects(int var1, int var2, int var3, int var4) { + int var5 = this.worldObj.getBlockId(var1, var2, var3); + if(var5 != 0) { + Block var6 = Block.blocksList[var5]; + float var7 = 0.1F; + double var8 = (double)var1 + this.rand.nextDouble() * (var6.maxX - var6.minX - (double)(var7 * 2.0F)) + (double)var7 + var6.minX; + double var10 = (double)var2 + this.rand.nextDouble() * (var6.maxY - var6.minY - (double)(var7 * 2.0F)) + (double)var7 + var6.minY; + double var12 = (double)var3 + this.rand.nextDouble() * (var6.maxZ - var6.minZ - (double)(var7 * 2.0F)) + (double)var7 + var6.minZ; + if(var4 == 0) { + var10 = (double)var2 + var6.minY - (double)var7; + } + + if(var4 == 1) { + var10 = (double)var2 + var6.maxY + (double)var7; + } + + if(var4 == 2) { + var12 = (double)var3 + var6.minZ - (double)var7; + } + + if(var4 == 3) { + var12 = (double)var3 + var6.maxZ + (double)var7; + } + + if(var4 == 4) { + var8 = (double)var1 + var6.minX - (double)var7; + } + + if(var4 == 5) { + var8 = (double)var1 + var6.maxX + (double)var7; + } + + this.addEffect((new EntityDiggingFX(this.worldObj, var8, var10, var12, 0.0D, 0.0D, 0.0D, var6, var4, this.worldObj.getBlockMetadata(var1, var2, var3))).func_4041_a(var1, var2, var3).func_407_b(0.2F).func_405_d(0.6F)); + } + } + + public String getStatistics() { + return "" + (this.fxLayers[0].size() + this.fxLayers[1].size() + this.fxLayers[2].size()); + } +} diff --git a/src/net/minecraft/src/Empty1.java b/src/net/minecraft/src/Empty1.java new file mode 100644 index 0000000..eed65b2 --- /dev/null +++ b/src/net/minecraft/src/Empty1.java @@ -0,0 +1,4 @@ +package net.minecraft.src; + +class Empty1 { +} diff --git a/src/net/minecraft/src/Empty2.java b/src/net/minecraft/src/Empty2.java new file mode 100644 index 0000000..7b2fe1a --- /dev/null +++ b/src/net/minecraft/src/Empty2.java @@ -0,0 +1,4 @@ +package net.minecraft.src; + +class Empty2 { +} diff --git a/src/net/minecraft/src/EmptyChunk.java b/src/net/minecraft/src/EmptyChunk.java new file mode 100644 index 0000000..ff543bf --- /dev/null +++ b/src/net/minecraft/src/EmptyChunk.java @@ -0,0 +1,127 @@ +package net.minecraft.src; + +import java.util.List; +import java.util.Random; + +public class EmptyChunk extends Chunk { + public EmptyChunk(World var1, int var2, int var3) { + super(var1, var2, var3); + this.neverSave = true; + } + + public EmptyChunk(World var1, byte[] var2, int var3, int var4) { + super(var1, var2, var3, var4); + this.neverSave = true; + } + + public boolean isAtLocation(int var1, int var2) { + return var1 == this.xPosition && var2 == this.zPosition; + } + + public int getHeightValue(int var1, int var2) { + return 0; + } + + public void func_1014_a() { + } + + public void generateHeightMap() { + } + + public void func_1024_c() { + } + + public void func_4143_d() { + } + + public int getBlockID(int var1, int var2, int var3) { + return 0; + } + + public boolean setBlockIDWithMetadata(int var1, int var2, int var3, int var4, int var5) { + return true; + } + + public boolean setBlockID(int var1, int var2, int var3, int var4) { + return true; + } + + public int getBlockMetadata(int var1, int var2, int var3) { + return 0; + } + + public void setBlockMetadata(int var1, int var2, int var3, int var4) { + } + + public int getSavedLightValue(EnumSkyBlock var1, int var2, int var3, int var4) { + return 0; + } + + public void setLightValue(EnumSkyBlock var1, int var2, int var3, int var4, int var5) { + } + + public int getBlockLightValue(int var1, int var2, int var3, int var4) { + return 0; + } + + public void addEntity(Entity var1) { + } + + public void removeEntity(Entity var1) { + } + + public void removeEntityAtIndex(Entity var1, int var2) { + } + + public boolean canBlockSeeTheSky(int var1, int var2, int var3) { + return false; + } + + public TileEntity getChunkBlockTileEntity(int var1, int var2, int var3) { + return null; + } + + public void addTileEntity(TileEntity var1) { + } + + public void setChunkBlockTileEntity(int var1, int var2, int var3, TileEntity var4) { + } + + public void removeChunkBlockTileEntity(int var1, int var2, int var3) { + } + + public void onChunkLoad() { + } + + public void onChunkUnload() { + } + + public void setChunkModified() { + } + + public void getEntitiesWithinAABBForEntity(Entity var1, AxisAlignedBB var2, List var3) { + } + + public void getEntitiesOfTypeWithinAAAB(Class var1, AxisAlignedBB var2, List var3) { + } + + public boolean needsSaving(boolean var1) { + return false; + } + + public int setChunkData(byte[] var1, int var2, int var3, int var4, int var5, int var6, int var7, int var8) { + int var9 = var5 - var2; + int var10 = var6 - var3; + int var11 = var7 - var4; + int var12 = var9 * var10 * var11; + return var12 + var12 / 2 * 3; + } + + public Random func_997_a(long var1) { + return new Random(this.worldObj.getRandomSeed() + (long)(this.xPosition * this.xPosition * 4987142) + (long)(this.xPosition * 5947611) + (long)(this.zPosition * this.zPosition) * 4392871L + (long)(this.zPosition * 389711) ^ var1); + } + + public boolean func_21167_h() { + return true; + } +} diff --git a/src/net/minecraft/src/Entity.java b/src/net/minecraft/src/Entity.java new file mode 100644 index 0000000..4754492 --- /dev/null +++ b/src/net/minecraft/src/Entity.java @@ -0,0 +1,1130 @@ +package net.minecraft.src; + +import java.util.List; +import java.util.Random; + +public abstract class Entity { + private static int nextEntityID = 0; + public int entityId = nextEntityID++; + public double renderDistanceWeight = 1.0D; + public boolean preventEntitySpawning = false; + public Entity riddenByEntity; + public Entity ridingEntity; + public World worldObj; + public double prevPosX; + public double prevPosY; + public double prevPosZ; + public double posX; + public double posY; + public double posZ; + public double motionX; + public double motionY; + public double motionZ; + public float rotationYaw; + public float rotationPitch; + public float prevRotationYaw; + public float prevRotationPitch; + public final AxisAlignedBB boundingBox = AxisAlignedBB.getBoundingBox(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D); + public boolean onGround = false; + public boolean isCollidedHorizontally; + public boolean isCollidedVertically; + public boolean isCollided = false; + public boolean beenAttacked = false; + public boolean isInWeb; + public boolean field_9293_aM = true; + public boolean isDead = false; + public float yOffset = 0.0F; + public float width = 0.6F; + public float height = 1.8F; + public float prevDistanceWalkedModified = 0.0F; + public float distanceWalkedModified = 0.0F; + protected float fallDistance = 0.0F; + private int nextStepDistance = 1; + public double lastTickPosX; + public double lastTickPosY; + public double lastTickPosZ; + public float ySize = 0.0F; + public float stepHeight = 0.0F; + public boolean noClip = false; + public float entityCollisionReduction = 0.0F; + protected Random rand = new Random(); + public int ticksExisted = 0; + public int fireResistance = 1; + public int fire = 0; + protected int maxAir = 300; + protected boolean inWater = false; + public int heartsLife = 0; + public int air = 300; + private boolean isFirstUpdate = true; + public String skinUrl; + public String cloakUrl; + protected boolean isImmuneToFire = false; + protected DataWatcher dataWatcher = new DataWatcher(); + public float entityBrightness = 0.0F; + private double entityRiderPitchDelta; + private double entityRiderYawDelta; + public boolean addedToChunk = false; + public int chunkCoordX; + public int chunkCoordY; + public int chunkCoordZ; + public int serverPosX; + public int serverPosY; + public int serverPosZ; + public boolean ignoreFrustumCheck; + + public Entity(World var1) { + this.worldObj = var1; + this.setPosition(0.0D, 0.0D, 0.0D); + this.dataWatcher.addObject(0, Byte.valueOf((byte)0)); + this.entityInit(); + } + + protected abstract void entityInit(); + + public DataWatcher getDataWatcher() { + return this.dataWatcher; + } + + public boolean equals(Object var1) { + return var1 instanceof Entity ? ((Entity)var1).entityId == this.entityId : false; + } + + public int hashCode() { + return this.entityId; + } + + protected void preparePlayerToSpawn() { + if(this.worldObj != null) { + while(this.posY > 0.0D) { + this.setPosition(this.posX, this.posY, this.posZ); + if(this.worldObj.getCollidingBoundingBoxes(this, this.boundingBox).size() == 0) { + break; + } + + ++this.posY; + } + + this.motionX = this.motionY = this.motionZ = 0.0D; + this.rotationPitch = 0.0F; + } + } + + public void setEntityDead() { + this.isDead = true; + } + + protected void setSize(float var1, float var2) { + this.width = var1; + this.height = var2; + } + + protected void setRotation(float var1, float var2) { + this.rotationYaw = var1 % 360.0F; + this.rotationPitch = var2 % 360.0F; + } + + public void setPosition(double var1, double var3, double var5) { + this.posX = var1; + this.posY = var3; + this.posZ = var5; + float var7 = this.width / 2.0F; + float var8 = this.height; + this.boundingBox.setBounds(var1 - (double)var7, var3 - (double)this.yOffset + (double)this.ySize, var5 - (double)var7, var1 + (double)var7, var3 - (double)this.yOffset + (double)this.ySize + (double)var8, var5 + (double)var7); + } + + public void func_346_d(float var1, float var2) { + float var3 = this.rotationPitch; + float var4 = this.rotationYaw; + this.rotationYaw = (float)((double)this.rotationYaw + (double)var1 * 0.15D); + this.rotationPitch = (float)((double)this.rotationPitch - (double)var2 * 0.15D); + if(this.rotationPitch < -90.0F) { + this.rotationPitch = -90.0F; + } + + if(this.rotationPitch > 90.0F) { + this.rotationPitch = 90.0F; + } + + this.prevRotationPitch += this.rotationPitch - var3; + this.prevRotationYaw += this.rotationYaw - var4; + } + + public void onUpdate() { + this.onEntityUpdate(); + } + + public void onEntityUpdate() { + if(this.ridingEntity != null && this.ridingEntity.isDead) { + this.ridingEntity = null; + } + + ++this.ticksExisted; + this.prevDistanceWalkedModified = this.distanceWalkedModified; + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + this.prevRotationPitch = this.rotationPitch; + this.prevRotationYaw = this.rotationYaw; + if(this.handleWaterMovement()) { + if(!this.inWater && !this.isFirstUpdate) { + float var1 = MathHelper.sqrt_double(this.motionX * this.motionX * (double)0.2F + this.motionY * this.motionY + this.motionZ * this.motionZ * (double)0.2F) * 0.2F; + if(var1 > 1.0F) { + var1 = 1.0F; + } + + this.worldObj.playSoundAtEntity(this, "random.splash", var1, 1.0F + (this.rand.nextFloat() - this.rand.nextFloat()) * 0.4F); + float var2 = (float)MathHelper.floor_double(this.boundingBox.minY); + + int var3; + float var4; + float var5; + for(var3 = 0; (float)var3 < 1.0F + this.width * 20.0F; ++var3) { + var4 = (this.rand.nextFloat() * 2.0F - 1.0F) * this.width; + var5 = (this.rand.nextFloat() * 2.0F - 1.0F) * this.width; + this.worldObj.spawnParticle("bubble", this.posX + (double)var4, (double)(var2 + 1.0F), this.posZ + (double)var5, this.motionX, this.motionY - (double)(this.rand.nextFloat() * 0.2F), this.motionZ); + } + + for(var3 = 0; (float)var3 < 1.0F + this.width * 20.0F; ++var3) { + var4 = (this.rand.nextFloat() * 2.0F - 1.0F) * this.width; + var5 = (this.rand.nextFloat() * 2.0F - 1.0F) * this.width; + this.worldObj.spawnParticle("splash", this.posX + (double)var4, (double)(var2 + 1.0F), this.posZ + (double)var5, this.motionX, this.motionY, this.motionZ); + } + } + + this.fallDistance = 0.0F; + this.inWater = true; + this.fire = 0; + } else { + this.inWater = false; + } + + if(this.worldObj.multiplayerWorld) { + this.fire = 0; + } else if(this.fire > 0) { + if(this.isImmuneToFire) { + this.fire -= 4; + if(this.fire < 0) { + this.fire = 0; + } + } else { + if(this.fire % 20 == 0) { + this.attackEntityFrom((Entity)null, 1); + } + + --this.fire; + } + } + + if(this.handleLavaMovement()) { + this.setOnFireFromLava(); + } + + if(this.posY < -64.0D) { + this.kill(); + } + + if(!this.worldObj.multiplayerWorld) { + this.setEntityFlag(0, this.fire > 0); + this.setEntityFlag(2, this.ridingEntity != null); + } + + this.isFirstUpdate = false; + } + + protected void setOnFireFromLava() { + if(!this.isImmuneToFire) { + this.attackEntityFrom((Entity)null, 4); + this.fire = 600; + } + + } + + protected void kill() { + this.setEntityDead(); + } + + public boolean isOffsetPositionInLiquid(double var1, double var3, double var5) { + AxisAlignedBB var7 = this.boundingBox.getOffsetBoundingBox(var1, var3, var5); + List var8 = this.worldObj.getCollidingBoundingBoxes(this, var7); + return var8.size() > 0 ? false : !this.worldObj.getIsAnyLiquid(var7); + } + + public void moveEntity(double var1, double var3, double var5) { + if(this.noClip) { + this.boundingBox.offset(var1, var3, var5); + this.posX = (this.boundingBox.minX + this.boundingBox.maxX) / 2.0D; + this.posY = this.boundingBox.minY + (double)this.yOffset - (double)this.ySize; + this.posZ = (this.boundingBox.minZ + this.boundingBox.maxZ) / 2.0D; + } else { + this.ySize *= 0.4F; + double var7 = this.posX; + double var9 = this.posZ; + if(this.isInWeb) { + this.isInWeb = false; + var1 *= 0.25D; + var3 *= (double)0.05F; + var5 *= 0.25D; + this.motionX = 0.0D; + this.motionY = 0.0D; + this.motionZ = 0.0D; + } + + double var11 = var1; + double var13 = var3; + double var15 = var5; + AxisAlignedBB var17 = this.boundingBox.copy(); + boolean var18 = this.onGround && this.isSneaking(); + if(var18) { + double var19; + for(var19 = 0.05D; var1 != 0.0D && this.worldObj.getCollidingBoundingBoxes(this, this.boundingBox.getOffsetBoundingBox(var1, -1.0D, 0.0D)).size() == 0; var11 = var1) { + if(var1 < var19 && var1 >= -var19) { + var1 = 0.0D; + } else if(var1 > 0.0D) { + var1 -= var19; + } else { + var1 += var19; + } + } + + for(; var5 != 0.0D && this.worldObj.getCollidingBoundingBoxes(this, this.boundingBox.getOffsetBoundingBox(0.0D, -1.0D, var5)).size() == 0; var15 = var5) { + if(var5 < var19 && var5 >= -var19) { + var5 = 0.0D; + } else if(var5 > 0.0D) { + var5 -= var19; + } else { + var5 += var19; + } + } + } + + List var35 = this.worldObj.getCollidingBoundingBoxes(this, this.boundingBox.addCoord(var1, var3, var5)); + + for(int var20 = 0; var20 < var35.size(); ++var20) { + var3 = ((AxisAlignedBB)var35.get(var20)).calculateYOffset(this.boundingBox, var3); + } + + this.boundingBox.offset(0.0D, var3, 0.0D); + if(!this.field_9293_aM && var13 != var3) { + var5 = 0.0D; + var3 = var5; + var1 = var5; + } + + boolean var36 = this.onGround || var13 != var3 && var13 < 0.0D; + + int var21; + for(var21 = 0; var21 < var35.size(); ++var21) { + var1 = ((AxisAlignedBB)var35.get(var21)).calculateXOffset(this.boundingBox, var1); + } + + this.boundingBox.offset(var1, 0.0D, 0.0D); + if(!this.field_9293_aM && var11 != var1) { + var5 = 0.0D; + var3 = var5; + var1 = var5; + } + + for(var21 = 0; var21 < var35.size(); ++var21) { + var5 = ((AxisAlignedBB)var35.get(var21)).calculateZOffset(this.boundingBox, var5); + } + + this.boundingBox.offset(0.0D, 0.0D, var5); + if(!this.field_9293_aM && var15 != var5) { + var5 = 0.0D; + var3 = var5; + var1 = var5; + } + + double var23; + int var28; + double var37; + if(this.stepHeight > 0.0F && var36 && (var18 || this.ySize < 0.05F) && (var11 != var1 || var15 != var5)) { + var37 = var1; + var23 = var3; + double var25 = var5; + var1 = var11; + var3 = (double)this.stepHeight; + var5 = var15; + AxisAlignedBB var27 = this.boundingBox.copy(); + this.boundingBox.setBB(var17); + var35 = this.worldObj.getCollidingBoundingBoxes(this, this.boundingBox.addCoord(var11, var3, var15)); + + for(var28 = 0; var28 < var35.size(); ++var28) { + var3 = ((AxisAlignedBB)var35.get(var28)).calculateYOffset(this.boundingBox, var3); + } + + this.boundingBox.offset(0.0D, var3, 0.0D); + if(!this.field_9293_aM && var13 != var3) { + var5 = 0.0D; + var3 = var5; + var1 = var5; + } + + for(var28 = 0; var28 < var35.size(); ++var28) { + var1 = ((AxisAlignedBB)var35.get(var28)).calculateXOffset(this.boundingBox, var1); + } + + this.boundingBox.offset(var1, 0.0D, 0.0D); + if(!this.field_9293_aM && var11 != var1) { + var5 = 0.0D; + var3 = var5; + var1 = var5; + } + + for(var28 = 0; var28 < var35.size(); ++var28) { + var5 = ((AxisAlignedBB)var35.get(var28)).calculateZOffset(this.boundingBox, var5); + } + + this.boundingBox.offset(0.0D, 0.0D, var5); + if(!this.field_9293_aM && var15 != var5) { + var5 = 0.0D; + var3 = var5; + var1 = var5; + } + + if(!this.field_9293_aM && var13 != var3) { + var5 = 0.0D; + var3 = var5; + var1 = var5; + } else { + var3 = (double)(-this.stepHeight); + + for(var28 = 0; var28 < var35.size(); ++var28) { + var3 = ((AxisAlignedBB)var35.get(var28)).calculateYOffset(this.boundingBox, var3); + } + + this.boundingBox.offset(0.0D, var3, 0.0D); + } + + if(var37 * var37 + var25 * var25 >= var1 * var1 + var5 * var5) { + var1 = var37; + var3 = var23; + var5 = var25; + this.boundingBox.setBB(var27); + } else { + double var41 = this.boundingBox.minY - (double)((int)this.boundingBox.minY); + if(var41 > 0.0D) { + this.ySize = (float)((double)this.ySize + var41 + 0.01D); + } + } + } + + this.posX = (this.boundingBox.minX + this.boundingBox.maxX) / 2.0D; + this.posY = this.boundingBox.minY + (double)this.yOffset - (double)this.ySize; + this.posZ = (this.boundingBox.minZ + this.boundingBox.maxZ) / 2.0D; + this.isCollidedHorizontally = var11 != var1 || var15 != var5; + this.isCollidedVertically = var13 != var3; + this.onGround = var13 != var3 && var13 < 0.0D; + this.isCollided = this.isCollidedHorizontally || this.isCollidedVertically; + this.updateFallState(var3, this.onGround); + if(var11 != var1) { + this.motionX = 0.0D; + } + + if(var13 != var3) { + this.motionY = 0.0D; + } + + if(var15 != var5) { + this.motionZ = 0.0D; + } + + var37 = this.posX - var7; + var23 = this.posZ - var9; + int var26; + int var38; + int var39; + if(this.canTriggerWalking() && !var18 && this.ridingEntity == null) { + this.distanceWalkedModified = (float)((double)this.distanceWalkedModified + (double)MathHelper.sqrt_double(var37 * var37 + var23 * var23) * 0.6D); + var38 = MathHelper.floor_double(this.posX); + var26 = MathHelper.floor_double(this.posY - (double)0.2F - (double)this.yOffset); + var39 = MathHelper.floor_double(this.posZ); + var28 = this.worldObj.getBlockId(var38, var26, var39); + if(this.worldObj.getBlockId(var38, var26 - 1, var39) == Block.fence.blockID) { + var28 = this.worldObj.getBlockId(var38, var26 - 1, var39); + } + + if(this.distanceWalkedModified > (float)this.nextStepDistance && var28 > 0) { + ++this.nextStepDistance; + StepSound var29 = Block.blocksList[var28].stepSound; + if(this.worldObj.getBlockId(var38, var26 + 1, var39) == Block.snow.blockID) { + var29 = Block.snow.stepSound; + this.worldObj.playSoundAtEntity(this, var29.func_1145_d(), var29.getVolume() * 0.15F, var29.getPitch()); + } else if(!Block.blocksList[var28].blockMaterial.getIsLiquid()) { + this.worldObj.playSoundAtEntity(this, var29.func_1145_d(), var29.getVolume() * 0.15F, var29.getPitch()); + } + + Block.blocksList[var28].onEntityWalking(this.worldObj, var38, var26, var39, this); + } + } + + var38 = MathHelper.floor_double(this.boundingBox.minX + 0.001D); + var26 = MathHelper.floor_double(this.boundingBox.minY + 0.001D); + var39 = MathHelper.floor_double(this.boundingBox.minZ + 0.001D); + var28 = MathHelper.floor_double(this.boundingBox.maxX - 0.001D); + int var40 = MathHelper.floor_double(this.boundingBox.maxY - 0.001D); + int var30 = MathHelper.floor_double(this.boundingBox.maxZ - 0.001D); + if(this.worldObj.checkChunksExist(var38, var26, var39, var28, var40, var30)) { + for(int var31 = var38; var31 <= var28; ++var31) { + for(int var32 = var26; var32 <= var40; ++var32) { + for(int var33 = var39; var33 <= var30; ++var33) { + int var34 = this.worldObj.getBlockId(var31, var32, var33); + if(var34 > 0) { + Block.blocksList[var34].onEntityCollidedWithBlock(this.worldObj, var31, var32, var33, this); + } + } + } + } + } + + boolean var42 = this.isWet(); + if(this.worldObj.isBoundingBoxBurning(this.boundingBox.func_28195_e(0.001D, 0.001D, 0.001D))) { + this.dealFireDamage(1); + if(!var42) { + ++this.fire; + if(this.fire == 0) { + this.fire = 300; + } + } + } else if(this.fire <= 0) { + this.fire = -this.fireResistance; + } + + if(var42 && this.fire > 0) { + this.worldObj.playSoundAtEntity(this, "random.fizz", 0.7F, 1.6F + (this.rand.nextFloat() - this.rand.nextFloat()) * 0.4F); + this.fire = -this.fireResistance; + } + + } + } + + protected boolean canTriggerWalking() { + return true; + } + + protected void updateFallState(double var1, boolean var3) { + if(var3) { + if(this.fallDistance > 0.0F) { + this.fall(this.fallDistance); + this.fallDistance = 0.0F; + } + } else if(var1 < 0.0D) { + this.fallDistance = (float)((double)this.fallDistance - var1); + } + + } + + public AxisAlignedBB getBoundingBox() { + return null; + } + + protected void dealFireDamage(int var1) { + if(!this.isImmuneToFire) { + this.attackEntityFrom((Entity)null, var1); + } + + } + + protected void fall(float var1) { + if(this.riddenByEntity != null) { + this.riddenByEntity.fall(var1); + } + + } + + public boolean isWet() { + return this.inWater || this.worldObj.canBlockBeRainedOn(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ)); + } + + public boolean isInWater() { + return this.inWater; + } + + public boolean handleWaterMovement() { + return this.worldObj.handleMaterialAcceleration(this.boundingBox.expand(0.0D, (double)-0.4F, 0.0D).func_28195_e(0.001D, 0.001D, 0.001D), Material.water, this); + } + + public boolean isInsideOfMaterial(Material var1) { + double var2 = this.posY + (double)this.getEyeHeight(); + int var4 = MathHelper.floor_double(this.posX); + int var5 = MathHelper.floor_float((float)MathHelper.floor_double(var2)); + int var6 = MathHelper.floor_double(this.posZ); + int var7 = this.worldObj.getBlockId(var4, var5, var6); + if(var7 != 0 && Block.blocksList[var7].blockMaterial == var1) { + float var8 = BlockFluid.getPercentAir(this.worldObj.getBlockMetadata(var4, var5, var6)) - 1.0F / 9.0F; + float var9 = (float)(var5 + 1) - var8; + return var2 < (double)var9; + } else { + return false; + } + } + + public float getEyeHeight() { + return 0.0F; + } + + public boolean handleLavaMovement() { + return this.worldObj.isMaterialInBB(this.boundingBox.expand((double)-0.1F, (double)-0.4F, (double)-0.1F), Material.lava); + } + + public void moveFlying(float var1, float var2, float var3) { + float var4 = MathHelper.sqrt_float(var1 * var1 + var2 * var2); + if(var4 >= 0.01F) { + if(var4 < 1.0F) { + var4 = 1.0F; + } + + var4 = var3 / var4; + var1 *= var4; + var2 *= var4; + float var5 = MathHelper.sin(this.rotationYaw * (float)Math.PI / 180.0F); + float var6 = MathHelper.cos(this.rotationYaw * (float)Math.PI / 180.0F); + this.motionX += (double)(var1 * var6 - var2 * var5); + this.motionZ += (double)(var2 * var6 + var1 * var5); + } + } + + public float getEntityBrightness(float var1) { + int var2 = MathHelper.floor_double(this.posX); + double var3 = (this.boundingBox.maxY - this.boundingBox.minY) * 0.66D; + int var5 = MathHelper.floor_double(this.posY - (double)this.yOffset + var3); + int var6 = MathHelper.floor_double(this.posZ); + if(this.worldObj.checkChunksExist(MathHelper.floor_double(this.boundingBox.minX), MathHelper.floor_double(this.boundingBox.minY), MathHelper.floor_double(this.boundingBox.minZ), MathHelper.floor_double(this.boundingBox.maxX), MathHelper.floor_double(this.boundingBox.maxY), MathHelper.floor_double(this.boundingBox.maxZ))) { + float var7 = this.worldObj.getLightBrightness(var2, var5, var6); + if(var7 < this.entityBrightness) { + var7 = this.entityBrightness; + } + + return var7; + } else { + return this.entityBrightness; + } + } + + public void setWorld(World var1) { + this.worldObj = var1; + } + + public void setPositionAndRotation(double var1, double var3, double var5, float var7, float var8) { + this.prevPosX = this.posX = var1; + this.prevPosY = this.posY = var3; + this.prevPosZ = this.posZ = var5; + this.prevRotationYaw = this.rotationYaw = var7; + this.prevRotationPitch = this.rotationPitch = var8; + this.ySize = 0.0F; + double var9 = (double)(this.prevRotationYaw - var7); + if(var9 < -180.0D) { + this.prevRotationYaw += 360.0F; + } + + if(var9 >= 180.0D) { + this.prevRotationYaw -= 360.0F; + } + + this.setPosition(this.posX, this.posY, this.posZ); + this.setRotation(var7, var8); + } + + public void setLocationAndAngles(double var1, double var3, double var5, float var7, float var8) { + this.lastTickPosX = this.prevPosX = this.posX = var1; + this.lastTickPosY = this.prevPosY = this.posY = var3 + (double)this.yOffset; + this.lastTickPosZ = this.prevPosZ = this.posZ = var5; + this.rotationYaw = var7; + this.rotationPitch = var8; + this.setPosition(this.posX, this.posY, this.posZ); + } + + public float getDistanceToEntity(Entity var1) { + float var2 = (float)(this.posX - var1.posX); + float var3 = (float)(this.posY - var1.posY); + float var4 = (float)(this.posZ - var1.posZ); + return MathHelper.sqrt_float(var2 * var2 + var3 * var3 + var4 * var4); + } + + public double getDistanceSq(double var1, double var3, double var5) { + double var7 = this.posX - var1; + double var9 = this.posY - var3; + double var11 = this.posZ - var5; + return var7 * var7 + var9 * var9 + var11 * var11; + } + + public double getDistance(double var1, double var3, double var5) { + double var7 = this.posX - var1; + double var9 = this.posY - var3; + double var11 = this.posZ - var5; + return (double)MathHelper.sqrt_double(var7 * var7 + var9 * var9 + var11 * var11); + } + + public double getDistanceSqToEntity(Entity var1) { + double var2 = this.posX - var1.posX; + double var4 = this.posY - var1.posY; + double var6 = this.posZ - var1.posZ; + return var2 * var2 + var4 * var4 + var6 * var6; + } + + public void onCollideWithPlayer(EntityPlayer var1) { + } + + public void applyEntityCollision(Entity var1) { + if(var1.riddenByEntity != this && var1.ridingEntity != this) { + double var2 = var1.posX - this.posX; + double var4 = var1.posZ - this.posZ; + double var6 = MathHelper.abs_max(var2, var4); + if(var6 >= (double)0.01F) { + var6 = (double)MathHelper.sqrt_double(var6); + var2 /= var6; + var4 /= var6; + double var8 = 1.0D / var6; + if(var8 > 1.0D) { + var8 = 1.0D; + } + + var2 *= var8; + var4 *= var8; + var2 *= (double)0.05F; + var4 *= (double)0.05F; + var2 *= (double)(1.0F - this.entityCollisionReduction); + var4 *= (double)(1.0F - this.entityCollisionReduction); + this.addVelocity(-var2, 0.0D, -var4); + var1.addVelocity(var2, 0.0D, var4); + } + + } + } + + public void addVelocity(double var1, double var3, double var5) { + this.motionX += var1; + this.motionY += var3; + this.motionZ += var5; + } + + protected void setBeenAttacked() { + this.beenAttacked = true; + } + + public boolean attackEntityFrom(Entity var1, int var2) { + this.setBeenAttacked(); + return false; + } + + public boolean canBeCollidedWith() { + return false; + } + + public boolean canBePushed() { + return false; + } + + public void addToPlayerScore(Entity var1, int var2) { + } + + public boolean isInRangeToRenderVec3D(Vec3D var1) { + double var2 = this.posX - var1.xCoord; + double var4 = this.posY - var1.yCoord; + double var6 = this.posZ - var1.zCoord; + double var8 = var2 * var2 + var4 * var4 + var6 * var6; + return this.isInRangeToRenderDist(var8); + } + + public boolean isInRangeToRenderDist(double var1) { + double var3 = this.boundingBox.getAverageEdgeLength(); + var3 *= 64.0D * this.renderDistanceWeight; + return var1 < var3 * var3; + } + + public String getEntityTexture() { + return null; + } + + public boolean addEntityID(NBTTagCompound var1) { + String var2 = this.getEntityString(); + if(!this.isDead && var2 != null) { + var1.setString("id", var2); + this.writeToNBT(var1); + return true; + } else { + return false; + } + } + + public void writeToNBT(NBTTagCompound var1) { + var1.setTag("Pos", this.newDoubleNBTList(new double[]{this.posX, this.posY + (double)this.ySize, this.posZ})); + var1.setTag("Motion", this.newDoubleNBTList(new double[]{this.motionX, this.motionY, this.motionZ})); + var1.setTag("Rotation", this.newFloatNBTList(new float[]{this.rotationYaw, this.rotationPitch})); + var1.setFloat("FallDistance", this.fallDistance); + var1.setShort("Fire", (short)this.fire); + var1.setShort("Air", (short)this.air); + var1.setBoolean("OnGround", this.onGround); + this.writeEntityToNBT(var1); + } + + public void readFromNBT(NBTTagCompound var1) { + NBTTagList var2 = var1.getTagList("Pos"); + NBTTagList var3 = var1.getTagList("Motion"); + NBTTagList var4 = var1.getTagList("Rotation"); + this.motionX = ((NBTTagDouble)var3.tagAt(0)).doubleValue; + this.motionY = ((NBTTagDouble)var3.tagAt(1)).doubleValue; + this.motionZ = ((NBTTagDouble)var3.tagAt(2)).doubleValue; + if(Math.abs(this.motionX) > 10.0D) { + this.motionX = 0.0D; + } + + if(Math.abs(this.motionY) > 10.0D) { + this.motionY = 0.0D; + } + + if(Math.abs(this.motionZ) > 10.0D) { + this.motionZ = 0.0D; + } + + this.prevPosX = this.lastTickPosX = this.posX = ((NBTTagDouble)var2.tagAt(0)).doubleValue; + this.prevPosY = this.lastTickPosY = this.posY = ((NBTTagDouble)var2.tagAt(1)).doubleValue; + this.prevPosZ = this.lastTickPosZ = this.posZ = ((NBTTagDouble)var2.tagAt(2)).doubleValue; + this.prevRotationYaw = this.rotationYaw = ((NBTTagFloat)var4.tagAt(0)).floatValue; + this.prevRotationPitch = this.rotationPitch = ((NBTTagFloat)var4.tagAt(1)).floatValue; + this.fallDistance = var1.getFloat("FallDistance"); + this.fire = var1.getShort("Fire"); + this.air = var1.getShort("Air"); + this.onGround = var1.getBoolean("OnGround"); + this.setPosition(this.posX, this.posY, this.posZ); + this.setRotation(this.rotationYaw, this.rotationPitch); + this.readEntityFromNBT(var1); + } + + protected final String getEntityString() { + return EntityList.getEntityString(this); + } + + protected abstract void readEntityFromNBT(NBTTagCompound var1); + + protected abstract void writeEntityToNBT(NBTTagCompound var1); + + protected NBTTagList newDoubleNBTList(double... var1) { + NBTTagList var2 = new NBTTagList(); + double[] var3 = var1; + int var4 = var1.length; + + for(int var5 = 0; var5 < var4; ++var5) { + double var6 = var3[var5]; + var2.setTag(new NBTTagDouble(var6)); + } + + return var2; + } + + protected NBTTagList newFloatNBTList(float... var1) { + NBTTagList var2 = new NBTTagList(); + float[] var3 = var1; + int var4 = var1.length; + + for(int var5 = 0; var5 < var4; ++var5) { + float var6 = var3[var5]; + var2.setTag(new NBTTagFloat(var6)); + } + + return var2; + } + + public float getShadowSize() { + return this.height / 2.0F; + } + + public EntityItem dropItem(int var1, int var2) { + return this.dropItemWithOffset(var1, var2, 0.0F); + } + + public EntityItem dropItemWithOffset(int var1, int var2, float var3) { + return this.entityDropItem(new ItemStack(var1, var2, 0), var3); + } + + public EntityItem entityDropItem(ItemStack var1, float var2) { + EntityItem var3 = new EntityItem(this.worldObj, this.posX, this.posY + (double)var2, this.posZ, var1); + var3.delayBeforeCanPickup = 10; + this.worldObj.entityJoinedWorld(var3); + return var3; + } + + public boolean isEntityAlive() { + return !this.isDead; + } + + public boolean isEntityInsideOpaqueBlock() { + for(int var1 = 0; var1 < 8; ++var1) { + float var2 = ((float)((var1 >> 0) % 2) - 0.5F) * this.width * 0.9F; + float var3 = ((float)((var1 >> 1) % 2) - 0.5F) * 0.1F; + float var4 = ((float)((var1 >> 2) % 2) - 0.5F) * this.width * 0.9F; + int var5 = MathHelper.floor_double(this.posX + (double)var2); + int var6 = MathHelper.floor_double(this.posY + (double)this.getEyeHeight() + (double)var3); + int var7 = MathHelper.floor_double(this.posZ + (double)var4); + if(this.worldObj.isBlockNormalCube(var5, var6, var7)) { + return true; + } + } + + return false; + } + + public boolean interact(EntityPlayer var1) { + return false; + } + + public AxisAlignedBB getCollisionBox(Entity var1) { + return null; + } + + public void updateRidden() { + if(this.ridingEntity.isDead) { + this.ridingEntity = null; + } else { + this.motionX = 0.0D; + this.motionY = 0.0D; + this.motionZ = 0.0D; + this.onUpdate(); + if(this.ridingEntity != null) { + this.ridingEntity.updateRiderPosition(); + this.entityRiderYawDelta += (double)(this.ridingEntity.rotationYaw - this.ridingEntity.prevRotationYaw); + + for(this.entityRiderPitchDelta += (double)(this.ridingEntity.rotationPitch - this.ridingEntity.prevRotationPitch); this.entityRiderYawDelta >= 180.0D; this.entityRiderYawDelta -= 360.0D) { + } + + while(this.entityRiderYawDelta < -180.0D) { + this.entityRiderYawDelta += 360.0D; + } + + while(this.entityRiderPitchDelta >= 180.0D) { + this.entityRiderPitchDelta -= 360.0D; + } + + while(this.entityRiderPitchDelta < -180.0D) { + this.entityRiderPitchDelta += 360.0D; + } + + double var1 = this.entityRiderYawDelta * 0.5D; + double var3 = this.entityRiderPitchDelta * 0.5D; + float var5 = 10.0F; + if(var1 > (double)var5) { + var1 = (double)var5; + } + + if(var1 < (double)(-var5)) { + var1 = (double)(-var5); + } + + if(var3 > (double)var5) { + var3 = (double)var5; + } + + if(var3 < (double)(-var5)) { + var3 = (double)(-var5); + } + + this.entityRiderYawDelta -= var1; + this.entityRiderPitchDelta -= var3; + this.rotationYaw = (float)((double)this.rotationYaw + var1); + this.rotationPitch = (float)((double)this.rotationPitch + var3); + } + } + } + + public void updateRiderPosition() { + this.riddenByEntity.setPosition(this.posX, this.posY + this.getMountedYOffset() + this.riddenByEntity.getYOffset(), this.posZ); + } + + public double getYOffset() { + return (double)this.yOffset; + } + + public double getMountedYOffset() { + return (double)this.height * 0.75D; + } + + public void mountEntity(Entity var1) { + this.entityRiderPitchDelta = 0.0D; + this.entityRiderYawDelta = 0.0D; + if(var1 == null) { + if(this.ridingEntity != null) { + this.setLocationAndAngles(this.ridingEntity.posX, this.ridingEntity.boundingBox.minY + (double)this.ridingEntity.height, this.ridingEntity.posZ, this.rotationYaw, this.rotationPitch); + this.ridingEntity.riddenByEntity = null; + } + + this.ridingEntity = null; + } else if(this.ridingEntity == var1) { + this.ridingEntity.riddenByEntity = null; + this.ridingEntity = null; + this.setLocationAndAngles(var1.posX, var1.boundingBox.minY + (double)var1.height, var1.posZ, this.rotationYaw, this.rotationPitch); + } else { + if(this.ridingEntity != null) { + this.ridingEntity.riddenByEntity = null; + } + + if(var1.riddenByEntity != null) { + var1.riddenByEntity.ridingEntity = null; + } + + this.ridingEntity = var1; + var1.riddenByEntity = this; + } + } + + public void setPositionAndRotation2(double var1, double var3, double var5, float var7, float var8, int var9) { + this.setPosition(var1, var3, var5); + this.setRotation(var7, var8); + List var10 = this.worldObj.getCollidingBoundingBoxes(this, this.boundingBox.func_28195_e(1.0D / 32.0D, 0.0D, 1.0D / 32.0D)); + if(var10.size() > 0) { + double var11 = 0.0D; + + for(int var13 = 0; var13 < var10.size(); ++var13) { + AxisAlignedBB var14 = (AxisAlignedBB)var10.get(var13); + if(var14.maxY > var11) { + var11 = var14.maxY; + } + } + + var3 += var11 - this.boundingBox.minY; + this.setPosition(var1, var3, var5); + } + + } + + public float getCollisionBorderSize() { + return 0.1F; + } + + public Vec3D getLookVec() { + return null; + } + + public void setInPortal() { + } + + public void setVelocity(double var1, double var3, double var5) { + this.motionX = var1; + this.motionY = var3; + this.motionZ = var5; + } + + public void handleHealthUpdate(byte var1) { + } + + public void performHurtAnimation() { + } + + public void updateCloak() { + } + + public void outfitWithItem(int var1, int var2, int var3) { + } + + public boolean isBurning() { + return this.fire > 0 || this.getEntityFlag(0); + } + + public boolean isRiding() { + return this.ridingEntity != null || this.getEntityFlag(2); + } + + public boolean isSneaking() { + return this.getEntityFlag(1); + } + + protected boolean getEntityFlag(int var1) { + return (this.dataWatcher.getWatchableObjectByte(0) & 1 << var1) != 0; + } + + protected void setEntityFlag(int var1, boolean var2) { + byte var3 = this.dataWatcher.getWatchableObjectByte(0); + if(var2) { + this.dataWatcher.updateObject(0, Byte.valueOf((byte)(var3 | 1 << var1))); + } else { + this.dataWatcher.updateObject(0, Byte.valueOf((byte)(var3 & ~(1 << var1)))); + } + + } + + public void onStruckByLightning(EntityLightningBolt var1) { + this.dealFireDamage(5); + ++this.fire; + if(this.fire == 0) { + this.fire = 300; + } + + } + + public void onKillEntity(EntityLiving var1) { + } + + protected boolean pushOutOfBlocks(double var1, double var3, double var5) { + int var7 = MathHelper.floor_double(var1); + int var8 = MathHelper.floor_double(var3); + int var9 = MathHelper.floor_double(var5); + double var10 = var1 - (double)var7; + double var12 = var3 - (double)var8; + double var14 = var5 - (double)var9; + if(this.worldObj.isBlockNormalCube(var7, var8, var9)) { + boolean var16 = !this.worldObj.isBlockNormalCube(var7 - 1, var8, var9); + boolean var17 = !this.worldObj.isBlockNormalCube(var7 + 1, var8, var9); + boolean var18 = !this.worldObj.isBlockNormalCube(var7, var8 - 1, var9); + boolean var19 = !this.worldObj.isBlockNormalCube(var7, var8 + 1, var9); + boolean var20 = !this.worldObj.isBlockNormalCube(var7, var8, var9 - 1); + boolean var21 = !this.worldObj.isBlockNormalCube(var7, var8, var9 + 1); + byte var22 = -1; + double var23 = 9999.0D; + if(var16 && var10 < var23) { + var23 = var10; + var22 = 0; + } + + if(var17 && 1.0D - var10 < var23) { + var23 = 1.0D - var10; + var22 = 1; + } + + if(var18 && var12 < var23) { + var23 = var12; + var22 = 2; + } + + if(var19 && 1.0D - var12 < var23) { + var23 = 1.0D - var12; + var22 = 3; + } + + if(var20 && var14 < var23) { + var23 = var14; + var22 = 4; + } + + if(var21 && 1.0D - var14 < var23) { + var23 = 1.0D - var14; + var22 = 5; + } + + float var25 = this.rand.nextFloat() * 0.2F + 0.1F; + if(var22 == 0) { + this.motionX = (double)(-var25); + } + + if(var22 == 1) { + this.motionX = (double)var25; + } + + if(var22 == 2) { + this.motionY = (double)(-var25); + } + + if(var22 == 3) { + this.motionY = (double)var25; + } + + if(var22 == 4) { + this.motionZ = (double)(-var25); + } + + if(var22 == 5) { + this.motionZ = (double)var25; + } + } + + return false; + } +} diff --git a/src/net/minecraft/src/EntityAnimal.java b/src/net/minecraft/src/EntityAnimal.java new file mode 100644 index 0000000..fec1df6 --- /dev/null +++ b/src/net/minecraft/src/EntityAnimal.java @@ -0,0 +1,30 @@ +package net.minecraft.src; + +public abstract class EntityAnimal extends EntityCreature { + public EntityAnimal(World var1) { + super(var1); + } + + protected float getBlockPathWeight(int var1, int var2, int var3) { + return this.worldObj.getBlockId(var1, var2 - 1, var3) == Block.grass.blockID ? 10.0F : this.worldObj.getLightBrightness(var1, var2, var3) - 0.5F; + } + + public void writeEntityToNBT(NBTTagCompound var1) { + super.writeEntityToNBT(var1); + } + + public void readEntityFromNBT(NBTTagCompound var1) { + super.readEntityFromNBT(var1); + } + + public boolean getCanSpawnHere() { + int var1 = MathHelper.floor_double(this.posX); + int var2 = MathHelper.floor_double(this.boundingBox.minY); + int var3 = MathHelper.floor_double(this.posZ); + return this.worldObj.getBlockId(var1, var2 - 1, var3) == Block.grass.blockID && this.worldObj.getFullBlockLightValue(var1, var2, var3) > 8 && super.getCanSpawnHere(); + } + + public int getTalkInterval() { + return 120; + } +} diff --git a/src/net/minecraft/src/EntityArrow.java b/src/net/minecraft/src/EntityArrow.java new file mode 100644 index 0000000..5782adf --- /dev/null +++ b/src/net/minecraft/src/EntityArrow.java @@ -0,0 +1,271 @@ +package net.minecraft.src; + +import java.util.List; + +public class EntityArrow extends Entity { + private int xTile = -1; + private int yTile = -1; + private int zTile = -1; + private int inTile = 0; + private int field_28019_h = 0; + private boolean inGround = false; + public boolean doesArrowBelongToPlayer = false; + public int arrowShake = 0; + public EntityLiving owner; + private int ticksInGround; + private int ticksInAir = 0; + + public EntityArrow(World var1) { + super(var1); + this.setSize(0.5F, 0.5F); + } + + public EntityArrow(World var1, double var2, double var4, double var6) { + super(var1); + this.setSize(0.5F, 0.5F); + this.setPosition(var2, var4, var6); + this.yOffset = 0.0F; + } + + public EntityArrow(World var1, EntityLiving var2) { + super(var1); + this.owner = var2; + this.doesArrowBelongToPlayer = var2 instanceof EntityPlayer; + this.setSize(0.5F, 0.5F); + this.setLocationAndAngles(var2.posX, var2.posY + (double)var2.getEyeHeight(), var2.posZ, var2.rotationYaw, var2.rotationPitch); + this.posX -= (double)(MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * 0.16F); + this.posY -= (double)0.1F; + this.posZ -= (double)(MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * 0.16F); + this.setPosition(this.posX, this.posY, this.posZ); + this.yOffset = 0.0F; + this.motionX = (double)(-MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI)); + this.motionZ = (double)(MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI)); + this.motionY = (double)(-MathHelper.sin(this.rotationPitch / 180.0F * (float)Math.PI)); + this.setArrowHeading(this.motionX, this.motionY, this.motionZ, 1.5F, 1.0F); + } + + protected void entityInit() { + } + + public void setArrowHeading(double var1, double var3, double var5, float var7, float var8) { + float var9 = MathHelper.sqrt_double(var1 * var1 + var3 * var3 + var5 * var5); + var1 /= (double)var9; + var3 /= (double)var9; + var5 /= (double)var9; + var1 += this.rand.nextGaussian() * (double)0.0075F * (double)var8; + var3 += this.rand.nextGaussian() * (double)0.0075F * (double)var8; + var5 += this.rand.nextGaussian() * (double)0.0075F * (double)var8; + var1 *= (double)var7; + var3 *= (double)var7; + var5 *= (double)var7; + this.motionX = var1; + this.motionY = var3; + this.motionZ = var5; + float var10 = MathHelper.sqrt_double(var1 * var1 + var5 * var5); + this.prevRotationYaw = this.rotationYaw = (float)(Math.atan2(var1, var5) * 180.0D / (double)((float)Math.PI)); + this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(var3, (double)var10) * 180.0D / (double)((float)Math.PI)); + this.ticksInGround = 0; + } + + public void setVelocity(double var1, double var3, double var5) { + this.motionX = var1; + this.motionY = var3; + this.motionZ = var5; + if(this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F) { + float var7 = MathHelper.sqrt_double(var1 * var1 + var5 * var5); + this.prevRotationYaw = this.rotationYaw = (float)(Math.atan2(var1, var5) * 180.0D / (double)((float)Math.PI)); + this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(var3, (double)var7) * 180.0D / (double)((float)Math.PI)); + this.prevRotationPitch = this.rotationPitch; + this.prevRotationYaw = this.rotationYaw; + this.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch); + this.ticksInGround = 0; + } + + } + + public void onUpdate() { + super.onUpdate(); + if(this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F) { + float var1 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); + this.prevRotationYaw = this.rotationYaw = (float)(Math.atan2(this.motionX, this.motionZ) * 180.0D / (double)((float)Math.PI)); + this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(this.motionY, (double)var1) * 180.0D / (double)((float)Math.PI)); + } + + int var15 = this.worldObj.getBlockId(this.xTile, this.yTile, this.zTile); + if(var15 > 0) { + Block.blocksList[var15].setBlockBoundsBasedOnState(this.worldObj, this.xTile, this.yTile, this.zTile); + AxisAlignedBB var2 = Block.blocksList[var15].getCollisionBoundingBoxFromPool(this.worldObj, this.xTile, this.yTile, this.zTile); + if(var2 != null && var2.isVecInside(Vec3D.createVector(this.posX, this.posY, this.posZ))) { + this.inGround = true; + } + } + + if(this.arrowShake > 0) { + --this.arrowShake; + } + + if(this.inGround) { + var15 = this.worldObj.getBlockId(this.xTile, this.yTile, this.zTile); + int var18 = this.worldObj.getBlockMetadata(this.xTile, this.yTile, this.zTile); + if(var15 == this.inTile && var18 == this.field_28019_h) { + ++this.ticksInGround; + if(this.ticksInGround == 1200) { + this.setEntityDead(); + } + + } else { + this.inGround = false; + this.motionX *= (double)(this.rand.nextFloat() * 0.2F); + this.motionY *= (double)(this.rand.nextFloat() * 0.2F); + this.motionZ *= (double)(this.rand.nextFloat() * 0.2F); + this.ticksInGround = 0; + this.ticksInAir = 0; + } + } else { + ++this.ticksInAir; + Vec3D var16 = Vec3D.createVector(this.posX, this.posY, this.posZ); + Vec3D var17 = Vec3D.createVector(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); + MovingObjectPosition var3 = this.worldObj.func_28105_a(var16, var17, false, true); + var16 = Vec3D.createVector(this.posX, this.posY, this.posZ); + var17 = Vec3D.createVector(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); + if(var3 != null) { + var17 = Vec3D.createVector(var3.hitVec.xCoord, var3.hitVec.yCoord, var3.hitVec.zCoord); + } + + Entity var4 = null; + List var5 = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D)); + double var6 = 0.0D; + + float var10; + for(int var8 = 0; var8 < var5.size(); ++var8) { + Entity var9 = (Entity)var5.get(var8); + if(var9.canBeCollidedWith() && (var9 != this.owner || this.ticksInAir >= 5)) { + var10 = 0.3F; + AxisAlignedBB var11 = var9.boundingBox.expand((double)var10, (double)var10, (double)var10); + MovingObjectPosition var12 = var11.func_1169_a(var16, var17); + if(var12 != null) { + double var13 = var16.distanceTo(var12.hitVec); + if(var13 < var6 || var6 == 0.0D) { + var4 = var9; + var6 = var13; + } + } + } + } + + if(var4 != null) { + var3 = new MovingObjectPosition(var4); + } + + float var19; + if(var3 != null) { + if(var3.entityHit != null) { + if(var3.entityHit.attackEntityFrom(this.owner, 4)) { + this.worldObj.playSoundAtEntity(this, "random.drr", 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F)); + this.setEntityDead(); + } else { + this.motionX *= (double)-0.1F; + this.motionY *= (double)-0.1F; + this.motionZ *= (double)-0.1F; + this.rotationYaw += 180.0F; + this.prevRotationYaw += 180.0F; + this.ticksInAir = 0; + } + } else { + this.xTile = var3.blockX; + this.yTile = var3.blockY; + this.zTile = var3.blockZ; + this.inTile = this.worldObj.getBlockId(this.xTile, this.yTile, this.zTile); + this.field_28019_h = this.worldObj.getBlockMetadata(this.xTile, this.yTile, this.zTile); + this.motionX = (double)((float)(var3.hitVec.xCoord - this.posX)); + this.motionY = (double)((float)(var3.hitVec.yCoord - this.posY)); + this.motionZ = (double)((float)(var3.hitVec.zCoord - this.posZ)); + var19 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ); + this.posX -= this.motionX / (double)var19 * (double)0.05F; + this.posY -= this.motionY / (double)var19 * (double)0.05F; + this.posZ -= this.motionZ / (double)var19 * (double)0.05F; + this.worldObj.playSoundAtEntity(this, "random.drr", 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F)); + this.inGround = true; + this.arrowShake = 7; + } + } + + this.posX += this.motionX; + this.posY += this.motionY; + this.posZ += this.motionZ; + var19 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); + this.rotationYaw = (float)(Math.atan2(this.motionX, this.motionZ) * 180.0D / (double)((float)Math.PI)); + + for(this.rotationPitch = (float)(Math.atan2(this.motionY, (double)var19) * 180.0D / (double)((float)Math.PI)); this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F) { + } + + while(this.rotationPitch - this.prevRotationPitch >= 180.0F) { + this.prevRotationPitch += 360.0F; + } + + while(this.rotationYaw - this.prevRotationYaw < -180.0F) { + this.prevRotationYaw -= 360.0F; + } + + while(this.rotationYaw - this.prevRotationYaw >= 180.0F) { + this.prevRotationYaw += 360.0F; + } + + this.rotationPitch = this.prevRotationPitch + (this.rotationPitch - this.prevRotationPitch) * 0.2F; + this.rotationYaw = this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * 0.2F; + float var20 = 0.99F; + var10 = 0.03F; + if(this.isInWater()) { + for(int var21 = 0; var21 < 4; ++var21) { + float var22 = 0.25F; + this.worldObj.spawnParticle("bubble", this.posX - this.motionX * (double)var22, this.posY - this.motionY * (double)var22, this.posZ - this.motionZ * (double)var22, this.motionX, this.motionY, this.motionZ); + } + + var20 = 0.8F; + } + + this.motionX *= (double)var20; + this.motionY *= (double)var20; + this.motionZ *= (double)var20; + this.motionY -= (double)var10; + this.setPosition(this.posX, this.posY, this.posZ); + } + } + + public void writeEntityToNBT(NBTTagCompound var1) { + var1.setShort("xTile", (short)this.xTile); + var1.setShort("yTile", (short)this.yTile); + var1.setShort("zTile", (short)this.zTile); + var1.setByte("inTile", (byte)this.inTile); + var1.setByte("inData", (byte)this.field_28019_h); + var1.setByte("shake", (byte)this.arrowShake); + var1.setByte("inGround", (byte)(this.inGround ? 1 : 0)); + var1.setBoolean("player", this.doesArrowBelongToPlayer); + } + + public void readEntityFromNBT(NBTTagCompound var1) { + this.xTile = var1.getShort("xTile"); + this.yTile = var1.getShort("yTile"); + this.zTile = var1.getShort("zTile"); + this.inTile = var1.getByte("inTile") & 255; + this.field_28019_h = var1.getByte("inData") & 255; + this.arrowShake = var1.getByte("shake") & 255; + this.inGround = var1.getByte("inGround") == 1; + this.doesArrowBelongToPlayer = var1.getBoolean("player"); + } + + public void onCollideWithPlayer(EntityPlayer var1) { + if(!this.worldObj.multiplayerWorld) { + if(this.inGround && this.doesArrowBelongToPlayer && this.arrowShake <= 0 && var1.inventory.addItemStackToInventory(new ItemStack(Item.arrow, 1))) { + this.worldObj.playSoundAtEntity(this, "random.pop", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); + var1.onItemPickup(this, 1); + this.setEntityDead(); + } + + } + } + + public float getShadowSize() { + return 0.0F; + } +} diff --git a/src/net/minecraft/src/EntityBoat.java b/src/net/minecraft/src/EntityBoat.java new file mode 100644 index 0000000..a560ae0 --- /dev/null +++ b/src/net/minecraft/src/EntityBoat.java @@ -0,0 +1,347 @@ +package net.minecraft.src; + +import java.util.List; + +public class EntityBoat extends Entity { + public int boatCurrentDamage; + public int boatTimeSinceHit; + public int boatRockDirection; + private int field_9394_d; + private double field_9393_e; + private double field_9392_f; + private double field_9391_g; + private double field_9390_h; + private double field_9389_i; + private double field_9388_j; + private double field_9387_k; + private double field_9386_l; + + public EntityBoat(World var1) { + super(var1); + this.boatCurrentDamage = 0; + this.boatTimeSinceHit = 0; + this.boatRockDirection = 1; + this.preventEntitySpawning = true; + this.setSize(1.5F, 0.6F); + this.yOffset = this.height / 2.0F; + } + + protected boolean canTriggerWalking() { + return false; + } + + protected void entityInit() { + } + + public AxisAlignedBB getCollisionBox(Entity var1) { + return var1.boundingBox; + } + + public AxisAlignedBB getBoundingBox() { + return this.boundingBox; + } + + public boolean canBePushed() { + return true; + } + + public EntityBoat(World var1, double var2, double var4, double var6) { + this(var1); + this.setPosition(var2, var4 + (double)this.yOffset, var6); + this.motionX = 0.0D; + this.motionY = 0.0D; + this.motionZ = 0.0D; + this.prevPosX = var2; + this.prevPosY = var4; + this.prevPosZ = var6; + } + + public double getMountedYOffset() { + return (double)this.height * 0.0D - (double)0.3F; + } + + public boolean attackEntityFrom(Entity var1, int var2) { + if(!this.worldObj.multiplayerWorld && !this.isDead) { + this.boatRockDirection = -this.boatRockDirection; + this.boatTimeSinceHit = 10; + this.boatCurrentDamage += var2 * 10; + this.setBeenAttacked(); + if(this.boatCurrentDamage > 40) { + if(this.riddenByEntity != null) { + this.riddenByEntity.mountEntity(this); + } + + int var3; + for(var3 = 0; var3 < 3; ++var3) { + this.dropItemWithOffset(Block.planks.blockID, 1, 0.0F); + } + + for(var3 = 0; var3 < 2; ++var3) { + this.dropItemWithOffset(Item.stick.shiftedIndex, 1, 0.0F); + } + + this.setEntityDead(); + } + + return true; + } else { + return true; + } + } + + public void performHurtAnimation() { + this.boatRockDirection = -this.boatRockDirection; + this.boatTimeSinceHit = 10; + this.boatCurrentDamage += this.boatCurrentDamage * 10; + } + + public boolean canBeCollidedWith() { + return !this.isDead; + } + + public void setPositionAndRotation2(double var1, double var3, double var5, float var7, float var8, int var9) { + this.field_9393_e = var1; + this.field_9392_f = var3; + this.field_9391_g = var5; + this.field_9390_h = (double)var7; + this.field_9389_i = (double)var8; + this.field_9394_d = var9 + 4; + this.motionX = this.field_9388_j; + this.motionY = this.field_9387_k; + this.motionZ = this.field_9386_l; + } + + public void setVelocity(double var1, double var3, double var5) { + this.field_9388_j = this.motionX = var1; + this.field_9387_k = this.motionY = var3; + this.field_9386_l = this.motionZ = var5; + } + + public void onUpdate() { + super.onUpdate(); + if(this.boatTimeSinceHit > 0) { + --this.boatTimeSinceHit; + } + + if(this.boatCurrentDamage > 0) { + --this.boatCurrentDamage; + } + + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + byte var1 = 5; + double var2 = 0.0D; + + for(int var4 = 0; var4 < var1; ++var4) { + double var5 = this.boundingBox.minY + (this.boundingBox.maxY - this.boundingBox.minY) * (double)(var4 + 0) / (double)var1 - 0.125D; + double var7 = this.boundingBox.minY + (this.boundingBox.maxY - this.boundingBox.minY) * (double)(var4 + 1) / (double)var1 - 0.125D; + AxisAlignedBB var9 = AxisAlignedBB.getBoundingBoxFromPool(this.boundingBox.minX, var5, this.boundingBox.minZ, this.boundingBox.maxX, var7, this.boundingBox.maxZ); + if(this.worldObj.isAABBInMaterial(var9, Material.water)) { + var2 += 1.0D / (double)var1; + } + } + + double var6; + double var8; + double var10; + double var21; + if(this.worldObj.multiplayerWorld) { + if(this.field_9394_d > 0) { + var21 = this.posX + (this.field_9393_e - this.posX) / (double)this.field_9394_d; + var6 = this.posY + (this.field_9392_f - this.posY) / (double)this.field_9394_d; + var8 = this.posZ + (this.field_9391_g - this.posZ) / (double)this.field_9394_d; + + for(var10 = this.field_9390_h - (double)this.rotationYaw; var10 < -180.0D; var10 += 360.0D) { + } + + while(var10 >= 180.0D) { + var10 -= 360.0D; + } + + this.rotationYaw = (float)((double)this.rotationYaw + var10 / (double)this.field_9394_d); + this.rotationPitch = (float)((double)this.rotationPitch + (this.field_9389_i - (double)this.rotationPitch) / (double)this.field_9394_d); + --this.field_9394_d; + this.setPosition(var21, var6, var8); + this.setRotation(this.rotationYaw, this.rotationPitch); + } else { + var21 = this.posX + this.motionX; + var6 = this.posY + this.motionY; + var8 = this.posZ + this.motionZ; + this.setPosition(var21, var6, var8); + if(this.onGround) { + this.motionX *= 0.5D; + this.motionY *= 0.5D; + this.motionZ *= 0.5D; + } + + this.motionX *= (double)0.99F; + this.motionY *= (double)0.95F; + this.motionZ *= (double)0.99F; + } + + } else { + if(var2 < 1.0D) { + var21 = var2 * 2.0D - 1.0D; + this.motionY += (double)0.04F * var21; + } else { + if(this.motionY < 0.0D) { + this.motionY /= 2.0D; + } + + this.motionY += (double)0.007F; + } + + if(this.riddenByEntity != null) { + this.motionX += this.riddenByEntity.motionX * 0.2D; + this.motionZ += this.riddenByEntity.motionZ * 0.2D; + } + + var21 = 0.4D; + if(this.motionX < -var21) { + this.motionX = -var21; + } + + if(this.motionX > var21) { + this.motionX = var21; + } + + if(this.motionZ < -var21) { + this.motionZ = -var21; + } + + if(this.motionZ > var21) { + this.motionZ = var21; + } + + if(this.onGround) { + this.motionX *= 0.5D; + this.motionY *= 0.5D; + this.motionZ *= 0.5D; + } + + this.moveEntity(this.motionX, this.motionY, this.motionZ); + var6 = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ); + if(var6 > 0.15D) { + var8 = Math.cos((double)this.rotationYaw * Math.PI / 180.0D); + var10 = Math.sin((double)this.rotationYaw * Math.PI / 180.0D); + + for(int var12 = 0; (double)var12 < 1.0D + var6 * 60.0D; ++var12) { + double var13 = (double)(this.rand.nextFloat() * 2.0F - 1.0F); + double var15 = (double)(this.rand.nextInt(2) * 2 - 1) * 0.7D; + double var17; + double var19; + if(this.rand.nextBoolean()) { + var17 = this.posX - var8 * var13 * 0.8D + var10 * var15; + var19 = this.posZ - var10 * var13 * 0.8D - var8 * var15; + this.worldObj.spawnParticle("splash", var17, this.posY - 0.125D, var19, this.motionX, this.motionY, this.motionZ); + } else { + var17 = this.posX + var8 + var10 * var13 * 0.7D; + var19 = this.posZ + var10 - var8 * var13 * 0.7D; + this.worldObj.spawnParticle("splash", var17, this.posY - 0.125D, var19, this.motionX, this.motionY, this.motionZ); + } + } + } + + if(this.isCollidedHorizontally && var6 > 0.15D) { + if(!this.worldObj.multiplayerWorld) { + this.setEntityDead(); + + int var22; + for(var22 = 0; var22 < 3; ++var22) { + this.dropItemWithOffset(Block.planks.blockID, 1, 0.0F); + } + + for(var22 = 0; var22 < 2; ++var22) { + this.dropItemWithOffset(Item.stick.shiftedIndex, 1, 0.0F); + } + } + } else { + this.motionX *= (double)0.99F; + this.motionY *= (double)0.95F; + this.motionZ *= (double)0.99F; + } + + this.rotationPitch = 0.0F; + var8 = (double)this.rotationYaw; + var10 = this.prevPosX - this.posX; + double var23 = this.prevPosZ - this.posZ; + if(var10 * var10 + var23 * var23 > 0.001D) { + var8 = (double)((float)(Math.atan2(var23, var10) * 180.0D / Math.PI)); + } + + double var14; + for(var14 = var8 - (double)this.rotationYaw; var14 >= 180.0D; var14 -= 360.0D) { + } + + while(var14 < -180.0D) { + var14 += 360.0D; + } + + if(var14 > 20.0D) { + var14 = 20.0D; + } + + if(var14 < -20.0D) { + var14 = -20.0D; + } + + this.rotationYaw = (float)((double)this.rotationYaw + var14); + this.setRotation(this.rotationYaw, this.rotationPitch); + List var16 = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.expand((double)0.2F, 0.0D, (double)0.2F)); + int var24; + if(var16 != null && var16.size() > 0) { + for(var24 = 0; var24 < var16.size(); ++var24) { + Entity var18 = (Entity)var16.get(var24); + if(var18 != this.riddenByEntity && var18.canBePushed() && var18 instanceof EntityBoat) { + var18.applyEntityCollision(this); + } + } + } + + for(var24 = 0; var24 < 4; ++var24) { + int var25 = MathHelper.floor_double(this.posX + ((double)(var24 % 2) - 0.5D) * 0.8D); + int var26 = MathHelper.floor_double(this.posY); + int var20 = MathHelper.floor_double(this.posZ + ((double)(var24 / 2) - 0.5D) * 0.8D); + if(this.worldObj.getBlockId(var25, var26, var20) == Block.snow.blockID) { + this.worldObj.setBlockWithNotify(var25, var26, var20, 0); + } + } + + if(this.riddenByEntity != null && this.riddenByEntity.isDead) { + this.riddenByEntity = null; + } + + } + } + + public void updateRiderPosition() { + if(this.riddenByEntity != null) { + double var1 = Math.cos((double)this.rotationYaw * Math.PI / 180.0D) * 0.4D; + double var3 = Math.sin((double)this.rotationYaw * Math.PI / 180.0D) * 0.4D; + this.riddenByEntity.setPosition(this.posX + var1, this.posY + this.getMountedYOffset() + this.riddenByEntity.getYOffset(), this.posZ + var3); + } + } + + protected void writeEntityToNBT(NBTTagCompound var1) { + } + + protected void readEntityFromNBT(NBTTagCompound var1) { + } + + public float getShadowSize() { + return 0.0F; + } + + public boolean interact(EntityPlayer var1) { + if(this.riddenByEntity != null && this.riddenByEntity instanceof EntityPlayer && this.riddenByEntity != var1) { + return true; + } else { + if(!this.worldObj.multiplayerWorld) { + var1.mountEntity(this); + } + + return true; + } + } +} diff --git a/src/net/minecraft/src/EntityBubbleFX.java b/src/net/minecraft/src/EntityBubbleFX.java new file mode 100644 index 0000000..d8ae2f2 --- /dev/null +++ b/src/net/minecraft/src/EntityBubbleFX.java @@ -0,0 +1,36 @@ +package net.minecraft.src; + +public class EntityBubbleFX extends EntityFX { + public EntityBubbleFX(World var1, double var2, double var4, double var6, double var8, double var10, double var12) { + super(var1, var2, var4, var6, var8, var10, var12); + this.particleRed = 1.0F; + this.particleGreen = 1.0F; + this.particleBlue = 1.0F; + this.particleTextureIndex = 32; + this.setSize(0.02F, 0.02F); + this.particleScale *= this.rand.nextFloat() * 0.6F + 0.2F; + this.motionX = var8 * (double)0.2F + (double)((float)(Math.random() * 2.0D - 1.0D) * 0.02F); + this.motionY = var10 * (double)0.2F + (double)((float)(Math.random() * 2.0D - 1.0D) * 0.02F); + this.motionZ = var12 * (double)0.2F + (double)((float)(Math.random() * 2.0D - 1.0D) * 0.02F); + this.particleMaxAge = (int)(8.0D / (Math.random() * 0.8D + 0.2D)); + } + + public void onUpdate() { + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + this.motionY += 0.002D; + this.moveEntity(this.motionX, this.motionY, this.motionZ); + this.motionX *= (double)0.85F; + this.motionY *= (double)0.85F; + this.motionZ *= (double)0.85F; + if(this.worldObj.getBlockMaterial(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ)) != Material.water) { + this.setEntityDead(); + } + + if(this.particleMaxAge-- <= 0) { + this.setEntityDead(); + } + + } +} diff --git a/src/net/minecraft/src/EntityChicken.java b/src/net/minecraft/src/EntityChicken.java new file mode 100644 index 0000000..11abce5 --- /dev/null +++ b/src/net/minecraft/src/EntityChicken.java @@ -0,0 +1,77 @@ +package net.minecraft.src; + +public class EntityChicken extends EntityAnimal { + public boolean field_753_a = false; + public float field_752_b = 0.0F; + public float destPos = 0.0F; + public float field_757_d; + public float field_756_e; + public float field_755_h = 1.0F; + public int timeUntilNextEgg; + + public EntityChicken(World var1) { + super(var1); + this.texture = "/mob/chicken.png"; + this.setSize(0.3F, 0.4F); + this.health = 4; + this.timeUntilNextEgg = this.rand.nextInt(6000) + 6000; + } + + public void onLivingUpdate() { + super.onLivingUpdate(); + this.field_756_e = this.field_752_b; + this.field_757_d = this.destPos; + this.destPos = (float)((double)this.destPos + (double)(this.onGround ? -1 : 4) * 0.3D); + if(this.destPos < 0.0F) { + this.destPos = 0.0F; + } + + if(this.destPos > 1.0F) { + this.destPos = 1.0F; + } + + if(!this.onGround && this.field_755_h < 1.0F) { + this.field_755_h = 1.0F; + } + + this.field_755_h = (float)((double)this.field_755_h * 0.9D); + if(!this.onGround && this.motionY < 0.0D) { + this.motionY *= 0.6D; + } + + this.field_752_b += this.field_755_h * 2.0F; + if(!this.worldObj.multiplayerWorld && --this.timeUntilNextEgg <= 0) { + this.worldObj.playSoundAtEntity(this, "mob.chickenplop", 1.0F, (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F); + this.dropItem(Item.egg.shiftedIndex, 1); + this.timeUntilNextEgg = this.rand.nextInt(6000) + 6000; + } + + } + + protected void fall(float var1) { + } + + public void writeEntityToNBT(NBTTagCompound var1) { + super.writeEntityToNBT(var1); + } + + public void readEntityFromNBT(NBTTagCompound var1) { + super.readEntityFromNBT(var1); + } + + protected String getLivingSound() { + return "mob.chicken"; + } + + protected String getHurtSound() { + return "mob.chickenhurt"; + } + + protected String getDeathSound() { + return "mob.chickenhurt"; + } + + protected int getDropItemId() { + return Item.feather.shiftedIndex; + } +} diff --git a/src/net/minecraft/src/EntityClientPlayerMP.java b/src/net/minecraft/src/EntityClientPlayerMP.java new file mode 100644 index 0000000..ca802ef --- /dev/null +++ b/src/net/minecraft/src/EntityClientPlayerMP.java @@ -0,0 +1,165 @@ +package net.minecraft.src; + +import net.minecraft.client.Minecraft; + +public class EntityClientPlayerMP extends EntityPlayerSP { + public NetClientHandler sendQueue; + private int field_9380_bx = 0; + private boolean field_21093_bH = false; + private double oldPosX; + private double field_9378_bz; + private double oldPosY; + private double oldPosZ; + private float oldRotationYaw; + private float oldRotationPitch; + private boolean field_9382_bF = false; + private boolean wasSneaking = false; + private int field_12242_bI = 0; + + public EntityClientPlayerMP(Minecraft var1, World var2, Session var3, NetClientHandler var4) { + super(var1, var2, var3, 0); + this.sendQueue = var4; + } + + public boolean attackEntityFrom(Entity var1, int var2) { + return false; + } + + public void heal(int var1) { + } + + public void onUpdate() { + if(this.worldObj.blockExists(MathHelper.floor_double(this.posX), 64, MathHelper.floor_double(this.posZ))) { + super.onUpdate(); + this.func_4056_N(); + } + } + + public void func_4056_N() { + if(this.field_9380_bx++ == 20) { + this.sendInventoryChanged(); + this.field_9380_bx = 0; + } + + boolean var1 = this.isSneaking(); + if(var1 != this.wasSneaking) { + if(var1) { + this.sendQueue.addToSendQueue(new Packet19EntityAction(this, 1)); + } else { + this.sendQueue.addToSendQueue(new Packet19EntityAction(this, 2)); + } + + this.wasSneaking = var1; + } + + double var2 = this.posX - this.oldPosX; + double var4 = this.boundingBox.minY - this.field_9378_bz; + double var6 = this.posY - this.oldPosY; + double var8 = this.posZ - this.oldPosZ; + double var10 = (double)(this.rotationYaw - this.oldRotationYaw); + double var12 = (double)(this.rotationPitch - this.oldRotationPitch); + boolean var14 = var4 != 0.0D || var6 != 0.0D || var2 != 0.0D || var8 != 0.0D; + boolean var15 = var10 != 0.0D || var12 != 0.0D; + if(this.ridingEntity != null) { + if(var15) { + this.sendQueue.addToSendQueue(new Packet11PlayerPosition(this.motionX, -999.0D, -999.0D, this.motionZ, this.onGround)); + } else { + this.sendQueue.addToSendQueue(new Packet13PlayerLookMove(this.motionX, -999.0D, -999.0D, this.motionZ, this.rotationYaw, this.rotationPitch, this.onGround)); + } + + var14 = false; + } else if(var14 && var15) { + this.sendQueue.addToSendQueue(new Packet13PlayerLookMove(this.posX, this.boundingBox.minY, this.posY, this.posZ, this.rotationYaw, this.rotationPitch, this.onGround)); + this.field_12242_bI = 0; + } else if(var14) { + this.sendQueue.addToSendQueue(new Packet11PlayerPosition(this.posX, this.boundingBox.minY, this.posY, this.posZ, this.onGround)); + this.field_12242_bI = 0; + } else if(var15) { + this.sendQueue.addToSendQueue(new Packet12PlayerLook(this.rotationYaw, this.rotationPitch, this.onGround)); + this.field_12242_bI = 0; + } else { + this.sendQueue.addToSendQueue(new Packet10Flying(this.onGround)); + if(this.field_9382_bF == this.onGround && this.field_12242_bI <= 200) { + ++this.field_12242_bI; + } else { + this.field_12242_bI = 0; + } + } + + this.field_9382_bF = this.onGround; + if(var14) { + this.oldPosX = this.posX; + this.field_9378_bz = this.boundingBox.minY; + this.oldPosY = this.posY; + this.oldPosZ = this.posZ; + } + + if(var15) { + this.oldRotationYaw = this.rotationYaw; + this.oldRotationPitch = this.rotationPitch; + } + + } + + public void dropCurrentItem() { + this.sendQueue.addToSendQueue(new Packet14BlockDig(4, 0, 0, 0, 0)); + } + + private void sendInventoryChanged() { + } + + protected void joinEntityItemWithWorld(EntityItem var1) { + } + + public void sendChatMessage(String var1) { + this.sendQueue.addToSendQueue(new Packet3Chat(var1)); + } + + public void swingItem() { + super.swingItem(); + this.sendQueue.addToSendQueue(new Packet18Animation(this, 1)); + } + + public void respawnPlayer() { + this.sendInventoryChanged(); + this.sendQueue.addToSendQueue(new Packet9Respawn((byte)this.dimension)); + } + + protected void damageEntity(int var1) { + this.health -= var1; + } + + public void closeScreen() { + this.sendQueue.addToSendQueue(new Packet101CloseWindow(this.craftingInventory.windowId)); + this.inventory.setItemStack((ItemStack)null); + super.closeScreen(); + } + + public void setHealth(int var1) { + if(this.field_21093_bH) { + super.setHealth(var1); + } else { + this.health = var1; + this.field_21093_bH = true; + } + + } + + public void addStat(StatBase var1, int var2) { + if(var1 != null) { + if(var1.field_27088_g) { + super.addStat(var1, var2); + } + + } + } + + public void func_27027_b(StatBase var1, int var2) { + if(var1 != null) { + if(!var1.field_27088_g) { + super.addStat(var1, var2); + } + + } + } +} diff --git a/src/net/minecraft/src/EntityCow.java b/src/net/minecraft/src/EntityCow.java new file mode 100644 index 0000000..a668fa9 --- /dev/null +++ b/src/net/minecraft/src/EntityCow.java @@ -0,0 +1,47 @@ +package net.minecraft.src; + +public class EntityCow extends EntityAnimal { + public EntityCow(World var1) { + super(var1); + this.texture = "/mob/cow.png"; + this.setSize(0.9F, 1.3F); + } + + public void writeEntityToNBT(NBTTagCompound var1) { + super.writeEntityToNBT(var1); + } + + public void readEntityFromNBT(NBTTagCompound var1) { + super.readEntityFromNBT(var1); + } + + protected String getLivingSound() { + return "mob.cow"; + } + + protected String getHurtSound() { + return "mob.cowhurt"; + } + + protected String getDeathSound() { + return "mob.cowhurt"; + } + + protected float getSoundVolume() { + return 0.4F; + } + + protected int getDropItemId() { + return Item.leather.shiftedIndex; + } + + public boolean interact(EntityPlayer var1) { + ItemStack var2 = var1.inventory.getCurrentItem(); + if(var2 != null && var2.itemID == Item.bucketEmpty.shiftedIndex) { + var1.inventory.setInventorySlotContents(var1.inventory.currentItem, new ItemStack(Item.bucketMilk)); + return true; + } else { + return false; + } + } +} diff --git a/src/net/minecraft/src/EntityCreature.java b/src/net/minecraft/src/EntityCreature.java new file mode 100644 index 0000000..61ce105 --- /dev/null +++ b/src/net/minecraft/src/EntityCreature.java @@ -0,0 +1,181 @@ +package net.minecraft.src; + +public class EntityCreature extends EntityLiving { + private PathEntity pathToEntity; + protected Entity playerToAttack; + protected boolean hasAttacked = false; + + public EntityCreature(World var1) { + super(var1); + } + + protected boolean isMovementCeased() { + return false; + } + + protected void updatePlayerActionState() { + this.hasAttacked = this.isMovementCeased(); + float var1 = 16.0F; + if(this.playerToAttack == null) { + this.playerToAttack = this.findPlayerToAttack(); + if(this.playerToAttack != null) { + this.pathToEntity = this.worldObj.getPathToEntity(this, this.playerToAttack, var1); + } + } else if(!this.playerToAttack.isEntityAlive()) { + this.playerToAttack = null; + } else { + float var2 = this.playerToAttack.getDistanceToEntity(this); + if(this.canEntityBeSeen(this.playerToAttack)) { + this.attackEntity(this.playerToAttack, var2); + } else { + this.attackBlockedEntity(this.playerToAttack, var2); + } + } + + if(this.hasAttacked || this.playerToAttack == null || this.pathToEntity != null && this.rand.nextInt(20) != 0) { + if(!this.hasAttacked && (this.pathToEntity == null && this.rand.nextInt(80) == 0 || this.rand.nextInt(80) == 0)) { + this.func_31026_E(); + } + } else { + this.pathToEntity = this.worldObj.getPathToEntity(this, this.playerToAttack, var1); + } + + int var21 = MathHelper.floor_double(this.boundingBox.minY + 0.5D); + boolean var3 = this.isInWater(); + boolean var4 = this.handleLavaMovement(); + this.rotationPitch = 0.0F; + if(this.pathToEntity != null && this.rand.nextInt(100) != 0) { + Vec3D var5 = this.pathToEntity.getPosition(this); + double var6 = (double)(this.width * 2.0F); + + while(var5 != null && var5.squareDistanceTo(this.posX, var5.yCoord, this.posZ) < var6 * var6) { + this.pathToEntity.incrementPathIndex(); + if(this.pathToEntity.isFinished()) { + var5 = null; + this.pathToEntity = null; + } else { + var5 = this.pathToEntity.getPosition(this); + } + } + + this.isJumping = false; + if(var5 != null) { + double var8 = var5.xCoord - this.posX; + double var10 = var5.zCoord - this.posZ; + double var12 = var5.yCoord - (double)var21; + float var14 = (float)(Math.atan2(var10, var8) * 180.0D / (double)((float)Math.PI)) - 90.0F; + float var15 = var14 - this.rotationYaw; + + for(this.moveForward = this.moveSpeed; var15 < -180.0F; var15 += 360.0F) { + } + + while(var15 >= 180.0F) { + var15 -= 360.0F; + } + + if(var15 > 30.0F) { + var15 = 30.0F; + } + + if(var15 < -30.0F) { + var15 = -30.0F; + } + + this.rotationYaw += var15; + if(this.hasAttacked && this.playerToAttack != null) { + double var16 = this.playerToAttack.posX - this.posX; + double var18 = this.playerToAttack.posZ - this.posZ; + float var20 = this.rotationYaw; + this.rotationYaw = (float)(Math.atan2(var18, var16) * 180.0D / (double)((float)Math.PI)) - 90.0F; + var15 = (var20 - this.rotationYaw + 90.0F) * (float)Math.PI / 180.0F; + this.moveStrafing = -MathHelper.sin(var15) * this.moveForward * 1.0F; + this.moveForward = MathHelper.cos(var15) * this.moveForward * 1.0F; + } + + if(var12 > 0.0D) { + this.isJumping = true; + } + } + + if(this.playerToAttack != null) { + this.faceEntity(this.playerToAttack, 30.0F, 30.0F); + } + + if(this.isCollidedHorizontally && !this.hasPath()) { + this.isJumping = true; + } + + if(this.rand.nextFloat() < 0.8F && (var3 || var4)) { + this.isJumping = true; + } + + } else { + super.updatePlayerActionState(); + this.pathToEntity = null; + } + } + + protected void func_31026_E() { + boolean var1 = false; + int var2 = -1; + int var3 = -1; + int var4 = -1; + float var5 = -99999.0F; + + for(int var6 = 0; var6 < 10; ++var6) { + int var7 = MathHelper.floor_double(this.posX + (double)this.rand.nextInt(13) - 6.0D); + int var8 = MathHelper.floor_double(this.posY + (double)this.rand.nextInt(7) - 3.0D); + int var9 = MathHelper.floor_double(this.posZ + (double)this.rand.nextInt(13) - 6.0D); + float var10 = this.getBlockPathWeight(var7, var8, var9); + if(var10 > var5) { + var5 = var10; + var2 = var7; + var3 = var8; + var4 = var9; + var1 = true; + } + } + + if(var1) { + this.pathToEntity = this.worldObj.getEntityPathToXYZ(this, var2, var3, var4, 10.0F); + } + + } + + protected void attackEntity(Entity var1, float var2) { + } + + protected void attackBlockedEntity(Entity var1, float var2) { + } + + protected float getBlockPathWeight(int var1, int var2, int var3) { + return 0.0F; + } + + protected Entity findPlayerToAttack() { + return null; + } + + public boolean getCanSpawnHere() { + int var1 = MathHelper.floor_double(this.posX); + int var2 = MathHelper.floor_double(this.boundingBox.minY); + int var3 = MathHelper.floor_double(this.posZ); + return super.getCanSpawnHere() && this.getBlockPathWeight(var1, var2, var3) >= 0.0F; + } + + public boolean hasPath() { + return this.pathToEntity != null; + } + + public void setPathToEntity(PathEntity var1) { + this.pathToEntity = var1; + } + + public Entity getTarget() { + return this.playerToAttack; + } + + public void setTarget(Entity var1) { + this.playerToAttack = var1; + } +} diff --git a/src/net/minecraft/src/EntityCreeper.java b/src/net/minecraft/src/EntityCreeper.java new file mode 100644 index 0000000..398d6f0 --- /dev/null +++ b/src/net/minecraft/src/EntityCreeper.java @@ -0,0 +1,145 @@ +package net.minecraft.src; + +public class EntityCreeper extends EntityMob { + int timeSinceIgnited; + int lastActiveTime; + + public EntityCreeper(World var1) { + super(var1); + this.texture = "/mob/creeper.png"; + } + + protected void entityInit() { + super.entityInit(); + this.dataWatcher.addObject(16, Byte.valueOf((byte)-1)); + this.dataWatcher.addObject(17, Byte.valueOf((byte)0)); + } + + public void writeEntityToNBT(NBTTagCompound var1) { + super.writeEntityToNBT(var1); + if(this.dataWatcher.getWatchableObjectByte(17) == 1) { + var1.setBoolean("powered", true); + } + + } + + public void readEntityFromNBT(NBTTagCompound var1) { + super.readEntityFromNBT(var1); + this.dataWatcher.updateObject(17, Byte.valueOf((byte)(var1.getBoolean("powered") ? 1 : 0))); + } + + protected void attackBlockedEntity(Entity var1, float var2) { + if(!this.worldObj.multiplayerWorld) { + if(this.timeSinceIgnited > 0) { + this.setCreeperState(-1); + --this.timeSinceIgnited; + if(this.timeSinceIgnited < 0) { + this.timeSinceIgnited = 0; + } + } + + } + } + + public void onUpdate() { + this.lastActiveTime = this.timeSinceIgnited; + if(this.worldObj.multiplayerWorld) { + int var1 = this.getCreeperState(); + if(var1 > 0 && this.timeSinceIgnited == 0) { + this.worldObj.playSoundAtEntity(this, "random.fuse", 1.0F, 0.5F); + } + + this.timeSinceIgnited += var1; + if(this.timeSinceIgnited < 0) { + this.timeSinceIgnited = 0; + } + + if(this.timeSinceIgnited >= 30) { + this.timeSinceIgnited = 30; + } + } + + super.onUpdate(); + if(this.playerToAttack == null && this.timeSinceIgnited > 0) { + this.setCreeperState(-1); + --this.timeSinceIgnited; + if(this.timeSinceIgnited < 0) { + this.timeSinceIgnited = 0; + } + } + + } + + protected String getHurtSound() { + return "mob.creeper"; + } + + protected String getDeathSound() { + return "mob.creeperdeath"; + } + + public void onDeath(Entity var1) { + super.onDeath(var1); + if(var1 instanceof EntitySkeleton) { + this.dropItem(Item.record13.shiftedIndex + this.rand.nextInt(2), 1); + } + + } + + protected void attackEntity(Entity var1, float var2) { + if(!this.worldObj.multiplayerWorld) { + int var3 = this.getCreeperState(); + if(var3 <= 0 && var2 < 3.0F || var3 > 0 && var2 < 7.0F) { + if(this.timeSinceIgnited == 0) { + this.worldObj.playSoundAtEntity(this, "random.fuse", 1.0F, 0.5F); + } + + this.setCreeperState(1); + ++this.timeSinceIgnited; + if(this.timeSinceIgnited >= 30) { + if(this.getPowered()) { + this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, 6.0F); + } else { + this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, 3.0F); + } + + this.setEntityDead(); + } + + this.hasAttacked = true; + } else { + this.setCreeperState(-1); + --this.timeSinceIgnited; + if(this.timeSinceIgnited < 0) { + this.timeSinceIgnited = 0; + } + } + + } + } + + public boolean getPowered() { + return this.dataWatcher.getWatchableObjectByte(17) == 1; + } + + public float setCreeperFlashTime(float var1) { + return ((float)this.lastActiveTime + (float)(this.timeSinceIgnited - this.lastActiveTime) * var1) / 28.0F; + } + + protected int getDropItemId() { + return Item.gunpowder.shiftedIndex; + } + + private int getCreeperState() { + return this.dataWatcher.getWatchableObjectByte(16); + } + + private void setCreeperState(int var1) { + this.dataWatcher.updateObject(16, Byte.valueOf((byte)var1)); + } + + public void onStruckByLightning(EntityLightningBolt var1) { + super.onStruckByLightning(var1); + this.dataWatcher.updateObject(17, Byte.valueOf((byte)1)); + } +} diff --git a/src/net/minecraft/src/EntityDiggingFX.java b/src/net/minecraft/src/EntityDiggingFX.java new file mode 100644 index 0000000..293fb5c --- /dev/null +++ b/src/net/minecraft/src/EntityDiggingFX.java @@ -0,0 +1,49 @@ +package net.minecraft.src; + +public class EntityDiggingFX extends EntityFX { + private Block field_4082_a; + private int field_32001_o = 0; + + public EntityDiggingFX(World var1, double var2, double var4, double var6, double var8, double var10, double var12, Block var14, int var15, int var16) { + super(var1, var2, var4, var6, var8, var10, var12); + this.field_4082_a = var14; + this.particleTextureIndex = var14.getBlockTextureFromSideAndMetadata(0, var16); + this.particleGravity = var14.blockParticleGravity; + this.particleRed = this.particleGreen = this.particleBlue = 0.6F; + this.particleScale /= 2.0F; + this.field_32001_o = var15; + } + + public EntityDiggingFX func_4041_a(int var1, int var2, int var3) { + if(this.field_4082_a == Block.grass) { + return this; + } else { + int var4 = this.field_4082_a.colorMultiplier(this.worldObj, var1, var2, var3); + this.particleRed *= (float)(var4 >> 16 & 255) / 255.0F; + this.particleGreen *= (float)(var4 >> 8 & 255) / 255.0F; + this.particleBlue *= (float)(var4 & 255) / 255.0F; + return this; + } + } + + public int getFXLayer() { + return 1; + } + + public void renderParticle(Tessellator var1, float var2, float var3, float var4, float var5, float var6, float var7) { + float var8 = ((float)(this.particleTextureIndex % 16) + this.particleTextureJitterX / 4.0F) / 16.0F; + float var9 = var8 + 0.999F / 64.0F; + float var10 = ((float)(this.particleTextureIndex / 16) + this.particleTextureJitterY / 4.0F) / 16.0F; + float var11 = var10 + 0.999F / 64.0F; + float var12 = 0.1F * this.particleScale; + float var13 = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)var2 - interpPosX); + float var14 = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)var2 - interpPosY); + float var15 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)var2 - interpPosZ); + float var16 = this.getEntityBrightness(var2); + var1.setColorOpaque_F(var16 * this.particleRed, var16 * this.particleGreen, var16 * this.particleBlue); + var1.addVertexWithUV((double)(var13 - var3 * var12 - var6 * var12), (double)(var14 - var4 * var12), (double)(var15 - var5 * var12 - var7 * var12), (double)var8, (double)var11); + var1.addVertexWithUV((double)(var13 - var3 * var12 + var6 * var12), (double)(var14 + var4 * var12), (double)(var15 - var5 * var12 + var7 * var12), (double)var8, (double)var10); + var1.addVertexWithUV((double)(var13 + var3 * var12 + var6 * var12), (double)(var14 + var4 * var12), (double)(var15 + var5 * var12 + var7 * var12), (double)var9, (double)var10); + var1.addVertexWithUV((double)(var13 + var3 * var12 - var6 * var12), (double)(var14 - var4 * var12), (double)(var15 + var5 * var12 - var7 * var12), (double)var9, (double)var11); + } +} diff --git a/src/net/minecraft/src/EntityEgg.java b/src/net/minecraft/src/EntityEgg.java new file mode 100644 index 0000000..245ba33 --- /dev/null +++ b/src/net/minecraft/src/EntityEgg.java @@ -0,0 +1,247 @@ +package net.minecraft.src; + +import java.util.List; + +public class EntityEgg extends Entity { + private int field_20056_b = -1; + private int field_20055_c = -1; + private int field_20054_d = -1; + private int field_20053_e = 0; + private boolean field_20052_f = false; + public int field_20057_a = 0; + private EntityLiving field_20051_g; + private int field_20050_h; + private int field_20049_i = 0; + + public EntityEgg(World var1) { + super(var1); + this.setSize(0.25F, 0.25F); + } + + protected void entityInit() { + } + + public boolean isInRangeToRenderDist(double var1) { + double var3 = this.boundingBox.getAverageEdgeLength() * 4.0D; + var3 *= 64.0D; + return var1 < var3 * var3; + } + + public EntityEgg(World var1, EntityLiving var2) { + super(var1); + this.field_20051_g = var2; + this.setSize(0.25F, 0.25F); + this.setLocationAndAngles(var2.posX, var2.posY + (double)var2.getEyeHeight(), var2.posZ, var2.rotationYaw, var2.rotationPitch); + this.posX -= (double)(MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * 0.16F); + this.posY -= (double)0.1F; + this.posZ -= (double)(MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * 0.16F); + this.setPosition(this.posX, this.posY, this.posZ); + this.yOffset = 0.0F; + float var3 = 0.4F; + this.motionX = (double)(-MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI) * var3); + this.motionZ = (double)(MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI) * var3); + this.motionY = (double)(-MathHelper.sin(this.rotationPitch / 180.0F * (float)Math.PI) * var3); + this.setEggHeading(this.motionX, this.motionY, this.motionZ, 1.5F, 1.0F); + } + + public EntityEgg(World var1, double var2, double var4, double var6) { + super(var1); + this.field_20050_h = 0; + this.setSize(0.25F, 0.25F); + this.setPosition(var2, var4, var6); + this.yOffset = 0.0F; + } + + public void setEggHeading(double var1, double var3, double var5, float var7, float var8) { + float var9 = MathHelper.sqrt_double(var1 * var1 + var3 * var3 + var5 * var5); + var1 /= (double)var9; + var3 /= (double)var9; + var5 /= (double)var9; + var1 += this.rand.nextGaussian() * (double)0.0075F * (double)var8; + var3 += this.rand.nextGaussian() * (double)0.0075F * (double)var8; + var5 += this.rand.nextGaussian() * (double)0.0075F * (double)var8; + var1 *= (double)var7; + var3 *= (double)var7; + var5 *= (double)var7; + this.motionX = var1; + this.motionY = var3; + this.motionZ = var5; + float var10 = MathHelper.sqrt_double(var1 * var1 + var5 * var5); + this.prevRotationYaw = this.rotationYaw = (float)(Math.atan2(var1, var5) * 180.0D / (double)((float)Math.PI)); + this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(var3, (double)var10) * 180.0D / (double)((float)Math.PI)); + this.field_20050_h = 0; + } + + public void setVelocity(double var1, double var3, double var5) { + this.motionX = var1; + this.motionY = var3; + this.motionZ = var5; + if(this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F) { + float var7 = MathHelper.sqrt_double(var1 * var1 + var5 * var5); + this.prevRotationYaw = this.rotationYaw = (float)(Math.atan2(var1, var5) * 180.0D / (double)((float)Math.PI)); + this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(var3, (double)var7) * 180.0D / (double)((float)Math.PI)); + } + + } + + public void onUpdate() { + this.lastTickPosX = this.posX; + this.lastTickPosY = this.posY; + this.lastTickPosZ = this.posZ; + super.onUpdate(); + if(this.field_20057_a > 0) { + --this.field_20057_a; + } + + if(this.field_20052_f) { + int var1 = this.worldObj.getBlockId(this.field_20056_b, this.field_20055_c, this.field_20054_d); + if(var1 == this.field_20053_e) { + ++this.field_20050_h; + if(this.field_20050_h == 1200) { + this.setEntityDead(); + } + + return; + } + + this.field_20052_f = false; + this.motionX *= (double)(this.rand.nextFloat() * 0.2F); + this.motionY *= (double)(this.rand.nextFloat() * 0.2F); + this.motionZ *= (double)(this.rand.nextFloat() * 0.2F); + this.field_20050_h = 0; + this.field_20049_i = 0; + } else { + ++this.field_20049_i; + } + + Vec3D var15 = Vec3D.createVector(this.posX, this.posY, this.posZ); + Vec3D var2 = Vec3D.createVector(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); + MovingObjectPosition var3 = this.worldObj.rayTraceBlocks(var15, var2); + var15 = Vec3D.createVector(this.posX, this.posY, this.posZ); + var2 = Vec3D.createVector(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); + if(var3 != null) { + var2 = Vec3D.createVector(var3.hitVec.xCoord, var3.hitVec.yCoord, var3.hitVec.zCoord); + } + + if(!this.worldObj.multiplayerWorld) { + Entity var4 = null; + List var5 = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D)); + double var6 = 0.0D; + + for(int var8 = 0; var8 < var5.size(); ++var8) { + Entity var9 = (Entity)var5.get(var8); + if(var9.canBeCollidedWith() && (var9 != this.field_20051_g || this.field_20049_i >= 5)) { + float var10 = 0.3F; + AxisAlignedBB var11 = var9.boundingBox.expand((double)var10, (double)var10, (double)var10); + MovingObjectPosition var12 = var11.func_1169_a(var15, var2); + if(var12 != null) { + double var13 = var15.distanceTo(var12.hitVec); + if(var13 < var6 || var6 == 0.0D) { + var4 = var9; + var6 = var13; + } + } + } + } + + if(var4 != null) { + var3 = new MovingObjectPosition(var4); + } + } + + if(var3 != null) { + if(var3.entityHit != null && var3.entityHit.attackEntityFrom(this.field_20051_g, 0)) { + } + + if(!this.worldObj.multiplayerWorld && this.rand.nextInt(8) == 0) { + byte var16 = 1; + if(this.rand.nextInt(32) == 0) { + var16 = 4; + } + + for(int var17 = 0; var17 < var16; ++var17) { + EntityChicken var21 = new EntityChicken(this.worldObj); + var21.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, 0.0F); + this.worldObj.entityJoinedWorld(var21); + } + } + + for(int var18 = 0; var18 < 8; ++var18) { + this.worldObj.spawnParticle("snowballpoof", this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D); + } + + this.setEntityDead(); + } + + this.posX += this.motionX; + this.posY += this.motionY; + this.posZ += this.motionZ; + float var20 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); + this.rotationYaw = (float)(Math.atan2(this.motionX, this.motionZ) * 180.0D / (double)((float)Math.PI)); + + for(this.rotationPitch = (float)(Math.atan2(this.motionY, (double)var20) * 180.0D / (double)((float)Math.PI)); this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F) { + } + + while(this.rotationPitch - this.prevRotationPitch >= 180.0F) { + this.prevRotationPitch += 360.0F; + } + + while(this.rotationYaw - this.prevRotationYaw < -180.0F) { + this.prevRotationYaw -= 360.0F; + } + + while(this.rotationYaw - this.prevRotationYaw >= 180.0F) { + this.prevRotationYaw += 360.0F; + } + + this.rotationPitch = this.prevRotationPitch + (this.rotationPitch - this.prevRotationPitch) * 0.2F; + this.rotationYaw = this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * 0.2F; + float var19 = 0.99F; + float var22 = 0.03F; + if(this.isInWater()) { + for(int var7 = 0; var7 < 4; ++var7) { + float var23 = 0.25F; + this.worldObj.spawnParticle("bubble", this.posX - this.motionX * (double)var23, this.posY - this.motionY * (double)var23, this.posZ - this.motionZ * (double)var23, this.motionX, this.motionY, this.motionZ); + } + + var19 = 0.8F; + } + + this.motionX *= (double)var19; + this.motionY *= (double)var19; + this.motionZ *= (double)var19; + this.motionY -= (double)var22; + this.setPosition(this.posX, this.posY, this.posZ); + } + + public void writeEntityToNBT(NBTTagCompound var1) { + var1.setShort("xTile", (short)this.field_20056_b); + var1.setShort("yTile", (short)this.field_20055_c); + var1.setShort("zTile", (short)this.field_20054_d); + var1.setByte("inTile", (byte)this.field_20053_e); + var1.setByte("shake", (byte)this.field_20057_a); + var1.setByte("inGround", (byte)(this.field_20052_f ? 1 : 0)); + } + + public void readEntityFromNBT(NBTTagCompound var1) { + this.field_20056_b = var1.getShort("xTile"); + this.field_20055_c = var1.getShort("yTile"); + this.field_20054_d = var1.getShort("zTile"); + this.field_20053_e = var1.getByte("inTile") & 255; + this.field_20057_a = var1.getByte("shake") & 255; + this.field_20052_f = var1.getByte("inGround") == 1; + } + + public void onCollideWithPlayer(EntityPlayer var1) { + if(this.field_20052_f && this.field_20051_g == var1 && this.field_20057_a <= 0 && var1.inventory.addItemStackToInventory(new ItemStack(Item.arrow, 1))) { + this.worldObj.playSoundAtEntity(this, "random.pop", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); + var1.onItemPickup(this, 1); + this.setEntityDead(); + } + + } + + public float getShadowSize() { + return 0.0F; + } +} diff --git a/src/net/minecraft/src/EntityExplodeFX.java b/src/net/minecraft/src/EntityExplodeFX.java new file mode 100644 index 0000000..9efd5f1 --- /dev/null +++ b/src/net/minecraft/src/EntityExplodeFX.java @@ -0,0 +1,38 @@ +package net.minecraft.src; + +public class EntityExplodeFX extends EntityFX { + public EntityExplodeFX(World var1, double var2, double var4, double var6, double var8, double var10, double var12) { + super(var1, var2, var4, var6, var8, var10, var12); + this.motionX = var8 + (double)((float)(Math.random() * 2.0D - 1.0D) * 0.05F); + this.motionY = var10 + (double)((float)(Math.random() * 2.0D - 1.0D) * 0.05F); + this.motionZ = var12 + (double)((float)(Math.random() * 2.0D - 1.0D) * 0.05F); + this.particleRed = this.particleGreen = this.particleBlue = this.rand.nextFloat() * 0.3F + 0.7F; + this.particleScale = this.rand.nextFloat() * this.rand.nextFloat() * 6.0F + 1.0F; + this.particleMaxAge = (int)(16.0D / ((double)this.rand.nextFloat() * 0.8D + 0.2D)) + 2; + } + + public void renderParticle(Tessellator var1, float var2, float var3, float var4, float var5, float var6, float var7) { + super.renderParticle(var1, var2, var3, var4, var5, var6, var7); + } + + public void onUpdate() { + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + if(this.particleAge++ >= this.particleMaxAge) { + this.setEntityDead(); + } + + this.particleTextureIndex = 7 - this.particleAge * 8 / this.particleMaxAge; + this.motionY += 0.004D; + this.moveEntity(this.motionX, this.motionY, this.motionZ); + this.motionX *= (double)0.9F; + this.motionY *= (double)0.9F; + this.motionZ *= (double)0.9F; + if(this.onGround) { + this.motionX *= (double)0.7F; + this.motionZ *= (double)0.7F; + } + + } +} diff --git a/src/net/minecraft/src/EntityFX.java b/src/net/minecraft/src/EntityFX.java new file mode 100644 index 0000000..e20e6ba --- /dev/null +++ b/src/net/minecraft/src/EntityFX.java @@ -0,0 +1,105 @@ +package net.minecraft.src; + +public class EntityFX extends Entity { + protected int particleTextureIndex; + protected float particleTextureJitterX; + protected float particleTextureJitterY; + protected int particleAge = 0; + protected int particleMaxAge = 0; + protected float particleScale; + protected float particleGravity; + protected float particleRed; + protected float particleGreen; + protected float particleBlue; + public static double interpPosX; + public static double interpPosY; + public static double interpPosZ; + + public EntityFX(World var1, double var2, double var4, double var6, double var8, double var10, double var12) { + super(var1); + this.setSize(0.2F, 0.2F); + this.yOffset = this.height / 2.0F; + this.setPosition(var2, var4, var6); + this.particleRed = this.particleGreen = this.particleBlue = 1.0F; + this.motionX = var8 + (double)((float)(Math.random() * 2.0D - 1.0D) * 0.4F); + this.motionY = var10 + (double)((float)(Math.random() * 2.0D - 1.0D) * 0.4F); + this.motionZ = var12 + (double)((float)(Math.random() * 2.0D - 1.0D) * 0.4F); + float var14 = (float)(Math.random() + Math.random() + 1.0D) * 0.15F; + float var15 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ); + this.motionX = this.motionX / (double)var15 * (double)var14 * (double)0.4F; + this.motionY = this.motionY / (double)var15 * (double)var14 * (double)0.4F + (double)0.1F; + this.motionZ = this.motionZ / (double)var15 * (double)var14 * (double)0.4F; + this.particleTextureJitterX = this.rand.nextFloat() * 3.0F; + this.particleTextureJitterY = this.rand.nextFloat() * 3.0F; + this.particleScale = (this.rand.nextFloat() * 0.5F + 0.5F) * 2.0F; + this.particleMaxAge = (int)(4.0F / (this.rand.nextFloat() * 0.9F + 0.1F)); + this.particleAge = 0; + } + + public EntityFX func_407_b(float var1) { + this.motionX *= (double)var1; + this.motionY = (this.motionY - (double)0.1F) * (double)var1 + (double)0.1F; + this.motionZ *= (double)var1; + return this; + } + + public EntityFX func_405_d(float var1) { + this.setSize(0.2F * var1, 0.2F * var1); + this.particleScale *= var1; + return this; + } + + protected boolean canTriggerWalking() { + return false; + } + + protected void entityInit() { + } + + public void onUpdate() { + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + if(this.particleAge++ >= this.particleMaxAge) { + this.setEntityDead(); + } + + this.motionY -= 0.04D * (double)this.particleGravity; + this.moveEntity(this.motionX, this.motionY, this.motionZ); + this.motionX *= (double)0.98F; + this.motionY *= (double)0.98F; + this.motionZ *= (double)0.98F; + if(this.onGround) { + this.motionX *= (double)0.7F; + this.motionZ *= (double)0.7F; + } + + } + + public void renderParticle(Tessellator var1, float var2, float var3, float var4, float var5, float var6, float var7) { + float var8 = (float)(this.particleTextureIndex % 16) / 16.0F; + float var9 = var8 + 0.999F / 16.0F; + float var10 = (float)(this.particleTextureIndex / 16) / 16.0F; + float var11 = var10 + 0.999F / 16.0F; + float var12 = 0.1F * this.particleScale; + float var13 = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)var2 - interpPosX); + float var14 = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)var2 - interpPosY); + float var15 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)var2 - interpPosZ); + float var16 = this.getEntityBrightness(var2); + var1.setColorOpaque_F(this.particleRed * var16, this.particleGreen * var16, this.particleBlue * var16); + var1.addVertexWithUV((double)(var13 - var3 * var12 - var6 * var12), (double)(var14 - var4 * var12), (double)(var15 - var5 * var12 - var7 * var12), (double)var9, (double)var11); + var1.addVertexWithUV((double)(var13 - var3 * var12 + var6 * var12), (double)(var14 + var4 * var12), (double)(var15 - var5 * var12 + var7 * var12), (double)var9, (double)var10); + var1.addVertexWithUV((double)(var13 + var3 * var12 + var6 * var12), (double)(var14 + var4 * var12), (double)(var15 + var5 * var12 + var7 * var12), (double)var8, (double)var10); + var1.addVertexWithUV((double)(var13 + var3 * var12 - var6 * var12), (double)(var14 - var4 * var12), (double)(var15 + var5 * var12 - var7 * var12), (double)var8, (double)var11); + } + + public int getFXLayer() { + return 0; + } + + public void writeEntityToNBT(NBTTagCompound var1) { + } + + public void readEntityFromNBT(NBTTagCompound var1) { + } +} diff --git a/src/net/minecraft/src/EntityFallingSand.java b/src/net/minecraft/src/EntityFallingSand.java new file mode 100644 index 0000000..31b7d9c --- /dev/null +++ b/src/net/minecraft/src/EntityFallingSand.java @@ -0,0 +1,88 @@ +package net.minecraft.src; + +public class EntityFallingSand extends Entity { + public int blockID; + public int fallTime = 0; + + public EntityFallingSand(World var1) { + super(var1); + } + + public EntityFallingSand(World var1, double var2, double var4, double var6, int var8) { + super(var1); + this.blockID = var8; + this.preventEntitySpawning = true; + this.setSize(0.98F, 0.98F); + this.yOffset = this.height / 2.0F; + this.setPosition(var2, var4, var6); + this.motionX = 0.0D; + this.motionY = 0.0D; + this.motionZ = 0.0D; + this.prevPosX = var2; + this.prevPosY = var4; + this.prevPosZ = var6; + } + + protected boolean canTriggerWalking() { + return false; + } + + protected void entityInit() { + } + + public boolean canBeCollidedWith() { + return !this.isDead; + } + + public void onUpdate() { + if(this.blockID == 0) { + this.setEntityDead(); + } else { + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + ++this.fallTime; + this.motionY -= (double)0.04F; + this.moveEntity(this.motionX, this.motionY, this.motionZ); + this.motionX *= (double)0.98F; + this.motionY *= (double)0.98F; + this.motionZ *= (double)0.98F; + int var1 = MathHelper.floor_double(this.posX); + int var2 = MathHelper.floor_double(this.posY); + int var3 = MathHelper.floor_double(this.posZ); + if(this.worldObj.getBlockId(var1, var2, var3) == this.blockID) { + this.worldObj.setBlockWithNotify(var1, var2, var3, 0); + } + + if(this.onGround) { + this.motionX *= (double)0.7F; + this.motionZ *= (double)0.7F; + this.motionY *= -0.5D; + this.setEntityDead(); + if((!this.worldObj.canBlockBePlacedAt(this.blockID, var1, var2, var3, true, 1) || BlockSand.canFallBelow(this.worldObj, var1, var2 - 1, var3) || !this.worldObj.setBlockWithNotify(var1, var2, var3, this.blockID)) && !this.worldObj.multiplayerWorld) { + this.dropItem(this.blockID, 1); + } + } else if(this.fallTime > 100 && !this.worldObj.multiplayerWorld) { + this.dropItem(this.blockID, 1); + this.setEntityDead(); + } + + } + } + + protected void writeEntityToNBT(NBTTagCompound var1) { + var1.setByte("Tile", (byte)this.blockID); + } + + protected void readEntityFromNBT(NBTTagCompound var1) { + this.blockID = var1.getByte("Tile") & 255; + } + + public float getShadowSize() { + return 0.0F; + } + + public World getWorld() { + return this.worldObj; + } +} diff --git a/src/net/minecraft/src/EntityFireball.java b/src/net/minecraft/src/EntityFireball.java new file mode 100644 index 0000000..d187537 --- /dev/null +++ b/src/net/minecraft/src/EntityFireball.java @@ -0,0 +1,224 @@ +package net.minecraft.src; + +import java.util.List; + +public class EntityFireball extends Entity { + private int field_9402_e = -1; + private int field_9401_f = -1; + private int field_9400_g = -1; + private int field_9399_h = 0; + private boolean field_9398_i = false; + public int field_9406_a = 0; + public EntityLiving field_9397_j; + private int field_9396_k; + private int field_9395_l = 0; + public double field_9405_b; + public double field_9404_c; + public double field_9403_d; + + public EntityFireball(World var1) { + super(var1); + this.setSize(1.0F, 1.0F); + } + + protected void entityInit() { + } + + public boolean isInRangeToRenderDist(double var1) { + double var3 = this.boundingBox.getAverageEdgeLength() * 4.0D; + var3 *= 64.0D; + return var1 < var3 * var3; + } + + public EntityFireball(World var1, double var2, double var4, double var6, double var8, double var10, double var12) { + super(var1); + this.setSize(1.0F, 1.0F); + this.setLocationAndAngles(var2, var4, var6, this.rotationYaw, this.rotationPitch); + this.setPosition(var2, var4, var6); + double var14 = (double)MathHelper.sqrt_double(var8 * var8 + var10 * var10 + var12 * var12); + this.field_9405_b = var8 / var14 * 0.1D; + this.field_9404_c = var10 / var14 * 0.1D; + this.field_9403_d = var12 / var14 * 0.1D; + } + + public EntityFireball(World var1, EntityLiving var2, double var3, double var5, double var7) { + super(var1); + this.field_9397_j = var2; + this.setSize(1.0F, 1.0F); + this.setLocationAndAngles(var2.posX, var2.posY, var2.posZ, var2.rotationYaw, var2.rotationPitch); + this.setPosition(this.posX, this.posY, this.posZ); + this.yOffset = 0.0F; + this.motionX = this.motionY = this.motionZ = 0.0D; + var3 += this.rand.nextGaussian() * 0.4D; + var5 += this.rand.nextGaussian() * 0.4D; + var7 += this.rand.nextGaussian() * 0.4D; + double var9 = (double)MathHelper.sqrt_double(var3 * var3 + var5 * var5 + var7 * var7); + this.field_9405_b = var3 / var9 * 0.1D; + this.field_9404_c = var5 / var9 * 0.1D; + this.field_9403_d = var7 / var9 * 0.1D; + } + + public void onUpdate() { + super.onUpdate(); + this.fire = 10; + if(this.field_9406_a > 0) { + --this.field_9406_a; + } + + if(this.field_9398_i) { + int var1 = this.worldObj.getBlockId(this.field_9402_e, this.field_9401_f, this.field_9400_g); + if(var1 == this.field_9399_h) { + ++this.field_9396_k; + if(this.field_9396_k == 1200) { + this.setEntityDead(); + } + + return; + } + + this.field_9398_i = false; + this.motionX *= (double)(this.rand.nextFloat() * 0.2F); + this.motionY *= (double)(this.rand.nextFloat() * 0.2F); + this.motionZ *= (double)(this.rand.nextFloat() * 0.2F); + this.field_9396_k = 0; + this.field_9395_l = 0; + } else { + ++this.field_9395_l; + } + + Vec3D var15 = Vec3D.createVector(this.posX, this.posY, this.posZ); + Vec3D var2 = Vec3D.createVector(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); + MovingObjectPosition var3 = this.worldObj.rayTraceBlocks(var15, var2); + var15 = Vec3D.createVector(this.posX, this.posY, this.posZ); + var2 = Vec3D.createVector(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); + if(var3 != null) { + var2 = Vec3D.createVector(var3.hitVec.xCoord, var3.hitVec.yCoord, var3.hitVec.zCoord); + } + + Entity var4 = null; + List var5 = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D)); + double var6 = 0.0D; + + for(int var8 = 0; var8 < var5.size(); ++var8) { + Entity var9 = (Entity)var5.get(var8); + if(var9.canBeCollidedWith() && (var9 != this.field_9397_j || this.field_9395_l >= 25)) { + float var10 = 0.3F; + AxisAlignedBB var11 = var9.boundingBox.expand((double)var10, (double)var10, (double)var10); + MovingObjectPosition var12 = var11.func_1169_a(var15, var2); + if(var12 != null) { + double var13 = var15.distanceTo(var12.hitVec); + if(var13 < var6 || var6 == 0.0D) { + var4 = var9; + var6 = var13; + } + } + } + } + + if(var4 != null) { + var3 = new MovingObjectPosition(var4); + } + + if(var3 != null) { + if(!this.worldObj.multiplayerWorld) { + if(var3.entityHit != null && var3.entityHit.attackEntityFrom(this.field_9397_j, 0)) { + } + + this.worldObj.newExplosion((Entity)null, this.posX, this.posY, this.posZ, 1.0F, true); + } + + this.setEntityDead(); + } + + this.posX += this.motionX; + this.posY += this.motionY; + this.posZ += this.motionZ; + float var16 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); + this.rotationYaw = (float)(Math.atan2(this.motionX, this.motionZ) * 180.0D / (double)((float)Math.PI)); + + for(this.rotationPitch = (float)(Math.atan2(this.motionY, (double)var16) * 180.0D / (double)((float)Math.PI)); this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F) { + } + + while(this.rotationPitch - this.prevRotationPitch >= 180.0F) { + this.prevRotationPitch += 360.0F; + } + + while(this.rotationYaw - this.prevRotationYaw < -180.0F) { + this.prevRotationYaw -= 360.0F; + } + + while(this.rotationYaw - this.prevRotationYaw >= 180.0F) { + this.prevRotationYaw += 360.0F; + } + + this.rotationPitch = this.prevRotationPitch + (this.rotationPitch - this.prevRotationPitch) * 0.2F; + this.rotationYaw = this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * 0.2F; + float var17 = 0.95F; + if(this.isInWater()) { + for(int var18 = 0; var18 < 4; ++var18) { + float var19 = 0.25F; + this.worldObj.spawnParticle("bubble", this.posX - this.motionX * (double)var19, this.posY - this.motionY * (double)var19, this.posZ - this.motionZ * (double)var19, this.motionX, this.motionY, this.motionZ); + } + + var17 = 0.8F; + } + + this.motionX += this.field_9405_b; + this.motionY += this.field_9404_c; + this.motionZ += this.field_9403_d; + this.motionX *= (double)var17; + this.motionY *= (double)var17; + this.motionZ *= (double)var17; + this.worldObj.spawnParticle("smoke", this.posX, this.posY + 0.5D, this.posZ, 0.0D, 0.0D, 0.0D); + this.setPosition(this.posX, this.posY, this.posZ); + } + + public void writeEntityToNBT(NBTTagCompound var1) { + var1.setShort("xTile", (short)this.field_9402_e); + var1.setShort("yTile", (short)this.field_9401_f); + var1.setShort("zTile", (short)this.field_9400_g); + var1.setByte("inTile", (byte)this.field_9399_h); + var1.setByte("shake", (byte)this.field_9406_a); + var1.setByte("inGround", (byte)(this.field_9398_i ? 1 : 0)); + } + + public void readEntityFromNBT(NBTTagCompound var1) { + this.field_9402_e = var1.getShort("xTile"); + this.field_9401_f = var1.getShort("yTile"); + this.field_9400_g = var1.getShort("zTile"); + this.field_9399_h = var1.getByte("inTile") & 255; + this.field_9406_a = var1.getByte("shake") & 255; + this.field_9398_i = var1.getByte("inGround") == 1; + } + + public boolean canBeCollidedWith() { + return true; + } + + public float getCollisionBorderSize() { + return 1.0F; + } + + public boolean attackEntityFrom(Entity var1, int var2) { + this.setBeenAttacked(); + if(var1 != null) { + Vec3D var3 = var1.getLookVec(); + if(var3 != null) { + this.motionX = var3.xCoord; + this.motionY = var3.yCoord; + this.motionZ = var3.zCoord; + this.field_9405_b = this.motionX * 0.1D; + this.field_9404_c = this.motionY * 0.1D; + this.field_9403_d = this.motionZ * 0.1D; + } + + return true; + } else { + return false; + } + } + + public float getShadowSize() { + return 0.0F; + } +} diff --git a/src/net/minecraft/src/EntityFish.java b/src/net/minecraft/src/EntityFish.java new file mode 100644 index 0000000..68cf63a --- /dev/null +++ b/src/net/minecraft/src/EntityFish.java @@ -0,0 +1,381 @@ +package net.minecraft.src; + +import java.util.List; + +public class EntityFish extends Entity { + private int xTile; + private int yTile; + private int zTile; + private int inTile; + private boolean inGround; + public int shake; + public EntityPlayer angler; + private int ticksInGround; + private int ticksInAir; + private int ticksCatchable; + public Entity bobber; + private int field_6388_l; + private double field_6387_m; + private double field_6386_n; + private double field_6385_o; + private double field_6384_p; + private double field_6383_q; + private double velocityX; + private double velocityY; + private double velocityZ; + + public EntityFish(World var1) { + super(var1); + this.xTile = -1; + this.yTile = -1; + this.zTile = -1; + this.inTile = 0; + this.inGround = false; + this.shake = 0; + this.ticksInAir = 0; + this.ticksCatchable = 0; + this.bobber = null; + this.setSize(0.25F, 0.25F); + this.ignoreFrustumCheck = true; + } + + public EntityFish(World var1, double var2, double var4, double var6) { + this(var1); + this.setPosition(var2, var4, var6); + this.ignoreFrustumCheck = true; + } + + public EntityFish(World var1, EntityPlayer var2) { + super(var1); + this.xTile = -1; + this.yTile = -1; + this.zTile = -1; + this.inTile = 0; + this.inGround = false; + this.shake = 0; + this.ticksInAir = 0; + this.ticksCatchable = 0; + this.bobber = null; + this.ignoreFrustumCheck = true; + this.angler = var2; + this.angler.fishEntity = this; + this.setSize(0.25F, 0.25F); + this.setLocationAndAngles(var2.posX, var2.posY + 1.62D - (double)var2.yOffset, var2.posZ, var2.rotationYaw, var2.rotationPitch); + this.posX -= (double)(MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * 0.16F); + this.posY -= (double)0.1F; + this.posZ -= (double)(MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * 0.16F); + this.setPosition(this.posX, this.posY, this.posZ); + this.yOffset = 0.0F; + float var3 = 0.4F; + this.motionX = (double)(-MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI) * var3); + this.motionZ = (double)(MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI) * var3); + this.motionY = (double)(-MathHelper.sin(this.rotationPitch / 180.0F * (float)Math.PI) * var3); + this.func_4042_a(this.motionX, this.motionY, this.motionZ, 1.5F, 1.0F); + } + + protected void entityInit() { + } + + public boolean isInRangeToRenderDist(double var1) { + double var3 = this.boundingBox.getAverageEdgeLength() * 4.0D; + var3 *= 64.0D; + return var1 < var3 * var3; + } + + public void func_4042_a(double var1, double var3, double var5, float var7, float var8) { + float var9 = MathHelper.sqrt_double(var1 * var1 + var3 * var3 + var5 * var5); + var1 /= (double)var9; + var3 /= (double)var9; + var5 /= (double)var9; + var1 += this.rand.nextGaussian() * (double)0.0075F * (double)var8; + var3 += this.rand.nextGaussian() * (double)0.0075F * (double)var8; + var5 += this.rand.nextGaussian() * (double)0.0075F * (double)var8; + var1 *= (double)var7; + var3 *= (double)var7; + var5 *= (double)var7; + this.motionX = var1; + this.motionY = var3; + this.motionZ = var5; + float var10 = MathHelper.sqrt_double(var1 * var1 + var5 * var5); + this.prevRotationYaw = this.rotationYaw = (float)(Math.atan2(var1, var5) * 180.0D / (double)((float)Math.PI)); + this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(var3, (double)var10) * 180.0D / (double)((float)Math.PI)); + this.ticksInGround = 0; + } + + public void setPositionAndRotation2(double var1, double var3, double var5, float var7, float var8, int var9) { + this.field_6387_m = var1; + this.field_6386_n = var3; + this.field_6385_o = var5; + this.field_6384_p = (double)var7; + this.field_6383_q = (double)var8; + this.field_6388_l = var9; + this.motionX = this.velocityX; + this.motionY = this.velocityY; + this.motionZ = this.velocityZ; + } + + public void setVelocity(double var1, double var3, double var5) { + this.velocityX = this.motionX = var1; + this.velocityY = this.motionY = var3; + this.velocityZ = this.motionZ = var5; + } + + public void onUpdate() { + super.onUpdate(); + if(this.field_6388_l > 0) { + double var21 = this.posX + (this.field_6387_m - this.posX) / (double)this.field_6388_l; + double var22 = this.posY + (this.field_6386_n - this.posY) / (double)this.field_6388_l; + double var23 = this.posZ + (this.field_6385_o - this.posZ) / (double)this.field_6388_l; + + double var7; + for(var7 = this.field_6384_p - (double)this.rotationYaw; var7 < -180.0D; var7 += 360.0D) { + } + + while(var7 >= 180.0D) { + var7 -= 360.0D; + } + + this.rotationYaw = (float)((double)this.rotationYaw + var7 / (double)this.field_6388_l); + this.rotationPitch = (float)((double)this.rotationPitch + (this.field_6383_q - (double)this.rotationPitch) / (double)this.field_6388_l); + --this.field_6388_l; + this.setPosition(var21, var22, var23); + this.setRotation(this.rotationYaw, this.rotationPitch); + } else { + if(!this.worldObj.multiplayerWorld) { + ItemStack var1 = this.angler.getCurrentEquippedItem(); + if(this.angler.isDead || !this.angler.isEntityAlive() || var1 == null || var1.getItem() != Item.fishingRod || this.getDistanceSqToEntity(this.angler) > 1024.0D) { + this.setEntityDead(); + this.angler.fishEntity = null; + return; + } + + if(this.bobber != null) { + if(!this.bobber.isDead) { + this.posX = this.bobber.posX; + this.posY = this.bobber.boundingBox.minY + (double)this.bobber.height * 0.8D; + this.posZ = this.bobber.posZ; + return; + } + + this.bobber = null; + } + } + + if(this.shake > 0) { + --this.shake; + } + + if(this.inGround) { + int var19 = this.worldObj.getBlockId(this.xTile, this.yTile, this.zTile); + if(var19 == this.inTile) { + ++this.ticksInGround; + if(this.ticksInGround == 1200) { + this.setEntityDead(); + } + + return; + } + + this.inGround = false; + this.motionX *= (double)(this.rand.nextFloat() * 0.2F); + this.motionY *= (double)(this.rand.nextFloat() * 0.2F); + this.motionZ *= (double)(this.rand.nextFloat() * 0.2F); + this.ticksInGround = 0; + this.ticksInAir = 0; + } else { + ++this.ticksInAir; + } + + Vec3D var20 = Vec3D.createVector(this.posX, this.posY, this.posZ); + Vec3D var2 = Vec3D.createVector(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); + MovingObjectPosition var3 = this.worldObj.rayTraceBlocks(var20, var2); + var20 = Vec3D.createVector(this.posX, this.posY, this.posZ); + var2 = Vec3D.createVector(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); + if(var3 != null) { + var2 = Vec3D.createVector(var3.hitVec.xCoord, var3.hitVec.yCoord, var3.hitVec.zCoord); + } + + Entity var4 = null; + List var5 = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D)); + double var6 = 0.0D; + + double var13; + for(int var8 = 0; var8 < var5.size(); ++var8) { + Entity var9 = (Entity)var5.get(var8); + if(var9.canBeCollidedWith() && (var9 != this.angler || this.ticksInAir >= 5)) { + float var10 = 0.3F; + AxisAlignedBB var11 = var9.boundingBox.expand((double)var10, (double)var10, (double)var10); + MovingObjectPosition var12 = var11.func_1169_a(var20, var2); + if(var12 != null) { + var13 = var20.distanceTo(var12.hitVec); + if(var13 < var6 || var6 == 0.0D) { + var4 = var9; + var6 = var13; + } + } + } + } + + if(var4 != null) { + var3 = new MovingObjectPosition(var4); + } + + if(var3 != null) { + if(var3.entityHit != null) { + if(var3.entityHit.attackEntityFrom(this.angler, 0)) { + this.bobber = var3.entityHit; + } + } else { + this.inGround = true; + } + } + + if(!this.inGround) { + this.moveEntity(this.motionX, this.motionY, this.motionZ); + float var24 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); + this.rotationYaw = (float)(Math.atan2(this.motionX, this.motionZ) * 180.0D / (double)((float)Math.PI)); + + for(this.rotationPitch = (float)(Math.atan2(this.motionY, (double)var24) * 180.0D / (double)((float)Math.PI)); this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F) { + } + + while(this.rotationPitch - this.prevRotationPitch >= 180.0F) { + this.prevRotationPitch += 360.0F; + } + + while(this.rotationYaw - this.prevRotationYaw < -180.0F) { + this.prevRotationYaw -= 360.0F; + } + + while(this.rotationYaw - this.prevRotationYaw >= 180.0F) { + this.prevRotationYaw += 360.0F; + } + + this.rotationPitch = this.prevRotationPitch + (this.rotationPitch - this.prevRotationPitch) * 0.2F; + this.rotationYaw = this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * 0.2F; + float var25 = 0.92F; + if(this.onGround || this.isCollidedHorizontally) { + var25 = 0.5F; + } + + byte var26 = 5; + double var27 = 0.0D; + + for(int var28 = 0; var28 < var26; ++var28) { + double var14 = this.boundingBox.minY + (this.boundingBox.maxY - this.boundingBox.minY) * (double)(var28 + 0) / (double)var26 - 0.125D + 0.125D; + double var16 = this.boundingBox.minY + (this.boundingBox.maxY - this.boundingBox.minY) * (double)(var28 + 1) / (double)var26 - 0.125D + 0.125D; + AxisAlignedBB var18 = AxisAlignedBB.getBoundingBoxFromPool(this.boundingBox.minX, var14, this.boundingBox.minZ, this.boundingBox.maxX, var16, this.boundingBox.maxZ); + if(this.worldObj.isAABBInMaterial(var18, Material.water)) { + var27 += 1.0D / (double)var26; + } + } + + if(var27 > 0.0D) { + if(this.ticksCatchable > 0) { + --this.ticksCatchable; + } else { + short var29 = 500; + if(this.worldObj.canBlockBeRainedOn(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY) + 1, MathHelper.floor_double(this.posZ))) { + var29 = 300; + } + + if(this.rand.nextInt(var29) == 0) { + this.ticksCatchable = this.rand.nextInt(30) + 10; + this.motionY -= (double)0.2F; + this.worldObj.playSoundAtEntity(this, "random.splash", 0.25F, 1.0F + (this.rand.nextFloat() - this.rand.nextFloat()) * 0.4F); + float var30 = (float)MathHelper.floor_double(this.boundingBox.minY); + + int var15; + float var17; + float var31; + for(var15 = 0; (float)var15 < 1.0F + this.width * 20.0F; ++var15) { + var31 = (this.rand.nextFloat() * 2.0F - 1.0F) * this.width; + var17 = (this.rand.nextFloat() * 2.0F - 1.0F) * this.width; + this.worldObj.spawnParticle("bubble", this.posX + (double)var31, (double)(var30 + 1.0F), this.posZ + (double)var17, this.motionX, this.motionY - (double)(this.rand.nextFloat() * 0.2F), this.motionZ); + } + + for(var15 = 0; (float)var15 < 1.0F + this.width * 20.0F; ++var15) { + var31 = (this.rand.nextFloat() * 2.0F - 1.0F) * this.width; + var17 = (this.rand.nextFloat() * 2.0F - 1.0F) * this.width; + this.worldObj.spawnParticle("splash", this.posX + (double)var31, (double)(var30 + 1.0F), this.posZ + (double)var17, this.motionX, this.motionY, this.motionZ); + } + } + } + } + + if(this.ticksCatchable > 0) { + this.motionY -= (double)(this.rand.nextFloat() * this.rand.nextFloat() * this.rand.nextFloat()) * 0.2D; + } + + var13 = var27 * 2.0D - 1.0D; + this.motionY += (double)0.04F * var13; + if(var27 > 0.0D) { + var25 = (float)((double)var25 * 0.9D); + this.motionY *= 0.8D; + } + + this.motionX *= (double)var25; + this.motionY *= (double)var25; + this.motionZ *= (double)var25; + this.setPosition(this.posX, this.posY, this.posZ); + } + } + } + + public void writeEntityToNBT(NBTTagCompound var1) { + var1.setShort("xTile", (short)this.xTile); + var1.setShort("yTile", (short)this.yTile); + var1.setShort("zTile", (short)this.zTile); + var1.setByte("inTile", (byte)this.inTile); + var1.setByte("shake", (byte)this.shake); + var1.setByte("inGround", (byte)(this.inGround ? 1 : 0)); + } + + public void readEntityFromNBT(NBTTagCompound var1) { + this.xTile = var1.getShort("xTile"); + this.yTile = var1.getShort("yTile"); + this.zTile = var1.getShort("zTile"); + this.inTile = var1.getByte("inTile") & 255; + this.shake = var1.getByte("shake") & 255; + this.inGround = var1.getByte("inGround") == 1; + } + + public float getShadowSize() { + return 0.0F; + } + + public int catchFish() { + byte var1 = 0; + if(this.bobber != null) { + double var2 = this.angler.posX - this.posX; + double var4 = this.angler.posY - this.posY; + double var6 = this.angler.posZ - this.posZ; + double var8 = (double)MathHelper.sqrt_double(var2 * var2 + var4 * var4 + var6 * var6); + double var10 = 0.1D; + this.bobber.motionX += var2 * var10; + this.bobber.motionY += var4 * var10 + (double)MathHelper.sqrt_double(var8) * 0.08D; + this.bobber.motionZ += var6 * var10; + var1 = 3; + } else if(this.ticksCatchable > 0) { + EntityItem var13 = new EntityItem(this.worldObj, this.posX, this.posY, this.posZ, new ItemStack(Item.fishRaw)); + double var3 = this.angler.posX - this.posX; + double var5 = this.angler.posY - this.posY; + double var7 = this.angler.posZ - this.posZ; + double var9 = (double)MathHelper.sqrt_double(var3 * var3 + var5 * var5 + var7 * var7); + double var11 = 0.1D; + var13.motionX = var3 * var11; + var13.motionY = var5 * var11 + (double)MathHelper.sqrt_double(var9) * 0.08D; + var13.motionZ = var7 * var11; + this.worldObj.entityJoinedWorld(var13); + this.angler.addStat(StatList.fishCaughtStat, 1); + var1 = 1; + } + + if(this.inGround) { + var1 = 2; + } + + this.setEntityDead(); + this.angler.fishEntity = null; + return var1; + } +} diff --git a/src/net/minecraft/src/EntityFlameFX.java b/src/net/minecraft/src/EntityFlameFX.java new file mode 100644 index 0000000..61961cf --- /dev/null +++ b/src/net/minecraft/src/EntityFlameFX.java @@ -0,0 +1,59 @@ +package net.minecraft.src; + +public class EntityFlameFX extends EntityFX { + private float field_672_a; + + public EntityFlameFX(World var1, double var2, double var4, double var6, double var8, double var10, double var12) { + super(var1, var2, var4, var6, var8, var10, var12); + this.motionX = this.motionX * (double)0.01F + var8; + this.motionY = this.motionY * (double)0.01F + var10; + this.motionZ = this.motionZ * (double)0.01F + var12; + double var10000 = var2 + (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.05F); + var10000 = var4 + (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.05F); + var10000 = var6 + (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.05F); + this.field_672_a = this.particleScale; + this.particleRed = this.particleGreen = this.particleBlue = 1.0F; + this.particleMaxAge = (int)(8.0D / (Math.random() * 0.8D + 0.2D)) + 4; + this.noClip = true; + this.particleTextureIndex = 48; + } + + public void renderParticle(Tessellator var1, float var2, float var3, float var4, float var5, float var6, float var7) { + float var8 = ((float)this.particleAge + var2) / (float)this.particleMaxAge; + this.particleScale = this.field_672_a * (1.0F - var8 * var8 * 0.5F); + super.renderParticle(var1, var2, var3, var4, var5, var6, var7); + } + + public float getEntityBrightness(float var1) { + float var2 = ((float)this.particleAge + var1) / (float)this.particleMaxAge; + if(var2 < 0.0F) { + var2 = 0.0F; + } + + if(var2 > 1.0F) { + var2 = 1.0F; + } + + float var3 = super.getEntityBrightness(var1); + return var3 * var2 + (1.0F - var2); + } + + public void onUpdate() { + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + if(this.particleAge++ >= this.particleMaxAge) { + this.setEntityDead(); + } + + this.moveEntity(this.motionX, this.motionY, this.motionZ); + this.motionX *= (double)0.96F; + this.motionY *= (double)0.96F; + this.motionZ *= (double)0.96F; + if(this.onGround) { + this.motionX *= (double)0.7F; + this.motionZ *= (double)0.7F; + } + + } +} diff --git a/src/net/minecraft/src/EntityFlying.java b/src/net/minecraft/src/EntityFlying.java new file mode 100644 index 0000000..58a9044 --- /dev/null +++ b/src/net/minecraft/src/EntityFlying.java @@ -0,0 +1,66 @@ +package net.minecraft.src; + +public class EntityFlying extends EntityLiving { + public EntityFlying(World var1) { + super(var1); + } + + protected void fall(float var1) { + } + + public void moveEntityWithHeading(float var1, float var2) { + if(this.isInWater()) { + this.moveFlying(var1, var2, 0.02F); + this.moveEntity(this.motionX, this.motionY, this.motionZ); + this.motionX *= (double)0.8F; + this.motionY *= (double)0.8F; + this.motionZ *= (double)0.8F; + } else if(this.handleLavaMovement()) { + this.moveFlying(var1, var2, 0.02F); + this.moveEntity(this.motionX, this.motionY, this.motionZ); + this.motionX *= 0.5D; + this.motionY *= 0.5D; + this.motionZ *= 0.5D; + } else { + float var3 = 0.91F; + if(this.onGround) { + var3 = 546.0F * 0.1F * 0.1F * 0.1F; + int var4 = this.worldObj.getBlockId(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.boundingBox.minY) - 1, MathHelper.floor_double(this.posZ)); + if(var4 > 0) { + var3 = Block.blocksList[var4].slipperiness * 0.91F; + } + } + + float var8 = 0.16277136F / (var3 * var3 * var3); + this.moveFlying(var1, var2, this.onGround ? 0.1F * var8 : 0.02F); + var3 = 0.91F; + if(this.onGround) { + var3 = 546.0F * 0.1F * 0.1F * 0.1F; + int var5 = this.worldObj.getBlockId(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.boundingBox.minY) - 1, MathHelper.floor_double(this.posZ)); + if(var5 > 0) { + var3 = Block.blocksList[var5].slipperiness * 0.91F; + } + } + + this.moveEntity(this.motionX, this.motionY, this.motionZ); + this.motionX *= (double)var3; + this.motionY *= (double)var3; + this.motionZ *= (double)var3; + } + + this.field_705_Q = this.field_704_R; + double var10 = this.posX - this.prevPosX; + double var9 = this.posZ - this.prevPosZ; + float var7 = MathHelper.sqrt_double(var10 * var10 + var9 * var9) * 4.0F; + if(var7 > 1.0F) { + var7 = 1.0F; + } + + this.field_704_R += (var7 - this.field_704_R) * 0.4F; + this.field_703_S += this.field_704_R; + } + + public boolean isOnLadder() { + return false; + } +} diff --git a/src/net/minecraft/src/EntityFootStepFX.java b/src/net/minecraft/src/EntityFootStepFX.java new file mode 100644 index 0000000..0cbb333 --- /dev/null +++ b/src/net/minecraft/src/EntityFootStepFX.java @@ -0,0 +1,57 @@ +package net.minecraft.src; + +import org.lwjgl.opengl.GL11; + +public class EntityFootStepFX extends EntityFX { + private int field_27018_a = 0; + private int field_27020_o = 0; + private RenderEngine field_27019_p; + + public EntityFootStepFX(RenderEngine var1, World var2, double var3, double var5, double var7) { + super(var2, var3, var5, var7, 0.0D, 0.0D, 0.0D); + this.field_27019_p = var1; + this.motionX = this.motionY = this.motionZ = 0.0D; + this.field_27020_o = 200; + } + + public void renderParticle(Tessellator var1, float var2, float var3, float var4, float var5, float var6, float var7) { + float var8 = ((float)this.field_27018_a + var2) / (float)this.field_27020_o; + var8 *= var8; + float var9 = 2.0F - var8 * 2.0F; + if(var9 > 1.0F) { + var9 = 1.0F; + } + + var9 *= 0.2F; + GL11.glDisable(GL11.GL_LIGHTING); + float var10 = 2.0F / 16.0F; + float var11 = (float)(this.posX - interpPosX); + float var12 = (float)(this.posY - interpPosY); + float var13 = (float)(this.posZ - interpPosZ); + float var14 = this.worldObj.getLightBrightness(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ)); + this.field_27019_p.bindTexture(this.field_27019_p.getTexture("/misc/footprint.png")); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + var1.startDrawingQuads(); + var1.setColorRGBA_F(var14, var14, var14, var9); + var1.addVertexWithUV((double)(var11 - var10), (double)var12, (double)(var13 + var10), 0.0D, 1.0D); + var1.addVertexWithUV((double)(var11 + var10), (double)var12, (double)(var13 + var10), 1.0D, 1.0D); + var1.addVertexWithUV((double)(var11 + var10), (double)var12, (double)(var13 - var10), 1.0D, 0.0D); + var1.addVertexWithUV((double)(var11 - var10), (double)var12, (double)(var13 - var10), 0.0D, 0.0D); + var1.draw(); + GL11.glDisable(GL11.GL_BLEND); + GL11.glEnable(GL11.GL_LIGHTING); + } + + public void onUpdate() { + ++this.field_27018_a; + if(this.field_27018_a == this.field_27020_o) { + this.setEntityDead(); + } + + } + + public int getFXLayer() { + return 3; + } +} diff --git a/src/net/minecraft/src/EntityGhast.java b/src/net/minecraft/src/EntityGhast.java new file mode 100644 index 0000000..c329924 --- /dev/null +++ b/src/net/minecraft/src/EntityGhast.java @@ -0,0 +1,158 @@ +package net.minecraft.src; + +public class EntityGhast extends EntityFlying implements IMob { + public int courseChangeCooldown = 0; + public double waypointX; + public double waypointY; + public double waypointZ; + private Entity targetedEntity = null; + private int aggroCooldown = 0; + public int prevAttackCounter = 0; + public int attackCounter = 0; + + public EntityGhast(World var1) { + super(var1); + this.texture = "/mob/ghast.png"; + this.setSize(4.0F, 4.0F); + this.isImmuneToFire = true; + } + + protected void entityInit() { + super.entityInit(); + this.dataWatcher.addObject(16, Byte.valueOf((byte)0)); + } + + public void onUpdate() { + super.onUpdate(); + byte var1 = this.dataWatcher.getWatchableObjectByte(16); + this.texture = var1 == 1 ? "/mob/ghast_fire.png" : "/mob/ghast.png"; + } + + protected void updatePlayerActionState() { + if(!this.worldObj.multiplayerWorld && this.worldObj.difficultySetting == 0) { + this.setEntityDead(); + } + + this.func_27021_X(); + this.prevAttackCounter = this.attackCounter; + double var1 = this.waypointX - this.posX; + double var3 = this.waypointY - this.posY; + double var5 = this.waypointZ - this.posZ; + double var7 = (double)MathHelper.sqrt_double(var1 * var1 + var3 * var3 + var5 * var5); + if(var7 < 1.0D || var7 > 60.0D) { + this.waypointX = this.posX + (double)((this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F); + this.waypointY = this.posY + (double)((this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F); + this.waypointZ = this.posZ + (double)((this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F); + } + + if(this.courseChangeCooldown-- <= 0) { + this.courseChangeCooldown += this.rand.nextInt(5) + 2; + if(this.isCourseTraversable(this.waypointX, this.waypointY, this.waypointZ, var7)) { + this.motionX += var1 / var7 * 0.1D; + this.motionY += var3 / var7 * 0.1D; + this.motionZ += var5 / var7 * 0.1D; + } else { + this.waypointX = this.posX; + this.waypointY = this.posY; + this.waypointZ = this.posZ; + } + } + + if(this.targetedEntity != null && this.targetedEntity.isDead) { + this.targetedEntity = null; + } + + if(this.targetedEntity == null || this.aggroCooldown-- <= 0) { + this.targetedEntity = this.worldObj.getClosestPlayerToEntity(this, 100.0D); + if(this.targetedEntity != null) { + this.aggroCooldown = 20; + } + } + + double var9 = 64.0D; + if(this.targetedEntity != null && this.targetedEntity.getDistanceSqToEntity(this) < var9 * var9) { + double var11 = this.targetedEntity.posX - this.posX; + double var13 = this.targetedEntity.boundingBox.minY + (double)(this.targetedEntity.height / 2.0F) - (this.posY + (double)(this.height / 2.0F)); + double var15 = this.targetedEntity.posZ - this.posZ; + this.renderYawOffset = this.rotationYaw = -((float)Math.atan2(var11, var15)) * 180.0F / (float)Math.PI; + if(this.canEntityBeSeen(this.targetedEntity)) { + if(this.attackCounter == 10) { + this.worldObj.playSoundAtEntity(this, "mob.ghast.charge", this.getSoundVolume(), (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F); + } + + ++this.attackCounter; + if(this.attackCounter == 20) { + this.worldObj.playSoundAtEntity(this, "mob.ghast.fireball", this.getSoundVolume(), (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F); + EntityFireball var17 = new EntityFireball(this.worldObj, this, var11, var13, var15); + double var18 = 4.0D; + Vec3D var20 = this.getLook(1.0F); + var17.posX = this.posX + var20.xCoord * var18; + var17.posY = this.posY + (double)(this.height / 2.0F) + 0.5D; + var17.posZ = this.posZ + var20.zCoord * var18; + this.worldObj.entityJoinedWorld(var17); + this.attackCounter = -40; + } + } else if(this.attackCounter > 0) { + --this.attackCounter; + } + } else { + this.renderYawOffset = this.rotationYaw = -((float)Math.atan2(this.motionX, this.motionZ)) * 180.0F / (float)Math.PI; + if(this.attackCounter > 0) { + --this.attackCounter; + } + } + + if(!this.worldObj.multiplayerWorld) { + byte var21 = this.dataWatcher.getWatchableObjectByte(16); + byte var12 = (byte)(this.attackCounter > 10 ? 1 : 0); + if(var21 != var12) { + this.dataWatcher.updateObject(16, Byte.valueOf(var12)); + } + } + + } + + private boolean isCourseTraversable(double var1, double var3, double var5, double var7) { + double var9 = (this.waypointX - this.posX) / var7; + double var11 = (this.waypointY - this.posY) / var7; + double var13 = (this.waypointZ - this.posZ) / var7; + AxisAlignedBB var15 = this.boundingBox.copy(); + + for(int var16 = 1; (double)var16 < var7; ++var16) { + var15.offset(var9, var11, var13); + if(this.worldObj.getCollidingBoundingBoxes(this, var15).size() > 0) { + return false; + } + } + + return true; + } + + protected String getLivingSound() { + return "mob.ghast.moan"; + } + + protected String getHurtSound() { + return "mob.ghast.scream"; + } + + protected String getDeathSound() { + return "mob.ghast.death"; + } + + protected int getDropItemId() { + return Item.gunpowder.shiftedIndex; + } + + protected float getSoundVolume() { + return 10.0F; + } + + public boolean getCanSpawnHere() { + return this.rand.nextInt(20) == 0 && super.getCanSpawnHere() && this.worldObj.difficultySetting > 0; + } + + public int getMaxSpawnedInChunk() { + return 1; + } +} diff --git a/src/net/minecraft/src/EntityGiantZombie.java b/src/net/minecraft/src/EntityGiantZombie.java new file mode 100644 index 0000000..8c544e8 --- /dev/null +++ b/src/net/minecraft/src/EntityGiantZombie.java @@ -0,0 +1,17 @@ +package net.minecraft.src; + +public class EntityGiantZombie extends EntityMob { + public EntityGiantZombie(World var1) { + super(var1); + this.texture = "/mob/zombie.png"; + this.moveSpeed = 0.5F; + this.attackStrength = 50; + this.health *= 10; + this.yOffset *= 6.0F; + this.setSize(this.width * 6.0F, this.height * 6.0F); + } + + protected float getBlockPathWeight(int var1, int var2, int var3) { + return this.worldObj.getLightBrightness(var1, var2, var3) - 0.5F; + } +} diff --git a/src/net/minecraft/src/EntityHeartFX.java b/src/net/minecraft/src/EntityHeartFX.java new file mode 100644 index 0000000..f835faa --- /dev/null +++ b/src/net/minecraft/src/EntityHeartFX.java @@ -0,0 +1,61 @@ +package net.minecraft.src; + +public class EntityHeartFX extends EntityFX { + float field_25022_a; + + public EntityHeartFX(World var1, double var2, double var4, double var6, double var8, double var10, double var12) { + this(var1, var2, var4, var6, var8, var10, var12, 2.0F); + } + + public EntityHeartFX(World var1, double var2, double var4, double var6, double var8, double var10, double var12, float var14) { + super(var1, var2, var4, var6, 0.0D, 0.0D, 0.0D); + this.motionX *= (double)0.01F; + this.motionY *= (double)0.01F; + this.motionZ *= (double)0.01F; + this.motionY += 0.1D; + this.particleScale *= 12.0F / 16.0F; + this.particleScale *= var14; + this.field_25022_a = this.particleScale; + this.particleMaxAge = 16; + this.noClip = false; + this.particleTextureIndex = 80; + } + + public void renderParticle(Tessellator var1, float var2, float var3, float var4, float var5, float var6, float var7) { + float var8 = ((float)this.particleAge + var2) / (float)this.particleMaxAge * 32.0F; + if(var8 < 0.0F) { + var8 = 0.0F; + } + + if(var8 > 1.0F) { + var8 = 1.0F; + } + + this.particleScale = this.field_25022_a * var8; + super.renderParticle(var1, var2, var3, var4, var5, var6, var7); + } + + public void onUpdate() { + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + if(this.particleAge++ >= this.particleMaxAge) { + this.setEntityDead(); + } + + this.moveEntity(this.motionX, this.motionY, this.motionZ); + if(this.posY == this.prevPosY) { + this.motionX *= 1.1D; + this.motionZ *= 1.1D; + } + + this.motionX *= (double)0.86F; + this.motionY *= (double)0.86F; + this.motionZ *= (double)0.86F; + if(this.onGround) { + this.motionX *= (double)0.7F; + this.motionZ *= (double)0.7F; + } + + } +} diff --git a/src/net/minecraft/src/EntityItem.java b/src/net/minecraft/src/EntityItem.java new file mode 100644 index 0000000..8c0790e --- /dev/null +++ b/src/net/minecraft/src/EntityItem.java @@ -0,0 +1,131 @@ +package net.minecraft.src; + +public class EntityItem extends Entity { + public ItemStack item; + private int field_803_e; + public int age = 0; + public int delayBeforeCanPickup; + private int health = 5; + public float field_804_d = (float)(Math.random() * Math.PI * 2.0D); + + public EntityItem(World var1, double var2, double var4, double var6, ItemStack var8) { + super(var1); + this.setSize(0.25F, 0.25F); + this.yOffset = this.height / 2.0F; + this.setPosition(var2, var4, var6); + this.item = var8; + this.rotationYaw = (float)(Math.random() * 360.0D); + this.motionX = (double)((float)(Math.random() * (double)0.2F - (double)0.1F)); + this.motionY = (double)0.2F; + this.motionZ = (double)((float)(Math.random() * (double)0.2F - (double)0.1F)); + } + + protected boolean canTriggerWalking() { + return false; + } + + public EntityItem(World var1) { + super(var1); + this.setSize(0.25F, 0.25F); + this.yOffset = this.height / 2.0F; + } + + protected void entityInit() { + } + + public void onUpdate() { + super.onUpdate(); + if(this.delayBeforeCanPickup > 0) { + --this.delayBeforeCanPickup; + } + + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + this.motionY -= (double)0.04F; + if(this.worldObj.getBlockMaterial(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ)) == Material.lava) { + this.motionY = (double)0.2F; + this.motionX = (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F); + this.motionZ = (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F); + this.worldObj.playSoundAtEntity(this, "random.fizz", 0.4F, 2.0F + this.rand.nextFloat() * 0.4F); + } + + this.pushOutOfBlocks(this.posX, (this.boundingBox.minY + this.boundingBox.maxY) / 2.0D, this.posZ); + this.moveEntity(this.motionX, this.motionY, this.motionZ); + float var1 = 0.98F; + if(this.onGround) { + var1 = 0.1F * 0.1F * 58.8F; + int var2 = this.worldObj.getBlockId(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.boundingBox.minY) - 1, MathHelper.floor_double(this.posZ)); + if(var2 > 0) { + var1 = Block.blocksList[var2].slipperiness * 0.98F; + } + } + + this.motionX *= (double)var1; + this.motionY *= (double)0.98F; + this.motionZ *= (double)var1; + if(this.onGround) { + this.motionY *= -0.5D; + } + + ++this.field_803_e; + ++this.age; + if(this.age >= 6000) { + this.setEntityDead(); + } + + } + + public boolean handleWaterMovement() { + return this.worldObj.handleMaterialAcceleration(this.boundingBox, Material.water, this); + } + + protected void dealFireDamage(int var1) { + this.attackEntityFrom((Entity)null, var1); + } + + public boolean attackEntityFrom(Entity var1, int var2) { + this.setBeenAttacked(); + this.health -= var2; + if(this.health <= 0) { + this.setEntityDead(); + } + + return false; + } + + public void writeEntityToNBT(NBTTagCompound var1) { + var1.setShort("Health", (short)((byte)this.health)); + var1.setShort("Age", (short)this.age); + var1.setCompoundTag("Item", this.item.writeToNBT(new NBTTagCompound())); + } + + public void readEntityFromNBT(NBTTagCompound var1) { + this.health = var1.getShort("Health") & 255; + this.age = var1.getShort("Age"); + NBTTagCompound var2 = var1.getCompoundTag("Item"); + this.item = new ItemStack(var2); + } + + public void onCollideWithPlayer(EntityPlayer var1) { + if(!this.worldObj.multiplayerWorld) { + int var2 = this.item.stackSize; + if(this.delayBeforeCanPickup == 0 && var1.inventory.addItemStackToInventory(this.item)) { + if(this.item.itemID == Block.wood.blockID) { + var1.triggerAchievement(AchievementList.mineWood); + } + + if(this.item.itemID == Item.leather.shiftedIndex) { + var1.triggerAchievement(AchievementList.killCow); + } + + this.worldObj.playSoundAtEntity(this, "random.pop", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); + var1.onItemPickup(this, var2); + if(this.item.stackSize <= 0) { + this.setEntityDead(); + } + } + + } + } +} diff --git a/src/net/minecraft/src/EntityLavaFX.java b/src/net/minecraft/src/EntityLavaFX.java new file mode 100644 index 0000000..423aa8b --- /dev/null +++ b/src/net/minecraft/src/EntityLavaFX.java @@ -0,0 +1,54 @@ +package net.minecraft.src; + +public class EntityLavaFX extends EntityFX { + private float field_674_a; + + public EntityLavaFX(World var1, double var2, double var4, double var6) { + super(var1, var2, var4, var6, 0.0D, 0.0D, 0.0D); + this.motionX *= (double)0.8F; + this.motionY *= (double)0.8F; + this.motionZ *= (double)0.8F; + this.motionY = (double)(this.rand.nextFloat() * 0.4F + 0.05F); + this.particleRed = this.particleGreen = this.particleBlue = 1.0F; + this.particleScale *= this.rand.nextFloat() * 2.0F + 0.2F; + this.field_674_a = this.particleScale; + this.particleMaxAge = (int)(16.0D / (Math.random() * 0.8D + 0.2D)); + this.noClip = false; + this.particleTextureIndex = 49; + } + + public float getEntityBrightness(float var1) { + return 1.0F; + } + + public void renderParticle(Tessellator var1, float var2, float var3, float var4, float var5, float var6, float var7) { + float var8 = ((float)this.particleAge + var2) / (float)this.particleMaxAge; + this.particleScale = this.field_674_a * (1.0F - var8 * var8); + super.renderParticle(var1, var2, var3, var4, var5, var6, var7); + } + + public void onUpdate() { + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + if(this.particleAge++ >= this.particleMaxAge) { + this.setEntityDead(); + } + + float var1 = (float)this.particleAge / (float)this.particleMaxAge; + if(this.rand.nextFloat() > var1) { + this.worldObj.spawnParticle("smoke", this.posX, this.posY, this.posZ, this.motionX, this.motionY, this.motionZ); + } + + this.motionY -= 0.03D; + this.moveEntity(this.motionX, this.motionY, this.motionZ); + this.motionX *= (double)0.999F; + this.motionY *= (double)0.999F; + this.motionZ *= (double)0.999F; + if(this.onGround) { + this.motionX *= (double)0.7F; + this.motionZ *= (double)0.7F; + } + + } +} diff --git a/src/net/minecraft/src/EntityLightningBolt.java b/src/net/minecraft/src/EntityLightningBolt.java new file mode 100644 index 0000000..c4cee73 --- /dev/null +++ b/src/net/minecraft/src/EntityLightningBolt.java @@ -0,0 +1,88 @@ +package net.minecraft.src; + +import java.util.List; + +public class EntityLightningBolt extends EntityWeatherEffect { + private int field_27028_b; + public long field_27029_a = 0L; + private int field_27030_c; + + public EntityLightningBolt(World var1, double var2, double var4, double var6) { + super(var1); + this.setLocationAndAngles(var2, var4, var6, 0.0F, 0.0F); + this.field_27028_b = 2; + this.field_27029_a = this.rand.nextLong(); + this.field_27030_c = this.rand.nextInt(3) + 1; + if(var1.difficultySetting >= 2 && var1.doChunksNearChunkExist(MathHelper.floor_double(var2), MathHelper.floor_double(var4), MathHelper.floor_double(var6), 10)) { + int var8 = MathHelper.floor_double(var2); + int var9 = MathHelper.floor_double(var4); + int var10 = MathHelper.floor_double(var6); + if(var1.getBlockId(var8, var9, var10) == 0 && Block.fire.canPlaceBlockAt(var1, var8, var9, var10)) { + var1.setBlockWithNotify(var8, var9, var10, Block.fire.blockID); + } + + for(var8 = 0; var8 < 4; ++var8) { + var9 = MathHelper.floor_double(var2) + this.rand.nextInt(3) - 1; + var10 = MathHelper.floor_double(var4) + this.rand.nextInt(3) - 1; + int var11 = MathHelper.floor_double(var6) + this.rand.nextInt(3) - 1; + if(var1.getBlockId(var9, var10, var11) == 0 && Block.fire.canPlaceBlockAt(var1, var9, var10, var11)) { + var1.setBlockWithNotify(var9, var10, var11, Block.fire.blockID); + } + } + } + + } + + public void onUpdate() { + super.onUpdate(); + if(this.field_27028_b == 2) { + this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "ambient.weather.thunder", 10000.0F, 0.8F + this.rand.nextFloat() * 0.2F); + this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "random.explode", 2.0F, 0.5F + this.rand.nextFloat() * 0.2F); + } + + --this.field_27028_b; + if(this.field_27028_b < 0) { + if(this.field_27030_c == 0) { + this.setEntityDead(); + } else if(this.field_27028_b < -this.rand.nextInt(10)) { + --this.field_27030_c; + this.field_27028_b = 1; + this.field_27029_a = this.rand.nextLong(); + if(this.worldObj.doChunksNearChunkExist(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ), 10)) { + int var1 = MathHelper.floor_double(this.posX); + int var2 = MathHelper.floor_double(this.posY); + int var3 = MathHelper.floor_double(this.posZ); + if(this.worldObj.getBlockId(var1, var2, var3) == 0 && Block.fire.canPlaceBlockAt(this.worldObj, var1, var2, var3)) { + this.worldObj.setBlockWithNotify(var1, var2, var3, Block.fire.blockID); + } + } + } + } + + if(this.field_27028_b >= 0) { + double var6 = 3.0D; + List var7 = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, AxisAlignedBB.getBoundingBoxFromPool(this.posX - var6, this.posY - var6, this.posZ - var6, this.posX + var6, this.posY + 6.0D + var6, this.posZ + var6)); + + for(int var4 = 0; var4 < var7.size(); ++var4) { + Entity var5 = (Entity)var7.get(var4); + var5.onStruckByLightning(this); + } + + this.worldObj.field_27172_i = 2; + } + + } + + protected void entityInit() { + } + + protected void readEntityFromNBT(NBTTagCompound var1) { + } + + protected void writeEntityToNBT(NBTTagCompound var1) { + } + + public boolean isInRangeToRenderVec3D(Vec3D var1) { + return this.field_27028_b >= 0; + } +} diff --git a/src/net/minecraft/src/EntityList.java b/src/net/minecraft/src/EntityList.java new file mode 100644 index 0000000..a763a7c --- /dev/null +++ b/src/net/minecraft/src/EntityList.java @@ -0,0 +1,108 @@ +package net.minecraft.src; + +import java.util.HashMap; +import java.util.Map; + +public class EntityList { + private static Map stringToClassMapping = new HashMap(); + private static Map classToStringMapping = new HashMap(); + private static Map IDtoClassMapping = new HashMap(); + private static Map classToIDMapping = new HashMap(); + + private static void addMapping(Class var0, String var1, int var2) { + stringToClassMapping.put(var1, var0); + classToStringMapping.put(var0, var1); + IDtoClassMapping.put(Integer.valueOf(var2), var0); + classToIDMapping.put(var0, Integer.valueOf(var2)); + } + + public static Entity createEntityInWorld(String var0, World var1) { + Entity var2 = null; + + try { + Class var3 = (Class)stringToClassMapping.get(var0); + if(var3 != null) { + var2 = (Entity)var3.getConstructor(new Class[]{World.class}).newInstance(new Object[]{var1}); + } + } catch (Exception var4) { + var4.printStackTrace(); + } + + return var2; + } + + public static Entity createEntityFromNBT(NBTTagCompound var0, World var1) { + Entity var2 = null; + + try { + Class var3 = (Class)stringToClassMapping.get(var0.getString("id")); + if(var3 != null) { + var2 = (Entity)var3.getConstructor(new Class[]{World.class}).newInstance(new Object[]{var1}); + } + } catch (Exception var4) { + var4.printStackTrace(); + } + + if(var2 != null) { + var2.readFromNBT(var0); + } else { + System.out.println("Skipping Entity with id " + var0.getString("id")); + } + + return var2; + } + + public static Entity createEntity(int var0, World var1) { + Entity var2 = null; + + try { + Class var3 = (Class)IDtoClassMapping.get(Integer.valueOf(var0)); + if(var3 != null) { + var2 = (Entity)var3.getConstructor(new Class[]{World.class}).newInstance(new Object[]{var1}); + } + } catch (Exception var4) { + var4.printStackTrace(); + } + + if(var2 == null) { + System.out.println("Skipping Entity with id " + var0); + } + + return var2; + } + + public static int getEntityID(Entity var0) { + return ((Integer)classToIDMapping.get(var0.getClass())).intValue(); + } + + public static String getEntityString(Entity var0) { + return (String)classToStringMapping.get(var0.getClass()); + } + + static { + addMapping(EntityArrow.class, "Arrow", 10); + addMapping(EntitySnowball.class, "Snowball", 11); + addMapping(EntityItem.class, "Item", 1); + addMapping(EntityPainting.class, "Painting", 9); + addMapping(EntityLiving.class, "Mob", 48); + addMapping(EntityMob.class, "Monster", 49); + addMapping(EntityCreeper.class, "Creeper", 50); + addMapping(EntitySkeleton.class, "Skeleton", 51); + addMapping(EntitySpider.class, "Spider", 52); + addMapping(EntityGiantZombie.class, "Giant", 53); + addMapping(EntityZombie.class, "Zombie", 54); + addMapping(EntitySlime.class, "Slime", 55); + addMapping(EntityGhast.class, "Ghast", 56); + addMapping(EntityPigZombie.class, "PigZombie", 57); + addMapping(EntityPig.class, "Pig", 90); + addMapping(EntitySheep.class, "Sheep", 91); + addMapping(EntityCow.class, "Cow", 92); + addMapping(EntityChicken.class, "Chicken", 93); + addMapping(EntitySquid.class, "Squid", 94); + addMapping(EntityWolf.class, "Wolf", 95); + addMapping(EntityTNTPrimed.class, "PrimedTnt", 20); + addMapping(EntityFallingSand.class, "FallingSand", 21); + addMapping(EntityMinecart.class, "Minecart", 40); + addMapping(EntityBoat.class, "Boat", 41); + } +} diff --git a/src/net/minecraft/src/EntityLiving.java b/src/net/minecraft/src/EntityLiving.java new file mode 100644 index 0000000..4a3c189 --- /dev/null +++ b/src/net/minecraft/src/EntityLiving.java @@ -0,0 +1,875 @@ +package net.minecraft.src; + +import java.util.List; + +public abstract class EntityLiving extends Entity { + public int heartsHalvesLife = 20; + public float field_9365_p; + public float field_9363_r; + public float renderYawOffset = 0.0F; + public float prevRenderYawOffset = 0.0F; + protected float field_9362_u; + protected float field_9361_v; + protected float field_9360_w; + protected float field_9359_x; + protected boolean field_9358_y = true; + protected String texture = "/mob/char.png"; + protected boolean field_9355_A = true; + protected float field_9353_B = 0.0F; + protected String field_9351_C = null; + protected float field_9349_D = 1.0F; + protected int scoreValue = 0; + protected float field_9345_F = 0.0F; + public boolean isMultiplayerEntity = false; + public float prevSwingProgress; + public float swingProgress; + public int health = 10; + public int prevHealth; + private int livingSoundTime; + public int hurtTime; + public int maxHurtTime; + public float attackedAtYaw = 0.0F; + public int deathTime = 0; + public int attackTime = 0; + public float cameraPitch; + public float field_9328_R; + protected boolean unused_flag = false; + public int field_9326_T = -1; + public float field_9325_U = (float)(Math.random() * (double)0.9F + (double)0.1F); + public float field_705_Q; + public float field_704_R; + public float field_703_S; + protected int newPosRotationIncrements; + protected double newPosX; + protected double newPosY; + protected double newPosZ; + protected double newRotationYaw; + protected double newRotationPitch; + float field_9348_ae = 0.0F; + protected int field_9346_af = 0; + protected int entityAge = 0; + protected float moveStrafing; + protected float moveForward; + protected float randomYawVelocity; + protected boolean isJumping = false; + protected float defaultPitch = 0.0F; + protected float moveSpeed = 0.7F; + private Entity currentTarget; + protected int numTicksToChaseTarget = 0; + + public EntityLiving(World var1) { + super(var1); + this.preventEntitySpawning = true; + this.field_9363_r = (float)(Math.random() + 1.0D) * 0.01F; + this.setPosition(this.posX, this.posY, this.posZ); + this.field_9365_p = (float)Math.random() * 12398.0F; + this.rotationYaw = (float)(Math.random() * (double)((float)Math.PI) * 2.0D); + this.stepHeight = 0.5F; + } + + protected void entityInit() { + } + + public boolean canEntityBeSeen(Entity var1) { + return this.worldObj.rayTraceBlocks(Vec3D.createVector(this.posX, this.posY + (double)this.getEyeHeight(), this.posZ), Vec3D.createVector(var1.posX, var1.posY + (double)var1.getEyeHeight(), var1.posZ)) == null; + } + + public String getEntityTexture() { + return this.texture; + } + + public boolean canBeCollidedWith() { + return !this.isDead; + } + + public boolean canBePushed() { + return !this.isDead; + } + + public float getEyeHeight() { + return this.height * 0.85F; + } + + public int getTalkInterval() { + return 80; + } + + public void playLivingSound() { + String var1 = this.getLivingSound(); + if(var1 != null) { + this.worldObj.playSoundAtEntity(this, var1, this.getSoundVolume(), (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F); + } + + } + + public void onEntityUpdate() { + this.prevSwingProgress = this.swingProgress; + super.onEntityUpdate(); + if(this.rand.nextInt(1000) < this.livingSoundTime++) { + this.livingSoundTime = -this.getTalkInterval(); + this.playLivingSound(); + } + + if(this.isEntityAlive() && this.isEntityInsideOpaqueBlock()) { + this.attackEntityFrom((Entity)null, 1); + } + + if(this.isImmuneToFire || this.worldObj.multiplayerWorld) { + this.fire = 0; + } + + int var1; + if(this.isEntityAlive() && this.isInsideOfMaterial(Material.water) && !this.canBreatheUnderwater()) { + --this.air; + if(this.air == -20) { + this.air = 0; + + for(var1 = 0; var1 < 8; ++var1) { + float var2 = this.rand.nextFloat() - this.rand.nextFloat(); + float var3 = this.rand.nextFloat() - this.rand.nextFloat(); + float var4 = this.rand.nextFloat() - this.rand.nextFloat(); + this.worldObj.spawnParticle("bubble", this.posX + (double)var2, this.posY + (double)var3, this.posZ + (double)var4, this.motionX, this.motionY, this.motionZ); + } + + this.attackEntityFrom((Entity)null, 2); + } + + this.fire = 0; + } else { + this.air = this.maxAir; + } + + this.cameraPitch = this.field_9328_R; + if(this.attackTime > 0) { + --this.attackTime; + } + + if(this.hurtTime > 0) { + --this.hurtTime; + } + + if(this.heartsLife > 0) { + --this.heartsLife; + } + + if(this.health <= 0) { + ++this.deathTime; + if(this.deathTime > 20) { + this.onEntityDeath(); + this.setEntityDead(); + + for(var1 = 0; var1 < 20; ++var1) { + double var8 = this.rand.nextGaussian() * 0.02D; + double var9 = this.rand.nextGaussian() * 0.02D; + double var6 = this.rand.nextGaussian() * 0.02D; + this.worldObj.spawnParticle("explode", this.posX + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width, this.posY + (double)(this.rand.nextFloat() * this.height), this.posZ + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width, var8, var9, var6); + } + } + } + + this.field_9359_x = this.field_9360_w; + this.prevRenderYawOffset = this.renderYawOffset; + this.prevRotationYaw = this.rotationYaw; + this.prevRotationPitch = this.rotationPitch; + } + + public void spawnExplosionParticle() { + for(int var1 = 0; var1 < 20; ++var1) { + double var2 = this.rand.nextGaussian() * 0.02D; + double var4 = this.rand.nextGaussian() * 0.02D; + double var6 = this.rand.nextGaussian() * 0.02D; + double var8 = 10.0D; + this.worldObj.spawnParticle("explode", this.posX + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width - var2 * var8, this.posY + (double)(this.rand.nextFloat() * this.height) - var4 * var8, this.posZ + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width - var6 * var8, var2, var4, var6); + } + + } + + public void updateRidden() { + super.updateRidden(); + this.field_9362_u = this.field_9361_v; + this.field_9361_v = 0.0F; + } + + public void setPositionAndRotation2(double var1, double var3, double var5, float var7, float var8, int var9) { + this.yOffset = 0.0F; + this.newPosX = var1; + this.newPosY = var3; + this.newPosZ = var5; + this.newRotationYaw = (double)var7; + this.newRotationPitch = (double)var8; + this.newPosRotationIncrements = var9; + } + + public void onUpdate() { + super.onUpdate(); + this.onLivingUpdate(); + double var1 = this.posX - this.prevPosX; + double var3 = this.posZ - this.prevPosZ; + float var5 = MathHelper.sqrt_double(var1 * var1 + var3 * var3); + float var6 = this.renderYawOffset; + float var7 = 0.0F; + this.field_9362_u = this.field_9361_v; + float var8 = 0.0F; + if(var5 > 0.05F) { + var8 = 1.0F; + var7 = var5 * 3.0F; + var6 = (float)Math.atan2(var3, var1) * 180.0F / (float)Math.PI - 90.0F; + } + + if(this.swingProgress > 0.0F) { + var6 = this.rotationYaw; + } + + if(!this.onGround) { + var8 = 0.0F; + } + + this.field_9361_v += (var8 - this.field_9361_v) * 0.3F; + + float var9; + for(var9 = var6 - this.renderYawOffset; var9 < -180.0F; var9 += 360.0F) { + } + + while(var9 >= 180.0F) { + var9 -= 360.0F; + } + + this.renderYawOffset += var9 * 0.3F; + + float var10; + for(var10 = this.rotationYaw - this.renderYawOffset; var10 < -180.0F; var10 += 360.0F) { + } + + while(var10 >= 180.0F) { + var10 -= 360.0F; + } + + boolean var11 = var10 < -90.0F || var10 >= 90.0F; + if(var10 < -75.0F) { + var10 = -75.0F; + } + + if(var10 >= 75.0F) { + var10 = 75.0F; + } + + this.renderYawOffset = this.rotationYaw - var10; + if(var10 * var10 > 2500.0F) { + this.renderYawOffset += var10 * 0.2F; + } + + if(var11) { + var7 *= -1.0F; + } + + while(this.rotationYaw - this.prevRotationYaw < -180.0F) { + this.prevRotationYaw -= 360.0F; + } + + while(this.rotationYaw - this.prevRotationYaw >= 180.0F) { + this.prevRotationYaw += 360.0F; + } + + while(this.renderYawOffset - this.prevRenderYawOffset < -180.0F) { + this.prevRenderYawOffset -= 360.0F; + } + + while(this.renderYawOffset - this.prevRenderYawOffset >= 180.0F) { + this.prevRenderYawOffset += 360.0F; + } + + while(this.rotationPitch - this.prevRotationPitch < -180.0F) { + this.prevRotationPitch -= 360.0F; + } + + while(this.rotationPitch - this.prevRotationPitch >= 180.0F) { + this.prevRotationPitch += 360.0F; + } + + this.field_9360_w += var7; + } + + protected void setSize(float var1, float var2) { + super.setSize(var1, var2); + } + + public void heal(int var1) { + if(this.health > 0) { + this.health += var1; + if(this.health > 20) { + this.health = 20; + } + + this.heartsLife = this.heartsHalvesLife / 2; + } + } + + public boolean attackEntityFrom(Entity var1, int var2) { + if(this.worldObj.multiplayerWorld) { + return false; + } else { + this.entityAge = 0; + if(this.health <= 0) { + return false; + } else { + this.field_704_R = 1.5F; + boolean var3 = true; + if((float)this.heartsLife > (float)this.heartsHalvesLife / 2.0F) { + if(var2 <= this.field_9346_af) { + return false; + } + + this.damageEntity(var2 - this.field_9346_af); + this.field_9346_af = var2; + var3 = false; + } else { + this.field_9346_af = var2; + this.prevHealth = this.health; + this.heartsLife = this.heartsHalvesLife; + this.damageEntity(var2); + this.hurtTime = this.maxHurtTime = 10; + } + + this.attackedAtYaw = 0.0F; + if(var3) { + this.worldObj.func_9425_a(this, (byte)2); + this.setBeenAttacked(); + if(var1 != null) { + double var4 = var1.posX - this.posX; + + double var6; + for(var6 = var1.posZ - this.posZ; var4 * var4 + var6 * var6 < 1.0E-4D; var6 = (Math.random() - Math.random()) * 0.01D) { + var4 = (Math.random() - Math.random()) * 0.01D; + } + + this.attackedAtYaw = (float)(Math.atan2(var6, var4) * 180.0D / (double)((float)Math.PI)) - this.rotationYaw; + this.knockBack(var1, var2, var4, var6); + } else { + this.attackedAtYaw = (float)((int)(Math.random() * 2.0D) * 180); + } + } + + if(this.health <= 0) { + if(var3) { + this.worldObj.playSoundAtEntity(this, this.getDeathSound(), this.getSoundVolume(), (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F); + } + + this.onDeath(var1); + } else if(var3) { + this.worldObj.playSoundAtEntity(this, this.getHurtSound(), this.getSoundVolume(), (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F); + } + + return true; + } + } + } + + public void performHurtAnimation() { + this.hurtTime = this.maxHurtTime = 10; + this.attackedAtYaw = 0.0F; + } + + protected void damageEntity(int var1) { + this.health -= var1; + } + + protected float getSoundVolume() { + return 1.0F; + } + + protected String getLivingSound() { + return null; + } + + protected String getHurtSound() { + return "random.hurt"; + } + + protected String getDeathSound() { + return "random.hurt"; + } + + public void knockBack(Entity var1, int var2, double var3, double var5) { + float var7 = MathHelper.sqrt_double(var3 * var3 + var5 * var5); + float var8 = 0.4F; + this.motionX /= 2.0D; + this.motionY /= 2.0D; + this.motionZ /= 2.0D; + this.motionX -= var3 / (double)var7 * (double)var8; + this.motionY += (double)0.4F; + this.motionZ -= var5 / (double)var7 * (double)var8; + if(this.motionY > (double)0.4F) { + this.motionY = (double)0.4F; + } + + } + + public void onDeath(Entity var1) { + if(this.scoreValue >= 0 && var1 != null) { + var1.addToPlayerScore(this, this.scoreValue); + } + + if(var1 != null) { + var1.onKillEntity(this); + } + + this.unused_flag = true; + if(!this.worldObj.multiplayerWorld) { + this.dropFewItems(); + } + + this.worldObj.func_9425_a(this, (byte)3); + } + + protected void dropFewItems() { + int var1 = this.getDropItemId(); + if(var1 > 0) { + int var2 = this.rand.nextInt(3); + + for(int var3 = 0; var3 < var2; ++var3) { + this.dropItem(var1, 1); + } + } + + } + + protected int getDropItemId() { + return 0; + } + + protected void fall(float var1) { + super.fall(var1); + int var2 = (int)Math.ceil((double)(var1 - 3.0F)); + if(var2 > 0) { + this.attackEntityFrom((Entity)null, var2); + int var3 = this.worldObj.getBlockId(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY - (double)0.2F - (double)this.yOffset), MathHelper.floor_double(this.posZ)); + if(var3 > 0) { + StepSound var4 = Block.blocksList[var3].stepSound; + this.worldObj.playSoundAtEntity(this, var4.func_1145_d(), var4.getVolume() * 0.5F, var4.getPitch() * (12.0F / 16.0F)); + } + } + + } + + public void moveEntityWithHeading(float var1, float var2) { + double var3; + if(this.isInWater()) { + var3 = this.posY; + this.moveFlying(var1, var2, 0.02F); + this.moveEntity(this.motionX, this.motionY, this.motionZ); + this.motionX *= (double)0.8F; + this.motionY *= (double)0.8F; + this.motionZ *= (double)0.8F; + this.motionY -= 0.02D; + if(this.isCollidedHorizontally && this.isOffsetPositionInLiquid(this.motionX, this.motionY + (double)0.6F - this.posY + var3, this.motionZ)) { + this.motionY = (double)0.3F; + } + } else if(this.handleLavaMovement()) { + var3 = this.posY; + this.moveFlying(var1, var2, 0.02F); + this.moveEntity(this.motionX, this.motionY, this.motionZ); + this.motionX *= 0.5D; + this.motionY *= 0.5D; + this.motionZ *= 0.5D; + this.motionY -= 0.02D; + if(this.isCollidedHorizontally && this.isOffsetPositionInLiquid(this.motionX, this.motionY + (double)0.6F - this.posY + var3, this.motionZ)) { + this.motionY = (double)0.3F; + } + } else { + float var8 = 0.91F; + if(this.onGround) { + var8 = 546.0F * 0.1F * 0.1F * 0.1F; + int var4 = this.worldObj.getBlockId(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.boundingBox.minY) - 1, MathHelper.floor_double(this.posZ)); + if(var4 > 0) { + var8 = Block.blocksList[var4].slipperiness * 0.91F; + } + } + + float var9 = 0.16277136F / (var8 * var8 * var8); + this.moveFlying(var1, var2, this.onGround ? 0.1F * var9 : 0.02F); + var8 = 0.91F; + if(this.onGround) { + var8 = 546.0F * 0.1F * 0.1F * 0.1F; + int var5 = this.worldObj.getBlockId(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.boundingBox.minY) - 1, MathHelper.floor_double(this.posZ)); + if(var5 > 0) { + var8 = Block.blocksList[var5].slipperiness * 0.91F; + } + } + + if(this.isOnLadder()) { + float var10 = 0.15F; + if(this.motionX < (double)(-var10)) { + this.motionX = (double)(-var10); + } + + if(this.motionX > (double)var10) { + this.motionX = (double)var10; + } + + if(this.motionZ < (double)(-var10)) { + this.motionZ = (double)(-var10); + } + + if(this.motionZ > (double)var10) { + this.motionZ = (double)var10; + } + + this.fallDistance = 0.0F; + if(this.motionY < -0.15D) { + this.motionY = -0.15D; + } + + if(this.isSneaking() && this.motionY < 0.0D) { + this.motionY = 0.0D; + } + } + + this.moveEntity(this.motionX, this.motionY, this.motionZ); + if(this.isCollidedHorizontally && this.isOnLadder()) { + this.motionY = 0.2D; + } + + this.motionY -= 0.08D; + this.motionY *= (double)0.98F; + this.motionX *= (double)var8; + this.motionZ *= (double)var8; + } + + this.field_705_Q = this.field_704_R; + var3 = this.posX - this.prevPosX; + double var11 = this.posZ - this.prevPosZ; + float var7 = MathHelper.sqrt_double(var3 * var3 + var11 * var11) * 4.0F; + if(var7 > 1.0F) { + var7 = 1.0F; + } + + this.field_704_R += (var7 - this.field_704_R) * 0.4F; + this.field_703_S += this.field_704_R; + } + + public boolean isOnLadder() { + int var1 = MathHelper.floor_double(this.posX); + int var2 = MathHelper.floor_double(this.boundingBox.minY); + int var3 = MathHelper.floor_double(this.posZ); + return this.worldObj.getBlockId(var1, var2, var3) == Block.ladder.blockID; + } + + public void writeEntityToNBT(NBTTagCompound var1) { + var1.setShort("Health", (short)this.health); + var1.setShort("HurtTime", (short)this.hurtTime); + var1.setShort("DeathTime", (short)this.deathTime); + var1.setShort("AttackTime", (short)this.attackTime); + } + + public void readEntityFromNBT(NBTTagCompound var1) { + this.health = var1.getShort("Health"); + if(!var1.hasKey("Health")) { + this.health = 10; + } + + this.hurtTime = var1.getShort("HurtTime"); + this.deathTime = var1.getShort("DeathTime"); + this.attackTime = var1.getShort("AttackTime"); + } + + public boolean isEntityAlive() { + return !this.isDead && this.health > 0; + } + + public boolean canBreatheUnderwater() { + return false; + } + + public void onLivingUpdate() { + if(this.newPosRotationIncrements > 0) { + double var1 = this.posX + (this.newPosX - this.posX) / (double)this.newPosRotationIncrements; + double var3 = this.posY + (this.newPosY - this.posY) / (double)this.newPosRotationIncrements; + double var5 = this.posZ + (this.newPosZ - this.posZ) / (double)this.newPosRotationIncrements; + + double var7; + for(var7 = this.newRotationYaw - (double)this.rotationYaw; var7 < -180.0D; var7 += 360.0D) { + } + + while(var7 >= 180.0D) { + var7 -= 360.0D; + } + + this.rotationYaw = (float)((double)this.rotationYaw + var7 / (double)this.newPosRotationIncrements); + this.rotationPitch = (float)((double)this.rotationPitch + (this.newRotationPitch - (double)this.rotationPitch) / (double)this.newPosRotationIncrements); + --this.newPosRotationIncrements; + this.setPosition(var1, var3, var5); + this.setRotation(this.rotationYaw, this.rotationPitch); + List var9 = this.worldObj.getCollidingBoundingBoxes(this, this.boundingBox.func_28195_e(1.0D / 32.0D, 0.0D, 1.0D / 32.0D)); + if(var9.size() > 0) { + double var10 = 0.0D; + + for(int var12 = 0; var12 < var9.size(); ++var12) { + AxisAlignedBB var13 = (AxisAlignedBB)var9.get(var12); + if(var13.maxY > var10) { + var10 = var13.maxY; + } + } + + var3 += var10 - this.boundingBox.minY; + this.setPosition(var1, var3, var5); + } + } + + if(this.isMovementBlocked()) { + this.isJumping = false; + this.moveStrafing = 0.0F; + this.moveForward = 0.0F; + this.randomYawVelocity = 0.0F; + } else if(!this.isMultiplayerEntity) { + this.updatePlayerActionState(); + } + + boolean var14 = this.isInWater(); + boolean var2 = this.handleLavaMovement(); + if(this.isJumping) { + if(var14) { + this.motionY += (double)0.04F; + } else if(var2) { + this.motionY += (double)0.04F; + } else if(this.onGround) { + this.jump(); + } + } + + this.moveStrafing *= 0.98F; + this.moveForward *= 0.98F; + this.randomYawVelocity *= 0.9F; + this.moveEntityWithHeading(this.moveStrafing, this.moveForward); + List var15 = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.expand((double)0.2F, 0.0D, (double)0.2F)); + if(var15 != null && var15.size() > 0) { + for(int var4 = 0; var4 < var15.size(); ++var4) { + Entity var16 = (Entity)var15.get(var4); + if(var16.canBePushed()) { + var16.applyEntityCollision(this); + } + } + } + + } + + protected boolean isMovementBlocked() { + return this.health <= 0; + } + + protected void jump() { + this.motionY = (double)0.42F; + } + + protected boolean canDespawn() { + return true; + } + + protected void func_27021_X() { + EntityPlayer var1 = this.worldObj.getClosestPlayerToEntity(this, -1.0D); + if(this.canDespawn() && var1 != null) { + double var2 = var1.posX - this.posX; + double var4 = var1.posY - this.posY; + double var6 = var1.posZ - this.posZ; + double var8 = var2 * var2 + var4 * var4 + var6 * var6; + if(var8 > 16384.0D) { + this.setEntityDead(); + } + + if(this.entityAge > 600 && this.rand.nextInt(800) == 0) { + if(var8 < 1024.0D) { + this.entityAge = 0; + } else { + this.setEntityDead(); + } + } + } + + } + + protected void updatePlayerActionState() { + ++this.entityAge; + EntityPlayer var1 = this.worldObj.getClosestPlayerToEntity(this, -1.0D); + this.func_27021_X(); + this.moveStrafing = 0.0F; + this.moveForward = 0.0F; + float var2 = 8.0F; + if(this.rand.nextFloat() < 0.02F) { + var1 = this.worldObj.getClosestPlayerToEntity(this, (double)var2); + if(var1 != null) { + this.currentTarget = var1; + this.numTicksToChaseTarget = 10 + this.rand.nextInt(20); + } else { + this.randomYawVelocity = (this.rand.nextFloat() - 0.5F) * 20.0F; + } + } + + if(this.currentTarget != null) { + this.faceEntity(this.currentTarget, 10.0F, (float)this.func_25026_x()); + if(this.numTicksToChaseTarget-- <= 0 || this.currentTarget.isDead || this.currentTarget.getDistanceSqToEntity(this) > (double)(var2 * var2)) { + this.currentTarget = null; + } + } else { + if(this.rand.nextFloat() < 0.05F) { + this.randomYawVelocity = (this.rand.nextFloat() - 0.5F) * 20.0F; + } + + this.rotationYaw += this.randomYawVelocity; + this.rotationPitch = this.defaultPitch; + } + + boolean var3 = this.isInWater(); + boolean var4 = this.handleLavaMovement(); + if(var3 || var4) { + this.isJumping = this.rand.nextFloat() < 0.8F; + } + + } + + protected int func_25026_x() { + return 40; + } + + public void faceEntity(Entity var1, float var2, float var3) { + double var4 = var1.posX - this.posX; + double var8 = var1.posZ - this.posZ; + double var6; + if(var1 instanceof EntityLiving) { + EntityLiving var10 = (EntityLiving)var1; + var6 = this.posY + (double)this.getEyeHeight() - (var10.posY + (double)var10.getEyeHeight()); + } else { + var6 = (var1.boundingBox.minY + var1.boundingBox.maxY) / 2.0D - (this.posY + (double)this.getEyeHeight()); + } + + double var14 = (double)MathHelper.sqrt_double(var4 * var4 + var8 * var8); + float var12 = (float)(Math.atan2(var8, var4) * 180.0D / (double)((float)Math.PI)) - 90.0F; + float var13 = (float)(-(Math.atan2(var6, var14) * 180.0D / (double)((float)Math.PI))); + this.rotationPitch = -this.updateRotation(this.rotationPitch, var13, var3); + this.rotationYaw = this.updateRotation(this.rotationYaw, var12, var2); + } + + public boolean hasCurrentTarget() { + return this.currentTarget != null; + } + + public Entity getCurrentTarget() { + return this.currentTarget; + } + + private float updateRotation(float var1, float var2, float var3) { + float var4; + for(var4 = var2 - var1; var4 < -180.0F; var4 += 360.0F) { + } + + while(var4 >= 180.0F) { + var4 -= 360.0F; + } + + if(var4 > var3) { + var4 = var3; + } + + if(var4 < -var3) { + var4 = -var3; + } + + return var1 + var4; + } + + public void onEntityDeath() { + } + + public boolean getCanSpawnHere() { + return this.worldObj.checkIfAABBIsClear(this.boundingBox) && this.worldObj.getCollidingBoundingBoxes(this, this.boundingBox).size() == 0 && !this.worldObj.getIsAnyLiquid(this.boundingBox); + } + + protected void kill() { + this.attackEntityFrom((Entity)null, 4); + } + + public float getSwingProgress(float var1) { + float var2 = this.swingProgress - this.prevSwingProgress; + if(var2 < 0.0F) { + ++var2; + } + + return this.prevSwingProgress + var2 * var1; + } + + public Vec3D getPosition(float var1) { + if(var1 == 1.0F) { + return Vec3D.createVector(this.posX, this.posY, this.posZ); + } else { + double var2 = this.prevPosX + (this.posX - this.prevPosX) * (double)var1; + double var4 = this.prevPosY + (this.posY - this.prevPosY) * (double)var1; + double var6 = this.prevPosZ + (this.posZ - this.prevPosZ) * (double)var1; + return Vec3D.createVector(var2, var4, var6); + } + } + + public Vec3D getLookVec() { + return this.getLook(1.0F); + } + + public Vec3D getLook(float var1) { + float var2; + float var3; + float var4; + float var5; + if(var1 == 1.0F) { + var2 = MathHelper.cos(-this.rotationYaw * ((float)Math.PI / 180.0F) - (float)Math.PI); + var3 = MathHelper.sin(-this.rotationYaw * ((float)Math.PI / 180.0F) - (float)Math.PI); + var4 = -MathHelper.cos(-this.rotationPitch * ((float)Math.PI / 180.0F)); + var5 = MathHelper.sin(-this.rotationPitch * ((float)Math.PI / 180.0F)); + return Vec3D.createVector((double)(var3 * var4), (double)var5, (double)(var2 * var4)); + } else { + var2 = this.prevRotationPitch + (this.rotationPitch - this.prevRotationPitch) * var1; + var3 = this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * var1; + var4 = MathHelper.cos(-var3 * ((float)Math.PI / 180.0F) - (float)Math.PI); + var5 = MathHelper.sin(-var3 * ((float)Math.PI / 180.0F) - (float)Math.PI); + float var6 = -MathHelper.cos(-var2 * ((float)Math.PI / 180.0F)); + float var7 = MathHelper.sin(-var2 * ((float)Math.PI / 180.0F)); + return Vec3D.createVector((double)(var5 * var6), (double)var7, (double)(var4 * var6)); + } + } + + public MovingObjectPosition rayTrace(double var1, float var3) { + Vec3D var4 = this.getPosition(var3); + Vec3D var5 = this.getLook(var3); + Vec3D var6 = var4.addVector(var5.xCoord * var1, var5.yCoord * var1, var5.zCoord * var1); + return this.worldObj.rayTraceBlocks(var4, var6); + } + + public int getMaxSpawnedInChunk() { + return 4; + } + + public ItemStack getHeldItem() { + return null; + } + + public void handleHealthUpdate(byte var1) { + if(var1 == 2) { + this.field_704_R = 1.5F; + this.heartsLife = this.heartsHalvesLife; + this.hurtTime = this.maxHurtTime = 10; + this.attackedAtYaw = 0.0F; + this.worldObj.playSoundAtEntity(this, this.getHurtSound(), this.getSoundVolume(), (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F); + this.attackEntityFrom((Entity)null, 0); + } else if(var1 == 3) { + this.worldObj.playSoundAtEntity(this, this.getDeathSound(), this.getSoundVolume(), (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F); + this.health = 0; + this.onDeath((Entity)null); + } else { + super.handleHealthUpdate(var1); + } + + } + + public boolean isPlayerSleeping() { + return false; + } + + public int getItemIcon(ItemStack var1) { + return var1.getIconIndex(); + } +} diff --git a/src/net/minecraft/src/EntityMinecart.java b/src/net/minecraft/src/EntityMinecart.java new file mode 100644 index 0000000..b065de2 --- /dev/null +++ b/src/net/minecraft/src/EntityMinecart.java @@ -0,0 +1,814 @@ +package net.minecraft.src; + +import java.util.List; + +public class EntityMinecart extends Entity implements IInventory { + private ItemStack[] cargoItems; + public int minecartCurrentDamage; + public int minecartTimeSinceHit; + public int minecartRockDirection; + private boolean field_856_i; + public int minecartType; + public int fuel; + public double pushX; + public double pushZ; + private static final int[][][] field_855_j = new int[][][]{{{0, 0, -1}, {0, 0, 1}}, {{-1, 0, 0}, {1, 0, 0}}, {{-1, -1, 0}, {1, 0, 0}}, {{-1, 0, 0}, {1, -1, 0}}, {{0, 0, -1}, {0, -1, 1}}, {{0, -1, -1}, {0, 0, 1}}, {{0, 0, 1}, {1, 0, 0}}, {{0, 0, 1}, {-1, 0, 0}}, {{0, 0, -1}, {-1, 0, 0}}, {{0, 0, -1}, {1, 0, 0}}}; + private int field_9415_k; + private double field_9414_l; + private double field_9413_m; + private double field_9412_n; + private double field_9411_o; + private double field_9410_p; + private double field_9409_q; + private double field_9408_r; + private double field_9407_s; + + public EntityMinecart(World var1) { + super(var1); + this.cargoItems = new ItemStack[36]; + this.minecartCurrentDamage = 0; + this.minecartTimeSinceHit = 0; + this.minecartRockDirection = 1; + this.field_856_i = false; + this.preventEntitySpawning = true; + this.setSize(0.98F, 0.7F); + this.yOffset = this.height / 2.0F; + } + + protected boolean canTriggerWalking() { + return false; + } + + protected void entityInit() { + } + + public AxisAlignedBB getCollisionBox(Entity var1) { + return var1.boundingBox; + } + + public AxisAlignedBB getBoundingBox() { + return null; + } + + public boolean canBePushed() { + return true; + } + + public EntityMinecart(World var1, double var2, double var4, double var6, int var8) { + this(var1); + this.setPosition(var2, var4 + (double)this.yOffset, var6); + this.motionX = 0.0D; + this.motionY = 0.0D; + this.motionZ = 0.0D; + this.prevPosX = var2; + this.prevPosY = var4; + this.prevPosZ = var6; + this.minecartType = var8; + } + + public double getMountedYOffset() { + return (double)this.height * 0.0D - (double)0.3F; + } + + public boolean attackEntityFrom(Entity var1, int var2) { + if(!this.worldObj.multiplayerWorld && !this.isDead) { + this.minecartRockDirection = -this.minecartRockDirection; + this.minecartTimeSinceHit = 10; + this.setBeenAttacked(); + this.minecartCurrentDamage += var2 * 10; + if(this.minecartCurrentDamage > 40) { + if(this.riddenByEntity != null) { + this.riddenByEntity.mountEntity(this); + } + + this.setEntityDead(); + this.dropItemWithOffset(Item.minecartEmpty.shiftedIndex, 1, 0.0F); + if(this.minecartType == 1) { + EntityMinecart var3 = this; + + for(int var4 = 0; var4 < var3.getSizeInventory(); ++var4) { + ItemStack var5 = var3.getStackInSlot(var4); + if(var5 != null) { + float var6 = this.rand.nextFloat() * 0.8F + 0.1F; + float var7 = this.rand.nextFloat() * 0.8F + 0.1F; + float var8 = this.rand.nextFloat() * 0.8F + 0.1F; + + while(var5.stackSize > 0) { + int var9 = this.rand.nextInt(21) + 10; + if(var9 > var5.stackSize) { + var9 = var5.stackSize; + } + + var5.stackSize -= var9; + EntityItem var10 = new EntityItem(this.worldObj, this.posX + (double)var6, this.posY + (double)var7, this.posZ + (double)var8, new ItemStack(var5.itemID, var9, var5.getItemDamage())); + float var11 = 0.05F; + var10.motionX = (double)((float)this.rand.nextGaussian() * var11); + var10.motionY = (double)((float)this.rand.nextGaussian() * var11 + 0.2F); + var10.motionZ = (double)((float)this.rand.nextGaussian() * var11); + this.worldObj.entityJoinedWorld(var10); + } + } + } + + this.dropItemWithOffset(Block.chest.blockID, 1, 0.0F); + } else if(this.minecartType == 2) { + this.dropItemWithOffset(Block.stoneOvenIdle.blockID, 1, 0.0F); + } + } + + return true; + } else { + return true; + } + } + + public void performHurtAnimation() { + System.out.println("Animating hurt"); + this.minecartRockDirection = -this.minecartRockDirection; + this.minecartTimeSinceHit = 10; + this.minecartCurrentDamage += this.minecartCurrentDamage * 10; + } + + public boolean canBeCollidedWith() { + return !this.isDead; + } + + public void setEntityDead() { + for(int var1 = 0; var1 < this.getSizeInventory(); ++var1) { + ItemStack var2 = this.getStackInSlot(var1); + if(var2 != null) { + float var3 = this.rand.nextFloat() * 0.8F + 0.1F; + float var4 = this.rand.nextFloat() * 0.8F + 0.1F; + float var5 = this.rand.nextFloat() * 0.8F + 0.1F; + + while(var2.stackSize > 0) { + int var6 = this.rand.nextInt(21) + 10; + if(var6 > var2.stackSize) { + var6 = var2.stackSize; + } + + var2.stackSize -= var6; + EntityItem var7 = new EntityItem(this.worldObj, this.posX + (double)var3, this.posY + (double)var4, this.posZ + (double)var5, new ItemStack(var2.itemID, var6, var2.getItemDamage())); + float var8 = 0.05F; + var7.motionX = (double)((float)this.rand.nextGaussian() * var8); + var7.motionY = (double)((float)this.rand.nextGaussian() * var8 + 0.2F); + var7.motionZ = (double)((float)this.rand.nextGaussian() * var8); + this.worldObj.entityJoinedWorld(var7); + } + } + } + + super.setEntityDead(); + } + + public void onUpdate() { + if(this.minecartTimeSinceHit > 0) { + --this.minecartTimeSinceHit; + } + + if(this.minecartCurrentDamage > 0) { + --this.minecartCurrentDamage; + } + + double var7; + if(this.worldObj.multiplayerWorld && this.field_9415_k > 0) { + if(this.field_9415_k > 0) { + double var46 = this.posX + (this.field_9414_l - this.posX) / (double)this.field_9415_k; + double var47 = this.posY + (this.field_9413_m - this.posY) / (double)this.field_9415_k; + double var5 = this.posZ + (this.field_9412_n - this.posZ) / (double)this.field_9415_k; + + for(var7 = this.field_9411_o - (double)this.rotationYaw; var7 < -180.0D; var7 += 360.0D) { + } + + while(var7 >= 180.0D) { + var7 -= 360.0D; + } + + this.rotationYaw = (float)((double)this.rotationYaw + var7 / (double)this.field_9415_k); + this.rotationPitch = (float)((double)this.rotationPitch + (this.field_9410_p - (double)this.rotationPitch) / (double)this.field_9415_k); + --this.field_9415_k; + this.setPosition(var46, var47, var5); + this.setRotation(this.rotationYaw, this.rotationPitch); + } else { + this.setPosition(this.posX, this.posY, this.posZ); + this.setRotation(this.rotationYaw, this.rotationPitch); + } + + } else { + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + this.motionY -= (double)0.04F; + int var1 = MathHelper.floor_double(this.posX); + int var2 = MathHelper.floor_double(this.posY); + int var3 = MathHelper.floor_double(this.posZ); + if(BlockRail.isRailBlockAt(this.worldObj, var1, var2 - 1, var3)) { + --var2; + } + + double var4 = 0.4D; + boolean var6 = false; + var7 = 1.0D / 128.0D; + int var9 = this.worldObj.getBlockId(var1, var2, var3); + if(BlockRail.isRailBlock(var9)) { + Vec3D var10 = this.func_514_g(this.posX, this.posY, this.posZ); + int var11 = this.worldObj.getBlockMetadata(var1, var2, var3); + this.posY = (double)var2; + boolean var12 = false; + boolean var13 = false; + if(var9 == Block.railPowered.blockID) { + var12 = (var11 & 8) != 0; + var13 = !var12; + } + + if(((BlockRail)Block.blocksList[var9]).getIsPowered()) { + var11 &= 7; + } + + if(var11 >= 2 && var11 <= 5) { + this.posY = (double)(var2 + 1); + } + + if(var11 == 2) { + this.motionX -= var7; + } + + if(var11 == 3) { + this.motionX += var7; + } + + if(var11 == 4) { + this.motionZ += var7; + } + + if(var11 == 5) { + this.motionZ -= var7; + } + + int[][] var14 = field_855_j[var11]; + double var15 = (double)(var14[1][0] - var14[0][0]); + double var17 = (double)(var14[1][2] - var14[0][2]); + double var19 = Math.sqrt(var15 * var15 + var17 * var17); + double var21 = this.motionX * var15 + this.motionZ * var17; + if(var21 < 0.0D) { + var15 = -var15; + var17 = -var17; + } + + double var23 = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ); + this.motionX = var23 * var15 / var19; + this.motionZ = var23 * var17 / var19; + double var25; + if(var13) { + var25 = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ); + if(var25 < 0.03D) { + this.motionX *= 0.0D; + this.motionY *= 0.0D; + this.motionZ *= 0.0D; + } else { + this.motionX *= 0.5D; + this.motionY *= 0.0D; + this.motionZ *= 0.5D; + } + } + + var25 = 0.0D; + double var27 = (double)var1 + 0.5D + (double)var14[0][0] * 0.5D; + double var29 = (double)var3 + 0.5D + (double)var14[0][2] * 0.5D; + double var31 = (double)var1 + 0.5D + (double)var14[1][0] * 0.5D; + double var33 = (double)var3 + 0.5D + (double)var14[1][2] * 0.5D; + var15 = var31 - var27; + var17 = var33 - var29; + double var35; + double var37; + double var39; + if(var15 == 0.0D) { + this.posX = (double)var1 + 0.5D; + var25 = this.posZ - (double)var3; + } else if(var17 == 0.0D) { + this.posZ = (double)var3 + 0.5D; + var25 = this.posX - (double)var1; + } else { + var35 = this.posX - var27; + var37 = this.posZ - var29; + var39 = (var35 * var15 + var37 * var17) * 2.0D; + var25 = var39; + } + + this.posX = var27 + var15 * var25; + this.posZ = var29 + var17 * var25; + this.setPosition(this.posX, this.posY + (double)this.yOffset, this.posZ); + var35 = this.motionX; + var37 = this.motionZ; + if(this.riddenByEntity != null) { + var35 *= 0.75D; + var37 *= 0.75D; + } + + if(var35 < -var4) { + var35 = -var4; + } + + if(var35 > var4) { + var35 = var4; + } + + if(var37 < -var4) { + var37 = -var4; + } + + if(var37 > var4) { + var37 = var4; + } + + this.moveEntity(var35, 0.0D, var37); + if(var14[0][1] != 0 && MathHelper.floor_double(this.posX) - var1 == var14[0][0] && MathHelper.floor_double(this.posZ) - var3 == var14[0][2]) { + this.setPosition(this.posX, this.posY + (double)var14[0][1], this.posZ); + } else if(var14[1][1] != 0 && MathHelper.floor_double(this.posX) - var1 == var14[1][0] && MathHelper.floor_double(this.posZ) - var3 == var14[1][2]) { + this.setPosition(this.posX, this.posY + (double)var14[1][1], this.posZ); + } + + if(this.riddenByEntity != null) { + this.motionX *= (double)0.997F; + this.motionY *= 0.0D; + this.motionZ *= (double)0.997F; + } else { + if(this.minecartType == 2) { + var39 = (double)MathHelper.sqrt_double(this.pushX * this.pushX + this.pushZ * this.pushZ); + if(var39 > 0.01D) { + var6 = true; + this.pushX /= var39; + this.pushZ /= var39; + double var41 = 0.04D; + this.motionX *= (double)0.8F; + this.motionY *= 0.0D; + this.motionZ *= (double)0.8F; + this.motionX += this.pushX * var41; + this.motionZ += this.pushZ * var41; + } else { + this.motionX *= (double)0.9F; + this.motionY *= 0.0D; + this.motionZ *= (double)0.9F; + } + } + + this.motionX *= (double)0.96F; + this.motionY *= 0.0D; + this.motionZ *= (double)0.96F; + } + + Vec3D var52 = this.func_514_g(this.posX, this.posY, this.posZ); + if(var52 != null && var10 != null) { + double var40 = (var10.yCoord - var52.yCoord) * 0.05D; + var23 = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ); + if(var23 > 0.0D) { + this.motionX = this.motionX / var23 * (var23 + var40); + this.motionZ = this.motionZ / var23 * (var23 + var40); + } + + this.setPosition(this.posX, var52.yCoord, this.posZ); + } + + int var53 = MathHelper.floor_double(this.posX); + int var54 = MathHelper.floor_double(this.posZ); + if(var53 != var1 || var54 != var3) { + var23 = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ); + this.motionX = var23 * (double)(var53 - var1); + this.motionZ = var23 * (double)(var54 - var3); + } + + double var42; + if(this.minecartType == 2) { + var42 = (double)MathHelper.sqrt_double(this.pushX * this.pushX + this.pushZ * this.pushZ); + if(var42 > 0.01D && this.motionX * this.motionX + this.motionZ * this.motionZ > 0.001D) { + this.pushX /= var42; + this.pushZ /= var42; + if(this.pushX * this.motionX + this.pushZ * this.motionZ < 0.0D) { + this.pushX = 0.0D; + this.pushZ = 0.0D; + } else { + this.pushX = this.motionX; + this.pushZ = this.motionZ; + } + } + } + + if(var12) { + var42 = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ); + if(var42 > 0.01D) { + double var44 = 0.06D; + this.motionX += this.motionX / var42 * var44; + this.motionZ += this.motionZ / var42 * var44; + } else if(var11 == 1) { + if(this.worldObj.isBlockNormalCube(var1 - 1, var2, var3)) { + this.motionX = 0.02D; + } else if(this.worldObj.isBlockNormalCube(var1 + 1, var2, var3)) { + this.motionX = -0.02D; + } + } else if(var11 == 0) { + if(this.worldObj.isBlockNormalCube(var1, var2, var3 - 1)) { + this.motionZ = 0.02D; + } else if(this.worldObj.isBlockNormalCube(var1, var2, var3 + 1)) { + this.motionZ = -0.02D; + } + } + } + } else { + if(this.motionX < -var4) { + this.motionX = -var4; + } + + if(this.motionX > var4) { + this.motionX = var4; + } + + if(this.motionZ < -var4) { + this.motionZ = -var4; + } + + if(this.motionZ > var4) { + this.motionZ = var4; + } + + if(this.onGround) { + this.motionX *= 0.5D; + this.motionY *= 0.5D; + this.motionZ *= 0.5D; + } + + this.moveEntity(this.motionX, this.motionY, this.motionZ); + if(!this.onGround) { + this.motionX *= (double)0.95F; + this.motionY *= (double)0.95F; + this.motionZ *= (double)0.95F; + } + } + + this.rotationPitch = 0.0F; + double var48 = this.prevPosX - this.posX; + double var49 = this.prevPosZ - this.posZ; + if(var48 * var48 + var49 * var49 > 0.001D) { + this.rotationYaw = (float)(Math.atan2(var49, var48) * 180.0D / Math.PI); + if(this.field_856_i) { + this.rotationYaw += 180.0F; + } + } + + double var50; + for(var50 = (double)(this.rotationYaw - this.prevRotationYaw); var50 >= 180.0D; var50 -= 360.0D) { + } + + while(var50 < -180.0D) { + var50 += 360.0D; + } + + if(var50 < -170.0D || var50 >= 170.0D) { + this.rotationYaw += 180.0F; + this.field_856_i = !this.field_856_i; + } + + this.setRotation(this.rotationYaw, this.rotationPitch); + List var16 = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.expand((double)0.2F, 0.0D, (double)0.2F)); + if(var16 != null && var16.size() > 0) { + for(int var51 = 0; var51 < var16.size(); ++var51) { + Entity var18 = (Entity)var16.get(var51); + if(var18 != this.riddenByEntity && var18.canBePushed() && var18 instanceof EntityMinecart) { + var18.applyEntityCollision(this); + } + } + } + + if(this.riddenByEntity != null && this.riddenByEntity.isDead) { + this.riddenByEntity = null; + } + + if(var6 && this.rand.nextInt(4) == 0) { + --this.fuel; + if(this.fuel < 0) { + this.pushX = this.pushZ = 0.0D; + } + + this.worldObj.spawnParticle("largesmoke", this.posX, this.posY + 0.8D, this.posZ, 0.0D, 0.0D, 0.0D); + } + + } + } + + public Vec3D func_515_a(double var1, double var3, double var5, double var7) { + int var9 = MathHelper.floor_double(var1); + int var10 = MathHelper.floor_double(var3); + int var11 = MathHelper.floor_double(var5); + if(BlockRail.isRailBlockAt(this.worldObj, var9, var10 - 1, var11)) { + --var10; + } + + int var12 = this.worldObj.getBlockId(var9, var10, var11); + if(!BlockRail.isRailBlock(var12)) { + return null; + } else { + int var13 = this.worldObj.getBlockMetadata(var9, var10, var11); + if(((BlockRail)Block.blocksList[var12]).getIsPowered()) { + var13 &= 7; + } + + var3 = (double)var10; + if(var13 >= 2 && var13 <= 5) { + var3 = (double)(var10 + 1); + } + + int[][] var14 = field_855_j[var13]; + double var15 = (double)(var14[1][0] - var14[0][0]); + double var17 = (double)(var14[1][2] - var14[0][2]); + double var19 = Math.sqrt(var15 * var15 + var17 * var17); + var15 /= var19; + var17 /= var19; + var1 += var15 * var7; + var5 += var17 * var7; + if(var14[0][1] != 0 && MathHelper.floor_double(var1) - var9 == var14[0][0] && MathHelper.floor_double(var5) - var11 == var14[0][2]) { + var3 += (double)var14[0][1]; + } else if(var14[1][1] != 0 && MathHelper.floor_double(var1) - var9 == var14[1][0] && MathHelper.floor_double(var5) - var11 == var14[1][2]) { + var3 += (double)var14[1][1]; + } + + return this.func_514_g(var1, var3, var5); + } + } + + public Vec3D func_514_g(double var1, double var3, double var5) { + int var7 = MathHelper.floor_double(var1); + int var8 = MathHelper.floor_double(var3); + int var9 = MathHelper.floor_double(var5); + if(BlockRail.isRailBlockAt(this.worldObj, var7, var8 - 1, var9)) { + --var8; + } + + int var10 = this.worldObj.getBlockId(var7, var8, var9); + if(BlockRail.isRailBlock(var10)) { + int var11 = this.worldObj.getBlockMetadata(var7, var8, var9); + var3 = (double)var8; + if(((BlockRail)Block.blocksList[var10]).getIsPowered()) { + var11 &= 7; + } + + if(var11 >= 2 && var11 <= 5) { + var3 = (double)(var8 + 1); + } + + int[][] var12 = field_855_j[var11]; + double var13 = 0.0D; + double var15 = (double)var7 + 0.5D + (double)var12[0][0] * 0.5D; + double var17 = (double)var8 + 0.5D + (double)var12[0][1] * 0.5D; + double var19 = (double)var9 + 0.5D + (double)var12[0][2] * 0.5D; + double var21 = (double)var7 + 0.5D + (double)var12[1][0] * 0.5D; + double var23 = (double)var8 + 0.5D + (double)var12[1][1] * 0.5D; + double var25 = (double)var9 + 0.5D + (double)var12[1][2] * 0.5D; + double var27 = var21 - var15; + double var29 = (var23 - var17) * 2.0D; + double var31 = var25 - var19; + if(var27 == 0.0D) { + var1 = (double)var7 + 0.5D; + var13 = var5 - (double)var9; + } else if(var31 == 0.0D) { + var5 = (double)var9 + 0.5D; + var13 = var1 - (double)var7; + } else { + double var33 = var1 - var15; + double var35 = var5 - var19; + double var37 = (var33 * var27 + var35 * var31) * 2.0D; + var13 = var37; + } + + var1 = var15 + var27 * var13; + var3 = var17 + var29 * var13; + var5 = var19 + var31 * var13; + if(var29 < 0.0D) { + ++var3; + } + + if(var29 > 0.0D) { + var3 += 0.5D; + } + + return Vec3D.createVector(var1, var3, var5); + } else { + return null; + } + } + + protected void writeEntityToNBT(NBTTagCompound var1) { + var1.setInteger("Type", this.minecartType); + if(this.minecartType == 2) { + var1.setDouble("PushX", this.pushX); + var1.setDouble("PushZ", this.pushZ); + var1.setShort("Fuel", (short)this.fuel); + } else if(this.minecartType == 1) { + NBTTagList var2 = new NBTTagList(); + + for(int var3 = 0; var3 < this.cargoItems.length; ++var3) { + if(this.cargoItems[var3] != null) { + NBTTagCompound var4 = new NBTTagCompound(); + var4.setByte("Slot", (byte)var3); + this.cargoItems[var3].writeToNBT(var4); + var2.setTag(var4); + } + } + + var1.setTag("Items", var2); + } + + } + + protected void readEntityFromNBT(NBTTagCompound var1) { + this.minecartType = var1.getInteger("Type"); + if(this.minecartType == 2) { + this.pushX = var1.getDouble("PushX"); + this.pushZ = var1.getDouble("PushZ"); + this.fuel = var1.getShort("Fuel"); + } else if(this.minecartType == 1) { + NBTTagList var2 = var1.getTagList("Items"); + this.cargoItems = new ItemStack[this.getSizeInventory()]; + + for(int var3 = 0; var3 < var2.tagCount(); ++var3) { + NBTTagCompound var4 = (NBTTagCompound)var2.tagAt(var3); + int var5 = var4.getByte("Slot") & 255; + if(var5 >= 0 && var5 < this.cargoItems.length) { + this.cargoItems[var5] = new ItemStack(var4); + } + } + } + + } + + public float getShadowSize() { + return 0.0F; + } + + public void applyEntityCollision(Entity var1) { + if(!this.worldObj.multiplayerWorld) { + if(var1 != this.riddenByEntity) { + if(var1 instanceof EntityLiving && !(var1 instanceof EntityPlayer) && this.minecartType == 0 && this.motionX * this.motionX + this.motionZ * this.motionZ > 0.01D && this.riddenByEntity == null && var1.ridingEntity == null) { + var1.mountEntity(this); + } + + double var2 = var1.posX - this.posX; + double var4 = var1.posZ - this.posZ; + double var6 = var2 * var2 + var4 * var4; + if(var6 >= (double)1.0E-4F) { + var6 = (double)MathHelper.sqrt_double(var6); + var2 /= var6; + var4 /= var6; + double var8 = 1.0D / var6; + if(var8 > 1.0D) { + var8 = 1.0D; + } + + var2 *= var8; + var4 *= var8; + var2 *= (double)0.1F; + var4 *= (double)0.1F; + var2 *= (double)(1.0F - this.entityCollisionReduction); + var4 *= (double)(1.0F - this.entityCollisionReduction); + var2 *= 0.5D; + var4 *= 0.5D; + if(var1 instanceof EntityMinecart) { + double var10 = var1.posX - this.posX; + double var12 = var1.posZ - this.posZ; + double var14 = var10 * var1.motionZ + var12 * var1.prevPosX; + var14 *= var14; + if(var14 > 5.0D) { + return; + } + + double var16 = var1.motionX + this.motionX; + double var18 = var1.motionZ + this.motionZ; + if(((EntityMinecart)var1).minecartType == 2 && this.minecartType != 2) { + this.motionX *= (double)0.2F; + this.motionZ *= (double)0.2F; + this.addVelocity(var1.motionX - var2, 0.0D, var1.motionZ - var4); + var1.motionX *= (double)0.7F; + var1.motionZ *= (double)0.7F; + } else if(((EntityMinecart)var1).minecartType != 2 && this.minecartType == 2) { + var1.motionX *= (double)0.2F; + var1.motionZ *= (double)0.2F; + var1.addVelocity(this.motionX + var2, 0.0D, this.motionZ + var4); + this.motionX *= (double)0.7F; + this.motionZ *= (double)0.7F; + } else { + var16 /= 2.0D; + var18 /= 2.0D; + this.motionX *= (double)0.2F; + this.motionZ *= (double)0.2F; + this.addVelocity(var16 - var2, 0.0D, var18 - var4); + var1.motionX *= (double)0.2F; + var1.motionZ *= (double)0.2F; + var1.addVelocity(var16 + var2, 0.0D, var18 + var4); + } + } else { + this.addVelocity(-var2, 0.0D, -var4); + var1.addVelocity(var2 / 4.0D, 0.0D, var4 / 4.0D); + } + } + + } + } + } + + public int getSizeInventory() { + return 27; + } + + public ItemStack getStackInSlot(int var1) { + return this.cargoItems[var1]; + } + + public ItemStack decrStackSize(int var1, int var2) { + if(this.cargoItems[var1] != null) { + ItemStack var3; + if(this.cargoItems[var1].stackSize <= var2) { + var3 = this.cargoItems[var1]; + this.cargoItems[var1] = null; + return var3; + } else { + var3 = this.cargoItems[var1].splitStack(var2); + if(this.cargoItems[var1].stackSize == 0) { + this.cargoItems[var1] = null; + } + + return var3; + } + } else { + return null; + } + } + + public void setInventorySlotContents(int var1, ItemStack var2) { + this.cargoItems[var1] = var2; + if(var2 != null && var2.stackSize > this.getInventoryStackLimit()) { + var2.stackSize = this.getInventoryStackLimit(); + } + + } + + public String getInvName() { + return "Minecart"; + } + + public int getInventoryStackLimit() { + return 64; + } + + public void onInventoryChanged() { + } + + public boolean interact(EntityPlayer var1) { + if(this.minecartType == 0) { + if(this.riddenByEntity != null && this.riddenByEntity instanceof EntityPlayer && this.riddenByEntity != var1) { + return true; + } + + if(!this.worldObj.multiplayerWorld) { + var1.mountEntity(this); + } + } else if(this.minecartType == 1) { + if(!this.worldObj.multiplayerWorld) { + var1.displayGUIChest(this); + } + } else if(this.minecartType == 2) { + ItemStack var2 = var1.inventory.getCurrentItem(); + if(var2 != null && var2.itemID == Item.coal.shiftedIndex) { + if(--var2.stackSize == 0) { + var1.inventory.setInventorySlotContents(var1.inventory.currentItem, (ItemStack)null); + } + + this.fuel += 1200; + } + + this.pushX = this.posX - var1.posX; + this.pushZ = this.posZ - var1.posZ; + } + + return true; + } + + public void setPositionAndRotation2(double var1, double var3, double var5, float var7, float var8, int var9) { + this.field_9414_l = var1; + this.field_9413_m = var3; + this.field_9412_n = var5; + this.field_9411_o = (double)var7; + this.field_9410_p = (double)var8; + this.field_9415_k = var9 + 2; + this.motionX = this.field_9409_q; + this.motionY = this.field_9408_r; + this.motionZ = this.field_9407_s; + } + + public void setVelocity(double var1, double var3, double var5) { + this.field_9409_q = this.motionX = var1; + this.field_9408_r = this.motionY = var3; + this.field_9407_s = this.motionZ = var5; + } + + public boolean canInteractWith(EntityPlayer var1) { + return this.isDead ? false : var1.getDistanceSqToEntity(this) <= 64.0D; + } +} diff --git a/src/net/minecraft/src/EntityMob.java b/src/net/minecraft/src/EntityMob.java new file mode 100644 index 0000000..06ff541 --- /dev/null +++ b/src/net/minecraft/src/EntityMob.java @@ -0,0 +1,87 @@ +package net.minecraft.src; + +public class EntityMob extends EntityCreature implements IMob { + protected int attackStrength = 2; + + public EntityMob(World var1) { + super(var1); + this.health = 20; + } + + public void onLivingUpdate() { + float var1 = this.getEntityBrightness(1.0F); + if(var1 > 0.5F) { + this.entityAge += 2; + } + + super.onLivingUpdate(); + } + + public void onUpdate() { + super.onUpdate(); + if(!this.worldObj.multiplayerWorld && this.worldObj.difficultySetting == 0) { + this.setEntityDead(); + } + + } + + protected Entity findPlayerToAttack() { + EntityPlayer var1 = this.worldObj.getClosestPlayerToEntity(this, 16.0D); + return var1 != null && this.canEntityBeSeen(var1) ? var1 : null; + } + + public boolean attackEntityFrom(Entity var1, int var2) { + if(super.attackEntityFrom(var1, var2)) { + if(this.riddenByEntity != var1 && this.ridingEntity != var1) { + if(var1 != this) { + this.playerToAttack = var1; + } + + return true; + } else { + return true; + } + } else { + return false; + } + } + + protected void attackEntity(Entity var1, float var2) { + if(this.attackTime <= 0 && var2 < 2.0F && var1.boundingBox.maxY > this.boundingBox.minY && var1.boundingBox.minY < this.boundingBox.maxY) { + this.attackTime = 20; + var1.attackEntityFrom(this, this.attackStrength); + } + + } + + protected float getBlockPathWeight(int var1, int var2, int var3) { + return 0.5F - this.worldObj.getLightBrightness(var1, var2, var3); + } + + public void writeEntityToNBT(NBTTagCompound var1) { + super.writeEntityToNBT(var1); + } + + public void readEntityFromNBT(NBTTagCompound var1) { + super.readEntityFromNBT(var1); + } + + public boolean getCanSpawnHere() { + int var1 = MathHelper.floor_double(this.posX); + int var2 = MathHelper.floor_double(this.boundingBox.minY); + int var3 = MathHelper.floor_double(this.posZ); + if(this.worldObj.getSavedLightValue(EnumSkyBlock.Sky, var1, var2, var3) > this.rand.nextInt(32)) { + return false; + } else { + int var4 = this.worldObj.getBlockLightValue(var1, var2, var3); + if(this.worldObj.func_27160_B()) { + int var5 = this.worldObj.skylightSubtracted; + this.worldObj.skylightSubtracted = 10; + var4 = this.worldObj.getBlockLightValue(var1, var2, var3); + this.worldObj.skylightSubtracted = var5; + } + + return var4 <= this.rand.nextInt(8) && super.getCanSpawnHere(); + } + } +} diff --git a/src/net/minecraft/src/EntityNoteFX.java b/src/net/minecraft/src/EntityNoteFX.java new file mode 100644 index 0000000..c65255b --- /dev/null +++ b/src/net/minecraft/src/EntityNoteFX.java @@ -0,0 +1,64 @@ +package net.minecraft.src; + +public class EntityNoteFX extends EntityFX { + float field_21065_a; + + public EntityNoteFX(World var1, double var2, double var4, double var6, double var8, double var10, double var12) { + this(var1, var2, var4, var6, var8, var10, var12, 2.0F); + } + + public EntityNoteFX(World var1, double var2, double var4, double var6, double var8, double var10, double var12, float var14) { + super(var1, var2, var4, var6, 0.0D, 0.0D, 0.0D); + this.motionX *= (double)0.01F; + this.motionY *= (double)0.01F; + this.motionZ *= (double)0.01F; + this.motionY += 0.2D; + this.particleRed = MathHelper.sin(((float)var8 + 0.0F) * (float)Math.PI * 2.0F) * 0.65F + 0.35F; + this.particleGreen = MathHelper.sin(((float)var8 + 1.0F / 3.0F) * (float)Math.PI * 2.0F) * 0.65F + 0.35F; + this.particleBlue = MathHelper.sin(((float)var8 + 2.0F / 3.0F) * (float)Math.PI * 2.0F) * 0.65F + 0.35F; + this.particleScale *= 12.0F / 16.0F; + this.particleScale *= var14; + this.field_21065_a = this.particleScale; + this.particleMaxAge = 6; + this.noClip = false; + this.particleTextureIndex = 64; + } + + public void renderParticle(Tessellator var1, float var2, float var3, float var4, float var5, float var6, float var7) { + float var8 = ((float)this.particleAge + var2) / (float)this.particleMaxAge * 32.0F; + if(var8 < 0.0F) { + var8 = 0.0F; + } + + if(var8 > 1.0F) { + var8 = 1.0F; + } + + this.particleScale = this.field_21065_a * var8; + super.renderParticle(var1, var2, var3, var4, var5, var6, var7); + } + + public void onUpdate() { + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + if(this.particleAge++ >= this.particleMaxAge) { + this.setEntityDead(); + } + + this.moveEntity(this.motionX, this.motionY, this.motionZ); + if(this.posY == this.prevPosY) { + this.motionX *= 1.1D; + this.motionZ *= 1.1D; + } + + this.motionX *= (double)0.66F; + this.motionY *= (double)0.66F; + this.motionZ *= (double)0.66F; + if(this.onGround) { + this.motionX *= (double)0.7F; + this.motionZ *= (double)0.7F; + } + + } +} diff --git a/src/net/minecraft/src/EntityOtherPlayerMP.java b/src/net/minecraft/src/EntityOtherPlayerMP.java new file mode 100644 index 0000000..25f3211 --- /dev/null +++ b/src/net/minecraft/src/EntityOtherPlayerMP.java @@ -0,0 +1,119 @@ +package net.minecraft.src; + +public class EntityOtherPlayerMP extends EntityPlayer { + private int field_785_bg; + private double field_784_bh; + private double field_783_bi; + private double field_782_bj; + private double field_780_bk; + private double field_786_bl; + float field_20924_a = 0.0F; + + public EntityOtherPlayerMP(World var1, String var2) { + super(var1); + this.username = var2; + this.yOffset = 0.0F; + this.stepHeight = 0.0F; + if(var2 != null && var2.length() > 0) { + this.skinUrl = "http://s3.amazonaws.com/MinecraftSkins/" + var2 + ".png"; + } + + this.noClip = true; + this.field_22062_y = 0.25F; + this.renderDistanceWeight = 10.0D; + } + + protected void resetHeight() { + this.yOffset = 0.0F; + } + + public boolean attackEntityFrom(Entity var1, int var2) { + return true; + } + + public void setPositionAndRotation2(double var1, double var3, double var5, float var7, float var8, int var9) { + this.field_784_bh = var1; + this.field_783_bi = var3; + this.field_782_bj = var5; + this.field_780_bk = (double)var7; + this.field_786_bl = (double)var8; + this.field_785_bg = var9; + } + + public void onUpdate() { + this.field_22062_y = 0.0F; + super.onUpdate(); + this.field_705_Q = this.field_704_R; + double var1 = this.posX - this.prevPosX; + double var3 = this.posZ - this.prevPosZ; + float var5 = MathHelper.sqrt_double(var1 * var1 + var3 * var3) * 4.0F; + if(var5 > 1.0F) { + var5 = 1.0F; + } + + this.field_704_R += (var5 - this.field_704_R) * 0.4F; + this.field_703_S += this.field_704_R; + } + + public float getShadowSize() { + return 0.0F; + } + + public void onLivingUpdate() { + super.updatePlayerActionState(); + if(this.field_785_bg > 0) { + double var1 = this.posX + (this.field_784_bh - this.posX) / (double)this.field_785_bg; + double var3 = this.posY + (this.field_783_bi - this.posY) / (double)this.field_785_bg; + double var5 = this.posZ + (this.field_782_bj - this.posZ) / (double)this.field_785_bg; + + double var7; + for(var7 = this.field_780_bk - (double)this.rotationYaw; var7 < -180.0D; var7 += 360.0D) { + } + + while(var7 >= 180.0D) { + var7 -= 360.0D; + } + + this.rotationYaw = (float)((double)this.rotationYaw + var7 / (double)this.field_785_bg); + this.rotationPitch = (float)((double)this.rotationPitch + (this.field_786_bl - (double)this.rotationPitch) / (double)this.field_785_bg); + --this.field_785_bg; + this.setPosition(var1, var3, var5); + this.setRotation(this.rotationYaw, this.rotationPitch); + } + + this.field_775_e = this.field_774_f; + float var9 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); + float var2 = (float)Math.atan(-this.motionY * (double)0.2F) * 15.0F; + if(var9 > 0.1F) { + var9 = 0.1F; + } + + if(!this.onGround || this.health <= 0) { + var9 = 0.0F; + } + + if(this.onGround || this.health <= 0) { + var2 = 0.0F; + } + + this.field_774_f += (var9 - this.field_774_f) * 0.4F; + this.field_9328_R += (var2 - this.field_9328_R) * 0.8F; + } + + public void outfitWithItem(int var1, int var2, int var3) { + ItemStack var4 = null; + if(var2 >= 0) { + var4 = new ItemStack(var2, 1, var3); + } + + if(var1 == 0) { + this.inventory.mainInventory[this.inventory.currentItem] = var4; + } else { + this.inventory.armorInventory[var1 - 1] = var4; + } + + } + + public void func_6420_o() { + } +} diff --git a/src/net/minecraft/src/EntityPainting.java b/src/net/minecraft/src/EntityPainting.java new file mode 100644 index 0000000..a78af53 --- /dev/null +++ b/src/net/minecraft/src/EntityPainting.java @@ -0,0 +1,256 @@ +package net.minecraft.src; + +import java.util.ArrayList; +import java.util.List; + +public class EntityPainting extends Entity { + private int field_695_c; + public int direction; + public int xPosition; + public int yPosition; + public int zPosition; + public EnumArt art; + + public EntityPainting(World var1) { + super(var1); + this.field_695_c = 0; + this.direction = 0; + this.yOffset = 0.0F; + this.setSize(0.5F, 0.5F); + } + + public EntityPainting(World var1, int var2, int var3, int var4, int var5) { + this(var1); + this.xPosition = var2; + this.yPosition = var3; + this.zPosition = var4; + ArrayList var6 = new ArrayList(); + EnumArt[] var7 = EnumArt.values(); + int var8 = var7.length; + + for(int var9 = 0; var9 < var8; ++var9) { + EnumArt var10 = var7[var9]; + this.art = var10; + this.func_412_b(var5); + if(this.func_410_i()) { + var6.add(var10); + } + } + + if(var6.size() > 0) { + this.art = (EnumArt)var6.get(this.rand.nextInt(var6.size())); + } + + this.func_412_b(var5); + } + + public EntityPainting(World var1, int var2, int var3, int var4, int var5, String var6) { + this(var1); + this.xPosition = var2; + this.yPosition = var3; + this.zPosition = var4; + EnumArt[] var7 = EnumArt.values(); + int var8 = var7.length; + + for(int var9 = 0; var9 < var8; ++var9) { + EnumArt var10 = var7[var9]; + if(var10.title.equals(var6)) { + this.art = var10; + break; + } + } + + this.func_412_b(var5); + } + + protected void entityInit() { + } + + public void func_412_b(int var1) { + this.direction = var1; + this.prevRotationYaw = this.rotationYaw = (float)(var1 * 90); + float var2 = (float)this.art.sizeX; + float var3 = (float)this.art.sizeY; + float var4 = (float)this.art.sizeX; + if(var1 != 0 && var1 != 2) { + var2 = 0.5F; + } else { + var4 = 0.5F; + } + + var2 /= 32.0F; + var3 /= 32.0F; + var4 /= 32.0F; + float var5 = (float)this.xPosition + 0.5F; + float var6 = (float)this.yPosition + 0.5F; + float var7 = (float)this.zPosition + 0.5F; + float var8 = 9.0F / 16.0F; + if(var1 == 0) { + var7 -= var8; + } + + if(var1 == 1) { + var5 -= var8; + } + + if(var1 == 2) { + var7 += var8; + } + + if(var1 == 3) { + var5 += var8; + } + + if(var1 == 0) { + var5 -= this.func_411_c(this.art.sizeX); + } + + if(var1 == 1) { + var7 += this.func_411_c(this.art.sizeX); + } + + if(var1 == 2) { + var5 += this.func_411_c(this.art.sizeX); + } + + if(var1 == 3) { + var7 -= this.func_411_c(this.art.sizeX); + } + + var6 += this.func_411_c(this.art.sizeY); + this.setPosition((double)var5, (double)var6, (double)var7); + float var9 = -(0.1F / 16.0F); + this.boundingBox.setBounds((double)(var5 - var2 - var9), (double)(var6 - var3 - var9), (double)(var7 - var4 - var9), (double)(var5 + var2 + var9), (double)(var6 + var3 + var9), (double)(var7 + var4 + var9)); + } + + private float func_411_c(int var1) { + return var1 == 32 ? 0.5F : (var1 == 64 ? 0.5F : 0.0F); + } + + public void onUpdate() { + if(this.field_695_c++ == 100 && !this.worldObj.multiplayerWorld) { + this.field_695_c = 0; + if(!this.func_410_i()) { + this.setEntityDead(); + this.worldObj.entityJoinedWorld(new EntityItem(this.worldObj, this.posX, this.posY, this.posZ, new ItemStack(Item.painting))); + } + } + + } + + public boolean func_410_i() { + if(this.worldObj.getCollidingBoundingBoxes(this, this.boundingBox).size() > 0) { + return false; + } else { + int var1 = this.art.sizeX / 16; + int var2 = this.art.sizeY / 16; + int var3 = this.xPosition; + int var4 = this.yPosition; + int var5 = this.zPosition; + if(this.direction == 0) { + var3 = MathHelper.floor_double(this.posX - (double)((float)this.art.sizeX / 32.0F)); + } + + if(this.direction == 1) { + var5 = MathHelper.floor_double(this.posZ - (double)((float)this.art.sizeX / 32.0F)); + } + + if(this.direction == 2) { + var3 = MathHelper.floor_double(this.posX - (double)((float)this.art.sizeX / 32.0F)); + } + + if(this.direction == 3) { + var5 = MathHelper.floor_double(this.posZ - (double)((float)this.art.sizeX / 32.0F)); + } + + var4 = MathHelper.floor_double(this.posY - (double)((float)this.art.sizeY / 32.0F)); + + int var7; + for(int var6 = 0; var6 < var1; ++var6) { + for(var7 = 0; var7 < var2; ++var7) { + Material var8; + if(this.direction != 0 && this.direction != 2) { + var8 = this.worldObj.getBlockMaterial(this.xPosition, var4 + var7, var5 + var6); + } else { + var8 = this.worldObj.getBlockMaterial(var3 + var6, var4 + var7, this.zPosition); + } + + if(!var8.isSolid()) { + return false; + } + } + } + + List var9 = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox); + + for(var7 = 0; var7 < var9.size(); ++var7) { + if(var9.get(var7) instanceof EntityPainting) { + return false; + } + } + + return true; + } + } + + public boolean canBeCollidedWith() { + return true; + } + + public boolean attackEntityFrom(Entity var1, int var2) { + if(!this.isDead && !this.worldObj.multiplayerWorld) { + this.setEntityDead(); + this.setBeenAttacked(); + this.worldObj.entityJoinedWorld(new EntityItem(this.worldObj, this.posX, this.posY, this.posZ, new ItemStack(Item.painting))); + } + + return true; + } + + public void writeEntityToNBT(NBTTagCompound var1) { + var1.setByte("Dir", (byte)this.direction); + var1.setString("Motive", this.art.title); + var1.setInteger("TileX", this.xPosition); + var1.setInteger("TileY", this.yPosition); + var1.setInteger("TileZ", this.zPosition); + } + + public void readEntityFromNBT(NBTTagCompound var1) { + this.direction = var1.getByte("Dir"); + this.xPosition = var1.getInteger("TileX"); + this.yPosition = var1.getInteger("TileY"); + this.zPosition = var1.getInteger("TileZ"); + String var2 = var1.getString("Motive"); + EnumArt[] var3 = EnumArt.values(); + int var4 = var3.length; + + for(int var5 = 0; var5 < var4; ++var5) { + EnumArt var6 = var3[var5]; + if(var6.title.equals(var2)) { + this.art = var6; + } + } + + if(this.art == null) { + this.art = EnumArt.Kebab; + } + + this.func_412_b(this.direction); + } + + public void moveEntity(double var1, double var3, double var5) { + if(!this.worldObj.multiplayerWorld && var1 * var1 + var3 * var3 + var5 * var5 > 0.0D) { + this.setEntityDead(); + this.worldObj.entityJoinedWorld(new EntityItem(this.worldObj, this.posX, this.posY, this.posZ, new ItemStack(Item.painting))); + } + + } + + public void addVelocity(double var1, double var3, double var5) { + if(!this.worldObj.multiplayerWorld && var1 * var1 + var3 * var3 + var5 * var5 > 0.0D) { + this.setEntityDead(); + this.worldObj.entityJoinedWorld(new EntityItem(this.worldObj, this.posX, this.posY, this.posZ, new ItemStack(Item.painting))); + } + + } +} diff --git a/src/net/minecraft/src/EntityPickupFX.java b/src/net/minecraft/src/EntityPickupFX.java new file mode 100644 index 0000000..37ccfeb --- /dev/null +++ b/src/net/minecraft/src/EntityPickupFX.java @@ -0,0 +1,54 @@ +package net.minecraft.src; + +import org.lwjgl.opengl.GL11; + +public class EntityPickupFX extends EntityFX { + private Entity field_675_a; + private Entity field_679_o; + private int field_678_p = 0; + private int field_677_q = 0; + private float field_676_r; + + public EntityPickupFX(World var1, Entity var2, Entity var3, float var4) { + super(var1, var2.posX, var2.posY, var2.posZ, var2.motionX, var2.motionY, var2.motionZ); + this.field_675_a = var2; + this.field_679_o = var3; + this.field_677_q = 3; + this.field_676_r = var4; + } + + public void renderParticle(Tessellator var1, float var2, float var3, float var4, float var5, float var6, float var7) { + float var8 = ((float)this.field_678_p + var2) / (float)this.field_677_q; + var8 *= var8; + double var9 = this.field_675_a.posX; + double var11 = this.field_675_a.posY; + double var13 = this.field_675_a.posZ; + double var15 = this.field_679_o.lastTickPosX + (this.field_679_o.posX - this.field_679_o.lastTickPosX) * (double)var2; + double var17 = this.field_679_o.lastTickPosY + (this.field_679_o.posY - this.field_679_o.lastTickPosY) * (double)var2 + (double)this.field_676_r; + double var19 = this.field_679_o.lastTickPosZ + (this.field_679_o.posZ - this.field_679_o.lastTickPosZ) * (double)var2; + double var21 = var9 + (var15 - var9) * (double)var8; + double var23 = var11 + (var17 - var11) * (double)var8; + double var25 = var13 + (var19 - var13) * (double)var8; + int var27 = MathHelper.floor_double(var21); + int var28 = MathHelper.floor_double(var23 + (double)(this.yOffset / 2.0F)); + int var29 = MathHelper.floor_double(var25); + float var30 = this.worldObj.getLightBrightness(var27, var28, var29); + var21 -= interpPosX; + var23 -= interpPosY; + var25 -= interpPosZ; + GL11.glColor4f(var30, var30, var30, 1.0F); + RenderManager.instance.renderEntityWithPosYaw(this.field_675_a, (double)((float)var21), (double)((float)var23), (double)((float)var25), this.field_675_a.rotationYaw, var2); + } + + public void onUpdate() { + ++this.field_678_p; + if(this.field_678_p == this.field_677_q) { + this.setEntityDead(); + } + + } + + public int getFXLayer() { + return 3; + } +} diff --git a/src/net/minecraft/src/EntityPig.java b/src/net/minecraft/src/EntityPig.java new file mode 100644 index 0000000..6e4eaf7 --- /dev/null +++ b/src/net/minecraft/src/EntityPig.java @@ -0,0 +1,78 @@ +package net.minecraft.src; + +public class EntityPig extends EntityAnimal { + public EntityPig(World var1) { + super(var1); + this.texture = "/mob/pig.png"; + this.setSize(0.9F, 0.9F); + } + + protected void entityInit() { + this.dataWatcher.addObject(16, Byte.valueOf((byte)0)); + } + + public void writeEntityToNBT(NBTTagCompound var1) { + super.writeEntityToNBT(var1); + var1.setBoolean("Saddle", this.getSaddled()); + } + + public void readEntityFromNBT(NBTTagCompound var1) { + super.readEntityFromNBT(var1); + this.setSaddled(var1.getBoolean("Saddle")); + } + + protected String getLivingSound() { + return "mob.pig"; + } + + protected String getHurtSound() { + return "mob.pig"; + } + + protected String getDeathSound() { + return "mob.pigdeath"; + } + + public boolean interact(EntityPlayer var1) { + if(!this.getSaddled() || this.worldObj.multiplayerWorld || this.riddenByEntity != null && this.riddenByEntity != var1) { + return false; + } else { + var1.mountEntity(this); + return true; + } + } + + protected int getDropItemId() { + return this.fire > 0 ? Item.porkCooked.shiftedIndex : Item.porkRaw.shiftedIndex; + } + + public boolean getSaddled() { + return (this.dataWatcher.getWatchableObjectByte(16) & 1) != 0; + } + + public void setSaddled(boolean var1) { + if(var1) { + this.dataWatcher.updateObject(16, Byte.valueOf((byte)1)); + } else { + this.dataWatcher.updateObject(16, Byte.valueOf((byte)0)); + } + + } + + public void onStruckByLightning(EntityLightningBolt var1) { + if(!this.worldObj.multiplayerWorld) { + EntityPigZombie var2 = new EntityPigZombie(this.worldObj); + var2.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch); + this.worldObj.entityJoinedWorld(var2); + this.setEntityDead(); + } + } + + protected void fall(float var1) { + super.fall(var1); + if(var1 > 5.0F && this.riddenByEntity instanceof EntityPlayer) { + ((EntityPlayer)this.riddenByEntity).triggerAchievement(AchievementList.flyPig); + } + + } +} diff --git a/src/net/minecraft/src/EntityPigZombie.java b/src/net/minecraft/src/EntityPigZombie.java new file mode 100644 index 0000000..de9f0a2 --- /dev/null +++ b/src/net/minecraft/src/EntityPigZombie.java @@ -0,0 +1,92 @@ +package net.minecraft.src; + +import java.util.List; + +public class EntityPigZombie extends EntityZombie { + private int angerLevel = 0; + private int randomSoundDelay = 0; + private static final ItemStack defaultHeldItem = new ItemStack(Item.swordGold, 1); + + public EntityPigZombie(World var1) { + super(var1); + this.texture = "/mob/pigzombie.png"; + this.moveSpeed = 0.5F; + this.attackStrength = 5; + this.isImmuneToFire = true; + } + + public void onUpdate() { + this.moveSpeed = this.playerToAttack != null ? 0.95F : 0.5F; + if(this.randomSoundDelay > 0 && --this.randomSoundDelay == 0) { + this.worldObj.playSoundAtEntity(this, "mob.zombiepig.zpigangry", this.getSoundVolume() * 2.0F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F) * 1.8F); + } + + super.onUpdate(); + } + + public boolean getCanSpawnHere() { + return this.worldObj.difficultySetting > 0 && this.worldObj.checkIfAABBIsClear(this.boundingBox) && this.worldObj.getCollidingBoundingBoxes(this, this.boundingBox).size() == 0 && !this.worldObj.getIsAnyLiquid(this.boundingBox); + } + + public void writeEntityToNBT(NBTTagCompound var1) { + super.writeEntityToNBT(var1); + var1.setShort("Anger", (short)this.angerLevel); + } + + public void readEntityFromNBT(NBTTagCompound var1) { + super.readEntityFromNBT(var1); + this.angerLevel = var1.getShort("Anger"); + } + + protected Entity findPlayerToAttack() { + return this.angerLevel == 0 ? null : super.findPlayerToAttack(); + } + + public void onLivingUpdate() { + super.onLivingUpdate(); + } + + public boolean attackEntityFrom(Entity var1, int var2) { + if(var1 instanceof EntityPlayer) { + List var3 = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.expand(32.0D, 32.0D, 32.0D)); + + for(int var4 = 0; var4 < var3.size(); ++var4) { + Entity var5 = (Entity)var3.get(var4); + if(var5 instanceof EntityPigZombie) { + EntityPigZombie var6 = (EntityPigZombie)var5; + var6.becomeAngryAt(var1); + } + } + + this.becomeAngryAt(var1); + } + + return super.attackEntityFrom(var1, var2); + } + + private void becomeAngryAt(Entity var1) { + this.playerToAttack = var1; + this.angerLevel = 400 + this.rand.nextInt(400); + this.randomSoundDelay = this.rand.nextInt(40); + } + + protected String getLivingSound() { + return "mob.zombiepig.zpig"; + } + + protected String getHurtSound() { + return "mob.zombiepig.zpighurt"; + } + + protected String getDeathSound() { + return "mob.zombiepig.zpigdeath"; + } + + protected int getDropItemId() { + return Item.porkCooked.shiftedIndex; + } + + public ItemStack getHeldItem() { + return defaultHeldItem; + } +} diff --git a/src/net/minecraft/src/EntityPlayer.java b/src/net/minecraft/src/EntityPlayer.java new file mode 100644 index 0000000..5fb51e4 --- /dev/null +++ b/src/net/minecraft/src/EntityPlayer.java @@ -0,0 +1,814 @@ +package net.minecraft.src; + +import java.util.Iterator; +import java.util.List; + +public abstract class EntityPlayer extends EntityLiving { + public InventoryPlayer inventory = new InventoryPlayer(this); + public Container inventorySlots; + public Container craftingInventory; + public byte field_9371_f = 0; + public int score = 0; + public float field_775_e; + public float field_774_f; + public boolean isSwinging = false; + public int swingProgressInt = 0; + public String username; + public int dimension; + public String playerCloakUrl; + public double field_20066_r; + public double field_20065_s; + public double field_20064_t; + public double field_20063_u; + public double field_20062_v; + public double field_20061_w; + protected boolean sleeping; + public ChunkCoordinates bedChunkCoordinates; + private int sleepTimer; + public float field_22063_x; + public float field_22062_y; + public float field_22061_z; + private ChunkCoordinates playerSpawnCoordinate; + private ChunkCoordinates startMinecartRidingCoordinate; + public int timeUntilPortal = 20; + protected boolean inPortal = false; + public float timeInPortal; + public float prevTimeInPortal; + private int damageRemainder = 0; + public EntityFish fishEntity = null; + + public EntityPlayer(World var1) { + super(var1); + this.inventorySlots = new ContainerPlayer(this.inventory, !var1.multiplayerWorld); + this.craftingInventory = this.inventorySlots; + this.yOffset = 1.62F; + ChunkCoordinates var2 = var1.getSpawnPoint(); + this.setLocationAndAngles((double)var2.x + 0.5D, (double)(var2.y + 1), (double)var2.z + 0.5D, 0.0F, 0.0F); + this.health = 20; + this.field_9351_C = "humanoid"; + this.field_9353_B = 180.0F; + this.fireResistance = 20; + this.texture = "/mob/char.png"; + } + + protected void entityInit() { + super.entityInit(); + this.dataWatcher.addObject(16, Byte.valueOf((byte)0)); + } + + public void onUpdate() { + if(this.isPlayerSleeping()) { + ++this.sleepTimer; + if(this.sleepTimer > 100) { + this.sleepTimer = 100; + } + + if(!this.worldObj.multiplayerWorld) { + if(!this.isInBed()) { + this.wakeUpPlayer(true, true, false); + } else if(this.worldObj.isDaytime()) { + this.wakeUpPlayer(false, true, true); + } + } + } else if(this.sleepTimer > 0) { + ++this.sleepTimer; + if(this.sleepTimer >= 110) { + this.sleepTimer = 0; + } + } + + super.onUpdate(); + if(!this.worldObj.multiplayerWorld && this.craftingInventory != null && !this.craftingInventory.isUsableByPlayer(this)) { + this.closeScreen(); + this.craftingInventory = this.inventorySlots; + } + + this.field_20066_r = this.field_20063_u; + this.field_20065_s = this.field_20062_v; + this.field_20064_t = this.field_20061_w; + double var1 = this.posX - this.field_20063_u; + double var3 = this.posY - this.field_20062_v; + double var5 = this.posZ - this.field_20061_w; + double var7 = 10.0D; + if(var1 > var7) { + this.field_20066_r = this.field_20063_u = this.posX; + } + + if(var5 > var7) { + this.field_20064_t = this.field_20061_w = this.posZ; + } + + if(var3 > var7) { + this.field_20065_s = this.field_20062_v = this.posY; + } + + if(var1 < -var7) { + this.field_20066_r = this.field_20063_u = this.posX; + } + + if(var5 < -var7) { + this.field_20064_t = this.field_20061_w = this.posZ; + } + + if(var3 < -var7) { + this.field_20065_s = this.field_20062_v = this.posY; + } + + this.field_20063_u += var1 * 0.25D; + this.field_20061_w += var5 * 0.25D; + this.field_20062_v += var3 * 0.25D; + this.addStat(StatList.minutesPlayedStat, 1); + if(this.ridingEntity == null) { + this.startMinecartRidingCoordinate = null; + } + + } + + protected boolean isMovementBlocked() { + return this.health <= 0 || this.isPlayerSleeping(); + } + + protected void closeScreen() { + this.craftingInventory = this.inventorySlots; + } + + public void updateCloak() { + this.playerCloakUrl = "http://s3.amazonaws.com/MinecraftCloaks/" + this.username + ".png"; + this.cloakUrl = this.playerCloakUrl; + } + + public void updateRidden() { + double var1 = this.posX; + double var3 = this.posY; + double var5 = this.posZ; + super.updateRidden(); + this.field_775_e = this.field_774_f; + this.field_774_f = 0.0F; + this.addMountedMovementStat(this.posX - var1, this.posY - var3, this.posZ - var5); + } + + public void preparePlayerToSpawn() { + this.yOffset = 1.62F; + this.setSize(0.6F, 1.8F); + super.preparePlayerToSpawn(); + this.health = 20; + this.deathTime = 0; + } + + protected void updatePlayerActionState() { + if(this.isSwinging) { + ++this.swingProgressInt; + if(this.swingProgressInt >= 8) { + this.swingProgressInt = 0; + this.isSwinging = false; + } + } else { + this.swingProgressInt = 0; + } + + this.swingProgress = (float)this.swingProgressInt / 8.0F; + } + + public void onLivingUpdate() { + if(this.worldObj.difficultySetting == 0 && this.health < 20 && this.ticksExisted % 20 * 12 == 0) { + this.heal(1); + } + + this.inventory.decrementAnimations(); + this.field_775_e = this.field_774_f; + super.onLivingUpdate(); + float var1 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); + float var2 = (float)Math.atan(-this.motionY * (double)0.2F) * 15.0F; + if(var1 > 0.1F) { + var1 = 0.1F; + } + + if(!this.onGround || this.health <= 0) { + var1 = 0.0F; + } + + if(this.onGround || this.health <= 0) { + var2 = 0.0F; + } + + this.field_774_f += (var1 - this.field_774_f) * 0.4F; + this.field_9328_R += (var2 - this.field_9328_R) * 0.8F; + if(this.health > 0) { + List var3 = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.expand(1.0D, 0.0D, 1.0D)); + if(var3 != null) { + for(int var4 = 0; var4 < var3.size(); ++var4) { + Entity var5 = (Entity)var3.get(var4); + if(!var5.isDead) { + this.collideWithPlayer(var5); + } + } + } + } + + } + + private void collideWithPlayer(Entity var1) { + var1.onCollideWithPlayer(this); + } + + public int getScore() { + return this.score; + } + + public void onDeath(Entity var1) { + super.onDeath(var1); + this.setSize(0.2F, 0.2F); + this.setPosition(this.posX, this.posY, this.posZ); + this.motionY = (double)0.1F; + if(this.username.equals("Notch")) { + this.dropPlayerItemWithRandomChoice(new ItemStack(Item.appleRed, 1), true); + } + + this.inventory.dropAllItems(); + if(var1 != null) { + this.motionX = (double)(-MathHelper.cos((this.attackedAtYaw + this.rotationYaw) * (float)Math.PI / 180.0F) * 0.1F); + this.motionZ = (double)(-MathHelper.sin((this.attackedAtYaw + this.rotationYaw) * (float)Math.PI / 180.0F) * 0.1F); + } else { + this.motionX = this.motionZ = 0.0D; + } + + this.yOffset = 0.1F; + this.addStat(StatList.deathsStat, 1); + } + + public void addToPlayerScore(Entity var1, int var2) { + this.score += var2; + if(var1 instanceof EntityPlayer) { + this.addStat(StatList.playerKillsStat, 1); + } else { + this.addStat(StatList.mobKillsStat, 1); + } + + } + + public void dropCurrentItem() { + this.dropPlayerItemWithRandomChoice(this.inventory.decrStackSize(this.inventory.currentItem, 1), false); + } + + public void dropPlayerItem(ItemStack var1) { + this.dropPlayerItemWithRandomChoice(var1, false); + } + + public void dropPlayerItemWithRandomChoice(ItemStack var1, boolean var2) { + if(var1 != null) { + EntityItem var3 = new EntityItem(this.worldObj, this.posX, this.posY - (double)0.3F + (double)this.getEyeHeight(), this.posZ, var1); + var3.delayBeforeCanPickup = 40; + float var4 = 0.1F; + float var5; + if(var2) { + var5 = this.rand.nextFloat() * 0.5F; + float var6 = this.rand.nextFloat() * (float)Math.PI * 2.0F; + var3.motionX = (double)(-MathHelper.sin(var6) * var5); + var3.motionZ = (double)(MathHelper.cos(var6) * var5); + var3.motionY = (double)0.2F; + } else { + var4 = 0.3F; + var3.motionX = (double)(-MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI) * var4); + var3.motionZ = (double)(MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI) * var4); + var3.motionY = (double)(-MathHelper.sin(this.rotationPitch / 180.0F * (float)Math.PI) * var4 + 0.1F); + var4 = 0.02F; + var5 = this.rand.nextFloat() * (float)Math.PI * 2.0F; + var4 *= this.rand.nextFloat(); + var3.motionX += Math.cos((double)var5) * (double)var4; + var3.motionY += (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.1F); + var3.motionZ += Math.sin((double)var5) * (double)var4; + } + + this.joinEntityItemWithWorld(var3); + this.addStat(StatList.dropStat, 1); + } + } + + protected void joinEntityItemWithWorld(EntityItem var1) { + this.worldObj.entityJoinedWorld(var1); + } + + public float getCurrentPlayerStrVsBlock(Block var1) { + float var2 = this.inventory.getStrVsBlock(var1); + if(this.isInsideOfMaterial(Material.water)) { + var2 /= 5.0F; + } + + if(!this.onGround) { + var2 /= 5.0F; + } + + return var2; + } + + public boolean canHarvestBlock(Block var1) { + return this.inventory.canHarvestBlock(var1); + } + + public void readEntityFromNBT(NBTTagCompound var1) { + super.readEntityFromNBT(var1); + NBTTagList var2 = var1.getTagList("Inventory"); + this.inventory.readFromNBT(var2); + this.dimension = var1.getInteger("Dimension"); + this.sleeping = var1.getBoolean("Sleeping"); + this.sleepTimer = var1.getShort("SleepTimer"); + if(this.sleeping) { + this.bedChunkCoordinates = new ChunkCoordinates(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ)); + this.wakeUpPlayer(true, true, false); + } + + if(var1.hasKey("SpawnX") && var1.hasKey("SpawnY") && var1.hasKey("SpawnZ")) { + this.playerSpawnCoordinate = new ChunkCoordinates(var1.getInteger("SpawnX"), var1.getInteger("SpawnY"), var1.getInteger("SpawnZ")); + } + + } + + public void writeEntityToNBT(NBTTagCompound var1) { + super.writeEntityToNBT(var1); + var1.setTag("Inventory", this.inventory.writeToNBT(new NBTTagList())); + var1.setInteger("Dimension", this.dimension); + var1.setBoolean("Sleeping", this.sleeping); + var1.setShort("SleepTimer", (short)this.sleepTimer); + if(this.playerSpawnCoordinate != null) { + var1.setInteger("SpawnX", this.playerSpawnCoordinate.x); + var1.setInteger("SpawnY", this.playerSpawnCoordinate.y); + var1.setInteger("SpawnZ", this.playerSpawnCoordinate.z); + } + + } + + public void displayGUIChest(IInventory var1) { + } + + public void displayWorkbenchGUI(int var1, int var2, int var3) { + } + + public void onItemPickup(Entity var1, int var2) { + } + + public float getEyeHeight() { + return 0.12F; + } + + protected void resetHeight() { + this.yOffset = 1.62F; + } + + public boolean attackEntityFrom(Entity var1, int var2) { + this.entityAge = 0; + if(this.health <= 0) { + return false; + } else { + if(this.isPlayerSleeping() && !this.worldObj.multiplayerWorld) { + this.wakeUpPlayer(true, true, false); + } + + if(var1 instanceof EntityMob || var1 instanceof EntityArrow) { + if(this.worldObj.difficultySetting == 0) { + var2 = 0; + } + + if(this.worldObj.difficultySetting == 1) { + var2 = var2 / 3 + 1; + } + + if(this.worldObj.difficultySetting == 3) { + var2 = var2 * 3 / 2; + } + } + + if(var2 == 0) { + return false; + } else { + Object var3 = var1; + if(var1 instanceof EntityArrow && ((EntityArrow)var1).owner != null) { + var3 = ((EntityArrow)var1).owner; + } + + if(var3 instanceof EntityLiving) { + this.alertWolves((EntityLiving)var3, false); + } + + this.addStat(StatList.damageTakenStat, var2); + return super.attackEntityFrom(var1, var2); + } + } + } + + protected boolean func_27025_G() { + return false; + } + + protected void alertWolves(EntityLiving var1, boolean var2) { + if(!(var1 instanceof EntityCreeper) && !(var1 instanceof EntityGhast)) { + if(var1 instanceof EntityWolf) { + EntityWolf var3 = (EntityWolf)var1; + if(var3.isWolfTamed() && this.username.equals(var3.getWolfOwner())) { + return; + } + } + + if(!(var1 instanceof EntityPlayer) || this.func_27025_G()) { + List var7 = this.worldObj.getEntitiesWithinAABB(EntityWolf.class, AxisAlignedBB.getBoundingBoxFromPool(this.posX, this.posY, this.posZ, this.posX + 1.0D, this.posY + 1.0D, this.posZ + 1.0D).expand(16.0D, 4.0D, 16.0D)); + Iterator var4 = var7.iterator(); + + while(true) { + EntityWolf var6; + do { + do { + do { + do { + if(!var4.hasNext()) { + return; + } + + Entity var5 = (Entity)var4.next(); + var6 = (EntityWolf)var5; + } while(!var6.isWolfTamed()); + } while(var6.getTarget() != null); + } while(!this.username.equals(var6.getWolfOwner())); + } while(var2 && var6.isWolfSitting()); + + var6.setWolfSitting(false); + var6.setTarget(var1); + } + } + } + } + + protected void damageEntity(int var1) { + int var2 = 25 - this.inventory.getTotalArmorValue(); + int var3 = var1 * var2 + this.damageRemainder; + this.inventory.damageArmor(var1); + var1 = var3 / 25; + this.damageRemainder = var3 % 25; + super.damageEntity(var1); + } + + public void displayGUIFurnace(TileEntityFurnace var1) { + } + + public void displayGUIDispenser(TileEntityDispenser var1) { + } + + public void displayGUIEditSign(TileEntitySign var1) { + } + + public void useCurrentItemOnEntity(Entity var1) { + if(!var1.interact(this)) { + ItemStack var2 = this.getCurrentEquippedItem(); + if(var2 != null && var1 instanceof EntityLiving) { + var2.useItemOnEntity((EntityLiving)var1); + if(var2.stackSize <= 0) { + var2.func_1097_a(this); + this.destroyCurrentEquippedItem(); + } + } + + } + } + + public ItemStack getCurrentEquippedItem() { + return this.inventory.getCurrentItem(); + } + + public void destroyCurrentEquippedItem() { + this.inventory.setInventorySlotContents(this.inventory.currentItem, (ItemStack)null); + } + + public double getYOffset() { + return (double)(this.yOffset - 0.5F); + } + + public void swingItem() { + this.swingProgressInt = -1; + this.isSwinging = true; + } + + public void attackTargetEntityWithCurrentItem(Entity var1) { + int var2 = this.inventory.getDamageVsEntity(var1); + if(var2 > 0) { + if(this.motionY < 0.0D) { + ++var2; + } + + var1.attackEntityFrom(this, var2); + ItemStack var3 = this.getCurrentEquippedItem(); + if(var3 != null && var1 instanceof EntityLiving) { + var3.hitEntity((EntityLiving)var1, this); + if(var3.stackSize <= 0) { + var3.func_1097_a(this); + this.destroyCurrentEquippedItem(); + } + } + + if(var1 instanceof EntityLiving) { + if(var1.isEntityAlive()) { + this.alertWolves((EntityLiving)var1, true); + } + + this.addStat(StatList.damageDealtStat, var2); + } + } + + } + + public void respawnPlayer() { + } + + public abstract void func_6420_o(); + + public void onItemStackChanged(ItemStack var1) { + } + + public void setEntityDead() { + super.setEntityDead(); + this.inventorySlots.onCraftGuiClosed(this); + if(this.craftingInventory != null) { + this.craftingInventory.onCraftGuiClosed(this); + } + + } + + public boolean isEntityInsideOpaqueBlock() { + return !this.sleeping && super.isEntityInsideOpaqueBlock(); + } + + public EnumStatus sleepInBedAt(int var1, int var2, int var3) { + if(!this.worldObj.multiplayerWorld) { + if(this.isPlayerSleeping() || !this.isEntityAlive()) { + return EnumStatus.OTHER_PROBLEM; + } + + if(this.worldObj.worldProvider.isNether) { + return EnumStatus.NOT_POSSIBLE_HERE; + } + + if(this.worldObj.isDaytime()) { + return EnumStatus.NOT_POSSIBLE_NOW; + } + + if(Math.abs(this.posX - (double)var1) > 3.0D || Math.abs(this.posY - (double)var2) > 2.0D || Math.abs(this.posZ - (double)var3) > 3.0D) { + return EnumStatus.TOO_FAR_AWAY; + } + } + + this.setSize(0.2F, 0.2F); + this.yOffset = 0.2F; + if(this.worldObj.blockExists(var1, var2, var3)) { + int var4 = this.worldObj.getBlockMetadata(var1, var2, var3); + int var5 = BlockBed.getDirectionFromMetadata(var4); + float var6 = 0.5F; + float var7 = 0.5F; + switch(var5) { + case 0: + var7 = 0.9F; + break; + case 1: + var6 = 0.1F; + break; + case 2: + var7 = 0.1F; + break; + case 3: + var6 = 0.9F; + } + + this.func_22052_e(var5); + this.setPosition((double)((float)var1 + var6), (double)((float)var2 + 15.0F / 16.0F), (double)((float)var3 + var7)); + } else { + this.setPosition((double)((float)var1 + 0.5F), (double)((float)var2 + 15.0F / 16.0F), (double)((float)var3 + 0.5F)); + } + + this.sleeping = true; + this.sleepTimer = 0; + this.bedChunkCoordinates = new ChunkCoordinates(var1, var2, var3); + this.motionX = this.motionZ = this.motionY = 0.0D; + if(!this.worldObj.multiplayerWorld) { + this.worldObj.updateAllPlayersSleepingFlag(); + } + + return EnumStatus.OK; + } + + private void func_22052_e(int var1) { + this.field_22063_x = 0.0F; + this.field_22061_z = 0.0F; + switch(var1) { + case 0: + this.field_22061_z = -1.8F; + break; + case 1: + this.field_22063_x = 1.8F; + break; + case 2: + this.field_22061_z = 1.8F; + break; + case 3: + this.field_22063_x = -1.8F; + } + + } + + public void wakeUpPlayer(boolean var1, boolean var2, boolean var3) { + this.setSize(0.6F, 1.8F); + this.resetHeight(); + ChunkCoordinates var4 = this.bedChunkCoordinates; + ChunkCoordinates var5 = this.bedChunkCoordinates; + if(var4 != null && this.worldObj.getBlockId(var4.x, var4.y, var4.z) == Block.blockBed.blockID) { + BlockBed.setBedOccupied(this.worldObj, var4.x, var4.y, var4.z, false); + var5 = BlockBed.getNearestEmptyChunkCoordinates(this.worldObj, var4.x, var4.y, var4.z, 0); + if(var5 == null) { + var5 = new ChunkCoordinates(var4.x, var4.y + 1, var4.z); + } + + this.setPosition((double)((float)var5.x + 0.5F), (double)((float)var5.y + this.yOffset + 0.1F), (double)((float)var5.z + 0.5F)); + } + + this.sleeping = false; + if(!this.worldObj.multiplayerWorld && var2) { + this.worldObj.updateAllPlayersSleepingFlag(); + } + + if(var1) { + this.sleepTimer = 0; + } else { + this.sleepTimer = 100; + } + + if(var3) { + this.setPlayerSpawnCoordinate(this.bedChunkCoordinates); + } + + } + + private boolean isInBed() { + return this.worldObj.getBlockId(this.bedChunkCoordinates.x, this.bedChunkCoordinates.y, this.bedChunkCoordinates.z) == Block.blockBed.blockID; + } + + public static ChunkCoordinates func_25060_a(World var0, ChunkCoordinates var1) { + IChunkProvider var2 = var0.getIChunkProvider(); + var2.prepareChunk(var1.x - 3 >> 4, var1.z - 3 >> 4); + var2.prepareChunk(var1.x + 3 >> 4, var1.z - 3 >> 4); + var2.prepareChunk(var1.x - 3 >> 4, var1.z + 3 >> 4); + var2.prepareChunk(var1.x + 3 >> 4, var1.z + 3 >> 4); + if(var0.getBlockId(var1.x, var1.y, var1.z) != Block.blockBed.blockID) { + return null; + } else { + ChunkCoordinates var3 = BlockBed.getNearestEmptyChunkCoordinates(var0, var1.x, var1.y, var1.z, 0); + return var3; + } + } + + public float getBedOrientationInDegrees() { + if(this.bedChunkCoordinates != null) { + int var1 = this.worldObj.getBlockMetadata(this.bedChunkCoordinates.x, this.bedChunkCoordinates.y, this.bedChunkCoordinates.z); + int var2 = BlockBed.getDirectionFromMetadata(var1); + switch(var2) { + case 0: + return 90.0F; + case 1: + return 0.0F; + case 2: + return 270.0F; + case 3: + return 180.0F; + } + } + + return 0.0F; + } + + public boolean isPlayerSleeping() { + return this.sleeping; + } + + public boolean isPlayerFullyAsleep() { + return this.sleeping && this.sleepTimer >= 100; + } + + public int func_22060_M() { + return this.sleepTimer; + } + + public void addChatMessage(String var1) { + } + + public ChunkCoordinates getPlayerSpawnCoordinate() { + return this.playerSpawnCoordinate; + } + + public void setPlayerSpawnCoordinate(ChunkCoordinates var1) { + if(var1 != null) { + this.playerSpawnCoordinate = new ChunkCoordinates(var1); + } else { + this.playerSpawnCoordinate = null; + } + + } + + public void triggerAchievement(StatBase var1) { + this.addStat(var1, 1); + } + + public void addStat(StatBase var1, int var2) { + } + + protected void jump() { + super.jump(); + this.addStat(StatList.jumpStat, 1); + } + + public void moveEntityWithHeading(float var1, float var2) { + double var3 = this.posX; + double var5 = this.posY; + double var7 = this.posZ; + super.moveEntityWithHeading(var1, var2); + this.addMovementStat(this.posX - var3, this.posY - var5, this.posZ - var7); + } + + private void addMovementStat(double var1, double var3, double var5) { + if(this.ridingEntity == null) { + int var7; + if(this.isInsideOfMaterial(Material.water)) { + var7 = Math.round(MathHelper.sqrt_double(var1 * var1 + var3 * var3 + var5 * var5) * 100.0F); + if(var7 > 0) { + this.addStat(StatList.distanceDoveStat, var7); + } + } else if(this.isInWater()) { + var7 = Math.round(MathHelper.sqrt_double(var1 * var1 + var5 * var5) * 100.0F); + if(var7 > 0) { + this.addStat(StatList.distanceSwumStat, var7); + } + } else if(this.isOnLadder()) { + if(var3 > 0.0D) { + this.addStat(StatList.distanceClimbedStat, (int)Math.round(var3 * 100.0D)); + } + } else if(this.onGround) { + var7 = Math.round(MathHelper.sqrt_double(var1 * var1 + var5 * var5) * 100.0F); + if(var7 > 0) { + this.addStat(StatList.distanceWalkedStat, var7); + } + } else { + var7 = Math.round(MathHelper.sqrt_double(var1 * var1 + var5 * var5) * 100.0F); + if(var7 > 25) { + this.addStat(StatList.distanceFlownStat, var7); + } + } + + } + } + + private void addMountedMovementStat(double var1, double var3, double var5) { + if(this.ridingEntity != null) { + int var7 = Math.round(MathHelper.sqrt_double(var1 * var1 + var3 * var3 + var5 * var5) * 100.0F); + if(var7 > 0) { + if(this.ridingEntity instanceof EntityMinecart) { + this.addStat(StatList.distanceByMinecartStat, var7); + if(this.startMinecartRidingCoordinate == null) { + this.startMinecartRidingCoordinate = new ChunkCoordinates(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ)); + } else if(this.startMinecartRidingCoordinate.getSqDistanceTo(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ)) >= 1000.0D) { + this.addStat(AchievementList.onARail, 1); + } + } else if(this.ridingEntity instanceof EntityBoat) { + this.addStat(StatList.distanceByBoatStat, var7); + } else if(this.ridingEntity instanceof EntityPig) { + this.addStat(StatList.distanceByPigStat, var7); + } + } + } + + } + + protected void fall(float var1) { + if(var1 >= 2.0F) { + this.addStat(StatList.distanceFallenStat, (int)Math.round((double)var1 * 100.0D)); + } + + super.fall(var1); + } + + public void onKillEntity(EntityLiving var1) { + if(var1 instanceof EntityMob) { + this.triggerAchievement(AchievementList.killEnemy); + } + + } + + public int getItemIcon(ItemStack var1) { + int var2 = super.getItemIcon(var1); + if(var1.itemID == Item.fishingRod.shiftedIndex && this.fishEntity != null) { + var2 = var1.getIconIndex() + 16; + } + + return var2; + } + + public void setInPortal() { + if(this.timeUntilPortal > 0) { + this.timeUntilPortal = 10; + } else { + this.inPortal = true; + } + } +} diff --git a/src/net/minecraft/src/EntityPlayerSP.java b/src/net/minecraft/src/EntityPlayerSP.java new file mode 100644 index 0000000..948a250 --- /dev/null +++ b/src/net/minecraft/src/EntityPlayerSP.java @@ -0,0 +1,251 @@ +package net.minecraft.src; + +import net.minecraft.client.Minecraft; + +public class EntityPlayerSP extends EntityPlayer { + public MovementInput movementInput; + protected Minecraft mc; + private MouseFilter field_21903_bJ = new MouseFilter(); + private MouseFilter field_21904_bK = new MouseFilter(); + private MouseFilter field_21902_bL = new MouseFilter(); + + public EntityPlayerSP(Minecraft var1, World var2, Session var3, int var4) { + super(var2); + this.mc = var1; + this.dimension = var4; + if(var3 != null && var3.username != null && var3.username.length() > 0) { + this.skinUrl = "http://s3.amazonaws.com/MinecraftSkins/" + var3.username + ".png"; + } + + this.username = var3.username; + } + + public void moveEntity(double var1, double var3, double var5) { + super.moveEntity(var1, var3, var5); + } + + public void updatePlayerActionState() { + super.updatePlayerActionState(); + this.moveStrafing = this.movementInput.moveStrafe; + this.moveForward = this.movementInput.moveForward; + this.isJumping = this.movementInput.jump; + } + + public void onLivingUpdate() { + if(!this.mc.statFileWriter.hasAchievementUnlocked(AchievementList.openInventory)) { + this.mc.guiAchievement.queueAchievementInformation(AchievementList.openInventory); + } + + this.prevTimeInPortal = this.timeInPortal; + if(this.inPortal) { + if(!this.worldObj.multiplayerWorld && this.ridingEntity != null) { + this.mountEntity((Entity)null); + } + + if(this.mc.currentScreen != null) { + this.mc.displayGuiScreen((GuiScreen)null); + } + + if(this.timeInPortal == 0.0F) { + this.mc.sndManager.playSoundFX("portal.trigger", 1.0F, this.rand.nextFloat() * 0.4F + 0.8F); + } + + this.timeInPortal += 0.0125F; + if(this.timeInPortal >= 1.0F) { + this.timeInPortal = 1.0F; + if(!this.worldObj.multiplayerWorld) { + this.timeUntilPortal = 10; + this.mc.sndManager.playSoundFX("portal.travel", 1.0F, this.rand.nextFloat() * 0.4F + 0.8F); + this.mc.usePortal(); + } + } + + this.inPortal = false; + } else { + if(this.timeInPortal > 0.0F) { + this.timeInPortal -= 0.05F; + } + + if(this.timeInPortal < 0.0F) { + this.timeInPortal = 0.0F; + } + } + + if(this.timeUntilPortal > 0) { + --this.timeUntilPortal; + } + + this.movementInput.updatePlayerMoveState(this); + if(this.movementInput.sneak && this.ySize < 0.2F) { + this.ySize = 0.2F; + } + + this.pushOutOfBlocks(this.posX - (double)this.width * 0.35D, this.boundingBox.minY + 0.5D, this.posZ + (double)this.width * 0.35D); + this.pushOutOfBlocks(this.posX - (double)this.width * 0.35D, this.boundingBox.minY + 0.5D, this.posZ - (double)this.width * 0.35D); + this.pushOutOfBlocks(this.posX + (double)this.width * 0.35D, this.boundingBox.minY + 0.5D, this.posZ - (double)this.width * 0.35D); + this.pushOutOfBlocks(this.posX + (double)this.width * 0.35D, this.boundingBox.minY + 0.5D, this.posZ + (double)this.width * 0.35D); + super.onLivingUpdate(); + } + + public void resetPlayerKeyState() { + this.movementInput.resetKeyState(); + } + + public void handleKeyPress(int var1, boolean var2) { + this.movementInput.checkKeyForMovementInput(var1, var2); + } + + public void writeEntityToNBT(NBTTagCompound var1) { + super.writeEntityToNBT(var1); + var1.setInteger("Score", this.score); + } + + public void readEntityFromNBT(NBTTagCompound var1) { + super.readEntityFromNBT(var1); + this.score = var1.getInteger("Score"); + } + + public void closeScreen() { + super.closeScreen(); + this.mc.displayGuiScreen((GuiScreen)null); + } + + public void displayGUIEditSign(TileEntitySign var1) { + this.mc.displayGuiScreen(new GuiEditSign(var1)); + } + + public void displayGUIChest(IInventory var1) { + this.mc.displayGuiScreen(new GuiChest(this.inventory, var1)); + } + + public void displayWorkbenchGUI(int var1, int var2, int var3) { + this.mc.displayGuiScreen(new GuiCrafting(this.inventory, this.worldObj, var1, var2, var3)); + } + + public void displayGUIFurnace(TileEntityFurnace var1) { + this.mc.displayGuiScreen(new GuiFurnace(this.inventory, var1)); + } + + public void displayGUIDispenser(TileEntityDispenser var1) { + this.mc.displayGuiScreen(new GuiDispenser(this.inventory, var1)); + } + + public void onItemPickup(Entity var1, int var2) { + this.mc.effectRenderer.addEffect(new EntityPickupFX(this.mc.theWorld, var1, this, -0.5F)); + } + + public int getPlayerArmorValue() { + return this.inventory.getTotalArmorValue(); + } + + public void sendChatMessage(String var1) { + } + + public boolean isSneaking() { + return this.movementInput.sneak && !this.sleeping; + } + + public void setHealth(int var1) { + int var2 = this.health - var1; + if(var2 <= 0) { + this.health = var1; + if(var2 < 0) { + this.heartsLife = this.heartsHalvesLife / 2; + } + } else { + this.field_9346_af = var2; + this.prevHealth = this.health; + this.heartsLife = this.heartsHalvesLife; + this.damageEntity(var2); + this.hurtTime = this.maxHurtTime = 10; + } + + } + + public void respawnPlayer() { + this.mc.respawn(false, 0); + } + + public void func_6420_o() { + } + + public void addChatMessage(String var1) { + this.mc.ingameGUI.addChatMessageTranslate(var1); + } + + public void addStat(StatBase var1, int var2) { + if(var1 != null) { + if(var1.func_25067_a()) { + Achievement var3 = (Achievement)var1; + if(var3.parentAchievement == null || this.mc.statFileWriter.hasAchievementUnlocked(var3.parentAchievement)) { + if(!this.mc.statFileWriter.hasAchievementUnlocked(var3)) { + this.mc.guiAchievement.queueTakenAchievement(var3); + } + + this.mc.statFileWriter.readStat(var1, var2); + } + } else { + this.mc.statFileWriter.readStat(var1, var2); + } + + } + } + + private boolean isBlockTranslucent(int var1, int var2, int var3) { + return this.worldObj.isBlockNormalCube(var1, var2, var3); + } + + protected boolean pushOutOfBlocks(double var1, double var3, double var5) { + int var7 = MathHelper.floor_double(var1); + int var8 = MathHelper.floor_double(var3); + int var9 = MathHelper.floor_double(var5); + double var10 = var1 - (double)var7; + double var12 = var5 - (double)var9; + if(this.isBlockTranslucent(var7, var8, var9) || this.isBlockTranslucent(var7, var8 + 1, var9)) { + boolean var14 = !this.isBlockTranslucent(var7 - 1, var8, var9) && !this.isBlockTranslucent(var7 - 1, var8 + 1, var9); + boolean var15 = !this.isBlockTranslucent(var7 + 1, var8, var9) && !this.isBlockTranslucent(var7 + 1, var8 + 1, var9); + boolean var16 = !this.isBlockTranslucent(var7, var8, var9 - 1) && !this.isBlockTranslucent(var7, var8 + 1, var9 - 1); + boolean var17 = !this.isBlockTranslucent(var7, var8, var9 + 1) && !this.isBlockTranslucent(var7, var8 + 1, var9 + 1); + byte var18 = -1; + double var19 = 9999.0D; + if(var14 && var10 < var19) { + var19 = var10; + var18 = 0; + } + + if(var15 && 1.0D - var10 < var19) { + var19 = 1.0D - var10; + var18 = 1; + } + + if(var16 && var12 < var19) { + var19 = var12; + var18 = 4; + } + + if(var17 && 1.0D - var12 < var19) { + var19 = 1.0D - var12; + var18 = 5; + } + + float var21 = 0.1F; + if(var18 == 0) { + this.motionX = (double)(-var21); + } + + if(var18 == 1) { + this.motionX = (double)var21; + } + + if(var18 == 4) { + this.motionZ = (double)(-var21); + } + + if(var18 == 5) { + this.motionZ = (double)var21; + } + } + + return false; + } +} diff --git a/src/net/minecraft/src/EntityPortalFX.java b/src/net/minecraft/src/EntityPortalFX.java new file mode 100644 index 0000000..c960b50 --- /dev/null +++ b/src/net/minecraft/src/EntityPortalFX.java @@ -0,0 +1,60 @@ +package net.minecraft.src; + +public class EntityPortalFX extends EntityFX { + private float field_4083_a; + private double field_4086_p; + private double field_4085_q; + private double field_4084_r; + + public EntityPortalFX(World var1, double var2, double var4, double var6, double var8, double var10, double var12) { + super(var1, var2, var4, var6, var8, var10, var12); + this.motionX = var8; + this.motionY = var10; + this.motionZ = var12; + this.field_4086_p = this.posX = var2; + this.field_4085_q = this.posY = var4; + this.field_4084_r = this.posZ = var6; + float var14 = this.rand.nextFloat() * 0.6F + 0.4F; + this.field_4083_a = this.particleScale = this.rand.nextFloat() * 0.2F + 0.5F; + this.particleRed = this.particleGreen = this.particleBlue = 1.0F * var14; + this.particleGreen *= 0.3F; + this.particleRed *= 0.9F; + this.particleMaxAge = (int)(Math.random() * 10.0D) + 40; + this.noClip = true; + this.particleTextureIndex = (int)(Math.random() * 8.0D); + } + + public void renderParticle(Tessellator var1, float var2, float var3, float var4, float var5, float var6, float var7) { + float var8 = ((float)this.particleAge + var2) / (float)this.particleMaxAge; + var8 = 1.0F - var8; + var8 *= var8; + var8 = 1.0F - var8; + this.particleScale = this.field_4083_a * var8; + super.renderParticle(var1, var2, var3, var4, var5, var6, var7); + } + + public float getEntityBrightness(float var1) { + float var2 = super.getEntityBrightness(var1); + float var3 = (float)this.particleAge / (float)this.particleMaxAge; + var3 *= var3; + var3 *= var3; + return var2 * (1.0F - var3) + var3; + } + + public void onUpdate() { + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + float var1 = (float)this.particleAge / (float)this.particleMaxAge; + float var2 = var1; + var1 = -var1 + var1 * var1 * 2.0F; + var1 = 1.0F - var1; + this.posX = this.field_4086_p + this.motionX * (double)var1; + this.posY = this.field_4085_q + this.motionY * (double)var1 + (double)(1.0F - var2); + this.posZ = this.field_4084_r + this.motionZ * (double)var1; + if(this.particleAge++ >= this.particleMaxAge) { + this.setEntityDead(); + } + + } +} diff --git a/src/net/minecraft/src/EntityRainFX.java b/src/net/minecraft/src/EntityRainFX.java new file mode 100644 index 0000000..c463f95 --- /dev/null +++ b/src/net/minecraft/src/EntityRainFX.java @@ -0,0 +1,53 @@ +package net.minecraft.src; + +public class EntityRainFX extends EntityFX { + public EntityRainFX(World var1, double var2, double var4, double var6) { + super(var1, var2, var4, var6, 0.0D, 0.0D, 0.0D); + this.motionX *= (double)0.3F; + this.motionY = (double)((float)Math.random() * 0.2F + 0.1F); + this.motionZ *= (double)0.3F; + this.particleRed = 1.0F; + this.particleGreen = 1.0F; + this.particleBlue = 1.0F; + this.particleTextureIndex = 19 + this.rand.nextInt(4); + this.setSize(0.01F, 0.01F); + this.particleGravity = 0.06F; + this.particleMaxAge = (int)(8.0D / (Math.random() * 0.8D + 0.2D)); + } + + public void renderParticle(Tessellator var1, float var2, float var3, float var4, float var5, float var6, float var7) { + super.renderParticle(var1, var2, var3, var4, var5, var6, var7); + } + + public void onUpdate() { + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + this.motionY -= (double)this.particleGravity; + this.moveEntity(this.motionX, this.motionY, this.motionZ); + this.motionX *= (double)0.98F; + this.motionY *= (double)0.98F; + this.motionZ *= (double)0.98F; + if(this.particleMaxAge-- <= 0) { + this.setEntityDead(); + } + + if(this.onGround) { + if(Math.random() < 0.5D) { + this.setEntityDead(); + } + + this.motionX *= (double)0.7F; + this.motionZ *= (double)0.7F; + } + + Material var1 = this.worldObj.getBlockMaterial(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ)); + if(var1.getIsLiquid() || var1.isSolid()) { + double var2 = (double)((float)(MathHelper.floor_double(this.posY) + 1) - BlockFluid.getPercentAir(this.worldObj.getBlockMetadata(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ)))); + if(this.posY < var2) { + this.setEntityDead(); + } + } + + } +} diff --git a/src/net/minecraft/src/EntityReddustFX.java b/src/net/minecraft/src/EntityReddustFX.java new file mode 100644 index 0000000..e9ac802 --- /dev/null +++ b/src/net/minecraft/src/EntityReddustFX.java @@ -0,0 +1,69 @@ +package net.minecraft.src; + +public class EntityReddustFX extends EntityFX { + float field_673_a; + + public EntityReddustFX(World var1, double var2, double var4, double var6, float var8, float var9, float var10) { + this(var1, var2, var4, var6, 1.0F, var8, var9, var10); + } + + public EntityReddustFX(World var1, double var2, double var4, double var6, float var8, float var9, float var10, float var11) { + super(var1, var2, var4, var6, 0.0D, 0.0D, 0.0D); + this.motionX *= (double)0.1F; + this.motionY *= (double)0.1F; + this.motionZ *= (double)0.1F; + if(var9 == 0.0F) { + var9 = 1.0F; + } + + float var12 = (float)Math.random() * 0.4F + 0.6F; + this.particleRed = ((float)(Math.random() * (double)0.2F) + 0.8F) * var9 * var12; + this.particleGreen = ((float)(Math.random() * (double)0.2F) + 0.8F) * var10 * var12; + this.particleBlue = ((float)(Math.random() * (double)0.2F) + 0.8F) * var11 * var12; + this.particleScale *= 12.0F / 16.0F; + this.particleScale *= var8; + this.field_673_a = this.particleScale; + this.particleMaxAge = (int)(8.0D / (Math.random() * 0.8D + 0.2D)); + this.particleMaxAge = (int)((float)this.particleMaxAge * var8); + this.noClip = false; + } + + public void renderParticle(Tessellator var1, float var2, float var3, float var4, float var5, float var6, float var7) { + float var8 = ((float)this.particleAge + var2) / (float)this.particleMaxAge * 32.0F; + if(var8 < 0.0F) { + var8 = 0.0F; + } + + if(var8 > 1.0F) { + var8 = 1.0F; + } + + this.particleScale = this.field_673_a * var8; + super.renderParticle(var1, var2, var3, var4, var5, var6, var7); + } + + public void onUpdate() { + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + if(this.particleAge++ >= this.particleMaxAge) { + this.setEntityDead(); + } + + this.particleTextureIndex = 7 - this.particleAge * 8 / this.particleMaxAge; + this.moveEntity(this.motionX, this.motionY, this.motionZ); + if(this.posY == this.prevPosY) { + this.motionX *= 1.1D; + this.motionZ *= 1.1D; + } + + this.motionX *= (double)0.96F; + this.motionY *= (double)0.96F; + this.motionZ *= (double)0.96F; + if(this.onGround) { + this.motionX *= (double)0.7F; + this.motionZ *= (double)0.7F; + } + + } +} diff --git a/src/net/minecraft/src/EntityRenderer.java b/src/net/minecraft/src/EntityRenderer.java new file mode 100644 index 0000000..c8b4696 --- /dev/null +++ b/src/net/minecraft/src/EntityRenderer.java @@ -0,0 +1,926 @@ +package net.minecraft.src; + +import java.nio.FloatBuffer; +import java.util.List; +import java.util.Random; +import net.minecraft.client.Minecraft; +import org.lwjgl.input.Mouse; +import org.lwjgl.opengl.Display; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GLContext; +import org.lwjgl.opengl.NVFogDistance; +import org.lwjgl.util.glu.GLU; + +public class EntityRenderer { + public static boolean field_28135_a = false; + public static int anaglyphField; + private Minecraft mc; + private float farPlaneDistance = 0.0F; + public ItemRenderer itemRenderer; + private int rendererUpdateCount; + private Entity pointedEntity = null; + private MouseFilter mouseFilterXAxis = new MouseFilter(); + private MouseFilter mouseFilterYAxis = new MouseFilter(); + private MouseFilter mouseFilterDummy1 = new MouseFilter(); + private MouseFilter mouseFilterDummy2 = new MouseFilter(); + private MouseFilter mouseFilterDummy3 = new MouseFilter(); + private MouseFilter mouseFilterDummy4 = new MouseFilter(); + private float field_22228_r = 4.0F; + private float field_22227_s = 4.0F; + private float field_22226_t = 0.0F; + private float field_22225_u = 0.0F; + private float field_22224_v = 0.0F; + private float field_22223_w = 0.0F; + private float field_22222_x = 0.0F; + private float field_22221_y = 0.0F; + private float field_22220_z = 0.0F; + private float field_22230_A = 0.0F; + private boolean cloudFog = false; + private double cameraZoom = 1.0D; + private double cameraYaw = 0.0D; + private double cameraPitch = 0.0D; + private long prevFrameTime = System.currentTimeMillis(); + private long field_28133_I = 0L; + private Random random = new Random(); + private int rainSoundCounter = 0; + volatile int field_1394_b = 0; + volatile int field_1393_c = 0; + FloatBuffer fogColorBuffer = GLAllocation.createDirectFloatBuffer(16); + float fogColorRed; + float fogColorGreen; + float fogColorBlue; + private float fogColor2; + private float fogColor1; + + public EntityRenderer(Minecraft var1) { + this.mc = var1; + this.itemRenderer = new ItemRenderer(var1); + } + + public void updateRenderer() { + this.fogColor2 = this.fogColor1; + this.field_22227_s = this.field_22228_r; + this.field_22225_u = this.field_22226_t; + this.field_22223_w = this.field_22224_v; + this.field_22221_y = this.field_22222_x; + this.field_22230_A = this.field_22220_z; + if(this.mc.renderViewEntity == null) { + this.mc.renderViewEntity = this.mc.thePlayer; + } + + float var1 = this.mc.theWorld.getLightBrightness(MathHelper.floor_double(this.mc.renderViewEntity.posX), MathHelper.floor_double(this.mc.renderViewEntity.posY), MathHelper.floor_double(this.mc.renderViewEntity.posZ)); + float var2 = (float)(3 - this.mc.gameSettings.renderDistance) / 3.0F; + float var3 = var1 * (1.0F - var2) + var2; + this.fogColor1 += (var3 - this.fogColor1) * 0.1F; + ++this.rendererUpdateCount; + this.itemRenderer.updateEquippedItem(); + this.addRainParticles(); + } + + public void getMouseOver(float var1) { + if(this.mc.renderViewEntity != null) { + if(this.mc.theWorld != null) { + double var2 = (double)this.mc.playerController.getBlockReachDistance(); + this.mc.objectMouseOver = this.mc.renderViewEntity.rayTrace(var2, var1); + double var4 = var2; + Vec3D var6 = this.mc.renderViewEntity.getPosition(var1); + if(this.mc.objectMouseOver != null) { + var4 = this.mc.objectMouseOver.hitVec.distanceTo(var6); + } + + if(this.mc.playerController instanceof PlayerControllerTest) { + var2 = 32.0D; + } else { + if(var4 > 3.0D) { + var4 = 3.0D; + } + + var2 = var4; + } + + Vec3D var7 = this.mc.renderViewEntity.getLook(var1); + Vec3D var8 = var6.addVector(var7.xCoord * var2, var7.yCoord * var2, var7.zCoord * var2); + this.pointedEntity = null; + float var9 = 1.0F; + List var10 = this.mc.theWorld.getEntitiesWithinAABBExcludingEntity(this.mc.renderViewEntity, this.mc.renderViewEntity.boundingBox.addCoord(var7.xCoord * var2, var7.yCoord * var2, var7.zCoord * var2).expand((double)var9, (double)var9, (double)var9)); + double var11 = 0.0D; + + for(int var13 = 0; var13 < var10.size(); ++var13) { + Entity var14 = (Entity)var10.get(var13); + if(var14.canBeCollidedWith()) { + float var15 = var14.getCollisionBorderSize(); + AxisAlignedBB var16 = var14.boundingBox.expand((double)var15, (double)var15, (double)var15); + MovingObjectPosition var17 = var16.func_1169_a(var6, var8); + if(var16.isVecInside(var6)) { + if(0.0D < var11 || var11 == 0.0D) { + this.pointedEntity = var14; + var11 = 0.0D; + } + } else if(var17 != null) { + double var18 = var6.distanceTo(var17.hitVec); + if(var18 < var11 || var11 == 0.0D) { + this.pointedEntity = var14; + var11 = var18; + } + } + } + } + + if(this.pointedEntity != null && !(this.mc.playerController instanceof PlayerControllerTest)) { + this.mc.objectMouseOver = new MovingObjectPosition(this.pointedEntity); + } + + } + } + } + + private float getFOVModifier(float var1) { + EntityLiving var2 = this.mc.renderViewEntity; + float var3 = 70.0F; + if(var2.isInsideOfMaterial(Material.water)) { + var3 = 60.0F; + } + + if(var2.health <= 0) { + float var4 = (float)var2.deathTime + var1; + var3 /= (1.0F - 500.0F / (var4 + 500.0F)) * 2.0F + 1.0F; + } + + return var3 + this.field_22221_y + (this.field_22222_x - this.field_22221_y) * var1; + } + + private void hurtCameraEffect(float var1) { + EntityLiving var2 = this.mc.renderViewEntity; + float var3 = (float)var2.hurtTime - var1; + float var4; + if(var2.health <= 0) { + var4 = (float)var2.deathTime + var1; + GL11.glRotatef(40.0F - 8000.0F / (var4 + 200.0F), 0.0F, 0.0F, 1.0F); + } + + if(var3 >= 0.0F) { + var3 /= (float)var2.maxHurtTime; + var3 = MathHelper.sin(var3 * var3 * var3 * var3 * (float)Math.PI); + var4 = var2.attackedAtYaw; + GL11.glRotatef(-var4, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(-var3 * 14.0F, 0.0F, 0.0F, 1.0F); + GL11.glRotatef(var4, 0.0F, 1.0F, 0.0F); + } + } + + private void setupViewBobbing(float var1) { + if(this.mc.renderViewEntity instanceof EntityPlayer) { + EntityPlayer var2 = (EntityPlayer)this.mc.renderViewEntity; + float var3 = var2.distanceWalkedModified - var2.prevDistanceWalkedModified; + float var4 = -(var2.distanceWalkedModified + var3 * var1); + float var5 = var2.field_775_e + (var2.field_774_f - var2.field_775_e) * var1; + float var6 = var2.cameraPitch + (var2.field_9328_R - var2.cameraPitch) * var1; + GL11.glTranslatef(MathHelper.sin(var4 * (float)Math.PI) * var5 * 0.5F, -Math.abs(MathHelper.cos(var4 * (float)Math.PI) * var5), 0.0F); + GL11.glRotatef(MathHelper.sin(var4 * (float)Math.PI) * var5 * 3.0F, 0.0F, 0.0F, 1.0F); + GL11.glRotatef(Math.abs(MathHelper.cos(var4 * (float)Math.PI - 0.2F) * var5) * 5.0F, 1.0F, 0.0F, 0.0F); + GL11.glRotatef(var6, 1.0F, 0.0F, 0.0F); + } + } + + private void orientCamera(float var1) { + EntityLiving var2 = this.mc.renderViewEntity; + float var3 = var2.yOffset - 1.62F; + double var4 = var2.prevPosX + (var2.posX - var2.prevPosX) * (double)var1; + double var6 = var2.prevPosY + (var2.posY - var2.prevPosY) * (double)var1 - (double)var3; + double var8 = var2.prevPosZ + (var2.posZ - var2.prevPosZ) * (double)var1; + GL11.glRotatef(this.field_22230_A + (this.field_22220_z - this.field_22230_A) * var1, 0.0F, 0.0F, 1.0F); + if(var2.isPlayerSleeping()) { + var3 = (float)((double)var3 + 1.0D); + GL11.glTranslatef(0.0F, 0.3F, 0.0F); + if(!this.mc.gameSettings.field_22273_E) { + int var10 = this.mc.theWorld.getBlockId(MathHelper.floor_double(var2.posX), MathHelper.floor_double(var2.posY), MathHelper.floor_double(var2.posZ)); + if(var10 == Block.blockBed.blockID) { + int var11 = this.mc.theWorld.getBlockMetadata(MathHelper.floor_double(var2.posX), MathHelper.floor_double(var2.posY), MathHelper.floor_double(var2.posZ)); + int var12 = var11 & 3; + GL11.glRotatef((float)(var12 * 90), 0.0F, 1.0F, 0.0F); + } + + GL11.glRotatef(var2.prevRotationYaw + (var2.rotationYaw - var2.prevRotationYaw) * var1 + 180.0F, 0.0F, -1.0F, 0.0F); + GL11.glRotatef(var2.prevRotationPitch + (var2.rotationPitch - var2.prevRotationPitch) * var1, -1.0F, 0.0F, 0.0F); + } + } else if(this.mc.gameSettings.thirdPersonView) { + double var27 = (double)(this.field_22227_s + (this.field_22228_r - this.field_22227_s) * var1); + float var13; + float var28; + if(this.mc.gameSettings.field_22273_E) { + var28 = this.field_22225_u + (this.field_22226_t - this.field_22225_u) * var1; + var13 = this.field_22223_w + (this.field_22224_v - this.field_22223_w) * var1; + GL11.glTranslatef(0.0F, 0.0F, (float)(-var27)); + GL11.glRotatef(var13, 1.0F, 0.0F, 0.0F); + GL11.glRotatef(var28, 0.0F, 1.0F, 0.0F); + } else { + var28 = var2.rotationYaw; + var13 = var2.rotationPitch; + double var14 = (double)(-MathHelper.sin(var28 / 180.0F * (float)Math.PI) * MathHelper.cos(var13 / 180.0F * (float)Math.PI)) * var27; + double var16 = (double)(MathHelper.cos(var28 / 180.0F * (float)Math.PI) * MathHelper.cos(var13 / 180.0F * (float)Math.PI)) * var27; + double var18 = (double)(-MathHelper.sin(var13 / 180.0F * (float)Math.PI)) * var27; + + for(int var20 = 0; var20 < 8; ++var20) { + float var21 = (float)((var20 & 1) * 2 - 1); + float var22 = (float)((var20 >> 1 & 1) * 2 - 1); + float var23 = (float)((var20 >> 2 & 1) * 2 - 1); + var21 *= 0.1F; + var22 *= 0.1F; + var23 *= 0.1F; + MovingObjectPosition var24 = this.mc.theWorld.rayTraceBlocks(Vec3D.createVector(var4 + (double)var21, var6 + (double)var22, var8 + (double)var23), Vec3D.createVector(var4 - var14 + (double)var21 + (double)var23, var6 - var18 + (double)var22, var8 - var16 + (double)var23)); + if(var24 != null) { + double var25 = var24.hitVec.distanceTo(Vec3D.createVector(var4, var6, var8)); + if(var25 < var27) { + var27 = var25; + } + } + } + + GL11.glRotatef(var2.rotationPitch - var13, 1.0F, 0.0F, 0.0F); + GL11.glRotatef(var2.rotationYaw - var28, 0.0F, 1.0F, 0.0F); + GL11.glTranslatef(0.0F, 0.0F, (float)(-var27)); + GL11.glRotatef(var28 - var2.rotationYaw, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(var13 - var2.rotationPitch, 1.0F, 0.0F, 0.0F); + } + } else { + GL11.glTranslatef(0.0F, 0.0F, -0.1F); + } + + if(!this.mc.gameSettings.field_22273_E) { + GL11.glRotatef(var2.prevRotationPitch + (var2.rotationPitch - var2.prevRotationPitch) * var1, 1.0F, 0.0F, 0.0F); + GL11.glRotatef(var2.prevRotationYaw + (var2.rotationYaw - var2.prevRotationYaw) * var1 + 180.0F, 0.0F, 1.0F, 0.0F); + } + + GL11.glTranslatef(0.0F, var3, 0.0F); + var4 = var2.prevPosX + (var2.posX - var2.prevPosX) * (double)var1; + var6 = var2.prevPosY + (var2.posY - var2.prevPosY) * (double)var1 - (double)var3; + var8 = var2.prevPosZ + (var2.posZ - var2.prevPosZ) * (double)var1; + this.cloudFog = this.mc.renderGlobal.func_27307_a(var4, var6, var8, var1); + } + + private void setupCameraTransform(float var1, int var2) { + this.farPlaneDistance = (float)(256 >> this.mc.gameSettings.renderDistance); + GL11.glMatrixMode(GL11.GL_PROJECTION); + GL11.glLoadIdentity(); + float var3 = 0.07F; + if(this.mc.gameSettings.anaglyph) { + GL11.glTranslatef((float)(-(var2 * 2 - 1)) * var3, 0.0F, 0.0F); + } + + if(this.cameraZoom != 1.0D) { + GL11.glTranslatef((float)this.cameraYaw, (float)(-this.cameraPitch), 0.0F); + GL11.glScaled(this.cameraZoom, this.cameraZoom, 1.0D); + GLU.gluPerspective(this.getFOVModifier(var1), (float)this.mc.displayWidth / (float)this.mc.displayHeight, 0.05F, this.farPlaneDistance * 2.0F); + } else { + GLU.gluPerspective(this.getFOVModifier(var1), (float)this.mc.displayWidth / (float)this.mc.displayHeight, 0.05F, this.farPlaneDistance * 2.0F); + } + + GL11.glMatrixMode(GL11.GL_MODELVIEW); + GL11.glLoadIdentity(); + if(this.mc.gameSettings.anaglyph) { + GL11.glTranslatef((float)(var2 * 2 - 1) * 0.1F, 0.0F, 0.0F); + } + + this.hurtCameraEffect(var1); + if(this.mc.gameSettings.viewBobbing) { + this.setupViewBobbing(var1); + } + + float var4 = this.mc.thePlayer.prevTimeInPortal + (this.mc.thePlayer.timeInPortal - this.mc.thePlayer.prevTimeInPortal) * var1; + if(var4 > 0.0F) { + float var5 = 5.0F / (var4 * var4 + 5.0F) - var4 * 0.04F; + var5 *= var5; + GL11.glRotatef(((float)this.rendererUpdateCount + var1) * 20.0F, 0.0F, 1.0F, 1.0F); + GL11.glScalef(1.0F / var5, 1.0F, 1.0F); + GL11.glRotatef(-((float)this.rendererUpdateCount + var1) * 20.0F, 0.0F, 1.0F, 1.0F); + } + + this.orientCamera(var1); + } + + private void func_4135_b(float var1, int var2) { + GL11.glLoadIdentity(); + if(this.mc.gameSettings.anaglyph) { + GL11.glTranslatef((float)(var2 * 2 - 1) * 0.1F, 0.0F, 0.0F); + } + + GL11.glPushMatrix(); + this.hurtCameraEffect(var1); + if(this.mc.gameSettings.viewBobbing) { + this.setupViewBobbing(var1); + } + + if(!this.mc.gameSettings.thirdPersonView && !this.mc.renderViewEntity.isPlayerSleeping() && !this.mc.gameSettings.hideGUI) { + this.itemRenderer.renderItemInFirstPerson(var1); + } + + GL11.glPopMatrix(); + if(!this.mc.gameSettings.thirdPersonView && !this.mc.renderViewEntity.isPlayerSleeping()) { + this.itemRenderer.renderOverlays(var1); + this.hurtCameraEffect(var1); + } + + if(this.mc.gameSettings.viewBobbing) { + this.setupViewBobbing(var1); + } + + } + + public void updateCameraAndRender(float var1) { + if(!Display.isActive()) { + if(System.currentTimeMillis() - this.prevFrameTime > 500L) { + this.mc.displayInGameMenu(); + } + } else { + this.prevFrameTime = System.currentTimeMillis(); + } + + if(this.mc.inGameHasFocus) { + this.mc.mouseHelper.mouseXYChange(); + float var2 = this.mc.gameSettings.mouseSensitivity * 0.6F + 0.2F; + float var3 = var2 * var2 * var2 * 8.0F; + float var4 = (float)this.mc.mouseHelper.deltaX * var3; + float var5 = (float)this.mc.mouseHelper.deltaY * var3; + byte var6 = 1; + if(this.mc.gameSettings.invertMouse) { + var6 = -1; + } + + if(this.mc.gameSettings.smoothCamera) { + var4 = this.mouseFilterXAxis.func_22386_a(var4, 0.05F * var3); + var5 = this.mouseFilterYAxis.func_22386_a(var5, 0.05F * var3); + } + + this.mc.thePlayer.func_346_d(var4, var5 * (float)var6); + } + + if(!this.mc.skipRenderWorld) { + field_28135_a = this.mc.gameSettings.anaglyph; + ScaledResolution var13 = new ScaledResolution(this.mc.gameSettings, this.mc.displayWidth, this.mc.displayHeight); + int var14 = var13.getScaledWidth(); + int var15 = var13.getScaledHeight(); + int var16 = Mouse.getX() * var14 / this.mc.displayWidth; + int var17 = var15 - Mouse.getY() * var15 / this.mc.displayHeight - 1; + short var7 = 200; + if(this.mc.gameSettings.limitFramerate == 1) { + var7 = 120; + } + + if(this.mc.gameSettings.limitFramerate == 2) { + var7 = 40; + } + + long var8; + if(this.mc.theWorld != null) { + if(this.mc.gameSettings.limitFramerate == 0) { + this.renderWorld(var1, 0L); + } else { + this.renderWorld(var1, this.field_28133_I + (long)(1000000000 / var7)); + } + + if(this.mc.gameSettings.limitFramerate == 2) { + var8 = (this.field_28133_I + (long)(1000000000 / var7) - System.nanoTime()) / 1000000L; + if(var8 > 0L && var8 < 500L) { + try { + Thread.sleep(var8); + } catch (InterruptedException var12) { + var12.printStackTrace(); + } + } + } + + this.field_28133_I = System.nanoTime(); + if(!this.mc.gameSettings.hideGUI || this.mc.currentScreen != null) { + this.mc.ingameGUI.renderGameOverlay(var1, this.mc.currentScreen != null, var16, var17); + } + } else { + GL11.glViewport(0, 0, this.mc.displayWidth, this.mc.displayHeight); + GL11.glMatrixMode(GL11.GL_PROJECTION); + GL11.glLoadIdentity(); + GL11.glMatrixMode(GL11.GL_MODELVIEW); + GL11.glLoadIdentity(); + this.func_905_b(); + if(this.mc.gameSettings.limitFramerate == 2) { + var8 = (this.field_28133_I + (long)(1000000000 / var7) - System.nanoTime()) / 1000000L; + if(var8 < 0L) { + var8 += 10L; + } + + if(var8 > 0L && var8 < 500L) { + try { + Thread.sleep(var8); + } catch (InterruptedException var11) { + var11.printStackTrace(); + } + } + } + + this.field_28133_I = System.nanoTime(); + } + + if(this.mc.currentScreen != null) { + GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT); + this.mc.currentScreen.drawScreen(var16, var17, var1); + if(this.mc.currentScreen != null && this.mc.currentScreen.field_25091_h != null) { + this.mc.currentScreen.field_25091_h.func_25087_a(var1); + } + } + + } + } + + public void renderWorld(float var1, long var2) { + GL11.glEnable(GL11.GL_CULL_FACE); + GL11.glEnable(GL11.GL_DEPTH_TEST); + if(this.mc.renderViewEntity == null) { + this.mc.renderViewEntity = this.mc.thePlayer; + } + + this.getMouseOver(var1); + EntityLiving var4 = this.mc.renderViewEntity; + RenderGlobal var5 = this.mc.renderGlobal; + EffectRenderer var6 = this.mc.effectRenderer; + double var7 = var4.lastTickPosX + (var4.posX - var4.lastTickPosX) * (double)var1; + double var9 = var4.lastTickPosY + (var4.posY - var4.lastTickPosY) * (double)var1; + double var11 = var4.lastTickPosZ + (var4.posZ - var4.lastTickPosZ) * (double)var1; + IChunkProvider var13 = this.mc.theWorld.getIChunkProvider(); + int var16; + if(var13 instanceof ChunkProviderLoadOrGenerate) { + ChunkProviderLoadOrGenerate var14 = (ChunkProviderLoadOrGenerate)var13; + int var15 = MathHelper.floor_float((float)((int)var7)) >> 4; + var16 = MathHelper.floor_float((float)((int)var11)) >> 4; + var14.setCurrentChunkOver(var15, var16); + } + + for(int var18 = 0; var18 < 2; ++var18) { + if(this.mc.gameSettings.anaglyph) { + anaglyphField = var18; + if(anaglyphField == 0) { + GL11.glColorMask(false, true, true, false); + } else { + GL11.glColorMask(true, false, false, false); + } + } + + GL11.glViewport(0, 0, this.mc.displayWidth, this.mc.displayHeight); + this.updateFogColor(var1); + GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT | GL11.GL_COLOR_BUFFER_BIT); + GL11.glEnable(GL11.GL_CULL_FACE); + this.setupCameraTransform(var1, var18); + ClippingHelperImpl.getInstance(); + if(this.mc.gameSettings.renderDistance < 2) { + this.setupFog(-1, var1); + var5.renderSky(var1); + } + + GL11.glEnable(GL11.GL_FOG); + this.setupFog(1, var1); + if(this.mc.gameSettings.ambientOcclusion) { + GL11.glShadeModel(GL11.GL_SMOOTH); + } + + Frustrum var19 = new Frustrum(); + var19.setPosition(var7, var9, var11); + this.mc.renderGlobal.clipRenderersByFrustrum(var19, var1); + if(var18 == 0) { + while(!this.mc.renderGlobal.updateRenderers(var4, false) && var2 != 0L) { + long var20 = var2 - System.nanoTime(); + if(var20 < 0L || var20 > 1000000000L) { + break; + } + } + } + + this.setupFog(0, var1); + GL11.glEnable(GL11.GL_FOG); + GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture("/terrain.png")); + RenderHelper.disableStandardItemLighting(); + var5.sortAndRender(var4, 0, (double)var1); + GL11.glShadeModel(GL11.GL_FLAT); + RenderHelper.enableStandardItemLighting(); + var5.renderEntities(var4.getPosition(var1), var19, var1); + var6.func_1187_b(var4, var1); + RenderHelper.disableStandardItemLighting(); + this.setupFog(0, var1); + var6.renderParticles(var4, var1); + EntityPlayer var21; + if(this.mc.objectMouseOver != null && var4.isInsideOfMaterial(Material.water) && var4 instanceof EntityPlayer) { + var21 = (EntityPlayer)var4; + GL11.glDisable(GL11.GL_ALPHA_TEST); + var5.drawBlockBreaking(var21, this.mc.objectMouseOver, 0, var21.inventory.getCurrentItem(), var1); + var5.drawSelectionBox(var21, this.mc.objectMouseOver, 0, var21.inventory.getCurrentItem(), var1); + GL11.glEnable(GL11.GL_ALPHA_TEST); + } + + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + this.setupFog(0, var1); + GL11.glEnable(GL11.GL_BLEND); + GL11.glDisable(GL11.GL_CULL_FACE); + GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture("/terrain.png")); + if(this.mc.gameSettings.fancyGraphics) { + if(this.mc.gameSettings.ambientOcclusion) { + GL11.glShadeModel(GL11.GL_SMOOTH); + } + + GL11.glColorMask(false, false, false, false); + var16 = var5.sortAndRender(var4, 1, (double)var1); + if(this.mc.gameSettings.anaglyph) { + if(anaglyphField == 0) { + GL11.glColorMask(false, true, true, true); + } else { + GL11.glColorMask(true, false, false, true); + } + } else { + GL11.glColorMask(true, true, true, true); + } + + if(var16 > 0) { + var5.renderAllRenderLists(1, (double)var1); + } + + GL11.glShadeModel(GL11.GL_FLAT); + } else { + var5.sortAndRender(var4, 1, (double)var1); + } + + GL11.glDepthMask(true); + GL11.glEnable(GL11.GL_CULL_FACE); + GL11.glDisable(GL11.GL_BLEND); + if(this.cameraZoom == 1.0D && var4 instanceof EntityPlayer && this.mc.objectMouseOver != null && !var4.isInsideOfMaterial(Material.water)) { + var21 = (EntityPlayer)var4; + GL11.glDisable(GL11.GL_ALPHA_TEST); + var5.drawBlockBreaking(var21, this.mc.objectMouseOver, 0, var21.inventory.getCurrentItem(), var1); + var5.drawSelectionBox(var21, this.mc.objectMouseOver, 0, var21.inventory.getCurrentItem(), var1); + GL11.glEnable(GL11.GL_ALPHA_TEST); + } + + this.renderRainSnow(var1); + GL11.glDisable(GL11.GL_FOG); + if(this.pointedEntity != null) { + } + + this.setupFog(0, var1); + GL11.glEnable(GL11.GL_FOG); + var5.renderClouds(var1); + GL11.glDisable(GL11.GL_FOG); + this.setupFog(1, var1); + if(this.cameraZoom == 1.0D) { + GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT); + this.func_4135_b(var1, var18); + } + + if(!this.mc.gameSettings.anaglyph) { + return; + } + } + + GL11.glColorMask(true, true, true, false); + } + + private void addRainParticles() { + float var1 = this.mc.theWorld.func_27162_g(1.0F); + if(!this.mc.gameSettings.fancyGraphics) { + var1 /= 2.0F; + } + + if(var1 != 0.0F) { + this.random.setSeed((long)this.rendererUpdateCount * 312987231L); + EntityLiving var2 = this.mc.renderViewEntity; + World var3 = this.mc.theWorld; + int var4 = MathHelper.floor_double(var2.posX); + int var5 = MathHelper.floor_double(var2.posY); + int var6 = MathHelper.floor_double(var2.posZ); + byte var7 = 10; + double var8 = 0.0D; + double var10 = 0.0D; + double var12 = 0.0D; + int var14 = 0; + + for(int var15 = 0; var15 < (int)(100.0F * var1 * var1); ++var15) { + int var16 = var4 + this.random.nextInt(var7) - this.random.nextInt(var7); + int var17 = var6 + this.random.nextInt(var7) - this.random.nextInt(var7); + int var18 = var3.findTopSolidBlock(var16, var17); + int var19 = var3.getBlockId(var16, var18 - 1, var17); + if(var18 <= var5 + var7 && var18 >= var5 - var7 && var3.getWorldChunkManager().getBiomeGenAt(var16, var17).canSpawnLightningBolt()) { + float var20 = this.random.nextFloat(); + float var21 = this.random.nextFloat(); + if(var19 > 0) { + if(Block.blocksList[var19].blockMaterial == Material.lava) { + this.mc.effectRenderer.addEffect(new EntitySmokeFX(var3, (double)((float)var16 + var20), (double)((float)var18 + 0.1F) - Block.blocksList[var19].minY, (double)((float)var17 + var21), 0.0D, 0.0D, 0.0D)); + } else { + ++var14; + if(this.random.nextInt(var14) == 0) { + var8 = (double)((float)var16 + var20); + var10 = (double)((float)var18 + 0.1F) - Block.blocksList[var19].minY; + var12 = (double)((float)var17 + var21); + } + + this.mc.effectRenderer.addEffect(new EntityRainFX(var3, (double)((float)var16 + var20), (double)((float)var18 + 0.1F) - Block.blocksList[var19].minY, (double)((float)var17 + var21))); + } + } + } + } + + if(var14 > 0 && this.random.nextInt(3) < this.rainSoundCounter++) { + this.rainSoundCounter = 0; + if(var10 > var2.posY + 1.0D && var3.findTopSolidBlock(MathHelper.floor_double(var2.posX), MathHelper.floor_double(var2.posZ)) > MathHelper.floor_double(var2.posY)) { + this.mc.theWorld.playSoundEffect(var8, var10, var12, "ambient.weather.rain", 0.1F, 0.5F); + } else { + this.mc.theWorld.playSoundEffect(var8, var10, var12, "ambient.weather.rain", 0.2F, 1.0F); + } + } + + } + } + + protected void renderRainSnow(float var1) { + float var2 = this.mc.theWorld.func_27162_g(var1); + if(var2 > 0.0F) { + EntityLiving var3 = this.mc.renderViewEntity; + World var4 = this.mc.theWorld; + int var5 = MathHelper.floor_double(var3.posX); + int var6 = MathHelper.floor_double(var3.posY); + int var7 = MathHelper.floor_double(var3.posZ); + Tessellator var8 = Tessellator.instance; + GL11.glDisable(GL11.GL_CULL_FACE); + GL11.glNormal3f(0.0F, 1.0F, 0.0F); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + GL11.glAlphaFunc(GL11.GL_GREATER, 0.01F); + GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture("/environment/snow.png")); + double var9 = var3.lastTickPosX + (var3.posX - var3.lastTickPosX) * (double)var1; + double var11 = var3.lastTickPosY + (var3.posY - var3.lastTickPosY) * (double)var1; + double var13 = var3.lastTickPosZ + (var3.posZ - var3.lastTickPosZ) * (double)var1; + int var15 = MathHelper.floor_double(var11); + byte var16 = 5; + if(this.mc.gameSettings.fancyGraphics) { + var16 = 10; + } + + BiomeGenBase[] var17 = var4.getWorldChunkManager().func_4069_a(var5 - var16, var7 - var16, var16 * 2 + 1, var16 * 2 + 1); + int var18 = 0; + + int var19; + int var20; + BiomeGenBase var21; + int var22; + int var23; + int var24; + float var26; + for(var19 = var5 - var16; var19 <= var5 + var16; ++var19) { + for(var20 = var7 - var16; var20 <= var7 + var16; ++var20) { + var21 = var17[var18++]; + if(var21.getEnableSnow()) { + var22 = var4.findTopSolidBlock(var19, var20); + if(var22 < 0) { + var22 = 0; + } + + var23 = var22; + if(var22 < var15) { + var23 = var15; + } + + var24 = var6 - var16; + int var25 = var6 + var16; + if(var24 < var22) { + var24 = var22; + } + + if(var25 < var22) { + var25 = var22; + } + + var26 = 1.0F; + if(var24 != var25) { + this.random.setSeed((long)(var19 * var19 * 3121 + var19 * 45238971 + var20 * var20 * 418711 + var20 * 13761)); + float var27 = (float)this.rendererUpdateCount + var1; + float var28 = ((float)(this.rendererUpdateCount & 511) + var1) / 512.0F; + float var29 = this.random.nextFloat() + var27 * 0.01F * (float)this.random.nextGaussian(); + float var30 = this.random.nextFloat() + var27 * (float)this.random.nextGaussian() * 0.001F; + double var31 = (double)((float)var19 + 0.5F) - var3.posX; + double var33 = (double)((float)var20 + 0.5F) - var3.posZ; + float var35 = MathHelper.sqrt_double(var31 * var31 + var33 * var33) / (float)var16; + var8.startDrawingQuads(); + float var36 = var4.getLightBrightness(var19, var23, var20); + GL11.glColor4f(var36, var36, var36, ((1.0F - var35 * var35) * 0.3F + 0.5F) * var2); + var8.setTranslationD(-var9 * 1.0D, -var11 * 1.0D, -var13 * 1.0D); + var8.addVertexWithUV((double)(var19 + 0), (double)var24, (double)var20 + 0.5D, (double)(0.0F * var26 + var29), (double)((float)var24 * var26 / 4.0F + var28 * var26 + var30)); + var8.addVertexWithUV((double)(var19 + 1), (double)var24, (double)var20 + 0.5D, (double)(1.0F * var26 + var29), (double)((float)var24 * var26 / 4.0F + var28 * var26 + var30)); + var8.addVertexWithUV((double)(var19 + 1), (double)var25, (double)var20 + 0.5D, (double)(1.0F * var26 + var29), (double)((float)var25 * var26 / 4.0F + var28 * var26 + var30)); + var8.addVertexWithUV((double)(var19 + 0), (double)var25, (double)var20 + 0.5D, (double)(0.0F * var26 + var29), (double)((float)var25 * var26 / 4.0F + var28 * var26 + var30)); + var8.addVertexWithUV((double)var19 + 0.5D, (double)var24, (double)(var20 + 0), (double)(0.0F * var26 + var29), (double)((float)var24 * var26 / 4.0F + var28 * var26 + var30)); + var8.addVertexWithUV((double)var19 + 0.5D, (double)var24, (double)(var20 + 1), (double)(1.0F * var26 + var29), (double)((float)var24 * var26 / 4.0F + var28 * var26 + var30)); + var8.addVertexWithUV((double)var19 + 0.5D, (double)var25, (double)(var20 + 1), (double)(1.0F * var26 + var29), (double)((float)var25 * var26 / 4.0F + var28 * var26 + var30)); + var8.addVertexWithUV((double)var19 + 0.5D, (double)var25, (double)(var20 + 0), (double)(0.0F * var26 + var29), (double)((float)var25 * var26 / 4.0F + var28 * var26 + var30)); + var8.setTranslationD(0.0D, 0.0D, 0.0D); + var8.draw(); + } + } + } + } + + GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture("/environment/rain.png")); + if(this.mc.gameSettings.fancyGraphics) { + var16 = 10; + } + + var18 = 0; + + for(var19 = var5 - var16; var19 <= var5 + var16; ++var19) { + for(var20 = var7 - var16; var20 <= var7 + var16; ++var20) { + var21 = var17[var18++]; + if(var21.canSpawnLightningBolt()) { + var22 = var4.findTopSolidBlock(var19, var20); + var23 = var6 - var16; + var24 = var6 + var16; + if(var23 < var22) { + var23 = var22; + } + + if(var24 < var22) { + var24 = var22; + } + + float var37 = 1.0F; + if(var23 != var24) { + this.random.setSeed((long)(var19 * var19 * 3121 + var19 * 45238971 + var20 * var20 * 418711 + var20 * 13761)); + var26 = ((float)(this.rendererUpdateCount + var19 * var19 * 3121 + var19 * 45238971 + var20 * var20 * 418711 + var20 * 13761 & 31) + var1) / 32.0F * (3.0F + this.random.nextFloat()); + double var38 = (double)((float)var19 + 0.5F) - var3.posX; + double var39 = (double)((float)var20 + 0.5F) - var3.posZ; + float var40 = MathHelper.sqrt_double(var38 * var38 + var39 * var39) / (float)var16; + var8.startDrawingQuads(); + float var32 = var4.getLightBrightness(var19, 128, var20) * 0.85F + 0.15F; + GL11.glColor4f(var32, var32, var32, ((1.0F - var40 * var40) * 0.5F + 0.5F) * var2); + var8.setTranslationD(-var9 * 1.0D, -var11 * 1.0D, -var13 * 1.0D); + var8.addVertexWithUV((double)(var19 + 0), (double)var23, (double)var20 + 0.5D, (double)(0.0F * var37), (double)((float)var23 * var37 / 4.0F + var26 * var37)); + var8.addVertexWithUV((double)(var19 + 1), (double)var23, (double)var20 + 0.5D, (double)(1.0F * var37), (double)((float)var23 * var37 / 4.0F + var26 * var37)); + var8.addVertexWithUV((double)(var19 + 1), (double)var24, (double)var20 + 0.5D, (double)(1.0F * var37), (double)((float)var24 * var37 / 4.0F + var26 * var37)); + var8.addVertexWithUV((double)(var19 + 0), (double)var24, (double)var20 + 0.5D, (double)(0.0F * var37), (double)((float)var24 * var37 / 4.0F + var26 * var37)); + var8.addVertexWithUV((double)var19 + 0.5D, (double)var23, (double)(var20 + 0), (double)(0.0F * var37), (double)((float)var23 * var37 / 4.0F + var26 * var37)); + var8.addVertexWithUV((double)var19 + 0.5D, (double)var23, (double)(var20 + 1), (double)(1.0F * var37), (double)((float)var23 * var37 / 4.0F + var26 * var37)); + var8.addVertexWithUV((double)var19 + 0.5D, (double)var24, (double)(var20 + 1), (double)(1.0F * var37), (double)((float)var24 * var37 / 4.0F + var26 * var37)); + var8.addVertexWithUV((double)var19 + 0.5D, (double)var24, (double)(var20 + 0), (double)(0.0F * var37), (double)((float)var24 * var37 / 4.0F + var26 * var37)); + var8.setTranslationD(0.0D, 0.0D, 0.0D); + var8.draw(); + } + } + } + } + + GL11.glEnable(GL11.GL_CULL_FACE); + GL11.glDisable(GL11.GL_BLEND); + GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); + } + } + + public void func_905_b() { + ScaledResolution var1 = new ScaledResolution(this.mc.gameSettings, this.mc.displayWidth, this.mc.displayHeight); + GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT); + GL11.glMatrixMode(GL11.GL_PROJECTION); + GL11.glLoadIdentity(); + GL11.glOrtho(0.0D, var1.field_25121_a, var1.field_25120_b, 0.0D, 1000.0D, 3000.0D); + GL11.glMatrixMode(GL11.GL_MODELVIEW); + GL11.glLoadIdentity(); + GL11.glTranslatef(0.0F, 0.0F, -2000.0F); + } + + private void updateFogColor(float var1) { + World var2 = this.mc.theWorld; + EntityLiving var3 = this.mc.renderViewEntity; + float var4 = 1.0F / (float)(4 - this.mc.gameSettings.renderDistance); + var4 = 1.0F - (float)Math.pow((double)var4, 0.25D); + Vec3D var5 = var2.func_4079_a(this.mc.renderViewEntity, var1); + float var6 = (float)var5.xCoord; + float var7 = (float)var5.yCoord; + float var8 = (float)var5.zCoord; + Vec3D var9 = var2.getFogColor(var1); + this.fogColorRed = (float)var9.xCoord; + this.fogColorGreen = (float)var9.yCoord; + this.fogColorBlue = (float)var9.zCoord; + this.fogColorRed += (var6 - this.fogColorRed) * var4; + this.fogColorGreen += (var7 - this.fogColorGreen) * var4; + this.fogColorBlue += (var8 - this.fogColorBlue) * var4; + float var10 = var2.func_27162_g(var1); + float var11; + float var12; + if(var10 > 0.0F) { + var11 = 1.0F - var10 * 0.5F; + var12 = 1.0F - var10 * 0.4F; + this.fogColorRed *= var11; + this.fogColorGreen *= var11; + this.fogColorBlue *= var12; + } + + var11 = var2.func_27166_f(var1); + if(var11 > 0.0F) { + var12 = 1.0F - var11 * 0.5F; + this.fogColorRed *= var12; + this.fogColorGreen *= var12; + this.fogColorBlue *= var12; + } + + if(this.cloudFog) { + Vec3D var16 = var2.func_628_d(var1); + this.fogColorRed = (float)var16.xCoord; + this.fogColorGreen = (float)var16.yCoord; + this.fogColorBlue = (float)var16.zCoord; + } else if(var3.isInsideOfMaterial(Material.water)) { + this.fogColorRed = 0.02F; + this.fogColorGreen = 0.02F; + this.fogColorBlue = 0.2F; + } else if(var3.isInsideOfMaterial(Material.lava)) { + this.fogColorRed = 0.6F; + this.fogColorGreen = 0.1F; + this.fogColorBlue = 0.0F; + } + + var12 = this.fogColor2 + (this.fogColor1 - this.fogColor2) * var1; + this.fogColorRed *= var12; + this.fogColorGreen *= var12; + this.fogColorBlue *= var12; + if(this.mc.gameSettings.anaglyph) { + float var13 = (this.fogColorRed * 30.0F + this.fogColorGreen * 59.0F + this.fogColorBlue * 11.0F) / 100.0F; + float var14 = (this.fogColorRed * 30.0F + this.fogColorGreen * 70.0F) / 100.0F; + float var15 = (this.fogColorRed * 30.0F + this.fogColorBlue * 70.0F) / 100.0F; + this.fogColorRed = var13; + this.fogColorGreen = var14; + this.fogColorBlue = var15; + } + + GL11.glClearColor(this.fogColorRed, this.fogColorGreen, this.fogColorBlue, 0.0F); + } + + private void setupFog(int var1, float var2) { + EntityLiving var3 = this.mc.renderViewEntity; + GL11.glFog(GL11.GL_FOG_COLOR, this.func_908_a(this.fogColorRed, this.fogColorGreen, this.fogColorBlue, 1.0F)); + GL11.glNormal3f(0.0F, -1.0F, 0.0F); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + float var4; + float var5; + float var6; + float var7; + float var8; + float var9; + if(this.cloudFog) { + GL11.glFogi(GL11.GL_FOG_MODE, GL11.GL_EXP); + GL11.glFogf(GL11.GL_FOG_DENSITY, 0.1F); + var4 = 1.0F; + var5 = 1.0F; + var6 = 1.0F; + if(this.mc.gameSettings.anaglyph) { + var7 = (var4 * 30.0F + var5 * 59.0F + var6 * 11.0F) / 100.0F; + var8 = (var4 * 30.0F + var5 * 70.0F) / 100.0F; + var9 = (var4 * 30.0F + var6 * 70.0F) / 100.0F; + } + } else if(var3.isInsideOfMaterial(Material.water)) { + GL11.glFogi(GL11.GL_FOG_MODE, GL11.GL_EXP); + GL11.glFogf(GL11.GL_FOG_DENSITY, 0.1F); + var4 = 0.4F; + var5 = 0.4F; + var6 = 0.9F; + if(this.mc.gameSettings.anaglyph) { + var7 = (var4 * 30.0F + var5 * 59.0F + var6 * 11.0F) / 100.0F; + var8 = (var4 * 30.0F + var5 * 70.0F) / 100.0F; + var9 = (var4 * 30.0F + var6 * 70.0F) / 100.0F; + } + } else if(var3.isInsideOfMaterial(Material.lava)) { + GL11.glFogi(GL11.GL_FOG_MODE, GL11.GL_EXP); + GL11.glFogf(GL11.GL_FOG_DENSITY, 2.0F); + var4 = 0.4F; + var5 = 0.3F; + var6 = 0.3F; + if(this.mc.gameSettings.anaglyph) { + var7 = (var4 * 30.0F + var5 * 59.0F + var6 * 11.0F) / 100.0F; + var8 = (var4 * 30.0F + var5 * 70.0F) / 100.0F; + var9 = (var4 * 30.0F + var6 * 70.0F) / 100.0F; + } + } else { + GL11.glFogi(GL11.GL_FOG_MODE, GL11.GL_LINEAR); + GL11.glFogf(GL11.GL_FOG_START, this.farPlaneDistance * 0.25F); + GL11.glFogf(GL11.GL_FOG_END, this.farPlaneDistance); + if(var1 < 0) { + GL11.glFogf(GL11.GL_FOG_START, 0.0F); + GL11.glFogf(GL11.GL_FOG_END, this.farPlaneDistance * 0.8F); + } + + if(GLContext.getCapabilities().GL_NV_fog_distance) { + GL11.glFogi(NVFogDistance.GL_FOG_DISTANCE_MODE_NV, NVFogDistance.GL_EYE_RADIAL_NV); + } + + if(this.mc.theWorld.worldProvider.isNether) { + GL11.glFogf(GL11.GL_FOG_START, 0.0F); + } + } + + GL11.glEnable(GL11.GL_COLOR_MATERIAL); + GL11.glColorMaterial(GL11.GL_FRONT, GL11.GL_AMBIENT); + } + + private FloatBuffer func_908_a(float var1, float var2, float var3, float var4) { + this.fogColorBuffer.clear(); + this.fogColorBuffer.put(var1).put(var2).put(var3).put(var4); + this.fogColorBuffer.flip(); + return this.fogColorBuffer; + } +} diff --git a/src/net/minecraft/src/EntitySheep.java b/src/net/minecraft/src/EntitySheep.java new file mode 100644 index 0000000..bfebfac --- /dev/null +++ b/src/net/minecraft/src/EntitySheep.java @@ -0,0 +1,106 @@ +package net.minecraft.src; + +import java.util.Random; + +public class EntitySheep extends EntityAnimal { + public static final float[][] fleeceColorTable = new float[][]{{1.0F, 1.0F, 1.0F}, {0.95F, 0.7F, 0.2F}, {0.9F, 0.5F, 0.85F}, {0.6F, 0.7F, 0.95F}, {0.9F, 0.9F, 0.2F}, {0.5F, 0.8F, 0.1F}, {0.95F, 0.7F, 0.8F}, {0.3F, 0.3F, 0.3F}, {0.6F, 0.6F, 0.6F}, {0.3F, 0.6F, 0.7F}, {0.7F, 0.4F, 0.9F}, {0.2F, 0.4F, 0.8F}, {0.5F, 0.4F, 0.3F}, {0.4F, 0.5F, 0.2F}, {0.8F, 0.3F, 0.3F}, {0.1F, 0.1F, 0.1F}}; + + public EntitySheep(World var1) { + super(var1); + this.texture = "/mob/sheep.png"; + this.setSize(0.9F, 1.3F); + } + + protected void entityInit() { + super.entityInit(); + this.dataWatcher.addObject(16, new Byte((byte)0)); + } + + public boolean attackEntityFrom(Entity var1, int var2) { + return super.attackEntityFrom(var1, var2); + } + + protected void dropFewItems() { + if(!this.getSheared()) { + this.entityDropItem(new ItemStack(Block.cloth.blockID, 1, this.getFleeceColor()), 0.0F); + } + + } + + protected int getDropItemId() { + return Block.cloth.blockID; + } + + public boolean interact(EntityPlayer var1) { + ItemStack var2 = var1.inventory.getCurrentItem(); + if(var2 != null && var2.itemID == Item.shears.shiftedIndex && !this.getSheared()) { + if(!this.worldObj.multiplayerWorld) { + this.setSheared(true); + int var3 = 2 + this.rand.nextInt(3); + + for(int var4 = 0; var4 < var3; ++var4) { + EntityItem var5 = this.entityDropItem(new ItemStack(Block.cloth.blockID, 1, this.getFleeceColor()), 1.0F); + var5.motionY += (double)(this.rand.nextFloat() * 0.05F); + var5.motionX += (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.1F); + var5.motionZ += (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.1F); + } + } + + var2.damageItem(1, var1); + } + + return false; + } + + public void writeEntityToNBT(NBTTagCompound var1) { + super.writeEntityToNBT(var1); + var1.setBoolean("Sheared", this.getSheared()); + var1.setByte("Color", (byte)this.getFleeceColor()); + } + + public void readEntityFromNBT(NBTTagCompound var1) { + super.readEntityFromNBT(var1); + this.setSheared(var1.getBoolean("Sheared")); + this.setFleeceColor(var1.getByte("Color")); + } + + protected String getLivingSound() { + return "mob.sheep"; + } + + protected String getHurtSound() { + return "mob.sheep"; + } + + protected String getDeathSound() { + return "mob.sheep"; + } + + public int getFleeceColor() { + return this.dataWatcher.getWatchableObjectByte(16) & 15; + } + + public void setFleeceColor(int var1) { + byte var2 = this.dataWatcher.getWatchableObjectByte(16); + this.dataWatcher.updateObject(16, Byte.valueOf((byte)(var2 & 240 | var1 & 15))); + } + + public boolean getSheared() { + return (this.dataWatcher.getWatchableObjectByte(16) & 16) != 0; + } + + public void setSheared(boolean var1) { + byte var2 = this.dataWatcher.getWatchableObjectByte(16); + if(var1) { + this.dataWatcher.updateObject(16, Byte.valueOf((byte)(var2 | 16))); + } else { + this.dataWatcher.updateObject(16, Byte.valueOf((byte)(var2 & -17))); + } + + } + + public static int getRandomFleeceColor(Random var0) { + int var1 = var0.nextInt(100); + return var1 < 5 ? 15 : (var1 < 10 ? 7 : (var1 < 15 ? 8 : (var1 < 18 ? 12 : (var0.nextInt(500) == 0 ? 6 : 0)))); + } +} diff --git a/src/net/minecraft/src/EntitySkeleton.java b/src/net/minecraft/src/EntitySkeleton.java new file mode 100644 index 0000000..f43d389 --- /dev/null +++ b/src/net/minecraft/src/EntitySkeleton.java @@ -0,0 +1,86 @@ +package net.minecraft.src; + +public class EntitySkeleton extends EntityMob { + private static final ItemStack defaultHeldItem = new ItemStack(Item.bow, 1); + + public EntitySkeleton(World var1) { + super(var1); + this.texture = "/mob/skeleton.png"; + } + + protected String getLivingSound() { + return "mob.skeleton"; + } + + protected String getHurtSound() { + return "mob.skeletonhurt"; + } + + protected String getDeathSound() { + return "mob.skeletonhurt"; + } + + public void onLivingUpdate() { + if(this.worldObj.isDaytime()) { + float var1 = this.getEntityBrightness(1.0F); + if(var1 > 0.5F && this.worldObj.canBlockSeeTheSky(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ)) && this.rand.nextFloat() * 30.0F < (var1 - 0.4F) * 2.0F) { + this.fire = 300; + } + } + + super.onLivingUpdate(); + } + + protected void attackEntity(Entity var1, float var2) { + if(var2 < 10.0F) { + double var3 = var1.posX - this.posX; + double var5 = var1.posZ - this.posZ; + if(this.attackTime == 0) { + EntityArrow var7 = new EntityArrow(this.worldObj, this); + var7.posY += (double)1.4F; + double var8 = var1.posY + (double)var1.getEyeHeight() - (double)0.2F - var7.posY; + float var10 = MathHelper.sqrt_double(var3 * var3 + var5 * var5) * 0.2F; + this.worldObj.playSoundAtEntity(this, "random.bow", 1.0F, 1.0F / (this.rand.nextFloat() * 0.4F + 0.8F)); + this.worldObj.entityJoinedWorld(var7); + var7.setArrowHeading(var3, var8 + (double)var10, var5, 0.6F, 12.0F); + this.attackTime = 30; + } + + this.rotationYaw = (float)(Math.atan2(var5, var3) * 180.0D / (double)((float)Math.PI)) - 90.0F; + this.hasAttacked = true; + } + + } + + public void writeEntityToNBT(NBTTagCompound var1) { + super.writeEntityToNBT(var1); + } + + public void readEntityFromNBT(NBTTagCompound var1) { + super.readEntityFromNBT(var1); + } + + protected int getDropItemId() { + return Item.arrow.shiftedIndex; + } + + protected void dropFewItems() { + int var1 = this.rand.nextInt(3); + + int var2; + for(var2 = 0; var2 < var1; ++var2) { + this.dropItem(Item.arrow.shiftedIndex, 1); + } + + var1 = this.rand.nextInt(3); + + for(var2 = 0; var2 < var1; ++var2) { + this.dropItem(Item.bone.shiftedIndex, 1); + } + + } + + public ItemStack getHeldItem() { + return defaultHeldItem; + } +} diff --git a/src/net/minecraft/src/EntitySlime.java b/src/net/minecraft/src/EntitySlime.java new file mode 100644 index 0000000..9b90285 --- /dev/null +++ b/src/net/minecraft/src/EntitySlime.java @@ -0,0 +1,142 @@ +package net.minecraft.src; + +public class EntitySlime extends EntityLiving implements IMob { + public float field_768_a; + public float field_767_b; + private int slimeJumpDelay = 0; + + public EntitySlime(World var1) { + super(var1); + this.texture = "/mob/slime.png"; + int var2 = 1 << this.rand.nextInt(3); + this.yOffset = 0.0F; + this.slimeJumpDelay = this.rand.nextInt(20) + 10; + this.setSlimeSize(var2); + } + + protected void entityInit() { + super.entityInit(); + this.dataWatcher.addObject(16, new Byte((byte)1)); + } + + public void setSlimeSize(int var1) { + this.dataWatcher.updateObject(16, new Byte((byte)var1)); + this.setSize(0.6F * (float)var1, 0.6F * (float)var1); + this.health = var1 * var1; + this.setPosition(this.posX, this.posY, this.posZ); + } + + public int getSlimeSize() { + return this.dataWatcher.getWatchableObjectByte(16); + } + + public void writeEntityToNBT(NBTTagCompound var1) { + super.writeEntityToNBT(var1); + var1.setInteger("Size", this.getSlimeSize() - 1); + } + + public void readEntityFromNBT(NBTTagCompound var1) { + super.readEntityFromNBT(var1); + this.setSlimeSize(var1.getInteger("Size") + 1); + } + + public void onUpdate() { + this.field_767_b = this.field_768_a; + boolean var1 = this.onGround; + super.onUpdate(); + if(this.onGround && !var1) { + int var2 = this.getSlimeSize(); + + for(int var3 = 0; var3 < var2 * 8; ++var3) { + float var4 = this.rand.nextFloat() * (float)Math.PI * 2.0F; + float var5 = this.rand.nextFloat() * 0.5F + 0.5F; + float var6 = MathHelper.sin(var4) * (float)var2 * 0.5F * var5; + float var7 = MathHelper.cos(var4) * (float)var2 * 0.5F * var5; + this.worldObj.spawnParticle("slime", this.posX + (double)var6, this.boundingBox.minY, this.posZ + (double)var7, 0.0D, 0.0D, 0.0D); + } + + if(var2 > 2) { + this.worldObj.playSoundAtEntity(this, "mob.slime", this.getSoundVolume(), ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F) / 0.8F); + } + + this.field_768_a = -0.5F; + } + + this.field_768_a *= 0.6F; + } + + protected void updatePlayerActionState() { + this.func_27021_X(); + EntityPlayer var1 = this.worldObj.getClosestPlayerToEntity(this, 16.0D); + if(var1 != null) { + this.faceEntity(var1, 10.0F, 20.0F); + } + + if(this.onGround && this.slimeJumpDelay-- <= 0) { + this.slimeJumpDelay = this.rand.nextInt(20) + 10; + if(var1 != null) { + this.slimeJumpDelay /= 3; + } + + this.isJumping = true; + if(this.getSlimeSize() > 1) { + this.worldObj.playSoundAtEntity(this, "mob.slime", this.getSoundVolume(), ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F) * 0.8F); + } + + this.field_768_a = 1.0F; + this.moveStrafing = 1.0F - this.rand.nextFloat() * 2.0F; + this.moveForward = (float)(1 * this.getSlimeSize()); + } else { + this.isJumping = false; + if(this.onGround) { + this.moveStrafing = this.moveForward = 0.0F; + } + } + + } + + public void setEntityDead() { + int var1 = this.getSlimeSize(); + if(!this.worldObj.multiplayerWorld && var1 > 1 && this.health == 0) { + for(int var2 = 0; var2 < 4; ++var2) { + float var3 = ((float)(var2 % 2) - 0.5F) * (float)var1 / 4.0F; + float var4 = ((float)(var2 / 2) - 0.5F) * (float)var1 / 4.0F; + EntitySlime var5 = new EntitySlime(this.worldObj); + var5.setSlimeSize(var1 / 2); + var5.setLocationAndAngles(this.posX + (double)var3, this.posY + 0.5D, this.posZ + (double)var4, this.rand.nextFloat() * 360.0F, 0.0F); + this.worldObj.entityJoinedWorld(var5); + } + } + + super.setEntityDead(); + } + + public void onCollideWithPlayer(EntityPlayer var1) { + int var2 = this.getSlimeSize(); + if(var2 > 1 && this.canEntityBeSeen(var1) && (double)this.getDistanceToEntity(var1) < 0.6D * (double)var2 && var1.attackEntityFrom(this, var2)) { + this.worldObj.playSoundAtEntity(this, "mob.slimeattack", 1.0F, (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F); + } + + } + + protected String getHurtSound() { + return "mob.slime"; + } + + protected String getDeathSound() { + return "mob.slime"; + } + + protected int getDropItemId() { + return this.getSlimeSize() == 1 ? Item.slimeBall.shiftedIndex : 0; + } + + public boolean getCanSpawnHere() { + Chunk var1 = this.worldObj.getChunkFromBlockCoords(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posZ)); + return (this.getSlimeSize() == 1 || this.worldObj.difficultySetting > 0) && this.rand.nextInt(10) == 0 && var1.func_997_a(987234911L).nextInt(10) == 0 && this.posY < 16.0D; + } + + protected float getSoundVolume() { + return 0.6F; + } +} diff --git a/src/net/minecraft/src/EntitySlimeFX.java b/src/net/minecraft/src/EntitySlimeFX.java new file mode 100644 index 0000000..ed80254 --- /dev/null +++ b/src/net/minecraft/src/EntitySlimeFX.java @@ -0,0 +1,32 @@ +package net.minecraft.src; + +public class EntitySlimeFX extends EntityFX { + public EntitySlimeFX(World var1, double var2, double var4, double var6, Item var8) { + super(var1, var2, var4, var6, 0.0D, 0.0D, 0.0D); + this.particleTextureIndex = var8.getIconFromDamage(0); + this.particleRed = this.particleGreen = this.particleBlue = 1.0F; + this.particleGravity = Block.blockSnow.blockParticleGravity; + this.particleScale /= 2.0F; + } + + public int getFXLayer() { + return 2; + } + + public void renderParticle(Tessellator var1, float var2, float var3, float var4, float var5, float var6, float var7) { + float var8 = ((float)(this.particleTextureIndex % 16) + this.particleTextureJitterX / 4.0F) / 16.0F; + float var9 = var8 + 0.999F / 64.0F; + float var10 = ((float)(this.particleTextureIndex / 16) + this.particleTextureJitterY / 4.0F) / 16.0F; + float var11 = var10 + 0.999F / 64.0F; + float var12 = 0.1F * this.particleScale; + float var13 = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)var2 - interpPosX); + float var14 = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)var2 - interpPosY); + float var15 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)var2 - interpPosZ); + float var16 = this.getEntityBrightness(var2); + var1.setColorOpaque_F(var16 * this.particleRed, var16 * this.particleGreen, var16 * this.particleBlue); + var1.addVertexWithUV((double)(var13 - var3 * var12 - var6 * var12), (double)(var14 - var4 * var12), (double)(var15 - var5 * var12 - var7 * var12), (double)var8, (double)var11); + var1.addVertexWithUV((double)(var13 - var3 * var12 + var6 * var12), (double)(var14 + var4 * var12), (double)(var15 - var5 * var12 + var7 * var12), (double)var8, (double)var10); + var1.addVertexWithUV((double)(var13 + var3 * var12 + var6 * var12), (double)(var14 + var4 * var12), (double)(var15 + var5 * var12 + var7 * var12), (double)var9, (double)var10); + var1.addVertexWithUV((double)(var13 + var3 * var12 - var6 * var12), (double)(var14 - var4 * var12), (double)(var15 + var5 * var12 - var7 * var12), (double)var9, (double)var11); + } +} diff --git a/src/net/minecraft/src/EntitySmokeFX.java b/src/net/minecraft/src/EntitySmokeFX.java new file mode 100644 index 0000000..e89fa7d --- /dev/null +++ b/src/net/minecraft/src/EntitySmokeFX.java @@ -0,0 +1,66 @@ +package net.minecraft.src; + +public class EntitySmokeFX extends EntityFX { + float field_671_a; + + public EntitySmokeFX(World var1, double var2, double var4, double var6, double var8, double var10, double var12) { + this(var1, var2, var4, var6, var8, var10, var12, 1.0F); + } + + public EntitySmokeFX(World var1, double var2, double var4, double var6, double var8, double var10, double var12, float var14) { + super(var1, var2, var4, var6, 0.0D, 0.0D, 0.0D); + this.motionX *= (double)0.1F; + this.motionY *= (double)0.1F; + this.motionZ *= (double)0.1F; + this.motionX += var8; + this.motionY += var10; + this.motionZ += var12; + this.particleRed = this.particleGreen = this.particleBlue = (float)(Math.random() * (double)0.3F); + this.particleScale *= 12.0F / 16.0F; + this.particleScale *= var14; + this.field_671_a = this.particleScale; + this.particleMaxAge = (int)(8.0D / (Math.random() * 0.8D + 0.2D)); + this.particleMaxAge = (int)((float)this.particleMaxAge * var14); + this.noClip = false; + } + + public void renderParticle(Tessellator var1, float var2, float var3, float var4, float var5, float var6, float var7) { + float var8 = ((float)this.particleAge + var2) / (float)this.particleMaxAge * 32.0F; + if(var8 < 0.0F) { + var8 = 0.0F; + } + + if(var8 > 1.0F) { + var8 = 1.0F; + } + + this.particleScale = this.field_671_a * var8; + super.renderParticle(var1, var2, var3, var4, var5, var6, var7); + } + + public void onUpdate() { + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + if(this.particleAge++ >= this.particleMaxAge) { + this.setEntityDead(); + } + + this.particleTextureIndex = 7 - this.particleAge * 8 / this.particleMaxAge; + this.motionY += 0.004D; + this.moveEntity(this.motionX, this.motionY, this.motionZ); + if(this.posY == this.prevPosY) { + this.motionX *= 1.1D; + this.motionZ *= 1.1D; + } + + this.motionX *= (double)0.96F; + this.motionY *= (double)0.96F; + this.motionZ *= (double)0.96F; + if(this.onGround) { + this.motionX *= (double)0.7F; + this.motionZ *= (double)0.7F; + } + + } +} diff --git a/src/net/minecraft/src/EntitySnowShovelFX.java b/src/net/minecraft/src/EntitySnowShovelFX.java new file mode 100644 index 0000000..1dd47ca --- /dev/null +++ b/src/net/minecraft/src/EntitySnowShovelFX.java @@ -0,0 +1,61 @@ +package net.minecraft.src; + +public class EntitySnowShovelFX extends EntityFX { + float field_27017_a; + + public EntitySnowShovelFX(World var1, double var2, double var4, double var6, double var8, double var10, double var12) { + this(var1, var2, var4, var6, var8, var10, var12, 1.0F); + } + + public EntitySnowShovelFX(World var1, double var2, double var4, double var6, double var8, double var10, double var12, float var14) { + super(var1, var2, var4, var6, var8, var10, var12); + this.motionX *= (double)0.1F; + this.motionY *= (double)0.1F; + this.motionZ *= (double)0.1F; + this.motionX += var8; + this.motionY += var10; + this.motionZ += var12; + this.particleRed = this.particleGreen = this.particleBlue = 1.0F - (float)(Math.random() * (double)0.3F); + this.particleScale *= 12.0F / 16.0F; + this.particleScale *= var14; + this.field_27017_a = this.particleScale; + this.particleMaxAge = (int)(8.0D / (Math.random() * 0.8D + 0.2D)); + this.particleMaxAge = (int)((float)this.particleMaxAge * var14); + this.noClip = false; + } + + public void renderParticle(Tessellator var1, float var2, float var3, float var4, float var5, float var6, float var7) { + float var8 = ((float)this.particleAge + var2) / (float)this.particleMaxAge * 32.0F; + if(var8 < 0.0F) { + var8 = 0.0F; + } + + if(var8 > 1.0F) { + var8 = 1.0F; + } + + this.particleScale = this.field_27017_a * var8; + super.renderParticle(var1, var2, var3, var4, var5, var6, var7); + } + + public void onUpdate() { + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + if(this.particleAge++ >= this.particleMaxAge) { + this.setEntityDead(); + } + + this.particleTextureIndex = 7 - this.particleAge * 8 / this.particleMaxAge; + this.motionY -= 0.03D; + this.moveEntity(this.motionX, this.motionY, this.motionZ); + this.motionX *= (double)0.99F; + this.motionY *= (double)0.99F; + this.motionZ *= (double)0.99F; + if(this.onGround) { + this.motionX *= (double)0.7F; + this.motionZ *= (double)0.7F; + } + + } +} diff --git a/src/net/minecraft/src/EntitySnowball.java b/src/net/minecraft/src/EntitySnowball.java new file mode 100644 index 0000000..df41826 --- /dev/null +++ b/src/net/minecraft/src/EntitySnowball.java @@ -0,0 +1,234 @@ +package net.minecraft.src; + +import java.util.List; + +public class EntitySnowball extends Entity { + private int xTileSnowball = -1; + private int yTileSnowball = -1; + private int zTileSnowball = -1; + private int inTileSnowball = 0; + private boolean inGroundSnowball = false; + public int shakeSnowball = 0; + private EntityLiving thrower; + private int ticksInGroundSnowball; + private int ticksInAirSnowball = 0; + + public EntitySnowball(World var1) { + super(var1); + this.setSize(0.25F, 0.25F); + } + + protected void entityInit() { + } + + public boolean isInRangeToRenderDist(double var1) { + double var3 = this.boundingBox.getAverageEdgeLength() * 4.0D; + var3 *= 64.0D; + return var1 < var3 * var3; + } + + public EntitySnowball(World var1, EntityLiving var2) { + super(var1); + this.thrower = var2; + this.setSize(0.25F, 0.25F); + this.setLocationAndAngles(var2.posX, var2.posY + (double)var2.getEyeHeight(), var2.posZ, var2.rotationYaw, var2.rotationPitch); + this.posX -= (double)(MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * 0.16F); + this.posY -= (double)0.1F; + this.posZ -= (double)(MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * 0.16F); + this.setPosition(this.posX, this.posY, this.posZ); + this.yOffset = 0.0F; + float var3 = 0.4F; + this.motionX = (double)(-MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI) * var3); + this.motionZ = (double)(MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI) * var3); + this.motionY = (double)(-MathHelper.sin(this.rotationPitch / 180.0F * (float)Math.PI) * var3); + this.setSnowballHeading(this.motionX, this.motionY, this.motionZ, 1.5F, 1.0F); + } + + public EntitySnowball(World var1, double var2, double var4, double var6) { + super(var1); + this.ticksInGroundSnowball = 0; + this.setSize(0.25F, 0.25F); + this.setPosition(var2, var4, var6); + this.yOffset = 0.0F; + } + + public void setSnowballHeading(double var1, double var3, double var5, float var7, float var8) { + float var9 = MathHelper.sqrt_double(var1 * var1 + var3 * var3 + var5 * var5); + var1 /= (double)var9; + var3 /= (double)var9; + var5 /= (double)var9; + var1 += this.rand.nextGaussian() * (double)0.0075F * (double)var8; + var3 += this.rand.nextGaussian() * (double)0.0075F * (double)var8; + var5 += this.rand.nextGaussian() * (double)0.0075F * (double)var8; + var1 *= (double)var7; + var3 *= (double)var7; + var5 *= (double)var7; + this.motionX = var1; + this.motionY = var3; + this.motionZ = var5; + float var10 = MathHelper.sqrt_double(var1 * var1 + var5 * var5); + this.prevRotationYaw = this.rotationYaw = (float)(Math.atan2(var1, var5) * 180.0D / (double)((float)Math.PI)); + this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(var3, (double)var10) * 180.0D / (double)((float)Math.PI)); + this.ticksInGroundSnowball = 0; + } + + public void setVelocity(double var1, double var3, double var5) { + this.motionX = var1; + this.motionY = var3; + this.motionZ = var5; + if(this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F) { + float var7 = MathHelper.sqrt_double(var1 * var1 + var5 * var5); + this.prevRotationYaw = this.rotationYaw = (float)(Math.atan2(var1, var5) * 180.0D / (double)((float)Math.PI)); + this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(var3, (double)var7) * 180.0D / (double)((float)Math.PI)); + } + + } + + public void onUpdate() { + this.lastTickPosX = this.posX; + this.lastTickPosY = this.posY; + this.lastTickPosZ = this.posZ; + super.onUpdate(); + if(this.shakeSnowball > 0) { + --this.shakeSnowball; + } + + if(this.inGroundSnowball) { + int var1 = this.worldObj.getBlockId(this.xTileSnowball, this.yTileSnowball, this.zTileSnowball); + if(var1 == this.inTileSnowball) { + ++this.ticksInGroundSnowball; + if(this.ticksInGroundSnowball == 1200) { + this.setEntityDead(); + } + + return; + } + + this.inGroundSnowball = false; + this.motionX *= (double)(this.rand.nextFloat() * 0.2F); + this.motionY *= (double)(this.rand.nextFloat() * 0.2F); + this.motionZ *= (double)(this.rand.nextFloat() * 0.2F); + this.ticksInGroundSnowball = 0; + this.ticksInAirSnowball = 0; + } else { + ++this.ticksInAirSnowball; + } + + Vec3D var15 = Vec3D.createVector(this.posX, this.posY, this.posZ); + Vec3D var2 = Vec3D.createVector(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); + MovingObjectPosition var3 = this.worldObj.rayTraceBlocks(var15, var2); + var15 = Vec3D.createVector(this.posX, this.posY, this.posZ); + var2 = Vec3D.createVector(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); + if(var3 != null) { + var2 = Vec3D.createVector(var3.hitVec.xCoord, var3.hitVec.yCoord, var3.hitVec.zCoord); + } + + if(!this.worldObj.multiplayerWorld) { + Entity var4 = null; + List var5 = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D)); + double var6 = 0.0D; + + for(int var8 = 0; var8 < var5.size(); ++var8) { + Entity var9 = (Entity)var5.get(var8); + if(var9.canBeCollidedWith() && (var9 != this.thrower || this.ticksInAirSnowball >= 5)) { + float var10 = 0.3F; + AxisAlignedBB var11 = var9.boundingBox.expand((double)var10, (double)var10, (double)var10); + MovingObjectPosition var12 = var11.func_1169_a(var15, var2); + if(var12 != null) { + double var13 = var15.distanceTo(var12.hitVec); + if(var13 < var6 || var6 == 0.0D) { + var4 = var9; + var6 = var13; + } + } + } + } + + if(var4 != null) { + var3 = new MovingObjectPosition(var4); + } + } + + if(var3 != null) { + if(var3.entityHit != null && var3.entityHit.attackEntityFrom(this.thrower, 0)) { + } + + for(int var16 = 0; var16 < 8; ++var16) { + this.worldObj.spawnParticle("snowballpoof", this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D); + } + + this.setEntityDead(); + } + + this.posX += this.motionX; + this.posY += this.motionY; + this.posZ += this.motionZ; + float var17 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); + this.rotationYaw = (float)(Math.atan2(this.motionX, this.motionZ) * 180.0D / (double)((float)Math.PI)); + + for(this.rotationPitch = (float)(Math.atan2(this.motionY, (double)var17) * 180.0D / (double)((float)Math.PI)); this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F) { + } + + while(this.rotationPitch - this.prevRotationPitch >= 180.0F) { + this.prevRotationPitch += 360.0F; + } + + while(this.rotationYaw - this.prevRotationYaw < -180.0F) { + this.prevRotationYaw -= 360.0F; + } + + while(this.rotationYaw - this.prevRotationYaw >= 180.0F) { + this.prevRotationYaw += 360.0F; + } + + this.rotationPitch = this.prevRotationPitch + (this.rotationPitch - this.prevRotationPitch) * 0.2F; + this.rotationYaw = this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * 0.2F; + float var18 = 0.99F; + float var19 = 0.03F; + if(this.isInWater()) { + for(int var7 = 0; var7 < 4; ++var7) { + float var20 = 0.25F; + this.worldObj.spawnParticle("bubble", this.posX - this.motionX * (double)var20, this.posY - this.motionY * (double)var20, this.posZ - this.motionZ * (double)var20, this.motionX, this.motionY, this.motionZ); + } + + var18 = 0.8F; + } + + this.motionX *= (double)var18; + this.motionY *= (double)var18; + this.motionZ *= (double)var18; + this.motionY -= (double)var19; + this.setPosition(this.posX, this.posY, this.posZ); + } + + public void writeEntityToNBT(NBTTagCompound var1) { + var1.setShort("xTile", (short)this.xTileSnowball); + var1.setShort("yTile", (short)this.yTileSnowball); + var1.setShort("zTile", (short)this.zTileSnowball); + var1.setByte("inTile", (byte)this.inTileSnowball); + var1.setByte("shake", (byte)this.shakeSnowball); + var1.setByte("inGround", (byte)(this.inGroundSnowball ? 1 : 0)); + } + + public void readEntityFromNBT(NBTTagCompound var1) { + this.xTileSnowball = var1.getShort("xTile"); + this.yTileSnowball = var1.getShort("yTile"); + this.zTileSnowball = var1.getShort("zTile"); + this.inTileSnowball = var1.getByte("inTile") & 255; + this.shakeSnowball = var1.getByte("shake") & 255; + this.inGroundSnowball = var1.getByte("inGround") == 1; + } + + public void onCollideWithPlayer(EntityPlayer var1) { + if(this.inGroundSnowball && this.thrower == var1 && this.shakeSnowball <= 0 && var1.inventory.addItemStackToInventory(new ItemStack(Item.arrow, 1))) { + this.worldObj.playSoundAtEntity(this, "random.pop", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); + var1.onItemPickup(this, 1); + this.setEntityDead(); + } + + } + + public float getShadowSize() { + return 0.0F; + } +} diff --git a/src/net/minecraft/src/EntitySorter.java b/src/net/minecraft/src/EntitySorter.java new file mode 100644 index 0000000..75a0025 --- /dev/null +++ b/src/net/minecraft/src/EntitySorter.java @@ -0,0 +1,29 @@ +package net.minecraft.src; + +import java.util.Comparator; + +public class EntitySorter implements Comparator { + private double field_30008_a; + private double field_30007_b; + private double field_30009_c; + + public EntitySorter(Entity var1) { + this.field_30008_a = -var1.posX; + this.field_30007_b = -var1.posY; + this.field_30009_c = -var1.posZ; + } + + public int sortByDistanceToEntity(WorldRenderer var1, WorldRenderer var2) { + double var3 = (double)var1.posXPlus + this.field_30008_a; + double var5 = (double)var1.posYPlus + this.field_30007_b; + double var7 = (double)var1.posZPlus + this.field_30009_c; + double var9 = (double)var2.posXPlus + this.field_30008_a; + double var11 = (double)var2.posYPlus + this.field_30007_b; + double var13 = (double)var2.posZPlus + this.field_30009_c; + return (int)((var3 * var3 + var5 * var5 + var7 * var7 - (var9 * var9 + var11 * var11 + var13 * var13)) * 1024.0D); + } + + public int compare(Object var1, Object var2) { + return this.sortByDistanceToEntity((WorldRenderer)var1, (WorldRenderer)var2); + } +} diff --git a/src/net/minecraft/src/EntitySpider.java b/src/net/minecraft/src/EntitySpider.java new file mode 100644 index 0000000..0571731 --- /dev/null +++ b/src/net/minecraft/src/EntitySpider.java @@ -0,0 +1,77 @@ +package net.minecraft.src; + +public class EntitySpider extends EntityMob { + public EntitySpider(World var1) { + super(var1); + this.texture = "/mob/spider.png"; + this.setSize(1.4F, 0.9F); + this.moveSpeed = 0.8F; + } + + public double getMountedYOffset() { + return (double)this.height * 0.75D - 0.5D; + } + + protected boolean canTriggerWalking() { + return false; + } + + protected Entity findPlayerToAttack() { + float var1 = this.getEntityBrightness(1.0F); + if(var1 < 0.5F) { + double var2 = 16.0D; + return this.worldObj.getClosestPlayerToEntity(this, var2); + } else { + return null; + } + } + + protected String getLivingSound() { + return "mob.spider"; + } + + protected String getHurtSound() { + return "mob.spider"; + } + + protected String getDeathSound() { + return "mob.spiderdeath"; + } + + protected void attackEntity(Entity var1, float var2) { + float var3 = this.getEntityBrightness(1.0F); + if(var3 > 0.5F && this.rand.nextInt(100) == 0) { + this.playerToAttack = null; + } else { + if(var2 > 2.0F && var2 < 6.0F && this.rand.nextInt(10) == 0) { + if(this.onGround) { + double var4 = var1.posX - this.posX; + double var6 = var1.posZ - this.posZ; + float var8 = MathHelper.sqrt_double(var4 * var4 + var6 * var6); + this.motionX = var4 / (double)var8 * 0.5D * (double)0.8F + this.motionX * (double)0.2F; + this.motionZ = var6 / (double)var8 * 0.5D * (double)0.8F + this.motionZ * (double)0.2F; + this.motionY = (double)0.4F; + } + } else { + super.attackEntity(var1, var2); + } + + } + } + + public void writeEntityToNBT(NBTTagCompound var1) { + super.writeEntityToNBT(var1); + } + + public void readEntityFromNBT(NBTTagCompound var1) { + super.readEntityFromNBT(var1); + } + + protected int getDropItemId() { + return Item.silk.shiftedIndex; + } + + public boolean isOnLadder() { + return this.isCollidedHorizontally; + } +} diff --git a/src/net/minecraft/src/EntitySplashFX.java b/src/net/minecraft/src/EntitySplashFX.java new file mode 100644 index 0000000..d91fb22 --- /dev/null +++ b/src/net/minecraft/src/EntitySplashFX.java @@ -0,0 +1,15 @@ +package net.minecraft.src; + +public class EntitySplashFX extends EntityRainFX { + public EntitySplashFX(World var1, double var2, double var4, double var6, double var8, double var10, double var12) { + super(var1, var2, var4, var6); + this.particleGravity = 0.04F; + ++this.particleTextureIndex; + if(var10 == 0.0D && (var8 != 0.0D || var12 != 0.0D)) { + this.motionX = var8; + this.motionY = var10 + 0.1D; + this.motionZ = var12; + } + + } +} diff --git a/src/net/minecraft/src/EntitySquid.java b/src/net/minecraft/src/EntitySquid.java new file mode 100644 index 0000000..70e5fc0 --- /dev/null +++ b/src/net/minecraft/src/EntitySquid.java @@ -0,0 +1,141 @@ +package net.minecraft.src; + +public class EntitySquid extends EntityWaterMob { + public float field_21089_a = 0.0F; + public float field_21088_b = 0.0F; + public float field_21087_c = 0.0F; + public float field_21086_f = 0.0F; + public float field_21085_g = 0.0F; + public float field_21084_h = 0.0F; + public float field_21083_i = 0.0F; + public float field_21082_j = 0.0F; + private float randomMotionSpeed = 0.0F; + private float field_21080_l = 0.0F; + private float field_21079_m = 0.0F; + private float randomMotionVecX = 0.0F; + private float randomMotionVecY = 0.0F; + private float randomMotionVecZ = 0.0F; + + public EntitySquid(World var1) { + super(var1); + this.texture = "/mob/squid.png"; + this.setSize(0.95F, 0.95F); + this.field_21080_l = 1.0F / (this.rand.nextFloat() + 1.0F) * 0.2F; + } + + public void writeEntityToNBT(NBTTagCompound var1) { + super.writeEntityToNBT(var1); + } + + public void readEntityFromNBT(NBTTagCompound var1) { + super.readEntityFromNBT(var1); + } + + protected String getLivingSound() { + return null; + } + + protected String getHurtSound() { + return null; + } + + protected String getDeathSound() { + return null; + } + + protected float getSoundVolume() { + return 0.4F; + } + + protected int getDropItemId() { + return 0; + } + + protected void dropFewItems() { + int var1 = this.rand.nextInt(3) + 1; + + for(int var2 = 0; var2 < var1; ++var2) { + this.entityDropItem(new ItemStack(Item.dyePowder, 1, 0), 0.0F); + } + + } + + public boolean interact(EntityPlayer var1) { + return false; + } + + public boolean isInWater() { + return this.worldObj.handleMaterialAcceleration(this.boundingBox.expand(0.0D, (double)-0.6F, 0.0D), Material.water, this); + } + + public void onLivingUpdate() { + super.onLivingUpdate(); + this.field_21088_b = this.field_21089_a; + this.field_21086_f = this.field_21087_c; + this.field_21084_h = this.field_21085_g; + this.field_21082_j = this.field_21083_i; + this.field_21085_g += this.field_21080_l; + if(this.field_21085_g > (float)Math.PI * 2.0F) { + this.field_21085_g -= (float)Math.PI * 2.0F; + if(this.rand.nextInt(10) == 0) { + this.field_21080_l = 1.0F / (this.rand.nextFloat() + 1.0F) * 0.2F; + } + } + + if(this.isInWater()) { + float var1; + if(this.field_21085_g < (float)Math.PI) { + var1 = this.field_21085_g / (float)Math.PI; + this.field_21083_i = MathHelper.sin(var1 * var1 * (float)Math.PI) * (float)Math.PI * 0.25F; + if((double)var1 > 0.75D) { + this.randomMotionSpeed = 1.0F; + this.field_21079_m = 1.0F; + } else { + this.field_21079_m *= 0.8F; + } + } else { + this.field_21083_i = 0.0F; + this.randomMotionSpeed *= 0.9F; + this.field_21079_m *= 0.99F; + } + + if(!this.isMultiplayerEntity) { + this.motionX = (double)(this.randomMotionVecX * this.randomMotionSpeed); + this.motionY = (double)(this.randomMotionVecY * this.randomMotionSpeed); + this.motionZ = (double)(this.randomMotionVecZ * this.randomMotionSpeed); + } + + var1 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); + this.renderYawOffset += (-((float)Math.atan2(this.motionX, this.motionZ)) * 180.0F / (float)Math.PI - this.renderYawOffset) * 0.1F; + this.rotationYaw = this.renderYawOffset; + this.field_21087_c += (float)Math.PI * this.field_21079_m * 1.5F; + this.field_21089_a += (-((float)Math.atan2((double)var1, this.motionY)) * 180.0F / (float)Math.PI - this.field_21089_a) * 0.1F; + } else { + this.field_21083_i = MathHelper.abs(MathHelper.sin(this.field_21085_g)) * (float)Math.PI * 0.25F; + if(!this.isMultiplayerEntity) { + this.motionX = 0.0D; + this.motionY -= 0.08D; + this.motionY *= (double)0.98F; + this.motionZ = 0.0D; + } + + this.field_21089_a = (float)((double)this.field_21089_a + (double)(-90.0F - this.field_21089_a) * 0.02D); + } + + } + + public void moveEntityWithHeading(float var1, float var2) { + this.moveEntity(this.motionX, this.motionY, this.motionZ); + } + + protected void updatePlayerActionState() { + if(this.rand.nextInt(50) == 0 || !this.inWater || this.randomMotionVecX == 0.0F && this.randomMotionVecY == 0.0F && this.randomMotionVecZ == 0.0F) { + float var1 = this.rand.nextFloat() * (float)Math.PI * 2.0F; + this.randomMotionVecX = MathHelper.cos(var1) * 0.2F; + this.randomMotionVecY = -0.1F + this.rand.nextFloat() * 0.2F; + this.randomMotionVecZ = MathHelper.sin(var1) * 0.2F; + } + + this.func_27021_X(); + } +} diff --git a/src/net/minecraft/src/EntityTNTPrimed.java b/src/net/minecraft/src/EntityTNTPrimed.java new file mode 100644 index 0000000..aeff89b --- /dev/null +++ b/src/net/minecraft/src/EntityTNTPrimed.java @@ -0,0 +1,82 @@ +package net.minecraft.src; + +public class EntityTNTPrimed extends Entity { + public int fuse; + + public EntityTNTPrimed(World var1) { + super(var1); + this.fuse = 0; + this.preventEntitySpawning = true; + this.setSize(0.98F, 0.98F); + this.yOffset = this.height / 2.0F; + } + + public EntityTNTPrimed(World var1, double var2, double var4, double var6) { + this(var1); + this.setPosition(var2, var4, var6); + float var8 = (float)(Math.random() * (double)((float)Math.PI) * 2.0D); + this.motionX = (double)(-MathHelper.sin(var8 * (float)Math.PI / 180.0F) * 0.02F); + this.motionY = (double)0.2F; + this.motionZ = (double)(-MathHelper.cos(var8 * (float)Math.PI / 180.0F) * 0.02F); + this.fuse = 80; + this.prevPosX = var2; + this.prevPosY = var4; + this.prevPosZ = var6; + } + + protected void entityInit() { + } + + protected boolean canTriggerWalking() { + return false; + } + + public boolean canBeCollidedWith() { + return !this.isDead; + } + + public void onUpdate() { + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + this.motionY -= (double)0.04F; + this.moveEntity(this.motionX, this.motionY, this.motionZ); + this.motionX *= (double)0.98F; + this.motionY *= (double)0.98F; + this.motionZ *= (double)0.98F; + if(this.onGround) { + this.motionX *= (double)0.7F; + this.motionZ *= (double)0.7F; + this.motionY *= -0.5D; + } + + if(this.fuse-- <= 0) { + if(!this.worldObj.multiplayerWorld) { + this.setEntityDead(); + this.explode(); + } else { + this.setEntityDead(); + } + } else { + this.worldObj.spawnParticle("smoke", this.posX, this.posY + 0.5D, this.posZ, 0.0D, 0.0D, 0.0D); + } + + } + + private void explode() { + float var1 = 4.0F; + this.worldObj.createExplosion((Entity)null, this.posX, this.posY, this.posZ, var1); + } + + protected void writeEntityToNBT(NBTTagCompound var1) { + var1.setByte("Fuse", (byte)this.fuse); + } + + protected void readEntityFromNBT(NBTTagCompound var1) { + this.fuse = var1.getByte("Fuse"); + } + + public float getShadowSize() { + return 0.0F; + } +} diff --git a/src/net/minecraft/src/EntityWaterMob.java b/src/net/minecraft/src/EntityWaterMob.java new file mode 100644 index 0000000..7a08d8c --- /dev/null +++ b/src/net/minecraft/src/EntityWaterMob.java @@ -0,0 +1,27 @@ +package net.minecraft.src; + +public class EntityWaterMob extends EntityCreature { + public EntityWaterMob(World var1) { + super(var1); + } + + public boolean canBreatheUnderwater() { + return true; + } + + public void writeEntityToNBT(NBTTagCompound var1) { + super.writeEntityToNBT(var1); + } + + public void readEntityFromNBT(NBTTagCompound var1) { + super.readEntityFromNBT(var1); + } + + public boolean getCanSpawnHere() { + return this.worldObj.checkIfAABBIsClear(this.boundingBox); + } + + public int getTalkInterval() { + return 120; + } +} diff --git a/src/net/minecraft/src/EntityWeatherEffect.java b/src/net/minecraft/src/EntityWeatherEffect.java new file mode 100644 index 0000000..1d9c5b4 --- /dev/null +++ b/src/net/minecraft/src/EntityWeatherEffect.java @@ -0,0 +1,7 @@ +package net.minecraft.src; + +public abstract class EntityWeatherEffect extends Entity { + public EntityWeatherEffect(World var1) { + super(var1); + } +} diff --git a/src/net/minecraft/src/EntityWolf.java b/src/net/minecraft/src/EntityWolf.java new file mode 100644 index 0000000..664438e --- /dev/null +++ b/src/net/minecraft/src/EntityWolf.java @@ -0,0 +1,457 @@ +package net.minecraft.src; + +import java.util.Iterator; +import java.util.List; + +public class EntityWolf extends EntityAnimal { + private boolean looksWithInterest = false; + private float field_25048_b; + private float field_25054_c; + private boolean isWolfShaking; + private boolean field_25052_g; + private float timeWolfIsShaking; + private float prevTimeWolfIsShaking; + + public EntityWolf(World var1) { + super(var1); + this.texture = "/mob/wolf.png"; + this.setSize(0.8F, 0.8F); + this.moveSpeed = 1.1F; + this.health = 8; + } + + protected void entityInit() { + super.entityInit(); + this.dataWatcher.addObject(16, Byte.valueOf((byte)0)); + this.dataWatcher.addObject(17, ""); + this.dataWatcher.addObject(18, new Integer(this.health)); + } + + protected boolean canTriggerWalking() { + return false; + } + + public String getEntityTexture() { + return this.isWolfTamed() ? "/mob/wolf_tame.png" : (this.isWolfAngry() ? "/mob/wolf_angry.png" : super.getEntityTexture()); + } + + public void writeEntityToNBT(NBTTagCompound var1) { + super.writeEntityToNBT(var1); + var1.setBoolean("Angry", this.isWolfAngry()); + var1.setBoolean("Sitting", this.isWolfSitting()); + if(this.getWolfOwner() == null) { + var1.setString("Owner", ""); + } else { + var1.setString("Owner", this.getWolfOwner()); + } + + } + + public void readEntityFromNBT(NBTTagCompound var1) { + super.readEntityFromNBT(var1); + this.setWolfAngry(var1.getBoolean("Angry")); + this.setWolfSitting(var1.getBoolean("Sitting")); + String var2 = var1.getString("Owner"); + if(var2.length() > 0) { + this.setWolfOwner(var2); + this.setWolfTamed(true); + } + + } + + protected boolean canDespawn() { + return !this.isWolfTamed(); + } + + protected String getLivingSound() { + return this.isWolfAngry() ? "mob.wolf.growl" : (this.rand.nextInt(3) == 0 ? (this.isWolfTamed() && this.dataWatcher.getWatchableObjectInt(18) < 10 ? "mob.wolf.whine" : "mob.wolf.panting") : "mob.wolf.bark"); + } + + protected String getHurtSound() { + return "mob.wolf.hurt"; + } + + protected String getDeathSound() { + return "mob.wolf.death"; + } + + protected float getSoundVolume() { + return 0.4F; + } + + protected int getDropItemId() { + return -1; + } + + protected void updatePlayerActionState() { + super.updatePlayerActionState(); + if(!this.hasAttacked && !this.hasPath() && this.isWolfTamed() && this.ridingEntity == null) { + EntityPlayer var3 = this.worldObj.getPlayerEntityByName(this.getWolfOwner()); + if(var3 != null) { + float var2 = var3.getDistanceToEntity(this); + if(var2 > 5.0F) { + this.getPathOrWalkableBlock(var3, var2); + } + } else if(!this.isInWater()) { + this.setWolfSitting(true); + } + } else if(this.playerToAttack == null && !this.hasPath() && !this.isWolfTamed() && this.worldObj.rand.nextInt(100) == 0) { + List var1 = this.worldObj.getEntitiesWithinAABB(EntitySheep.class, AxisAlignedBB.getBoundingBoxFromPool(this.posX, this.posY, this.posZ, this.posX + 1.0D, this.posY + 1.0D, this.posZ + 1.0D).expand(16.0D, 4.0D, 16.0D)); + if(!var1.isEmpty()) { + this.setTarget((Entity)var1.get(this.worldObj.rand.nextInt(var1.size()))); + } + } + + if(this.isInWater()) { + this.setWolfSitting(false); + } + + if(!this.worldObj.multiplayerWorld) { + this.dataWatcher.updateObject(18, Integer.valueOf(this.health)); + } + + } + + public void onLivingUpdate() { + super.onLivingUpdate(); + this.looksWithInterest = false; + if(this.hasCurrentTarget() && !this.hasPath() && !this.isWolfAngry()) { + Entity var1 = this.getCurrentTarget(); + if(var1 instanceof EntityPlayer) { + EntityPlayer var2 = (EntityPlayer)var1; + ItemStack var3 = var2.inventory.getCurrentItem(); + if(var3 != null) { + if(!this.isWolfTamed() && var3.itemID == Item.bone.shiftedIndex) { + this.looksWithInterest = true; + } else if(this.isWolfTamed() && Item.itemsList[var3.itemID] instanceof ItemFood) { + this.looksWithInterest = ((ItemFood)Item.itemsList[var3.itemID]).getIsWolfsFavoriteMeat(); + } + } + } + } + + if(!this.isMultiplayerEntity && this.isWolfShaking && !this.field_25052_g && !this.hasPath() && this.onGround) { + this.field_25052_g = true; + this.timeWolfIsShaking = 0.0F; + this.prevTimeWolfIsShaking = 0.0F; + this.worldObj.func_9425_a(this, (byte)8); + } + + } + + public void onUpdate() { + super.onUpdate(); + this.field_25054_c = this.field_25048_b; + if(this.looksWithInterest) { + this.field_25048_b += (1.0F - this.field_25048_b) * 0.4F; + } else { + this.field_25048_b += (0.0F - this.field_25048_b) * 0.4F; + } + + if(this.looksWithInterest) { + this.numTicksToChaseTarget = 10; + } + + if(this.isWet()) { + this.isWolfShaking = true; + this.field_25052_g = false; + this.timeWolfIsShaking = 0.0F; + this.prevTimeWolfIsShaking = 0.0F; + } else if((this.isWolfShaking || this.field_25052_g) && this.field_25052_g) { + if(this.timeWolfIsShaking == 0.0F) { + this.worldObj.playSoundAtEntity(this, "mob.wolf.shake", this.getSoundVolume(), (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F); + } + + this.prevTimeWolfIsShaking = this.timeWolfIsShaking; + this.timeWolfIsShaking += 0.05F; + if(this.prevTimeWolfIsShaking >= 2.0F) { + this.isWolfShaking = false; + this.field_25052_g = false; + this.prevTimeWolfIsShaking = 0.0F; + this.timeWolfIsShaking = 0.0F; + } + + if(this.timeWolfIsShaking > 0.4F) { + float var1 = (float)this.boundingBox.minY; + int var2 = (int)(MathHelper.sin((this.timeWolfIsShaking - 0.4F) * (float)Math.PI) * 7.0F); + + for(int var3 = 0; var3 < var2; ++var3) { + float var4 = (this.rand.nextFloat() * 2.0F - 1.0F) * this.width * 0.5F; + float var5 = (this.rand.nextFloat() * 2.0F - 1.0F) * this.width * 0.5F; + this.worldObj.spawnParticle("splash", this.posX + (double)var4, (double)(var1 + 0.8F), this.posZ + (double)var5, this.motionX, this.motionY, this.motionZ); + } + } + } + + } + + public boolean getWolfShaking() { + return this.isWolfShaking; + } + + public float getShadingWhileShaking(float var1) { + return 12.0F / 16.0F + (this.prevTimeWolfIsShaking + (this.timeWolfIsShaking - this.prevTimeWolfIsShaking) * var1) / 2.0F * 0.25F; + } + + public float getShakeAngle(float var1, float var2) { + float var3 = (this.prevTimeWolfIsShaking + (this.timeWolfIsShaking - this.prevTimeWolfIsShaking) * var1 + var2) / 1.8F; + if(var3 < 0.0F) { + var3 = 0.0F; + } else if(var3 > 1.0F) { + var3 = 1.0F; + } + + return MathHelper.sin(var3 * (float)Math.PI) * MathHelper.sin(var3 * (float)Math.PI * 11.0F) * 0.15F * (float)Math.PI; + } + + public float getInterestedAngle(float var1) { + return (this.field_25054_c + (this.field_25048_b - this.field_25054_c) * var1) * 0.15F * (float)Math.PI; + } + + public float getEyeHeight() { + return this.height * 0.8F; + } + + protected int func_25026_x() { + return this.isWolfSitting() ? 20 : super.func_25026_x(); + } + + private void getPathOrWalkableBlock(Entity var1, float var2) { + PathEntity var3 = this.worldObj.getPathToEntity(this, var1, 16.0F); + if(var3 == null && var2 > 12.0F) { + int var4 = MathHelper.floor_double(var1.posX) - 2; + int var5 = MathHelper.floor_double(var1.posZ) - 2; + int var6 = MathHelper.floor_double(var1.boundingBox.minY); + + for(int var7 = 0; var7 <= 4; ++var7) { + for(int var8 = 0; var8 <= 4; ++var8) { + if((var7 < 1 || var8 < 1 || var7 > 3 || var8 > 3) && this.worldObj.isBlockNormalCube(var4 + var7, var6 - 1, var5 + var8) && !this.worldObj.isBlockNormalCube(var4 + var7, var6, var5 + var8) && !this.worldObj.isBlockNormalCube(var4 + var7, var6 + 1, var5 + var8)) { + this.setLocationAndAngles((double)((float)(var4 + var7) + 0.5F), (double)var6, (double)((float)(var5 + var8) + 0.5F), this.rotationYaw, this.rotationPitch); + return; + } + } + } + } else { + this.setPathToEntity(var3); + } + + } + + protected boolean isMovementCeased() { + return this.isWolfSitting() || this.field_25052_g; + } + + public boolean attackEntityFrom(Entity var1, int var2) { + this.setWolfSitting(false); + if(var1 != null && !(var1 instanceof EntityPlayer) && !(var1 instanceof EntityArrow)) { + var2 = (var2 + 1) / 2; + } + + if(!super.attackEntityFrom((Entity)var1, var2)) { + return false; + } else { + if(!this.isWolfTamed() && !this.isWolfAngry()) { + if(var1 instanceof EntityPlayer) { + this.setWolfAngry(true); + this.playerToAttack = (Entity)var1; + } + + if(var1 instanceof EntityArrow && ((EntityArrow)var1).owner != null) { + var1 = ((EntityArrow)var1).owner; + } + + if(var1 instanceof EntityLiving) { + List var3 = this.worldObj.getEntitiesWithinAABB(EntityWolf.class, AxisAlignedBB.getBoundingBoxFromPool(this.posX, this.posY, this.posZ, this.posX + 1.0D, this.posY + 1.0D, this.posZ + 1.0D).expand(16.0D, 4.0D, 16.0D)); + Iterator var4 = var3.iterator(); + + while(var4.hasNext()) { + Entity var5 = (Entity)var4.next(); + EntityWolf var6 = (EntityWolf)var5; + if(!var6.isWolfTamed() && var6.playerToAttack == null) { + var6.playerToAttack = (Entity)var1; + if(var1 instanceof EntityPlayer) { + var6.setWolfAngry(true); + } + } + } + } + } else if(var1 != this && var1 != null) { + if(this.isWolfTamed() && var1 instanceof EntityPlayer && ((EntityPlayer)var1).username.equalsIgnoreCase(this.getWolfOwner())) { + return true; + } + + this.playerToAttack = (Entity)var1; + } + + return true; + } + } + + protected Entity findPlayerToAttack() { + return this.isWolfAngry() ? this.worldObj.getClosestPlayerToEntity(this, 16.0D) : null; + } + + protected void attackEntity(Entity var1, float var2) { + if(var2 > 2.0F && var2 < 6.0F && this.rand.nextInt(10) == 0) { + if(this.onGround) { + double var8 = var1.posX - this.posX; + double var5 = var1.posZ - this.posZ; + float var7 = MathHelper.sqrt_double(var8 * var8 + var5 * var5); + this.motionX = var8 / (double)var7 * 0.5D * (double)0.8F + this.motionX * (double)0.2F; + this.motionZ = var5 / (double)var7 * 0.5D * (double)0.8F + this.motionZ * (double)0.2F; + this.motionY = (double)0.4F; + } + } else if((double)var2 < 1.5D && var1.boundingBox.maxY > this.boundingBox.minY && var1.boundingBox.minY < this.boundingBox.maxY) { + this.attackTime = 20; + byte var3 = 2; + if(this.isWolfTamed()) { + var3 = 4; + } + + var1.attackEntityFrom(this, var3); + } + + } + + public boolean interact(EntityPlayer var1) { + ItemStack var2 = var1.inventory.getCurrentItem(); + if(!this.isWolfTamed()) { + if(var2 != null && var2.itemID == Item.bone.shiftedIndex && !this.isWolfAngry()) { + --var2.stackSize; + if(var2.stackSize <= 0) { + var1.inventory.setInventorySlotContents(var1.inventory.currentItem, (ItemStack)null); + } + + if(!this.worldObj.multiplayerWorld) { + if(this.rand.nextInt(3) == 0) { + this.setWolfTamed(true); + this.setPathToEntity((PathEntity)null); + this.setWolfSitting(true); + this.health = 20; + this.setWolfOwner(var1.username); + this.showHeartsOrSmokeFX(true); + this.worldObj.func_9425_a(this, (byte)7); + } else { + this.showHeartsOrSmokeFX(false); + this.worldObj.func_9425_a(this, (byte)6); + } + } + + return true; + } + } else { + if(var2 != null && Item.itemsList[var2.itemID] instanceof ItemFood) { + ItemFood var3 = (ItemFood)Item.itemsList[var2.itemID]; + if(var3.getIsWolfsFavoriteMeat() && this.dataWatcher.getWatchableObjectInt(18) < 20) { + --var2.stackSize; + if(var2.stackSize <= 0) { + var1.inventory.setInventorySlotContents(var1.inventory.currentItem, (ItemStack)null); + } + + this.heal(((ItemFood)Item.porkRaw).getHealAmount()); + return true; + } + } + + if(var1.username.equalsIgnoreCase(this.getWolfOwner())) { + if(!this.worldObj.multiplayerWorld) { + this.setWolfSitting(!this.isWolfSitting()); + this.isJumping = false; + this.setPathToEntity((PathEntity)null); + } + + return true; + } + } + + return false; + } + + void showHeartsOrSmokeFX(boolean var1) { + String var2 = "heart"; + if(!var1) { + var2 = "smoke"; + } + + for(int var3 = 0; var3 < 7; ++var3) { + double var4 = this.rand.nextGaussian() * 0.02D; + double var6 = this.rand.nextGaussian() * 0.02D; + double var8 = this.rand.nextGaussian() * 0.02D; + this.worldObj.spawnParticle(var2, this.posX + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width, this.posY + 0.5D + (double)(this.rand.nextFloat() * this.height), this.posZ + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width, var4, var6, var8); + } + + } + + public void handleHealthUpdate(byte var1) { + if(var1 == 7) { + this.showHeartsOrSmokeFX(true); + } else if(var1 == 6) { + this.showHeartsOrSmokeFX(false); + } else if(var1 == 8) { + this.field_25052_g = true; + this.timeWolfIsShaking = 0.0F; + this.prevTimeWolfIsShaking = 0.0F; + } else { + super.handleHealthUpdate(var1); + } + + } + + public float setTailRotation() { + return this.isWolfAngry() ? (float)Math.PI * 0.49F : (this.isWolfTamed() ? (0.55F - (float)(20 - this.dataWatcher.getWatchableObjectInt(18)) * 0.02F) * (float)Math.PI : (float)Math.PI * 0.2F); + } + + public int getMaxSpawnedInChunk() { + return 8; + } + + public String getWolfOwner() { + return this.dataWatcher.getWatchableObjectString(17); + } + + public void setWolfOwner(String var1) { + this.dataWatcher.updateObject(17, var1); + } + + public boolean isWolfSitting() { + return (this.dataWatcher.getWatchableObjectByte(16) & 1) != 0; + } + + public void setWolfSitting(boolean var1) { + byte var2 = this.dataWatcher.getWatchableObjectByte(16); + if(var1) { + this.dataWatcher.updateObject(16, Byte.valueOf((byte)(var2 | 1))); + } else { + this.dataWatcher.updateObject(16, Byte.valueOf((byte)(var2 & -2))); + } + + } + + public boolean isWolfAngry() { + return (this.dataWatcher.getWatchableObjectByte(16) & 2) != 0; + } + + public void setWolfAngry(boolean var1) { + byte var2 = this.dataWatcher.getWatchableObjectByte(16); + if(var1) { + this.dataWatcher.updateObject(16, Byte.valueOf((byte)(var2 | 2))); + } else { + this.dataWatcher.updateObject(16, Byte.valueOf((byte)(var2 & -3))); + } + + } + + public boolean isWolfTamed() { + return (this.dataWatcher.getWatchableObjectByte(16) & 4) != 0; + } + + public void setWolfTamed(boolean var1) { + byte var2 = this.dataWatcher.getWatchableObjectByte(16); + if(var1) { + this.dataWatcher.updateObject(16, Byte.valueOf((byte)(var2 | 4))); + } else { + this.dataWatcher.updateObject(16, Byte.valueOf((byte)(var2 & -5))); + } + + } +} diff --git a/src/net/minecraft/src/EntityZombie.java b/src/net/minecraft/src/EntityZombie.java new file mode 100644 index 0000000..28c0d8e --- /dev/null +++ b/src/net/minecraft/src/EntityZombie.java @@ -0,0 +1,37 @@ +package net.minecraft.src; + +public class EntityZombie extends EntityMob { + public EntityZombie(World var1) { + super(var1); + this.texture = "/mob/zombie.png"; + this.moveSpeed = 0.5F; + this.attackStrength = 5; + } + + public void onLivingUpdate() { + if(this.worldObj.isDaytime()) { + float var1 = this.getEntityBrightness(1.0F); + if(var1 > 0.5F && this.worldObj.canBlockSeeTheSky(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ)) && this.rand.nextFloat() * 30.0F < (var1 - 0.4F) * 2.0F) { + this.fire = 300; + } + } + + super.onLivingUpdate(); + } + + protected String getLivingSound() { + return "mob.zombie"; + } + + protected String getHurtSound() { + return "mob.zombiehurt"; + } + + protected String getDeathSound() { + return "mob.zombiedeath"; + } + + protected int getDropItemId() { + return Item.feather.shiftedIndex; + } +} diff --git a/src/net/minecraft/src/EnumArt.java b/src/net/minecraft/src/EnumArt.java new file mode 100644 index 0000000..fc4ebc4 --- /dev/null +++ b/src/net/minecraft/src/EnumArt.java @@ -0,0 +1,44 @@ +package net.minecraft.src; + +public enum EnumArt { + Kebab("Kebab", 16, 16, 0, 0), + Aztec("Aztec", 16, 16, 16, 0), + Alban("Alban", 16, 16, 32, 0), + Aztec2("Aztec2", 16, 16, 48, 0), + Bomb("Bomb", 16, 16, 64, 0), + Plant("Plant", 16, 16, 80, 0), + Wasteland("Wasteland", 16, 16, 96, 0), + Pool("Pool", 32, 16, 0, 32), + Courbet("Courbet", 32, 16, 32, 32), + Sea("Sea", 32, 16, 64, 32), + Sunset("Sunset", 32, 16, 96, 32), + Creebet("Creebet", 32, 16, 128, 32), + Wanderer("Wanderer", 16, 32, 0, 64), + Graham("Graham", 16, 32, 16, 64), + Match("Match", 32, 32, 0, 128), + Bust("Bust", 32, 32, 32, 128), + Stage("Stage", 32, 32, 64, 128), + Void("Void", 32, 32, 96, 128), + SkullAndRoses("SkullAndRoses", 32, 32, 128, 128), + Fighters("Fighters", 64, 32, 0, 96), + Pointer("Pointer", 64, 64, 0, 192), + Pigscene("Pigscene", 64, 64, 64, 192), + BurningSkull("BurningSkull", 64, 64, 128, 192), + Skeleton("Skeleton", 64, 48, 192, 64), + DonkeyKong("DonkeyKong", 64, 48, 192, 112); + + public static final int maxArtTitleLength = "SkullAndRoses".length(); + public final String title; + public final int sizeX; + public final int sizeY; + public final int offsetX; + public final int offsetY; + + private EnumArt(String var3, int var4, int var5, int var6, int var7) { + this.title = var3; + this.sizeX = var4; + this.sizeY = var5; + this.offsetX = var6; + this.offsetY = var7; + } +} diff --git a/src/net/minecraft/src/EnumCreatureType.java b/src/net/minecraft/src/EnumCreatureType.java new file mode 100644 index 0000000..c3c6cf3 --- /dev/null +++ b/src/net/minecraft/src/EnumCreatureType.java @@ -0,0 +1,35 @@ +package net.minecraft.src; + +public enum EnumCreatureType { + monster(IMob.class, 70, Material.air, false), + creature(EntityAnimal.class, 15, Material.air, true), + waterCreature(EntityWaterMob.class, 5, Material.water, true); + + private final Class creatureClass; + private final int maxNumberOfCreature; + private final Material creatureMaterial; + private final boolean isPeacefulCreature; + + private EnumCreatureType(Class var3, int var4, Material var5, boolean var6) { + this.creatureClass = var3; + this.maxNumberOfCreature = var4; + this.creatureMaterial = var5; + this.isPeacefulCreature = var6; + } + + public Class getCreatureClass() { + return this.creatureClass; + } + + public int getMaxNumberOfCreature() { + return this.maxNumberOfCreature; + } + + public Material getCreatureMaterial() { + return this.creatureMaterial; + } + + public boolean getPeacefulCreature() { + return this.isPeacefulCreature; + } +} diff --git a/src/net/minecraft/src/EnumJsonNodeType.java b/src/net/minecraft/src/EnumJsonNodeType.java new file mode 100644 index 0000000..0be27c7 --- /dev/null +++ b/src/net/minecraft/src/EnumJsonNodeType.java @@ -0,0 +1,11 @@ +package net.minecraft.src; + +public enum EnumJsonNodeType { + OBJECT, + ARRAY, + STRING, + NUMBER, + TRUE, + FALSE, + NULL; +} diff --git a/src/net/minecraft/src/EnumJsonNodeTypeMappingHelper.java b/src/net/minecraft/src/EnumJsonNodeTypeMappingHelper.java new file mode 100644 index 0000000..501fefa --- /dev/null +++ b/src/net/minecraft/src/EnumJsonNodeTypeMappingHelper.java @@ -0,0 +1,43 @@ +package net.minecraft.src; + +class EnumJsonNodeTypeMappingHelper { + static final int[] field_27341_a = new int[EnumJsonNodeType.values().length]; + + static { + try { + field_27341_a[EnumJsonNodeType.ARRAY.ordinal()] = 1; + } catch (NoSuchFieldError var7) { + } + + try { + field_27341_a[EnumJsonNodeType.OBJECT.ordinal()] = 2; + } catch (NoSuchFieldError var6) { + } + + try { + field_27341_a[EnumJsonNodeType.STRING.ordinal()] = 3; + } catch (NoSuchFieldError var5) { + } + + try { + field_27341_a[EnumJsonNodeType.NUMBER.ordinal()] = 4; + } catch (NoSuchFieldError var4) { + } + + try { + field_27341_a[EnumJsonNodeType.FALSE.ordinal()] = 5; + } catch (NoSuchFieldError var3) { + } + + try { + field_27341_a[EnumJsonNodeType.TRUE.ordinal()] = 6; + } catch (NoSuchFieldError var2) { + } + + try { + field_27341_a[EnumJsonNodeType.NULL.ordinal()] = 7; + } catch (NoSuchFieldError var1) { + } + + } +} diff --git a/src/net/minecraft/src/EnumMobType.java b/src/net/minecraft/src/EnumMobType.java new file mode 100644 index 0000000..609fdb7 --- /dev/null +++ b/src/net/minecraft/src/EnumMobType.java @@ -0,0 +1,7 @@ +package net.minecraft.src; + +public enum EnumMobType { + everything, + mobs, + players; +} diff --git a/src/net/minecraft/src/EnumMovingObjectType.java b/src/net/minecraft/src/EnumMovingObjectType.java new file mode 100644 index 0000000..d4ce076 --- /dev/null +++ b/src/net/minecraft/src/EnumMovingObjectType.java @@ -0,0 +1,6 @@ +package net.minecraft.src; + +public enum EnumMovingObjectType { + TILE, + ENTITY; +} diff --git a/src/net/minecraft/src/EnumOS1.java b/src/net/minecraft/src/EnumOS1.java new file mode 100644 index 0000000..68d723a --- /dev/null +++ b/src/net/minecraft/src/EnumOS1.java @@ -0,0 +1,9 @@ +package net.minecraft.src; + +enum EnumOS1 { + linux, + solaris, + windows, + macos, + unknown; +} diff --git a/src/net/minecraft/src/EnumOS2.java b/src/net/minecraft/src/EnumOS2.java new file mode 100644 index 0000000..396cc34 --- /dev/null +++ b/src/net/minecraft/src/EnumOS2.java @@ -0,0 +1,9 @@ +package net.minecraft.src; + +public enum EnumOS2 { + linux, + solaris, + windows, + macos, + unknown; +} diff --git a/src/net/minecraft/src/EnumOSMappingHelper.java b/src/net/minecraft/src/EnumOSMappingHelper.java new file mode 100644 index 0000000..445d827 --- /dev/null +++ b/src/net/minecraft/src/EnumOSMappingHelper.java @@ -0,0 +1,28 @@ +package net.minecraft.src; + +public class EnumOSMappingHelper { + public static final int[] enumOSMappingArray = new int[EnumOS2.values().length]; + + static { + try { + enumOSMappingArray[EnumOS2.linux.ordinal()] = 1; + } catch (NoSuchFieldError var4) { + } + + try { + enumOSMappingArray[EnumOS2.solaris.ordinal()] = 2; + } catch (NoSuchFieldError var3) { + } + + try { + enumOSMappingArray[EnumOS2.windows.ordinal()] = 3; + } catch (NoSuchFieldError var2) { + } + + try { + enumOSMappingArray[EnumOS2.macos.ordinal()] = 4; + } catch (NoSuchFieldError var1) { + } + + } +} diff --git a/src/net/minecraft/src/EnumOptions.java b/src/net/minecraft/src/EnumOptions.java new file mode 100644 index 0000000..6bdfa57 --- /dev/null +++ b/src/net/minecraft/src/EnumOptions.java @@ -0,0 +1,57 @@ +package net.minecraft.src; + +public enum EnumOptions { + MUSIC("options.music", true, false), + SOUND("options.sound", true, false), + INVERT_MOUSE("options.invertMouse", false, true), + SENSITIVITY("options.sensitivity", true, false), + RENDER_DISTANCE("options.renderDistance", false, false), + VIEW_BOBBING("options.viewBobbing", false, true), + ANAGLYPH("options.anaglyph", false, true), + ADVANCED_OPENGL("options.advancedOpengl", false, true), + FRAMERATE_LIMIT("options.framerateLimit", false, false), + DIFFICULTY("options.difficulty", false, false), + GRAPHICS("options.graphics", false, false), + AMBIENT_OCCLUSION("options.ao", false, true), + GUI_SCALE("options.guiScale", false, false); + + private final boolean enumFloat; + private final boolean enumBoolean; + private final String enumString; + + public static EnumOptions getEnumOptions(int var0) { + EnumOptions[] var1 = values(); + int var2 = var1.length; + + for(int var3 = 0; var3 < var2; ++var3) { + EnumOptions var4 = var1[var3]; + if(var4.returnEnumOrdinal() == var0) { + return var4; + } + } + + return null; + } + + private EnumOptions(String var3, boolean var4, boolean var5) { + this.enumString = var3; + this.enumFloat = var4; + this.enumBoolean = var5; + } + + public boolean getEnumFloat() { + return this.enumFloat; + } + + public boolean getEnumBoolean() { + return this.enumBoolean; + } + + public int returnEnumOrdinal() { + return this.ordinal(); + } + + public String getEnumString() { + return this.enumString; + } +} diff --git a/src/net/minecraft/src/EnumOptionsMappingHelper.java b/src/net/minecraft/src/EnumOptionsMappingHelper.java new file mode 100644 index 0000000..92c6221 --- /dev/null +++ b/src/net/minecraft/src/EnumOptionsMappingHelper.java @@ -0,0 +1,33 @@ +package net.minecraft.src; + +class EnumOptionsMappingHelper { + static final int[] enumOptionsMappingHelperArray = new int[EnumOptions.values().length]; + + static { + try { + enumOptionsMappingHelperArray[EnumOptions.INVERT_MOUSE.ordinal()] = 1; + } catch (NoSuchFieldError var5) { + } + + try { + enumOptionsMappingHelperArray[EnumOptions.VIEW_BOBBING.ordinal()] = 2; + } catch (NoSuchFieldError var4) { + } + + try { + enumOptionsMappingHelperArray[EnumOptions.ANAGLYPH.ordinal()] = 3; + } catch (NoSuchFieldError var3) { + } + + try { + enumOptionsMappingHelperArray[EnumOptions.ADVANCED_OPENGL.ordinal()] = 4; + } catch (NoSuchFieldError var2) { + } + + try { + enumOptionsMappingHelperArray[EnumOptions.AMBIENT_OCCLUSION.ordinal()] = 5; + } catch (NoSuchFieldError var1) { + } + + } +} diff --git a/src/net/minecraft/src/EnumSkyBlock.java b/src/net/minecraft/src/EnumSkyBlock.java new file mode 100644 index 0000000..9884ce5 --- /dev/null +++ b/src/net/minecraft/src/EnumSkyBlock.java @@ -0,0 +1,12 @@ +package net.minecraft.src; + +public enum EnumSkyBlock { + Sky(15), + Block(0); + + public final int field_1722_c; + + private EnumSkyBlock(int var3) { + this.field_1722_c = var3; + } +} diff --git a/src/net/minecraft/src/EnumStatus.java b/src/net/minecraft/src/EnumStatus.java new file mode 100644 index 0000000..60adc78 --- /dev/null +++ b/src/net/minecraft/src/EnumStatus.java @@ -0,0 +1,9 @@ +package net.minecraft.src; + +public enum EnumStatus { + OK, + NOT_POSSIBLE_HERE, + NOT_POSSIBLE_NOW, + TOO_FAR_AWAY, + OTHER_PROBLEM; +} diff --git a/src/net/minecraft/src/EnumToolMaterial.java b/src/net/minecraft/src/EnumToolMaterial.java new file mode 100644 index 0000000..aba4bcd --- /dev/null +++ b/src/net/minecraft/src/EnumToolMaterial.java @@ -0,0 +1,37 @@ +package net.minecraft.src; + +public enum EnumToolMaterial { + WOOD(0, 59, 2.0F, 0), + STONE(1, 131, 4.0F, 1), + IRON(2, 250, 6.0F, 2), + EMERALD(3, 1561, 8.0F, 3), + GOLD(0, 32, 12.0F, 0); + + private final int harvestLevel; + private final int maxUses; + private final float efficiencyOnProperMaterial; + private final int damageVsEntity; + + private EnumToolMaterial(int var3, int var4, float var5, int var6) { + this.harvestLevel = var3; + this.maxUses = var4; + this.efficiencyOnProperMaterial = var5; + this.damageVsEntity = var6; + } + + public int getMaxUses() { + return this.maxUses; + } + + public float getEfficiencyOnProperMaterial() { + return this.efficiencyOnProperMaterial; + } + + public int getDamageVsEntity() { + return this.damageVsEntity; + } + + public int getHarvestLevel() { + return this.harvestLevel; + } +} diff --git a/src/net/minecraft/src/Explosion.java b/src/net/minecraft/src/Explosion.java new file mode 100644 index 0000000..2cec7bf --- /dev/null +++ b/src/net/minecraft/src/Explosion.java @@ -0,0 +1,165 @@ +package net.minecraft.src; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Random; +import java.util.Set; + +public class Explosion { + public boolean isFlaming = false; + private Random ExplosionRNG = new Random(); + private World worldObj; + public double explosionX; + public double explosionY; + public double explosionZ; + public Entity exploder; + public float explosionSize; + public Set destroyedBlockPositions = new HashSet(); + + public Explosion(World var1, Entity var2, double var3, double var5, double var7, float var9) { + this.worldObj = var1; + this.exploder = var2; + this.explosionSize = var9; + this.explosionX = var3; + this.explosionY = var5; + this.explosionZ = var7; + } + + public void doExplosionA() { + float var1 = this.explosionSize; + byte var2 = 16; + + int var3; + int var4; + int var5; + double var15; + double var17; + double var19; + for(var3 = 0; var3 < var2; ++var3) { + for(var4 = 0; var4 < var2; ++var4) { + for(var5 = 0; var5 < var2; ++var5) { + if(var3 == 0 || var3 == var2 - 1 || var4 == 0 || var4 == var2 - 1 || var5 == 0 || var5 == var2 - 1) { + double var6 = (double)((float)var3 / ((float)var2 - 1.0F) * 2.0F - 1.0F); + double var8 = (double)((float)var4 / ((float)var2 - 1.0F) * 2.0F - 1.0F); + double var10 = (double)((float)var5 / ((float)var2 - 1.0F) * 2.0F - 1.0F); + double var12 = Math.sqrt(var6 * var6 + var8 * var8 + var10 * var10); + var6 /= var12; + var8 /= var12; + var10 /= var12; + float var14 = this.explosionSize * (0.7F + this.worldObj.rand.nextFloat() * 0.6F); + var15 = this.explosionX; + var17 = this.explosionY; + var19 = this.explosionZ; + + for(float var21 = 0.3F; var14 > 0.0F; var14 -= var21 * (12.0F / 16.0F)) { + int var22 = MathHelper.floor_double(var15); + int var23 = MathHelper.floor_double(var17); + int var24 = MathHelper.floor_double(var19); + int var25 = this.worldObj.getBlockId(var22, var23, var24); + if(var25 > 0) { + var14 -= (Block.blocksList[var25].getExplosionResistance(this.exploder) + 0.3F) * var21; + } + + if(var14 > 0.0F) { + this.destroyedBlockPositions.add(new ChunkPosition(var22, var23, var24)); + } + + var15 += var6 * (double)var21; + var17 += var8 * (double)var21; + var19 += var10 * (double)var21; + } + } + } + } + } + + this.explosionSize *= 2.0F; + var3 = MathHelper.floor_double(this.explosionX - (double)this.explosionSize - 1.0D); + var4 = MathHelper.floor_double(this.explosionX + (double)this.explosionSize + 1.0D); + var5 = MathHelper.floor_double(this.explosionY - (double)this.explosionSize - 1.0D); + int var29 = MathHelper.floor_double(this.explosionY + (double)this.explosionSize + 1.0D); + int var7 = MathHelper.floor_double(this.explosionZ - (double)this.explosionSize - 1.0D); + int var30 = MathHelper.floor_double(this.explosionZ + (double)this.explosionSize + 1.0D); + List var9 = this.worldObj.getEntitiesWithinAABBExcludingEntity(this.exploder, AxisAlignedBB.getBoundingBoxFromPool((double)var3, (double)var5, (double)var7, (double)var4, (double)var29, (double)var30)); + Vec3D var31 = Vec3D.createVector(this.explosionX, this.explosionY, this.explosionZ); + + for(int var11 = 0; var11 < var9.size(); ++var11) { + Entity var33 = (Entity)var9.get(var11); + double var13 = var33.getDistance(this.explosionX, this.explosionY, this.explosionZ) / (double)this.explosionSize; + if(var13 <= 1.0D) { + var15 = var33.posX - this.explosionX; + var17 = var33.posY - this.explosionY; + var19 = var33.posZ - this.explosionZ; + double var39 = (double)MathHelper.sqrt_double(var15 * var15 + var17 * var17 + var19 * var19); + var15 /= var39; + var17 /= var39; + var19 /= var39; + double var40 = (double)this.worldObj.func_675_a(var31, var33.boundingBox); + double var41 = (1.0D - var13) * var40; + var33.attackEntityFrom(this.exploder, (int)((var41 * var41 + var41) / 2.0D * 8.0D * (double)this.explosionSize + 1.0D)); + var33.motionX += var15 * var41; + var33.motionY += var17 * var41; + var33.motionZ += var19 * var41; + } + } + + this.explosionSize = var1; + ArrayList var32 = new ArrayList(); + var32.addAll(this.destroyedBlockPositions); + if(this.isFlaming) { + for(int var34 = var32.size() - 1; var34 >= 0; --var34) { + ChunkPosition var35 = (ChunkPosition)var32.get(var34); + int var36 = var35.x; + int var37 = var35.y; + int var16 = var35.z; + int var38 = this.worldObj.getBlockId(var36, var37, var16); + int var18 = this.worldObj.getBlockId(var36, var37 - 1, var16); + if(var38 == 0 && Block.opaqueCubeLookup[var18] && this.ExplosionRNG.nextInt(3) == 0) { + this.worldObj.setBlockWithNotify(var36, var37, var16, Block.fire.blockID); + } + } + } + + } + + public void doExplosionB(boolean var1) { + this.worldObj.playSoundEffect(this.explosionX, this.explosionY, this.explosionZ, "random.explode", 4.0F, (1.0F + (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.2F) * 0.7F); + ArrayList var2 = new ArrayList(); + var2.addAll(this.destroyedBlockPositions); + + for(int var3 = var2.size() - 1; var3 >= 0; --var3) { + ChunkPosition var4 = (ChunkPosition)var2.get(var3); + int var5 = var4.x; + int var6 = var4.y; + int var7 = var4.z; + int var8 = this.worldObj.getBlockId(var5, var6, var7); + if(var1) { + double var9 = (double)((float)var5 + this.worldObj.rand.nextFloat()); + double var11 = (double)((float)var6 + this.worldObj.rand.nextFloat()); + double var13 = (double)((float)var7 + this.worldObj.rand.nextFloat()); + double var15 = var9 - this.explosionX; + double var17 = var11 - this.explosionY; + double var19 = var13 - this.explosionZ; + double var21 = (double)MathHelper.sqrt_double(var15 * var15 + var17 * var17 + var19 * var19); + var15 /= var21; + var17 /= var21; + var19 /= var21; + double var23 = 0.5D / (var21 / (double)this.explosionSize + 0.1D); + var23 *= (double)(this.worldObj.rand.nextFloat() * this.worldObj.rand.nextFloat() + 0.3F); + var15 *= var23; + var17 *= var23; + var19 *= var23; + this.worldObj.spawnParticle("explode", (var9 + this.explosionX * 1.0D) / 2.0D, (var11 + this.explosionY * 1.0D) / 2.0D, (var13 + this.explosionZ * 1.0D) / 2.0D, var15, var17, var19); + this.worldObj.spawnParticle("smoke", var9, var11, var13, var15, var17, var19); + } + + if(var8 > 0) { + Block.blocksList[var8].dropBlockAsItemWithChance(this.worldObj, var5, var6, var7, this.worldObj.getBlockMetadata(var5, var6, var7), 0.3F); + this.worldObj.setBlockWithNotify(var5, var6, var7, 0); + Block.blocksList[var8].onBlockDestroyedByExplosion(this.worldObj, var5, var6, var7); + } + } + + } +} diff --git a/src/net/minecraft/src/FontRenderer.java b/src/net/minecraft/src/FontRenderer.java new file mode 100644 index 0000000..b97454c --- /dev/null +++ b/src/net/minecraft/src/FontRenderer.java @@ -0,0 +1,284 @@ +package net.minecraft.src; + +import java.awt.image.BufferedImage; +import java.io.IOException; +import java.nio.IntBuffer; +import javax.imageio.ImageIO; +import org.lwjgl.opengl.GL11; + +public class FontRenderer { + private int[] charWidth = new int[256]; + public int fontTextureName = 0; + private int fontDisplayLists; + private IntBuffer buffer = GLAllocation.createDirectIntBuffer(1024); + + public FontRenderer(GameSettings var1, String var2, RenderEngine var3) { + BufferedImage var4; + try { + var4 = ImageIO.read(RenderEngine.class.getResourceAsStream(var2)); + } catch (IOException var18) { + throw new RuntimeException(var18); + } + + int var5 = var4.getWidth(); + int var6 = var4.getHeight(); + int[] var7 = new int[var5 * var6]; + var4.getRGB(0, 0, var5, var6, var7, 0, var5); + + int var9; + int var10; + int var11; + int var12; + int var15; + int var16; + for(int var8 = 0; var8 < 256; ++var8) { + var9 = var8 % 16; + var10 = var8 / 16; + + for(var11 = 7; var11 >= 0; --var11) { + var12 = var9 * 8 + var11; + boolean var13 = true; + + for(int var14 = 0; var14 < 8 && var13; ++var14) { + var15 = (var10 * 8 + var14) * var5; + var16 = var7[var12 + var15] & 255; + if(var16 > 0) { + var13 = false; + } + } + + if(!var13) { + break; + } + } + + if(var8 == 32) { + var11 = 2; + } + + this.charWidth[var8] = var11 + 2; + } + + this.fontTextureName = var3.allocateAndSetupTexture(var4); + this.fontDisplayLists = GLAllocation.generateDisplayLists(288); + Tessellator var19 = Tessellator.instance; + + for(var9 = 0; var9 < 256; ++var9) { + GL11.glNewList(this.fontDisplayLists + var9, GL11.GL_COMPILE); + var19.startDrawingQuads(); + var10 = var9 % 16 * 8; + var11 = var9 / 16 * 8; + float var20 = 7.99F; + float var21 = 0.0F; + float var23 = 0.0F; + var19.addVertexWithUV(0.0D, (double)(0.0F + var20), 0.0D, (double)((float)var10 / 128.0F + var21), (double)(((float)var11 + var20) / 128.0F + var23)); + var19.addVertexWithUV((double)(0.0F + var20), (double)(0.0F + var20), 0.0D, (double)(((float)var10 + var20) / 128.0F + var21), (double)(((float)var11 + var20) / 128.0F + var23)); + var19.addVertexWithUV((double)(0.0F + var20), 0.0D, 0.0D, (double)(((float)var10 + var20) / 128.0F + var21), (double)((float)var11 / 128.0F + var23)); + var19.addVertexWithUV(0.0D, 0.0D, 0.0D, (double)((float)var10 / 128.0F + var21), (double)((float)var11 / 128.0F + var23)); + var19.draw(); + GL11.glTranslatef((float)this.charWidth[var9], 0.0F, 0.0F); + GL11.glEndList(); + } + + for(var9 = 0; var9 < 32; ++var9) { + var10 = (var9 >> 3 & 1) * 85; + var11 = (var9 >> 2 & 1) * 170 + var10; + var12 = (var9 >> 1 & 1) * 170 + var10; + int var22 = (var9 >> 0 & 1) * 170 + var10; + if(var9 == 6) { + var11 += 85; + } + + boolean var24 = var9 >= 16; + if(var1.anaglyph) { + var15 = (var11 * 30 + var12 * 59 + var22 * 11) / 100; + var16 = (var11 * 30 + var12 * 70) / 100; + int var17 = (var11 * 30 + var22 * 70) / 100; + var11 = var15; + var12 = var16; + var22 = var17; + } + + if(var24) { + var11 /= 4; + var12 /= 4; + var22 /= 4; + } + + GL11.glNewList(this.fontDisplayLists + 256 + var9, GL11.GL_COMPILE); + GL11.glColor3f((float)var11 / 255.0F, (float)var12 / 255.0F, (float)var22 / 255.0F); + GL11.glEndList(); + } + + } + + public void drawStringWithShadow(String var1, int var2, int var3, int var4) { + this.renderString(var1, var2 + 1, var3 + 1, var4, true); + this.drawString(var1, var2, var3, var4); + } + + public void drawString(String var1, int var2, int var3, int var4) { + this.renderString(var1, var2, var3, var4, false); + } + + public void renderString(String var1, int var2, int var3, int var4, boolean var5) { + if(var1 != null) { + int var6; + if(var5) { + var6 = var4 & -16777216; + var4 = (var4 & 16579836) >> 2; + var4 += var6; + } + + GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.fontTextureName); + float var10 = (float)(var4 >> 16 & 255) / 255.0F; + float var7 = (float)(var4 >> 8 & 255) / 255.0F; + float var8 = (float)(var4 & 255) / 255.0F; + float var9 = (float)(var4 >> 24 & 255) / 255.0F; + if(var9 == 0.0F) { + var9 = 1.0F; + } + + GL11.glColor4f(var10, var7, var8, var9); + this.buffer.clear(); + GL11.glPushMatrix(); + GL11.glTranslatef((float)var2, (float)var3, 0.0F); + + for(var6 = 0; var6 < var1.length(); ++var6) { + int var11; + for(; var1.length() > var6 + 1 && var1.charAt(var6) == 167; var6 += 2) { + var11 = "0123456789abcdef".indexOf(var1.toLowerCase().charAt(var6 + 1)); + if(var11 < 0 || var11 > 15) { + var11 = 15; + } + + this.buffer.put(this.fontDisplayLists + 256 + var11 + (var5 ? 16 : 0)); + if(this.buffer.remaining() == 0) { + this.buffer.flip(); + GL11.glCallLists(this.buffer); + this.buffer.clear(); + } + } + + if(var6 < var1.length()) { + var11 = ChatAllowedCharacters.allowedCharacters.indexOf(var1.charAt(var6)); + if(var11 >= 0) { + this.buffer.put(this.fontDisplayLists + var11 + 32); + } + } + + if(this.buffer.remaining() == 0) { + this.buffer.flip(); + GL11.glCallLists(this.buffer); + this.buffer.clear(); + } + } + + this.buffer.flip(); + GL11.glCallLists(this.buffer); + GL11.glPopMatrix(); + } + } + + public int getStringWidth(String var1) { + if(var1 == null) { + return 0; + } else { + int var2 = 0; + + for(int var3 = 0; var3 < var1.length(); ++var3) { + if(var1.charAt(var3) == 167) { + ++var3; + } else { + int var4 = ChatAllowedCharacters.allowedCharacters.indexOf(var1.charAt(var3)); + if(var4 >= 0) { + var2 += this.charWidth[var4 + 32]; + } + } + } + + return var2; + } + } + + public void func_27278_a(String var1, int var2, int var3, int var4, int var5) { + String[] var6 = var1.split("\n"); + if(var6.length > 1) { + for(int var11 = 0; var11 < var6.length; ++var11) { + this.func_27278_a(var6[var11], var2, var3, var4, var5); + var3 += this.func_27277_a(var6[var11], var4); + } + + } else { + String[] var7 = var1.split(" "); + int var8 = 0; + + while(var8 < var7.length) { + String var9; + for(var9 = var7[var8++] + " "; var8 < var7.length && this.getStringWidth(var9 + var7[var8]) < var4; var9 = var9 + var7[var8++] + " ") { + } + + int var10; + for(; this.getStringWidth(var9) > var4; var9 = var9.substring(var10)) { + for(var10 = 0; this.getStringWidth(var9.substring(0, var10 + 1)) <= var4; ++var10) { + } + + if(var9.substring(0, var10).trim().length() > 0) { + this.drawString(var9.substring(0, var10), var2, var3, var5); + var3 += 8; + } + } + + if(var9.trim().length() > 0) { + this.drawString(var9, var2, var3, var5); + var3 += 8; + } + } + + } + } + + public int func_27277_a(String var1, int var2) { + String[] var3 = var1.split("\n"); + int var5; + if(var3.length > 1) { + int var9 = 0; + + for(var5 = 0; var5 < var3.length; ++var5) { + var9 += this.func_27277_a(var3[var5], var2); + } + + return var9; + } else { + String[] var4 = var1.split(" "); + var5 = 0; + int var6 = 0; + + while(var5 < var4.length) { + String var7; + for(var7 = var4[var5++] + " "; var5 < var4.length && this.getStringWidth(var7 + var4[var5]) < var2; var7 = var7 + var4[var5++] + " ") { + } + + int var8; + for(; this.getStringWidth(var7) > var2; var7 = var7.substring(var8)) { + for(var8 = 0; this.getStringWidth(var7.substring(0, var8 + 1)) <= var2; ++var8) { + } + + if(var7.substring(0, var8).trim().length() > 0) { + var6 += 8; + } + } + + if(var7.trim().length() > 0) { + var6 += 8; + } + } + + if(var6 < 8) { + var6 += 8; + } + + return var6; + } + } +} diff --git a/src/net/minecraft/src/Frustrum.java b/src/net/minecraft/src/Frustrum.java new file mode 100644 index 0000000..1f3c043 --- /dev/null +++ b/src/net/minecraft/src/Frustrum.java @@ -0,0 +1,22 @@ +package net.minecraft.src; + +public class Frustrum implements ICamera { + private ClippingHelper clippingHelper = ClippingHelperImpl.getInstance(); + private double xPosition; + private double yPosition; + private double zPosition; + + public void setPosition(double var1, double var3, double var5) { + this.xPosition = var1; + this.yPosition = var3; + this.zPosition = var5; + } + + public boolean isBoxInFrustum(double var1, double var3, double var5, double var7, double var9, double var11) { + return this.clippingHelper.isBoxInFrustum(var1 - this.xPosition, var3 - this.yPosition, var5 - this.zPosition, var7 - this.xPosition, var9 - this.yPosition, var11 - this.zPosition); + } + + public boolean isBoundingBoxInFrustum(AxisAlignedBB var1) { + return this.isBoxInFrustum(var1.minX, var1.minY, var1.minZ, var1.maxX, var1.maxY, var1.maxZ); + } +} diff --git a/src/net/minecraft/src/FurnaceRecipes.java b/src/net/minecraft/src/FurnaceRecipes.java new file mode 100644 index 0000000..c9a85b4 --- /dev/null +++ b/src/net/minecraft/src/FurnaceRecipes.java @@ -0,0 +1,38 @@ +package net.minecraft.src; + +import java.util.HashMap; +import java.util.Map; + +public class FurnaceRecipes { + private static final FurnaceRecipes smeltingBase = new FurnaceRecipes(); + private Map smeltingList = new HashMap(); + + public static final FurnaceRecipes smelting() { + return smeltingBase; + } + + private FurnaceRecipes() { + this.addSmelting(Block.oreIron.blockID, new ItemStack(Item.ingotIron)); + this.addSmelting(Block.oreGold.blockID, new ItemStack(Item.ingotGold)); + this.addSmelting(Block.oreDiamond.blockID, new ItemStack(Item.diamond)); + this.addSmelting(Block.sand.blockID, new ItemStack(Block.glass)); + this.addSmelting(Item.porkRaw.shiftedIndex, new ItemStack(Item.porkCooked)); + this.addSmelting(Item.fishRaw.shiftedIndex, new ItemStack(Item.fishCooked)); + this.addSmelting(Block.cobblestone.blockID, new ItemStack(Block.stone)); + this.addSmelting(Item.clay.shiftedIndex, new ItemStack(Item.brick)); + this.addSmelting(Block.cactus.blockID, new ItemStack(Item.dyePowder, 1, 2)); + this.addSmelting(Block.wood.blockID, new ItemStack(Item.coal, 1, 1)); + } + + public void addSmelting(int var1, ItemStack var2) { + this.smeltingList.put(Integer.valueOf(var1), var2); + } + + public ItemStack getSmeltingResult(int var1) { + return (ItemStack)this.smeltingList.get(Integer.valueOf(var1)); + } + + public Map getSmeltingList() { + return this.smeltingList; + } +} diff --git a/src/net/minecraft/src/GLAllocation.java b/src/net/minecraft/src/GLAllocation.java new file mode 100644 index 0000000..9b92760 --- /dev/null +++ b/src/net/minecraft/src/GLAllocation.java @@ -0,0 +1,69 @@ +package net.minecraft.src; + +import java.nio.ByteBuffer; +import java.nio.ByteOrder; +import java.nio.FloatBuffer; +import java.nio.IntBuffer; +import java.util.ArrayList; +import java.util.List; +import org.lwjgl.opengl.GL11; + +public class GLAllocation { + private static List displayLists = new ArrayList(); + private static List textureNames = new ArrayList(); + + public static synchronized int generateDisplayLists(int var0) { + int var1 = GL11.glGenLists(var0); + displayLists.add(Integer.valueOf(var1)); + displayLists.add(Integer.valueOf(var0)); + return var1; + } + + public static synchronized void generateTextureNames(IntBuffer var0) { + GL11.glGenTextures(var0); + + for(int var1 = var0.position(); var1 < var0.limit(); ++var1) { + textureNames.add(Integer.valueOf(var0.get(var1))); + } + + } + + public static synchronized void func_28194_b(int var0) { + int var1 = displayLists.indexOf(Integer.valueOf(var0)); + GL11.glDeleteLists(((Integer)displayLists.get(var1)).intValue(), ((Integer)displayLists.get(var1 + 1)).intValue()); + displayLists.remove(var1); + displayLists.remove(var1); + } + + public static synchronized void deleteTexturesAndDisplayLists() { + for(int var0 = 0; var0 < displayLists.size(); var0 += 2) { + GL11.glDeleteLists(((Integer)displayLists.get(var0)).intValue(), ((Integer)displayLists.get(var0 + 1)).intValue()); + } + + IntBuffer var2 = createDirectIntBuffer(textureNames.size()); + var2.flip(); + GL11.glDeleteTextures(var2); + + for(int var1 = 0; var1 < textureNames.size(); ++var1) { + var2.put(((Integer)textureNames.get(var1)).intValue()); + } + + var2.flip(); + GL11.glDeleteTextures(var2); + displayLists.clear(); + textureNames.clear(); + } + + public static synchronized ByteBuffer createDirectByteBuffer(int var0) { + ByteBuffer var1 = ByteBuffer.allocateDirect(var0).order(ByteOrder.nativeOrder()); + return var1; + } + + public static IntBuffer createDirectIntBuffer(int var0) { + return createDirectByteBuffer(var0 << 2).asIntBuffer(); + } + + public static FloatBuffer createDirectFloatBuffer(int var0) { + return createDirectByteBuffer(var0 << 2).asFloatBuffer(); + } +} diff --git a/src/net/minecraft/src/GameSettings.java b/src/net/minecraft/src/GameSettings.java new file mode 100644 index 0000000..30aa476 --- /dev/null +++ b/src/net/minecraft/src/GameSettings.java @@ -0,0 +1,304 @@ +package net.minecraft.src; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.PrintWriter; +import net.minecraft.client.Minecraft; +import org.lwjgl.input.Keyboard; + +public class GameSettings { + private static final String[] RENDER_DISTANCES = new String[]{"options.renderDistance.far", "options.renderDistance.normal", "options.renderDistance.short", "options.renderDistance.tiny"}; + private static final String[] DIFFICULTIES = new String[]{"options.difficulty.peaceful", "options.difficulty.easy", "options.difficulty.normal", "options.difficulty.hard"}; + private static final String[] GUISCALES = new String[]{"options.guiScale.auto", "options.guiScale.small", "options.guiScale.normal", "options.guiScale.large"}; + private static final String[] LIMIT_FRAMERATES = new String[]{"performance.max", "performance.balanced", "performance.powersaver"}; + public float musicVolume = 1.0F; + public float soundVolume = 1.0F; + public float mouseSensitivity = 0.5F; + public boolean invertMouse = false; + public int renderDistance = 0; + public boolean viewBobbing = true; + public boolean anaglyph = false; + public boolean advancedOpengl = false; + public int limitFramerate = 1; + public boolean fancyGraphics = true; + public boolean ambientOcclusion = true; + public String skin = "Default"; + public KeyBinding keyBindForward = new KeyBinding("key.forward", 17); + public KeyBinding keyBindLeft = new KeyBinding("key.left", 30); + public KeyBinding keyBindBack = new KeyBinding("key.back", 31); + public KeyBinding keyBindRight = new KeyBinding("key.right", 32); + public KeyBinding keyBindJump = new KeyBinding("key.jump", 57); + public KeyBinding keyBindInventory = new KeyBinding("key.inventory", 18); + public KeyBinding keyBindDrop = new KeyBinding("key.drop", 16); + public KeyBinding keyBindChat = new KeyBinding("key.chat", 20); + public KeyBinding keyBindToggleFog = new KeyBinding("key.fog", 33); + public KeyBinding keyBindSneak = new KeyBinding("key.sneak", 42); + public KeyBinding[] keyBindings = new KeyBinding[]{this.keyBindForward, this.keyBindLeft, this.keyBindBack, this.keyBindRight, this.keyBindJump, this.keyBindSneak, this.keyBindDrop, this.keyBindInventory, this.keyBindChat, this.keyBindToggleFog}; + protected Minecraft mc; + private File optionsFile; + public int difficulty = 2; + public boolean hideGUI = false; + public boolean thirdPersonView = false; + public boolean showDebugInfo = false; + public String lastServer = ""; + public boolean field_22275_C = false; + public boolean smoothCamera = false; + public boolean field_22273_E = false; + public float field_22272_F = 1.0F; + public float field_22271_G = 1.0F; + public int guiScale = 0; + + public GameSettings(Minecraft var1, File var2) { + this.mc = var1; + this.optionsFile = new File(var2, "options.txt"); + this.loadOptions(); + } + + public GameSettings() { + } + + public String getKeyBindingDescription(int var1) { + StringTranslate var2 = StringTranslate.getInstance(); + return var2.translateKey(this.keyBindings[var1].keyDescription); + } + + public String getOptionDisplayString(int var1) { + return Keyboard.getKeyName(this.keyBindings[var1].keyCode); + } + + public void setKeyBinding(int var1, int var2) { + this.keyBindings[var1].keyCode = var2; + this.saveOptions(); + } + + public void setOptionFloatValue(EnumOptions var1, float var2) { + if(var1 == EnumOptions.MUSIC) { + this.musicVolume = var2; + this.mc.sndManager.onSoundOptionsChanged(); + } + + if(var1 == EnumOptions.SOUND) { + this.soundVolume = var2; + this.mc.sndManager.onSoundOptionsChanged(); + } + + if(var1 == EnumOptions.SENSITIVITY) { + this.mouseSensitivity = var2; + } + + } + + public void setOptionValue(EnumOptions var1, int var2) { + if(var1 == EnumOptions.INVERT_MOUSE) { + this.invertMouse = !this.invertMouse; + } + + if(var1 == EnumOptions.RENDER_DISTANCE) { + this.renderDistance = this.renderDistance + var2 & 3; + } + + if(var1 == EnumOptions.GUI_SCALE) { + this.guiScale = this.guiScale + var2 & 3; + } + + if(var1 == EnumOptions.VIEW_BOBBING) { + this.viewBobbing = !this.viewBobbing; + } + + if(var1 == EnumOptions.ADVANCED_OPENGL) { + this.advancedOpengl = !this.advancedOpengl; + this.mc.renderGlobal.loadRenderers(); + } + + if(var1 == EnumOptions.ANAGLYPH) { + this.anaglyph = !this.anaglyph; + this.mc.renderEngine.refreshTextures(); + } + + if(var1 == EnumOptions.FRAMERATE_LIMIT) { + this.limitFramerate = (this.limitFramerate + var2 + 3) % 3; + } + + if(var1 == EnumOptions.DIFFICULTY) { + this.difficulty = this.difficulty + var2 & 3; + } + + if(var1 == EnumOptions.GRAPHICS) { + this.fancyGraphics = !this.fancyGraphics; + this.mc.renderGlobal.loadRenderers(); + } + + if(var1 == EnumOptions.AMBIENT_OCCLUSION) { + this.ambientOcclusion = !this.ambientOcclusion; + this.mc.renderGlobal.loadRenderers(); + } + + this.saveOptions(); + } + + public float getOptionFloatValue(EnumOptions var1) { + return var1 == EnumOptions.MUSIC ? this.musicVolume : (var1 == EnumOptions.SOUND ? this.soundVolume : (var1 == EnumOptions.SENSITIVITY ? this.mouseSensitivity : 0.0F)); + } + + public boolean getOptionOrdinalValue(EnumOptions var1) { + switch(EnumOptionsMappingHelper.enumOptionsMappingHelperArray[var1.ordinal()]) { + case 1: + return this.invertMouse; + case 2: + return this.viewBobbing; + case 3: + return this.anaglyph; + case 4: + return this.advancedOpengl; + case 5: + return this.ambientOcclusion; + default: + return false; + } + } + + public String getKeyBinding(EnumOptions var1) { + StringTranslate var2 = StringTranslate.getInstance(); + String var3 = var2.translateKey(var1.getEnumString()) + ": "; + if(var1.getEnumFloat()) { + float var5 = this.getOptionFloatValue(var1); + return var1 == EnumOptions.SENSITIVITY ? (var5 == 0.0F ? var3 + var2.translateKey("options.sensitivity.min") : (var5 == 1.0F ? var3 + var2.translateKey("options.sensitivity.max") : var3 + (int)(var5 * 200.0F) + "%")) : (var5 == 0.0F ? var3 + var2.translateKey("options.off") : var3 + (int)(var5 * 100.0F) + "%"); + } else if(var1.getEnumBoolean()) { + boolean var4 = this.getOptionOrdinalValue(var1); + return var4 ? var3 + var2.translateKey("options.on") : var3 + var2.translateKey("options.off"); + } else { + return var1 == EnumOptions.RENDER_DISTANCE ? var3 + var2.translateKey(RENDER_DISTANCES[this.renderDistance]) : (var1 == EnumOptions.DIFFICULTY ? var3 + var2.translateKey(DIFFICULTIES[this.difficulty]) : (var1 == EnumOptions.GUI_SCALE ? var3 + var2.translateKey(GUISCALES[this.guiScale]) : (var1 == EnumOptions.FRAMERATE_LIMIT ? var3 + StatCollector.translateToLocal(LIMIT_FRAMERATES[this.limitFramerate]) : (var1 == EnumOptions.GRAPHICS ? (this.fancyGraphics ? var3 + var2.translateKey("options.graphics.fancy") : var3 + var2.translateKey("options.graphics.fast")) : var3)))); + } + } + + public void loadOptions() { + try { + if(!this.optionsFile.exists()) { + return; + } + + BufferedReader var1 = new BufferedReader(new FileReader(this.optionsFile)); + String var2 = ""; + + while(true) { + var2 = var1.readLine(); + if(var2 == null) { + var1.close(); + break; + } + + try { + String[] var3 = var2.split(":"); + if(var3[0].equals("music")) { + this.musicVolume = this.parseFloat(var3[1]); + } + + if(var3[0].equals("sound")) { + this.soundVolume = this.parseFloat(var3[1]); + } + + if(var3[0].equals("mouseSensitivity")) { + this.mouseSensitivity = this.parseFloat(var3[1]); + } + + if(var3[0].equals("invertYMouse")) { + this.invertMouse = var3[1].equals("true"); + } + + if(var3[0].equals("viewDistance")) { + this.renderDistance = Integer.parseInt(var3[1]); + } + + if(var3[0].equals("guiScale")) { + this.guiScale = Integer.parseInt(var3[1]); + } + + if(var3[0].equals("bobView")) { + this.viewBobbing = var3[1].equals("true"); + } + + if(var3[0].equals("anaglyph3d")) { + this.anaglyph = var3[1].equals("true"); + } + + if(var3[0].equals("advancedOpengl")) { + this.advancedOpengl = var3[1].equals("true"); + } + + if(var3[0].equals("fpsLimit")) { + this.limitFramerate = Integer.parseInt(var3[1]); + } + + if(var3[0].equals("difficulty")) { + this.difficulty = Integer.parseInt(var3[1]); + } + + if(var3[0].equals("fancyGraphics")) { + this.fancyGraphics = var3[1].equals("true"); + } + + if(var3[0].equals("ao")) { + this.ambientOcclusion = var3[1].equals("true"); + } + + if(var3[0].equals("skin")) { + this.skin = var3[1]; + } + + if(var3[0].equals("lastServer") && var3.length >= 2) { + this.lastServer = var3[1]; + } + + for(int var4 = 0; var4 < this.keyBindings.length; ++var4) { + if(var3[0].equals("key_" + this.keyBindings[var4].keyDescription)) { + this.keyBindings[var4].keyCode = Integer.parseInt(var3[1]); + } + } + } catch (Exception var5) { + System.out.println("Skipping bad option: " + var2); + } + } + } catch (Exception var6) { + System.out.println("Failed to load options"); + var6.printStackTrace(); + } + + } + + private float parseFloat(String var1) { + return var1.equals("true") ? 1.0F : (var1.equals("false") ? 0.0F : Float.parseFloat(var1)); + } + + public void saveOptions() { + try { + PrintWriter var1 = new PrintWriter(new FileWriter(this.optionsFile)); + var1.println("music:" + this.musicVolume); + var1.println("sound:" + this.soundVolume); + var1.println("invertYMouse:" + this.invertMouse); + var1.println("mouseSensitivity:" + this.mouseSensitivity); + var1.println("viewDistance:" + this.renderDistance); + var1.println("guiScale:" + this.guiScale); + var1.println("bobView:" + this.viewBobbing); + var1.println("anaglyph3d:" + this.anaglyph); + var1.println("advancedOpengl:" + this.advancedOpengl); + var1.println("fpsLimit:" + this.limitFramerate); + var1.println("difficulty:" + this.difficulty); + var1.println("fancyGraphics:" + this.fancyGraphics); + var1.println("ao:" + this.ambientOcclusion); + var1.println("skin:" + this.skin); + var1.println("lastServer:" + this.lastServer); + + for(int var2 = 0; var2 < this.keyBindings.length; ++var2) { + var1.println("key_" + this.keyBindings[var2].keyDescription + ":" + this.keyBindings[var2].keyCode); + } + + var1.close(); + } catch (Exception var3) { + System.out.println("Failed to save options"); + var3.printStackTrace(); + } + + } +} diff --git a/src/net/minecraft/src/GameWindowListener.java b/src/net/minecraft/src/GameWindowListener.java new file mode 100644 index 0000000..b5be797 --- /dev/null +++ b/src/net/minecraft/src/GameWindowListener.java @@ -0,0 +1,27 @@ +package net.minecraft.src; + +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import net.minecraft.client.Minecraft; + +public final class GameWindowListener extends WindowAdapter { + final Minecraft mc; + final Thread mcThread; + + public GameWindowListener(Minecraft var1, Thread var2) { + this.mc = var1; + this.mcThread = var2; + } + + public void windowClosing(WindowEvent var1) { + this.mc.shutdown(); + + try { + this.mcThread.join(); + } catch (InterruptedException var3) { + var3.printStackTrace(); + } + + System.exit(0); + } +} diff --git a/src/net/minecraft/src/Gui.java b/src/net/minecraft/src/Gui.java new file mode 100644 index 0000000..4b276f9 --- /dev/null +++ b/src/net/minecraft/src/Gui.java @@ -0,0 +1,109 @@ +package net.minecraft.src; + +import org.lwjgl.opengl.GL11; + +public class Gui { + protected float zLevel = 0.0F; + + protected void func_27100_a(int var1, int var2, int var3, int var4) { + if(var2 < var1) { + int var5 = var1; + var1 = var2; + var2 = var5; + } + + this.drawRect(var1, var3, var2 + 1, var3 + 1, var4); + } + + protected void func_27099_b(int var1, int var2, int var3, int var4) { + if(var3 < var2) { + int var5 = var2; + var2 = var3; + var3 = var5; + } + + this.drawRect(var1, var2 + 1, var1 + 1, var3, var4); + } + + protected void drawRect(int var1, int var2, int var3, int var4, int var5) { + int var6; + if(var1 < var3) { + var6 = var1; + var1 = var3; + var3 = var6; + } + + if(var2 < var4) { + var6 = var2; + var2 = var4; + var4 = var6; + } + + float var11 = (float)(var5 >> 24 & 255) / 255.0F; + float var7 = (float)(var5 >> 16 & 255) / 255.0F; + float var8 = (float)(var5 >> 8 & 255) / 255.0F; + float var9 = (float)(var5 & 255) / 255.0F; + Tessellator var10 = Tessellator.instance; + GL11.glEnable(GL11.GL_BLEND); + GL11.glDisable(GL11.GL_TEXTURE_2D); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + GL11.glColor4f(var7, var8, var9, var11); + var10.startDrawingQuads(); + var10.addVertex((double)var1, (double)var4, 0.0D); + var10.addVertex((double)var3, (double)var4, 0.0D); + var10.addVertex((double)var3, (double)var2, 0.0D); + var10.addVertex((double)var1, (double)var2, 0.0D); + var10.draw(); + GL11.glEnable(GL11.GL_TEXTURE_2D); + GL11.glDisable(GL11.GL_BLEND); + } + + protected void drawGradientRect(int var1, int var2, int var3, int var4, int var5, int var6) { + float var7 = (float)(var5 >> 24 & 255) / 255.0F; + float var8 = (float)(var5 >> 16 & 255) / 255.0F; + float var9 = (float)(var5 >> 8 & 255) / 255.0F; + float var10 = (float)(var5 & 255) / 255.0F; + float var11 = (float)(var6 >> 24 & 255) / 255.0F; + float var12 = (float)(var6 >> 16 & 255) / 255.0F; + float var13 = (float)(var6 >> 8 & 255) / 255.0F; + float var14 = (float)(var6 & 255) / 255.0F; + GL11.glDisable(GL11.GL_TEXTURE_2D); + GL11.glEnable(GL11.GL_BLEND); + GL11.glDisable(GL11.GL_ALPHA_TEST); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + GL11.glShadeModel(GL11.GL_SMOOTH); + Tessellator var15 = Tessellator.instance; + var15.startDrawingQuads(); + var15.setColorRGBA_F(var8, var9, var10, var7); + var15.addVertex((double)var3, (double)var2, 0.0D); + var15.addVertex((double)var1, (double)var2, 0.0D); + var15.setColorRGBA_F(var12, var13, var14, var11); + var15.addVertex((double)var1, (double)var4, 0.0D); + var15.addVertex((double)var3, (double)var4, 0.0D); + var15.draw(); + GL11.glShadeModel(GL11.GL_FLAT); + GL11.glDisable(GL11.GL_BLEND); + GL11.glEnable(GL11.GL_ALPHA_TEST); + GL11.glEnable(GL11.GL_TEXTURE_2D); + } + + public void drawCenteredString(FontRenderer var1, String var2, int var3, int var4, int var5) { + var1.drawStringWithShadow(var2, var3 - var1.getStringWidth(var2) / 2, var4, var5); + } + + public void drawString(FontRenderer var1, String var2, int var3, int var4, int var5) { + var1.drawStringWithShadow(var2, var3, var4, var5); + } + + public void drawTexturedModalRect(int var1, int var2, int var3, int var4, int var5, int var6) { + float var7 = 0.00390625F; + float var8 = 0.00390625F; + Tessellator var9 = Tessellator.instance; + var9.startDrawingQuads(); + var9.addVertexWithUV((double)(var1 + 0), (double)(var2 + var6), (double)this.zLevel, (double)((float)(var3 + 0) * var7), (double)((float)(var4 + var6) * var8)); + var9.addVertexWithUV((double)(var1 + var5), (double)(var2 + var6), (double)this.zLevel, (double)((float)(var3 + var5) * var7), (double)((float)(var4 + var6) * var8)); + var9.addVertexWithUV((double)(var1 + var5), (double)(var2 + 0), (double)this.zLevel, (double)((float)(var3 + var5) * var7), (double)((float)(var4 + 0) * var8)); + var9.addVertexWithUV((double)(var1 + 0), (double)(var2 + 0), (double)this.zLevel, (double)((float)(var3 + 0) * var7), (double)((float)(var4 + 0) * var8)); + var9.draw(); + } +} diff --git a/src/net/minecraft/src/GuiAchievement.java b/src/net/minecraft/src/GuiAchievement.java new file mode 100644 index 0000000..c00a8f9 --- /dev/null +++ b/src/net/minecraft/src/GuiAchievement.java @@ -0,0 +1,126 @@ +package net.minecraft.src; + +import net.minecraft.client.Minecraft; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +public class GuiAchievement extends Gui { + private Minecraft theGame; + private int achievementWindowWidth; + private int achievementWindowHeight; + private String field_25085_d; + private String field_25084_e; + private Achievement theAchievement; + private long field_25083_f; + private RenderItem itemRender; + private boolean field_27103_i; + + public GuiAchievement(Minecraft var1) { + this.theGame = var1; + this.itemRender = new RenderItem(); + } + + public void queueTakenAchievement(Achievement var1) { + this.field_25085_d = StatCollector.translateToLocal("achievement.get"); + this.field_25084_e = var1.statName; + this.field_25083_f = System.currentTimeMillis(); + this.theAchievement = var1; + this.field_27103_i = false; + } + + public void queueAchievementInformation(Achievement var1) { + this.field_25085_d = var1.statName; + this.field_25084_e = var1.getDescription(); + this.field_25083_f = System.currentTimeMillis() - 2500L; + this.theAchievement = var1; + this.field_27103_i = true; + } + + private void updateAchievementWindowScale() { + GL11.glViewport(0, 0, this.theGame.displayWidth, this.theGame.displayHeight); + GL11.glMatrixMode(GL11.GL_PROJECTION); + GL11.glLoadIdentity(); + GL11.glMatrixMode(GL11.GL_MODELVIEW); + GL11.glLoadIdentity(); + this.achievementWindowWidth = this.theGame.displayWidth; + this.achievementWindowHeight = this.theGame.displayHeight; + ScaledResolution var1 = new ScaledResolution(this.theGame.gameSettings, this.theGame.displayWidth, this.theGame.displayHeight); + this.achievementWindowWidth = var1.getScaledWidth(); + this.achievementWindowHeight = var1.getScaledHeight(); + GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT); + GL11.glMatrixMode(GL11.GL_PROJECTION); + GL11.glLoadIdentity(); + GL11.glOrtho(0.0D, (double)this.achievementWindowWidth, (double)this.achievementWindowHeight, 0.0D, 1000.0D, 3000.0D); + GL11.glMatrixMode(GL11.GL_MODELVIEW); + GL11.glLoadIdentity(); + GL11.glTranslatef(0.0F, 0.0F, -2000.0F); + } + + public void updateAchievementWindow() { + if(Minecraft.hasPaidCheckTime > 0L) { + GL11.glDisable(GL11.GL_DEPTH_TEST); + GL11.glDepthMask(false); + RenderHelper.disableStandardItemLighting(); + this.updateAchievementWindowScale(); + String var1 = "Minecraft Beta 1.7.3 Unlicensed Copy :("; + String var2 = "(Or logged in from another location)"; + String var3 = "Purchase at minecraft.net"; + this.theGame.fontRenderer.drawStringWithShadow(var1, 2, 2, 16777215); + this.theGame.fontRenderer.drawStringWithShadow(var2, 2, 11, 16777215); + this.theGame.fontRenderer.drawStringWithShadow(var3, 2, 20, 16777215); + GL11.glDepthMask(true); + GL11.glEnable(GL11.GL_DEPTH_TEST); + } + + if(this.theAchievement != null && this.field_25083_f != 0L) { + double var8 = (double)(System.currentTimeMillis() - this.field_25083_f) / 3000.0D; + if(this.field_27103_i || this.field_27103_i || var8 >= 0.0D && var8 <= 1.0D) { + this.updateAchievementWindowScale(); + GL11.glDisable(GL11.GL_DEPTH_TEST); + GL11.glDepthMask(false); + double var9 = var8 * 2.0D; + if(var9 > 1.0D) { + var9 = 2.0D - var9; + } + + var9 *= 4.0D; + var9 = 1.0D - var9; + if(var9 < 0.0D) { + var9 = 0.0D; + } + + var9 *= var9; + var9 *= var9; + int var5 = this.achievementWindowWidth - 160; + int var6 = 0 - (int)(var9 * 36.0D); + int var7 = this.theGame.renderEngine.getTexture("/achievement/bg.png"); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glEnable(GL11.GL_TEXTURE_2D); + GL11.glBindTexture(GL11.GL_TEXTURE_2D, var7); + GL11.glDisable(GL11.GL_LIGHTING); + this.drawTexturedModalRect(var5, var6, 96, 202, 160, 32); + if(this.field_27103_i) { + this.theGame.fontRenderer.func_27278_a(this.field_25084_e, var5 + 30, var6 + 7, 120, -1); + } else { + this.theGame.fontRenderer.drawString(this.field_25085_d, var5 + 30, var6 + 7, -256); + this.theGame.fontRenderer.drawString(this.field_25084_e, var5 + 30, var6 + 18, -1); + } + + GL11.glPushMatrix(); + GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F); + RenderHelper.enableStandardItemLighting(); + GL11.glPopMatrix(); + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + GL11.glEnable(GL11.GL_COLOR_MATERIAL); + GL11.glEnable(GL11.GL_LIGHTING); + this.itemRender.renderItemIntoGUI(this.theGame.fontRenderer, this.theGame.renderEngine, this.theAchievement.theItemStack, var5 + 8, var6 + 8); + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glDepthMask(true); + GL11.glEnable(GL11.GL_DEPTH_TEST); + } else { + this.field_25083_f = 0L; + } + } + } +} diff --git a/src/net/minecraft/src/GuiAchievements.java b/src/net/minecraft/src/GuiAchievements.java new file mode 100644 index 0000000..a618367 --- /dev/null +++ b/src/net/minecraft/src/GuiAchievements.java @@ -0,0 +1,337 @@ +package net.minecraft.src; + +import java.util.Random; +import org.lwjgl.input.Mouse; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +public class GuiAchievements extends GuiScreen { + private static final int field_27126_s = AchievementList.minDisplayColumn * 24 - 112; + private static final int field_27125_t = AchievementList.minDisplayRow * 24 - 112; + private static final int field_27124_u = AchievementList.maxDisplayColumn * 24 - 77; + private static final int field_27123_v = AchievementList.maxDisplayRow * 24 - 77; + protected int field_27121_a = 256; + protected int field_27119_i = 202; + protected int field_27118_j = 0; + protected int field_27117_l = 0; + protected double field_27116_m; + protected double field_27115_n; + protected double field_27114_o; + protected double field_27113_p; + protected double field_27112_q; + protected double field_27111_r; + private int field_27122_w = 0; + private StatFileWriter field_27120_x; + + public GuiAchievements(StatFileWriter var1) { + this.field_27120_x = var1; + short var2 = 141; + short var3 = 141; + this.field_27116_m = this.field_27114_o = this.field_27112_q = (double)(AchievementList.openInventory.displayColumn * 24 - var2 / 2 - 12); + this.field_27115_n = this.field_27113_p = this.field_27111_r = (double)(AchievementList.openInventory.displayRow * 24 - var3 / 2); + } + + public void initGui() { + this.controlList.clear(); + this.controlList.add(new GuiSmallButton(1, this.width / 2 + 24, this.height / 2 + 74, 80, 20, StatCollector.translateToLocal("gui.done"))); + } + + protected void actionPerformed(GuiButton var1) { + if(var1.id == 1) { + this.mc.displayGuiScreen((GuiScreen)null); + this.mc.setIngameFocus(); + } + + super.actionPerformed(var1); + } + + protected void keyTyped(char var1, int var2) { + if(var2 == this.mc.gameSettings.keyBindInventory.keyCode) { + this.mc.displayGuiScreen((GuiScreen)null); + this.mc.setIngameFocus(); + } else { + super.keyTyped(var1, var2); + } + + } + + public void drawScreen(int var1, int var2, float var3) { + if(Mouse.isButtonDown(0)) { + int var4 = (this.width - this.field_27121_a) / 2; + int var5 = (this.height - this.field_27119_i) / 2; + int var6 = var4 + 8; + int var7 = var5 + 17; + if((this.field_27122_w == 0 || this.field_27122_w == 1) && var1 >= var6 && var1 < var6 + 224 && var2 >= var7 && var2 < var7 + 155) { + if(this.field_27122_w == 0) { + this.field_27122_w = 1; + } else { + this.field_27114_o -= (double)(var1 - this.field_27118_j); + this.field_27113_p -= (double)(var2 - this.field_27117_l); + this.field_27112_q = this.field_27116_m = this.field_27114_o; + this.field_27111_r = this.field_27115_n = this.field_27113_p; + } + + this.field_27118_j = var1; + this.field_27117_l = var2; + } + + if(this.field_27112_q < (double)field_27126_s) { + this.field_27112_q = (double)field_27126_s; + } + + if(this.field_27111_r < (double)field_27125_t) { + this.field_27111_r = (double)field_27125_t; + } + + if(this.field_27112_q >= (double)field_27124_u) { + this.field_27112_q = (double)(field_27124_u - 1); + } + + if(this.field_27111_r >= (double)field_27123_v) { + this.field_27111_r = (double)(field_27123_v - 1); + } + } else { + this.field_27122_w = 0; + } + + this.drawDefaultBackground(); + this.func_27109_b(var1, var2, var3); + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glDisable(GL11.GL_DEPTH_TEST); + this.func_27110_k(); + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glEnable(GL11.GL_DEPTH_TEST); + } + + public void updateScreen() { + this.field_27116_m = this.field_27114_o; + this.field_27115_n = this.field_27113_p; + double var1 = this.field_27112_q - this.field_27114_o; + double var3 = this.field_27111_r - this.field_27113_p; + if(var1 * var1 + var3 * var3 < 4.0D) { + this.field_27114_o += var1; + this.field_27113_p += var3; + } else { + this.field_27114_o += var1 * 0.85D; + this.field_27113_p += var3 * 0.85D; + } + + } + + protected void func_27110_k() { + int var1 = (this.width - this.field_27121_a) / 2; + int var2 = (this.height - this.field_27119_i) / 2; + this.fontRenderer.drawString("Achievements", var1 + 15, var2 + 5, 4210752); + } + + protected void func_27109_b(int var1, int var2, float var3) { + int var4 = MathHelper.floor_double(this.field_27116_m + (this.field_27114_o - this.field_27116_m) * (double)var3); + int var5 = MathHelper.floor_double(this.field_27115_n + (this.field_27113_p - this.field_27115_n) * (double)var3); + if(var4 < field_27126_s) { + var4 = field_27126_s; + } + + if(var5 < field_27125_t) { + var5 = field_27125_t; + } + + if(var4 >= field_27124_u) { + var4 = field_27124_u - 1; + } + + if(var5 >= field_27123_v) { + var5 = field_27123_v - 1; + } + + int var6 = this.mc.renderEngine.getTexture("/terrain.png"); + int var7 = this.mc.renderEngine.getTexture("/achievement/bg.png"); + int var8 = (this.width - this.field_27121_a) / 2; + int var9 = (this.height - this.field_27119_i) / 2; + int var10 = var8 + 16; + int var11 = var9 + 17; + this.zLevel = 0.0F; + GL11.glDepthFunc(GL11.GL_GEQUAL); + GL11.glPushMatrix(); + GL11.glTranslatef(0.0F, 0.0F, -200.0F); + GL11.glEnable(GL11.GL_TEXTURE_2D); + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + GL11.glEnable(GL11.GL_COLOR_MATERIAL); + this.mc.renderEngine.bindTexture(var6); + int var12 = var4 + 288 >> 4; + int var13 = var5 + 288 >> 4; + int var14 = (var4 + 288) % 16; + int var15 = (var5 + 288) % 16; + Random var21 = new Random(); + + for(int var22 = 0; var22 * 16 - var15 < 155; ++var22) { + float var23 = 0.6F - (float)(var13 + var22) / 25.0F * 0.3F; + GL11.glColor4f(var23, var23, var23, 1.0F); + + for(int var24 = 0; var24 * 16 - var14 < 224; ++var24) { + var21.setSeed((long)(1234 + var12 + var24)); + var21.nextInt(); + int var25 = var21.nextInt(1 + var13 + var22) + (var13 + var22) / 2; + int var26 = Block.sand.blockIndexInTexture; + if(var25 <= 37 && var13 + var22 != 35) { + if(var25 == 22) { + if(var21.nextInt(2) == 0) { + var26 = Block.oreDiamond.blockIndexInTexture; + } else { + var26 = Block.oreRedstone.blockIndexInTexture; + } + } else if(var25 == 10) { + var26 = Block.oreIron.blockIndexInTexture; + } else if(var25 == 8) { + var26 = Block.oreCoal.blockIndexInTexture; + } else if(var25 > 4) { + var26 = Block.stone.blockIndexInTexture; + } else if(var25 > 0) { + var26 = Block.dirt.blockIndexInTexture; + } + } else { + var26 = Block.bedrock.blockIndexInTexture; + } + + this.drawTexturedModalRect(var10 + var24 * 16 - var14, var11 + var22 * 16 - var15, var26 % 16 << 4, var26 >> 4 << 4, 16, 16); + } + } + + GL11.glEnable(GL11.GL_DEPTH_TEST); + GL11.glDepthFunc(GL11.GL_LEQUAL); + GL11.glDisable(GL11.GL_TEXTURE_2D); + + int var16; + int var17; + int var33; + int var38; + for(var12 = 0; var12 < AchievementList.achievementList.size(); ++var12) { + Achievement var28 = (Achievement)AchievementList.achievementList.get(var12); + if(var28.parentAchievement != null) { + var14 = var28.displayColumn * 24 - var4 + 11 + var10; + var15 = var28.displayRow * 24 - var5 + 11 + var11; + var16 = var28.parentAchievement.displayColumn * 24 - var4 + 11 + var10; + var17 = var28.parentAchievement.displayRow * 24 - var5 + 11 + var11; + boolean var18 = false; + boolean var19 = this.field_27120_x.hasAchievementUnlocked(var28); + boolean var20 = this.field_27120_x.func_27181_b(var28); + var38 = Math.sin((double)(System.currentTimeMillis() % 600L) / 600.0D * Math.PI * 2.0D) > 0.6D ? 255 : 130; + if(var19) { + var33 = -9408400; + } else if(var20) { + var33 = '\uff00' + (var38 << 24); + } else { + var33 = -16777216; + } + + this.func_27100_a(var14, var16, var15, var33); + this.func_27099_b(var16, var15, var17, var33); + } + } + + Achievement var27 = null; + RenderItem var29 = new RenderItem(); + GL11.glPushMatrix(); + GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F); + RenderHelper.enableStandardItemLighting(); + GL11.glPopMatrix(); + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + GL11.glEnable(GL11.GL_COLOR_MATERIAL); + + int var34; + for(var14 = 0; var14 < AchievementList.achievementList.size(); ++var14) { + Achievement var30 = (Achievement)AchievementList.achievementList.get(var14); + var16 = var30.displayColumn * 24 - var4; + var17 = var30.displayRow * 24 - var5; + if(var16 >= -24 && var17 >= -24 && var16 <= 224 && var17 <= 155) { + float var35; + if(this.field_27120_x.hasAchievementUnlocked(var30)) { + var35 = 1.0F; + GL11.glColor4f(var35, var35, var35, 1.0F); + } else if(this.field_27120_x.func_27181_b(var30)) { + var35 = Math.sin((double)(System.currentTimeMillis() % 600L) / 600.0D * Math.PI * 2.0D) < 0.6D ? 0.6F : 0.8F; + GL11.glColor4f(var35, var35, var35, 1.0F); + } else { + var35 = 0.3F; + GL11.glColor4f(var35, var35, var35, 1.0F); + } + + this.mc.renderEngine.bindTexture(var7); + var33 = var10 + var16; + var34 = var11 + var17; + if(var30.getSpecial()) { + this.drawTexturedModalRect(var33 - 2, var34 - 2, 26, 202, 26, 26); + } else { + this.drawTexturedModalRect(var33 - 2, var34 - 2, 0, 202, 26, 26); + } + + if(!this.field_27120_x.func_27181_b(var30)) { + float var36 = 0.1F; + GL11.glColor4f(var36, var36, var36, 1.0F); + var29.field_27004_a = false; + } + + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glEnable(GL11.GL_CULL_FACE); + var29.renderItemIntoGUI(this.mc.fontRenderer, this.mc.renderEngine, var30.theItemStack, var33 + 3, var34 + 3); + GL11.glDisable(GL11.GL_LIGHTING); + if(!this.field_27120_x.func_27181_b(var30)) { + var29.field_27004_a = true; + } + + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + if(var1 >= var10 && var2 >= var11 && var1 < var10 + 224 && var2 < var11 + 155 && var1 >= var33 && var1 <= var33 + 22 && var2 >= var34 && var2 <= var34 + 22) { + var27 = var30; + } + } + } + + GL11.glDisable(GL11.GL_DEPTH_TEST); + GL11.glEnable(GL11.GL_BLEND); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + this.mc.renderEngine.bindTexture(var7); + this.drawTexturedModalRect(var8, var9, 0, 0, this.field_27121_a, this.field_27119_i); + GL11.glPopMatrix(); + this.zLevel = 0.0F; + GL11.glDepthFunc(GL11.GL_LEQUAL); + GL11.glDisable(GL11.GL_DEPTH_TEST); + GL11.glEnable(GL11.GL_TEXTURE_2D); + super.drawScreen(var1, var2, var3); + if(var27 != null) { + String var31 = var27.statName; + String var32 = var27.getDescription(); + var17 = var1 + 12; + var33 = var2 - 4; + if(this.field_27120_x.func_27181_b(var27)) { + var34 = Math.max(this.fontRenderer.getStringWidth(var31), 120); + int var37 = this.fontRenderer.func_27277_a(var32, var34); + if(this.field_27120_x.hasAchievementUnlocked(var27)) { + var37 += 12; + } + + this.drawGradientRect(var17 - 3, var33 - 3, var17 + var34 + 3, var33 + var37 + 3 + 12, -1073741824, -1073741824); + this.fontRenderer.func_27278_a(var32, var17, var33 + 12, var34, -6250336); + if(this.field_27120_x.hasAchievementUnlocked(var27)) { + this.fontRenderer.drawStringWithShadow(StatCollector.translateToLocal("achievement.taken"), var17, var33 + var37 + 4, -7302913); + } + } else { + var34 = Math.max(this.fontRenderer.getStringWidth(var31), 120); + String var39 = StatCollector.translateToLocalFormatted("achievement.requires", new Object[]{var27.parentAchievement.statName}); + var38 = this.fontRenderer.func_27277_a(var39, var34); + this.drawGradientRect(var17 - 3, var33 - 3, var17 + var34 + 3, var33 + var38 + 12 + 3, -1073741824, -1073741824); + this.fontRenderer.func_27278_a(var39, var17, var33 + 12, var34, -9416624); + } + + this.fontRenderer.drawStringWithShadow(var31, var17, var33, this.field_27120_x.func_27181_b(var27) ? (var27.getSpecial() ? -128 : -1) : (var27.getSpecial() ? -8355776 : -8355712)); + } + + GL11.glEnable(GL11.GL_DEPTH_TEST); + GL11.glEnable(GL11.GL_LIGHTING); + RenderHelper.disableStandardItemLighting(); + } + + public boolean doesGuiPauseGame() { + return true; + } +} diff --git a/src/net/minecraft/src/GuiButton.java b/src/net/minecraft/src/GuiButton.java new file mode 100644 index 0000000..1495398 --- /dev/null +++ b/src/net/minecraft/src/GuiButton.java @@ -0,0 +1,74 @@ +package net.minecraft.src; + +import net.minecraft.client.Minecraft; +import org.lwjgl.opengl.GL11; + +public class GuiButton extends Gui { + protected int width; + protected int height; + public int xPosition; + public int yPosition; + public String displayString; + public int id; + public boolean enabled; + public boolean enabled2; + + public GuiButton(int var1, int var2, int var3, String var4) { + this(var1, var2, var3, 200, 20, var4); + } + + public GuiButton(int var1, int var2, int var3, int var4, int var5, String var6) { + this.width = 200; + this.height = 20; + this.enabled = true; + this.enabled2 = true; + this.id = var1; + this.xPosition = var2; + this.yPosition = var3; + this.width = var4; + this.height = var5; + this.displayString = var6; + } + + protected int getHoverState(boolean var1) { + byte var2 = 1; + if(!this.enabled) { + var2 = 0; + } else if(var1) { + var2 = 2; + } + + return var2; + } + + public void drawButton(Minecraft var1, int var2, int var3) { + if(this.enabled2) { + FontRenderer var4 = var1.fontRenderer; + GL11.glBindTexture(GL11.GL_TEXTURE_2D, var1.renderEngine.getTexture("/gui/gui.png")); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + boolean var5 = var2 >= this.xPosition && var3 >= this.yPosition && var2 < this.xPosition + this.width && var3 < this.yPosition + this.height; + int var6 = this.getHoverState(var5); + this.drawTexturedModalRect(this.xPosition, this.yPosition, 0, 46 + var6 * 20, this.width / 2, this.height); + this.drawTexturedModalRect(this.xPosition + this.width / 2, this.yPosition, 200 - this.width / 2, 46 + var6 * 20, this.width / 2, this.height); + this.mouseDragged(var1, var2, var3); + if(!this.enabled) { + this.drawCenteredString(var4, this.displayString, this.xPosition + this.width / 2, this.yPosition + (this.height - 8) / 2, -6250336); + } else if(var5) { + this.drawCenteredString(var4, this.displayString, this.xPosition + this.width / 2, this.yPosition + (this.height - 8) / 2, 16777120); + } else { + this.drawCenteredString(var4, this.displayString, this.xPosition + this.width / 2, this.yPosition + (this.height - 8) / 2, 14737632); + } + + } + } + + protected void mouseDragged(Minecraft var1, int var2, int var3) { + } + + public void mouseReleased(int var1, int var2) { + } + + public boolean mousePressed(Minecraft var1, int var2, int var3) { + return this.enabled && var2 >= this.xPosition && var3 >= this.yPosition && var2 < this.xPosition + this.width && var3 < this.yPosition + this.height; + } +} diff --git a/src/net/minecraft/src/GuiChat.java b/src/net/minecraft/src/GuiChat.java new file mode 100644 index 0000000..6efb75d --- /dev/null +++ b/src/net/minecraft/src/GuiChat.java @@ -0,0 +1,71 @@ +package net.minecraft.src; + +import org.lwjgl.input.Keyboard; + +public class GuiChat extends GuiScreen { + protected String message = ""; + private int updateCounter = 0; + private static final String field_20082_i = ChatAllowedCharacters.allowedCharacters; + + public void initGui() { + Keyboard.enableRepeatEvents(true); + } + + public void onGuiClosed() { + Keyboard.enableRepeatEvents(false); + } + + public void updateScreen() { + ++this.updateCounter; + } + + protected void keyTyped(char var1, int var2) { + if(var2 == 1) { + this.mc.displayGuiScreen((GuiScreen)null); + } else if(var2 == 28) { + String var3 = this.message.trim(); + if(var3.length() > 0) { + String var4 = this.message.trim(); + if(!this.mc.lineIsCommand(var4)) { + this.mc.thePlayer.sendChatMessage(var4); + } + } + + this.mc.displayGuiScreen((GuiScreen)null); + } else { + if(var2 == 14 && this.message.length() > 0) { + this.message = this.message.substring(0, this.message.length() - 1); + } + + if(field_20082_i.indexOf(var1) >= 0 && this.message.length() < 100) { + this.message = this.message + var1; + } + + } + } + + public void drawScreen(int var1, int var2, float var3) { + this.drawRect(2, this.height - 14, this.width - 2, this.height - 2, Integer.MIN_VALUE); + this.drawString(this.fontRenderer, "> " + this.message + (this.updateCounter / 6 % 2 == 0 ? "_" : ""), 4, this.height - 12, 14737632); + super.drawScreen(var1, var2, var3); + } + + protected void mouseClicked(int var1, int var2, int var3) { + if(var3 == 0) { + if(this.mc.ingameGUI.field_933_a != null) { + if(this.message.length() > 0 && !this.message.endsWith(" ")) { + this.message = this.message + " "; + } + + this.message = this.message + this.mc.ingameGUI.field_933_a; + byte var4 = 100; + if(this.message.length() > var4) { + this.message = this.message.substring(0, var4); + } + } else { + super.mouseClicked(var1, var2, var3); + } + } + + } +} diff --git a/src/net/minecraft/src/GuiChest.java b/src/net/minecraft/src/GuiChest.java new file mode 100644 index 0000000..73f1038 --- /dev/null +++ b/src/net/minecraft/src/GuiChest.java @@ -0,0 +1,35 @@ +package net.minecraft.src; + +import org.lwjgl.opengl.GL11; + +public class GuiChest extends GuiContainer { + private IInventory upperChestInventory; + private IInventory lowerChestInventory; + private int inventoryRows = 0; + + public GuiChest(IInventory var1, IInventory var2) { + super(new ContainerChest(var1, var2)); + this.upperChestInventory = var1; + this.lowerChestInventory = var2; + this.field_948_f = false; + short var3 = 222; + int var4 = var3 - 108; + this.inventoryRows = var2.getSizeInventory() / 9; + this.ySize = var4 + this.inventoryRows * 18; + } + + protected void drawGuiContainerForegroundLayer() { + this.fontRenderer.drawString(this.lowerChestInventory.getInvName(), 8, 6, 4210752); + this.fontRenderer.drawString(this.upperChestInventory.getInvName(), 8, this.ySize - 96 + 2, 4210752); + } + + protected void drawGuiContainerBackgroundLayer(float var1) { + int var2 = this.mc.renderEngine.getTexture("/gui/container.png"); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + this.mc.renderEngine.bindTexture(var2); + int var3 = (this.width - this.xSize) / 2; + int var4 = (this.height - this.ySize) / 2; + this.drawTexturedModalRect(var3, var4, 0, 0, this.xSize, this.inventoryRows * 18 + 17); + this.drawTexturedModalRect(var3, var4 + this.inventoryRows * 18 + 17, 0, 126, this.xSize, 96); + } +} diff --git a/src/net/minecraft/src/GuiConflictWarning.java b/src/net/minecraft/src/GuiConflictWarning.java new file mode 100644 index 0000000..ca59b0c --- /dev/null +++ b/src/net/minecraft/src/GuiConflictWarning.java @@ -0,0 +1,33 @@ +package net.minecraft.src; + +public class GuiConflictWarning extends GuiScreen { + private int updateCounter = 0; + + public void updateScreen() { + ++this.updateCounter; + } + + public void initGui() { + this.controlList.clear(); + this.controlList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 120 + 12, "Back to title screen")); + } + + protected void actionPerformed(GuiButton var1) { + if(var1.enabled) { + if(var1.id == 0) { + this.mc.displayGuiScreen(new GuiMainMenu()); + } + + } + } + + public void drawScreen(int var1, int var2, float var3) { + this.drawDefaultBackground(); + this.drawCenteredString(this.fontRenderer, "Level save conflict", this.width / 2, this.height / 4 - 60 + 20, 16777215); + this.drawString(this.fontRenderer, "Minecraft detected a conflict in the level save data.", this.width / 2 - 140, this.height / 4 - 60 + 60 + 0, 10526880); + this.drawString(this.fontRenderer, "This could be caused by two copies of the game", this.width / 2 - 140, this.height / 4 - 60 + 60 + 18, 10526880); + this.drawString(this.fontRenderer, "accessing the same level.", this.width / 2 - 140, this.height / 4 - 60 + 60 + 27, 10526880); + this.drawString(this.fontRenderer, "To prevent level corruption, the current game has quit.", this.width / 2 - 140, this.height / 4 - 60 + 60 + 45, 10526880); + super.drawScreen(var1, var2, var3); + } +} diff --git a/src/net/minecraft/src/GuiConnectFailed.java b/src/net/minecraft/src/GuiConnectFailed.java new file mode 100644 index 0000000..717e85a --- /dev/null +++ b/src/net/minecraft/src/GuiConnectFailed.java @@ -0,0 +1,43 @@ +package net.minecraft.src; + +public class GuiConnectFailed extends GuiScreen { + private String errorMessage; + private String errorDetail; + + public GuiConnectFailed(String var1, String var2, Object... var3) { + StringTranslate var4 = StringTranslate.getInstance(); + this.errorMessage = var4.translateKey(var1); + if(var3 != null) { + this.errorDetail = var4.translateKeyFormat(var2, var3); + } else { + this.errorDetail = var4.translateKey(var2); + } + + } + + public void updateScreen() { + } + + protected void keyTyped(char var1, int var2) { + } + + public void initGui() { + StringTranslate var1 = StringTranslate.getInstance(); + this.controlList.clear(); + this.controlList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 120 + 12, var1.translateKey("gui.toMenu"))); + } + + protected void actionPerformed(GuiButton var1) { + if(var1.id == 0) { + this.mc.displayGuiScreen(new GuiMainMenu()); + } + + } + + public void drawScreen(int var1, int var2, float var3) { + this.drawDefaultBackground(); + this.drawCenteredString(this.fontRenderer, this.errorMessage, this.width / 2, this.height / 2 - 50, 16777215); + this.drawCenteredString(this.fontRenderer, this.errorDetail, this.width / 2, this.height / 2 - 10, 16777215); + super.drawScreen(var1, var2, var3); + } +} diff --git a/src/net/minecraft/src/GuiConnecting.java b/src/net/minecraft/src/GuiConnecting.java new file mode 100644 index 0000000..0a10d03 --- /dev/null +++ b/src/net/minecraft/src/GuiConnecting.java @@ -0,0 +1,68 @@ +package net.minecraft.src; + +import net.minecraft.client.Minecraft; + +public class GuiConnecting extends GuiScreen { + private NetClientHandler clientHandler; + private boolean cancelled = false; + + public GuiConnecting(Minecraft var1, String var2, int var3) { + System.out.println("Connecting to " + var2 + ", " + var3); + var1.changeWorld1((World)null); + (new ThreadConnectToServer(this, var1, var2, var3)).start(); + } + + public void updateScreen() { + if(this.clientHandler != null) { + this.clientHandler.processReadPackets(); + } + + } + + protected void keyTyped(char var1, int var2) { + } + + public void initGui() { + StringTranslate var1 = StringTranslate.getInstance(); + this.controlList.clear(); + this.controlList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 120 + 12, var1.translateKey("gui.cancel"))); + } + + protected void actionPerformed(GuiButton var1) { + if(var1.id == 0) { + this.cancelled = true; + if(this.clientHandler != null) { + this.clientHandler.disconnect(); + } + + this.mc.displayGuiScreen(new GuiMainMenu()); + } + + } + + public void drawScreen(int var1, int var2, float var3) { + this.drawDefaultBackground(); + StringTranslate var4 = StringTranslate.getInstance(); + if(this.clientHandler == null) { + this.drawCenteredString(this.fontRenderer, var4.translateKey("connect.connecting"), this.width / 2, this.height / 2 - 50, 16777215); + this.drawCenteredString(this.fontRenderer, "", this.width / 2, this.height / 2 - 10, 16777215); + } else { + this.drawCenteredString(this.fontRenderer, var4.translateKey("connect.authorizing"), this.width / 2, this.height / 2 - 50, 16777215); + this.drawCenteredString(this.fontRenderer, this.clientHandler.field_1209_a, this.width / 2, this.height / 2 - 10, 16777215); + } + + super.drawScreen(var1, var2, var3); + } + + static NetClientHandler setNetClientHandler(GuiConnecting var0, NetClientHandler var1) { + return var0.clientHandler = var1; + } + + static boolean isCancelled(GuiConnecting var0) { + return var0.cancelled; + } + + static NetClientHandler getNetClientHandler(GuiConnecting var0) { + return var0.clientHandler; + } +} diff --git a/src/net/minecraft/src/GuiContainer.java b/src/net/minecraft/src/GuiContainer.java new file mode 100644 index 0000000..000e281 --- /dev/null +++ b/src/net/minecraft/src/GuiContainer.java @@ -0,0 +1,180 @@ +package net.minecraft.src; + +import org.lwjgl.input.Keyboard; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +public abstract class GuiContainer extends GuiScreen { + private static RenderItem itemRenderer = new RenderItem(); + protected int xSize = 176; + protected int ySize = 166; + public Container inventorySlots; + + public GuiContainer(Container var1) { + this.inventorySlots = var1; + } + + public void initGui() { + super.initGui(); + this.mc.thePlayer.craftingInventory = this.inventorySlots; + } + + public void drawScreen(int var1, int var2, float var3) { + this.drawDefaultBackground(); + int var4 = (this.width - this.xSize) / 2; + int var5 = (this.height - this.ySize) / 2; + this.drawGuiContainerBackgroundLayer(var3); + GL11.glPushMatrix(); + GL11.glRotatef(120.0F, 1.0F, 0.0F, 0.0F); + RenderHelper.enableStandardItemLighting(); + GL11.glPopMatrix(); + GL11.glPushMatrix(); + GL11.glTranslatef((float)var4, (float)var5, 0.0F); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + Slot var6 = null; + + int var9; + int var10; + for(int var7 = 0; var7 < this.inventorySlots.slots.size(); ++var7) { + Slot var8 = (Slot)this.inventorySlots.slots.get(var7); + this.drawSlotInventory(var8); + if(this.getIsMouseOverSlot(var8, var1, var2)) { + var6 = var8; + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glDisable(GL11.GL_DEPTH_TEST); + var9 = var8.xDisplayPosition; + var10 = var8.yDisplayPosition; + this.drawGradientRect(var9, var10, var9 + 16, var10 + 16, -2130706433, -2130706433); + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glEnable(GL11.GL_DEPTH_TEST); + } + } + + InventoryPlayer var12 = this.mc.thePlayer.inventory; + if(var12.getItemStack() != null) { + GL11.glTranslatef(0.0F, 0.0F, 32.0F); + itemRenderer.renderItemIntoGUI(this.fontRenderer, this.mc.renderEngine, var12.getItemStack(), var1 - var4 - 8, var2 - var5 - 8); + itemRenderer.renderItemOverlayIntoGUI(this.fontRenderer, this.mc.renderEngine, var12.getItemStack(), var1 - var4 - 8, var2 - var5 - 8); + } + + GL11.glDisable(GL12.GL_RESCALE_NORMAL); + RenderHelper.disableStandardItemLighting(); + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glDisable(GL11.GL_DEPTH_TEST); + this.drawGuiContainerForegroundLayer(); + if(var12.getItemStack() == null && var6 != null && var6.getHasStack()) { + String var13 = ("" + StringTranslate.getInstance().translateNamedKey(var6.getStack().getItemName())).trim(); + if(var13.length() > 0) { + var9 = var1 - var4 + 12; + var10 = var2 - var5 - 12; + int var11 = this.fontRenderer.getStringWidth(var13); + this.drawGradientRect(var9 - 3, var10 - 3, var9 + var11 + 3, var10 + 8 + 3, -1073741824, -1073741824); + this.fontRenderer.drawStringWithShadow(var13, var9, var10, -1); + } + } + + GL11.glPopMatrix(); + super.drawScreen(var1, var2, var3); + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glEnable(GL11.GL_DEPTH_TEST); + } + + protected void drawGuiContainerForegroundLayer() { + } + + protected abstract void drawGuiContainerBackgroundLayer(float var1); + + private void drawSlotInventory(Slot var1) { + int var2 = var1.xDisplayPosition; + int var3 = var1.yDisplayPosition; + ItemStack var4 = var1.getStack(); + if(var4 == null) { + int var5 = var1.getBackgroundIconIndex(); + if(var5 >= 0) { + GL11.glDisable(GL11.GL_LIGHTING); + this.mc.renderEngine.bindTexture(this.mc.renderEngine.getTexture("/gui/items.png")); + this.drawTexturedModalRect(var2, var3, var5 % 16 * 16, var5 / 16 * 16, 16, 16); + GL11.glEnable(GL11.GL_LIGHTING); + return; + } + } + + itemRenderer.renderItemIntoGUI(this.fontRenderer, this.mc.renderEngine, var4, var2, var3); + itemRenderer.renderItemOverlayIntoGUI(this.fontRenderer, this.mc.renderEngine, var4, var2, var3); + } + + private Slot getSlotAtPosition(int var1, int var2) { + for(int var3 = 0; var3 < this.inventorySlots.slots.size(); ++var3) { + Slot var4 = (Slot)this.inventorySlots.slots.get(var3); + if(this.getIsMouseOverSlot(var4, var1, var2)) { + return var4; + } + } + + return null; + } + + private boolean getIsMouseOverSlot(Slot var1, int var2, int var3) { + int var4 = (this.width - this.xSize) / 2; + int var5 = (this.height - this.ySize) / 2; + var2 -= var4; + var3 -= var5; + return var2 >= var1.xDisplayPosition - 1 && var2 < var1.xDisplayPosition + 16 + 1 && var3 >= var1.yDisplayPosition - 1 && var3 < var1.yDisplayPosition + 16 + 1; + } + + protected void mouseClicked(int var1, int var2, int var3) { + super.mouseClicked(var1, var2, var3); + if(var3 == 0 || var3 == 1) { + Slot var4 = this.getSlotAtPosition(var1, var2); + int var5 = (this.width - this.xSize) / 2; + int var6 = (this.height - this.ySize) / 2; + boolean var7 = var1 < var5 || var2 < var6 || var1 >= var5 + this.xSize || var2 >= var6 + this.ySize; + int var8 = -1; + if(var4 != null) { + var8 = var4.slotNumber; + } + + if(var7) { + var8 = -999; + } + + if(var8 != -1) { + boolean var9 = var8 != -999 && (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)); + this.mc.playerController.func_27174_a(this.inventorySlots.windowId, var8, var3, var9, this.mc.thePlayer); + } + } + + } + + protected void mouseMovedOrUp(int var1, int var2, int var3) { + if(var3 == 0) { + } + + } + + protected void keyTyped(char var1, int var2) { + if(var2 == 1 || var2 == this.mc.gameSettings.keyBindInventory.keyCode) { + this.mc.thePlayer.closeScreen(); + } + + } + + public void onGuiClosed() { + if(this.mc.thePlayer != null) { + this.mc.playerController.func_20086_a(this.inventorySlots.windowId, this.mc.thePlayer); + } + } + + public boolean doesGuiPauseGame() { + return false; + } + + public void updateScreen() { + super.updateScreen(); + if(!this.mc.thePlayer.isEntityAlive() || this.mc.thePlayer.isDead) { + this.mc.thePlayer.closeScreen(); + } + + } +} diff --git a/src/net/minecraft/src/GuiControls.java b/src/net/minecraft/src/GuiControls.java new file mode 100644 index 0000000..f12041f --- /dev/null +++ b/src/net/minecraft/src/GuiControls.java @@ -0,0 +1,66 @@ +package net.minecraft.src; + +public class GuiControls extends GuiScreen { + private GuiScreen parentScreen; + protected String screenTitle = "Controls"; + private GameSettings options; + private int buttonId = -1; + + public GuiControls(GuiScreen var1, GameSettings var2) { + this.parentScreen = var1; + this.options = var2; + } + + private int func_20080_j() { + return this.width / 2 - 155; + } + + public void initGui() { + StringTranslate var1 = StringTranslate.getInstance(); + int var2 = this.func_20080_j(); + + for(int var3 = 0; var3 < this.options.keyBindings.length; ++var3) { + this.controlList.add(new GuiSmallButton(var3, var2 + var3 % 2 * 160, this.height / 6 + 24 * (var3 >> 1), 70, 20, this.options.getOptionDisplayString(var3))); + } + + this.controlList.add(new GuiButton(200, this.width / 2 - 100, this.height / 6 + 168, var1.translateKey("gui.done"))); + this.screenTitle = var1.translateKey("controls.title"); + } + + protected void actionPerformed(GuiButton var1) { + for(int var2 = 0; var2 < this.options.keyBindings.length; ++var2) { + ((GuiButton)this.controlList.get(var2)).displayString = this.options.getOptionDisplayString(var2); + } + + if(var1.id == 200) { + this.mc.displayGuiScreen(this.parentScreen); + } else { + this.buttonId = var1.id; + var1.displayString = "> " + this.options.getOptionDisplayString(var1.id) + " <"; + } + + } + + protected void keyTyped(char var1, int var2) { + if(this.buttonId >= 0) { + this.options.setKeyBinding(this.buttonId, var2); + ((GuiButton)this.controlList.get(this.buttonId)).displayString = this.options.getOptionDisplayString(this.buttonId); + this.buttonId = -1; + } else { + super.keyTyped(var1, var2); + } + + } + + public void drawScreen(int var1, int var2, float var3) { + this.drawDefaultBackground(); + this.drawCenteredString(this.fontRenderer, this.screenTitle, this.width / 2, 20, 16777215); + int var4 = this.func_20080_j(); + + for(int var5 = 0; var5 < this.options.keyBindings.length; ++var5) { + this.drawString(this.fontRenderer, this.options.getKeyBindingDescription(var5), var4 + var5 % 2 * 160 + 70 + 6, this.height / 6 + 24 * (var5 >> 1) + 7, -1); + } + + super.drawScreen(var1, var2, var3); + } +} diff --git a/src/net/minecraft/src/GuiCrafting.java b/src/net/minecraft/src/GuiCrafting.java new file mode 100644 index 0000000..ad8c325 --- /dev/null +++ b/src/net/minecraft/src/GuiCrafting.java @@ -0,0 +1,28 @@ +package net.minecraft.src; + +import org.lwjgl.opengl.GL11; + +public class GuiCrafting extends GuiContainer { + public GuiCrafting(InventoryPlayer var1, World var2, int var3, int var4, int var5) { + super(new ContainerWorkbench(var1, var2, var3, var4, var5)); + } + + public void onGuiClosed() { + super.onGuiClosed(); + this.inventorySlots.onCraftGuiClosed(this.mc.thePlayer); + } + + protected void drawGuiContainerForegroundLayer() { + this.fontRenderer.drawString("Crafting", 28, 6, 4210752); + this.fontRenderer.drawString("Inventory", 8, this.ySize - 96 + 2, 4210752); + } + + protected void drawGuiContainerBackgroundLayer(float var1) { + int var2 = this.mc.renderEngine.getTexture("/gui/crafting.png"); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + this.mc.renderEngine.bindTexture(var2); + int var3 = (this.width - this.xSize) / 2; + int var4 = (this.height - this.ySize) / 2; + this.drawTexturedModalRect(var3, var4, 0, 0, this.xSize, this.ySize); + } +} diff --git a/src/net/minecraft/src/GuiCreateWorld.java b/src/net/minecraft/src/GuiCreateWorld.java new file mode 100644 index 0000000..7382ec6 --- /dev/null +++ b/src/net/minecraft/src/GuiCreateWorld.java @@ -0,0 +1,140 @@ +package net.minecraft.src; + +import java.util.Random; +import org.lwjgl.input.Keyboard; + +public class GuiCreateWorld extends GuiScreen { + private GuiScreen field_22131_a; + private GuiTextField textboxWorldName; + private GuiTextField textboxSeed; + private String folderName; + private boolean createClicked; + + public GuiCreateWorld(GuiScreen var1) { + this.field_22131_a = var1; + } + + public void updateScreen() { + this.textboxWorldName.updateCursorCounter(); + this.textboxSeed.updateCursorCounter(); + } + + public void initGui() { + StringTranslate var1 = StringTranslate.getInstance(); + Keyboard.enableRepeatEvents(true); + this.controlList.clear(); + this.controlList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 96 + 12, var1.translateKey("selectWorld.create"))); + this.controlList.add(new GuiButton(1, this.width / 2 - 100, this.height / 4 + 120 + 12, var1.translateKey("gui.cancel"))); + this.textboxWorldName = new GuiTextField(this, this.fontRenderer, this.width / 2 - 100, 60, 200, 20, var1.translateKey("selectWorld.newWorld")); + this.textboxWorldName.isFocused = true; + this.textboxWorldName.setMaxStringLength(32); + this.textboxSeed = new GuiTextField(this, this.fontRenderer, this.width / 2 - 100, 116, 200, 20, ""); + this.func_22129_j(); + } + + private void func_22129_j() { + this.folderName = this.textboxWorldName.getText().trim(); + char[] var1 = ChatAllowedCharacters.allowedCharactersArray; + int var2 = var1.length; + + for(int var3 = 0; var3 < var2; ++var3) { + char var4 = var1[var3]; + this.folderName = this.folderName.replace(var4, '_'); + } + + if(MathHelper.stringNullOrLengthZero(this.folderName)) { + this.folderName = "World"; + } + + this.folderName = generateUnusedFolderName(this.mc.getSaveLoader(), this.folderName); + } + + public static String generateUnusedFolderName(ISaveFormat var0, String var1) { + while(var0.func_22173_b(var1) != null) { + var1 = var1 + "-"; + } + + return var1; + } + + public void onGuiClosed() { + Keyboard.enableRepeatEvents(false); + } + + protected void actionPerformed(GuiButton var1) { + if(var1.enabled) { + if(var1.id == 1) { + this.mc.displayGuiScreen(this.field_22131_a); + } else if(var1.id == 0) { + this.mc.displayGuiScreen((GuiScreen)null); + if(this.createClicked) { + return; + } + + this.createClicked = true; + long var2 = (new Random()).nextLong(); + String var4 = this.textboxSeed.getText(); + if(!MathHelper.stringNullOrLengthZero(var4)) { + try { + long var5 = Long.parseLong(var4); + if(var5 != 0L) { + var2 = var5; + } + } catch (NumberFormatException var7) { + var2 = (long)var4.hashCode(); + } + } + + this.mc.playerController = new PlayerControllerSP(this.mc); + this.mc.startWorld(this.folderName, this.textboxWorldName.getText(), var2); + this.mc.displayGuiScreen((GuiScreen)null); + } + + } + } + + protected void keyTyped(char var1, int var2) { + if(this.textboxWorldName.isFocused) { + this.textboxWorldName.textboxKeyTyped(var1, var2); + } else { + this.textboxSeed.textboxKeyTyped(var1, var2); + } + + if(var1 == 13) { + this.actionPerformed((GuiButton)this.controlList.get(0)); + } + + ((GuiButton)this.controlList.get(0)).enabled = this.textboxWorldName.getText().length() > 0; + this.func_22129_j(); + } + + protected void mouseClicked(int var1, int var2, int var3) { + super.mouseClicked(var1, var2, var3); + this.textboxWorldName.mouseClicked(var1, var2, var3); + this.textboxSeed.mouseClicked(var1, var2, var3); + } + + public void drawScreen(int var1, int var2, float var3) { + StringTranslate var4 = StringTranslate.getInstance(); + this.drawDefaultBackground(); + this.drawCenteredString(this.fontRenderer, var4.translateKey("selectWorld.create"), this.width / 2, this.height / 4 - 60 + 20, 16777215); + this.drawString(this.fontRenderer, var4.translateKey("selectWorld.enterName"), this.width / 2 - 100, 47, 10526880); + this.drawString(this.fontRenderer, var4.translateKey("selectWorld.resultFolder") + " " + this.folderName, this.width / 2 - 100, 85, 10526880); + this.drawString(this.fontRenderer, var4.translateKey("selectWorld.enterSeed"), this.width / 2 - 100, 104, 10526880); + this.drawString(this.fontRenderer, var4.translateKey("selectWorld.seedInfo"), this.width / 2 - 100, 140, 10526880); + this.textboxWorldName.drawTextBox(); + this.textboxSeed.drawTextBox(); + super.drawScreen(var1, var2, var3); + } + + public void selectNextField() { + if(this.textboxWorldName.isFocused) { + this.textboxWorldName.setFocused(false); + this.textboxSeed.setFocused(true); + } else { + this.textboxWorldName.setFocused(true); + this.textboxSeed.setFocused(false); + } + + } +} diff --git a/src/net/minecraft/src/GuiDispenser.java b/src/net/minecraft/src/GuiDispenser.java new file mode 100644 index 0000000..b144f96 --- /dev/null +++ b/src/net/minecraft/src/GuiDispenser.java @@ -0,0 +1,23 @@ +package net.minecraft.src; + +import org.lwjgl.opengl.GL11; + +public class GuiDispenser extends GuiContainer { + public GuiDispenser(InventoryPlayer var1, TileEntityDispenser var2) { + super(new ContainerDispenser(var1, var2)); + } + + protected void drawGuiContainerForegroundLayer() { + this.fontRenderer.drawString("Dispenser", 60, 6, 4210752); + this.fontRenderer.drawString("Inventory", 8, this.ySize - 96 + 2, 4210752); + } + + protected void drawGuiContainerBackgroundLayer(float var1) { + int var2 = this.mc.renderEngine.getTexture("/gui/trap.png"); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + this.mc.renderEngine.bindTexture(var2); + int var3 = (this.width - this.xSize) / 2; + int var4 = (this.height - this.ySize) / 2; + this.drawTexturedModalRect(var3, var4, 0, 0, this.xSize, this.ySize); + } +} diff --git a/src/net/minecraft/src/GuiDownloadTerrain.java b/src/net/minecraft/src/GuiDownloadTerrain.java new file mode 100644 index 0000000..faab856 --- /dev/null +++ b/src/net/minecraft/src/GuiDownloadTerrain.java @@ -0,0 +1,39 @@ +package net.minecraft.src; + +public class GuiDownloadTerrain extends GuiScreen { + private NetClientHandler netHandler; + private int updateCounter = 0; + + public GuiDownloadTerrain(NetClientHandler var1) { + this.netHandler = var1; + } + + protected void keyTyped(char var1, int var2) { + } + + public void initGui() { + this.controlList.clear(); + } + + public void updateScreen() { + ++this.updateCounter; + if(this.updateCounter % 20 == 0) { + this.netHandler.addToSendQueue(new Packet0KeepAlive()); + } + + if(this.netHandler != null) { + this.netHandler.processReadPackets(); + } + + } + + protected void actionPerformed(GuiButton var1) { + } + + public void drawScreen(int var1, int var2, float var3) { + this.drawBackground(0); + StringTranslate var4 = StringTranslate.getInstance(); + this.drawCenteredString(this.fontRenderer, var4.translateKey("multiplayer.downloadingTerrain"), this.width / 2, this.height / 2 - 50, 16777215); + super.drawScreen(var1, var2, var3); + } +} diff --git a/src/net/minecraft/src/GuiEditSign.java b/src/net/minecraft/src/GuiEditSign.java new file mode 100644 index 0000000..5dccede --- /dev/null +++ b/src/net/minecraft/src/GuiEditSign.java @@ -0,0 +1,105 @@ +package net.minecraft.src; + +import org.lwjgl.input.Keyboard; +import org.lwjgl.opengl.GL11; + +public class GuiEditSign extends GuiScreen { + protected String screenTitle = "Edit sign message:"; + private TileEntitySign entitySign; + private int updateCounter; + private int editLine = 0; + private static final String allowedCharacters = ChatAllowedCharacters.allowedCharacters; + + public GuiEditSign(TileEntitySign var1) { + this.entitySign = var1; + } + + public void initGui() { + this.controlList.clear(); + Keyboard.enableRepeatEvents(true); + this.controlList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 120, "Done")); + } + + public void onGuiClosed() { + Keyboard.enableRepeatEvents(false); + if(this.mc.theWorld.multiplayerWorld) { + this.mc.getSendQueue().addToSendQueue(new Packet130UpdateSign(this.entitySign.xCoord, this.entitySign.yCoord, this.entitySign.zCoord, this.entitySign.signText)); + } + + } + + public void updateScreen() { + ++this.updateCounter; + } + + protected void actionPerformed(GuiButton var1) { + if(var1.enabled) { + if(var1.id == 0) { + this.entitySign.onInventoryChanged(); + this.mc.displayGuiScreen((GuiScreen)null); + } + + } + } + + protected void keyTyped(char var1, int var2) { + if(var2 == 200) { + this.editLine = this.editLine - 1 & 3; + } + + if(var2 == 208 || var2 == 28) { + this.editLine = this.editLine + 1 & 3; + } + + if(var2 == 14 && this.entitySign.signText[this.editLine].length() > 0) { + this.entitySign.signText[this.editLine] = this.entitySign.signText[this.editLine].substring(0, this.entitySign.signText[this.editLine].length() - 1); + } + + if(allowedCharacters.indexOf(var1) >= 0 && this.entitySign.signText[this.editLine].length() < 15) { + this.entitySign.signText[this.editLine] = this.entitySign.signText[this.editLine] + var1; + } + + } + + public void drawScreen(int var1, int var2, float var3) { + this.drawDefaultBackground(); + this.drawCenteredString(this.fontRenderer, this.screenTitle, this.width / 2, 40, 16777215); + GL11.glPushMatrix(); + GL11.glTranslatef((float)(this.width / 2), 0.0F, 50.0F); + float var4 = 93.75F; + GL11.glScalef(-var4, -var4, -var4); + GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F); + Block var5 = this.entitySign.getBlockType(); + if(var5 == Block.signPost) { + float var6 = (float)(this.entitySign.getBlockMetadata() * 360) / 16.0F; + GL11.glRotatef(var6, 0.0F, 1.0F, 0.0F); + GL11.glTranslatef(0.0F, -1.0625F, 0.0F); + } else { + int var8 = this.entitySign.getBlockMetadata(); + float var7 = 0.0F; + if(var8 == 2) { + var7 = 180.0F; + } + + if(var8 == 4) { + var7 = 90.0F; + } + + if(var8 == 5) { + var7 = -90.0F; + } + + GL11.glRotatef(var7, 0.0F, 1.0F, 0.0F); + GL11.glTranslatef(0.0F, -1.0625F, 0.0F); + } + + if(this.updateCounter / 6 % 2 == 0) { + this.entitySign.lineBeingEdited = this.editLine; + } + + TileEntityRenderer.instance.renderTileEntityAt(this.entitySign, -0.5D, -0.75D, -0.5D, 0.0F); + this.entitySign.lineBeingEdited = -1; + GL11.glPopMatrix(); + super.drawScreen(var1, var2, var3); + } +} diff --git a/src/net/minecraft/src/GuiErrorScreen.java b/src/net/minecraft/src/GuiErrorScreen.java new file mode 100644 index 0000000..a8111b2 --- /dev/null +++ b/src/net/minecraft/src/GuiErrorScreen.java @@ -0,0 +1,31 @@ +package net.minecraft.src; + +public class GuiErrorScreen extends GuiScreen { + private int field_28098_a = 0; + + public void updateScreen() { + ++this.field_28098_a; + } + + public void initGui() { + } + + protected void actionPerformed(GuiButton var1) { + } + + protected void keyTyped(char var1, int var2) { + } + + public void drawScreen(int var1, int var2, float var3) { + this.drawDefaultBackground(); + this.drawCenteredString(this.fontRenderer, "Out of memory!", this.width / 2, this.height / 4 - 60 + 20, 16777215); + this.drawString(this.fontRenderer, "Minecraft has run out of memory.", this.width / 2 - 140, this.height / 4 - 60 + 60 + 0, 10526880); + this.drawString(this.fontRenderer, "This could be caused by a bug in the game or by the", this.width / 2 - 140, this.height / 4 - 60 + 60 + 18, 10526880); + this.drawString(this.fontRenderer, "Java Virtual Machine not being allocated enough", this.width / 2 - 140, this.height / 4 - 60 + 60 + 27, 10526880); + this.drawString(this.fontRenderer, "memory. If you are playing in a web browser, try", this.width / 2 - 140, this.height / 4 - 60 + 60 + 36, 10526880); + this.drawString(this.fontRenderer, "downloading the game and playing it offline.", this.width / 2 - 140, this.height / 4 - 60 + 60 + 45, 10526880); + this.drawString(this.fontRenderer, "To prevent level corruption, the current game has quit.", this.width / 2 - 140, this.height / 4 - 60 + 60 + 63, 10526880); + this.drawString(this.fontRenderer, "Please restart the game.", this.width / 2 - 140, this.height / 4 - 60 + 60 + 81, 10526880); + super.drawScreen(var1, var2, var3); + } +} diff --git a/src/net/minecraft/src/GuiFurnace.java b/src/net/minecraft/src/GuiFurnace.java new file mode 100644 index 0000000..1e5211f --- /dev/null +++ b/src/net/minecraft/src/GuiFurnace.java @@ -0,0 +1,34 @@ +package net.minecraft.src; + +import org.lwjgl.opengl.GL11; + +public class GuiFurnace extends GuiContainer { + private TileEntityFurnace furnaceInventory; + + public GuiFurnace(InventoryPlayer var1, TileEntityFurnace var2) { + super(new ContainerFurnace(var1, var2)); + this.furnaceInventory = var2; + } + + protected void drawGuiContainerForegroundLayer() { + this.fontRenderer.drawString("Furnace", 60, 6, 4210752); + this.fontRenderer.drawString("Inventory", 8, this.ySize - 96 + 2, 4210752); + } + + protected void drawGuiContainerBackgroundLayer(float var1) { + int var2 = this.mc.renderEngine.getTexture("/gui/furnace.png"); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + this.mc.renderEngine.bindTexture(var2); + int var3 = (this.width - this.xSize) / 2; + int var4 = (this.height - this.ySize) / 2; + this.drawTexturedModalRect(var3, var4, 0, 0, this.xSize, this.ySize); + int var5; + if(this.furnaceInventory.isBurning()) { + var5 = this.furnaceInventory.getBurnTimeRemainingScaled(12); + this.drawTexturedModalRect(var3 + 56, var4 + 36 + 12 - var5, 176, 12 - var5, 14, var5 + 2); + } + + var5 = this.furnaceInventory.getCookProgressScaled(24); + this.drawTexturedModalRect(var3 + 79, var4 + 34, 176, 14, var5 + 1, 16); + } +} diff --git a/src/net/minecraft/src/GuiGameOver.java b/src/net/minecraft/src/GuiGameOver.java new file mode 100644 index 0000000..5f2f953 --- /dev/null +++ b/src/net/minecraft/src/GuiGameOver.java @@ -0,0 +1,48 @@ +package net.minecraft.src; + +import org.lwjgl.opengl.GL11; + +public class GuiGameOver extends GuiScreen { + public void initGui() { + this.controlList.clear(); + this.controlList.add(new GuiButton(1, this.width / 2 - 100, this.height / 4 + 72, "Respawn")); + this.controlList.add(new GuiButton(2, this.width / 2 - 100, this.height / 4 + 96, "Title menu")); + if(this.mc.session == null) { + ((GuiButton)this.controlList.get(1)).enabled = false; + } + + } + + protected void keyTyped(char var1, int var2) { + } + + protected void actionPerformed(GuiButton var1) { + if(var1.id == 0) { + } + + if(var1.id == 1) { + this.mc.thePlayer.respawnPlayer(); + this.mc.displayGuiScreen((GuiScreen)null); + } + + if(var1.id == 2) { + this.mc.changeWorld1((World)null); + this.mc.displayGuiScreen(new GuiMainMenu()); + } + + } + + public void drawScreen(int var1, int var2, float var3) { + this.drawGradientRect(0, 0, this.width, this.height, 1615855616, -1602211792); + GL11.glPushMatrix(); + GL11.glScalef(2.0F, 2.0F, 2.0F); + this.drawCenteredString(this.fontRenderer, "Game over!", this.width / 2 / 2, 30, 16777215); + GL11.glPopMatrix(); + this.drawCenteredString(this.fontRenderer, "Score: &e" + this.mc.thePlayer.getScore(), this.width / 2, 100, 16777215); + super.drawScreen(var1, var2, var3); + } + + public boolean doesGuiPauseGame() { + return false; + } +} diff --git a/src/net/minecraft/src/GuiIngame.java b/src/net/minecraft/src/GuiIngame.java new file mode 100644 index 0000000..7bad577 --- /dev/null +++ b/src/net/minecraft/src/GuiIngame.java @@ -0,0 +1,410 @@ +package net.minecraft.src; + +import java.awt.Color; +import java.util.ArrayList; +import java.util.List; +import java.util.Random; +import net.minecraft.client.Minecraft; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +public class GuiIngame extends Gui { + private static RenderItem itemRenderer = new RenderItem(); + private List chatMessageList = new ArrayList(); + private Random rand = new Random(); + private Minecraft mc; + public String field_933_a = null; + private int updateCounter = 0; + private String recordPlaying = ""; + private int recordPlayingUpFor = 0; + private boolean field_22065_l = false; + public float damageGuiPartialTime; + float prevVignetteBrightness = 1.0F; + + public GuiIngame(Minecraft var1) { + this.mc = var1; + } + + public void renderGameOverlay(float var1, boolean var2, int var3, int var4) { + ScaledResolution var5 = new ScaledResolution(this.mc.gameSettings, this.mc.displayWidth, this.mc.displayHeight); + int var6 = var5.getScaledWidth(); + int var7 = var5.getScaledHeight(); + FontRenderer var8 = this.mc.fontRenderer; + this.mc.entityRenderer.func_905_b(); + GL11.glEnable(GL11.GL_BLEND); + if(Minecraft.isFancyGraphicsEnabled()) { + this.renderVignette(this.mc.thePlayer.getEntityBrightness(var1), var6, var7); + } + + ItemStack var9 = this.mc.thePlayer.inventory.armorItemInSlot(3); + if(!this.mc.gameSettings.thirdPersonView && var9 != null && var9.itemID == Block.pumpkin.blockID) { + this.renderPumpkinBlur(var6, var7); + } + + float var10 = this.mc.thePlayer.prevTimeInPortal + (this.mc.thePlayer.timeInPortal - this.mc.thePlayer.prevTimeInPortal) * var1; + if(var10 > 0.0F) { + this.renderPortalOverlay(var10, var6, var7); + } + + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture("/gui/gui.png")); + InventoryPlayer var11 = this.mc.thePlayer.inventory; + this.zLevel = -90.0F; + this.drawTexturedModalRect(var6 / 2 - 91, var7 - 22, 0, 0, 182, 22); + this.drawTexturedModalRect(var6 / 2 - 91 - 1 + var11.currentItem * 20, var7 - 22 - 1, 0, 22, 24, 22); + GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture("/gui/icons.png")); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_ONE_MINUS_DST_COLOR, GL11.GL_ONE_MINUS_SRC_COLOR); + this.drawTexturedModalRect(var6 / 2 - 7, var7 / 2 - 7, 0, 0, 16, 16); + GL11.glDisable(GL11.GL_BLEND); + boolean var12 = this.mc.thePlayer.heartsLife / 3 % 2 == 1; + if(this.mc.thePlayer.heartsLife < 10) { + var12 = false; + } + + int var13 = this.mc.thePlayer.health; + int var14 = this.mc.thePlayer.prevHealth; + this.rand.setSeed((long)(this.updateCounter * 312871)); + int var15; + int var16; + int var17; + if(this.mc.playerController.shouldDrawHUD()) { + var15 = this.mc.thePlayer.getPlayerArmorValue(); + + int var18; + for(var16 = 0; var16 < 10; ++var16) { + var17 = var7 - 32; + if(var15 > 0) { + var18 = var6 / 2 + 91 - var16 * 8 - 9; + if(var16 * 2 + 1 < var15) { + this.drawTexturedModalRect(var18, var17, 34, 9, 9, 9); + } + + if(var16 * 2 + 1 == var15) { + this.drawTexturedModalRect(var18, var17, 25, 9, 9, 9); + } + + if(var16 * 2 + 1 > var15) { + this.drawTexturedModalRect(var18, var17, 16, 9, 9, 9); + } + } + + byte var28 = 0; + if(var12) { + var28 = 1; + } + + int var19 = var6 / 2 - 91 + var16 * 8; + if(var13 <= 4) { + var17 += this.rand.nextInt(2); + } + + this.drawTexturedModalRect(var19, var17, 16 + var28 * 9, 0, 9, 9); + if(var12) { + if(var16 * 2 + 1 < var14) { + this.drawTexturedModalRect(var19, var17, 70, 0, 9, 9); + } + + if(var16 * 2 + 1 == var14) { + this.drawTexturedModalRect(var19, var17, 79, 0, 9, 9); + } + } + + if(var16 * 2 + 1 < var13) { + this.drawTexturedModalRect(var19, var17, 52, 0, 9, 9); + } + + if(var16 * 2 + 1 == var13) { + this.drawTexturedModalRect(var19, var17, 61, 0, 9, 9); + } + } + + if(this.mc.thePlayer.isInsideOfMaterial(Material.water)) { + var16 = (int)Math.ceil((double)(this.mc.thePlayer.air - 2) * 10.0D / 300.0D); + var17 = (int)Math.ceil((double)this.mc.thePlayer.air * 10.0D / 300.0D) - var16; + + for(var18 = 0; var18 < var16 + var17; ++var18) { + if(var18 < var16) { + this.drawTexturedModalRect(var6 / 2 - 91 + var18 * 8, var7 - 32 - 9, 16, 18, 9, 9); + } else { + this.drawTexturedModalRect(var6 / 2 - 91 + var18 * 8, var7 - 32 - 9, 25, 18, 9, 9); + } + } + } + } + + GL11.glDisable(GL11.GL_BLEND); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + GL11.glPushMatrix(); + GL11.glRotatef(120.0F, 1.0F, 0.0F, 0.0F); + RenderHelper.enableStandardItemLighting(); + GL11.glPopMatrix(); + + for(var15 = 0; var15 < 9; ++var15) { + var16 = var6 / 2 - 90 + var15 * 20 + 2; + var17 = var7 - 16 - 3; + this.renderInventorySlot(var15, var16, var17, var1); + } + + RenderHelper.disableStandardItemLighting(); + GL11.glDisable(GL12.GL_RESCALE_NORMAL); + if(this.mc.thePlayer.func_22060_M() > 0) { + GL11.glDisable(GL11.GL_DEPTH_TEST); + GL11.glDisable(GL11.GL_ALPHA_TEST); + var15 = this.mc.thePlayer.func_22060_M(); + float var27 = (float)var15 / 100.0F; + if(var27 > 1.0F) { + var27 = 1.0F - (float)(var15 - 100) / 10.0F; + } + + var17 = (int)(220.0F * var27) << 24 | 1052704; + this.drawRect(0, 0, var6, var7, var17); + GL11.glEnable(GL11.GL_ALPHA_TEST); + GL11.glEnable(GL11.GL_DEPTH_TEST); + } + + String var23; + if(this.mc.gameSettings.showDebugInfo) { + GL11.glPushMatrix(); + if(Minecraft.hasPaidCheckTime > 0L) { + GL11.glTranslatef(0.0F, 32.0F, 0.0F); + } + + var8.drawStringWithShadow("Minecraft Beta 1.7.3 (" + this.mc.debug + ")", 2, 2, 16777215); + var8.drawStringWithShadow(this.mc.func_6241_m(), 2, 12, 16777215); + var8.drawStringWithShadow(this.mc.func_6262_n(), 2, 22, 16777215); + var8.drawStringWithShadow(this.mc.func_6245_o(), 2, 32, 16777215); + var8.drawStringWithShadow(this.mc.func_21002_o(), 2, 42, 16777215); + long var24 = Runtime.getRuntime().maxMemory(); + long var29 = Runtime.getRuntime().totalMemory(); + long var30 = Runtime.getRuntime().freeMemory(); + long var21 = var29 - var30; + var23 = "Used memory: " + var21 * 100L / var24 + "% (" + var21 / 1024L / 1024L + "MB) of " + var24 / 1024L / 1024L + "MB"; + this.drawString(var8, var23, var6 - var8.getStringWidth(var23) - 2, 2, 14737632); + var23 = "Allocated memory: " + var29 * 100L / var24 + "% (" + var29 / 1024L / 1024L + "MB)"; + this.drawString(var8, var23, var6 - var8.getStringWidth(var23) - 2, 12, 14737632); + this.drawString(var8, "x: " + this.mc.thePlayer.posX, 2, 64, 14737632); + this.drawString(var8, "y: " + this.mc.thePlayer.posY, 2, 72, 14737632); + this.drawString(var8, "z: " + this.mc.thePlayer.posZ, 2, 80, 14737632); + this.drawString(var8, "f: " + (MathHelper.floor_double((double)(this.mc.thePlayer.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3), 2, 88, 14737632); + GL11.glPopMatrix(); + } + + if(this.recordPlayingUpFor > 0) { + float var25 = (float)this.recordPlayingUpFor - var1; + var16 = (int)(var25 * 256.0F / 20.0F); + if(var16 > 255) { + var16 = 255; + } + + if(var16 > 0) { + GL11.glPushMatrix(); + GL11.glTranslatef((float)(var6 / 2), (float)(var7 - 48), 0.0F); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + var17 = 16777215; + if(this.field_22065_l) { + var17 = Color.HSBtoRGB(var25 / 50.0F, 0.7F, 0.6F) & 16777215; + } + + var8.drawString(this.recordPlaying, -var8.getStringWidth(this.recordPlaying) / 2, -4, var17 + (var16 << 24)); + GL11.glDisable(GL11.GL_BLEND); + GL11.glPopMatrix(); + } + } + + byte var26 = 10; + boolean var31 = false; + if(this.mc.currentScreen instanceof GuiChat) { + var26 = 20; + var31 = true; + } + + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + GL11.glDisable(GL11.GL_ALPHA_TEST); + GL11.glPushMatrix(); + GL11.glTranslatef(0.0F, (float)(var7 - 48), 0.0F); + + for(var17 = 0; var17 < this.chatMessageList.size() && var17 < var26; ++var17) { + if(((ChatLine)this.chatMessageList.get(var17)).updateCounter < 200 || var31) { + double var32 = (double)((ChatLine)this.chatMessageList.get(var17)).updateCounter / 200.0D; + var32 = 1.0D - var32; + var32 *= 10.0D; + if(var32 < 0.0D) { + var32 = 0.0D; + } + + if(var32 > 1.0D) { + var32 = 1.0D; + } + + var32 *= var32; + int var20 = (int)(255.0D * var32); + if(var31) { + var20 = 255; + } + + if(var20 > 0) { + byte var33 = 2; + int var22 = -var17 * 9; + var23 = ((ChatLine)this.chatMessageList.get(var17)).message; + this.drawRect(var33, var22 - 1, var33 + 320, var22 + 8, var20 / 2 << 24); + GL11.glEnable(GL11.GL_BLEND); + var8.drawStringWithShadow(var23, var33, var22, 16777215 + (var20 << 24)); + } + } + } + + GL11.glPopMatrix(); + GL11.glEnable(GL11.GL_ALPHA_TEST); + GL11.glDisable(GL11.GL_BLEND); + } + + private void renderPumpkinBlur(int var1, int var2) { + GL11.glDisable(GL11.GL_DEPTH_TEST); + GL11.glDepthMask(false); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glDisable(GL11.GL_ALPHA_TEST); + GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture("%blur%/misc/pumpkinblur.png")); + Tessellator var3 = Tessellator.instance; + var3.startDrawingQuads(); + var3.addVertexWithUV(0.0D, (double)var2, -90.0D, 0.0D, 1.0D); + var3.addVertexWithUV((double)var1, (double)var2, -90.0D, 1.0D, 1.0D); + var3.addVertexWithUV((double)var1, 0.0D, -90.0D, 1.0D, 0.0D); + var3.addVertexWithUV(0.0D, 0.0D, -90.0D, 0.0D, 0.0D); + var3.draw(); + GL11.glDepthMask(true); + GL11.glEnable(GL11.GL_DEPTH_TEST); + GL11.glEnable(GL11.GL_ALPHA_TEST); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + } + + private void renderVignette(float var1, int var2, int var3) { + var1 = 1.0F - var1; + if(var1 < 0.0F) { + var1 = 0.0F; + } + + if(var1 > 1.0F) { + var1 = 1.0F; + } + + this.prevVignetteBrightness = (float)((double)this.prevVignetteBrightness + (double)(var1 - this.prevVignetteBrightness) * 0.01D); + GL11.glDisable(GL11.GL_DEPTH_TEST); + GL11.glDepthMask(false); + GL11.glBlendFunc(GL11.GL_ZERO, GL11.GL_ONE_MINUS_SRC_COLOR); + GL11.glColor4f(this.prevVignetteBrightness, this.prevVignetteBrightness, this.prevVignetteBrightness, 1.0F); + GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture("%blur%/misc/vignette.png")); + Tessellator var4 = Tessellator.instance; + var4.startDrawingQuads(); + var4.addVertexWithUV(0.0D, (double)var3, -90.0D, 0.0D, 1.0D); + var4.addVertexWithUV((double)var2, (double)var3, -90.0D, 1.0D, 1.0D); + var4.addVertexWithUV((double)var2, 0.0D, -90.0D, 1.0D, 0.0D); + var4.addVertexWithUV(0.0D, 0.0D, -90.0D, 0.0D, 0.0D); + var4.draw(); + GL11.glDepthMask(true); + GL11.glEnable(GL11.GL_DEPTH_TEST); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + } + + private void renderPortalOverlay(float var1, int var2, int var3) { + if(var1 < 1.0F) { + var1 *= var1; + var1 *= var1; + var1 = var1 * 0.8F + 0.2F; + } + + GL11.glDisable(GL11.GL_ALPHA_TEST); + GL11.glDisable(GL11.GL_DEPTH_TEST); + GL11.glDepthMask(false); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + GL11.glColor4f(1.0F, 1.0F, 1.0F, var1); + GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture("/terrain.png")); + float var4 = (float)(Block.portal.blockIndexInTexture % 16) / 16.0F; + float var5 = (float)(Block.portal.blockIndexInTexture / 16) / 16.0F; + float var6 = (float)(Block.portal.blockIndexInTexture % 16 + 1) / 16.0F; + float var7 = (float)(Block.portal.blockIndexInTexture / 16 + 1) / 16.0F; + Tessellator var8 = Tessellator.instance; + var8.startDrawingQuads(); + var8.addVertexWithUV(0.0D, (double)var3, -90.0D, (double)var4, (double)var7); + var8.addVertexWithUV((double)var2, (double)var3, -90.0D, (double)var6, (double)var7); + var8.addVertexWithUV((double)var2, 0.0D, -90.0D, (double)var6, (double)var5); + var8.addVertexWithUV(0.0D, 0.0D, -90.0D, (double)var4, (double)var5); + var8.draw(); + GL11.glDepthMask(true); + GL11.glEnable(GL11.GL_DEPTH_TEST); + GL11.glEnable(GL11.GL_ALPHA_TEST); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + } + + private void renderInventorySlot(int var1, int var2, int var3, float var4) { + ItemStack var5 = this.mc.thePlayer.inventory.mainInventory[var1]; + if(var5 != null) { + float var6 = (float)var5.animationsToGo - var4; + if(var6 > 0.0F) { + GL11.glPushMatrix(); + float var7 = 1.0F + var6 / 5.0F; + GL11.glTranslatef((float)(var2 + 8), (float)(var3 + 12), 0.0F); + GL11.glScalef(1.0F / var7, (var7 + 1.0F) / 2.0F, 1.0F); + GL11.glTranslatef((float)(-(var2 + 8)), (float)(-(var3 + 12)), 0.0F); + } + + itemRenderer.renderItemIntoGUI(this.mc.fontRenderer, this.mc.renderEngine, var5, var2, var3); + if(var6 > 0.0F) { + GL11.glPopMatrix(); + } + + itemRenderer.renderItemOverlayIntoGUI(this.mc.fontRenderer, this.mc.renderEngine, var5, var2, var3); + } + } + + public void updateTick() { + if(this.recordPlayingUpFor > 0) { + --this.recordPlayingUpFor; + } + + ++this.updateCounter; + + for(int var1 = 0; var1 < this.chatMessageList.size(); ++var1) { + ++((ChatLine)this.chatMessageList.get(var1)).updateCounter; + } + + } + + public void clearChatMessages() { + this.chatMessageList.clear(); + } + + public void addChatMessage(String var1) { + while(this.mc.fontRenderer.getStringWidth(var1) > 320) { + int var2; + for(var2 = 1; var2 < var1.length() && this.mc.fontRenderer.getStringWidth(var1.substring(0, var2 + 1)) <= 320; ++var2) { + } + + this.addChatMessage(var1.substring(0, var2)); + var1 = var1.substring(var2); + } + + this.chatMessageList.add(0, new ChatLine(var1)); + + while(this.chatMessageList.size() > 50) { + this.chatMessageList.remove(this.chatMessageList.size() - 1); + } + + } + + public void setRecordPlayingMessage(String var1) { + this.recordPlaying = "Now playing: " + var1; + this.recordPlayingUpFor = 60; + this.field_22065_l = true; + } + + public void addChatMessageTranslate(String var1) { + StringTranslate var2 = StringTranslate.getInstance(); + String var3 = var2.translateKey(var1); + this.addChatMessage(var3); + } +} diff --git a/src/net/minecraft/src/GuiIngameMenu.java b/src/net/minecraft/src/GuiIngameMenu.java new file mode 100644 index 0000000..17eee06 --- /dev/null +++ b/src/net/minecraft/src/GuiIngameMenu.java @@ -0,0 +1,70 @@ +package net.minecraft.src; + +public class GuiIngameMenu extends GuiScreen { + private int updateCounter2 = 0; + private int updateCounter = 0; + + public void initGui() { + this.updateCounter2 = 0; + this.controlList.clear(); + byte var1 = -16; + this.controlList.add(new GuiButton(1, this.width / 2 - 100, this.height / 4 + 120 + var1, "Save and quit to title")); + if(this.mc.isMultiplayerWorld()) { + ((GuiButton)this.controlList.get(0)).displayString = "Disconnect"; + } + + this.controlList.add(new GuiButton(4, this.width / 2 - 100, this.height / 4 + 24 + var1, "Back to game")); + this.controlList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 96 + var1, "Options...")); + this.controlList.add(new GuiButton(5, this.width / 2 - 100, this.height / 4 + 48 + var1, 98, 20, StatCollector.translateToLocal("gui.achievements"))); + this.controlList.add(new GuiButton(6, this.width / 2 + 2, this.height / 4 + 48 + var1, 98, 20, StatCollector.translateToLocal("gui.stats"))); + } + + protected void actionPerformed(GuiButton var1) { + if(var1.id == 0) { + this.mc.displayGuiScreen(new GuiOptions(this, this.mc.gameSettings)); + } + + if(var1.id == 1) { + this.mc.statFileWriter.readStat(StatList.leaveGameStat, 1); + if(this.mc.isMultiplayerWorld()) { + this.mc.theWorld.sendQuittingDisconnectingPacket(); + } + + this.mc.changeWorld1((World)null); + this.mc.displayGuiScreen(new GuiMainMenu()); + } + + if(var1.id == 4) { + this.mc.displayGuiScreen((GuiScreen)null); + this.mc.setIngameFocus(); + } + + if(var1.id == 5) { + this.mc.displayGuiScreen(new GuiAchievements(this.mc.statFileWriter)); + } + + if(var1.id == 6) { + this.mc.displayGuiScreen(new GuiStats(this, this.mc.statFileWriter)); + } + + } + + public void updateScreen() { + super.updateScreen(); + ++this.updateCounter; + } + + public void drawScreen(int var1, int var2, float var3) { + this.drawDefaultBackground(); + boolean var4 = !this.mc.theWorld.func_650_a(this.updateCounter2++); + if(var4 || this.updateCounter < 20) { + float var5 = ((float)(this.updateCounter % 10) + var3) / 10.0F; + var5 = MathHelper.sin(var5 * (float)Math.PI * 2.0F) * 0.2F + 0.8F; + int var6 = (int)(255.0F * var5); + this.drawString(this.fontRenderer, "Saving level..", 8, this.height - 16, var6 << 16 | var6 << 8 | var6); + } + + this.drawCenteredString(this.fontRenderer, "Game menu", this.width / 2, 40, 16777215); + super.drawScreen(var1, var2, var3); + } +} diff --git a/src/net/minecraft/src/GuiInventory.java b/src/net/minecraft/src/GuiInventory.java new file mode 100644 index 0000000..f2dcf0e --- /dev/null +++ b/src/net/minecraft/src/GuiInventory.java @@ -0,0 +1,79 @@ +package net.minecraft.src; + +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +public class GuiInventory extends GuiContainer { + private float xSize_lo; + private float ySize_lo; + + public GuiInventory(EntityPlayer var1) { + super(var1.inventorySlots); + this.field_948_f = true; + var1.addStat(AchievementList.openInventory, 1); + } + + public void initGui() { + this.controlList.clear(); + } + + protected void drawGuiContainerForegroundLayer() { + this.fontRenderer.drawString("Crafting", 86, 16, 4210752); + } + + public void drawScreen(int var1, int var2, float var3) { + super.drawScreen(var1, var2, var3); + this.xSize_lo = (float)var1; + this.ySize_lo = (float)var2; + } + + protected void drawGuiContainerBackgroundLayer(float var1) { + int var2 = this.mc.renderEngine.getTexture("/gui/inventory.png"); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + this.mc.renderEngine.bindTexture(var2); + int var3 = (this.width - this.xSize) / 2; + int var4 = (this.height - this.ySize) / 2; + this.drawTexturedModalRect(var3, var4, 0, 0, this.xSize, this.ySize); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + GL11.glEnable(GL11.GL_COLOR_MATERIAL); + GL11.glPushMatrix(); + GL11.glTranslatef((float)(var3 + 51), (float)(var4 + 75), 50.0F); + float var5 = 30.0F; + GL11.glScalef(-var5, var5, var5); + GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F); + float var6 = this.mc.thePlayer.renderYawOffset; + float var7 = this.mc.thePlayer.rotationYaw; + float var8 = this.mc.thePlayer.rotationPitch; + float var9 = (float)(var3 + 51) - this.xSize_lo; + float var10 = (float)(var4 + 75 - 50) - this.ySize_lo; + GL11.glRotatef(135.0F, 0.0F, 1.0F, 0.0F); + RenderHelper.enableStandardItemLighting(); + GL11.glRotatef(-135.0F, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(-((float)Math.atan((double)(var10 / 40.0F))) * 20.0F, 1.0F, 0.0F, 0.0F); + this.mc.thePlayer.renderYawOffset = (float)Math.atan((double)(var9 / 40.0F)) * 20.0F; + this.mc.thePlayer.rotationYaw = (float)Math.atan((double)(var9 / 40.0F)) * 40.0F; + this.mc.thePlayer.rotationPitch = -((float)Math.atan((double)(var10 / 40.0F))) * 20.0F; + this.mc.thePlayer.entityBrightness = 1.0F; + GL11.glTranslatef(0.0F, this.mc.thePlayer.yOffset, 0.0F); + RenderManager.instance.playerViewY = 180.0F; + RenderManager.instance.renderEntityWithPosYaw(this.mc.thePlayer, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F); + this.mc.thePlayer.entityBrightness = 0.0F; + this.mc.thePlayer.renderYawOffset = var6; + this.mc.thePlayer.rotationYaw = var7; + this.mc.thePlayer.rotationPitch = var8; + GL11.glPopMatrix(); + RenderHelper.disableStandardItemLighting(); + GL11.glDisable(GL12.GL_RESCALE_NORMAL); + } + + protected void actionPerformed(GuiButton var1) { + if(var1.id == 0) { + this.mc.displayGuiScreen(new GuiAchievements(this.mc.statFileWriter)); + } + + if(var1.id == 1) { + this.mc.displayGuiScreen(new GuiStats(this, this.mc.statFileWriter)); + } + + } +} diff --git a/src/net/minecraft/src/GuiMainMenu.java b/src/net/minecraft/src/GuiMainMenu.java new file mode 100644 index 0000000..790d88d --- /dev/null +++ b/src/net/minecraft/src/GuiMainMenu.java @@ -0,0 +1,126 @@ +package net.minecraft.src; + +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.nio.charset.Charset; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.Random; +import org.lwjgl.opengl.GL11; + +public class GuiMainMenu extends GuiScreen { + private static final Random rand = new Random(); + private float updateCounter = 0.0F; + private String splashText = "missingno"; + private GuiButton multiplayerButton; + + public GuiMainMenu() { + try { + ArrayList var1 = new ArrayList(); + BufferedReader var2 = new BufferedReader(new InputStreamReader(GuiMainMenu.class.getResourceAsStream("/title/splashes.txt"), Charset.forName("UTF-8"))); + String var3 = ""; + + while(true) { + var3 = var2.readLine(); + if(var3 == null) { + this.splashText = (String)var1.get(rand.nextInt(var1.size())); + break; + } + + var3 = var3.trim(); + if(var3.length() > 0) { + var1.add(var3); + } + } + } catch (Exception var4) { + } + + } + + public void updateScreen() { + ++this.updateCounter; + } + + protected void keyTyped(char var1, int var2) { + } + + public void initGui() { + Calendar var1 = Calendar.getInstance(); + var1.setTime(new Date()); + if(var1.get(2) + 1 == 11 && var1.get(5) == 9) { + this.splashText = "Happy birthday, ez!"; + } else if(var1.get(2) + 1 == 6 && var1.get(5) == 1) { + this.splashText = "Happy birthday, Notch!"; + } else if(var1.get(2) + 1 == 12 && var1.get(5) == 24) { + this.splashText = "Merry X-mas!"; + } else if(var1.get(2) + 1 == 1 && var1.get(5) == 1) { + this.splashText = "Happy new year!"; + } + + StringTranslate var2 = StringTranslate.getInstance(); + int var4 = this.height / 4 + 48; + this.controlList.add(new GuiButton(1, this.width / 2 - 100, var4, var2.translateKey("menu.singleplayer"))); + this.controlList.add(this.multiplayerButton = new GuiButton(2, this.width / 2 - 100, var4 + 24, var2.translateKey("menu.multiplayer"))); + this.controlList.add(new GuiButton(3, this.width / 2 - 100, var4 + 48, var2.translateKey("menu.mods"))); + if(this.mc.hideQuitButton) { + this.controlList.add(new GuiButton(0, this.width / 2 - 100, var4 + 72, var2.translateKey("menu.options"))); + } else { + this.controlList.add(new GuiButton(0, this.width / 2 - 100, var4 + 72 + 12, 98, 20, var2.translateKey("menu.options"))); + this.controlList.add(new GuiButton(4, this.width / 2 + 2, var4 + 72 + 12, 98, 20, var2.translateKey("menu.quit"))); + } + + if(this.mc.session == null) { + this.multiplayerButton.enabled = false; + } + + } + + protected void actionPerformed(GuiButton var1) { + if(var1.id == 0) { + this.mc.displayGuiScreen(new GuiOptions(this, this.mc.gameSettings)); + } + + if(var1.id == 1) { + this.mc.displayGuiScreen(new GuiSelectWorld(this)); + } + + if(var1.id == 2) { + this.mc.displayGuiScreen(new GuiMultiplayer(this)); + } + + if(var1.id == 3) { + this.mc.displayGuiScreen(new GuiTexturePacks(this)); + } + + if(var1.id == 4) { + this.mc.shutdown(); + } + + } + + public void drawScreen(int var1, int var2, float var3) { + this.drawDefaultBackground(); + Tessellator var4 = Tessellator.instance; + short var5 = 274; + int var6 = this.width / 2 - var5 / 2; + byte var7 = 30; + GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture("/title/mclogo.png")); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + this.drawTexturedModalRect(var6 + 0, var7 + 0, 0, 0, 155, 44); + this.drawTexturedModalRect(var6 + 155, var7 + 0, 0, 45, 155, 44); + var4.setColorOpaque_I(16777215); + GL11.glPushMatrix(); + GL11.glTranslatef((float)(this.width / 2 + 90), 70.0F, 0.0F); + GL11.glRotatef(-20.0F, 0.0F, 0.0F, 1.0F); + float var8 = 1.8F - MathHelper.abs(MathHelper.sin((float)(System.currentTimeMillis() % 1000L) / 1000.0F * (float)Math.PI * 2.0F) * 0.1F); + var8 = var8 * 100.0F / (float)(this.fontRenderer.getStringWidth(this.splashText) + 32); + GL11.glScalef(var8, var8, var8); + this.drawCenteredString(this.fontRenderer, this.splashText, 0, -8, 16776960); + GL11.glPopMatrix(); + this.drawString(this.fontRenderer, "Minecraft Beta 1.7.3", 2, 2, 5263440); + String var9 = "Copyright Mojang AB. Do not distribute."; + this.drawString(this.fontRenderer, var9, this.width - this.fontRenderer.getStringWidth(var9) - 2, this.height - 10, 16777215); + super.drawScreen(var1, var2, var3); + } +} diff --git a/src/net/minecraft/src/GuiMultiplayer.java b/src/net/minecraft/src/GuiMultiplayer.java new file mode 100644 index 0000000..d280149 --- /dev/null +++ b/src/net/minecraft/src/GuiMultiplayer.java @@ -0,0 +1,99 @@ +package net.minecraft.src; + +import org.lwjgl.input.Keyboard; + +public class GuiMultiplayer extends GuiScreen { + private GuiScreen parentScreen; + private GuiTextField field_22111_h; + + public GuiMultiplayer(GuiScreen var1) { + this.parentScreen = var1; + } + + public void updateScreen() { + this.field_22111_h.updateCursorCounter(); + } + + public void initGui() { + StringTranslate var1 = StringTranslate.getInstance(); + Keyboard.enableRepeatEvents(true); + this.controlList.clear(); + this.controlList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 96 + 12, var1.translateKey("multiplayer.connect"))); + this.controlList.add(new GuiButton(1, this.width / 2 - 100, this.height / 4 + 120 + 12, var1.translateKey("gui.cancel"))); + String var2 = this.mc.gameSettings.lastServer.replaceAll("_", ":"); + ((GuiButton)this.controlList.get(0)).enabled = var2.length() > 0; + this.field_22111_h = new GuiTextField(this, this.fontRenderer, this.width / 2 - 100, this.height / 4 - 10 + 50 + 18, 200, 20, var2); + this.field_22111_h.isFocused = true; + this.field_22111_h.setMaxStringLength(128); + } + + public void onGuiClosed() { + Keyboard.enableRepeatEvents(false); + } + + protected void actionPerformed(GuiButton var1) { + if(var1.enabled) { + if(var1.id == 1) { + this.mc.displayGuiScreen(this.parentScreen); + } else if(var1.id == 0) { + String var2 = this.field_22111_h.getText().trim(); + this.mc.gameSettings.lastServer = var2.replaceAll(":", "_"); + this.mc.gameSettings.saveOptions(); + String[] var3 = var2.split(":"); + if(var2.startsWith("[")) { + int var4 = var2.indexOf("]"); + if(var4 > 0) { + String var5 = var2.substring(1, var4); + String var6 = var2.substring(var4 + 1).trim(); + if(var6.startsWith(":") && var6.length() > 0) { + var6 = var6.substring(1); + var3 = new String[]{var5, var6}; + } else { + var3 = new String[]{var5}; + } + } + } + + if(var3.length > 2) { + var3 = new String[]{var2}; + } + + this.mc.displayGuiScreen(new GuiConnecting(this.mc, var3[0], var3.length > 1 ? this.parseIntWithDefault(var3[1], 25565) : 25565)); + } + + } + } + + private int parseIntWithDefault(String var1, int var2) { + try { + return Integer.parseInt(var1.trim()); + } catch (Exception var4) { + return var2; + } + } + + protected void keyTyped(char var1, int var2) { + this.field_22111_h.textboxKeyTyped(var1, var2); + if(var1 == 13) { + this.actionPerformed((GuiButton)this.controlList.get(0)); + } + + ((GuiButton)this.controlList.get(0)).enabled = this.field_22111_h.getText().length() > 0; + } + + protected void mouseClicked(int var1, int var2, int var3) { + super.mouseClicked(var1, var2, var3); + this.field_22111_h.mouseClicked(var1, var2, var3); + } + + public void drawScreen(int var1, int var2, float var3) { + StringTranslate var4 = StringTranslate.getInstance(); + this.drawDefaultBackground(); + this.drawCenteredString(this.fontRenderer, var4.translateKey("multiplayer.title"), this.width / 2, this.height / 4 - 60 + 20, 16777215); + this.drawString(this.fontRenderer, var4.translateKey("multiplayer.info1"), this.width / 2 - 140, this.height / 4 - 60 + 60 + 0, 10526880); + this.drawString(this.fontRenderer, var4.translateKey("multiplayer.info2"), this.width / 2 - 140, this.height / 4 - 60 + 60 + 9, 10526880); + this.drawString(this.fontRenderer, var4.translateKey("multiplayer.ipinfo"), this.width / 2 - 140, this.height / 4 - 60 + 60 + 36, 10526880); + this.field_22111_h.drawTextBox(); + super.drawScreen(var1, var2, var3); + } +} diff --git a/src/net/minecraft/src/GuiOptions.java b/src/net/minecraft/src/GuiOptions.java new file mode 100644 index 0000000..ace9406 --- /dev/null +++ b/src/net/minecraft/src/GuiOptions.java @@ -0,0 +1,67 @@ +package net.minecraft.src; + +public class GuiOptions extends GuiScreen { + private GuiScreen parentScreen; + protected String screenTitle = "Options"; + private GameSettings options; + private static EnumOptions[] field_22135_k = new EnumOptions[]{EnumOptions.MUSIC, EnumOptions.SOUND, EnumOptions.INVERT_MOUSE, EnumOptions.SENSITIVITY, EnumOptions.DIFFICULTY}; + + public GuiOptions(GuiScreen var1, GameSettings var2) { + this.parentScreen = var1; + this.options = var2; + } + + public void initGui() { + StringTranslate var1 = StringTranslate.getInstance(); + this.screenTitle = var1.translateKey("options.title"); + int var2 = 0; + EnumOptions[] var3 = field_22135_k; + int var4 = var3.length; + + for(int var5 = 0; var5 < var4; ++var5) { + EnumOptions var6 = var3[var5]; + if(!var6.getEnumFloat()) { + this.controlList.add(new GuiSmallButton(var6.returnEnumOrdinal(), this.width / 2 - 155 + var2 % 2 * 160, this.height / 6 + 24 * (var2 >> 1), var6, this.options.getKeyBinding(var6))); + } else { + this.controlList.add(new GuiSlider(var6.returnEnumOrdinal(), this.width / 2 - 155 + var2 % 2 * 160, this.height / 6 + 24 * (var2 >> 1), var6, this.options.getKeyBinding(var6), this.options.getOptionFloatValue(var6))); + } + + ++var2; + } + + this.controlList.add(new GuiButton(101, this.width / 2 - 100, this.height / 6 + 96 + 12, var1.translateKey("options.video"))); + this.controlList.add(new GuiButton(100, this.width / 2 - 100, this.height / 6 + 120 + 12, var1.translateKey("options.controls"))); + this.controlList.add(new GuiButton(200, this.width / 2 - 100, this.height / 6 + 168, var1.translateKey("gui.done"))); + } + + protected void actionPerformed(GuiButton var1) { + if(var1.enabled) { + if(var1.id < 100 && var1 instanceof GuiSmallButton) { + this.options.setOptionValue(((GuiSmallButton)var1).returnEnumOptions(), 1); + var1.displayString = this.options.getKeyBinding(EnumOptions.getEnumOptions(var1.id)); + } + + if(var1.id == 101) { + this.mc.gameSettings.saveOptions(); + this.mc.displayGuiScreen(new GuiVideoSettings(this, this.options)); + } + + if(var1.id == 100) { + this.mc.gameSettings.saveOptions(); + this.mc.displayGuiScreen(new GuiControls(this, this.options)); + } + + if(var1.id == 200) { + this.mc.gameSettings.saveOptions(); + this.mc.displayGuiScreen(this.parentScreen); + } + + } + } + + public void drawScreen(int var1, int var2, float var3) { + this.drawDefaultBackground(); + this.drawCenteredString(this.fontRenderer, this.screenTitle, this.width / 2, 20, 16777215); + super.drawScreen(var1, var2, var3); + } +} diff --git a/src/net/minecraft/src/GuiParticle.java b/src/net/minecraft/src/GuiParticle.java new file mode 100644 index 0000000..546bd1f --- /dev/null +++ b/src/net/minecraft/src/GuiParticle.java @@ -0,0 +1,44 @@ +package net.minecraft.src; + +import java.util.ArrayList; +import java.util.List; +import net.minecraft.client.Minecraft; +import org.lwjgl.opengl.GL11; + +public class GuiParticle extends Gui { + private List field_25090_a = new ArrayList(); + private Minecraft field_25089_b; + + public GuiParticle(Minecraft var1) { + this.field_25089_b = var1; + } + + public void func_25088_a() { + for(int var1 = 0; var1 < this.field_25090_a.size(); ++var1) { + Particle var2 = (Particle)this.field_25090_a.get(var1); + var2.func_25127_a(); + var2.func_25125_a(this); + if(var2.field_25139_h) { + this.field_25090_a.remove(var1--); + } + } + + } + + public void func_25087_a(float var1) { + this.field_25089_b.renderEngine.bindTexture(this.field_25089_b.renderEngine.getTexture("/gui/particles.png")); + + for(int var2 = 0; var2 < this.field_25090_a.size(); ++var2) { + Particle var3 = (Particle)this.field_25090_a.get(var2); + int var4 = (int)(var3.field_25144_c + (var3.field_25146_a - var3.field_25144_c) * (double)var1 - 4.0D); + int var5 = (int)(var3.field_25143_d + (var3.field_25145_b - var3.field_25143_d) * (double)var1 - 4.0D); + float var6 = (float)(var3.field_25129_r + (var3.field_25133_n - var3.field_25129_r) * (double)var1); + float var7 = (float)(var3.field_25132_o + (var3.field_25136_k - var3.field_25132_o) * (double)var1); + float var8 = (float)(var3.field_25131_p + (var3.field_25135_l - var3.field_25131_p) * (double)var1); + float var9 = (float)(var3.field_25130_q + (var3.field_25134_m - var3.field_25130_q) * (double)var1); + GL11.glColor4f(var7, var8, var9, var6); + this.drawTexturedModalRect(var4, var5, 40, 0, 8, 8); + } + + } +} diff --git a/src/net/minecraft/src/GuiRenameWorld.java b/src/net/minecraft/src/GuiRenameWorld.java new file mode 100644 index 0000000..2b16789 --- /dev/null +++ b/src/net/minecraft/src/GuiRenameWorld.java @@ -0,0 +1,72 @@ +package net.minecraft.src; + +import org.lwjgl.input.Keyboard; + +public class GuiRenameWorld extends GuiScreen { + private GuiScreen field_22112_a; + private GuiTextField field_22114_h; + private final String field_22113_i; + + public GuiRenameWorld(GuiScreen var1, String var2) { + this.field_22112_a = var1; + this.field_22113_i = var2; + } + + public void updateScreen() { + this.field_22114_h.updateCursorCounter(); + } + + public void initGui() { + StringTranslate var1 = StringTranslate.getInstance(); + Keyboard.enableRepeatEvents(true); + this.controlList.clear(); + this.controlList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 96 + 12, var1.translateKey("selectWorld.renameButton"))); + this.controlList.add(new GuiButton(1, this.width / 2 - 100, this.height / 4 + 120 + 12, var1.translateKey("gui.cancel"))); + ISaveFormat var2 = this.mc.getSaveLoader(); + WorldInfo var3 = var2.func_22173_b(this.field_22113_i); + String var4 = var3.getWorldName(); + this.field_22114_h = new GuiTextField(this, this.fontRenderer, this.width / 2 - 100, 60, 200, 20, var4); + this.field_22114_h.isFocused = true; + this.field_22114_h.setMaxStringLength(32); + } + + public void onGuiClosed() { + Keyboard.enableRepeatEvents(false); + } + + protected void actionPerformed(GuiButton var1) { + if(var1.enabled) { + if(var1.id == 1) { + this.mc.displayGuiScreen(this.field_22112_a); + } else if(var1.id == 0) { + ISaveFormat var2 = this.mc.getSaveLoader(); + var2.func_22170_a(this.field_22113_i, this.field_22114_h.getText().trim()); + this.mc.displayGuiScreen(this.field_22112_a); + } + + } + } + + protected void keyTyped(char var1, int var2) { + this.field_22114_h.textboxKeyTyped(var1, var2); + ((GuiButton)this.controlList.get(0)).enabled = this.field_22114_h.getText().trim().length() > 0; + if(var1 == 13) { + this.actionPerformed((GuiButton)this.controlList.get(0)); + } + + } + + protected void mouseClicked(int var1, int var2, int var3) { + super.mouseClicked(var1, var2, var3); + this.field_22114_h.mouseClicked(var1, var2, var3); + } + + public void drawScreen(int var1, int var2, float var3) { + StringTranslate var4 = StringTranslate.getInstance(); + this.drawDefaultBackground(); + this.drawCenteredString(this.fontRenderer, var4.translateKey("selectWorld.renameTitle"), this.width / 2, this.height / 4 - 60 + 20, 16777215); + this.drawString(this.fontRenderer, var4.translateKey("selectWorld.enterName"), this.width / 2 - 100, 47, 10526880); + this.field_22114_h.drawTextBox(); + super.drawScreen(var1, var2, var3); + } +} diff --git a/src/net/minecraft/src/GuiScreen.java b/src/net/minecraft/src/GuiScreen.java new file mode 100644 index 0000000..8bcdbc3 --- /dev/null +++ b/src/net/minecraft/src/GuiScreen.java @@ -0,0 +1,172 @@ +package net.minecraft.src; + +import java.awt.Toolkit; +import java.awt.datatransfer.DataFlavor; +import java.awt.datatransfer.Transferable; +import java.util.ArrayList; +import java.util.List; +import net.minecraft.client.Minecraft; +import org.lwjgl.input.Keyboard; +import org.lwjgl.input.Mouse; +import org.lwjgl.opengl.GL11; + +public class GuiScreen extends Gui { + protected Minecraft mc; + public int width; + public int height; + protected List controlList = new ArrayList(); + public boolean field_948_f = false; + protected FontRenderer fontRenderer; + public GuiParticle field_25091_h; + private GuiButton selectedButton = null; + + public void drawScreen(int var1, int var2, float var3) { + for(int var4 = 0; var4 < this.controlList.size(); ++var4) { + GuiButton var5 = (GuiButton)this.controlList.get(var4); + var5.drawButton(this.mc, var1, var2); + } + + } + + protected void keyTyped(char var1, int var2) { + if(var2 == 1) { + this.mc.displayGuiScreen((GuiScreen)null); + this.mc.setIngameFocus(); + } + + } + + public static String getClipboardString() { + try { + Transferable var0 = Toolkit.getDefaultToolkit().getSystemClipboard().getContents((Object)null); + if(var0 != null && var0.isDataFlavorSupported(DataFlavor.stringFlavor)) { + String var1 = (String)var0.getTransferData(DataFlavor.stringFlavor); + return var1; + } + } catch (Exception var2) { + } + + return null; + } + + protected void mouseClicked(int var1, int var2, int var3) { + if(var3 == 0) { + for(int var4 = 0; var4 < this.controlList.size(); ++var4) { + GuiButton var5 = (GuiButton)this.controlList.get(var4); + if(var5.mousePressed(this.mc, var1, var2)) { + this.selectedButton = var5; + this.mc.sndManager.playSoundFX("random.click", 1.0F, 1.0F); + this.actionPerformed(var5); + } + } + } + + } + + protected void mouseMovedOrUp(int var1, int var2, int var3) { + if(this.selectedButton != null && var3 == 0) { + this.selectedButton.mouseReleased(var1, var2); + this.selectedButton = null; + } + + } + + protected void actionPerformed(GuiButton var1) { + } + + public void setWorldAndResolution(Minecraft var1, int var2, int var3) { + this.field_25091_h = new GuiParticle(var1); + this.mc = var1; + this.fontRenderer = var1.fontRenderer; + this.width = var2; + this.height = var3; + this.controlList.clear(); + this.initGui(); + } + + public void initGui() { + } + + public void handleInput() { + while(Mouse.next()) { + this.handleMouseInput(); + } + + while(Keyboard.next()) { + this.handleKeyboardInput(); + } + + } + + public void handleMouseInput() { + int var1; + int var2; + if(Mouse.getEventButtonState()) { + var1 = Mouse.getEventX() * this.width / this.mc.displayWidth; + var2 = this.height - Mouse.getEventY() * this.height / this.mc.displayHeight - 1; + this.mouseClicked(var1, var2, Mouse.getEventButton()); + } else { + var1 = Mouse.getEventX() * this.width / this.mc.displayWidth; + var2 = this.height - Mouse.getEventY() * this.height / this.mc.displayHeight - 1; + this.mouseMovedOrUp(var1, var2, Mouse.getEventButton()); + } + + } + + public void handleKeyboardInput() { + if(Keyboard.getEventKeyState()) { + if(Keyboard.getEventKey() == Keyboard.KEY_F11) { + this.mc.toggleFullscreen(); + return; + } + + this.keyTyped(Keyboard.getEventCharacter(), Keyboard.getEventKey()); + } + + } + + public void updateScreen() { + } + + public void onGuiClosed() { + } + + public void drawDefaultBackground() { + this.drawWorldBackground(0); + } + + public void drawWorldBackground(int var1) { + if(this.mc.theWorld != null) { + this.drawGradientRect(0, 0, this.width, this.height, -1072689136, -804253680); + } else { + this.drawBackground(var1); + } + + } + + public void drawBackground(int var1) { + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glDisable(GL11.GL_FOG); + Tessellator var2 = Tessellator.instance; + GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture("/gui/background.png")); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + float var3 = 32.0F; + var2.startDrawingQuads(); + var2.setColorOpaque_I(4210752); + var2.addVertexWithUV(0.0D, (double)this.height, 0.0D, 0.0D, (double)((float)this.height / var3 + (float)var1)); + var2.addVertexWithUV((double)this.width, (double)this.height, 0.0D, (double)((float)this.width / var3), (double)((float)this.height / var3 + (float)var1)); + var2.addVertexWithUV((double)this.width, 0.0D, 0.0D, (double)((float)this.width / var3), (double)(0 + var1)); + var2.addVertexWithUV(0.0D, 0.0D, 0.0D, 0.0D, (double)(0 + var1)); + var2.draw(); + } + + public boolean doesGuiPauseGame() { + return true; + } + + public void deleteWorld(boolean var1, int var2) { + } + + public void selectNextField() { + } +} diff --git a/src/net/minecraft/src/GuiSelectWorld.java b/src/net/minecraft/src/GuiSelectWorld.java new file mode 100644 index 0000000..6a182c4 --- /dev/null +++ b/src/net/minecraft/src/GuiSelectWorld.java @@ -0,0 +1,171 @@ +package net.minecraft.src; + +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.Collections; +import java.util.List; + +public class GuiSelectWorld extends GuiScreen { + private final DateFormat dateFormatter = new SimpleDateFormat(); + protected GuiScreen parentScreen; + protected String screenTitle = "Select world"; + private boolean selected = false; + private int selectedWorld; + private List saveList; + private GuiWorldSlot worldSlotContainer; + private String field_22098_o; + private String field_22097_p; + private boolean deleting; + private GuiButton buttonRename; + private GuiButton buttonSelect; + private GuiButton buttonDelete; + + public GuiSelectWorld(GuiScreen var1) { + this.parentScreen = var1; + } + + public void initGui() { + StringTranslate var1 = StringTranslate.getInstance(); + this.screenTitle = var1.translateKey("selectWorld.title"); + this.field_22098_o = var1.translateKey("selectWorld.world"); + this.field_22097_p = var1.translateKey("selectWorld.conversion"); + this.loadSaves(); + this.worldSlotContainer = new GuiWorldSlot(this); + this.worldSlotContainer.registerScrollButtons(this.controlList, 4, 5); + this.initButtons(); + } + + private void loadSaves() { + ISaveFormat var1 = this.mc.getSaveLoader(); + this.saveList = var1.func_22176_b(); + Collections.sort(this.saveList); + this.selectedWorld = -1; + } + + protected String getSaveFileName(int var1) { + return ((SaveFormatComparator)this.saveList.get(var1)).getFileName(); + } + + protected String getSaveName(int var1) { + String var2 = ((SaveFormatComparator)this.saveList.get(var1)).getDisplayName(); + if(var2 == null || MathHelper.stringNullOrLengthZero(var2)) { + StringTranslate var3 = StringTranslate.getInstance(); + var2 = var3.translateKey("selectWorld.world") + " " + (var1 + 1); + } + + return var2; + } + + public void initButtons() { + StringTranslate var1 = StringTranslate.getInstance(); + this.controlList.add(this.buttonSelect = new GuiButton(1, this.width / 2 - 154, this.height - 52, 150, 20, var1.translateKey("selectWorld.select"))); + this.controlList.add(this.buttonRename = new GuiButton(6, this.width / 2 - 154, this.height - 28, 70, 20, var1.translateKey("selectWorld.rename"))); + this.controlList.add(this.buttonDelete = new GuiButton(2, this.width / 2 - 74, this.height - 28, 70, 20, var1.translateKey("selectWorld.delete"))); + this.controlList.add(new GuiButton(3, this.width / 2 + 4, this.height - 52, 150, 20, var1.translateKey("selectWorld.create"))); + this.controlList.add(new GuiButton(0, this.width / 2 + 4, this.height - 28, 150, 20, var1.translateKey("gui.cancel"))); + this.buttonSelect.enabled = false; + this.buttonRename.enabled = false; + this.buttonDelete.enabled = false; + } + + protected void actionPerformed(GuiButton var1) { + if(var1.enabled) { + if(var1.id == 2) { + String var2 = this.getSaveName(this.selectedWorld); + if(var2 != null) { + this.deleting = true; + StringTranslate var3 = StringTranslate.getInstance(); + String var4 = var3.translateKey("selectWorld.deleteQuestion"); + String var5 = "\'" + var2 + "\' " + var3.translateKey("selectWorld.deleteWarning"); + String var6 = var3.translateKey("selectWorld.deleteButton"); + String var7 = var3.translateKey("gui.cancel"); + GuiYesNo var8 = new GuiYesNo(this, var4, var5, var6, var7, this.selectedWorld); + this.mc.displayGuiScreen(var8); + } + } else if(var1.id == 1) { + this.selectWorld(this.selectedWorld); + } else if(var1.id == 3) { + this.mc.displayGuiScreen(new GuiCreateWorld(this)); + } else if(var1.id == 6) { + this.mc.displayGuiScreen(new GuiRenameWorld(this, this.getSaveFileName(this.selectedWorld))); + } else if(var1.id == 0) { + this.mc.displayGuiScreen(this.parentScreen); + } else { + this.worldSlotContainer.actionPerformed(var1); + } + + } + } + + public void selectWorld(int var1) { + this.mc.displayGuiScreen((GuiScreen)null); + if(!this.selected) { + this.selected = true; + this.mc.playerController = new PlayerControllerSP(this.mc); + String var2 = this.getSaveFileName(var1); + if(var2 == null) { + var2 = "World" + var1; + } + + this.mc.startWorld(var2, this.getSaveName(var1), 0L); + this.mc.displayGuiScreen((GuiScreen)null); + } + } + + public void deleteWorld(boolean var1, int var2) { + if(this.deleting) { + this.deleting = false; + if(var1) { + ISaveFormat var3 = this.mc.getSaveLoader(); + var3.flushCache(); + var3.func_22172_c(this.getSaveFileName(var2)); + this.loadSaves(); + } + + this.mc.displayGuiScreen(this); + } + + } + + public void drawScreen(int var1, int var2, float var3) { + this.worldSlotContainer.drawScreen(var1, var2, var3); + this.drawCenteredString(this.fontRenderer, this.screenTitle, this.width / 2, 20, 16777215); + super.drawScreen(var1, var2, var3); + } + + static List getSize(GuiSelectWorld var0) { + return var0.saveList; + } + + static int onElementSelected(GuiSelectWorld var0, int var1) { + return var0.selectedWorld = var1; + } + + static int getSelectedWorld(GuiSelectWorld var0) { + return var0.selectedWorld; + } + + static GuiButton getSelectButton(GuiSelectWorld var0) { + return var0.buttonSelect; + } + + static GuiButton getRenameButton(GuiSelectWorld var0) { + return var0.buttonRename; + } + + static GuiButton getDeleteButton(GuiSelectWorld var0) { + return var0.buttonDelete; + } + + static String func_22087_f(GuiSelectWorld var0) { + return var0.field_22098_o; + } + + static DateFormat getDateFormatter(GuiSelectWorld var0) { + return var0.dateFormatter; + } + + static String func_22088_h(GuiSelectWorld var0) { + return var0.field_22097_p; + } +} diff --git a/src/net/minecraft/src/GuiSleepMP.java b/src/net/minecraft/src/GuiSleepMP.java new file mode 100644 index 0000000..b7fa741 --- /dev/null +++ b/src/net/minecraft/src/GuiSleepMP.java @@ -0,0 +1,52 @@ +package net.minecraft.src; + +import org.lwjgl.input.Keyboard; + +public class GuiSleepMP extends GuiChat { + public void initGui() { + Keyboard.enableRepeatEvents(true); + StringTranslate var1 = StringTranslate.getInstance(); + this.controlList.add(new GuiButton(1, this.width / 2 - 100, this.height - 40, var1.translateKey("multiplayer.stopSleeping"))); + } + + public void onGuiClosed() { + Keyboard.enableRepeatEvents(false); + } + + protected void keyTyped(char var1, int var2) { + if(var2 == 1) { + this.func_22115_j(); + } else if(var2 == 28) { + String var3 = this.message.trim(); + if(var3.length() > 0) { + this.mc.thePlayer.sendChatMessage(this.message.trim()); + } + + this.message = ""; + } else { + super.keyTyped(var1, var2); + } + + } + + public void drawScreen(int var1, int var2, float var3) { + super.drawScreen(var1, var2, var3); + } + + protected void actionPerformed(GuiButton var1) { + if(var1.id == 1) { + this.func_22115_j(); + } else { + super.actionPerformed(var1); + } + + } + + private void func_22115_j() { + if(this.mc.thePlayer instanceof EntityClientPlayerMP) { + NetClientHandler var1 = ((EntityClientPlayerMP)this.mc.thePlayer).sendQueue; + var1.addToSendQueue(new Packet19EntityAction(this.mc.thePlayer, 3)); + } + + } +} diff --git a/src/net/minecraft/src/GuiSlider.java b/src/net/minecraft/src/GuiSlider.java new file mode 100644 index 0000000..ac21d5e --- /dev/null +++ b/src/net/minecraft/src/GuiSlider.java @@ -0,0 +1,66 @@ +package net.minecraft.src; + +import net.minecraft.client.Minecraft; +import org.lwjgl.opengl.GL11; + +public class GuiSlider extends GuiButton { + public float sliderValue = 1.0F; + public boolean dragging = false; + private EnumOptions idFloat = null; + + public GuiSlider(int var1, int var2, int var3, EnumOptions var4, String var5, float var6) { + super(var1, var2, var3, 150, 20, var5); + this.idFloat = var4; + this.sliderValue = var6; + } + + protected int getHoverState(boolean var1) { + return 0; + } + + protected void mouseDragged(Minecraft var1, int var2, int var3) { + if(this.enabled2) { + if(this.dragging) { + this.sliderValue = (float)(var2 - (this.xPosition + 4)) / (float)(this.width - 8); + if(this.sliderValue < 0.0F) { + this.sliderValue = 0.0F; + } + + if(this.sliderValue > 1.0F) { + this.sliderValue = 1.0F; + } + + var1.gameSettings.setOptionFloatValue(this.idFloat, this.sliderValue); + this.displayString = var1.gameSettings.getKeyBinding(this.idFloat); + } + + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + this.drawTexturedModalRect(this.xPosition + (int)(this.sliderValue * (float)(this.width - 8)), this.yPosition, 0, 66, 4, 20); + this.drawTexturedModalRect(this.xPosition + (int)(this.sliderValue * (float)(this.width - 8)) + 4, this.yPosition, 196, 66, 4, 20); + } + } + + public boolean mousePressed(Minecraft var1, int var2, int var3) { + if(super.mousePressed(var1, var2, var3)) { + this.sliderValue = (float)(var2 - (this.xPosition + 4)) / (float)(this.width - 8); + if(this.sliderValue < 0.0F) { + this.sliderValue = 0.0F; + } + + if(this.sliderValue > 1.0F) { + this.sliderValue = 1.0F; + } + + var1.gameSettings.setOptionFloatValue(this.idFloat, this.sliderValue); + this.displayString = var1.gameSettings.getKeyBinding(this.idFloat); + this.dragging = true; + return true; + } else { + return false; + } + } + + public void mouseReleased(int var1, int var2) { + this.dragging = false; + } +} diff --git a/src/net/minecraft/src/GuiSlot.java b/src/net/minecraft/src/GuiSlot.java new file mode 100644 index 0000000..6e68cc9 --- /dev/null +++ b/src/net/minecraft/src/GuiSlot.java @@ -0,0 +1,318 @@ +package net.minecraft.src; + +import java.util.List; +import net.minecraft.client.Minecraft; +import org.lwjgl.input.Mouse; +import org.lwjgl.opengl.GL11; + +public abstract class GuiSlot { + private final Minecraft mc; + private final int width; + private final int height; + protected final int top; + protected final int bottom; + private final int right; + private final int left; + protected final int posZ; + private int scrollUpButtonID; + private int scrollDownButtonID; + private float initialClickY = -2.0F; + private float scrollMultiplier; + private float amountScrolled; + private int selectedElement = -1; + private long lastClicked = 0L; + private boolean field_25123_p = true; + private boolean field_27262_q; + private int field_27261_r; + + public GuiSlot(Minecraft var1, int var2, int var3, int var4, int var5, int var6) { + this.mc = var1; + this.width = var2; + this.height = var3; + this.top = var4; + this.bottom = var5; + this.posZ = var6; + this.left = 0; + this.right = var2; + } + + public void func_27258_a(boolean var1) { + this.field_25123_p = var1; + } + + protected void func_27259_a(boolean var1, int var2) { + this.field_27262_q = var1; + this.field_27261_r = var2; + if(!var1) { + this.field_27261_r = 0; + } + + } + + protected abstract int getSize(); + + protected abstract void elementClicked(int var1, boolean var2); + + protected abstract boolean isSelected(int var1); + + protected int getContentHeight() { + return this.getSize() * this.posZ + this.field_27261_r; + } + + protected abstract void drawBackground(); + + protected abstract void drawSlot(int var1, int var2, int var3, int var4, Tessellator var5); + + protected void func_27260_a(int var1, int var2, Tessellator var3) { + } + + protected void func_27255_a(int var1, int var2) { + } + + protected void func_27257_b(int var1, int var2) { + } + + public int func_27256_c(int var1, int var2) { + int var3 = this.width / 2 - 110; + int var4 = this.width / 2 + 110; + int var5 = var2 - this.top - this.field_27261_r + (int)this.amountScrolled - 4; + int var6 = var5 / this.posZ; + return var1 >= var3 && var1 <= var4 && var6 >= 0 && var5 >= 0 && var6 < this.getSize() ? var6 : -1; + } + + public void registerScrollButtons(List var1, int var2, int var3) { + this.scrollUpButtonID = var2; + this.scrollDownButtonID = var3; + } + + private void bindAmountScrolled() { + int var1 = this.getContentHeight() - (this.bottom - this.top - 4); + if(var1 < 0) { + var1 /= 2; + } + + if(this.amountScrolled < 0.0F) { + this.amountScrolled = 0.0F; + } + + if(this.amountScrolled > (float)var1) { + this.amountScrolled = (float)var1; + } + + } + + public void actionPerformed(GuiButton var1) { + if(var1.enabled) { + if(var1.id == this.scrollUpButtonID) { + this.amountScrolled -= (float)(this.posZ * 2 / 3); + this.initialClickY = -2.0F; + this.bindAmountScrolled(); + } else if(var1.id == this.scrollDownButtonID) { + this.amountScrolled += (float)(this.posZ * 2 / 3); + this.initialClickY = -2.0F; + this.bindAmountScrolled(); + } + + } + } + + public void drawScreen(int var1, int var2, float var3) { + this.drawBackground(); + int var4 = this.getSize(); + int var5 = this.width / 2 + 124; + int var6 = var5 + 6; + int var9; + int var10; + int var11; + int var13; + int var19; + if(Mouse.isButtonDown(0)) { + if(this.initialClickY == -1.0F) { + boolean var7 = true; + if(var2 >= this.top && var2 <= this.bottom) { + int var8 = this.width / 2 - 110; + var9 = this.width / 2 + 110; + var10 = var2 - this.top - this.field_27261_r + (int)this.amountScrolled - 4; + var11 = var10 / this.posZ; + if(var1 >= var8 && var1 <= var9 && var11 >= 0 && var10 >= 0 && var11 < var4) { + boolean var12 = var11 == this.selectedElement && System.currentTimeMillis() - this.lastClicked < 250L; + this.elementClicked(var11, var12); + this.selectedElement = var11; + this.lastClicked = System.currentTimeMillis(); + } else if(var1 >= var8 && var1 <= var9 && var10 < 0) { + this.func_27255_a(var1 - var8, var2 - this.top + (int)this.amountScrolled - 4); + var7 = false; + } + + if(var1 >= var5 && var1 <= var6) { + this.scrollMultiplier = -1.0F; + var19 = this.getContentHeight() - (this.bottom - this.top - 4); + if(var19 < 1) { + var19 = 1; + } + + var13 = (int)((float)((this.bottom - this.top) * (this.bottom - this.top)) / (float)this.getContentHeight()); + if(var13 < 32) { + var13 = 32; + } + + if(var13 > this.bottom - this.top - 8) { + var13 = this.bottom - this.top - 8; + } + + this.scrollMultiplier /= (float)(this.bottom - this.top - var13) / (float)var19; + } else { + this.scrollMultiplier = 1.0F; + } + + if(var7) { + this.initialClickY = (float)var2; + } else { + this.initialClickY = -2.0F; + } + } else { + this.initialClickY = -2.0F; + } + } else if(this.initialClickY >= 0.0F) { + this.amountScrolled -= ((float)var2 - this.initialClickY) * this.scrollMultiplier; + this.initialClickY = (float)var2; + } + } else { + this.initialClickY = -1.0F; + } + + this.bindAmountScrolled(); + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glDisable(GL11.GL_FOG); + Tessellator var16 = Tessellator.instance; + GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture("/gui/background.png")); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + float var17 = 32.0F; + var16.startDrawingQuads(); + var16.setColorOpaque_I(2105376); + var16.addVertexWithUV((double)this.left, (double)this.bottom, 0.0D, (double)((float)this.left / var17), (double)((float)(this.bottom + (int)this.amountScrolled) / var17)); + var16.addVertexWithUV((double)this.right, (double)this.bottom, 0.0D, (double)((float)this.right / var17), (double)((float)(this.bottom + (int)this.amountScrolled) / var17)); + var16.addVertexWithUV((double)this.right, (double)this.top, 0.0D, (double)((float)this.right / var17), (double)((float)(this.top + (int)this.amountScrolled) / var17)); + var16.addVertexWithUV((double)this.left, (double)this.top, 0.0D, (double)((float)this.left / var17), (double)((float)(this.top + (int)this.amountScrolled) / var17)); + var16.draw(); + var9 = this.width / 2 - 92 - 16; + var10 = this.top + 4 - (int)this.amountScrolled; + if(this.field_27262_q) { + this.func_27260_a(var9, var10, var16); + } + + int var14; + for(var11 = 0; var11 < var4; ++var11) { + var19 = var10 + var11 * this.posZ + this.field_27261_r; + var13 = this.posZ - 4; + if(var19 <= this.bottom && var19 + var13 >= this.top) { + if(this.field_25123_p && this.isSelected(var11)) { + var14 = this.width / 2 - 110; + int var15 = this.width / 2 + 110; + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glDisable(GL11.GL_TEXTURE_2D); + var16.startDrawingQuads(); + var16.setColorOpaque_I(8421504); + var16.addVertexWithUV((double)var14, (double)(var19 + var13 + 2), 0.0D, 0.0D, 1.0D); + var16.addVertexWithUV((double)var15, (double)(var19 + var13 + 2), 0.0D, 1.0D, 1.0D); + var16.addVertexWithUV((double)var15, (double)(var19 - 2), 0.0D, 1.0D, 0.0D); + var16.addVertexWithUV((double)var14, (double)(var19 - 2), 0.0D, 0.0D, 0.0D); + var16.setColorOpaque_I(0); + var16.addVertexWithUV((double)(var14 + 1), (double)(var19 + var13 + 1), 0.0D, 0.0D, 1.0D); + var16.addVertexWithUV((double)(var15 - 1), (double)(var19 + var13 + 1), 0.0D, 1.0D, 1.0D); + var16.addVertexWithUV((double)(var15 - 1), (double)(var19 - 1), 0.0D, 1.0D, 0.0D); + var16.addVertexWithUV((double)(var14 + 1), (double)(var19 - 1), 0.0D, 0.0D, 0.0D); + var16.draw(); + GL11.glEnable(GL11.GL_TEXTURE_2D); + } + + this.drawSlot(var11, var9, var19, var13, var16); + } + } + + GL11.glDisable(GL11.GL_DEPTH_TEST); + byte var18 = 4; + this.overlayBackground(0, this.top, 255, 255); + this.overlayBackground(this.bottom, this.height, 255, 255); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + GL11.glDisable(GL11.GL_ALPHA_TEST); + GL11.glShadeModel(GL11.GL_SMOOTH); + GL11.glDisable(GL11.GL_TEXTURE_2D); + var16.startDrawingQuads(); + var16.setColorRGBA_I(0, 0); + var16.addVertexWithUV((double)this.left, (double)(this.top + var18), 0.0D, 0.0D, 1.0D); + var16.addVertexWithUV((double)this.right, (double)(this.top + var18), 0.0D, 1.0D, 1.0D); + var16.setColorRGBA_I(0, 255); + var16.addVertexWithUV((double)this.right, (double)this.top, 0.0D, 1.0D, 0.0D); + var16.addVertexWithUV((double)this.left, (double)this.top, 0.0D, 0.0D, 0.0D); + var16.draw(); + var16.startDrawingQuads(); + var16.setColorRGBA_I(0, 255); + var16.addVertexWithUV((double)this.left, (double)this.bottom, 0.0D, 0.0D, 1.0D); + var16.addVertexWithUV((double)this.right, (double)this.bottom, 0.0D, 1.0D, 1.0D); + var16.setColorRGBA_I(0, 0); + var16.addVertexWithUV((double)this.right, (double)(this.bottom - var18), 0.0D, 1.0D, 0.0D); + var16.addVertexWithUV((double)this.left, (double)(this.bottom - var18), 0.0D, 0.0D, 0.0D); + var16.draw(); + var19 = this.getContentHeight() - (this.bottom - this.top - 4); + if(var19 > 0) { + var13 = (this.bottom - this.top) * (this.bottom - this.top) / this.getContentHeight(); + if(var13 < 32) { + var13 = 32; + } + + if(var13 > this.bottom - this.top - 8) { + var13 = this.bottom - this.top - 8; + } + + var14 = (int)this.amountScrolled * (this.bottom - this.top - var13) / var19 + this.top; + if(var14 < this.top) { + var14 = this.top; + } + + var16.startDrawingQuads(); + var16.setColorRGBA_I(0, 255); + var16.addVertexWithUV((double)var5, (double)this.bottom, 0.0D, 0.0D, 1.0D); + var16.addVertexWithUV((double)var6, (double)this.bottom, 0.0D, 1.0D, 1.0D); + var16.addVertexWithUV((double)var6, (double)this.top, 0.0D, 1.0D, 0.0D); + var16.addVertexWithUV((double)var5, (double)this.top, 0.0D, 0.0D, 0.0D); + var16.draw(); + var16.startDrawingQuads(); + var16.setColorRGBA_I(8421504, 255); + var16.addVertexWithUV((double)var5, (double)(var14 + var13), 0.0D, 0.0D, 1.0D); + var16.addVertexWithUV((double)var6, (double)(var14 + var13), 0.0D, 1.0D, 1.0D); + var16.addVertexWithUV((double)var6, (double)var14, 0.0D, 1.0D, 0.0D); + var16.addVertexWithUV((double)var5, (double)var14, 0.0D, 0.0D, 0.0D); + var16.draw(); + var16.startDrawingQuads(); + var16.setColorRGBA_I(12632256, 255); + var16.addVertexWithUV((double)var5, (double)(var14 + var13 - 1), 0.0D, 0.0D, 1.0D); + var16.addVertexWithUV((double)(var6 - 1), (double)(var14 + var13 - 1), 0.0D, 1.0D, 1.0D); + var16.addVertexWithUV((double)(var6 - 1), (double)var14, 0.0D, 1.0D, 0.0D); + var16.addVertexWithUV((double)var5, (double)var14, 0.0D, 0.0D, 0.0D); + var16.draw(); + } + + this.func_27257_b(var1, var2); + GL11.glEnable(GL11.GL_TEXTURE_2D); + GL11.glShadeModel(GL11.GL_FLAT); + GL11.glEnable(GL11.GL_ALPHA_TEST); + GL11.glDisable(GL11.GL_BLEND); + } + + private void overlayBackground(int var1, int var2, int var3, int var4) { + Tessellator var5 = Tessellator.instance; + GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture("/gui/background.png")); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + float var6 = 32.0F; + var5.startDrawingQuads(); + var5.setColorRGBA_I(4210752, var4); + var5.addVertexWithUV(0.0D, (double)var2, 0.0D, 0.0D, (double)((float)var2 / var6)); + var5.addVertexWithUV((double)this.width, (double)var2, 0.0D, (double)((float)this.width / var6), (double)((float)var2 / var6)); + var5.setColorRGBA_I(4210752, var3); + var5.addVertexWithUV((double)this.width, (double)var1, 0.0D, (double)((float)this.width / var6), (double)((float)var1 / var6)); + var5.addVertexWithUV(0.0D, (double)var1, 0.0D, 0.0D, (double)((float)var1 / var6)); + var5.draw(); + } +} diff --git a/src/net/minecraft/src/GuiSlotStats.java b/src/net/minecraft/src/GuiSlotStats.java new file mode 100644 index 0000000..e8f6709 --- /dev/null +++ b/src/net/minecraft/src/GuiSlotStats.java @@ -0,0 +1,183 @@ +package net.minecraft.src; + +import java.util.Collections; +import java.util.Comparator; +import java.util.List; +import org.lwjgl.input.Mouse; + +abstract class GuiSlotStats extends GuiSlot { + protected int field_27268_b; + protected List field_27273_c; + protected Comparator field_27272_d; + protected int field_27271_e; + protected int field_27270_f; + final GuiStats field_27269_g; + + protected GuiSlotStats(GuiStats var1) { + super(GuiStats.func_27143_f(var1), var1.width, var1.height, 32, var1.height - 64, 20); + this.field_27269_g = var1; + this.field_27268_b = -1; + this.field_27271_e = -1; + this.field_27270_f = 0; + this.func_27258_a(false); + this.func_27259_a(true, 20); + } + + protected void elementClicked(int var1, boolean var2) { + } + + protected boolean isSelected(int var1) { + return false; + } + + protected void drawBackground() { + this.field_27269_g.drawDefaultBackground(); + } + + protected void func_27260_a(int var1, int var2, Tessellator var3) { + if(!Mouse.isButtonDown(0)) { + this.field_27268_b = -1; + } + + if(this.field_27268_b == 0) { + GuiStats.func_27128_a(this.field_27269_g, var1 + 115 - 18, var2 + 1, 0, 0); + } else { + GuiStats.func_27128_a(this.field_27269_g, var1 + 115 - 18, var2 + 1, 0, 18); + } + + if(this.field_27268_b == 1) { + GuiStats.func_27128_a(this.field_27269_g, var1 + 165 - 18, var2 + 1, 0, 0); + } else { + GuiStats.func_27128_a(this.field_27269_g, var1 + 165 - 18, var2 + 1, 0, 18); + } + + if(this.field_27268_b == 2) { + GuiStats.func_27128_a(this.field_27269_g, var1 + 215 - 18, var2 + 1, 0, 0); + } else { + GuiStats.func_27128_a(this.field_27269_g, var1 + 215 - 18, var2 + 1, 0, 18); + } + + if(this.field_27271_e != -1) { + short var4 = 79; + byte var5 = 18; + if(this.field_27271_e == 1) { + var4 = 129; + } else if(this.field_27271_e == 2) { + var4 = 179; + } + + if(this.field_27270_f == 1) { + var5 = 36; + } + + GuiStats.func_27128_a(this.field_27269_g, var1 + var4, var2 + 1, var5, 0); + } + + } + + protected void func_27255_a(int var1, int var2) { + this.field_27268_b = -1; + if(var1 >= 79 && var1 < 115) { + this.field_27268_b = 0; + } else if(var1 >= 129 && var1 < 165) { + this.field_27268_b = 1; + } else if(var1 >= 179 && var1 < 215) { + this.field_27268_b = 2; + } + + if(this.field_27268_b >= 0) { + this.func_27266_c(this.field_27268_b); + GuiStats.func_27149_g(this.field_27269_g).sndManager.playSoundFX("random.click", 1.0F, 1.0F); + } + + } + + protected final int getSize() { + return this.field_27273_c.size(); + } + + protected final StatCrafting func_27264_b(int var1) { + return (StatCrafting)this.field_27273_c.get(var1); + } + + protected abstract String func_27263_a(int var1); + + protected void func_27265_a(StatCrafting var1, int var2, int var3, boolean var4) { + String var5; + if(var1 != null) { + var5 = var1.func_27084_a(GuiStats.func_27142_c(this.field_27269_g).writeStat(var1)); + this.field_27269_g.drawString(GuiStats.func_27133_h(this.field_27269_g), var5, var2 - GuiStats.func_27137_i(this.field_27269_g).getStringWidth(var5), var3 + 5, var4 ? 16777215 : 9474192); + } else { + var5 = "-"; + this.field_27269_g.drawString(GuiStats.func_27132_j(this.field_27269_g), var5, var2 - GuiStats.func_27134_k(this.field_27269_g).getStringWidth(var5), var3 + 5, var4 ? 16777215 : 9474192); + } + + } + + protected void func_27257_b(int var1, int var2) { + if(var2 >= this.top && var2 <= this.bottom) { + int var3 = this.func_27256_c(var1, var2); + int var4 = this.field_27269_g.width / 2 - 92 - 16; + if(var3 >= 0) { + if(var1 < var4 + 40 || var1 > var4 + 40 + 20) { + return; + } + + StatCrafting var9 = this.func_27264_b(var3); + this.func_27267_a(var9, var1, var2); + } else { + String var5 = ""; + if(var1 >= var4 + 115 - 18 && var1 <= var4 + 115) { + var5 = this.func_27263_a(0); + } else if(var1 >= var4 + 165 - 18 && var1 <= var4 + 165) { + var5 = this.func_27263_a(1); + } else { + if(var1 < var4 + 215 - 18 || var1 > var4 + 215) { + return; + } + + var5 = this.func_27263_a(2); + } + + var5 = ("" + StringTranslate.getInstance().translateKey(var5)).trim(); + if(var5.length() > 0) { + int var6 = var1 + 12; + int var7 = var2 - 12; + int var8 = GuiStats.func_27139_l(this.field_27269_g).getStringWidth(var5); + GuiStats.func_27129_a(this.field_27269_g, var6 - 3, var7 - 3, var6 + var8 + 3, var7 + 8 + 3, -1073741824, -1073741824); + GuiStats.func_27144_m(this.field_27269_g).drawStringWithShadow(var5, var6, var7, -1); + } + } + + } + } + + protected void func_27267_a(StatCrafting var1, int var2, int var3) { + if(var1 != null) { + Item var4 = Item.itemsList[var1.func_25072_b()]; + String var5 = ("" + StringTranslate.getInstance().translateNamedKey(var4.getItemName())).trim(); + if(var5.length() > 0) { + int var6 = var2 + 12; + int var7 = var3 - 12; + int var8 = GuiStats.func_27127_n(this.field_27269_g).getStringWidth(var5); + GuiStats.func_27135_b(this.field_27269_g, var6 - 3, var7 - 3, var6 + var8 + 3, var7 + 8 + 3, -1073741824, -1073741824); + GuiStats.func_27131_o(this.field_27269_g).drawStringWithShadow(var5, var6, var7, -1); + } + + } + } + + protected void func_27266_c(int var1) { + if(var1 != this.field_27271_e) { + this.field_27271_e = var1; + this.field_27270_f = -1; + } else if(this.field_27270_f == -1) { + this.field_27270_f = 1; + } else { + this.field_27271_e = -1; + this.field_27270_f = 0; + } + + Collections.sort(this.field_27273_c, this.field_27272_d); + } +} diff --git a/src/net/minecraft/src/GuiSlotStatsBlock.java b/src/net/minecraft/src/GuiSlotStatsBlock.java new file mode 100644 index 0000000..e8ebbbf --- /dev/null +++ b/src/net/minecraft/src/GuiSlotStatsBlock.java @@ -0,0 +1,69 @@ +package net.minecraft.src; + +import java.util.ArrayList; +import java.util.Iterator; + +class GuiSlotStatsBlock extends GuiSlotStats { + final GuiStats field_27274_a; + + public GuiSlotStatsBlock(GuiStats var1) { + super(var1); + this.field_27274_a = var1; + this.field_27273_c = new ArrayList(); + Iterator var2 = StatList.field_25185_d.iterator(); + + while(var2.hasNext()) { + StatCrafting var3 = (StatCrafting)var2.next(); + boolean var4 = false; + int var5 = var3.func_25072_b(); + if(GuiStats.func_27142_c(var1).writeStat(var3) > 0) { + var4 = true; + } else if(StatList.field_25172_A[var5] != null && GuiStats.func_27142_c(var1).writeStat(StatList.field_25172_A[var5]) > 0) { + var4 = true; + } else if(StatList.field_25158_z[var5] != null && GuiStats.func_27142_c(var1).writeStat(StatList.field_25158_z[var5]) > 0) { + var4 = true; + } + + if(var4) { + this.field_27273_c.add(var3); + } + } + + this.field_27272_d = new SorterStatsBlock(this, var1); + } + + protected void func_27260_a(int var1, int var2, Tessellator var3) { + super.func_27260_a(var1, var2, var3); + if(this.field_27268_b == 0) { + GuiStats.func_27128_a(this.field_27274_a, var1 + 115 - 18 + 1, var2 + 1 + 1, 18, 18); + } else { + GuiStats.func_27128_a(this.field_27274_a, var1 + 115 - 18, var2 + 1, 18, 18); + } + + if(this.field_27268_b == 1) { + GuiStats.func_27128_a(this.field_27274_a, var1 + 165 - 18 + 1, var2 + 1 + 1, 36, 18); + } else { + GuiStats.func_27128_a(this.field_27274_a, var1 + 165 - 18, var2 + 1, 36, 18); + } + + if(this.field_27268_b == 2) { + GuiStats.func_27128_a(this.field_27274_a, var1 + 215 - 18 + 1, var2 + 1 + 1, 54, 18); + } else { + GuiStats.func_27128_a(this.field_27274_a, var1 + 215 - 18, var2 + 1, 54, 18); + } + + } + + protected void drawSlot(int var1, int var2, int var3, int var4, Tessellator var5) { + StatCrafting var6 = this.func_27264_b(var1); + int var7 = var6.func_25072_b(); + GuiStats.func_27148_a(this.field_27274_a, var2 + 40, var3, var7); + this.func_27265_a((StatCrafting)StatList.field_25158_z[var7], var2 + 115, var3, var1 % 2 == 0); + this.func_27265_a((StatCrafting)StatList.field_25172_A[var7], var2 + 165, var3, var1 % 2 == 0); + this.func_27265_a(var6, var2 + 215, var3, var1 % 2 == 0); + } + + protected String func_27263_a(int var1) { + return var1 == 0 ? "stat.crafted" : (var1 == 1 ? "stat.used" : "stat.mined"); + } +} diff --git a/src/net/minecraft/src/GuiSlotStatsGeneral.java b/src/net/minecraft/src/GuiSlotStatsGeneral.java new file mode 100644 index 0000000..9664f69 --- /dev/null +++ b/src/net/minecraft/src/GuiSlotStatsGeneral.java @@ -0,0 +1,37 @@ +package net.minecraft.src; + +class GuiSlotStatsGeneral extends GuiSlot { + final GuiStats field_27276_a; + + public GuiSlotStatsGeneral(GuiStats var1) { + super(GuiStats.func_27141_a(var1), var1.width, var1.height, 32, var1.height - 64, 10); + this.field_27276_a = var1; + this.func_27258_a(false); + } + + protected int getSize() { + return StatList.field_25187_b.size(); + } + + protected void elementClicked(int var1, boolean var2) { + } + + protected boolean isSelected(int var1) { + return false; + } + + protected int getContentHeight() { + return this.getSize() * 10; + } + + protected void drawBackground() { + this.field_27276_a.drawDefaultBackground(); + } + + protected void drawSlot(int var1, int var2, int var3, int var4, Tessellator var5) { + StatBase var6 = (StatBase)StatList.field_25187_b.get(var1); + this.field_27276_a.drawString(GuiStats.func_27145_b(this.field_27276_a), var6.statName, var2 + 2, var3 + 1, var1 % 2 == 0 ? 16777215 : 9474192); + String var7 = var6.func_27084_a(GuiStats.func_27142_c(this.field_27276_a).writeStat(var6)); + this.field_27276_a.drawString(GuiStats.func_27140_d(this.field_27276_a), var7, var2 + 2 + 213 - GuiStats.func_27146_e(this.field_27276_a).getStringWidth(var7), var3 + 1, var1 % 2 == 0 ? 16777215 : 9474192); + } +} diff --git a/src/net/minecraft/src/GuiSlotStatsItem.java b/src/net/minecraft/src/GuiSlotStatsItem.java new file mode 100644 index 0000000..2f7a90b --- /dev/null +++ b/src/net/minecraft/src/GuiSlotStatsItem.java @@ -0,0 +1,69 @@ +package net.minecraft.src; + +import java.util.ArrayList; +import java.util.Iterator; + +class GuiSlotStatsItem extends GuiSlotStats { + final GuiStats field_27275_a; + + public GuiSlotStatsItem(GuiStats var1) { + super(var1); + this.field_27275_a = var1; + this.field_27273_c = new ArrayList(); + Iterator var2 = StatList.field_25186_c.iterator(); + + while(var2.hasNext()) { + StatCrafting var3 = (StatCrafting)var2.next(); + boolean var4 = false; + int var5 = var3.func_25072_b(); + if(GuiStats.func_27142_c(var1).writeStat(var3) > 0) { + var4 = true; + } else if(StatList.field_25170_B[var5] != null && GuiStats.func_27142_c(var1).writeStat(StatList.field_25170_B[var5]) > 0) { + var4 = true; + } else if(StatList.field_25158_z[var5] != null && GuiStats.func_27142_c(var1).writeStat(StatList.field_25158_z[var5]) > 0) { + var4 = true; + } + + if(var4) { + this.field_27273_c.add(var3); + } + } + + this.field_27272_d = new SorterStatsItem(this, var1); + } + + protected void func_27260_a(int var1, int var2, Tessellator var3) { + super.func_27260_a(var1, var2, var3); + if(this.field_27268_b == 0) { + GuiStats.func_27128_a(this.field_27275_a, var1 + 115 - 18 + 1, var2 + 1 + 1, 72, 18); + } else { + GuiStats.func_27128_a(this.field_27275_a, var1 + 115 - 18, var2 + 1, 72, 18); + } + + if(this.field_27268_b == 1) { + GuiStats.func_27128_a(this.field_27275_a, var1 + 165 - 18 + 1, var2 + 1 + 1, 18, 18); + } else { + GuiStats.func_27128_a(this.field_27275_a, var1 + 165 - 18, var2 + 1, 18, 18); + } + + if(this.field_27268_b == 2) { + GuiStats.func_27128_a(this.field_27275_a, var1 + 215 - 18 + 1, var2 + 1 + 1, 36, 18); + } else { + GuiStats.func_27128_a(this.field_27275_a, var1 + 215 - 18, var2 + 1, 36, 18); + } + + } + + protected void drawSlot(int var1, int var2, int var3, int var4, Tessellator var5) { + StatCrafting var6 = this.func_27264_b(var1); + int var7 = var6.func_25072_b(); + GuiStats.func_27148_a(this.field_27275_a, var2 + 40, var3, var7); + this.func_27265_a((StatCrafting)StatList.field_25170_B[var7], var2 + 115, var3, var1 % 2 == 0); + this.func_27265_a((StatCrafting)StatList.field_25158_z[var7], var2 + 165, var3, var1 % 2 == 0); + this.func_27265_a(var6, var2 + 215, var3, var1 % 2 == 0); + } + + protected String func_27263_a(int var1) { + return var1 == 1 ? "stat.crafted" : (var1 == 2 ? "stat.used" : "stat.depleted"); + } +} diff --git a/src/net/minecraft/src/GuiSmallButton.java b/src/net/minecraft/src/GuiSmallButton.java new file mode 100644 index 0000000..e9eb33f --- /dev/null +++ b/src/net/minecraft/src/GuiSmallButton.java @@ -0,0 +1,23 @@ +package net.minecraft.src; + +public class GuiSmallButton extends GuiButton { + private final EnumOptions enumOptions; + + public GuiSmallButton(int var1, int var2, int var3, String var4) { + this(var1, var2, var3, (EnumOptions)null, var4); + } + + public GuiSmallButton(int var1, int var2, int var3, int var4, int var5, String var6) { + super(var1, var2, var3, var4, var5, var6); + this.enumOptions = null; + } + + public GuiSmallButton(int var1, int var2, int var3, EnumOptions var4, String var5) { + super(var1, var2, var3, 150, 20, var5); + this.enumOptions = var4; + } + + public EnumOptions returnEnumOptions() { + return this.enumOptions; + } +} diff --git a/src/net/minecraft/src/GuiStats.java b/src/net/minecraft/src/GuiStats.java new file mode 100644 index 0000000..0ef60ec --- /dev/null +++ b/src/net/minecraft/src/GuiStats.java @@ -0,0 +1,182 @@ +package net.minecraft.src; + +import java.util.List; +import net.minecraft.client.Minecraft; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +public class GuiStats extends GuiScreen { + private static RenderItem field_27153_j = new RenderItem(); + protected GuiScreen field_27152_a; + protected String field_27154_i = "Select world"; + private GuiSlotStatsGeneral field_27151_l; + private GuiSlotStatsItem field_27150_m; + private GuiSlotStatsBlock field_27157_n; + private StatFileWriter field_27156_o; + private GuiSlot field_27155_p = null; + + public GuiStats(GuiScreen var1, StatFileWriter var2) { + this.field_27152_a = var1; + this.field_27156_o = var2; + } + + public void initGui() { + this.field_27154_i = StatCollector.translateToLocal("gui.stats"); + this.field_27151_l = new GuiSlotStatsGeneral(this); + this.field_27151_l.registerScrollButtons(this.controlList, 1, 1); + this.field_27150_m = new GuiSlotStatsItem(this); + this.field_27150_m.registerScrollButtons(this.controlList, 1, 1); + this.field_27157_n = new GuiSlotStatsBlock(this); + this.field_27157_n.registerScrollButtons(this.controlList, 1, 1); + this.field_27155_p = this.field_27151_l; + this.func_27130_k(); + } + + public void func_27130_k() { + StringTranslate var1 = StringTranslate.getInstance(); + this.controlList.add(new GuiButton(0, this.width / 2 + 4, this.height - 28, 150, 20, var1.translateKey("gui.done"))); + this.controlList.add(new GuiButton(1, this.width / 2 - 154, this.height - 52, 100, 20, var1.translateKey("stat.generalButton"))); + List var10000 = this.controlList; + GuiButton var2 = new GuiButton(2, this.width / 2 - 46, this.height - 52, 100, 20, var1.translateKey("stat.blocksButton")); + var10000.add(var2); + var10000 = this.controlList; + GuiButton var3 = new GuiButton(3, this.width / 2 + 62, this.height - 52, 100, 20, var1.translateKey("stat.itemsButton")); + var10000.add(var3); + if(this.field_27157_n.getSize() == 0) { + var2.enabled = false; + } + + if(this.field_27150_m.getSize() == 0) { + var3.enabled = false; + } + + } + + protected void actionPerformed(GuiButton var1) { + if(var1.enabled) { + if(var1.id == 0) { + this.mc.displayGuiScreen(this.field_27152_a); + } else if(var1.id == 1) { + this.field_27155_p = this.field_27151_l; + } else if(var1.id == 3) { + this.field_27155_p = this.field_27150_m; + } else if(var1.id == 2) { + this.field_27155_p = this.field_27157_n; + } else { + this.field_27155_p.actionPerformed(var1); + } + + } + } + + public void drawScreen(int var1, int var2, float var3) { + this.field_27155_p.drawScreen(var1, var2, var3); + this.drawCenteredString(this.fontRenderer, this.field_27154_i, this.width / 2, 20, 16777215); + super.drawScreen(var1, var2, var3); + } + + private void func_27138_c(int var1, int var2, int var3) { + this.func_27147_a(var1 + 1, var2 + 1); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + GL11.glPushMatrix(); + GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F); + RenderHelper.enableStandardItemLighting(); + GL11.glPopMatrix(); + field_27153_j.drawItemIntoGui(this.fontRenderer, this.mc.renderEngine, var3, 0, Item.itemsList[var3].getIconFromDamage(0), var1 + 2, var2 + 2); + RenderHelper.disableStandardItemLighting(); + GL11.glDisable(GL12.GL_RESCALE_NORMAL); + } + + private void func_27147_a(int var1, int var2) { + this.func_27136_c(var1, var2, 0, 0); + } + + private void func_27136_c(int var1, int var2, int var3, int var4) { + int var5 = this.mc.renderEngine.getTexture("/gui/slot.png"); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + this.mc.renderEngine.bindTexture(var5); + Tessellator var10 = Tessellator.instance; + var10.startDrawingQuads(); + var10.addVertexWithUV((double)(var1 + 0), (double)(var2 + 18), (double)this.zLevel, (double)((float)(var3 + 0) * 0.0078125F), (double)((float)(var4 + 18) * 0.0078125F)); + var10.addVertexWithUV((double)(var1 + 18), (double)(var2 + 18), (double)this.zLevel, (double)((float)(var3 + 18) * 0.0078125F), (double)((float)(var4 + 18) * 0.0078125F)); + var10.addVertexWithUV((double)(var1 + 18), (double)(var2 + 0), (double)this.zLevel, (double)((float)(var3 + 18) * 0.0078125F), (double)((float)(var4 + 0) * 0.0078125F)); + var10.addVertexWithUV((double)(var1 + 0), (double)(var2 + 0), (double)this.zLevel, (double)((float)(var3 + 0) * 0.0078125F), (double)((float)(var4 + 0) * 0.0078125F)); + var10.draw(); + } + + static Minecraft func_27141_a(GuiStats var0) { + return var0.mc; + } + + static FontRenderer func_27145_b(GuiStats var0) { + return var0.fontRenderer; + } + + static StatFileWriter func_27142_c(GuiStats var0) { + return var0.field_27156_o; + } + + static FontRenderer func_27140_d(GuiStats var0) { + return var0.fontRenderer; + } + + static FontRenderer func_27146_e(GuiStats var0) { + return var0.fontRenderer; + } + + static Minecraft func_27143_f(GuiStats var0) { + return var0.mc; + } + + static void func_27128_a(GuiStats var0, int var1, int var2, int var3, int var4) { + var0.func_27136_c(var1, var2, var3, var4); + } + + static Minecraft func_27149_g(GuiStats var0) { + return var0.mc; + } + + static FontRenderer func_27133_h(GuiStats var0) { + return var0.fontRenderer; + } + + static FontRenderer func_27137_i(GuiStats var0) { + return var0.fontRenderer; + } + + static FontRenderer func_27132_j(GuiStats var0) { + return var0.fontRenderer; + } + + static FontRenderer func_27134_k(GuiStats var0) { + return var0.fontRenderer; + } + + static FontRenderer func_27139_l(GuiStats var0) { + return var0.fontRenderer; + } + + static void func_27129_a(GuiStats var0, int var1, int var2, int var3, int var4, int var5, int var6) { + var0.drawGradientRect(var1, var2, var3, var4, var5, var6); + } + + static FontRenderer func_27144_m(GuiStats var0) { + return var0.fontRenderer; + } + + static FontRenderer func_27127_n(GuiStats var0) { + return var0.fontRenderer; + } + + static void func_27135_b(GuiStats var0, int var1, int var2, int var3, int var4, int var5, int var6) { + var0.drawGradientRect(var1, var2, var3, var4, var5, var6); + } + + static FontRenderer func_27131_o(GuiStats var0) { + return var0.fontRenderer; + } + + static void func_27148_a(GuiStats var0, int var1, int var2, int var3) { + var0.func_27138_c(var1, var2, var3); + } +} diff --git a/src/net/minecraft/src/GuiTextField.java b/src/net/minecraft/src/GuiTextField.java new file mode 100644 index 0000000..1abf880 --- /dev/null +++ b/src/net/minecraft/src/GuiTextField.java @@ -0,0 +1,99 @@ +package net.minecraft.src; + +public class GuiTextField extends Gui { + private final FontRenderer fontRenderer; + private final int xPos; + private final int yPos; + private final int width; + private final int height; + private String text; + private int maxStringLength; + private int cursorCounter; + public boolean isFocused = false; + public boolean isEnabled = true; + private GuiScreen parentGuiScreen; + + public GuiTextField(GuiScreen var1, FontRenderer var2, int var3, int var4, int var5, int var6, String var7) { + this.parentGuiScreen = var1; + this.fontRenderer = var2; + this.xPos = var3; + this.yPos = var4; + this.width = var5; + this.height = var6; + this.setText(var7); + } + + public void setText(String var1) { + this.text = var1; + } + + public String getText() { + return this.text; + } + + public void updateCursorCounter() { + ++this.cursorCounter; + } + + public void textboxKeyTyped(char var1, int var2) { + if(this.isEnabled && this.isFocused) { + if(var1 == 9) { + this.parentGuiScreen.selectNextField(); + } + + if(var1 == 22) { + String var3 = GuiScreen.getClipboardString(); + if(var3 == null) { + var3 = ""; + } + + int var4 = 32 - this.text.length(); + if(var4 > var3.length()) { + var4 = var3.length(); + } + + if(var4 > 0) { + this.text = this.text + var3.substring(0, var4); + } + } + + if(var2 == 14 && this.text.length() > 0) { + this.text = this.text.substring(0, this.text.length() - 1); + } + + if(ChatAllowedCharacters.allowedCharacters.indexOf(var1) >= 0 && (this.text.length() < this.maxStringLength || this.maxStringLength == 0)) { + this.text = this.text + var1; + } + + } + } + + public void mouseClicked(int var1, int var2, int var3) { + boolean var4 = this.isEnabled && var1 >= this.xPos && var1 < this.xPos + this.width && var2 >= this.yPos && var2 < this.yPos + this.height; + this.setFocused(var4); + } + + public void setFocused(boolean var1) { + if(var1 && !this.isFocused) { + this.cursorCounter = 0; + } + + this.isFocused = var1; + } + + public void drawTextBox() { + this.drawRect(this.xPos - 1, this.yPos - 1, this.xPos + this.width + 1, this.yPos + this.height + 1, -6250336); + this.drawRect(this.xPos, this.yPos, this.xPos + this.width, this.yPos + this.height, -16777216); + if(this.isEnabled) { + boolean var1 = this.isFocused && this.cursorCounter / 6 % 2 == 0; + this.drawString(this.fontRenderer, this.text + (var1 ? "_" : ""), this.xPos + 4, this.yPos + (this.height - 8) / 2, 14737632); + } else { + this.drawString(this.fontRenderer, this.text, this.xPos + 4, this.yPos + (this.height - 8) / 2, 7368816); + } + + } + + public void setMaxStringLength(int var1) { + this.maxStringLength = var1; + } +} diff --git a/src/net/minecraft/src/GuiTexturePackSlot.java b/src/net/minecraft/src/GuiTexturePackSlot.java new file mode 100644 index 0000000..ab1433f --- /dev/null +++ b/src/net/minecraft/src/GuiTexturePackSlot.java @@ -0,0 +1,53 @@ +package net.minecraft.src; + +import java.util.List; +import org.lwjgl.opengl.GL11; + +class GuiTexturePackSlot extends GuiSlot { + final GuiTexturePacks parentTexturePackGui; + + public GuiTexturePackSlot(GuiTexturePacks var1) { + super(GuiTexturePacks.func_22124_a(var1), var1.width, var1.height, 32, var1.height - 55 + 4, 36); + this.parentTexturePackGui = var1; + } + + protected int getSize() { + List var1 = GuiTexturePacks.func_22126_b(this.parentTexturePackGui).texturePackList.availableTexturePacks(); + return var1.size(); + } + + protected void elementClicked(int var1, boolean var2) { + List var3 = GuiTexturePacks.func_22119_c(this.parentTexturePackGui).texturePackList.availableTexturePacks(); + GuiTexturePacks.func_22122_d(this.parentTexturePackGui).texturePackList.setTexturePack((TexturePackBase)var3.get(var1)); + GuiTexturePacks.func_22117_e(this.parentTexturePackGui).renderEngine.refreshTextures(); + } + + protected boolean isSelected(int var1) { + List var2 = GuiTexturePacks.func_22118_f(this.parentTexturePackGui).texturePackList.availableTexturePacks(); + return GuiTexturePacks.func_22116_g(this.parentTexturePackGui).texturePackList.selectedTexturePack == var2.get(var1); + } + + protected int getContentHeight() { + return this.getSize() * 36; + } + + protected void drawBackground() { + this.parentTexturePackGui.drawDefaultBackground(); + } + + protected void drawSlot(int var1, int var2, int var3, int var4, Tessellator var5) { + TexturePackBase var6 = (TexturePackBase)GuiTexturePacks.func_22121_h(this.parentTexturePackGui).texturePackList.availableTexturePacks().get(var1); + var6.bindThumbnailTexture(GuiTexturePacks.func_22123_i(this.parentTexturePackGui)); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + var5.startDrawingQuads(); + var5.setColorOpaque_I(16777215); + var5.addVertexWithUV((double)var2, (double)(var3 + var4), 0.0D, 0.0D, 1.0D); + var5.addVertexWithUV((double)(var2 + 32), (double)(var3 + var4), 0.0D, 1.0D, 1.0D); + var5.addVertexWithUV((double)(var2 + 32), (double)var3, 0.0D, 1.0D, 0.0D); + var5.addVertexWithUV((double)var2, (double)var3, 0.0D, 0.0D, 0.0D); + var5.draw(); + this.parentTexturePackGui.drawString(GuiTexturePacks.func_22127_j(this.parentTexturePackGui), var6.texturePackFileName, var2 + 32 + 2, var3 + 1, 16777215); + this.parentTexturePackGui.drawString(GuiTexturePacks.func_22120_k(this.parentTexturePackGui), var6.firstDescriptionLine, var2 + 32 + 2, var3 + 12, 8421504); + this.parentTexturePackGui.drawString(GuiTexturePacks.func_22125_l(this.parentTexturePackGui), var6.secondDescriptionLine, var2 + 32 + 2, var3 + 12 + 10, 8421504); + } +} diff --git a/src/net/minecraft/src/GuiTexturePacks.java b/src/net/minecraft/src/GuiTexturePacks.java new file mode 100644 index 0000000..8982bdd --- /dev/null +++ b/src/net/minecraft/src/GuiTexturePacks.java @@ -0,0 +1,114 @@ +package net.minecraft.src; + +import java.io.File; +import net.minecraft.client.Minecraft; +import org.lwjgl.Sys; + +public class GuiTexturePacks extends GuiScreen { + protected GuiScreen guiScreen; + private int field_6454_o = -1; + private String fileLocation = ""; + private GuiTexturePackSlot guiTexturePackSlot; + + public GuiTexturePacks(GuiScreen var1) { + this.guiScreen = var1; + } + + public void initGui() { + StringTranslate var1 = StringTranslate.getInstance(); + this.controlList.add(new GuiSmallButton(5, this.width / 2 - 154, this.height - 48, var1.translateKey("texturePack.openFolder"))); + this.controlList.add(new GuiSmallButton(6, this.width / 2 + 4, this.height - 48, var1.translateKey("gui.done"))); + this.mc.texturePackList.updateAvaliableTexturePacks(); + this.fileLocation = (new File(Minecraft.getMinecraftDir(), "texturepacks")).getAbsolutePath(); + this.guiTexturePackSlot = new GuiTexturePackSlot(this); + this.guiTexturePackSlot.registerScrollButtons(this.controlList, 7, 8); + } + + protected void actionPerformed(GuiButton var1) { + if(var1.enabled) { + if(var1.id == 5) { + Sys.openURL("file://" + this.fileLocation); + } else if(var1.id == 6) { + this.mc.renderEngine.refreshTextures(); + this.mc.displayGuiScreen(this.guiScreen); + } else { + this.guiTexturePackSlot.actionPerformed(var1); + } + + } + } + + protected void mouseClicked(int var1, int var2, int var3) { + super.mouseClicked(var1, var2, var3); + } + + protected void mouseMovedOrUp(int var1, int var2, int var3) { + super.mouseMovedOrUp(var1, var2, var3); + } + + public void drawScreen(int var1, int var2, float var3) { + this.guiTexturePackSlot.drawScreen(var1, var2, var3); + if(this.field_6454_o <= 0) { + this.mc.texturePackList.updateAvaliableTexturePacks(); + this.field_6454_o += 20; + } + + StringTranslate var4 = StringTranslate.getInstance(); + this.drawCenteredString(this.fontRenderer, var4.translateKey("texturePack.title"), this.width / 2, 16, 16777215); + this.drawCenteredString(this.fontRenderer, var4.translateKey("texturePack.folderInfo"), this.width / 2 - 77, this.height - 26, 8421504); + super.drawScreen(var1, var2, var3); + } + + public void updateScreen() { + super.updateScreen(); + --this.field_6454_o; + } + + static Minecraft func_22124_a(GuiTexturePacks var0) { + return var0.mc; + } + + static Minecraft func_22126_b(GuiTexturePacks var0) { + return var0.mc; + } + + static Minecraft func_22119_c(GuiTexturePacks var0) { + return var0.mc; + } + + static Minecraft func_22122_d(GuiTexturePacks var0) { + return var0.mc; + } + + static Minecraft func_22117_e(GuiTexturePacks var0) { + return var0.mc; + } + + static Minecraft func_22118_f(GuiTexturePacks var0) { + return var0.mc; + } + + static Minecraft func_22116_g(GuiTexturePacks var0) { + return var0.mc; + } + + static Minecraft func_22121_h(GuiTexturePacks var0) { + return var0.mc; + } + + static Minecraft func_22123_i(GuiTexturePacks var0) { + return var0.mc; + } + + static FontRenderer func_22127_j(GuiTexturePacks var0) { + return var0.fontRenderer; + } + + static FontRenderer func_22120_k(GuiTexturePacks var0) { + return var0.fontRenderer; + } + + static FontRenderer func_22125_l(GuiTexturePacks var0) { + return var0.fontRenderer; + } +} diff --git a/src/net/minecraft/src/GuiUnused.java b/src/net/minecraft/src/GuiUnused.java new file mode 100644 index 0000000..8d6de16 --- /dev/null +++ b/src/net/minecraft/src/GuiUnused.java @@ -0,0 +1,19 @@ +package net.minecraft.src; + +public class GuiUnused extends GuiScreen { + private String message1; + private String message2; + + public void initGui() { + } + + public void drawScreen(int var1, int var2, float var3) { + this.drawGradientRect(0, 0, this.width, this.height, -12574688, -11530224); + this.drawCenteredString(this.fontRenderer, this.message1, this.width / 2, 90, 16777215); + this.drawCenteredString(this.fontRenderer, this.message2, this.width / 2, 110, 16777215); + super.drawScreen(var1, var2, var3); + } + + protected void keyTyped(char var1, int var2) { + } +} diff --git a/src/net/minecraft/src/GuiVideoSettings.java b/src/net/minecraft/src/GuiVideoSettings.java new file mode 100644 index 0000000..1872adc --- /dev/null +++ b/src/net/minecraft/src/GuiVideoSettings.java @@ -0,0 +1,59 @@ +package net.minecraft.src; + +public class GuiVideoSettings extends GuiScreen { + private GuiScreen field_22110_h; + protected String field_22107_a = "Video Settings"; + private GameSettings guiGameSettings; + private static EnumOptions[] field_22108_k = new EnumOptions[]{EnumOptions.GRAPHICS, EnumOptions.RENDER_DISTANCE, EnumOptions.AMBIENT_OCCLUSION, EnumOptions.FRAMERATE_LIMIT, EnumOptions.ANAGLYPH, EnumOptions.VIEW_BOBBING, EnumOptions.GUI_SCALE, EnumOptions.ADVANCED_OPENGL}; + + public GuiVideoSettings(GuiScreen var1, GameSettings var2) { + this.field_22110_h = var1; + this.guiGameSettings = var2; + } + + public void initGui() { + StringTranslate var1 = StringTranslate.getInstance(); + this.field_22107_a = var1.translateKey("options.videoTitle"); + int var2 = 0; + EnumOptions[] var3 = field_22108_k; + int var4 = var3.length; + + for(int var5 = 0; var5 < var4; ++var5) { + EnumOptions var6 = var3[var5]; + if(!var6.getEnumFloat()) { + this.controlList.add(new GuiSmallButton(var6.returnEnumOrdinal(), this.width / 2 - 155 + var2 % 2 * 160, this.height / 6 + 24 * (var2 >> 1), var6, this.guiGameSettings.getKeyBinding(var6))); + } else { + this.controlList.add(new GuiSlider(var6.returnEnumOrdinal(), this.width / 2 - 155 + var2 % 2 * 160, this.height / 6 + 24 * (var2 >> 1), var6, this.guiGameSettings.getKeyBinding(var6), this.guiGameSettings.getOptionFloatValue(var6))); + } + + ++var2; + } + + this.controlList.add(new GuiButton(200, this.width / 2 - 100, this.height / 6 + 168, var1.translateKey("gui.done"))); + } + + protected void actionPerformed(GuiButton var1) { + if(var1.enabled) { + if(var1.id < 100 && var1 instanceof GuiSmallButton) { + this.guiGameSettings.setOptionValue(((GuiSmallButton)var1).returnEnumOptions(), 1); + var1.displayString = this.guiGameSettings.getKeyBinding(EnumOptions.getEnumOptions(var1.id)); + } + + if(var1.id == 200) { + this.mc.gameSettings.saveOptions(); + this.mc.displayGuiScreen(this.field_22110_h); + } + + ScaledResolution var2 = new ScaledResolution(this.mc.gameSettings, this.mc.displayWidth, this.mc.displayHeight); + int var3 = var2.getScaledWidth(); + int var4 = var2.getScaledHeight(); + this.setWorldAndResolution(this.mc, var3, var4); + } + } + + public void drawScreen(int var1, int var2, float var3) { + this.drawDefaultBackground(); + this.drawCenteredString(this.fontRenderer, this.field_22107_a, this.width / 2, 20, 16777215); + super.drawScreen(var1, var2, var3); + } +} diff --git a/src/net/minecraft/src/GuiWorldSlot.java b/src/net/minecraft/src/GuiWorldSlot.java new file mode 100644 index 0000000..8c4fe4f --- /dev/null +++ b/src/net/minecraft/src/GuiWorldSlot.java @@ -0,0 +1,61 @@ +package net.minecraft.src; + +import java.util.Date; + +class GuiWorldSlot extends GuiSlot { + final GuiSelectWorld parentWorldGui; + + public GuiWorldSlot(GuiSelectWorld var1) { + super(var1.mc, var1.width, var1.height, 32, var1.height - 64, 36); + this.parentWorldGui = var1; + } + + protected int getSize() { + return GuiSelectWorld.getSize(this.parentWorldGui).size(); + } + + protected void elementClicked(int var1, boolean var2) { + GuiSelectWorld.onElementSelected(this.parentWorldGui, var1); + boolean var3 = GuiSelectWorld.getSelectedWorld(this.parentWorldGui) >= 0 && GuiSelectWorld.getSelectedWorld(this.parentWorldGui) < this.getSize(); + GuiSelectWorld.getSelectButton(this.parentWorldGui).enabled = var3; + GuiSelectWorld.getRenameButton(this.parentWorldGui).enabled = var3; + GuiSelectWorld.getDeleteButton(this.parentWorldGui).enabled = var3; + if(var2 && var3) { + this.parentWorldGui.selectWorld(var1); + } + + } + + protected boolean isSelected(int var1) { + return var1 == GuiSelectWorld.getSelectedWorld(this.parentWorldGui); + } + + protected int getContentHeight() { + return GuiSelectWorld.getSize(this.parentWorldGui).size() * 36; + } + + protected void drawBackground() { + this.parentWorldGui.drawDefaultBackground(); + } + + protected void drawSlot(int var1, int var2, int var3, int var4, Tessellator var5) { + SaveFormatComparator var6 = (SaveFormatComparator)GuiSelectWorld.getSize(this.parentWorldGui).get(var1); + String var7 = var6.getDisplayName(); + if(var7 == null || MathHelper.stringNullOrLengthZero(var7)) { + var7 = GuiSelectWorld.func_22087_f(this.parentWorldGui) + " " + (var1 + 1); + } + + String var8 = var6.getFileName(); + var8 = var8 + " (" + GuiSelectWorld.getDateFormatter(this.parentWorldGui).format(new Date(var6.func_22163_e())); + long var9 = var6.func_22159_c(); + var8 = var8 + ", " + (float)(var9 / 1024L * 100L / 1024L) / 100.0F + " MB)"; + String var11 = ""; + if(var6.func_22161_d()) { + var11 = GuiSelectWorld.func_22088_h(this.parentWorldGui) + " " + var11; + } + + this.parentWorldGui.drawString(this.parentWorldGui.fontRenderer, var7, var2 + 2, var3 + 1, 16777215); + this.parentWorldGui.drawString(this.parentWorldGui.fontRenderer, var8, var2 + 2, var3 + 12, 8421504); + this.parentWorldGui.drawString(this.parentWorldGui.fontRenderer, var11, var2 + 2, var3 + 12 + 10, 8421504); + } +} diff --git a/src/net/minecraft/src/GuiYesNo.java b/src/net/minecraft/src/GuiYesNo.java new file mode 100644 index 0000000..3baa4e7 --- /dev/null +++ b/src/net/minecraft/src/GuiYesNo.java @@ -0,0 +1,35 @@ +package net.minecraft.src; + +public class GuiYesNo extends GuiScreen { + private GuiScreen parentScreen; + private String message1; + private String message2; + private String field_22106_k; + private String field_22105_l; + private int worldNumber; + + public GuiYesNo(GuiScreen var1, String var2, String var3, String var4, String var5, int var6) { + this.parentScreen = var1; + this.message1 = var2; + this.message2 = var3; + this.field_22106_k = var4; + this.field_22105_l = var5; + this.worldNumber = var6; + } + + public void initGui() { + this.controlList.add(new GuiSmallButton(0, this.width / 2 - 155 + 0, this.height / 6 + 96, this.field_22106_k)); + this.controlList.add(new GuiSmallButton(1, this.width / 2 - 155 + 160, this.height / 6 + 96, this.field_22105_l)); + } + + protected void actionPerformed(GuiButton var1) { + this.parentScreen.deleteWorld(var1.id == 0, this.worldNumber); + } + + public void drawScreen(int var1, int var2, float var3) { + this.drawDefaultBackground(); + this.drawCenteredString(this.fontRenderer, this.message1, this.width / 2, 70, 16777215); + this.drawCenteredString(this.fontRenderer, this.message2, this.width / 2, 90, 16777215); + super.drawScreen(var1, var2, var3); + } +} diff --git a/src/net/minecraft/src/IBlockAccess.java b/src/net/minecraft/src/IBlockAccess.java new file mode 100644 index 0000000..be60b11 --- /dev/null +++ b/src/net/minecraft/src/IBlockAccess.java @@ -0,0 +1,21 @@ +package net.minecraft.src; + +public interface IBlockAccess { + int getBlockId(int var1, int var2, int var3); + + TileEntity getBlockTileEntity(int var1, int var2, int var3); + + float getBrightness(int var1, int var2, int var3, int var4); + + float getLightBrightness(int var1, int var2, int var3); + + int getBlockMetadata(int var1, int var2, int var3); + + Material getBlockMaterial(int var1, int var2, int var3); + + boolean isBlockOpaqueCube(int var1, int var2, int var3); + + boolean isBlockNormalCube(int var1, int var2, int var3); + + WorldChunkManager getWorldChunkManager(); +} diff --git a/src/net/minecraft/src/ICamera.java b/src/net/minecraft/src/ICamera.java new file mode 100644 index 0000000..d32ba62 --- /dev/null +++ b/src/net/minecraft/src/ICamera.java @@ -0,0 +1,7 @@ +package net.minecraft.src; + +public interface ICamera { + boolean isBoundingBoxInFrustum(AxisAlignedBB var1); + + void setPosition(double var1, double var3, double var5); +} diff --git a/src/net/minecraft/src/IChunkLoader.java b/src/net/minecraft/src/IChunkLoader.java new file mode 100644 index 0000000..8c99e3e --- /dev/null +++ b/src/net/minecraft/src/IChunkLoader.java @@ -0,0 +1,15 @@ +package net.minecraft.src; + +import java.io.IOException; + +public interface IChunkLoader { + Chunk loadChunk(World var1, int var2, int var3) throws IOException; + + void saveChunk(World var1, Chunk var2) throws IOException; + + void saveExtraChunkData(World var1, Chunk var2) throws IOException; + + void func_814_a(); + + void saveExtraData(); +} diff --git a/src/net/minecraft/src/IChunkProvider.java b/src/net/minecraft/src/IChunkProvider.java new file mode 100644 index 0000000..c52c2a4 --- /dev/null +++ b/src/net/minecraft/src/IChunkProvider.java @@ -0,0 +1,19 @@ +package net.minecraft.src; + +public interface IChunkProvider { + boolean chunkExists(int var1, int var2); + + Chunk provideChunk(int var1, int var2); + + Chunk prepareChunk(int var1, int var2); + + void populate(IChunkProvider var1, int var2, int var3); + + boolean saveChunks(boolean var1, IProgressUpdate var2); + + boolean unload100OldestChunks(); + + boolean canSave(); + + String makeString(); +} diff --git a/src/net/minecraft/src/ICrafting.java b/src/net/minecraft/src/ICrafting.java new file mode 100644 index 0000000..8d83729 --- /dev/null +++ b/src/net/minecraft/src/ICrafting.java @@ -0,0 +1,7 @@ +package net.minecraft.src; + +public interface ICrafting { + void func_20159_a(Container var1, int var2, ItemStack var3); + + void func_20158_a(Container var1, int var2, int var3); +} diff --git a/src/net/minecraft/src/IInvBasic.java b/src/net/minecraft/src/IInvBasic.java new file mode 100644 index 0000000..6caf389 --- /dev/null +++ b/src/net/minecraft/src/IInvBasic.java @@ -0,0 +1,5 @@ +package net.minecraft.src; + +public interface IInvBasic { + void func_20134_a(InventoryBasic var1); +} diff --git a/src/net/minecraft/src/IInventory.java b/src/net/minecraft/src/IInventory.java new file mode 100644 index 0000000..d0182c6 --- /dev/null +++ b/src/net/minecraft/src/IInventory.java @@ -0,0 +1,19 @@ +package net.minecraft.src; + +public interface IInventory { + int getSizeInventory(); + + ItemStack getStackInSlot(int var1); + + ItemStack decrStackSize(int var1, int var2); + + void setInventorySlotContents(int var1, ItemStack var2); + + String getInvName(); + + int getInventoryStackLimit(); + + void onInventoryChanged(); + + boolean canInteractWith(EntityPlayer var1); +} diff --git a/src/net/minecraft/src/IMob.java b/src/net/minecraft/src/IMob.java new file mode 100644 index 0000000..553e047 --- /dev/null +++ b/src/net/minecraft/src/IMob.java @@ -0,0 +1,4 @@ +package net.minecraft.src; + +public interface IMob { +} diff --git a/src/net/minecraft/src/IProgressUpdate.java b/src/net/minecraft/src/IProgressUpdate.java new file mode 100644 index 0000000..df867cb --- /dev/null +++ b/src/net/minecraft/src/IProgressUpdate.java @@ -0,0 +1,9 @@ +package net.minecraft.src; + +public interface IProgressUpdate { + void func_594_b(String var1); + + void displayLoadingString(String var1); + + void setLoadingProgress(int var1); +} diff --git a/src/net/minecraft/src/IRecipe.java b/src/net/minecraft/src/IRecipe.java new file mode 100644 index 0000000..c5d5000 --- /dev/null +++ b/src/net/minecraft/src/IRecipe.java @@ -0,0 +1,11 @@ +package net.minecraft.src; + +public interface IRecipe { + boolean matches(InventoryCrafting var1); + + ItemStack getCraftingResult(InventoryCrafting var1); + + int getRecipeSize(); + + ItemStack getRecipeOutput(); +} diff --git a/src/net/minecraft/src/ISaveFormat.java b/src/net/minecraft/src/ISaveFormat.java new file mode 100644 index 0000000..6e00d25 --- /dev/null +++ b/src/net/minecraft/src/ISaveFormat.java @@ -0,0 +1,23 @@ +package net.minecraft.src; + +import java.util.List; + +public interface ISaveFormat { + String func_22178_a(); + + ISaveHandler getSaveLoader(String var1, boolean var2); + + List func_22176_b(); + + void flushCache(); + + WorldInfo func_22173_b(String var1); + + void func_22172_c(String var1); + + void func_22170_a(String var1, String var2); + + boolean isOldMapFormat(String var1); + + boolean convertMapFormat(String var1, IProgressUpdate var2); +} diff --git a/src/net/minecraft/src/ISaveHandler.java b/src/net/minecraft/src/ISaveHandler.java new file mode 100644 index 0000000..1e0938c --- /dev/null +++ b/src/net/minecraft/src/ISaveHandler.java @@ -0,0 +1,18 @@ +package net.minecraft.src; + +import java.io.File; +import java.util.List; + +public interface ISaveHandler { + WorldInfo loadWorldInfo(); + + void func_22150_b(); + + IChunkLoader getChunkLoader(WorldProvider var1); + + void saveWorldInfoAndPlayer(WorldInfo var1, List var2); + + void saveWorldInfo(WorldInfo var1); + + File func_28113_a(String var1); +} diff --git a/src/net/minecraft/src/IStatStringFormat.java b/src/net/minecraft/src/IStatStringFormat.java new file mode 100644 index 0000000..5318179 --- /dev/null +++ b/src/net/minecraft/src/IStatStringFormat.java @@ -0,0 +1,5 @@ +package net.minecraft.src; + +public interface IStatStringFormat { + String formatString(String var1); +} diff --git a/src/net/minecraft/src/IStatType.java b/src/net/minecraft/src/IStatType.java new file mode 100644 index 0000000..3168516 --- /dev/null +++ b/src/net/minecraft/src/IStatType.java @@ -0,0 +1,5 @@ +package net.minecraft.src; + +public interface IStatType { + String func_27192_a(int var1); +} diff --git a/src/net/minecraft/src/IWorldAccess.java b/src/net/minecraft/src/IWorldAccess.java new file mode 100644 index 0000000..c2dd6b2 --- /dev/null +++ b/src/net/minecraft/src/IWorldAccess.java @@ -0,0 +1,23 @@ +package net.minecraft.src; + +public interface IWorldAccess { + void markBlockAndNeighborsNeedsUpdate(int var1, int var2, int var3); + + void markBlockRangeNeedsUpdate(int var1, int var2, int var3, int var4, int var5, int var6); + + void playSound(String var1, double var2, double var4, double var6, float var8, float var9); + + void spawnParticle(String var1, double var2, double var4, double var6, double var8, double var10, double var12); + + void obtainEntitySkin(Entity var1); + + void releaseEntitySkin(Entity var1); + + void updateAllRenderers(); + + void playRecord(String var1, int var2, int var3, int var4); + + void doNothingWithTileEntity(int var1, int var2, int var3, TileEntity var4); + + void func_28136_a(EntityPlayer var1, int var2, int var3, int var4, int var5, int var6); +} diff --git a/src/net/minecraft/src/ImageBuffer.java b/src/net/minecraft/src/ImageBuffer.java new file mode 100644 index 0000000..8e55985 --- /dev/null +++ b/src/net/minecraft/src/ImageBuffer.java @@ -0,0 +1,7 @@ +package net.minecraft.src; + +import java.awt.image.BufferedImage; + +public interface ImageBuffer { + BufferedImage parseUserSkin(BufferedImage var1); +} diff --git a/src/net/minecraft/src/ImageBufferDownload.java b/src/net/minecraft/src/ImageBufferDownload.java new file mode 100644 index 0000000..b445ddf --- /dev/null +++ b/src/net/minecraft/src/ImageBufferDownload.java @@ -0,0 +1,88 @@ +package net.minecraft.src; + +import java.awt.Graphics; +import java.awt.image.BufferedImage; +import java.awt.image.DataBufferInt; +import java.awt.image.ImageObserver; + +public class ImageBufferDownload implements ImageBuffer { + private int[] imageData; + private int imageWidth; + private int imageHeight; + + public BufferedImage parseUserSkin(BufferedImage var1) { + if(var1 == null) { + return null; + } else { + this.imageWidth = 64; + this.imageHeight = 32; + BufferedImage var2 = new BufferedImage(this.imageWidth, this.imageHeight, 2); + Graphics var3 = var2.getGraphics(); + var3.drawImage(var1, 0, 0, (ImageObserver)null); + var3.dispose(); + this.imageData = ((DataBufferInt)var2.getRaster().getDataBuffer()).getData(); + this.func_884_b(0, 0, 32, 16); + this.func_885_a(32, 0, 64, 32); + this.func_884_b(0, 16, 64, 32); + boolean var4 = false; + + int var5; + int var6; + int var7; + for(var5 = 32; var5 < 64; ++var5) { + for(var6 = 0; var6 < 16; ++var6) { + var7 = this.imageData[var5 + var6 * 64]; + if((var7 >> 24 & 255) < 128) { + var4 = true; + } + } + } + + if(!var4) { + for(var5 = 32; var5 < 64; ++var5) { + for(var6 = 0; var6 < 16; ++var6) { + var7 = this.imageData[var5 + var6 * 64]; + if((var7 >> 24 & 255) < 128) { + var4 = true; + } + } + } + } + + return var2; + } + } + + private void func_885_a(int var1, int var2, int var3, int var4) { + if(!this.func_886_c(var1, var2, var3, var4)) { + for(int var5 = var1; var5 < var3; ++var5) { + for(int var6 = var2; var6 < var4; ++var6) { + this.imageData[var5 + var6 * this.imageWidth] &= 16777215; + } + } + + } + } + + private void func_884_b(int var1, int var2, int var3, int var4) { + for(int var5 = var1; var5 < var3; ++var5) { + for(int var6 = var2; var6 < var4; ++var6) { + this.imageData[var5 + var6 * this.imageWidth] |= -16777216; + } + } + + } + + private boolean func_886_c(int var1, int var2, int var3, int var4) { + for(int var5 = var1; var5 < var3; ++var5) { + for(int var6 = var2; var6 < var4; ++var6) { + int var7 = this.imageData[var5 + var6 * this.imageWidth]; + if((var7 >> 24 & 255) < 128) { + return true; + } + } + } + + return false; + } +} diff --git a/src/net/minecraft/src/InventoryBasic.java b/src/net/minecraft/src/InventoryBasic.java new file mode 100644 index 0000000..cc7b674 --- /dev/null +++ b/src/net/minecraft/src/InventoryBasic.java @@ -0,0 +1,76 @@ +package net.minecraft.src; + +import java.util.List; + +public class InventoryBasic implements IInventory { + private String inventoryTitle; + private int slotsCount; + private ItemStack[] inventoryContents; + private List field_20073_d; + + public InventoryBasic(String var1, int var2) { + this.inventoryTitle = var1; + this.slotsCount = var2; + this.inventoryContents = new ItemStack[var2]; + } + + public ItemStack getStackInSlot(int var1) { + return this.inventoryContents[var1]; + } + + public ItemStack decrStackSize(int var1, int var2) { + if(this.inventoryContents[var1] != null) { + ItemStack var3; + if(this.inventoryContents[var1].stackSize <= var2) { + var3 = this.inventoryContents[var1]; + this.inventoryContents[var1] = null; + this.onInventoryChanged(); + return var3; + } else { + var3 = this.inventoryContents[var1].splitStack(var2); + if(this.inventoryContents[var1].stackSize == 0) { + this.inventoryContents[var1] = null; + } + + this.onInventoryChanged(); + return var3; + } + } else { + return null; + } + } + + public void setInventorySlotContents(int var1, ItemStack var2) { + this.inventoryContents[var1] = var2; + if(var2 != null && var2.stackSize > this.getInventoryStackLimit()) { + var2.stackSize = this.getInventoryStackLimit(); + } + + this.onInventoryChanged(); + } + + public int getSizeInventory() { + return this.slotsCount; + } + + public String getInvName() { + return this.inventoryTitle; + } + + public int getInventoryStackLimit() { + return 64; + } + + public void onInventoryChanged() { + if(this.field_20073_d != null) { + for(int var1 = 0; var1 < this.field_20073_d.size(); ++var1) { + ((IInvBasic)this.field_20073_d.get(var1)).func_20134_a(this); + } + } + + } + + public boolean canInteractWith(EntityPlayer var1) { + return true; + } +} diff --git a/src/net/minecraft/src/InventoryCraftResult.java b/src/net/minecraft/src/InventoryCraftResult.java new file mode 100644 index 0000000..5ce88b3 --- /dev/null +++ b/src/net/minecraft/src/InventoryCraftResult.java @@ -0,0 +1,42 @@ +package net.minecraft.src; + +public class InventoryCraftResult implements IInventory { + private ItemStack[] stackResult = new ItemStack[1]; + + public int getSizeInventory() { + return 1; + } + + public ItemStack getStackInSlot(int var1) { + return this.stackResult[var1]; + } + + public String getInvName() { + return "Result"; + } + + public ItemStack decrStackSize(int var1, int var2) { + if(this.stackResult[var1] != null) { + ItemStack var3 = this.stackResult[var1]; + this.stackResult[var1] = null; + return var3; + } else { + return null; + } + } + + public void setInventorySlotContents(int var1, ItemStack var2) { + this.stackResult[var1] = var2; + } + + public int getInventoryStackLimit() { + return 64; + } + + public void onInventoryChanged() { + } + + public boolean canInteractWith(EntityPlayer var1) { + return true; + } +} diff --git a/src/net/minecraft/src/InventoryCrafting.java b/src/net/minecraft/src/InventoryCrafting.java new file mode 100644 index 0000000..9b39c98 --- /dev/null +++ b/src/net/minecraft/src/InventoryCrafting.java @@ -0,0 +1,73 @@ +package net.minecraft.src; + +public class InventoryCrafting implements IInventory { + private ItemStack[] stackList; + private int field_21104_b; + private Container eventHandler; + + public InventoryCrafting(Container var1, int var2, int var3) { + int var4 = var2 * var3; + this.stackList = new ItemStack[var4]; + this.eventHandler = var1; + this.field_21104_b = var2; + } + + public int getSizeInventory() { + return this.stackList.length; + } + + public ItemStack getStackInSlot(int var1) { + return var1 >= this.getSizeInventory() ? null : this.stackList[var1]; + } + + public ItemStack func_21103_b(int var1, int var2) { + if(var1 >= 0 && var1 < this.field_21104_b) { + int var3 = var1 + var2 * this.field_21104_b; + return this.getStackInSlot(var3); + } else { + return null; + } + } + + public String getInvName() { + return "Crafting"; + } + + public ItemStack decrStackSize(int var1, int var2) { + if(this.stackList[var1] != null) { + ItemStack var3; + if(this.stackList[var1].stackSize <= var2) { + var3 = this.stackList[var1]; + this.stackList[var1] = null; + this.eventHandler.onCraftMatrixChanged(this); + return var3; + } else { + var3 = this.stackList[var1].splitStack(var2); + if(this.stackList[var1].stackSize == 0) { + this.stackList[var1] = null; + } + + this.eventHandler.onCraftMatrixChanged(this); + return var3; + } + } else { + return null; + } + } + + public void setInventorySlotContents(int var1, ItemStack var2) { + this.stackList[var1] = var2; + this.eventHandler.onCraftMatrixChanged(this); + } + + public int getInventoryStackLimit() { + return 64; + } + + public void onInventoryChanged() { + } + + public boolean canInteractWith(EntityPlayer var1) { + return true; + } +} diff --git a/src/net/minecraft/src/InventoryLargeChest.java b/src/net/minecraft/src/InventoryLargeChest.java new file mode 100644 index 0000000..de0bfa5 --- /dev/null +++ b/src/net/minecraft/src/InventoryLargeChest.java @@ -0,0 +1,51 @@ +package net.minecraft.src; + +public class InventoryLargeChest implements IInventory { + private String name; + private IInventory upperChest; + private IInventory lowerChest; + + public InventoryLargeChest(String var1, IInventory var2, IInventory var3) { + this.name = var1; + this.upperChest = var2; + this.lowerChest = var3; + } + + public int getSizeInventory() { + return this.upperChest.getSizeInventory() + this.lowerChest.getSizeInventory(); + } + + public String getInvName() { + return this.name; + } + + public ItemStack getStackInSlot(int var1) { + return var1 >= this.upperChest.getSizeInventory() ? this.lowerChest.getStackInSlot(var1 - this.upperChest.getSizeInventory()) : this.upperChest.getStackInSlot(var1); + } + + public ItemStack decrStackSize(int var1, int var2) { + return var1 >= this.upperChest.getSizeInventory() ? this.lowerChest.decrStackSize(var1 - this.upperChest.getSizeInventory(), var2) : this.upperChest.decrStackSize(var1, var2); + } + + public void setInventorySlotContents(int var1, ItemStack var2) { + if(var1 >= this.upperChest.getSizeInventory()) { + this.lowerChest.setInventorySlotContents(var1 - this.upperChest.getSizeInventory(), var2); + } else { + this.upperChest.setInventorySlotContents(var1, var2); + } + + } + + public int getInventoryStackLimit() { + return this.upperChest.getInventoryStackLimit(); + } + + public void onInventoryChanged() { + this.upperChest.onInventoryChanged(); + this.lowerChest.onInventoryChanged(); + } + + public boolean canInteractWith(EntityPlayer var1) { + return this.upperChest.canInteractWith(var1) && this.lowerChest.canInteractWith(var1); + } +} diff --git a/src/net/minecraft/src/InventoryPlayer.java b/src/net/minecraft/src/InventoryPlayer.java new file mode 100644 index 0000000..3cfd21f --- /dev/null +++ b/src/net/minecraft/src/InventoryPlayer.java @@ -0,0 +1,371 @@ +package net.minecraft.src; + +public class InventoryPlayer implements IInventory { + public ItemStack[] mainInventory = new ItemStack[36]; + public ItemStack[] armorInventory = new ItemStack[4]; + public int currentItem = 0; + public EntityPlayer player; + private ItemStack itemStack; + public boolean inventoryChanged = false; + + public InventoryPlayer(EntityPlayer var1) { + this.player = var1; + } + + public ItemStack getCurrentItem() { + return this.currentItem < 9 && this.currentItem >= 0 ? this.mainInventory[this.currentItem] : null; + } + + private int getInventorySlotContainItem(int var1) { + for(int var2 = 0; var2 < this.mainInventory.length; ++var2) { + if(this.mainInventory[var2] != null && this.mainInventory[var2].itemID == var1) { + return var2; + } + } + + return -1; + } + + private int storeItemStack(ItemStack var1) { + for(int var2 = 0; var2 < this.mainInventory.length; ++var2) { + if(this.mainInventory[var2] != null && this.mainInventory[var2].itemID == var1.itemID && this.mainInventory[var2].isStackable() && this.mainInventory[var2].stackSize < this.mainInventory[var2].getMaxStackSize() && this.mainInventory[var2].stackSize < this.getInventoryStackLimit() && (!this.mainInventory[var2].getHasSubtypes() || this.mainInventory[var2].getItemDamage() == var1.getItemDamage())) { + return var2; + } + } + + return -1; + } + + private int getFirstEmptyStack() { + for(int var1 = 0; var1 < this.mainInventory.length; ++var1) { + if(this.mainInventory[var1] == null) { + return var1; + } + } + + return -1; + } + + public void setCurrentItem(int var1, boolean var2) { + int var3 = this.getInventorySlotContainItem(var1); + if(var3 >= 0 && var3 < 9) { + this.currentItem = var3; + } + } + + public void changeCurrentItem(int var1) { + if(var1 > 0) { + var1 = 1; + } + + if(var1 < 0) { + var1 = -1; + } + + for(this.currentItem -= var1; this.currentItem < 0; this.currentItem += 9) { + } + + while(this.currentItem >= 9) { + this.currentItem -= 9; + } + + } + + private int storePartialItemStack(ItemStack var1) { + int var2 = var1.itemID; + int var3 = var1.stackSize; + int var4 = this.storeItemStack(var1); + if(var4 < 0) { + var4 = this.getFirstEmptyStack(); + } + + if(var4 < 0) { + return var3; + } else { + if(this.mainInventory[var4] == null) { + this.mainInventory[var4] = new ItemStack(var2, 0, var1.getItemDamage()); + } + + int var5 = var3; + if(var3 > this.mainInventory[var4].getMaxStackSize() - this.mainInventory[var4].stackSize) { + var5 = this.mainInventory[var4].getMaxStackSize() - this.mainInventory[var4].stackSize; + } + + if(var5 > this.getInventoryStackLimit() - this.mainInventory[var4].stackSize) { + var5 = this.getInventoryStackLimit() - this.mainInventory[var4].stackSize; + } + + if(var5 == 0) { + return var3; + } else { + var3 -= var5; + this.mainInventory[var4].stackSize += var5; + this.mainInventory[var4].animationsToGo = 5; + return var3; + } + } + } + + public void decrementAnimations() { + for(int var1 = 0; var1 < this.mainInventory.length; ++var1) { + if(this.mainInventory[var1] != null) { + this.mainInventory[var1].updateAnimation(this.player.worldObj, this.player, var1, this.currentItem == var1); + } + } + + } + + public boolean consumeInventoryItem(int var1) { + int var2 = this.getInventorySlotContainItem(var1); + if(var2 < 0) { + return false; + } else { + if(--this.mainInventory[var2].stackSize <= 0) { + this.mainInventory[var2] = null; + } + + return true; + } + } + + public boolean addItemStackToInventory(ItemStack var1) { + int var2; + if(var1.isItemDamaged()) { + var2 = this.getFirstEmptyStack(); + if(var2 >= 0) { + this.mainInventory[var2] = ItemStack.copyItemStack(var1); + this.mainInventory[var2].animationsToGo = 5; + var1.stackSize = 0; + return true; + } else { + return false; + } + } else { + do { + var2 = var1.stackSize; + var1.stackSize = this.storePartialItemStack(var1); + } while(var1.stackSize > 0 && var1.stackSize < var2); + + return var1.stackSize < var2; + } + } + + public ItemStack decrStackSize(int var1, int var2) { + ItemStack[] var3 = this.mainInventory; + if(var1 >= this.mainInventory.length) { + var3 = this.armorInventory; + var1 -= this.mainInventory.length; + } + + if(var3[var1] != null) { + ItemStack var4; + if(var3[var1].stackSize <= var2) { + var4 = var3[var1]; + var3[var1] = null; + return var4; + } else { + var4 = var3[var1].splitStack(var2); + if(var3[var1].stackSize == 0) { + var3[var1] = null; + } + + return var4; + } + } else { + return null; + } + } + + public void setInventorySlotContents(int var1, ItemStack var2) { + ItemStack[] var3 = this.mainInventory; + if(var1 >= var3.length) { + var1 -= var3.length; + var3 = this.armorInventory; + } + + var3[var1] = var2; + } + + public float getStrVsBlock(Block var1) { + float var2 = 1.0F; + if(this.mainInventory[this.currentItem] != null) { + var2 *= this.mainInventory[this.currentItem].getStrVsBlock(var1); + } + + return var2; + } + + public NBTTagList writeToNBT(NBTTagList var1) { + int var2; + NBTTagCompound var3; + for(var2 = 0; var2 < this.mainInventory.length; ++var2) { + if(this.mainInventory[var2] != null) { + var3 = new NBTTagCompound(); + var3.setByte("Slot", (byte)var2); + this.mainInventory[var2].writeToNBT(var3); + var1.setTag(var3); + } + } + + for(var2 = 0; var2 < this.armorInventory.length; ++var2) { + if(this.armorInventory[var2] != null) { + var3 = new NBTTagCompound(); + var3.setByte("Slot", (byte)(var2 + 100)); + this.armorInventory[var2].writeToNBT(var3); + var1.setTag(var3); + } + } + + return var1; + } + + public void readFromNBT(NBTTagList var1) { + this.mainInventory = new ItemStack[36]; + this.armorInventory = new ItemStack[4]; + + for(int var2 = 0; var2 < var1.tagCount(); ++var2) { + NBTTagCompound var3 = (NBTTagCompound)var1.tagAt(var2); + int var4 = var3.getByte("Slot") & 255; + ItemStack var5 = new ItemStack(var3); + if(var5.getItem() != null) { + if(var4 >= 0 && var4 < this.mainInventory.length) { + this.mainInventory[var4] = var5; + } + + if(var4 >= 100 && var4 < this.armorInventory.length + 100) { + this.armorInventory[var4 - 100] = var5; + } + } + } + + } + + public int getSizeInventory() { + return this.mainInventory.length + 4; + } + + public ItemStack getStackInSlot(int var1) { + ItemStack[] var2 = this.mainInventory; + if(var1 >= var2.length) { + var1 -= var2.length; + var2 = this.armorInventory; + } + + return var2[var1]; + } + + public String getInvName() { + return "Inventory"; + } + + public int getInventoryStackLimit() { + return 64; + } + + public int getDamageVsEntity(Entity var1) { + ItemStack var2 = this.getStackInSlot(this.currentItem); + return var2 != null ? var2.getDamageVsEntity(var1) : 1; + } + + public boolean canHarvestBlock(Block var1) { + if(var1.blockMaterial.getIsHarvestable()) { + return true; + } else { + ItemStack var2 = this.getStackInSlot(this.currentItem); + return var2 != null ? var2.canHarvestBlock(var1) : false; + } + } + + public ItemStack armorItemInSlot(int var1) { + return this.armorInventory[var1]; + } + + public int getTotalArmorValue() { + int var1 = 0; + int var2 = 0; + int var3 = 0; + + for(int var4 = 0; var4 < this.armorInventory.length; ++var4) { + if(this.armorInventory[var4] != null && this.armorInventory[var4].getItem() instanceof ItemArmor) { + int var5 = this.armorInventory[var4].getMaxDamage(); + int var6 = this.armorInventory[var4].getItemDamageForDisplay(); + int var7 = var5 - var6; + var2 += var7; + var3 += var5; + int var8 = ((ItemArmor)this.armorInventory[var4].getItem()).damageReduceAmount; + var1 += var8; + } + } + + if(var3 == 0) { + return 0; + } else { + return (var1 - 1) * var2 / var3 + 1; + } + } + + public void damageArmor(int var1) { + for(int var2 = 0; var2 < this.armorInventory.length; ++var2) { + if(this.armorInventory[var2] != null && this.armorInventory[var2].getItem() instanceof ItemArmor) { + this.armorInventory[var2].damageItem(var1, this.player); + if(this.armorInventory[var2].stackSize == 0) { + this.armorInventory[var2].func_1097_a(this.player); + this.armorInventory[var2] = null; + } + } + } + + } + + public void dropAllItems() { + int var1; + for(var1 = 0; var1 < this.mainInventory.length; ++var1) { + if(this.mainInventory[var1] != null) { + this.player.dropPlayerItemWithRandomChoice(this.mainInventory[var1], true); + this.mainInventory[var1] = null; + } + } + + for(var1 = 0; var1 < this.armorInventory.length; ++var1) { + if(this.armorInventory[var1] != null) { + this.player.dropPlayerItemWithRandomChoice(this.armorInventory[var1], true); + this.armorInventory[var1] = null; + } + } + + } + + public void onInventoryChanged() { + this.inventoryChanged = true; + } + + public void setItemStack(ItemStack var1) { + this.itemStack = var1; + this.player.onItemStackChanged(var1); + } + + public ItemStack getItemStack() { + return this.itemStack; + } + + public boolean canInteractWith(EntityPlayer var1) { + return this.player.isDead ? false : var1.getDistanceSqToEntity(this.player) <= 64.0D; + } + + public boolean func_28018_c(ItemStack var1) { + int var2; + for(var2 = 0; var2 < this.armorInventory.length; ++var2) { + if(this.armorInventory[var2] != null && this.armorInventory[var2].isStackEqual(var1)) { + return true; + } + } + + for(var2 = 0; var2 < this.mainInventory.length; ++var2) { + if(this.mainInventory[var2] != null && this.mainInventory[var2].isStackEqual(var1)) { + return true; + } + } + + return false; + } +} diff --git a/src/net/minecraft/src/IsoImageBuffer.java b/src/net/minecraft/src/IsoImageBuffer.java new file mode 100644 index 0000000..05f0796 --- /dev/null +++ b/src/net/minecraft/src/IsoImageBuffer.java @@ -0,0 +1,32 @@ +package net.minecraft.src; + +import java.awt.image.BufferedImage; + +public class IsoImageBuffer { + public BufferedImage field_1348_a; + public World worldObj; + public int field_1354_c; + public int field_1353_d; + public boolean field_1352_e = false; + public boolean field_1351_f = false; + public int field_1350_g = 0; + public boolean field_1349_h = false; + + public IsoImageBuffer(World var1, int var2, int var3) { + this.worldObj = var1; + this.func_889_a(var2, var3); + } + + public void func_889_a(int var1, int var2) { + this.field_1352_e = false; + this.field_1354_c = var1; + this.field_1353_d = var2; + this.field_1350_g = 0; + this.field_1349_h = false; + } + + public void func_888_a(World var1, int var2, int var3) { + this.worldObj = var1; + this.func_889_a(var2, var3); + } +} diff --git a/src/net/minecraft/src/Item.java b/src/net/minecraft/src/Item.java new file mode 100644 index 0000000..039e0d5 --- /dev/null +++ b/src/net/minecraft/src/Item.java @@ -0,0 +1,276 @@ +package net.minecraft.src; + +import java.util.Random; + +public class Item { + protected static Random itemRand = new Random(); + public static Item[] itemsList = new Item[32000]; + public static Item shovelSteel = (new ItemSpade(0, EnumToolMaterial.IRON)).setIconCoord(2, 5).setItemName("shovelIron"); + public static Item pickaxeSteel = (new ItemPickaxe(1, EnumToolMaterial.IRON)).setIconCoord(2, 6).setItemName("pickaxeIron"); + public static Item axeSteel = (new ItemAxe(2, EnumToolMaterial.IRON)).setIconCoord(2, 7).setItemName("hatchetIron"); + public static Item flintAndSteel = (new ItemFlintAndSteel(3)).setIconCoord(5, 0).setItemName("flintAndSteel"); + public static Item appleRed = (new ItemFood(4, 4, false)).setIconCoord(10, 0).setItemName("apple"); + public static Item bow = (new ItemBow(5)).setIconCoord(5, 1).setItemName("bow"); + public static Item arrow = (new Item(6)).setIconCoord(5, 2).setItemName("arrow"); + public static Item coal = (new ItemCoal(7)).setIconCoord(7, 0).setItemName("coal"); + public static Item diamond = (new Item(8)).setIconCoord(7, 3).setItemName("emerald"); + public static Item ingotIron = (new Item(9)).setIconCoord(7, 1).setItemName("ingotIron"); + public static Item ingotGold = (new Item(10)).setIconCoord(7, 2).setItemName("ingotGold"); + public static Item swordSteel = (new ItemSword(11, EnumToolMaterial.IRON)).setIconCoord(2, 4).setItemName("swordIron"); + public static Item swordWood = (new ItemSword(12, EnumToolMaterial.WOOD)).setIconCoord(0, 4).setItemName("swordWood"); + public static Item shovelWood = (new ItemSpade(13, EnumToolMaterial.WOOD)).setIconCoord(0, 5).setItemName("shovelWood"); + public static Item pickaxeWood = (new ItemPickaxe(14, EnumToolMaterial.WOOD)).setIconCoord(0, 6).setItemName("pickaxeWood"); + public static Item axeWood = (new ItemAxe(15, EnumToolMaterial.WOOD)).setIconCoord(0, 7).setItemName("hatchetWood"); + public static Item swordStone = (new ItemSword(16, EnumToolMaterial.STONE)).setIconCoord(1, 4).setItemName("swordStone"); + public static Item shovelStone = (new ItemSpade(17, EnumToolMaterial.STONE)).setIconCoord(1, 5).setItemName("shovelStone"); + public static Item pickaxeStone = (new ItemPickaxe(18, EnumToolMaterial.STONE)).setIconCoord(1, 6).setItemName("pickaxeStone"); + public static Item axeStone = (new ItemAxe(19, EnumToolMaterial.STONE)).setIconCoord(1, 7).setItemName("hatchetStone"); + public static Item swordDiamond = (new ItemSword(20, EnumToolMaterial.EMERALD)).setIconCoord(3, 4).setItemName("swordDiamond"); + public static Item shovelDiamond = (new ItemSpade(21, EnumToolMaterial.EMERALD)).setIconCoord(3, 5).setItemName("shovelDiamond"); + public static Item pickaxeDiamond = (new ItemPickaxe(22, EnumToolMaterial.EMERALD)).setIconCoord(3, 6).setItemName("pickaxeDiamond"); + public static Item axeDiamond = (new ItemAxe(23, EnumToolMaterial.EMERALD)).setIconCoord(3, 7).setItemName("hatchetDiamond"); + public static Item stick = (new Item(24)).setIconCoord(5, 3).setFull3D().setItemName("stick"); + public static Item bowlEmpty = (new Item(25)).setIconCoord(7, 4).setItemName("bowl"); + public static Item bowlSoup = (new ItemSoup(26, 10)).setIconCoord(8, 4).setItemName("mushroomStew"); + public static Item swordGold = (new ItemSword(27, EnumToolMaterial.GOLD)).setIconCoord(4, 4).setItemName("swordGold"); + public static Item shovelGold = (new ItemSpade(28, EnumToolMaterial.GOLD)).setIconCoord(4, 5).setItemName("shovelGold"); + public static Item pickaxeGold = (new ItemPickaxe(29, EnumToolMaterial.GOLD)).setIconCoord(4, 6).setItemName("pickaxeGold"); + public static Item axeGold = (new ItemAxe(30, EnumToolMaterial.GOLD)).setIconCoord(4, 7).setItemName("hatchetGold"); + public static Item silk = (new Item(31)).setIconCoord(8, 0).setItemName("string"); + public static Item feather = (new Item(32)).setIconCoord(8, 1).setItemName("feather"); + public static Item gunpowder = (new Item(33)).setIconCoord(8, 2).setItemName("sulphur"); + public static Item hoeWood = (new ItemHoe(34, EnumToolMaterial.WOOD)).setIconCoord(0, 8).setItemName("hoeWood"); + public static Item hoeStone = (new ItemHoe(35, EnumToolMaterial.STONE)).setIconCoord(1, 8).setItemName("hoeStone"); + public static Item hoeSteel = (new ItemHoe(36, EnumToolMaterial.IRON)).setIconCoord(2, 8).setItemName("hoeIron"); + public static Item hoeDiamond = (new ItemHoe(37, EnumToolMaterial.EMERALD)).setIconCoord(3, 8).setItemName("hoeDiamond"); + public static Item hoeGold = (new ItemHoe(38, EnumToolMaterial.GOLD)).setIconCoord(4, 8).setItemName("hoeGold"); + public static Item seeds = (new ItemSeeds(39, Block.crops.blockID)).setIconCoord(9, 0).setItemName("seeds"); + public static Item wheat = (new Item(40)).setIconCoord(9, 1).setItemName("wheat"); + public static Item bread = (new ItemFood(41, 5, false)).setIconCoord(9, 2).setItemName("bread"); + public static Item helmetLeather = (new ItemArmor(42, 0, 0, 0)).setIconCoord(0, 0).setItemName("helmetCloth"); + public static Item plateLeather = (new ItemArmor(43, 0, 0, 1)).setIconCoord(0, 1).setItemName("chestplateCloth"); + public static Item legsLeather = (new ItemArmor(44, 0, 0, 2)).setIconCoord(0, 2).setItemName("leggingsCloth"); + public static Item bootsLeather = (new ItemArmor(45, 0, 0, 3)).setIconCoord(0, 3).setItemName("bootsCloth"); + public static Item helmetChain = (new ItemArmor(46, 1, 1, 0)).setIconCoord(1, 0).setItemName("helmetChain"); + public static Item plateChain = (new ItemArmor(47, 1, 1, 1)).setIconCoord(1, 1).setItemName("chestplateChain"); + public static Item legsChain = (new ItemArmor(48, 1, 1, 2)).setIconCoord(1, 2).setItemName("leggingsChain"); + public static Item bootsChain = (new ItemArmor(49, 1, 1, 3)).setIconCoord(1, 3).setItemName("bootsChain"); + public static Item helmetSteel = (new ItemArmor(50, 2, 2, 0)).setIconCoord(2, 0).setItemName("helmetIron"); + public static Item plateSteel = (new ItemArmor(51, 2, 2, 1)).setIconCoord(2, 1).setItemName("chestplateIron"); + public static Item legsSteel = (new ItemArmor(52, 2, 2, 2)).setIconCoord(2, 2).setItemName("leggingsIron"); + public static Item bootsSteel = (new ItemArmor(53, 2, 2, 3)).setIconCoord(2, 3).setItemName("bootsIron"); + public static Item helmetDiamond = (new ItemArmor(54, 3, 3, 0)).setIconCoord(3, 0).setItemName("helmetDiamond"); + public static Item plateDiamond = (new ItemArmor(55, 3, 3, 1)).setIconCoord(3, 1).setItemName("chestplateDiamond"); + public static Item legsDiamond = (new ItemArmor(56, 3, 3, 2)).setIconCoord(3, 2).setItemName("leggingsDiamond"); + public static Item bootsDiamond = (new ItemArmor(57, 3, 3, 3)).setIconCoord(3, 3).setItemName("bootsDiamond"); + public static Item helmetGold = (new ItemArmor(58, 1, 4, 0)).setIconCoord(4, 0).setItemName("helmetGold"); + public static Item plateGold = (new ItemArmor(59, 1, 4, 1)).setIconCoord(4, 1).setItemName("chestplateGold"); + public static Item legsGold = (new ItemArmor(60, 1, 4, 2)).setIconCoord(4, 2).setItemName("leggingsGold"); + public static Item bootsGold = (new ItemArmor(61, 1, 4, 3)).setIconCoord(4, 3).setItemName("bootsGold"); + public static Item flint = (new Item(62)).setIconCoord(6, 0).setItemName("flint"); + public static Item porkRaw = (new ItemFood(63, 3, true)).setIconCoord(7, 5).setItemName("porkchopRaw"); + public static Item porkCooked = (new ItemFood(64, 8, true)).setIconCoord(8, 5).setItemName("porkchopCooked"); + public static Item painting = (new ItemPainting(65)).setIconCoord(10, 1).setItemName("painting"); + public static Item appleGold = (new ItemFood(66, 42, false)).setIconCoord(11, 0).setItemName("appleGold"); + public static Item sign = (new ItemSign(67)).setIconCoord(10, 2).setItemName("sign"); + public static Item doorWood = (new ItemDoor(68, Material.wood)).setIconCoord(11, 2).setItemName("doorWood"); + public static Item bucketEmpty = (new ItemBucket(69, 0)).setIconCoord(10, 4).setItemName("bucket"); + public static Item bucketWater = (new ItemBucket(70, Block.waterMoving.blockID)).setIconCoord(11, 4).setItemName("bucketWater").setContainerItem(bucketEmpty); + public static Item bucketLava = (new ItemBucket(71, Block.lavaMoving.blockID)).setIconCoord(12, 4).setItemName("bucketLava").setContainerItem(bucketEmpty); + public static Item minecartEmpty = (new ItemMinecart(72, 0)).setIconCoord(7, 8).setItemName("minecart"); + public static Item saddle = (new ItemSaddle(73)).setIconCoord(8, 6).setItemName("saddle"); + public static Item doorSteel = (new ItemDoor(74, Material.iron)).setIconCoord(12, 2).setItemName("doorIron"); + public static Item redstone = (new ItemRedstone(75)).setIconCoord(8, 3).setItemName("redstone"); + public static Item snowball = (new ItemSnowball(76)).setIconCoord(14, 0).setItemName("snowball"); + public static Item boat = (new ItemBoat(77)).setIconCoord(8, 8).setItemName("boat"); + public static Item leather = (new Item(78)).setIconCoord(7, 6).setItemName("leather"); + public static Item bucketMilk = (new ItemBucket(79, -1)).setIconCoord(13, 4).setItemName("milk").setContainerItem(bucketEmpty); + public static Item brick = (new Item(80)).setIconCoord(6, 1).setItemName("brick"); + public static Item clay = (new Item(81)).setIconCoord(9, 3).setItemName("clay"); + public static Item reed = (new ItemReed(82, Block.reed)).setIconCoord(11, 1).setItemName("reeds"); + public static Item paper = (new Item(83)).setIconCoord(10, 3).setItemName("paper"); + public static Item book = (new Item(84)).setIconCoord(11, 3).setItemName("book"); + public static Item slimeBall = (new Item(85)).setIconCoord(14, 1).setItemName("slimeball"); + public static Item minecartCrate = (new ItemMinecart(86, 1)).setIconCoord(7, 9).setItemName("minecartChest"); + public static Item minecartPowered = (new ItemMinecart(87, 2)).setIconCoord(7, 10).setItemName("minecartFurnace"); + public static Item egg = (new ItemEgg(88)).setIconCoord(12, 0).setItemName("egg"); + public static Item compass = (new Item(89)).setIconCoord(6, 3).setItemName("compass"); + public static Item fishingRod = (new ItemFishingRod(90)).setIconCoord(5, 4).setItemName("fishingRod"); + public static Item pocketSundial = (new Item(91)).setIconCoord(6, 4).setItemName("clock"); + public static Item lightStoneDust = (new Item(92)).setIconCoord(9, 4).setItemName("yellowDust"); + public static Item fishRaw = (new ItemFood(93, 2, false)).setIconCoord(9, 5).setItemName("fishRaw"); + public static Item fishCooked = (new ItemFood(94, 5, false)).setIconCoord(10, 5).setItemName("fishCooked"); + public static Item dyePowder = (new ItemDye(95)).setIconCoord(14, 4).setItemName("dyePowder"); + public static Item bone = (new Item(96)).setIconCoord(12, 1).setItemName("bone").setFull3D(); + public static Item sugar = (new Item(97)).setIconCoord(13, 0).setItemName("sugar").setFull3D(); + public static Item cake = (new ItemReed(98, Block.cake)).setMaxStackSize(1).setIconCoord(13, 1).setItemName("cake"); + public static Item bed = (new ItemBed(99)).setMaxStackSize(1).setIconCoord(13, 2).setItemName("bed"); + public static Item redstoneRepeater = (new ItemReed(100, Block.redstoneRepeaterIdle)).setIconCoord(6, 5).setItemName("diode"); + public static Item cookie = (new ItemCookie(101, 1, false, 8)).setIconCoord(12, 5).setItemName("cookie"); + public static ItemMap mapItem = (ItemMap)(new ItemMap(102)).setIconCoord(12, 3).setItemName("map"); + public static ItemShears shears = (ItemShears)(new ItemShears(103)).setIconCoord(13, 5).setItemName("shears"); + public static Item record13 = (new ItemRecord(2000, "13")).setIconCoord(0, 15).setItemName("record"); + public static Item recordCat = (new ItemRecord(2001, "cat")).setIconCoord(1, 15).setItemName("record"); + public final int shiftedIndex; + protected int maxStackSize = 64; + private int maxDamage = 0; + protected int iconIndex; + protected boolean bFull3D = false; + protected boolean hasSubtypes = false; + private Item containerItem = null; + private String itemName; + + protected Item(int var1) { + this.shiftedIndex = 256 + var1; + if(itemsList[256 + var1] != null) { + System.out.println("CONFLICT @ " + var1); + } + + itemsList[256 + var1] = this; + } + + public Item setIconIndex(int var1) { + this.iconIndex = var1; + return this; + } + + public Item setMaxStackSize(int var1) { + this.maxStackSize = var1; + return this; + } + + public Item setIconCoord(int var1, int var2) { + this.iconIndex = var1 + var2 * 16; + return this; + } + + public int getIconFromDamage(int var1) { + return this.iconIndex; + } + + public final int getIconIndex(ItemStack var1) { + return this.getIconFromDamage(var1.getItemDamage()); + } + + public boolean onItemUse(ItemStack var1, EntityPlayer var2, World var3, int var4, int var5, int var6, int var7) { + return false; + } + + public float getStrVsBlock(ItemStack var1, Block var2) { + return 1.0F; + } + + public ItemStack onItemRightClick(ItemStack var1, World var2, EntityPlayer var3) { + return var1; + } + + public int getItemStackLimit() { + return this.maxStackSize; + } + + public int getPlacedBlockMetadata(int var1) { + return 0; + } + + public boolean getHasSubtypes() { + return this.hasSubtypes; + } + + protected Item setHasSubtypes(boolean var1) { + this.hasSubtypes = var1; + return this; + } + + public int getMaxDamage() { + return this.maxDamage; + } + + protected Item setMaxDamage(int var1) { + this.maxDamage = var1; + return this; + } + + public boolean isDamagable() { + return this.maxDamage > 0 && !this.hasSubtypes; + } + + public boolean hitEntity(ItemStack var1, EntityLiving var2, EntityLiving var3) { + return false; + } + + public boolean onBlockDestroyed(ItemStack var1, int var2, int var3, int var4, int var5, EntityLiving var6) { + return false; + } + + public int getDamageVsEntity(Entity var1) { + return 1; + } + + public boolean canHarvestBlock(Block var1) { + return false; + } + + public void saddleEntity(ItemStack var1, EntityLiving var2) { + } + + public Item setFull3D() { + this.bFull3D = true; + return this; + } + + public boolean isFull3D() { + return this.bFull3D; + } + + public boolean shouldRotateAroundWhenRendering() { + return false; + } + + public Item setItemName(String var1) { + this.itemName = "item." + var1; + return this; + } + + public String getItemName() { + return this.itemName; + } + + public String getItemNameIS(ItemStack var1) { + return this.itemName; + } + + public Item setContainerItem(Item var1) { + if(this.maxStackSize > 1) { + throw new IllegalArgumentException("Max stack size must be 1 for items with crafting results"); + } else { + this.containerItem = var1; + return this; + } + } + + public Item getContainerItem() { + return this.containerItem; + } + + public boolean hasContainerItem() { + return this.containerItem != null; + } + + public String getStatName() { + return StatCollector.translateToLocal(this.getItemName() + ".name"); + } + + public int getColorFromDamage(int var1) { + return 16777215; + } + + public void onUpdate(ItemStack var1, World var2, Entity var3, int var4, boolean var5) { + } + + public void onCreated(ItemStack var1, World var2, EntityPlayer var3) { + } + + static { + StatList.func_25151_b(); + } +} diff --git a/src/net/minecraft/src/ItemArmor.java b/src/net/minecraft/src/ItemArmor.java new file mode 100644 index 0000000..0368b8e --- /dev/null +++ b/src/net/minecraft/src/ItemArmor.java @@ -0,0 +1,20 @@ +package net.minecraft.src; + +public class ItemArmor extends Item { + private static final int[] damageReduceAmountArray = new int[]{3, 8, 6, 3}; + private static final int[] maxDamageArray = new int[]{11, 16, 15, 13}; + public final int armorLevel; + public final int armorType; + public final int damageReduceAmount; + public final int renderIndex; + + public ItemArmor(int var1, int var2, int var3, int var4) { + super(var1); + this.armorLevel = var2; + this.armorType = var4; + this.renderIndex = var3; + this.damageReduceAmount = damageReduceAmountArray[var4]; + this.setMaxDamage(maxDamageArray[var4] * 3 << var2); + this.maxStackSize = 1; + } +} diff --git a/src/net/minecraft/src/ItemAxe.java b/src/net/minecraft/src/ItemAxe.java new file mode 100644 index 0000000..1fed749 --- /dev/null +++ b/src/net/minecraft/src/ItemAxe.java @@ -0,0 +1,9 @@ +package net.minecraft.src; + +public class ItemAxe extends ItemTool { + private static Block[] blocksEffectiveAgainst = new Block[]{Block.planks, Block.bookShelf, Block.wood, Block.chest}; + + protected ItemAxe(int var1, EnumToolMaterial var2) { + super(var1, 3, var2, blocksEffectiveAgainst); + } +} diff --git a/src/net/minecraft/src/ItemBed.java b/src/net/minecraft/src/ItemBed.java new file mode 100644 index 0000000..d9491ba --- /dev/null +++ b/src/net/minecraft/src/ItemBed.java @@ -0,0 +1,43 @@ +package net.minecraft.src; + +public class ItemBed extends Item { + public ItemBed(int var1) { + super(var1); + } + + public boolean onItemUse(ItemStack var1, EntityPlayer var2, World var3, int var4, int var5, int var6, int var7) { + if(var7 != 1) { + return false; + } else { + ++var5; + BlockBed var8 = (BlockBed)Block.blockBed; + int var9 = MathHelper.floor_double((double)(var2.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; + byte var10 = 0; + byte var11 = 0; + if(var9 == 0) { + var11 = 1; + } + + if(var9 == 1) { + var10 = -1; + } + + if(var9 == 2) { + var11 = -1; + } + + if(var9 == 3) { + var10 = 1; + } + + if(var3.isAirBlock(var4, var5, var6) && var3.isAirBlock(var4 + var10, var5, var6 + var11) && var3.isBlockNormalCube(var4, var5 - 1, var6) && var3.isBlockNormalCube(var4 + var10, var5 - 1, var6 + var11)) { + var3.setBlockAndMetadataWithNotify(var4, var5, var6, var8.blockID, var9); + var3.setBlockAndMetadataWithNotify(var4 + var10, var5, var6 + var11, var8.blockID, var9 + 8); + --var1.stackSize; + return true; + } else { + return false; + } + } + } +} diff --git a/src/net/minecraft/src/ItemBlock.java b/src/net/minecraft/src/ItemBlock.java new file mode 100644 index 0000000..ff4f0b5 --- /dev/null +++ b/src/net/minecraft/src/ItemBlock.java @@ -0,0 +1,67 @@ +package net.minecraft.src; + +public class ItemBlock extends Item { + private int blockID; + + public ItemBlock(int var1) { + super(var1); + this.blockID = var1 + 256; + this.setIconIndex(Block.blocksList[var1 + 256].getBlockTextureFromSide(2)); + } + + public boolean onItemUse(ItemStack var1, EntityPlayer var2, World var3, int var4, int var5, int var6, int var7) { + if(var3.getBlockId(var4, var5, var6) == Block.snow.blockID) { + var7 = 0; + } else { + if(var7 == 0) { + --var5; + } + + if(var7 == 1) { + ++var5; + } + + if(var7 == 2) { + --var6; + } + + if(var7 == 3) { + ++var6; + } + + if(var7 == 4) { + --var4; + } + + if(var7 == 5) { + ++var4; + } + } + + if(var1.stackSize == 0) { + return false; + } else if(var5 == 127 && Block.blocksList[this.blockID].blockMaterial.isSolid()) { + return false; + } else if(var3.canBlockBePlacedAt(this.blockID, var4, var5, var6, false, var7)) { + Block var8 = Block.blocksList[this.blockID]; + if(var3.setBlockAndMetadataWithNotify(var4, var5, var6, this.blockID, this.getPlacedBlockMetadata(var1.getItemDamage()))) { + Block.blocksList[this.blockID].onBlockPlaced(var3, var4, var5, var6, var7); + Block.blocksList[this.blockID].onBlockPlacedBy(var3, var4, var5, var6, var2); + var3.playSoundEffect((double)((float)var4 + 0.5F), (double)((float)var5 + 0.5F), (double)((float)var6 + 0.5F), var8.stepSound.func_1145_d(), (var8.stepSound.getVolume() + 1.0F) / 2.0F, var8.stepSound.getPitch() * 0.8F); + --var1.stackSize; + } + + return true; + } else { + return false; + } + } + + public String getItemNameIS(ItemStack var1) { + return Block.blocksList[this.blockID].getBlockName(); + } + + public String getItemName() { + return Block.blocksList[this.blockID].getBlockName(); + } +} diff --git a/src/net/minecraft/src/ItemBoat.java b/src/net/minecraft/src/ItemBoat.java new file mode 100644 index 0000000..08b76e5 --- /dev/null +++ b/src/net/minecraft/src/ItemBoat.java @@ -0,0 +1,47 @@ +package net.minecraft.src; + +public class ItemBoat extends Item { + public ItemBoat(int var1) { + super(var1); + this.maxStackSize = 1; + } + + public ItemStack onItemRightClick(ItemStack var1, World var2, EntityPlayer var3) { + float var4 = 1.0F; + float var5 = var3.prevRotationPitch + (var3.rotationPitch - var3.prevRotationPitch) * var4; + float var6 = var3.prevRotationYaw + (var3.rotationYaw - var3.prevRotationYaw) * var4; + double var7 = var3.prevPosX + (var3.posX - var3.prevPosX) * (double)var4; + double var9 = var3.prevPosY + (var3.posY - var3.prevPosY) * (double)var4 + 1.62D - (double)var3.yOffset; + double var11 = var3.prevPosZ + (var3.posZ - var3.prevPosZ) * (double)var4; + Vec3D var13 = Vec3D.createVector(var7, var9, var11); + float var14 = MathHelper.cos(-var6 * ((float)Math.PI / 180.0F) - (float)Math.PI); + float var15 = MathHelper.sin(-var6 * ((float)Math.PI / 180.0F) - (float)Math.PI); + float var16 = -MathHelper.cos(-var5 * ((float)Math.PI / 180.0F)); + float var17 = MathHelper.sin(-var5 * ((float)Math.PI / 180.0F)); + float var18 = var15 * var16; + float var20 = var14 * var16; + double var21 = 5.0D; + Vec3D var23 = var13.addVector((double)var18 * var21, (double)var17 * var21, (double)var20 * var21); + MovingObjectPosition var24 = var2.rayTraceBlocks_do(var13, var23, true); + if(var24 == null) { + return var1; + } else { + if(var24.typeOfHit == EnumMovingObjectType.TILE) { + int var25 = var24.blockX; + int var26 = var24.blockY; + int var27 = var24.blockZ; + if(!var2.multiplayerWorld) { + if(var2.getBlockId(var25, var26, var27) == Block.snow.blockID) { + --var26; + } + + var2.entityJoinedWorld(new EntityBoat(var2, (double)((float)var25 + 0.5F), (double)((float)var26 + 1.0F), (double)((float)var27 + 0.5F))); + } + + --var1.stackSize; + } + + return var1; + } + } +} diff --git a/src/net/minecraft/src/ItemBow.java b/src/net/minecraft/src/ItemBow.java new file mode 100644 index 0000000..f20f019 --- /dev/null +++ b/src/net/minecraft/src/ItemBow.java @@ -0,0 +1,19 @@ +package net.minecraft.src; + +public class ItemBow extends Item { + public ItemBow(int var1) { + super(var1); + this.maxStackSize = 1; + } + + public ItemStack onItemRightClick(ItemStack var1, World var2, EntityPlayer var3) { + if(var3.inventory.consumeInventoryItem(Item.arrow.shiftedIndex)) { + var2.playSoundAtEntity(var3, "random.bow", 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 0.8F)); + if(!var2.multiplayerWorld) { + var2.entityJoinedWorld(new EntityArrow(var2, var3)); + } + } + + return var1; + } +} diff --git a/src/net/minecraft/src/ItemBucket.java b/src/net/minecraft/src/ItemBucket.java new file mode 100644 index 0000000..f6980a0 --- /dev/null +++ b/src/net/minecraft/src/ItemBucket.java @@ -0,0 +1,100 @@ +package net.minecraft.src; + +public class ItemBucket extends Item { + private int isFull; + + public ItemBucket(int var1, int var2) { + super(var1); + this.maxStackSize = 1; + this.isFull = var2; + } + + public ItemStack onItemRightClick(ItemStack var1, World var2, EntityPlayer var3) { + float var4 = 1.0F; + float var5 = var3.prevRotationPitch + (var3.rotationPitch - var3.prevRotationPitch) * var4; + float var6 = var3.prevRotationYaw + (var3.rotationYaw - var3.prevRotationYaw) * var4; + double var7 = var3.prevPosX + (var3.posX - var3.prevPosX) * (double)var4; + double var9 = var3.prevPosY + (var3.posY - var3.prevPosY) * (double)var4 + 1.62D - (double)var3.yOffset; + double var11 = var3.prevPosZ + (var3.posZ - var3.prevPosZ) * (double)var4; + Vec3D var13 = Vec3D.createVector(var7, var9, var11); + float var14 = MathHelper.cos(-var6 * ((float)Math.PI / 180.0F) - (float)Math.PI); + float var15 = MathHelper.sin(-var6 * ((float)Math.PI / 180.0F) - (float)Math.PI); + float var16 = -MathHelper.cos(-var5 * ((float)Math.PI / 180.0F)); + float var17 = MathHelper.sin(-var5 * ((float)Math.PI / 180.0F)); + float var18 = var15 * var16; + float var20 = var14 * var16; + double var21 = 5.0D; + Vec3D var23 = var13.addVector((double)var18 * var21, (double)var17 * var21, (double)var20 * var21); + MovingObjectPosition var24 = var2.rayTraceBlocks_do(var13, var23, this.isFull == 0); + if(var24 == null) { + return var1; + } else { + if(var24.typeOfHit == EnumMovingObjectType.TILE) { + int var25 = var24.blockX; + int var26 = var24.blockY; + int var27 = var24.blockZ; + if(!var2.func_6466_a(var3, var25, var26, var27)) { + return var1; + } + + if(this.isFull == 0) { + if(var2.getBlockMaterial(var25, var26, var27) == Material.water && var2.getBlockMetadata(var25, var26, var27) == 0) { + var2.setBlockWithNotify(var25, var26, var27, 0); + return new ItemStack(Item.bucketWater); + } + + if(var2.getBlockMaterial(var25, var26, var27) == Material.lava && var2.getBlockMetadata(var25, var26, var27) == 0) { + var2.setBlockWithNotify(var25, var26, var27, 0); + return new ItemStack(Item.bucketLava); + } + } else { + if(this.isFull < 0) { + return new ItemStack(Item.bucketEmpty); + } + + if(var24.sideHit == 0) { + --var26; + } + + if(var24.sideHit == 1) { + ++var26; + } + + if(var24.sideHit == 2) { + --var27; + } + + if(var24.sideHit == 3) { + ++var27; + } + + if(var24.sideHit == 4) { + --var25; + } + + if(var24.sideHit == 5) { + ++var25; + } + + if(var2.isAirBlock(var25, var26, var27) || !var2.getBlockMaterial(var25, var26, var27).isSolid()) { + if(var2.worldProvider.isHellWorld && this.isFull == Block.waterMoving.blockID) { + var2.playSoundEffect(var7 + 0.5D, var9 + 0.5D, var11 + 0.5D, "random.fizz", 0.5F, 2.6F + (var2.rand.nextFloat() - var2.rand.nextFloat()) * 0.8F); + + for(int var28 = 0; var28 < 8; ++var28) { + var2.spawnParticle("largesmoke", (double)var25 + Math.random(), (double)var26 + Math.random(), (double)var27 + Math.random(), 0.0D, 0.0D, 0.0D); + } + } else { + var2.setBlockAndMetadataWithNotify(var25, var26, var27, this.isFull, 0); + } + + return new ItemStack(Item.bucketEmpty); + } + } + } else if(this.isFull == 0 && var24.entityHit instanceof EntityCow) { + return new ItemStack(Item.bucketMilk); + } + + return var1; + } + } +} diff --git a/src/net/minecraft/src/ItemCloth.java b/src/net/minecraft/src/ItemCloth.java new file mode 100644 index 0000000..5cb7522 --- /dev/null +++ b/src/net/minecraft/src/ItemCloth.java @@ -0,0 +1,21 @@ +package net.minecraft.src; + +public class ItemCloth extends ItemBlock { + public ItemCloth(int var1) { + super(var1); + this.setMaxDamage(0); + this.setHasSubtypes(true); + } + + public int getIconFromDamage(int var1) { + return Block.cloth.getBlockTextureFromSideAndMetadata(2, BlockCloth.func_21034_c(var1)); + } + + public int getPlacedBlockMetadata(int var1) { + return var1; + } + + public String getItemNameIS(ItemStack var1) { + return super.getItemName() + "." + ItemDye.dyeColors[BlockCloth.func_21034_c(var1.getItemDamage())]; + } +} diff --git a/src/net/minecraft/src/ItemCoal.java b/src/net/minecraft/src/ItemCoal.java new file mode 100644 index 0000000..8df5f52 --- /dev/null +++ b/src/net/minecraft/src/ItemCoal.java @@ -0,0 +1,13 @@ +package net.minecraft.src; + +public class ItemCoal extends Item { + public ItemCoal(int var1) { + super(var1); + this.setHasSubtypes(true); + this.setMaxDamage(0); + } + + public String getItemNameIS(ItemStack var1) { + return var1.getItemDamage() == 1 ? "item.charcoal" : "item.coal"; + } +} diff --git a/src/net/minecraft/src/ItemCookie.java b/src/net/minecraft/src/ItemCookie.java new file mode 100644 index 0000000..c04a4e3 --- /dev/null +++ b/src/net/minecraft/src/ItemCookie.java @@ -0,0 +1,8 @@ +package net.minecraft.src; + +public class ItemCookie extends ItemFood { + public ItemCookie(int var1, int var2, boolean var3, int var4) { + super(var1, var2, var3); + this.maxStackSize = var4; + } +} diff --git a/src/net/minecraft/src/ItemDoor.java b/src/net/minecraft/src/ItemDoor.java new file mode 100644 index 0000000..b391b95 --- /dev/null +++ b/src/net/minecraft/src/ItemDoor.java @@ -0,0 +1,73 @@ +package net.minecraft.src; + +public class ItemDoor extends Item { + private Material doorMaterial; + + public ItemDoor(int var1, Material var2) { + super(var1); + this.doorMaterial = var2; + this.maxStackSize = 1; + } + + public boolean onItemUse(ItemStack var1, EntityPlayer var2, World var3, int var4, int var5, int var6, int var7) { + if(var7 != 1) { + return false; + } else { + ++var5; + Block var8; + if(this.doorMaterial == Material.wood) { + var8 = Block.doorWood; + } else { + var8 = Block.doorSteel; + } + + if(!var8.canPlaceBlockAt(var3, var4, var5, var6)) { + return false; + } else { + int var9 = MathHelper.floor_double((double)((var2.rotationYaw + 180.0F) * 4.0F / 360.0F) - 0.5D) & 3; + byte var10 = 0; + byte var11 = 0; + if(var9 == 0) { + var11 = 1; + } + + if(var9 == 1) { + var10 = -1; + } + + if(var9 == 2) { + var11 = -1; + } + + if(var9 == 3) { + var10 = 1; + } + + int var12 = (var3.isBlockNormalCube(var4 - var10, var5, var6 - var11) ? 1 : 0) + (var3.isBlockNormalCube(var4 - var10, var5 + 1, var6 - var11) ? 1 : 0); + int var13 = (var3.isBlockNormalCube(var4 + var10, var5, var6 + var11) ? 1 : 0) + (var3.isBlockNormalCube(var4 + var10, var5 + 1, var6 + var11) ? 1 : 0); + boolean var14 = var3.getBlockId(var4 - var10, var5, var6 - var11) == var8.blockID || var3.getBlockId(var4 - var10, var5 + 1, var6 - var11) == var8.blockID; + boolean var15 = var3.getBlockId(var4 + var10, var5, var6 + var11) == var8.blockID || var3.getBlockId(var4 + var10, var5 + 1, var6 + var11) == var8.blockID; + boolean var16 = false; + if(var14 && !var15) { + var16 = true; + } else if(var13 > var12) { + var16 = true; + } + + if(var16) { + var9 = var9 - 1 & 3; + var9 += 4; + } + + var3.editingBlocks = true; + var3.setBlockAndMetadataWithNotify(var4, var5, var6, var8.blockID, var9); + var3.setBlockAndMetadataWithNotify(var4, var5 + 1, var6, var8.blockID, var9 + 8); + var3.editingBlocks = false; + var3.notifyBlocksOfNeighborChange(var4, var5, var6, var8.blockID); + var3.notifyBlocksOfNeighborChange(var4, var5 + 1, var6, var8.blockID); + --var1.stackSize; + return true; + } + } + } +} diff --git a/src/net/minecraft/src/ItemDye.java b/src/net/minecraft/src/ItemDye.java new file mode 100644 index 0000000..8a7a07d --- /dev/null +++ b/src/net/minecraft/src/ItemDye.java @@ -0,0 +1,91 @@ +package net.minecraft.src; + +public class ItemDye extends Item { + public static final String[] dyeColors = new String[]{"black", "red", "green", "brown", "blue", "purple", "cyan", "silver", "gray", "pink", "lime", "yellow", "lightBlue", "magenta", "orange", "white"}; + public static final int[] field_31002_bk = new int[]{1973019, 11743532, 3887386, 5320730, 2437522, 8073150, 2651799, 2651799, 4408131, 14188952, 4312372, 14602026, 6719955, 12801229, 15435844, 15790320}; + + public ItemDye(int var1) { + super(var1); + this.setHasSubtypes(true); + this.setMaxDamage(0); + } + + public int getIconFromDamage(int var1) { + return this.iconIndex + var1 % 8 * 16 + var1 / 8; + } + + public String getItemNameIS(ItemStack var1) { + return super.getItemName() + "." + dyeColors[var1.getItemDamage()]; + } + + public boolean onItemUse(ItemStack var1, EntityPlayer var2, World var3, int var4, int var5, int var6, int var7) { + if(var1.getItemDamage() == 15) { + int var8 = var3.getBlockId(var4, var5, var6); + if(var8 == Block.sapling.blockID) { + if(!var3.multiplayerWorld) { + ((BlockSapling)Block.sapling).growTree(var3, var4, var5, var6, var3.rand); + --var1.stackSize; + } + + return true; + } + + if(var8 == Block.crops.blockID) { + if(!var3.multiplayerWorld) { + ((BlockCrops)Block.crops).fertilize(var3, var4, var5, var6); + --var1.stackSize; + } + + return true; + } + + if(var8 == Block.grass.blockID) { + if(!var3.multiplayerWorld) { + --var1.stackSize; + + label53: + for(int var9 = 0; var9 < 128; ++var9) { + int var10 = var4; + int var11 = var5 + 1; + int var12 = var6; + + for(int var13 = 0; var13 < var9 / 16; ++var13) { + var10 += itemRand.nextInt(3) - 1; + var11 += (itemRand.nextInt(3) - 1) * itemRand.nextInt(3) / 2; + var12 += itemRand.nextInt(3) - 1; + if(var3.getBlockId(var10, var11 - 1, var12) != Block.grass.blockID || var3.isBlockNormalCube(var10, var11, var12)) { + continue label53; + } + } + + if(var3.getBlockId(var10, var11, var12) == 0) { + if(itemRand.nextInt(10) != 0) { + var3.setBlockAndMetadataWithNotify(var10, var11, var12, Block.tallGrass.blockID, 1); + } else if(itemRand.nextInt(3) != 0) { + var3.setBlockWithNotify(var10, var11, var12, Block.plantYellow.blockID); + } else { + var3.setBlockWithNotify(var10, var11, var12, Block.plantRed.blockID); + } + } + } + } + + return true; + } + } + + return false; + } + + public void saddleEntity(ItemStack var1, EntityLiving var2) { + if(var2 instanceof EntitySheep) { + EntitySheep var3 = (EntitySheep)var2; + int var4 = BlockCloth.func_21034_c(var1.getItemDamage()); + if(!var3.getSheared() && var3.getFleeceColor() != var4) { + var3.setFleeceColor(var4); + --var1.stackSize; + } + } + + } +} diff --git a/src/net/minecraft/src/ItemEgg.java b/src/net/minecraft/src/ItemEgg.java new file mode 100644 index 0000000..da99fb3 --- /dev/null +++ b/src/net/minecraft/src/ItemEgg.java @@ -0,0 +1,18 @@ +package net.minecraft.src; + +public class ItemEgg extends Item { + public ItemEgg(int var1) { + super(var1); + this.maxStackSize = 16; + } + + public ItemStack onItemRightClick(ItemStack var1, World var2, EntityPlayer var3) { + --var1.stackSize; + var2.playSoundAtEntity(var3, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F)); + if(!var2.multiplayerWorld) { + var2.entityJoinedWorld(new EntityEgg(var2, var3)); + } + + return var1; + } +} diff --git a/src/net/minecraft/src/ItemFishingRod.java b/src/net/minecraft/src/ItemFishingRod.java new file mode 100644 index 0000000..aa761e8 --- /dev/null +++ b/src/net/minecraft/src/ItemFishingRod.java @@ -0,0 +1,34 @@ +package net.minecraft.src; + +public class ItemFishingRod extends Item { + public ItemFishingRod(int var1) { + super(var1); + this.setMaxDamage(64); + this.setMaxStackSize(1); + } + + public boolean isFull3D() { + return true; + } + + public boolean shouldRotateAroundWhenRendering() { + return true; + } + + public ItemStack onItemRightClick(ItemStack var1, World var2, EntityPlayer var3) { + if(var3.fishEntity != null) { + int var4 = var3.fishEntity.catchFish(); + var1.damageItem(var4, var3); + var3.swingItem(); + } else { + var2.playSoundAtEntity(var3, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F)); + if(!var2.multiplayerWorld) { + var2.entityJoinedWorld(new EntityFish(var2, var3)); + } + + var3.swingItem(); + } + + return var1; + } +} diff --git a/src/net/minecraft/src/ItemFlintAndSteel.java b/src/net/minecraft/src/ItemFlintAndSteel.java new file mode 100644 index 0000000..b74e594 --- /dev/null +++ b/src/net/minecraft/src/ItemFlintAndSteel.java @@ -0,0 +1,44 @@ +package net.minecraft.src; + +public class ItemFlintAndSteel extends Item { + public ItemFlintAndSteel(int var1) { + super(var1); + this.maxStackSize = 1; + this.setMaxDamage(64); + } + + public boolean onItemUse(ItemStack var1, EntityPlayer var2, World var3, int var4, int var5, int var6, int var7) { + if(var7 == 0) { + --var5; + } + + if(var7 == 1) { + ++var5; + } + + if(var7 == 2) { + --var6; + } + + if(var7 == 3) { + ++var6; + } + + if(var7 == 4) { + --var4; + } + + if(var7 == 5) { + ++var4; + } + + int var8 = var3.getBlockId(var4, var5, var6); + if(var8 == 0) { + var3.playSoundEffect((double)var4 + 0.5D, (double)var5 + 0.5D, (double)var6 + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F); + var3.setBlockWithNotify(var4, var5, var6, Block.fire.blockID); + } + + var1.damageItem(1, var2); + return true; + } +} diff --git a/src/net/minecraft/src/ItemFood.java b/src/net/minecraft/src/ItemFood.java new file mode 100644 index 0000000..c0ff35e --- /dev/null +++ b/src/net/minecraft/src/ItemFood.java @@ -0,0 +1,27 @@ +package net.minecraft.src; + +public class ItemFood extends Item { + private int healAmount; + private boolean isWolfsFavoriteMeat; + + public ItemFood(int var1, int var2, boolean var3) { + super(var1); + this.healAmount = var2; + this.isWolfsFavoriteMeat = var3; + this.maxStackSize = 1; + } + + public ItemStack onItemRightClick(ItemStack var1, World var2, EntityPlayer var3) { + --var1.stackSize; + var3.heal(this.healAmount); + return var1; + } + + public int getHealAmount() { + return this.healAmount; + } + + public boolean getIsWolfsFavoriteMeat() { + return this.isWolfsFavoriteMeat; + } +} diff --git a/src/net/minecraft/src/ItemHoe.java b/src/net/minecraft/src/ItemHoe.java new file mode 100644 index 0000000..e5b54cf --- /dev/null +++ b/src/net/minecraft/src/ItemHoe.java @@ -0,0 +1,31 @@ +package net.minecraft.src; + +public class ItemHoe extends Item { + public ItemHoe(int var1, EnumToolMaterial var2) { + super(var1); + this.maxStackSize = 1; + this.setMaxDamage(var2.getMaxUses()); + } + + public boolean onItemUse(ItemStack var1, EntityPlayer var2, World var3, int var4, int var5, int var6, int var7) { + int var8 = var3.getBlockId(var4, var5, var6); + int var9 = var3.getBlockId(var4, var5 + 1, var6); + if((var7 == 0 || var9 != 0 || var8 != Block.grass.blockID) && var8 != Block.dirt.blockID) { + return false; + } else { + Block var10 = Block.tilledField; + var3.playSoundEffect((double)((float)var4 + 0.5F), (double)((float)var5 + 0.5F), (double)((float)var6 + 0.5F), var10.stepSound.func_1145_d(), (var10.stepSound.getVolume() + 1.0F) / 2.0F, var10.stepSound.getPitch() * 0.8F); + if(var3.multiplayerWorld) { + return true; + } else { + var3.setBlockWithNotify(var4, var5, var6, var10.blockID); + var1.damageItem(1, var2); + return true; + } + } + } + + public boolean isFull3D() { + return true; + } +} diff --git a/src/net/minecraft/src/ItemLeaves.java b/src/net/minecraft/src/ItemLeaves.java new file mode 100644 index 0000000..99f03a2 --- /dev/null +++ b/src/net/minecraft/src/ItemLeaves.java @@ -0,0 +1,21 @@ +package net.minecraft.src; + +public class ItemLeaves extends ItemBlock { + public ItemLeaves(int var1) { + super(var1); + this.setMaxDamage(0); + this.setHasSubtypes(true); + } + + public int getPlacedBlockMetadata(int var1) { + return var1 | 8; + } + + public int getIconFromDamage(int var1) { + return Block.leaves.getBlockTextureFromSideAndMetadata(0, var1); + } + + public int getColorFromDamage(int var1) { + return (var1 & 1) == 1 ? ColorizerFoliage.getFoliageColorPine() : ((var1 & 2) == 2 ? ColorizerFoliage.getFoliageColorBirch() : ColorizerFoliage.func_31073_c()); + } +} diff --git a/src/net/minecraft/src/ItemLog.java b/src/net/minecraft/src/ItemLog.java new file mode 100644 index 0000000..d7dd5df --- /dev/null +++ b/src/net/minecraft/src/ItemLog.java @@ -0,0 +1,17 @@ +package net.minecraft.src; + +public class ItemLog extends ItemBlock { + public ItemLog(int var1) { + super(var1); + this.setMaxDamage(0); + this.setHasSubtypes(true); + } + + public int getIconFromDamage(int var1) { + return Block.wood.getBlockTextureFromSideAndMetadata(2, var1); + } + + public int getPlacedBlockMetadata(int var1) { + return var1; + } +} diff --git a/src/net/minecraft/src/ItemMap.java b/src/net/minecraft/src/ItemMap.java new file mode 100644 index 0000000..6e4cb09 --- /dev/null +++ b/src/net/minecraft/src/ItemMap.java @@ -0,0 +1,236 @@ +package net.minecraft.src; + +public class ItemMap extends ItemMapBase { + protected ItemMap(int var1) { + super(var1); + this.setMaxStackSize(1); + } + + public static MapData func_28013_a(short var0, World var1) { + (new StringBuilder()).append("map_").append(var0).toString(); + MapData var3 = (MapData)var1.loadItemData(MapData.class, "map_" + var0); + if(var3 == null) { + int var4 = var1.getUniqueDataId("map"); + String var2 = "map_" + var4; + var3 = new MapData(var2); + var1.setItemData(var2, var3); + } + + return var3; + } + + public MapData func_28012_a(ItemStack var1, World var2) { + (new StringBuilder()).append("map_").append(var1.getItemDamage()).toString(); + MapData var4 = (MapData)var2.loadItemData(MapData.class, "map_" + var1.getItemDamage()); + if(var4 == null) { + var1.setItemDamage(var2.getUniqueDataId("map")); + String var3 = "map_" + var1.getItemDamage(); + var4 = new MapData(var3); + var4.field_28180_b = var2.getWorldInfo().getSpawnX(); + var4.field_28179_c = var2.getWorldInfo().getSpawnZ(); + var4.field_28177_e = 3; + var4.field_28178_d = (byte)var2.worldProvider.worldType; + var4.markDirty(); + var2.setItemData(var3, var4); + } + + return var4; + } + + public void func_28011_a(World var1, Entity var2, MapData var3) { + if(var1.worldProvider.worldType == var3.field_28178_d) { + short var4 = 128; + short var5 = 128; + int var6 = 1 << var3.field_28177_e; + int var7 = var3.field_28180_b; + int var8 = var3.field_28179_c; + int var9 = MathHelper.floor_double(var2.posX - (double)var7) / var6 + var4 / 2; + int var10 = MathHelper.floor_double(var2.posZ - (double)var8) / var6 + var5 / 2; + int var11 = 128 / var6; + if(var1.worldProvider.hasNoSky) { + var11 /= 2; + } + + ++var3.field_28175_g; + + for(int var12 = var9 - var11 + 1; var12 < var9 + var11; ++var12) { + if((var12 & 15) == (var3.field_28175_g & 15)) { + int var13 = 255; + int var14 = 0; + double var15 = 0.0D; + + for(int var17 = var10 - var11 - 1; var17 < var10 + var11; ++var17) { + if(var12 >= 0 && var17 >= -1 && var12 < var4 && var17 < var5) { + int var18 = var12 - var9; + int var19 = var17 - var10; + boolean var20 = var18 * var18 + var19 * var19 > (var11 - 2) * (var11 - 2); + int var21 = (var7 / var6 + var12 - var4 / 2) * var6; + int var22 = (var8 / var6 + var17 - var5 / 2) * var6; + byte var23 = 0; + byte var24 = 0; + byte var25 = 0; + int[] var26 = new int[256]; + Chunk var27 = var1.getChunkFromBlockCoords(var21, var22); + int var28 = var21 & 15; + int var29 = var22 & 15; + int var30 = 0; + double var31 = 0.0D; + int var33; + int var34; + int var35; + int var38; + if(var1.worldProvider.hasNoSky) { + var33 = var21 + var22 * 231871; + var33 = var33 * var33 * 31287121 + var33 * 11; + if((var33 >> 20 & 1) == 0) { + var26[Block.dirt.blockID] += 10; + } else { + var26[Block.stone.blockID] += 10; + } + + var31 = 100.0D; + } else { + for(var33 = 0; var33 < var6; ++var33) { + for(var34 = 0; var34 < var6; ++var34) { + var35 = var27.getHeightValue(var33 + var28, var34 + var29) + 1; + int var36 = 0; + if(var35 > 1) { + boolean var37 = false; + + label164: + while(true) { + var37 = true; + var36 = var27.getBlockID(var33 + var28, var35 - 1, var34 + var29); + if(var36 == 0) { + var37 = false; + } else if(var35 > 0 && var36 > 0 && Block.blocksList[var36].blockMaterial.materialMapColor == MapColor.airColor) { + var37 = false; + } + + if(!var37) { + --var35; + var36 = var27.getBlockID(var33 + var28, var35 - 1, var34 + var29); + } + + if(var37) { + if(var36 == 0 || !Block.blocksList[var36].blockMaterial.getIsLiquid()) { + break; + } + + var38 = var35 - 1; + boolean var39 = false; + + while(true) { + int var43 = var27.getBlockID(var33 + var28, var38--, var34 + var29); + ++var30; + if(var38 <= 0 || var43 == 0 || !Block.blocksList[var43].blockMaterial.getIsLiquid()) { + break label164; + } + } + } + } + } + + var31 += (double)var35 / (double)(var6 * var6); + ++var26[var36]; + } + } + } + + var30 /= var6 * var6; + int var10000 = var23 / (var6 * var6); + var10000 = var24 / (var6 * var6); + var10000 = var25 / (var6 * var6); + var33 = 0; + var34 = 0; + + for(var35 = 0; var35 < 256; ++var35) { + if(var26[var35] > var33) { + var34 = var35; + var33 = var26[var35]; + } + } + + double var41 = (var31 - var15) * 4.0D / (double)(var6 + 4) + ((double)(var12 + var17 & 1) - 0.5D) * 0.4D; + byte var42 = 1; + if(var41 > 0.6D) { + var42 = 2; + } + + if(var41 < -0.6D) { + var42 = 0; + } + + var38 = 0; + if(var34 > 0) { + MapColor var44 = Block.blocksList[var34].blockMaterial.materialMapColor; + if(var44 == MapColor.waterColor) { + var41 = (double)var30 * 0.1D + (double)(var12 + var17 & 1) * 0.2D; + var42 = 1; + if(var41 < 0.5D) { + var42 = 2; + } + + if(var41 > 0.9D) { + var42 = 0; + } + } + + var38 = var44.colorIndex; + } + + var15 = var31; + if(var17 >= 0 && var18 * var18 + var19 * var19 < var11 * var11 && (!var20 || (var12 + var17 & 1) != 0)) { + byte var45 = var3.field_28176_f[var12 + var17 * var4]; + byte var40 = (byte)(var38 * 4 + var42); + if(var45 != var40) { + if(var13 > var17) { + var13 = var17; + } + + if(var14 < var17) { + var14 = var17; + } + + var3.field_28176_f[var12 + var17 * var4] = var40; + } + } + } + } + + if(var13 <= var14) { + var3.func_28170_a(var12, var13, var14); + } + } + } + + } + } + + public void onUpdate(ItemStack var1, World var2, Entity var3, int var4, boolean var5) { + if(!var2.multiplayerWorld) { + MapData var6 = this.func_28012_a(var1, var2); + if(var3 instanceof EntityPlayer) { + EntityPlayer var7 = (EntityPlayer)var3; + var6.func_28169_a(var7, var1); + } + + if(var5) { + this.func_28011_a(var2, var3, var6); + } + + } + } + + public void onCreated(ItemStack var1, World var2, EntityPlayer var3) { + var1.setItemDamage(var2.getUniqueDataId("map")); + String var4 = "map_" + var1.getItemDamage(); + MapData var5 = new MapData(var4); + var2.setItemData(var4, var5); + var5.field_28180_b = MathHelper.floor_double(var3.posX); + var5.field_28179_c = MathHelper.floor_double(var3.posZ); + var5.field_28177_e = 3; + var5.field_28178_d = (byte)var2.worldProvider.worldType; + var5.markDirty(); + } +} diff --git a/src/net/minecraft/src/ItemMapBase.java b/src/net/minecraft/src/ItemMapBase.java new file mode 100644 index 0000000..9852843 --- /dev/null +++ b/src/net/minecraft/src/ItemMapBase.java @@ -0,0 +1,7 @@ +package net.minecraft.src; + +public class ItemMapBase extends Item { + protected ItemMapBase(int var1) { + super(var1); + } +} diff --git a/src/net/minecraft/src/ItemMinecart.java b/src/net/minecraft/src/ItemMinecart.java new file mode 100644 index 0000000..a89dee2 --- /dev/null +++ b/src/net/minecraft/src/ItemMinecart.java @@ -0,0 +1,25 @@ +package net.minecraft.src; + +public class ItemMinecart extends Item { + public int minecartType; + + public ItemMinecart(int var1, int var2) { + super(var1); + this.maxStackSize = 1; + this.minecartType = var2; + } + + public boolean onItemUse(ItemStack var1, EntityPlayer var2, World var3, int var4, int var5, int var6, int var7) { + int var8 = var3.getBlockId(var4, var5, var6); + if(BlockRail.isRailBlock(var8)) { + if(!var3.multiplayerWorld) { + var3.entityJoinedWorld(new EntityMinecart(var3, (double)((float)var4 + 0.5F), (double)((float)var5 + 0.5F), (double)((float)var6 + 0.5F), this.minecartType)); + } + + --var1.stackSize; + return true; + } else { + return false; + } + } +} diff --git a/src/net/minecraft/src/ItemPainting.java b/src/net/minecraft/src/ItemPainting.java new file mode 100644 index 0000000..f776749 --- /dev/null +++ b/src/net/minecraft/src/ItemPainting.java @@ -0,0 +1,39 @@ +package net.minecraft.src; + +public class ItemPainting extends Item { + public ItemPainting(int var1) { + super(var1); + } + + public boolean onItemUse(ItemStack var1, EntityPlayer var2, World var3, int var4, int var5, int var6, int var7) { + if(var7 == 0) { + return false; + } else if(var7 == 1) { + return false; + } else { + byte var8 = 0; + if(var7 == 4) { + var8 = 1; + } + + if(var7 == 3) { + var8 = 2; + } + + if(var7 == 5) { + var8 = 3; + } + + EntityPainting var9 = new EntityPainting(var3, var4, var5, var6, var8); + if(var9.func_410_i()) { + if(!var3.multiplayerWorld) { + var3.entityJoinedWorld(var9); + } + + --var1.stackSize; + } + + return true; + } + } +} diff --git a/src/net/minecraft/src/ItemPickaxe.java b/src/net/minecraft/src/ItemPickaxe.java new file mode 100644 index 0000000..db9e6a5 --- /dev/null +++ b/src/net/minecraft/src/ItemPickaxe.java @@ -0,0 +1,13 @@ +package net.minecraft.src; + +public class ItemPickaxe extends ItemTool { + private static Block[] blocksEffectiveAgainst = new Block[]{Block.cobblestone, Block.stairDouble, Block.stairSingle, Block.stone, Block.sandStone, Block.cobblestoneMossy, Block.oreIron, Block.blockSteel, Block.oreCoal, Block.blockGold, Block.oreGold, Block.oreDiamond, Block.blockDiamond, Block.ice, Block.netherrack, Block.oreLapis, Block.blockLapis}; + + protected ItemPickaxe(int var1, EnumToolMaterial var2) { + super(var1, 2, var2, blocksEffectiveAgainst); + } + + public boolean canHarvestBlock(Block var1) { + return var1 == Block.obsidian ? this.toolMaterial.getHarvestLevel() == 3 : (var1 != Block.blockDiamond && var1 != Block.oreDiamond ? (var1 != Block.blockGold && var1 != Block.oreGold ? (var1 != Block.blockSteel && var1 != Block.oreIron ? (var1 != Block.blockLapis && var1 != Block.oreLapis ? (var1 != Block.oreRedstone && var1 != Block.oreRedstoneGlowing ? (var1.blockMaterial == Material.rock ? true : var1.blockMaterial == Material.iron) : this.toolMaterial.getHarvestLevel() >= 2) : this.toolMaterial.getHarvestLevel() >= 1) : this.toolMaterial.getHarvestLevel() >= 1) : this.toolMaterial.getHarvestLevel() >= 2) : this.toolMaterial.getHarvestLevel() >= 2); + } +} diff --git a/src/net/minecraft/src/ItemPiston.java b/src/net/minecraft/src/ItemPiston.java new file mode 100644 index 0000000..e5db7cc --- /dev/null +++ b/src/net/minecraft/src/ItemPiston.java @@ -0,0 +1,11 @@ +package net.minecraft.src; + +public class ItemPiston extends ItemBlock { + public ItemPiston(int var1) { + super(var1); + } + + public int getPlacedBlockMetadata(int var1) { + return 7; + } +} diff --git a/src/net/minecraft/src/ItemRecord.java b/src/net/minecraft/src/ItemRecord.java new file mode 100644 index 0000000..fcc4263 --- /dev/null +++ b/src/net/minecraft/src/ItemRecord.java @@ -0,0 +1,26 @@ +package net.minecraft.src; + +public class ItemRecord extends Item { + public final String recordName; + + protected ItemRecord(int var1, String var2) { + super(var1); + this.recordName = var2; + this.maxStackSize = 1; + } + + public boolean onItemUse(ItemStack var1, EntityPlayer var2, World var3, int var4, int var5, int var6, int var7) { + if(var3.getBlockId(var4, var5, var6) == Block.jukebox.blockID && var3.getBlockMetadata(var4, var5, var6) == 0) { + if(var3.multiplayerWorld) { + return true; + } else { + ((BlockJukeBox)Block.jukebox).ejectRecord(var3, var4, var5, var6, this.shiftedIndex); + var3.func_28107_a((EntityPlayer)null, 1005, var4, var5, var6, this.shiftedIndex); + --var1.stackSize; + return true; + } + } else { + return false; + } + } +} diff --git a/src/net/minecraft/src/ItemRedstone.java b/src/net/minecraft/src/ItemRedstone.java new file mode 100644 index 0000000..26cd545 --- /dev/null +++ b/src/net/minecraft/src/ItemRedstone.java @@ -0,0 +1,46 @@ +package net.minecraft.src; + +public class ItemRedstone extends Item { + public ItemRedstone(int var1) { + super(var1); + } + + public boolean onItemUse(ItemStack var1, EntityPlayer var2, World var3, int var4, int var5, int var6, int var7) { + if(var3.getBlockId(var4, var5, var6) != Block.snow.blockID) { + if(var7 == 0) { + --var5; + } + + if(var7 == 1) { + ++var5; + } + + if(var7 == 2) { + --var6; + } + + if(var7 == 3) { + ++var6; + } + + if(var7 == 4) { + --var4; + } + + if(var7 == 5) { + ++var4; + } + + if(!var3.isAirBlock(var4, var5, var6)) { + return false; + } + } + + if(Block.redstoneWire.canPlaceBlockAt(var3, var4, var5, var6)) { + --var1.stackSize; + var3.setBlockWithNotify(var4, var5, var6, Block.redstoneWire.blockID); + } + + return true; + } +} diff --git a/src/net/minecraft/src/ItemReed.java b/src/net/minecraft/src/ItemReed.java new file mode 100644 index 0000000..5be3033 --- /dev/null +++ b/src/net/minecraft/src/ItemReed.java @@ -0,0 +1,56 @@ +package net.minecraft.src; + +public class ItemReed extends Item { + private int field_320_a; + + public ItemReed(int var1, Block var2) { + super(var1); + this.field_320_a = var2.blockID; + } + + public boolean onItemUse(ItemStack var1, EntityPlayer var2, World var3, int var4, int var5, int var6, int var7) { + if(var3.getBlockId(var4, var5, var6) == Block.snow.blockID) { + var7 = 0; + } else { + if(var7 == 0) { + --var5; + } + + if(var7 == 1) { + ++var5; + } + + if(var7 == 2) { + --var6; + } + + if(var7 == 3) { + ++var6; + } + + if(var7 == 4) { + --var4; + } + + if(var7 == 5) { + ++var4; + } + } + + if(var1.stackSize == 0) { + return false; + } else { + if(var3.canBlockBePlacedAt(this.field_320_a, var4, var5, var6, false, var7)) { + Block var8 = Block.blocksList[this.field_320_a]; + if(var3.setBlockWithNotify(var4, var5, var6, this.field_320_a)) { + Block.blocksList[this.field_320_a].onBlockPlaced(var3, var4, var5, var6, var7); + Block.blocksList[this.field_320_a].onBlockPlacedBy(var3, var4, var5, var6, var2); + var3.playSoundEffect((double)((float)var4 + 0.5F), (double)((float)var5 + 0.5F), (double)((float)var6 + 0.5F), var8.stepSound.func_1145_d(), (var8.stepSound.getVolume() + 1.0F) / 2.0F, var8.stepSound.getPitch() * 0.8F); + --var1.stackSize; + } + } + + return true; + } + } +} diff --git a/src/net/minecraft/src/ItemRenderer.java b/src/net/minecraft/src/ItemRenderer.java new file mode 100644 index 0000000..64c25e4 --- /dev/null +++ b/src/net/minecraft/src/ItemRenderer.java @@ -0,0 +1,452 @@ +package net.minecraft.src; + +import net.minecraft.client.Minecraft; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +public class ItemRenderer { + private Minecraft mc; + private ItemStack itemToRender = null; + private float equippedProgress = 0.0F; + private float prevEquippedProgress = 0.0F; + private RenderBlocks renderBlocksInstance = new RenderBlocks(); + private MapItemRenderer field_28131_f; + private int field_20099_f = -1; + + public ItemRenderer(Minecraft var1) { + this.mc = var1; + this.field_28131_f = new MapItemRenderer(var1.fontRenderer, var1.gameSettings, var1.renderEngine); + } + + public void renderItem(EntityLiving var1, ItemStack var2) { + GL11.glPushMatrix(); + if(var2.itemID < 256 && RenderBlocks.renderItemIn3d(Block.blocksList[var2.itemID].getRenderType())) { + GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture("/terrain.png")); + this.renderBlocksInstance.renderBlockOnInventory(Block.blocksList[var2.itemID], var2.getItemDamage(), var1.getEntityBrightness(1.0F)); + } else { + if(var2.itemID < 256) { + GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture("/terrain.png")); + } else { + GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture("/gui/items.png")); + } + + Tessellator var3 = Tessellator.instance; + int var4 = var1.getItemIcon(var2); + float var5 = ((float)(var4 % 16 * 16) + 0.0F) / 256.0F; + float var6 = ((float)(var4 % 16 * 16) + 15.99F) / 256.0F; + float var7 = ((float)(var4 / 16 * 16) + 0.0F) / 256.0F; + float var8 = ((float)(var4 / 16 * 16) + 15.99F) / 256.0F; + float var9 = 1.0F; + float var10 = 0.0F; + float var11 = 0.3F; + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + GL11.glTranslatef(-var10, -var11, 0.0F); + float var12 = 1.5F; + GL11.glScalef(var12, var12, var12); + GL11.glRotatef(50.0F, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(335.0F, 0.0F, 0.0F, 1.0F); + GL11.glTranslatef(-(15.0F / 16.0F), -(1.0F / 16.0F), 0.0F); + float var13 = 1.0F / 16.0F; + var3.startDrawingQuads(); + var3.setNormal(0.0F, 0.0F, 1.0F); + var3.addVertexWithUV(0.0D, 0.0D, 0.0D, (double)var6, (double)var8); + var3.addVertexWithUV((double)var9, 0.0D, 0.0D, (double)var5, (double)var8); + var3.addVertexWithUV((double)var9, 1.0D, 0.0D, (double)var5, (double)var7); + var3.addVertexWithUV(0.0D, 1.0D, 0.0D, (double)var6, (double)var7); + var3.draw(); + var3.startDrawingQuads(); + var3.setNormal(0.0F, 0.0F, -1.0F); + var3.addVertexWithUV(0.0D, 1.0D, (double)(0.0F - var13), (double)var6, (double)var7); + var3.addVertexWithUV((double)var9, 1.0D, (double)(0.0F - var13), (double)var5, (double)var7); + var3.addVertexWithUV((double)var9, 0.0D, (double)(0.0F - var13), (double)var5, (double)var8); + var3.addVertexWithUV(0.0D, 0.0D, (double)(0.0F - var13), (double)var6, (double)var8); + var3.draw(); + var3.startDrawingQuads(); + var3.setNormal(-1.0F, 0.0F, 0.0F); + + int var14; + float var15; + float var16; + float var17; + for(var14 = 0; var14 < 16; ++var14) { + var15 = (float)var14 / 16.0F; + var16 = var6 + (var5 - var6) * var15 - 0.001953125F; + var17 = var9 * var15; + var3.addVertexWithUV((double)var17, 0.0D, (double)(0.0F - var13), (double)var16, (double)var8); + var3.addVertexWithUV((double)var17, 0.0D, 0.0D, (double)var16, (double)var8); + var3.addVertexWithUV((double)var17, 1.0D, 0.0D, (double)var16, (double)var7); + var3.addVertexWithUV((double)var17, 1.0D, (double)(0.0F - var13), (double)var16, (double)var7); + } + + var3.draw(); + var3.startDrawingQuads(); + var3.setNormal(1.0F, 0.0F, 0.0F); + + for(var14 = 0; var14 < 16; ++var14) { + var15 = (float)var14 / 16.0F; + var16 = var6 + (var5 - var6) * var15 - 0.001953125F; + var17 = var9 * var15 + 1.0F / 16.0F; + var3.addVertexWithUV((double)var17, 1.0D, (double)(0.0F - var13), (double)var16, (double)var7); + var3.addVertexWithUV((double)var17, 1.0D, 0.0D, (double)var16, (double)var7); + var3.addVertexWithUV((double)var17, 0.0D, 0.0D, (double)var16, (double)var8); + var3.addVertexWithUV((double)var17, 0.0D, (double)(0.0F - var13), (double)var16, (double)var8); + } + + var3.draw(); + var3.startDrawingQuads(); + var3.setNormal(0.0F, 1.0F, 0.0F); + + for(var14 = 0; var14 < 16; ++var14) { + var15 = (float)var14 / 16.0F; + var16 = var8 + (var7 - var8) * var15 - 0.001953125F; + var17 = var9 * var15 + 1.0F / 16.0F; + var3.addVertexWithUV(0.0D, (double)var17, 0.0D, (double)var6, (double)var16); + var3.addVertexWithUV((double)var9, (double)var17, 0.0D, (double)var5, (double)var16); + var3.addVertexWithUV((double)var9, (double)var17, (double)(0.0F - var13), (double)var5, (double)var16); + var3.addVertexWithUV(0.0D, (double)var17, (double)(0.0F - var13), (double)var6, (double)var16); + } + + var3.draw(); + var3.startDrawingQuads(); + var3.setNormal(0.0F, -1.0F, 0.0F); + + for(var14 = 0; var14 < 16; ++var14) { + var15 = (float)var14 / 16.0F; + var16 = var8 + (var7 - var8) * var15 - 0.001953125F; + var17 = var9 * var15; + var3.addVertexWithUV((double)var9, (double)var17, 0.0D, (double)var5, (double)var16); + var3.addVertexWithUV(0.0D, (double)var17, 0.0D, (double)var6, (double)var16); + var3.addVertexWithUV(0.0D, (double)var17, (double)(0.0F - var13), (double)var6, (double)var16); + var3.addVertexWithUV((double)var9, (double)var17, (double)(0.0F - var13), (double)var5, (double)var16); + } + + var3.draw(); + GL11.glDisable(GL12.GL_RESCALE_NORMAL); + } + + GL11.glPopMatrix(); + } + + public void renderItemInFirstPerson(float var1) { + float var2 = this.prevEquippedProgress + (this.equippedProgress - this.prevEquippedProgress) * var1; + EntityPlayerSP var3 = this.mc.thePlayer; + float var4 = var3.prevRotationPitch + (var3.rotationPitch - var3.prevRotationPitch) * var1; + GL11.glPushMatrix(); + GL11.glRotatef(var4, 1.0F, 0.0F, 0.0F); + GL11.glRotatef(var3.prevRotationYaw + (var3.rotationYaw - var3.prevRotationYaw) * var1, 0.0F, 1.0F, 0.0F); + RenderHelper.enableStandardItemLighting(); + GL11.glPopMatrix(); + ItemStack var5 = this.itemToRender; + float var6 = this.mc.theWorld.getLightBrightness(MathHelper.floor_double(var3.posX), MathHelper.floor_double(var3.posY), MathHelper.floor_double(var3.posZ)); + float var8; + float var9; + float var10; + if(var5 != null) { + int var7 = Item.itemsList[var5.itemID].getColorFromDamage(var5.getItemDamage()); + var8 = (float)(var7 >> 16 & 255) / 255.0F; + var9 = (float)(var7 >> 8 & 255) / 255.0F; + var10 = (float)(var7 & 255) / 255.0F; + GL11.glColor4f(var6 * var8, var6 * var9, var6 * var10, 1.0F); + } else { + GL11.glColor4f(var6, var6, var6, 1.0F); + } + + float var14; + if(var5 != null && var5.itemID == Item.mapItem.shiftedIndex) { + GL11.glPushMatrix(); + var14 = 0.8F; + var8 = var3.getSwingProgress(var1); + var9 = MathHelper.sin(var8 * (float)Math.PI); + var10 = MathHelper.sin(MathHelper.sqrt_float(var8) * (float)Math.PI); + GL11.glTranslatef(-var10 * 0.4F, MathHelper.sin(MathHelper.sqrt_float(var8) * (float)Math.PI * 2.0F) * 0.2F, -var9 * 0.2F); + var8 = 1.0F - var4 / 45.0F + 0.1F; + if(var8 < 0.0F) { + var8 = 0.0F; + } + + if(var8 > 1.0F) { + var8 = 1.0F; + } + + var8 = -MathHelper.cos(var8 * (float)Math.PI) * 0.5F + 0.5F; + GL11.glTranslatef(0.0F, 0.0F * var14 - (1.0F - var2) * 1.2F - var8 * 0.5F + 0.04F, -0.9F * var14); + GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(var8 * -85.0F, 0.0F, 0.0F, 1.0F); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTextureForDownloadableImage(this.mc.thePlayer.skinUrl, this.mc.thePlayer.getEntityTexture())); + + for(int var17 = 0; var17 < 2; ++var17) { + int var21 = var17 * 2 - 1; + GL11.glPushMatrix(); + GL11.glTranslatef(-0.0F, -0.6F, 1.1F * (float)var21); + GL11.glRotatef((float)(-45 * var21), 1.0F, 0.0F, 0.0F); + GL11.glRotatef(-90.0F, 0.0F, 0.0F, 1.0F); + GL11.glRotatef(59.0F, 0.0F, 0.0F, 1.0F); + GL11.glRotatef((float)(-65 * var21), 0.0F, 1.0F, 0.0F); + Render var11 = RenderManager.instance.getEntityRenderObject(this.mc.thePlayer); + RenderPlayer var12 = (RenderPlayer)var11; + float var13 = 1.0F; + GL11.glScalef(var13, var13, var13); + var12.drawFirstPersonHand(); + GL11.glPopMatrix(); + } + + var9 = var3.getSwingProgress(var1); + var10 = MathHelper.sin(var9 * var9 * (float)Math.PI); + float var18 = MathHelper.sin(MathHelper.sqrt_float(var9) * (float)Math.PI); + GL11.glRotatef(-var10 * 20.0F, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(-var18 * 20.0F, 0.0F, 0.0F, 1.0F); + GL11.glRotatef(-var18 * 80.0F, 1.0F, 0.0F, 0.0F); + var9 = 0.38F; + GL11.glScalef(var9, var9, var9); + GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F); + GL11.glTranslatef(-1.0F, -1.0F, 0.0F); + var10 = 0.015625F; + GL11.glScalef(var10, var10, var10); + this.mc.renderEngine.bindTexture(this.mc.renderEngine.getTexture("/misc/mapbg.png")); + Tessellator var19 = Tessellator.instance; + GL11.glNormal3f(0.0F, 0.0F, -1.0F); + var19.startDrawingQuads(); + byte var20 = 7; + var19.addVertexWithUV((double)(0 - var20), (double)(128 + var20), 0.0D, 0.0D, 1.0D); + var19.addVertexWithUV((double)(128 + var20), (double)(128 + var20), 0.0D, 1.0D, 1.0D); + var19.addVertexWithUV((double)(128 + var20), (double)(0 - var20), 0.0D, 1.0D, 0.0D); + var19.addVertexWithUV((double)(0 - var20), (double)(0 - var20), 0.0D, 0.0D, 0.0D); + var19.draw(); + MapData var22 = Item.mapItem.func_28012_a(var5, this.mc.theWorld); + this.field_28131_f.func_28157_a(this.mc.thePlayer, this.mc.renderEngine, var22); + GL11.glPopMatrix(); + } else if(var5 != null) { + GL11.glPushMatrix(); + var14 = 0.8F; + var8 = var3.getSwingProgress(var1); + var9 = MathHelper.sin(var8 * (float)Math.PI); + var10 = MathHelper.sin(MathHelper.sqrt_float(var8) * (float)Math.PI); + GL11.glTranslatef(-var10 * 0.4F, MathHelper.sin(MathHelper.sqrt_float(var8) * (float)Math.PI * 2.0F) * 0.2F, -var9 * 0.2F); + GL11.glTranslatef(0.7F * var14, -0.65F * var14 - (1.0F - var2) * 0.6F, -0.9F * var14); + GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + var8 = var3.getSwingProgress(var1); + var9 = MathHelper.sin(var8 * var8 * (float)Math.PI); + var10 = MathHelper.sin(MathHelper.sqrt_float(var8) * (float)Math.PI); + GL11.glRotatef(-var9 * 20.0F, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(-var10 * 20.0F, 0.0F, 0.0F, 1.0F); + GL11.glRotatef(-var10 * 80.0F, 1.0F, 0.0F, 0.0F); + var8 = 0.4F; + GL11.glScalef(var8, var8, var8); + if(var5.getItem().shouldRotateAroundWhenRendering()) { + GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F); + } + + this.renderItem(var3, var5); + GL11.glPopMatrix(); + } else { + GL11.glPushMatrix(); + var14 = 0.8F; + var8 = var3.getSwingProgress(var1); + var9 = MathHelper.sin(var8 * (float)Math.PI); + var10 = MathHelper.sin(MathHelper.sqrt_float(var8) * (float)Math.PI); + GL11.glTranslatef(-var10 * 0.3F, MathHelper.sin(MathHelper.sqrt_float(var8) * (float)Math.PI * 2.0F) * 0.4F, -var9 * 0.4F); + GL11.glTranslatef(0.8F * var14, -(12.0F / 16.0F) * var14 - (1.0F - var2) * 0.6F, -0.9F * var14); + GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + var8 = var3.getSwingProgress(var1); + var9 = MathHelper.sin(var8 * var8 * (float)Math.PI); + var10 = MathHelper.sin(MathHelper.sqrt_float(var8) * (float)Math.PI); + GL11.glRotatef(var10 * 70.0F, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(-var9 * 20.0F, 0.0F, 0.0F, 1.0F); + GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTextureForDownloadableImage(this.mc.thePlayer.skinUrl, this.mc.thePlayer.getEntityTexture())); + GL11.glTranslatef(-1.0F, 3.6F, 3.5F); + GL11.glRotatef(120.0F, 0.0F, 0.0F, 1.0F); + GL11.glRotatef(200.0F, 1.0F, 0.0F, 0.0F); + GL11.glRotatef(-135.0F, 0.0F, 1.0F, 0.0F); + GL11.glScalef(1.0F, 1.0F, 1.0F); + GL11.glTranslatef(5.6F, 0.0F, 0.0F); + Render var15 = RenderManager.instance.getEntityRenderObject(this.mc.thePlayer); + RenderPlayer var16 = (RenderPlayer)var15; + var10 = 1.0F; + GL11.glScalef(var10, var10, var10); + var16.drawFirstPersonHand(); + GL11.glPopMatrix(); + } + + GL11.glDisable(GL12.GL_RESCALE_NORMAL); + RenderHelper.disableStandardItemLighting(); + } + + public void renderOverlays(float var1) { + GL11.glDisable(GL11.GL_ALPHA_TEST); + int var2; + if(this.mc.thePlayer.isBurning()) { + var2 = this.mc.renderEngine.getTexture("/terrain.png"); + GL11.glBindTexture(GL11.GL_TEXTURE_2D, var2); + this.renderFireInFirstPerson(var1); + } + + if(this.mc.thePlayer.isEntityInsideOpaqueBlock()) { + var2 = MathHelper.floor_double(this.mc.thePlayer.posX); + int var3 = MathHelper.floor_double(this.mc.thePlayer.posY); + int var4 = MathHelper.floor_double(this.mc.thePlayer.posZ); + int var5 = this.mc.renderEngine.getTexture("/terrain.png"); + GL11.glBindTexture(GL11.GL_TEXTURE_2D, var5); + int var6 = this.mc.theWorld.getBlockId(var2, var3, var4); + if(this.mc.theWorld.isBlockNormalCube(var2, var3, var4)) { + this.renderInsideOfBlock(var1, Block.blocksList[var6].getBlockTextureFromSide(2)); + } else { + for(int var7 = 0; var7 < 8; ++var7) { + float var8 = ((float)((var7 >> 0) % 2) - 0.5F) * this.mc.thePlayer.width * 0.9F; + float var9 = ((float)((var7 >> 1) % 2) - 0.5F) * this.mc.thePlayer.height * 0.2F; + float var10 = ((float)((var7 >> 2) % 2) - 0.5F) * this.mc.thePlayer.width * 0.9F; + int var11 = MathHelper.floor_float((float)var2 + var8); + int var12 = MathHelper.floor_float((float)var3 + var9); + int var13 = MathHelper.floor_float((float)var4 + var10); + if(this.mc.theWorld.isBlockNormalCube(var11, var12, var13)) { + var6 = this.mc.theWorld.getBlockId(var11, var12, var13); + } + } + } + + if(Block.blocksList[var6] != null) { + this.renderInsideOfBlock(var1, Block.blocksList[var6].getBlockTextureFromSide(2)); + } + } + + if(this.mc.thePlayer.isInsideOfMaterial(Material.water)) { + var2 = this.mc.renderEngine.getTexture("/misc/water.png"); + GL11.glBindTexture(GL11.GL_TEXTURE_2D, var2); + this.renderWarpedTextureOverlay(var1); + } + + GL11.glEnable(GL11.GL_ALPHA_TEST); + } + + private void renderInsideOfBlock(float var1, int var2) { + Tessellator var3 = Tessellator.instance; + this.mc.thePlayer.getEntityBrightness(var1); + float var4 = 0.1F; + GL11.glColor4f(var4, var4, var4, 0.5F); + GL11.glPushMatrix(); + float var5 = -1.0F; + float var6 = 1.0F; + float var7 = -1.0F; + float var8 = 1.0F; + float var9 = -0.5F; + float var10 = 0.0078125F; + float var11 = (float)(var2 % 16) / 256.0F - var10; + float var12 = ((float)(var2 % 16) + 15.99F) / 256.0F + var10; + float var13 = (float)(var2 / 16) / 256.0F - var10; + float var14 = ((float)(var2 / 16) + 15.99F) / 256.0F + var10; + var3.startDrawingQuads(); + var3.addVertexWithUV((double)var5, (double)var7, (double)var9, (double)var12, (double)var14); + var3.addVertexWithUV((double)var6, (double)var7, (double)var9, (double)var11, (double)var14); + var3.addVertexWithUV((double)var6, (double)var8, (double)var9, (double)var11, (double)var13); + var3.addVertexWithUV((double)var5, (double)var8, (double)var9, (double)var12, (double)var13); + var3.draw(); + GL11.glPopMatrix(); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + } + + private void renderWarpedTextureOverlay(float var1) { + Tessellator var2 = Tessellator.instance; + float var3 = this.mc.thePlayer.getEntityBrightness(var1); + GL11.glColor4f(var3, var3, var3, 0.5F); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + GL11.glPushMatrix(); + float var4 = 4.0F; + float var5 = -1.0F; + float var6 = 1.0F; + float var7 = -1.0F; + float var8 = 1.0F; + float var9 = -0.5F; + float var10 = -this.mc.thePlayer.rotationYaw / 64.0F; + float var11 = this.mc.thePlayer.rotationPitch / 64.0F; + var2.startDrawingQuads(); + var2.addVertexWithUV((double)var5, (double)var7, (double)var9, (double)(var4 + var10), (double)(var4 + var11)); + var2.addVertexWithUV((double)var6, (double)var7, (double)var9, (double)(0.0F + var10), (double)(var4 + var11)); + var2.addVertexWithUV((double)var6, (double)var8, (double)var9, (double)(0.0F + var10), (double)(0.0F + var11)); + var2.addVertexWithUV((double)var5, (double)var8, (double)var9, (double)(var4 + var10), (double)(0.0F + var11)); + var2.draw(); + GL11.glPopMatrix(); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glDisable(GL11.GL_BLEND); + } + + private void renderFireInFirstPerson(float var1) { + Tessellator var2 = Tessellator.instance; + GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.9F); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + float var3 = 1.0F; + + for(int var4 = 0; var4 < 2; ++var4) { + GL11.glPushMatrix(); + int var5 = Block.fire.blockIndexInTexture + var4 * 16; + int var6 = (var5 & 15) << 4; + int var7 = var5 & 240; + float var8 = (float)var6 / 256.0F; + float var9 = ((float)var6 + 15.99F) / 256.0F; + float var10 = (float)var7 / 256.0F; + float var11 = ((float)var7 + 15.99F) / 256.0F; + float var12 = (0.0F - var3) / 2.0F; + float var13 = var12 + var3; + float var14 = 0.0F - var3 / 2.0F; + float var15 = var14 + var3; + float var16 = -0.5F; + GL11.glTranslatef((float)(-(var4 * 2 - 1)) * 0.24F, -0.3F, 0.0F); + GL11.glRotatef((float)(var4 * 2 - 1) * 10.0F, 0.0F, 1.0F, 0.0F); + var2.startDrawingQuads(); + var2.addVertexWithUV((double)var12, (double)var14, (double)var16, (double)var9, (double)var11); + var2.addVertexWithUV((double)var13, (double)var14, (double)var16, (double)var8, (double)var11); + var2.addVertexWithUV((double)var13, (double)var15, (double)var16, (double)var8, (double)var10); + var2.addVertexWithUV((double)var12, (double)var15, (double)var16, (double)var9, (double)var10); + var2.draw(); + GL11.glPopMatrix(); + } + + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glDisable(GL11.GL_BLEND); + } + + public void updateEquippedItem() { + this.prevEquippedProgress = this.equippedProgress; + EntityPlayerSP var1 = this.mc.thePlayer; + ItemStack var2 = var1.inventory.getCurrentItem(); + boolean var4 = this.field_20099_f == var1.inventory.currentItem && var2 == this.itemToRender; + if(this.itemToRender == null && var2 == null) { + var4 = true; + } + + if(var2 != null && this.itemToRender != null && var2 != this.itemToRender && var2.itemID == this.itemToRender.itemID && var2.getItemDamage() == this.itemToRender.getItemDamage()) { + this.itemToRender = var2; + var4 = true; + } + + float var5 = 0.4F; + float var6 = var4 ? 1.0F : 0.0F; + float var7 = var6 - this.equippedProgress; + if(var7 < -var5) { + var7 = -var5; + } + + if(var7 > var5) { + var7 = var5; + } + + this.equippedProgress += var7; + if(this.equippedProgress < 0.1F) { + this.itemToRender = var2; + this.field_20099_f = var1.inventory.currentItem; + } + + } + + public void func_9449_b() { + this.equippedProgress = 0.0F; + } + + public void func_9450_c() { + this.equippedProgress = 0.0F; + } +} diff --git a/src/net/minecraft/src/ItemSaddle.java b/src/net/minecraft/src/ItemSaddle.java new file mode 100644 index 0000000..7452568 --- /dev/null +++ b/src/net/minecraft/src/ItemSaddle.java @@ -0,0 +1,24 @@ +package net.minecraft.src; + +public class ItemSaddle extends Item { + public ItemSaddle(int var1) { + super(var1); + this.maxStackSize = 1; + } + + public void saddleEntity(ItemStack var1, EntityLiving var2) { + if(var2 instanceof EntityPig) { + EntityPig var3 = (EntityPig)var2; + if(!var3.getSaddled()) { + var3.setSaddled(true); + --var1.stackSize; + } + } + + } + + public boolean hitEntity(ItemStack var1, EntityLiving var2, EntityLiving var3) { + this.saddleEntity(var1, var2); + return true; + } +} diff --git a/src/net/minecraft/src/ItemSapling.java b/src/net/minecraft/src/ItemSapling.java new file mode 100644 index 0000000..ab63e90 --- /dev/null +++ b/src/net/minecraft/src/ItemSapling.java @@ -0,0 +1,17 @@ +package net.minecraft.src; + +public class ItemSapling extends ItemBlock { + public ItemSapling(int var1) { + super(var1); + this.setMaxDamage(0); + this.setHasSubtypes(true); + } + + public int getPlacedBlockMetadata(int var1) { + return var1; + } + + public int getIconFromDamage(int var1) { + return Block.sapling.getBlockTextureFromSideAndMetadata(0, var1); + } +} diff --git a/src/net/minecraft/src/ItemSeeds.java b/src/net/minecraft/src/ItemSeeds.java new file mode 100644 index 0000000..00b16af --- /dev/null +++ b/src/net/minecraft/src/ItemSeeds.java @@ -0,0 +1,25 @@ +package net.minecraft.src; + +public class ItemSeeds extends Item { + private int field_318_a; + + public ItemSeeds(int var1, int var2) { + super(var1); + this.field_318_a = var2; + } + + public boolean onItemUse(ItemStack var1, EntityPlayer var2, World var3, int var4, int var5, int var6, int var7) { + if(var7 != 1) { + return false; + } else { + int var8 = var3.getBlockId(var4, var5, var6); + if(var8 == Block.tilledField.blockID && var3.isAirBlock(var4, var5 + 1, var6)) { + var3.setBlockWithNotify(var4, var5 + 1, var6, this.field_318_a); + --var1.stackSize; + return true; + } else { + return false; + } + } + } +} diff --git a/src/net/minecraft/src/ItemShears.java b/src/net/minecraft/src/ItemShears.java new file mode 100644 index 0000000..f871830 --- /dev/null +++ b/src/net/minecraft/src/ItemShears.java @@ -0,0 +1,25 @@ +package net.minecraft.src; + +public class ItemShears extends Item { + public ItemShears(int var1) { + super(var1); + this.setMaxStackSize(1); + this.setMaxDamage(238); + } + + public boolean onBlockDestroyed(ItemStack var1, int var2, int var3, int var4, int var5, EntityLiving var6) { + if(var2 == Block.leaves.blockID || var2 == Block.web.blockID) { + var1.damageItem(1, var6); + } + + return super.onBlockDestroyed(var1, var2, var3, var4, var5, var6); + } + + public boolean canHarvestBlock(Block var1) { + return var1.blockID == Block.web.blockID; + } + + public float getStrVsBlock(ItemStack var1, Block var2) { + return var2.blockID != Block.web.blockID && var2.blockID != Block.leaves.blockID ? (var2.blockID == Block.cloth.blockID ? 5.0F : super.getStrVsBlock(var1, var2)) : 15.0F; + } +} diff --git a/src/net/minecraft/src/ItemSign.java b/src/net/minecraft/src/ItemSign.java new file mode 100644 index 0000000..4abd395 --- /dev/null +++ b/src/net/minecraft/src/ItemSign.java @@ -0,0 +1,54 @@ +package net.minecraft.src; + +public class ItemSign extends Item { + public ItemSign(int var1) { + super(var1); + this.maxStackSize = 1; + } + + public boolean onItemUse(ItemStack var1, EntityPlayer var2, World var3, int var4, int var5, int var6, int var7) { + if(var7 == 0) { + return false; + } else if(!var3.getBlockMaterial(var4, var5, var6).isSolid()) { + return false; + } else { + if(var7 == 1) { + ++var5; + } + + if(var7 == 2) { + --var6; + } + + if(var7 == 3) { + ++var6; + } + + if(var7 == 4) { + --var4; + } + + if(var7 == 5) { + ++var4; + } + + if(!Block.signPost.canPlaceBlockAt(var3, var4, var5, var6)) { + return false; + } else { + if(var7 == 1) { + var3.setBlockAndMetadataWithNotify(var4, var5, var6, Block.signPost.blockID, MathHelper.floor_double((double)((var2.rotationYaw + 180.0F) * 16.0F / 360.0F) + 0.5D) & 15); + } else { + var3.setBlockAndMetadataWithNotify(var4, var5, var6, Block.signWall.blockID, var7); + } + + --var1.stackSize; + TileEntitySign var8 = (TileEntitySign)var3.getBlockTileEntity(var4, var5, var6); + if(var8 != null) { + var2.displayGUIEditSign(var8); + } + + return true; + } + } + } +} diff --git a/src/net/minecraft/src/ItemSlab.java b/src/net/minecraft/src/ItemSlab.java new file mode 100644 index 0000000..cd2a9cc --- /dev/null +++ b/src/net/minecraft/src/ItemSlab.java @@ -0,0 +1,21 @@ +package net.minecraft.src; + +public class ItemSlab extends ItemBlock { + public ItemSlab(int var1) { + super(var1); + this.setMaxDamage(0); + this.setHasSubtypes(true); + } + + public int getIconFromDamage(int var1) { + return Block.stairSingle.getBlockTextureFromSideAndMetadata(2, var1); + } + + public int getPlacedBlockMetadata(int var1) { + return var1; + } + + public String getItemNameIS(ItemStack var1) { + return super.getItemName() + "." + BlockStep.field_22037_a[var1.getItemDamage()]; + } +} diff --git a/src/net/minecraft/src/ItemSnowball.java b/src/net/minecraft/src/ItemSnowball.java new file mode 100644 index 0000000..f70f58e --- /dev/null +++ b/src/net/minecraft/src/ItemSnowball.java @@ -0,0 +1,18 @@ +package net.minecraft.src; + +public class ItemSnowball extends Item { + public ItemSnowball(int var1) { + super(var1); + this.maxStackSize = 16; + } + + public ItemStack onItemRightClick(ItemStack var1, World var2, EntityPlayer var3) { + --var1.stackSize; + var2.playSoundAtEntity(var3, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F)); + if(!var2.multiplayerWorld) { + var2.entityJoinedWorld(new EntitySnowball(var2, var3)); + } + + return var1; + } +} diff --git a/src/net/minecraft/src/ItemSoup.java b/src/net/minecraft/src/ItemSoup.java new file mode 100644 index 0000000..5afc3ff --- /dev/null +++ b/src/net/minecraft/src/ItemSoup.java @@ -0,0 +1,12 @@ +package net.minecraft.src; + +public class ItemSoup extends ItemFood { + public ItemSoup(int var1, int var2) { + super(var1, var2, false); + } + + public ItemStack onItemRightClick(ItemStack var1, World var2, EntityPlayer var3) { + super.onItemRightClick(var1, var2, var3); + return new ItemStack(Item.bowlEmpty); + } +} diff --git a/src/net/minecraft/src/ItemSpade.java b/src/net/minecraft/src/ItemSpade.java new file mode 100644 index 0000000..31af9fc --- /dev/null +++ b/src/net/minecraft/src/ItemSpade.java @@ -0,0 +1,13 @@ +package net.minecraft.src; + +public class ItemSpade extends ItemTool { + private static Block[] blocksEffectiveAgainst = new Block[]{Block.grass, Block.dirt, Block.sand, Block.gravel, Block.snow, Block.blockSnow, Block.blockClay, Block.tilledField}; + + public ItemSpade(int var1, EnumToolMaterial var2) { + super(var1, 1, var2, blocksEffectiveAgainst); + } + + public boolean canHarvestBlock(Block var1) { + return var1 == Block.snow ? true : var1 == Block.blockSnow; + } +} diff --git a/src/net/minecraft/src/ItemStack.java b/src/net/minecraft/src/ItemStack.java new file mode 100644 index 0000000..97fe0bc --- /dev/null +++ b/src/net/minecraft/src/ItemStack.java @@ -0,0 +1,218 @@ +package net.minecraft.src; + +public final class ItemStack { + public int stackSize; + public int animationsToGo; + public int itemID; + private int itemDamage; + + public ItemStack(Block var1) { + this((Block)var1, 1); + } + + public ItemStack(Block var1, int var2) { + this(var1.blockID, var2, 0); + } + + public ItemStack(Block var1, int var2, int var3) { + this(var1.blockID, var2, var3); + } + + public ItemStack(Item var1) { + this(var1.shiftedIndex, 1, 0); + } + + public ItemStack(Item var1, int var2) { + this(var1.shiftedIndex, var2, 0); + } + + public ItemStack(Item var1, int var2, int var3) { + this(var1.shiftedIndex, var2, var3); + } + + public ItemStack(int var1, int var2, int var3) { + this.stackSize = 0; + this.itemID = var1; + this.stackSize = var2; + this.itemDamage = var3; + } + + public ItemStack(NBTTagCompound var1) { + this.stackSize = 0; + this.readFromNBT(var1); + } + + public ItemStack splitStack(int var1) { + this.stackSize -= var1; + return new ItemStack(this.itemID, var1, this.itemDamage); + } + + public Item getItem() { + return Item.itemsList[this.itemID]; + } + + public int getIconIndex() { + return this.getItem().getIconIndex(this); + } + + public boolean useItem(EntityPlayer var1, World var2, int var3, int var4, int var5, int var6) { + boolean var7 = this.getItem().onItemUse(this, var1, var2, var3, var4, var5, var6); + if(var7) { + var1.addStat(StatList.field_25172_A[this.itemID], 1); + } + + return var7; + } + + public float getStrVsBlock(Block var1) { + return this.getItem().getStrVsBlock(this, var1); + } + + public ItemStack useItemRightClick(World var1, EntityPlayer var2) { + return this.getItem().onItemRightClick(this, var1, var2); + } + + public NBTTagCompound writeToNBT(NBTTagCompound var1) { + var1.setShort("id", (short)this.itemID); + var1.setByte("Count", (byte)this.stackSize); + var1.setShort("Damage", (short)this.itemDamage); + return var1; + } + + public void readFromNBT(NBTTagCompound var1) { + this.itemID = var1.getShort("id"); + this.stackSize = var1.getByte("Count"); + this.itemDamage = var1.getShort("Damage"); + } + + public int getMaxStackSize() { + return this.getItem().getItemStackLimit(); + } + + public boolean isStackable() { + return this.getMaxStackSize() > 1 && (!this.isItemStackDamageable() || !this.isItemDamaged()); + } + + public boolean isItemStackDamageable() { + return Item.itemsList[this.itemID].getMaxDamage() > 0; + } + + public boolean getHasSubtypes() { + return Item.itemsList[this.itemID].getHasSubtypes(); + } + + public boolean isItemDamaged() { + return this.isItemStackDamageable() && this.itemDamage > 0; + } + + public int getItemDamageForDisplay() { + return this.itemDamage; + } + + public int getItemDamage() { + return this.itemDamage; + } + + public void setItemDamage(int var1) { + this.itemDamage = var1; + } + + public int getMaxDamage() { + return Item.itemsList[this.itemID].getMaxDamage(); + } + + public void damageItem(int var1, Entity var2) { + if(this.isItemStackDamageable()) { + this.itemDamage += var1; + if(this.itemDamage > this.getMaxDamage()) { + if(var2 instanceof EntityPlayer) { + ((EntityPlayer)var2).addStat(StatList.field_25170_B[this.itemID], 1); + } + + --this.stackSize; + if(this.stackSize < 0) { + this.stackSize = 0; + } + + this.itemDamage = 0; + } + + } + } + + public void hitEntity(EntityLiving var1, EntityPlayer var2) { + boolean var3 = Item.itemsList[this.itemID].hitEntity(this, var1, var2); + if(var3) { + var2.addStat(StatList.field_25172_A[this.itemID], 1); + } + + } + + public void onDestroyBlock(int var1, int var2, int var3, int var4, EntityPlayer var5) { + boolean var6 = Item.itemsList[this.itemID].onBlockDestroyed(this, var1, var2, var3, var4, var5); + if(var6) { + var5.addStat(StatList.field_25172_A[this.itemID], 1); + } + + } + + public int getDamageVsEntity(Entity var1) { + return Item.itemsList[this.itemID].getDamageVsEntity(var1); + } + + public boolean canHarvestBlock(Block var1) { + return Item.itemsList[this.itemID].canHarvestBlock(var1); + } + + public void func_1097_a(EntityPlayer var1) { + } + + public void useItemOnEntity(EntityLiving var1) { + Item.itemsList[this.itemID].saddleEntity(this, var1); + } + + public ItemStack copy() { + return new ItemStack(this.itemID, this.stackSize, this.itemDamage); + } + + public static boolean areItemStacksEqual(ItemStack var0, ItemStack var1) { + return var0 == null && var1 == null ? true : (var0 != null && var1 != null ? var0.isItemStackEqual(var1) : false); + } + + private boolean isItemStackEqual(ItemStack var1) { + return this.stackSize != var1.stackSize ? false : (this.itemID != var1.itemID ? false : this.itemDamage == var1.itemDamage); + } + + public boolean isItemEqual(ItemStack var1) { + return this.itemID == var1.itemID && this.itemDamage == var1.itemDamage; + } + + public String getItemName() { + return Item.itemsList[this.itemID].getItemNameIS(this); + } + + public static ItemStack copyItemStack(ItemStack var0) { + return var0 == null ? null : var0.copy(); + } + + public String toString() { + return this.stackSize + "x" + Item.itemsList[this.itemID].getItemName() + "@" + this.itemDamage; + } + + public void updateAnimation(World var1, Entity var2, int var3, boolean var4) { + if(this.animationsToGo > 0) { + --this.animationsToGo; + } + + Item.itemsList[this.itemID].onUpdate(this, var1, var2, var3, var4); + } + + public void onCrafting(World var1, EntityPlayer var2) { + var2.addStat(StatList.field_25158_z[this.itemID], this.stackSize); + Item.itemsList[this.itemID].onCreated(this, var1, var2); + } + + public boolean isStackEqual(ItemStack var1) { + return this.itemID == var1.itemID && this.stackSize == var1.stackSize && this.itemDamage == var1.itemDamage; + } +} diff --git a/src/net/minecraft/src/ItemSword.java b/src/net/minecraft/src/ItemSword.java new file mode 100644 index 0000000..43bee0a --- /dev/null +++ b/src/net/minecraft/src/ItemSword.java @@ -0,0 +1,38 @@ +package net.minecraft.src; + +public class ItemSword extends Item { + private int weaponDamage; + + public ItemSword(int var1, EnumToolMaterial var2) { + super(var1); + this.maxStackSize = 1; + this.setMaxDamage(var2.getMaxUses()); + this.weaponDamage = 4 + var2.getDamageVsEntity() * 2; + } + + public float getStrVsBlock(ItemStack var1, Block var2) { + return var2.blockID == Block.web.blockID ? 15.0F : 1.5F; + } + + public boolean hitEntity(ItemStack var1, EntityLiving var2, EntityLiving var3) { + var1.damageItem(1, var3); + return true; + } + + public boolean onBlockDestroyed(ItemStack var1, int var2, int var3, int var4, int var5, EntityLiving var6) { + var1.damageItem(2, var6); + return true; + } + + public int getDamageVsEntity(Entity var1) { + return this.weaponDamage; + } + + public boolean isFull3D() { + return true; + } + + public boolean canHarvestBlock(Block var1) { + return var1.blockID == Block.web.blockID; + } +} diff --git a/src/net/minecraft/src/ItemTool.java b/src/net/minecraft/src/ItemTool.java new file mode 100644 index 0000000..4b0ef54 --- /dev/null +++ b/src/net/minecraft/src/ItemTool.java @@ -0,0 +1,46 @@ +package net.minecraft.src; + +public class ItemTool extends Item { + private Block[] blocksEffectiveAgainst; + private float efficiencyOnProperMaterial = 4.0F; + private int damageVsEntity; + protected EnumToolMaterial toolMaterial; + + protected ItemTool(int var1, int var2, EnumToolMaterial var3, Block[] var4) { + super(var1); + this.toolMaterial = var3; + this.blocksEffectiveAgainst = var4; + this.maxStackSize = 1; + this.setMaxDamage(var3.getMaxUses()); + this.efficiencyOnProperMaterial = var3.getEfficiencyOnProperMaterial(); + this.damageVsEntity = var2 + var3.getDamageVsEntity(); + } + + public float getStrVsBlock(ItemStack var1, Block var2) { + for(int var3 = 0; var3 < this.blocksEffectiveAgainst.length; ++var3) { + if(this.blocksEffectiveAgainst[var3] == var2) { + return this.efficiencyOnProperMaterial; + } + } + + return 1.0F; + } + + public boolean hitEntity(ItemStack var1, EntityLiving var2, EntityLiving var3) { + var1.damageItem(2, var3); + return true; + } + + public boolean onBlockDestroyed(ItemStack var1, int var2, int var3, int var4, int var5, EntityLiving var6) { + var1.damageItem(1, var6); + return true; + } + + public int getDamageVsEntity(Entity var1) { + return this.damageVsEntity; + } + + public boolean isFull3D() { + return true; + } +} diff --git a/src/net/minecraft/src/J_ArrayNodeContainer.java b/src/net/minecraft/src/J_ArrayNodeContainer.java new file mode 100644 index 0000000..9f791dd --- /dev/null +++ b/src/net/minecraft/src/J_ArrayNodeContainer.java @@ -0,0 +1,19 @@ +package net.minecraft.src; + +class J_ArrayNodeContainer implements J_NodeContainer { + final J_JsonArrayNodeBuilder field_27294_a; + final J_JsonListenerToJdomAdapter field_27293_b; + + J_ArrayNodeContainer(J_JsonListenerToJdomAdapter var1, J_JsonArrayNodeBuilder var2) { + this.field_27293_b = var1; + this.field_27294_a = var2; + } + + public void func_27290_a(J_JsonNodeBuilder var1) { + this.field_27294_a.func_27240_a(var1); + } + + public void func_27289_a(J_JsonFieldBuilder var1) { + throw new RuntimeException("Coding failure in Argo: Attempt to add a field to an array."); + } +} diff --git a/src/net/minecraft/src/J_ChainedFunctor.java b/src/net/minecraft/src/J_ChainedFunctor.java new file mode 100644 index 0000000..a5e308c --- /dev/null +++ b/src/net/minecraft/src/J_ChainedFunctor.java @@ -0,0 +1,39 @@ +package net.minecraft.src; + +final class J_ChainedFunctor implements J_Functor { + private final J_JsonNodeSelector field_27062_a; + private final J_JsonNodeSelector field_27061_b; + + J_ChainedFunctor(J_JsonNodeSelector var1, J_JsonNodeSelector var2) { + this.field_27062_a = var1; + this.field_27061_b = var2; + } + + public boolean func_27058_a(Object var1) { + return this.field_27062_a.func_27356_a(var1) && this.field_27061_b.func_27356_a(this.field_27062_a.func_27357_b(var1)); + } + + public Object func_27059_b(Object var1) { + Object var2; + try { + var2 = this.field_27062_a.func_27357_b(var1); + } catch (J_JsonNodeDoesNotMatchChainedJsonNodeSelectorException var6) { + throw J_JsonNodeDoesNotMatchChainedJsonNodeSelectorException.func_27321_b(var6, this.field_27062_a); + } + + try { + Object var3 = this.field_27061_b.func_27357_b(var2); + return var3; + } catch (J_JsonNodeDoesNotMatchChainedJsonNodeSelectorException var5) { + throw J_JsonNodeDoesNotMatchChainedJsonNodeSelectorException.func_27323_a(var5, this.field_27062_a); + } + } + + public String func_27060_a() { + return this.field_27061_b.func_27358_a(); + } + + public String toString() { + return this.field_27062_a.toString() + ", with " + this.field_27061_b.toString(); + } +} diff --git a/src/net/minecraft/src/J_CompactJsonFormatter.java b/src/net/minecraft/src/J_CompactJsonFormatter.java new file mode 100644 index 0000000..a173a6f --- /dev/null +++ b/src/net/minecraft/src/J_CompactJsonFormatter.java @@ -0,0 +1,84 @@ +package net.minecraft.src; + +import java.io.IOException; +import java.io.StringWriter; +import java.io.Writer; +import java.util.Iterator; +import java.util.TreeSet; + +public final class J_CompactJsonFormatter implements J_JsonFormatter { + public String func_27327_a(J_JsonRootNode var1) { + StringWriter var2 = new StringWriter(); + + try { + this.func_27329_a(var1, var2); + } catch (IOException var4) { + throw new RuntimeException("Coding failure in Argo: StringWriter gave an IOException", var4); + } + + return var2.toString(); + } + + public void func_27329_a(J_JsonRootNode var1, Writer var2) throws IOException { + this.func_27328_a(var1, var2); + } + + private void func_27328_a(J_JsonNode var1, Writer var2) throws IOException { + boolean var3 = true; + Iterator var4; + switch(EnumJsonNodeTypeMappingHelper.field_27341_a[var1.func_27218_a().ordinal()]) { + case 1: + var2.append('['); + var4 = var1.func_27215_d().iterator(); + + while(var4.hasNext()) { + J_JsonNode var6 = (J_JsonNode)var4.next(); + if(!var3) { + var2.append(','); + } + + var3 = false; + this.func_27328_a(var6, var2); + } + + var2.append(']'); + break; + case 2: + var2.append('{'); + var4 = (new TreeSet(var1.func_27214_c().keySet())).iterator(); + + while(var4.hasNext()) { + J_JsonStringNode var5 = (J_JsonStringNode)var4.next(); + if(!var3) { + var2.append(','); + } + + var3 = false; + this.func_27328_a(var5, var2); + var2.append(':'); + this.func_27328_a((J_JsonNode)var1.func_27214_c().get(var5), var2); + } + + var2.append('}'); + break; + case 3: + var2.append('\"').append((new J_JsonEscapedString(var1.func_27216_b())).toString()).append('\"'); + break; + case 4: + var2.append(var1.func_27216_b()); + break; + case 5: + var2.append("false"); + break; + case 6: + var2.append("true"); + break; + case 7: + var2.append("null"); + break; + default: + throw new RuntimeException("Coding failure in Argo: Attempt to format a JsonNode of unknown type [" + var1.func_27218_a() + "];"); + } + + } +} diff --git a/src/net/minecraft/src/J_FieldNodeContainer.java b/src/net/minecraft/src/J_FieldNodeContainer.java new file mode 100644 index 0000000..a6cbaf2 --- /dev/null +++ b/src/net/minecraft/src/J_FieldNodeContainer.java @@ -0,0 +1,19 @@ +package net.minecraft.src; + +class J_FieldNodeContainer implements J_NodeContainer { + final J_JsonFieldBuilder field_27292_a; + final J_JsonListenerToJdomAdapter field_27291_b; + + J_FieldNodeContainer(J_JsonListenerToJdomAdapter var1, J_JsonFieldBuilder var2) { + this.field_27291_b = var1; + this.field_27292_a = var2; + } + + public void func_27290_a(J_JsonNodeBuilder var1) { + this.field_27292_a.func_27300_b(var1); + } + + public void func_27289_a(J_JsonFieldBuilder var1) { + throw new RuntimeException("Coding failure in Argo: Attempt to add a field to a field."); + } +} diff --git a/src/net/minecraft/src/J_Functor.java b/src/net/minecraft/src/J_Functor.java new file mode 100644 index 0000000..2bca71d --- /dev/null +++ b/src/net/minecraft/src/J_Functor.java @@ -0,0 +1,9 @@ +package net.minecraft.src; + +interface J_Functor { + boolean func_27058_a(Object var1); + + Object func_27059_b(Object var1); + + String func_27060_a(); +} diff --git a/src/net/minecraft/src/J_InvalidSyntaxException.java b/src/net/minecraft/src/J_InvalidSyntaxException.java new file mode 100644 index 0000000..d4e9b3e --- /dev/null +++ b/src/net/minecraft/src/J_InvalidSyntaxException.java @@ -0,0 +1,18 @@ +package net.minecraft.src; + +public final class J_InvalidSyntaxException extends Exception { + private final int field_27191_a; + private final int field_27190_b; + + J_InvalidSyntaxException(String var1, J_ThingWithPosition var2) { + super("At line " + var2.func_27330_b() + ", column " + var2.func_27331_a() + ": " + var1); + this.field_27191_a = var2.func_27331_a(); + this.field_27190_b = var2.func_27330_b(); + } + + J_InvalidSyntaxException(String var1, Throwable var2, J_ThingWithPosition var3) { + super("At line " + var3.func_27330_b() + ", column " + var3.func_27331_a() + ": " + var1, var2); + this.field_27191_a = var3.func_27331_a(); + this.field_27190_b = var3.func_27330_b(); + } +} diff --git a/src/net/minecraft/src/J_JdomParser.java b/src/net/minecraft/src/J_JdomParser.java new file mode 100644 index 0000000..3e99579 --- /dev/null +++ b/src/net/minecraft/src/J_JdomParser.java @@ -0,0 +1,22 @@ +package net.minecraft.src; + +import java.io.IOException; +import java.io.Reader; +import java.io.StringReader; + +public final class J_JdomParser { + public J_JsonRootNode func_27366_a(Reader var1) throws IOException, J_InvalidSyntaxException { + J_JsonListenerToJdomAdapter var2 = new J_JsonListenerToJdomAdapter(); + (new J_SajParser()).func_27463_a(var1, var2); + return var2.func_27208_a(); + } + + public J_JsonRootNode func_27367_a(String var1) throws J_InvalidSyntaxException { + try { + J_JsonRootNode var2 = this.func_27366_a(new StringReader(var1)); + return var2; + } catch (IOException var4) { + throw new RuntimeException("Coding failure in Argo: StringWriter gave an IOException", var4); + } + } +} diff --git a/src/net/minecraft/src/J_JsonArray.java b/src/net/minecraft/src/J_JsonArray.java new file mode 100644 index 0000000..a2bd87a --- /dev/null +++ b/src/net/minecraft/src/J_JsonArray.java @@ -0,0 +1,52 @@ +package net.minecraft.src; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +final class J_JsonArray extends J_JsonRootNode { + private final List field_27221_a; + + J_JsonArray(Iterable var1) { + this.field_27221_a = func_27220_a(var1); + } + + public EnumJsonNodeType func_27218_a() { + return EnumJsonNodeType.ARRAY; + } + + public List func_27215_d() { + return new ArrayList(this.field_27221_a); + } + + public String func_27216_b() { + throw new IllegalStateException("Attempt to get text on a JsonNode without text."); + } + + public Map func_27214_c() { + throw new IllegalStateException("Attempt to get fields on a JsonNode without fields."); + } + + public boolean equals(Object var1) { + if(this == var1) { + return true; + } else if(var1 != null && this.getClass() == var1.getClass()) { + J_JsonArray var2 = (J_JsonArray)var1; + return this.field_27221_a.equals(var2.field_27221_a); + } else { + return false; + } + } + + public int hashCode() { + return this.field_27221_a.hashCode(); + } + + public String toString() { + return "JsonArray elements:[" + this.field_27221_a + "]"; + } + + private static List func_27220_a(Iterable var0) { + return new J_JsonNodeList(var0); + } +} diff --git a/src/net/minecraft/src/J_JsonArrayNodeBuilder.java b/src/net/minecraft/src/J_JsonArrayNodeBuilder.java new file mode 100644 index 0000000..bc542b3 --- /dev/null +++ b/src/net/minecraft/src/J_JsonArrayNodeBuilder.java @@ -0,0 +1,30 @@ +package net.minecraft.src; + +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; + +public final class J_JsonArrayNodeBuilder implements J_JsonNodeBuilder { + private final List field_27242_a = new LinkedList(); + + public J_JsonArrayNodeBuilder func_27240_a(J_JsonNodeBuilder var1) { + this.field_27242_a.add(var1); + return this; + } + + public J_JsonRootNode func_27241_a() { + LinkedList var1 = new LinkedList(); + Iterator var2 = this.field_27242_a.iterator(); + + while(var2.hasNext()) { + J_JsonNodeBuilder var3 = (J_JsonNodeBuilder)var2.next(); + var1.add(var3.func_27234_b()); + } + + return J_JsonNodeFactories.func_27309_a(var1); + } + + public J_JsonNode func_27234_b() { + return this.func_27241_a(); + } +} diff --git a/src/net/minecraft/src/J_JsonArrayNodeSelector.java b/src/net/minecraft/src/J_JsonArrayNodeSelector.java new file mode 100644 index 0000000..2ee2ffe --- /dev/null +++ b/src/net/minecraft/src/J_JsonArrayNodeSelector.java @@ -0,0 +1,29 @@ +package net.minecraft.src; + +import java.util.List; + +final class J_JsonArrayNodeSelector extends J_LeafFunctor { + public boolean func_27074_a(J_JsonNode var1) { + return EnumJsonNodeType.ARRAY == var1.func_27218_a(); + } + + public String func_27060_a() { + return "A short form array"; + } + + public List func_27075_b(J_JsonNode var1) { + return var1.func_27215_d(); + } + + public String toString() { + return "an array"; + } + + public Object func_27063_c(Object var1) { + return this.func_27075_b((J_JsonNode)var1); + } + + public boolean func_27058_a(Object var1) { + return this.func_27074_a((J_JsonNode)var1); + } +} diff --git a/src/net/minecraft/src/J_JsonConstants.java b/src/net/minecraft/src/J_JsonConstants.java new file mode 100644 index 0000000..2fe17b6 --- /dev/null +++ b/src/net/minecraft/src/J_JsonConstants.java @@ -0,0 +1,31 @@ +package net.minecraft.src; + +import java.util.List; +import java.util.Map; + +final class J_JsonConstants extends J_JsonNode { + static final J_JsonConstants field_27228_a = new J_JsonConstants(EnumJsonNodeType.NULL); + static final J_JsonConstants field_27227_b = new J_JsonConstants(EnumJsonNodeType.TRUE); + static final J_JsonConstants field_27230_c = new J_JsonConstants(EnumJsonNodeType.FALSE); + private final EnumJsonNodeType field_27229_d; + + private J_JsonConstants(EnumJsonNodeType var1) { + this.field_27229_d = var1; + } + + public EnumJsonNodeType func_27218_a() { + return this.field_27229_d; + } + + public String func_27216_b() { + throw new IllegalStateException("Attempt to get text on a JsonNode without text."); + } + + public Map func_27214_c() { + throw new IllegalStateException("Attempt to get fields on a JsonNode without fields."); + } + + public List func_27215_d() { + throw new IllegalStateException("Attempt to get elements on a JsonNode without elements."); + } +} diff --git a/src/net/minecraft/src/J_JsonElementNodeSelector.java b/src/net/minecraft/src/J_JsonElementNodeSelector.java new file mode 100644 index 0000000..b4b5d0a --- /dev/null +++ b/src/net/minecraft/src/J_JsonElementNodeSelector.java @@ -0,0 +1,35 @@ +package net.minecraft.src; + +import java.util.List; + +final class J_JsonElementNodeSelector extends J_LeafFunctor { + final int field_27069_a; + + J_JsonElementNodeSelector(int var1) { + this.field_27069_a = var1; + } + + public boolean func_27067_a(List var1) { + return var1.size() > this.field_27069_a; + } + + public String func_27060_a() { + return Integer.toString(this.field_27069_a); + } + + public J_JsonNode func_27068_b(List var1) { + return (J_JsonNode)var1.get(this.field_27069_a); + } + + public String toString() { + return "an element at index [" + this.field_27069_a + "]"; + } + + public Object func_27063_c(Object var1) { + return this.func_27068_b((List)var1); + } + + public boolean func_27058_a(Object var1) { + return this.func_27067_a((List)var1); + } +} diff --git a/src/net/minecraft/src/J_JsonEscapedString.java b/src/net/minecraft/src/J_JsonEscapedString.java new file mode 100644 index 0000000..87fcf73 --- /dev/null +++ b/src/net/minecraft/src/J_JsonEscapedString.java @@ -0,0 +1,13 @@ +package net.minecraft.src; + +final class J_JsonEscapedString { + private final String field_27031_a; + + J_JsonEscapedString(String var1) { + this.field_27031_a = var1.replace("\\", "\\\\").replace("\"", "\\\"").replace("\b", "\\b").replace("\f", "\\f").replace("\n", "\\n").replace("\r", "\\r").replace("\t", "\\t"); + } + + public String toString() { + return this.field_27031_a; + } +} diff --git a/src/net/minecraft/src/J_JsonFalseNodeBuilder.java b/src/net/minecraft/src/J_JsonFalseNodeBuilder.java new file mode 100644 index 0000000..b20b231 --- /dev/null +++ b/src/net/minecraft/src/J_JsonFalseNodeBuilder.java @@ -0,0 +1,7 @@ +package net.minecraft.src; + +final class J_JsonFalseNodeBuilder implements J_JsonNodeBuilder { + public J_JsonNode func_27234_b() { + return J_JsonNodeFactories.func_27314_c(); + } +} diff --git a/src/net/minecraft/src/J_JsonFieldBuilder.java b/src/net/minecraft/src/J_JsonFieldBuilder.java new file mode 100644 index 0000000..0cdacb9 --- /dev/null +++ b/src/net/minecraft/src/J_JsonFieldBuilder.java @@ -0,0 +1,28 @@ +package net.minecraft.src; + +final class J_JsonFieldBuilder { + private J_JsonNodeBuilder field_27306_a; + private J_JsonNodeBuilder field_27305_b; + + static J_JsonFieldBuilder func_27301_a() { + return new J_JsonFieldBuilder(); + } + + J_JsonFieldBuilder func_27304_a(J_JsonNodeBuilder var1) { + this.field_27306_a = var1; + return this; + } + + J_JsonFieldBuilder func_27300_b(J_JsonNodeBuilder var1) { + this.field_27305_b = var1; + return this; + } + + J_JsonStringNode func_27303_b() { + return (J_JsonStringNode)this.field_27306_a.func_27234_b(); + } + + J_JsonNode func_27302_c() { + return this.field_27305_b.func_27234_b(); + } +} diff --git a/src/net/minecraft/src/J_JsonFieldNodeSelector.java b/src/net/minecraft/src/J_JsonFieldNodeSelector.java new file mode 100644 index 0000000..b3519be --- /dev/null +++ b/src/net/minecraft/src/J_JsonFieldNodeSelector.java @@ -0,0 +1,35 @@ +package net.minecraft.src; + +import java.util.Map; + +final class J_JsonFieldNodeSelector extends J_LeafFunctor { + final J_JsonStringNode field_27066_a; + + J_JsonFieldNodeSelector(J_JsonStringNode var1) { + this.field_27066_a = var1; + } + + public boolean func_27065_a(Map var1) { + return var1.containsKey(this.field_27066_a); + } + + public String func_27060_a() { + return "\"" + this.field_27066_a.func_27216_b() + "\""; + } + + public J_JsonNode func_27064_b(Map var1) { + return (J_JsonNode)var1.get(this.field_27066_a); + } + + public String toString() { + return "a field called [\"" + this.field_27066_a.func_27216_b() + "\"]"; + } + + public Object func_27063_c(Object var1) { + return this.func_27064_b((Map)var1); + } + + public boolean func_27058_a(Object var1) { + return this.func_27065_a((Map)var1); + } +} diff --git a/src/net/minecraft/src/J_JsonFormatter.java b/src/net/minecraft/src/J_JsonFormatter.java new file mode 100644 index 0000000..4986ed8 --- /dev/null +++ b/src/net/minecraft/src/J_JsonFormatter.java @@ -0,0 +1,5 @@ +package net.minecraft.src; + +public interface J_JsonFormatter { + String func_27327_a(J_JsonRootNode var1); +} diff --git a/src/net/minecraft/src/J_JsonListener.java b/src/net/minecraft/src/J_JsonListener.java new file mode 100644 index 0000000..1d2081f --- /dev/null +++ b/src/net/minecraft/src/J_JsonListener.java @@ -0,0 +1,29 @@ +package net.minecraft.src; + +public interface J_JsonListener { + void func_27195_b(); + + void func_27204_c(); + + void func_27200_d(); + + void func_27197_e(); + + void func_27194_f(); + + void func_27203_g(); + + void func_27205_a(String var1); + + void func_27199_h(); + + void func_27198_c(String var1); + + void func_27201_b(String var1); + + void func_27196_i(); + + void func_27193_j(); + + void func_27202_k(); +} diff --git a/src/net/minecraft/src/J_JsonListenerToJdomAdapter.java b/src/net/minecraft/src/J_JsonListenerToJdomAdapter.java new file mode 100644 index 0000000..a34fc05 --- /dev/null +++ b/src/net/minecraft/src/J_JsonListenerToJdomAdapter.java @@ -0,0 +1,81 @@ +package net.minecraft.src; + +import java.util.Stack; + +final class J_JsonListenerToJdomAdapter implements J_JsonListener { + private final Stack field_27210_a = new Stack(); + private J_JsonNodeBuilder field_27209_b; + + J_JsonRootNode func_27208_a() { + return (J_JsonRootNode)this.field_27209_b.func_27234_b(); + } + + public void func_27195_b() { + } + + public void func_27204_c() { + } + + public void func_27200_d() { + J_JsonArrayNodeBuilder var1 = J_JsonNodeBuilders.func_27249_e(); + this.func_27207_a(var1); + this.field_27210_a.push(new J_ArrayNodeContainer(this, var1)); + } + + public void func_27197_e() { + this.field_27210_a.pop(); + } + + public void func_27194_f() { + J_JsonObjectNodeBuilder var1 = J_JsonNodeBuilders.func_27253_d(); + this.func_27207_a(var1); + this.field_27210_a.push(new J_ObjectNodeContainer(this, var1)); + } + + public void func_27203_g() { + this.field_27210_a.pop(); + } + + public void func_27205_a(String var1) { + J_JsonFieldBuilder var2 = J_JsonFieldBuilder.func_27301_a().func_27304_a(J_JsonNodeBuilders.func_27254_b(var1)); + ((J_NodeContainer)this.field_27210_a.peek()).func_27289_a(var2); + this.field_27210_a.push(new J_FieldNodeContainer(this, var2)); + } + + public void func_27199_h() { + this.field_27210_a.pop(); + } + + public void func_27201_b(String var1) { + this.func_27206_b(J_JsonNodeBuilders.func_27250_a(var1)); + } + + public void func_27196_i() { + this.func_27206_b(J_JsonNodeBuilders.func_27251_b()); + } + + public void func_27198_c(String var1) { + this.func_27206_b(J_JsonNodeBuilders.func_27254_b(var1)); + } + + public void func_27193_j() { + this.func_27206_b(J_JsonNodeBuilders.func_27252_c()); + } + + public void func_27202_k() { + this.func_27206_b(J_JsonNodeBuilders.func_27248_a()); + } + + private void func_27207_a(J_JsonNodeBuilder var1) { + if(this.field_27209_b == null) { + this.field_27209_b = var1; + } else { + this.func_27206_b(var1); + } + + } + + private void func_27206_b(J_JsonNodeBuilder var1) { + ((J_NodeContainer)this.field_27210_a.peek()).func_27290_a(var1); + } +} diff --git a/src/net/minecraft/src/J_JsonNode.java b/src/net/minecraft/src/J_JsonNode.java new file mode 100644 index 0000000..bb3188e --- /dev/null +++ b/src/net/minecraft/src/J_JsonNode.java @@ -0,0 +1,30 @@ +package net.minecraft.src; + +import java.util.List; +import java.util.Map; + +public abstract class J_JsonNode { + public abstract EnumJsonNodeType func_27218_a(); + + public abstract String func_27216_b(); + + public abstract Map func_27214_c(); + + public abstract List func_27215_d(); + + public final String func_27213_a(Object... var1) { + return (String)this.func_27219_a(J_JsonNodeSelectors.func_27349_a(var1), this, var1); + } + + public final List func_27217_b(Object... var1) { + return (List)this.func_27219_a(J_JsonNodeSelectors.func_27346_b(var1), this, var1); + } + + private Object func_27219_a(J_JsonNodeSelector var1, J_JsonNode var2, Object[] var3) { + try { + return var1.func_27357_b(var2); + } catch (J_JsonNodeDoesNotMatchChainedJsonNodeSelectorException var5) { + throw J_JsonNodeDoesNotMatchPathElementsException.func_27319_a(var5, var3, J_JsonNodeFactories.func_27315_a(new J_JsonNode[]{var2})); + } + } +} diff --git a/src/net/minecraft/src/J_JsonNodeBuilder.java b/src/net/minecraft/src/J_JsonNodeBuilder.java new file mode 100644 index 0000000..03414fe --- /dev/null +++ b/src/net/minecraft/src/J_JsonNodeBuilder.java @@ -0,0 +1,5 @@ +package net.minecraft.src; + +public interface J_JsonNodeBuilder { + J_JsonNode func_27234_b(); +} diff --git a/src/net/minecraft/src/J_JsonNodeBuilders.java b/src/net/minecraft/src/J_JsonNodeBuilders.java new file mode 100644 index 0000000..c3139b6 --- /dev/null +++ b/src/net/minecraft/src/J_JsonNodeBuilders.java @@ -0,0 +1,31 @@ +package net.minecraft.src; + +public final class J_JsonNodeBuilders { + public static J_JsonNodeBuilder func_27248_a() { + return new J_JsonNullNodeBuilder(); + } + + public static J_JsonNodeBuilder func_27251_b() { + return new J_JsonTrueNodeBuilder(); + } + + public static J_JsonNodeBuilder func_27252_c() { + return new J_JsonFalseNodeBuilder(); + } + + public static J_JsonNodeBuilder func_27250_a(String var0) { + return new J_JsonNumberNodeBuilder(var0); + } + + public static J_JsonStringNodeBuilder func_27254_b(String var0) { + return new J_JsonStringNodeBuilder(var0); + } + + public static J_JsonObjectNodeBuilder func_27253_d() { + return new J_JsonObjectNodeBuilder(); + } + + public static J_JsonArrayNodeBuilder func_27249_e() { + return new J_JsonArrayNodeBuilder(); + } +} diff --git a/src/net/minecraft/src/J_JsonNodeDoesNotMatchChainedJsonNodeSelectorException.java b/src/net/minecraft/src/J_JsonNodeDoesNotMatchChainedJsonNodeSelectorException.java new file mode 100644 index 0000000..3630b52 --- /dev/null +++ b/src/net/minecraft/src/J_JsonNodeDoesNotMatchChainedJsonNodeSelectorException.java @@ -0,0 +1,48 @@ +package net.minecraft.src; + +import java.util.LinkedList; +import java.util.List; + +public final class J_JsonNodeDoesNotMatchChainedJsonNodeSelectorException extends J_JsonNodeDoesNotMatchJsonNodeSelectorException { + final J_Functor field_27326_a; + final List field_27325_b; + + static J_JsonNodeDoesNotMatchJsonNodeSelectorException func_27322_a(J_Functor var0) { + return new J_JsonNodeDoesNotMatchChainedJsonNodeSelectorException(var0, new LinkedList()); + } + + static J_JsonNodeDoesNotMatchJsonNodeSelectorException func_27323_a(J_JsonNodeDoesNotMatchChainedJsonNodeSelectorException var0, J_JsonNodeSelector var1) { + LinkedList var2 = new LinkedList(var0.field_27325_b); + var2.add(var1); + return new J_JsonNodeDoesNotMatchChainedJsonNodeSelectorException(var0.field_27326_a, var2); + } + + static J_JsonNodeDoesNotMatchJsonNodeSelectorException func_27321_b(J_JsonNodeDoesNotMatchChainedJsonNodeSelectorException var0, J_JsonNodeSelector var1) { + LinkedList var2 = new LinkedList(); + var2.add(var1); + return new J_JsonNodeDoesNotMatchChainedJsonNodeSelectorException(var0.field_27326_a, var2); + } + + private J_JsonNodeDoesNotMatchChainedJsonNodeSelectorException(J_Functor var1, List var2) { + super("Failed to match any JSON node at [" + func_27324_a(var2) + "]"); + this.field_27326_a = var1; + this.field_27325_b = var2; + } + + static String func_27324_a(List var0) { + StringBuilder var1 = new StringBuilder(); + + for(int var2 = var0.size() - 1; var2 >= 0; --var2) { + var1.append(((J_JsonNodeSelector)var0.get(var2)).func_27358_a()); + if(var2 != 0) { + var1.append("."); + } + } + + return var1.toString(); + } + + public String toString() { + return "JsonNodeDoesNotMatchJsonNodeSelectorException{failedNode=" + this.field_27326_a + ", failPath=" + this.field_27325_b + '}'; + } +} diff --git a/src/net/minecraft/src/J_JsonNodeDoesNotMatchJsonNodeSelectorException.java b/src/net/minecraft/src/J_JsonNodeDoesNotMatchJsonNodeSelectorException.java new file mode 100644 index 0000000..1203ed3 --- /dev/null +++ b/src/net/minecraft/src/J_JsonNodeDoesNotMatchJsonNodeSelectorException.java @@ -0,0 +1,7 @@ +package net.minecraft.src; + +public class J_JsonNodeDoesNotMatchJsonNodeSelectorException extends IllegalArgumentException { + J_JsonNodeDoesNotMatchJsonNodeSelectorException(String var1) { + super(var1); + } +} diff --git a/src/net/minecraft/src/J_JsonNodeDoesNotMatchPathElementsException.java b/src/net/minecraft/src/J_JsonNodeDoesNotMatchPathElementsException.java new file mode 100644 index 0000000..14c7177 --- /dev/null +++ b/src/net/minecraft/src/J_JsonNodeDoesNotMatchPathElementsException.java @@ -0,0 +1,40 @@ +package net.minecraft.src; + +public final class J_JsonNodeDoesNotMatchPathElementsException extends J_JsonNodeDoesNotMatchJsonNodeSelectorException { + private static final J_JsonFormatter field_27320_a = new J_CompactJsonFormatter(); + + static J_JsonNodeDoesNotMatchPathElementsException func_27319_a(J_JsonNodeDoesNotMatchChainedJsonNodeSelectorException var0, Object[] var1, J_JsonRootNode var2) { + return new J_JsonNodeDoesNotMatchPathElementsException(var0, var1, var2); + } + + private J_JsonNodeDoesNotMatchPathElementsException(J_JsonNodeDoesNotMatchChainedJsonNodeSelectorException var1, Object[] var2, J_JsonRootNode var3) { + super(func_27318_b(var1, var2, var3)); + } + + private static String func_27318_b(J_JsonNodeDoesNotMatchChainedJsonNodeSelectorException var0, Object[] var1, J_JsonRootNode var2) { + return "Failed to find " + var0.field_27326_a.toString() + " at [" + J_JsonNodeDoesNotMatchChainedJsonNodeSelectorException.func_27324_a(var0.field_27325_b) + "] while resolving [" + func_27317_a(var1) + "] in " + field_27320_a.func_27327_a(var2) + "."; + } + + private static String func_27317_a(Object[] var0) { + StringBuilder var1 = new StringBuilder(); + boolean var2 = true; + Object[] var3 = var0; + int var4 = var0.length; + + for(int var5 = 0; var5 < var4; ++var5) { + Object var6 = var3[var5]; + if(!var2) { + var1.append("."); + } + + var2 = false; + if(var6 instanceof String) { + var1.append("\"").append(var6).append("\""); + } else { + var1.append(var6); + } + } + + return var1.toString(); + } +} diff --git a/src/net/minecraft/src/J_JsonNodeFactories.java b/src/net/minecraft/src/J_JsonNodeFactories.java new file mode 100644 index 0000000..4e1b615 --- /dev/null +++ b/src/net/minecraft/src/J_JsonNodeFactories.java @@ -0,0 +1,38 @@ +package net.minecraft.src; + +import java.util.Arrays; +import java.util.Map; + +public final class J_JsonNodeFactories { + public static J_JsonNode func_27310_a() { + return J_JsonConstants.field_27228_a; + } + + public static J_JsonNode func_27313_b() { + return J_JsonConstants.field_27227_b; + } + + public static J_JsonNode func_27314_c() { + return J_JsonConstants.field_27230_c; + } + + public static J_JsonStringNode func_27316_a(String var0) { + return new J_JsonStringNode(var0); + } + + public static J_JsonNode func_27311_b(String var0) { + return new J_JsonNumberNode(var0); + } + + public static J_JsonRootNode func_27309_a(Iterable var0) { + return new J_JsonArray(var0); + } + + public static J_JsonRootNode func_27315_a(J_JsonNode... var0) { + return func_27309_a(Arrays.asList(var0)); + } + + public static J_JsonRootNode func_27312_a(Map var0) { + return new J_JsonObject(var0); + } +} diff --git a/src/net/minecraft/src/J_JsonNodeList.java b/src/net/minecraft/src/J_JsonNodeList.java new file mode 100644 index 0000000..f323ed5 --- /dev/null +++ b/src/net/minecraft/src/J_JsonNodeList.java @@ -0,0 +1,19 @@ +package net.minecraft.src; + +import java.util.ArrayList; +import java.util.Iterator; + +final class J_JsonNodeList extends ArrayList { + final Iterable field_27405_a; + + J_JsonNodeList(Iterable var1) { + this.field_27405_a = var1; + Iterator var2 = this.field_27405_a.iterator(); + + while(var2.hasNext()) { + J_JsonNode var3 = (J_JsonNode)var2.next(); + this.add(var3); + } + + } +} diff --git a/src/net/minecraft/src/J_JsonNodeSelector.java b/src/net/minecraft/src/J_JsonNodeSelector.java new file mode 100644 index 0000000..dbfdf51 --- /dev/null +++ b/src/net/minecraft/src/J_JsonNodeSelector.java @@ -0,0 +1,29 @@ +package net.minecraft.src; + +public final class J_JsonNodeSelector { + final J_Functor field_27359_a; + + J_JsonNodeSelector(J_Functor var1) { + this.field_27359_a = var1; + } + + public boolean func_27356_a(Object var1) { + return this.field_27359_a.func_27058_a(var1); + } + + public Object func_27357_b(Object var1) { + return this.field_27359_a.func_27059_b(var1); + } + + public J_JsonNodeSelector func_27355_a(J_JsonNodeSelector var1) { + return new J_JsonNodeSelector(new J_ChainedFunctor(this, var1)); + } + + String func_27358_a() { + return this.field_27359_a.func_27060_a(); + } + + public String toString() { + return this.field_27359_a.toString(); + } +} diff --git a/src/net/minecraft/src/J_JsonNodeSelectors.java b/src/net/minecraft/src/J_JsonNodeSelectors.java new file mode 100644 index 0000000..8cd2a96 --- /dev/null +++ b/src/net/minecraft/src/J_JsonNodeSelectors.java @@ -0,0 +1,59 @@ +package net.minecraft.src; + +import java.util.Arrays; + +public final class J_JsonNodeSelectors { + public static J_JsonNodeSelector func_27349_a(Object... var0) { + return func_27352_a(var0, new J_JsonNodeSelector(new J_JsonStringNodeSelector())); + } + + public static J_JsonNodeSelector func_27346_b(Object... var0) { + return func_27352_a(var0, new J_JsonNodeSelector(new J_JsonArrayNodeSelector())); + } + + public static J_JsonNodeSelector func_27353_c(Object... var0) { + return func_27352_a(var0, new J_JsonNodeSelector(new J_JsonObjectNodeSelector())); + } + + public static J_JsonNodeSelector func_27348_a(String var0) { + return func_27350_a(J_JsonNodeFactories.func_27316_a(var0)); + } + + public static J_JsonNodeSelector func_27350_a(J_JsonStringNode var0) { + return new J_JsonNodeSelector(new J_JsonFieldNodeSelector(var0)); + } + + public static J_JsonNodeSelector func_27351_b(String var0) { + return func_27353_c(new Object[0]).func_27355_a(func_27348_a(var0)); + } + + public static J_JsonNodeSelector func_27347_a(int var0) { + return new J_JsonNodeSelector(new J_JsonElementNodeSelector(var0)); + } + + public static J_JsonNodeSelector func_27354_b(int var0) { + return func_27346_b(new Object[0]).func_27355_a(func_27347_a(var0)); + } + + private static J_JsonNodeSelector func_27352_a(Object[] var0, J_JsonNodeSelector var1) { + J_JsonNodeSelector var2 = var1; + + for(int var3 = var0.length - 1; var3 >= 0; --var3) { + if(var0[var3] instanceof Integer) { + var2 = func_27345_a(func_27354_b(((Integer)var0[var3]).intValue()), var2); + } else { + if(!(var0[var3] instanceof String)) { + throw new IllegalArgumentException("Element [" + var0[var3] + "] of path elements" + " [" + Arrays.toString(var0) + "] was of illegal type [" + var0[var3].getClass().getCanonicalName() + "]; only Integer and String are valid."); + } + + var2 = func_27345_a(func_27351_b((String)var0[var3]), var2); + } + } + + return var2; + } + + private static J_JsonNodeSelector func_27345_a(J_JsonNodeSelector var0, J_JsonNodeSelector var1) { + return new J_JsonNodeSelector(new J_ChainedFunctor(var0, var1)); + } +} diff --git a/src/net/minecraft/src/J_JsonNullNodeBuilder.java b/src/net/minecraft/src/J_JsonNullNodeBuilder.java new file mode 100644 index 0000000..6503881 --- /dev/null +++ b/src/net/minecraft/src/J_JsonNullNodeBuilder.java @@ -0,0 +1,7 @@ +package net.minecraft.src; + +final class J_JsonNullNodeBuilder implements J_JsonNodeBuilder { + public J_JsonNode func_27234_b() { + return J_JsonNodeFactories.func_27310_a(); + } +} diff --git a/src/net/minecraft/src/J_JsonNumberNode.java b/src/net/minecraft/src/J_JsonNumberNode.java new file mode 100644 index 0000000..f60ad59 --- /dev/null +++ b/src/net/minecraft/src/J_JsonNumberNode.java @@ -0,0 +1,55 @@ +package net.minecraft.src; + +import java.util.List; +import java.util.Map; +import java.util.regex.Pattern; + +final class J_JsonNumberNode extends J_JsonNode { + private static final Pattern field_27226_a = Pattern.compile("(-?)(0|([1-9]([0-9]*)))(\\.[0-9]+)?((e|E)(\\+|-)?[0-9]+)?"); + private final String field_27225_b; + + J_JsonNumberNode(String var1) { + if(var1 == null) { + throw new NullPointerException("Attempt to construct a JsonNumber with a null value."); + } else if(!field_27226_a.matcher(var1).matches()) { + throw new IllegalArgumentException("Attempt to construct a JsonNumber with a String [" + var1 + "] that does not match the JSON number specification."); + } else { + this.field_27225_b = var1; + } + } + + public EnumJsonNodeType func_27218_a() { + return EnumJsonNodeType.NUMBER; + } + + public String func_27216_b() { + return this.field_27225_b; + } + + public Map func_27214_c() { + throw new IllegalStateException("Attempt to get fields on a JsonNode without fields."); + } + + public List func_27215_d() { + throw new IllegalStateException("Attempt to get elements on a JsonNode without elements."); + } + + public boolean equals(Object var1) { + if(this == var1) { + return true; + } else if(var1 != null && this.getClass() == var1.getClass()) { + J_JsonNumberNode var2 = (J_JsonNumberNode)var1; + return this.field_27225_b.equals(var2.field_27225_b); + } else { + return false; + } + } + + public int hashCode() { + return this.field_27225_b.hashCode(); + } + + public String toString() { + return "JsonNumberNode value:[" + this.field_27225_b + "]"; + } +} diff --git a/src/net/minecraft/src/J_JsonNumberNodeBuilder.java b/src/net/minecraft/src/J_JsonNumberNodeBuilder.java new file mode 100644 index 0000000..a9d4d21 --- /dev/null +++ b/src/net/minecraft/src/J_JsonNumberNodeBuilder.java @@ -0,0 +1,13 @@ +package net.minecraft.src; + +final class J_JsonNumberNodeBuilder implements J_JsonNodeBuilder { + private final J_JsonNode field_27239_a; + + J_JsonNumberNodeBuilder(String var1) { + this.field_27239_a = J_JsonNodeFactories.func_27311_b(var1); + } + + public J_JsonNode func_27234_b() { + return this.field_27239_a; + } +} diff --git a/src/net/minecraft/src/J_JsonObject.java b/src/net/minecraft/src/J_JsonObject.java new file mode 100644 index 0000000..f805518 --- /dev/null +++ b/src/net/minecraft/src/J_JsonObject.java @@ -0,0 +1,48 @@ +package net.minecraft.src; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +final class J_JsonObject extends J_JsonRootNode { + private final Map field_27222_a; + + J_JsonObject(Map var1) { + this.field_27222_a = new HashMap(var1); + } + + public Map func_27214_c() { + return new HashMap(this.field_27222_a); + } + + public EnumJsonNodeType func_27218_a() { + return EnumJsonNodeType.OBJECT; + } + + public String func_27216_b() { + throw new IllegalStateException("Attempt to get text on a JsonNode without text."); + } + + public List func_27215_d() { + throw new IllegalStateException("Attempt to get elements on a JsonNode without elements."); + } + + public boolean equals(Object var1) { + if(this == var1) { + return true; + } else if(var1 != null && this.getClass() == var1.getClass()) { + J_JsonObject var2 = (J_JsonObject)var1; + return this.field_27222_a.equals(var2.field_27222_a); + } else { + return false; + } + } + + public int hashCode() { + return this.field_27222_a.hashCode(); + } + + public String toString() { + return "JsonObject fields:[" + this.field_27222_a + "]"; + } +} diff --git a/src/net/minecraft/src/J_JsonObjectNodeBuilder.java b/src/net/minecraft/src/J_JsonObjectNodeBuilder.java new file mode 100644 index 0000000..6fe5327 --- /dev/null +++ b/src/net/minecraft/src/J_JsonObjectNodeBuilder.java @@ -0,0 +1,25 @@ +package net.minecraft.src; + +import java.util.LinkedList; +import java.util.List; + +public final class J_JsonObjectNodeBuilder implements J_JsonNodeBuilder { + private final List field_27238_a = new LinkedList(); + + public J_JsonObjectNodeBuilder func_27237_a(J_JsonFieldBuilder var1) { + this.field_27238_a.add(var1); + return this; + } + + public J_JsonRootNode func_27235_a() { + return J_JsonNodeFactories.func_27312_a(new J_JsonObjectNodeList(this)); + } + + public J_JsonNode func_27234_b() { + return this.func_27235_a(); + } + + static List func_27236_a(J_JsonObjectNodeBuilder var0) { + return var0.field_27238_a; + } +} diff --git a/src/net/minecraft/src/J_JsonObjectNodeList.java b/src/net/minecraft/src/J_JsonObjectNodeList.java new file mode 100644 index 0000000..19f2c4f --- /dev/null +++ b/src/net/minecraft/src/J_JsonObjectNodeList.java @@ -0,0 +1,19 @@ +package net.minecraft.src; + +import java.util.HashMap; +import java.util.Iterator; + +class J_JsonObjectNodeList extends HashMap { + final J_JsonObjectNodeBuilder field_27308_a; + + J_JsonObjectNodeList(J_JsonObjectNodeBuilder var1) { + this.field_27308_a = var1; + Iterator var2 = J_JsonObjectNodeBuilder.func_27236_a(this.field_27308_a).iterator(); + + while(var2.hasNext()) { + J_JsonFieldBuilder var3 = (J_JsonFieldBuilder)var2.next(); + this.put(var3.func_27303_b(), var3.func_27302_c()); + } + + } +} diff --git a/src/net/minecraft/src/J_JsonObjectNodeSelector.java b/src/net/minecraft/src/J_JsonObjectNodeSelector.java new file mode 100644 index 0000000..90b2639 --- /dev/null +++ b/src/net/minecraft/src/J_JsonObjectNodeSelector.java @@ -0,0 +1,29 @@ +package net.minecraft.src; + +import java.util.Map; + +final class J_JsonObjectNodeSelector extends J_LeafFunctor { + public boolean func_27070_a(J_JsonNode var1) { + return EnumJsonNodeType.OBJECT == var1.func_27218_a(); + } + + public String func_27060_a() { + return "A short form object"; + } + + public Map func_27071_b(J_JsonNode var1) { + return var1.func_27214_c(); + } + + public String toString() { + return "an object"; + } + + public Object func_27063_c(Object var1) { + return this.func_27071_b((J_JsonNode)var1); + } + + public boolean func_27058_a(Object var1) { + return this.func_27070_a((J_JsonNode)var1); + } +} diff --git a/src/net/minecraft/src/J_JsonRootNode.java b/src/net/minecraft/src/J_JsonRootNode.java new file mode 100644 index 0000000..e63ef7d --- /dev/null +++ b/src/net/minecraft/src/J_JsonRootNode.java @@ -0,0 +1,4 @@ +package net.minecraft.src; + +public abstract class J_JsonRootNode extends J_JsonNode { +} diff --git a/src/net/minecraft/src/J_JsonStringNode.java b/src/net/minecraft/src/J_JsonStringNode.java new file mode 100644 index 0000000..7349506 --- /dev/null +++ b/src/net/minecraft/src/J_JsonStringNode.java @@ -0,0 +1,59 @@ +package net.minecraft.src; + +import java.util.List; +import java.util.Map; + +public final class J_JsonStringNode extends J_JsonNode implements Comparable { + private final String field_27224_a; + + J_JsonStringNode(String var1) { + if(var1 == null) { + throw new NullPointerException("Attempt to construct a JsonString with a null value."); + } else { + this.field_27224_a = var1; + } + } + + public EnumJsonNodeType func_27218_a() { + return EnumJsonNodeType.STRING; + } + + public String func_27216_b() { + return this.field_27224_a; + } + + public Map func_27214_c() { + throw new IllegalStateException("Attempt to get fields on a JsonNode without fields."); + } + + public List func_27215_d() { + throw new IllegalStateException("Attempt to get elements on a JsonNode without elements."); + } + + public boolean equals(Object var1) { + if(this == var1) { + return true; + } else if(var1 != null && this.getClass() == var1.getClass()) { + J_JsonStringNode var2 = (J_JsonStringNode)var1; + return this.field_27224_a.equals(var2.field_27224_a); + } else { + return false; + } + } + + public int hashCode() { + return this.field_27224_a.hashCode(); + } + + public String toString() { + return "JsonStringNode value:[" + this.field_27224_a + "]"; + } + + public int func_27223_a(J_JsonStringNode var1) { + return this.field_27224_a.compareTo(var1.field_27224_a); + } + + public int compareTo(Object var1) { + return this.func_27223_a((J_JsonStringNode)var1); + } +} diff --git a/src/net/minecraft/src/J_JsonStringNodeBuilder.java b/src/net/minecraft/src/J_JsonStringNodeBuilder.java new file mode 100644 index 0000000..924daa4 --- /dev/null +++ b/src/net/minecraft/src/J_JsonStringNodeBuilder.java @@ -0,0 +1,17 @@ +package net.minecraft.src; + +public final class J_JsonStringNodeBuilder implements J_JsonNodeBuilder { + private final String field_27244_a; + + J_JsonStringNodeBuilder(String var1) { + this.field_27244_a = var1; + } + + public J_JsonStringNode func_27243_a() { + return J_JsonNodeFactories.func_27316_a(this.field_27244_a); + } + + public J_JsonNode func_27234_b() { + return this.func_27243_a(); + } +} diff --git a/src/net/minecraft/src/J_JsonStringNodeSelector.java b/src/net/minecraft/src/J_JsonStringNodeSelector.java new file mode 100644 index 0000000..aff2fb5 --- /dev/null +++ b/src/net/minecraft/src/J_JsonStringNodeSelector.java @@ -0,0 +1,27 @@ +package net.minecraft.src; + +final class J_JsonStringNodeSelector extends J_LeafFunctor { + public boolean func_27072_a(J_JsonNode var1) { + return EnumJsonNodeType.STRING == var1.func_27218_a(); + } + + public String func_27060_a() { + return "A short form string"; + } + + public String func_27073_b(J_JsonNode var1) { + return var1.func_27216_b(); + } + + public String toString() { + return "a value that is a string"; + } + + public Object func_27063_c(Object var1) { + return this.func_27073_b((J_JsonNode)var1); + } + + public boolean func_27058_a(Object var1) { + return this.func_27072_a((J_JsonNode)var1); + } +} diff --git a/src/net/minecraft/src/J_JsonTrueNodeBuilder.java b/src/net/minecraft/src/J_JsonTrueNodeBuilder.java new file mode 100644 index 0000000..9321796 --- /dev/null +++ b/src/net/minecraft/src/J_JsonTrueNodeBuilder.java @@ -0,0 +1,7 @@ +package net.minecraft.src; + +final class J_JsonTrueNodeBuilder implements J_JsonNodeBuilder { + public J_JsonNode func_27234_b() { + return J_JsonNodeFactories.func_27313_b(); + } +} diff --git a/src/net/minecraft/src/J_LeafFunctor.java b/src/net/minecraft/src/J_LeafFunctor.java new file mode 100644 index 0000000..f74ef38 --- /dev/null +++ b/src/net/minecraft/src/J_LeafFunctor.java @@ -0,0 +1,13 @@ +package net.minecraft.src; + +abstract class J_LeafFunctor implements J_Functor { + public final Object func_27059_b(Object var1) { + if(!this.func_27058_a(var1)) { + throw J_JsonNodeDoesNotMatchChainedJsonNodeSelectorException.func_27322_a(this); + } else { + return this.func_27063_c(var1); + } + } + + protected abstract Object func_27063_c(Object var1); +} diff --git a/src/net/minecraft/src/J_NodeContainer.java b/src/net/minecraft/src/J_NodeContainer.java new file mode 100644 index 0000000..c38c854 --- /dev/null +++ b/src/net/minecraft/src/J_NodeContainer.java @@ -0,0 +1,7 @@ +package net.minecraft.src; + +interface J_NodeContainer { + void func_27290_a(J_JsonNodeBuilder var1); + + void func_27289_a(J_JsonFieldBuilder var1); +} diff --git a/src/net/minecraft/src/J_ObjectNodeContainer.java b/src/net/minecraft/src/J_ObjectNodeContainer.java new file mode 100644 index 0000000..ef9b118 --- /dev/null +++ b/src/net/minecraft/src/J_ObjectNodeContainer.java @@ -0,0 +1,19 @@ +package net.minecraft.src; + +class J_ObjectNodeContainer implements J_NodeContainer { + final J_JsonObjectNodeBuilder field_27296_a; + final J_JsonListenerToJdomAdapter field_27295_b; + + J_ObjectNodeContainer(J_JsonListenerToJdomAdapter var1, J_JsonObjectNodeBuilder var2) { + this.field_27295_b = var1; + this.field_27296_a = var2; + } + + public void func_27290_a(J_JsonNodeBuilder var1) { + throw new RuntimeException("Coding failure in Argo: Attempt to add a node to an object."); + } + + public void func_27289_a(J_JsonFieldBuilder var1) { + this.field_27296_a.func_27237_a(var1); + } +} diff --git a/src/net/minecraft/src/J_PositionTrackingPushbackReader.java b/src/net/minecraft/src/J_PositionTrackingPushbackReader.java new file mode 100644 index 0000000..bbff36a --- /dev/null +++ b/src/net/minecraft/src/J_PositionTrackingPushbackReader.java @@ -0,0 +1,78 @@ +package net.minecraft.src; + +import java.io.IOException; +import java.io.PushbackReader; +import java.io.Reader; + +final class J_PositionTrackingPushbackReader implements J_ThingWithPosition { + private final PushbackReader field_27338_a; + private int field_27337_b = 0; + private int field_27340_c = 1; + private boolean field_27339_d = false; + + public J_PositionTrackingPushbackReader(Reader var1) { + this.field_27338_a = new PushbackReader(var1); + } + + public void func_27334_a(char var1) throws IOException { + --this.field_27337_b; + if(this.field_27337_b < 0) { + this.field_27337_b = 0; + } + + this.field_27338_a.unread(var1); + } + + public void func_27335_a(char[] var1) { + this.field_27337_b -= var1.length; + if(this.field_27337_b < 0) { + this.field_27337_b = 0; + } + + } + + public int func_27333_c() throws IOException { + int var1 = this.field_27338_a.read(); + this.func_27332_a(var1); + return var1; + } + + public int func_27336_b(char[] var1) throws IOException { + int var2 = this.field_27338_a.read(var1); + char[] var3 = var1; + int var4 = var1.length; + + for(int var5 = 0; var5 < var4; ++var5) { + char var6 = var3[var5]; + this.func_27332_a(var6); + } + + return var2; + } + + private void func_27332_a(int var1) { + if(13 == var1) { + this.field_27337_b = 0; + ++this.field_27340_c; + this.field_27339_d = true; + } else { + if(10 == var1 && !this.field_27339_d) { + this.field_27337_b = 0; + ++this.field_27340_c; + } else { + ++this.field_27337_b; + } + + this.field_27339_d = false; + } + + } + + public int func_27331_a() { + return this.field_27337_b; + } + + public int func_27330_b() { + return this.field_27340_c; + } +} diff --git a/src/net/minecraft/src/J_SajParser.java b/src/net/minecraft/src/J_SajParser.java new file mode 100644 index 0000000..d3ed967 --- /dev/null +++ b/src/net/minecraft/src/J_SajParser.java @@ -0,0 +1,417 @@ +package net.minecraft.src; + +import java.io.IOException; +import java.io.Reader; +import java.util.Arrays; + +public final class J_SajParser { + public void func_27463_a(Reader var1, J_JsonListener var2) throws IOException, J_InvalidSyntaxException { + J_PositionTrackingPushbackReader var3 = new J_PositionTrackingPushbackReader(var1); + char var4 = (char)var3.func_27333_c(); + switch(var4) { + case '[': + var3.func_27334_a(var4); + var2.func_27195_b(); + this.func_27455_a(var3, var2); + break; + case '{': + var3.func_27334_a(var4); + var2.func_27195_b(); + this.func_27453_b(var3, var2); + break; + default: + throw new J_InvalidSyntaxException("Expected either [ or { but got [" + var4 + "].", var3); + } + + int var5 = this.func_27448_l(var3); + if(var5 != -1) { + throw new J_InvalidSyntaxException("Got unexpected trailing character [" + (char)var5 + "].", var3); + } else { + var2.func_27204_c(); + } + } + + private void func_27455_a(J_PositionTrackingPushbackReader var1, J_JsonListener var2) throws IOException, J_InvalidSyntaxException { + char var3 = (char)this.func_27448_l(var1); + if(var3 != 91) { + throw new J_InvalidSyntaxException("Expected object to start with [ but got [" + var3 + "].", var1); + } else { + var2.func_27200_d(); + char var4 = (char)this.func_27448_l(var1); + var1.func_27334_a(var4); + if(var4 != 93) { + this.func_27464_d(var1, var2); + } + + boolean var5 = false; + + while(!var5) { + char var6 = (char)this.func_27448_l(var1); + switch(var6) { + case ',': + this.func_27464_d(var1, var2); + break; + case ']': + var5 = true; + break; + default: + throw new J_InvalidSyntaxException("Expected either , or ] but got [" + var6 + "].", var1); + } + } + + var2.func_27197_e(); + } + } + + private void func_27453_b(J_PositionTrackingPushbackReader var1, J_JsonListener var2) throws IOException, J_InvalidSyntaxException { + char var3 = (char)this.func_27448_l(var1); + if(var3 != 123) { + throw new J_InvalidSyntaxException("Expected object to start with { but got [" + var3 + "].", var1); + } else { + var2.func_27194_f(); + char var4 = (char)this.func_27448_l(var1); + var1.func_27334_a(var4); + if(var4 != 125) { + this.func_27449_c(var1, var2); + } + + boolean var5 = false; + + while(!var5) { + char var6 = (char)this.func_27448_l(var1); + switch(var6) { + case ',': + this.func_27449_c(var1, var2); + break; + case '}': + var5 = true; + break; + default: + throw new J_InvalidSyntaxException("Expected either , or } but got [" + var6 + "].", var1); + } + } + + var2.func_27203_g(); + } + } + + private void func_27449_c(J_PositionTrackingPushbackReader var1, J_JsonListener var2) throws IOException, J_InvalidSyntaxException { + char var3 = (char)this.func_27448_l(var1); + if(34 != var3) { + throw new J_InvalidSyntaxException("Expected object identifier to begin with [\"] but got [" + var3 + "].", var1); + } else { + var1.func_27334_a(var3); + var2.func_27205_a(this.func_27452_i(var1)); + char var4 = (char)this.func_27448_l(var1); + if(var4 != 58) { + throw new J_InvalidSyntaxException("Expected object identifier to be followed by : but got [" + var4 + "].", var1); + } else { + this.func_27464_d(var1, var2); + var2.func_27199_h(); + } + } + } + + private void func_27464_d(J_PositionTrackingPushbackReader var1, J_JsonListener var2) throws IOException, J_InvalidSyntaxException { + char var3 = (char)this.func_27448_l(var1); + switch(var3) { + case '\"': + var1.func_27334_a(var3); + var2.func_27198_c(this.func_27452_i(var1)); + break; + case '-': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + var1.func_27334_a(var3); + var2.func_27201_b(this.func_27459_a(var1)); + break; + case '[': + var1.func_27334_a(var3); + this.func_27455_a(var1, var2); + break; + case 'f': + char[] var6 = new char[4]; + int var7 = var1.func_27336_b(var6); + if(var7 != 4 || var6[0] != 97 || var6[1] != 108 || var6[2] != 115 || var6[3] != 101) { + var1.func_27335_a(var6); + throw new J_InvalidSyntaxException("Expected \'f\' to be followed by [[a, l, s, e]], but got [" + Arrays.toString(var6) + "].", var1); + } + + var2.func_27193_j(); + break; + case 'n': + char[] var8 = new char[3]; + int var9 = var1.func_27336_b(var8); + if(var9 != 3 || var8[0] != 117 || var8[1] != 108 || var8[2] != 108) { + var1.func_27335_a(var8); + throw new J_InvalidSyntaxException("Expected \'n\' to be followed by [[u, l, l]], but got [" + Arrays.toString(var8) + "].", var1); + } + + var2.func_27202_k(); + break; + case 't': + char[] var4 = new char[3]; + int var5 = var1.func_27336_b(var4); + if(var5 != 3 || var4[0] != 114 || var4[1] != 117 || var4[2] != 101) { + var1.func_27335_a(var4); + throw new J_InvalidSyntaxException("Expected \'t\' to be followed by [[r, u, e]], but got [" + Arrays.toString(var4) + "].", var1); + } + + var2.func_27196_i(); + break; + case '{': + var1.func_27334_a(var3); + this.func_27453_b(var1, var2); + break; + default: + throw new J_InvalidSyntaxException("Invalid character at start of value [" + var3 + "].", var1); + } + + } + + private String func_27459_a(J_PositionTrackingPushbackReader var1) throws IOException, J_InvalidSyntaxException { + StringBuilder var2 = new StringBuilder(); + char var3 = (char)var1.func_27333_c(); + if(45 == var3) { + var2.append('-'); + } else { + var1.func_27334_a(var3); + } + + var2.append(this.func_27451_b(var1)); + return var2.toString(); + } + + private String func_27451_b(J_PositionTrackingPushbackReader var1) throws IOException, J_InvalidSyntaxException { + StringBuilder var2 = new StringBuilder(); + char var3 = (char)var1.func_27333_c(); + if(48 == var3) { + var2.append('0'); + var2.append(this.func_27462_f(var1)); + var2.append(this.func_27454_g(var1)); + } else { + var1.func_27334_a(var3); + var2.append(this.func_27460_c(var1)); + var2.append(this.func_27456_e(var1)); + var2.append(this.func_27462_f(var1)); + var2.append(this.func_27454_g(var1)); + } + + return var2.toString(); + } + + private char func_27460_c(J_PositionTrackingPushbackReader var1) throws IOException, J_InvalidSyntaxException { + char var3 = (char)var1.func_27333_c(); + switch(var3) { + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + return var3; + default: + throw new J_InvalidSyntaxException("Expected a digit 1 - 9 but got [" + var3 + "].", var1); + } + } + + private char func_27458_d(J_PositionTrackingPushbackReader var1) throws IOException, J_InvalidSyntaxException { + char var3 = (char)var1.func_27333_c(); + switch(var3) { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + return var3; + default: + throw new J_InvalidSyntaxException("Expected a digit 1 - 9 but got [" + var3 + "].", var1); + } + } + + private String func_27456_e(J_PositionTrackingPushbackReader var1) throws IOException { + StringBuilder var2 = new StringBuilder(); + boolean var3 = false; + + while(!var3) { + char var4 = (char)var1.func_27333_c(); + switch(var4) { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + var2.append(var4); + break; + default: + var3 = true; + var1.func_27334_a(var4); + } + } + + return var2.toString(); + } + + private String func_27462_f(J_PositionTrackingPushbackReader var1) throws IOException, J_InvalidSyntaxException { + StringBuilder var2 = new StringBuilder(); + char var3 = (char)var1.func_27333_c(); + if(var3 == 46) { + var2.append('.'); + var2.append(this.func_27458_d(var1)); + var2.append(this.func_27456_e(var1)); + } else { + var1.func_27334_a(var3); + } + + return var2.toString(); + } + + private String func_27454_g(J_PositionTrackingPushbackReader var1) throws IOException, J_InvalidSyntaxException { + StringBuilder var2 = new StringBuilder(); + char var3 = (char)var1.func_27333_c(); + if(var3 != 46 && var3 != 69) { + var1.func_27334_a(var3); + } else { + var2.append('E'); + var2.append(this.func_27461_h(var1)); + var2.append(this.func_27458_d(var1)); + var2.append(this.func_27456_e(var1)); + } + + return var2.toString(); + } + + private String func_27461_h(J_PositionTrackingPushbackReader var1) throws IOException { + StringBuilder var2 = new StringBuilder(); + char var3 = (char)var1.func_27333_c(); + if(var3 != 43 && var3 != 45) { + var1.func_27334_a(var3); + } else { + var2.append(var3); + } + + return var2.toString(); + } + + private String func_27452_i(J_PositionTrackingPushbackReader var1) throws IOException, J_InvalidSyntaxException { + StringBuilder var2 = new StringBuilder(); + char var3 = (char)var1.func_27333_c(); + if(34 != var3) { + throw new J_InvalidSyntaxException("Expected [\"] but got [" + var3 + "].", var1); + } else { + boolean var4 = false; + + while(!var4) { + char var5 = (char)var1.func_27333_c(); + switch(var5) { + case '\"': + var4 = true; + break; + case '\\': + char var6 = this.func_27457_j(var1); + var2.append(var6); + break; + default: + var2.append(var5); + } + } + + return var2.toString(); + } + } + + private char func_27457_j(J_PositionTrackingPushbackReader var1) throws IOException, J_InvalidSyntaxException { + char var3 = (char)var1.func_27333_c(); + char var2; + switch(var3) { + case '\"': + var2 = 34; + break; + case '/': + var2 = 47; + break; + case '\\': + var2 = 92; + break; + case 'b': + var2 = 8; + break; + case 'f': + var2 = 12; + break; + case 'n': + var2 = 10; + break; + case 'r': + var2 = 13; + break; + case 't': + var2 = 9; + break; + case 'u': + var2 = (char)this.func_27450_k(var1); + break; + default: + throw new J_InvalidSyntaxException("Unrecognised escape character [" + var3 + "].", var1); + } + + return var2; + } + + private int func_27450_k(J_PositionTrackingPushbackReader var1) throws IOException, J_InvalidSyntaxException { + char[] var2 = new char[4]; + int var3 = var1.func_27336_b(var2); + if(var3 != 4) { + throw new J_InvalidSyntaxException("Expected a 4 digit hexidecimal number but got only [" + var3 + "], namely [" + String.valueOf(var2, 0, var3) + "].", var1); + } else { + try { + int var4 = Integer.parseInt(String.valueOf(var2), 16); + return var4; + } catch (NumberFormatException var6) { + var1.func_27335_a(var2); + throw new J_InvalidSyntaxException("Unable to parse [" + String.valueOf(var2) + "] as a hexidecimal number.", var6, var1); + } + } + } + + private int func_27448_l(J_PositionTrackingPushbackReader var1) throws IOException { + boolean var3 = false; + + int var2; + do { + var2 = var1.func_27333_c(); + switch(var2) { + case 9: + case 10: + case 13: + case 32: + break; + default: + var3 = true; + } + } while(!var3); + + return var2; + } +} diff --git a/src/net/minecraft/src/J_ThingWithPosition.java b/src/net/minecraft/src/J_ThingWithPosition.java new file mode 100644 index 0000000..908dbb2 --- /dev/null +++ b/src/net/minecraft/src/J_ThingWithPosition.java @@ -0,0 +1,7 @@ +package net.minecraft.src; + +interface J_ThingWithPosition { + int func_27331_a(); + + int func_27330_b(); +} diff --git a/src/net/minecraft/src/KeyBinding.java b/src/net/minecraft/src/KeyBinding.java new file mode 100644 index 0000000..8f0d528 --- /dev/null +++ b/src/net/minecraft/src/KeyBinding.java @@ -0,0 +1,11 @@ +package net.minecraft.src; + +public class KeyBinding { + public String keyDescription; + public int keyCode; + + public KeyBinding(String var1, int var2) { + this.keyDescription = var1; + this.keyCode = var2; + } +} diff --git a/src/net/minecraft/src/LoadingScreenRenderer.java b/src/net/minecraft/src/LoadingScreenRenderer.java new file mode 100644 index 0000000..e71d587 --- /dev/null +++ b/src/net/minecraft/src/LoadingScreenRenderer.java @@ -0,0 +1,123 @@ +package net.minecraft.src; + +import net.minecraft.client.Minecraft; +import org.lwjgl.opengl.Display; +import org.lwjgl.opengl.GL11; + +public class LoadingScreenRenderer implements IProgressUpdate { + private String field_1004_a = ""; + private Minecraft mc; + private String field_1007_c = ""; + private long field_1006_d = System.currentTimeMillis(); + private boolean field_1005_e = false; + + public LoadingScreenRenderer(Minecraft var1) { + this.mc = var1; + } + + public void printText(String var1) { + this.field_1005_e = false; + this.func_597_c(var1); + } + + public void func_594_b(String var1) { + this.field_1005_e = true; + this.func_597_c(this.field_1007_c); + } + + public void func_597_c(String var1) { + if(!this.mc.running) { + if(!this.field_1005_e) { + throw new MinecraftError(); + } + } else { + this.field_1007_c = var1; + ScaledResolution var2 = new ScaledResolution(this.mc.gameSettings, this.mc.displayWidth, this.mc.displayHeight); + GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT); + GL11.glMatrixMode(GL11.GL_PROJECTION); + GL11.glLoadIdentity(); + GL11.glOrtho(0.0D, var2.field_25121_a, var2.field_25120_b, 0.0D, 100.0D, 300.0D); + GL11.glMatrixMode(GL11.GL_MODELVIEW); + GL11.glLoadIdentity(); + GL11.glTranslatef(0.0F, 0.0F, -200.0F); + } + } + + public void displayLoadingString(String var1) { + if(!this.mc.running) { + if(!this.field_1005_e) { + throw new MinecraftError(); + } + } else { + this.field_1006_d = 0L; + this.field_1004_a = var1; + this.setLoadingProgress(-1); + this.field_1006_d = 0L; + } + } + + public void setLoadingProgress(int var1) { + if(!this.mc.running) { + if(!this.field_1005_e) { + throw new MinecraftError(); + } + } else { + long var2 = System.currentTimeMillis(); + if(var2 - this.field_1006_d >= 20L) { + this.field_1006_d = var2; + ScaledResolution var4 = new ScaledResolution(this.mc.gameSettings, this.mc.displayWidth, this.mc.displayHeight); + int var5 = var4.getScaledWidth(); + int var6 = var4.getScaledHeight(); + GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT); + GL11.glMatrixMode(GL11.GL_PROJECTION); + GL11.glLoadIdentity(); + GL11.glOrtho(0.0D, var4.field_25121_a, var4.field_25120_b, 0.0D, 100.0D, 300.0D); + GL11.glMatrixMode(GL11.GL_MODELVIEW); + GL11.glLoadIdentity(); + GL11.glTranslatef(0.0F, 0.0F, -200.0F); + GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT | GL11.GL_COLOR_BUFFER_BIT); + Tessellator var7 = Tessellator.instance; + int var8 = this.mc.renderEngine.getTexture("/gui/background.png"); + GL11.glBindTexture(GL11.GL_TEXTURE_2D, var8); + float var9 = 32.0F; + var7.startDrawingQuads(); + var7.setColorOpaque_I(4210752); + var7.addVertexWithUV(0.0D, (double)var6, 0.0D, 0.0D, (double)((float)var6 / var9)); + var7.addVertexWithUV((double)var5, (double)var6, 0.0D, (double)((float)var5 / var9), (double)((float)var6 / var9)); + var7.addVertexWithUV((double)var5, 0.0D, 0.0D, (double)((float)var5 / var9), 0.0D); + var7.addVertexWithUV(0.0D, 0.0D, 0.0D, 0.0D, 0.0D); + var7.draw(); + if(var1 >= 0) { + byte var10 = 100; + byte var11 = 2; + int var12 = var5 / 2 - var10 / 2; + int var13 = var6 / 2 + 16; + GL11.glDisable(GL11.GL_TEXTURE_2D); + var7.startDrawingQuads(); + var7.setColorOpaque_I(8421504); + var7.addVertex((double)var12, (double)var13, 0.0D); + var7.addVertex((double)var12, (double)(var13 + var11), 0.0D); + var7.addVertex((double)(var12 + var10), (double)(var13 + var11), 0.0D); + var7.addVertex((double)(var12 + var10), (double)var13, 0.0D); + var7.setColorOpaque_I(8454016); + var7.addVertex((double)var12, (double)var13, 0.0D); + var7.addVertex((double)var12, (double)(var13 + var11), 0.0D); + var7.addVertex((double)(var12 + var1), (double)(var13 + var11), 0.0D); + var7.addVertex((double)(var12 + var1), (double)var13, 0.0D); + var7.draw(); + GL11.glEnable(GL11.GL_TEXTURE_2D); + } + + this.mc.fontRenderer.drawStringWithShadow(this.field_1007_c, (var5 - this.mc.fontRenderer.getStringWidth(this.field_1007_c)) / 2, var6 / 2 - 4 - 16, 16777215); + this.mc.fontRenderer.drawStringWithShadow(this.field_1004_a, (var5 - this.mc.fontRenderer.getStringWidth(this.field_1004_a)) / 2, var6 / 2 - 4 + 8, 16777215); + Display.update(); + + try { + Thread.yield(); + } catch (Exception var14) { + } + + } + } + } +} diff --git a/src/net/minecraft/src/MCHash.java b/src/net/minecraft/src/MCHash.java new file mode 100644 index 0000000..c04d009 --- /dev/null +++ b/src/net/minecraft/src/MCHash.java @@ -0,0 +1,135 @@ +package net.minecraft.src; + +public class MCHash { + private transient MCHashEntry[] slots = new MCHashEntry[16]; + private transient int count; + private int threshold = 12; + private final float growFactor = 12.0F / 16.0F; + private transient volatile int versionStamp; + + private static int computeHash(int var0) { + var0 ^= var0 >>> 20 ^ var0 >>> 12; + return var0 ^ var0 >>> 7 ^ var0 >>> 4; + } + + private static int getSlotIndex(int var0, int var1) { + return var0 & var1 - 1; + } + + public Object lookup(int var1) { + int var2 = computeHash(var1); + + for(MCHashEntry var3 = this.slots[getSlotIndex(var2, this.slots.length)]; var3 != null; var3 = var3.nextEntry) { + if(var3.hashEntry == var1) { + return var3.valueEntry; + } + } + + return null; + } + + public void addKey(int var1, Object var2) { + int var3 = computeHash(var1); + int var4 = getSlotIndex(var3, this.slots.length); + + for(MCHashEntry var5 = this.slots[var4]; var5 != null; var5 = var5.nextEntry) { + if(var5.hashEntry == var1) { + var5.valueEntry = var2; + } + } + + ++this.versionStamp; + this.insert(var3, var1, var2, var4); + } + + private void grow(int var1) { + MCHashEntry[] var2 = this.slots; + int var3 = var2.length; + if(var3 == 1073741824) { + this.threshold = Integer.MAX_VALUE; + } else { + MCHashEntry[] var4 = new MCHashEntry[var1]; + this.copyTo(var4); + this.slots = var4; + this.threshold = (int)((float)var1 * this.growFactor); + } + } + + private void copyTo(MCHashEntry[] var1) { + MCHashEntry[] var2 = this.slots; + int var3 = var1.length; + + for(int var4 = 0; var4 < var2.length; ++var4) { + MCHashEntry var5 = var2[var4]; + if(var5 != null) { + var2[var4] = null; + + MCHashEntry var6; + do { + var6 = var5.nextEntry; + int var7 = getSlotIndex(var5.slotHash, var3); + var5.nextEntry = var1[var7]; + var1[var7] = var5; + var5 = var6; + } while(var6 != null); + } + } + + } + + public Object removeObject(int var1) { + MCHashEntry var2 = this.removeEntry(var1); + return var2 == null ? null : var2.valueEntry; + } + + final MCHashEntry removeEntry(int var1) { + int var2 = computeHash(var1); + int var3 = getSlotIndex(var2, this.slots.length); + MCHashEntry var4 = this.slots[var3]; + + MCHashEntry var5; + MCHashEntry var6; + for(var5 = var4; var5 != null; var5 = var6) { + var6 = var5.nextEntry; + if(var5.hashEntry == var1) { + ++this.versionStamp; + --this.count; + if(var4 == var5) { + this.slots[var3] = var6; + } else { + var4.nextEntry = var6; + } + + return var5; + } + + var4 = var5; + } + + return var5; + } + + public void clearMap() { + ++this.versionStamp; + MCHashEntry[] var1 = this.slots; + + for(int var2 = 0; var2 < var1.length; ++var2) { + var1[var2] = null; + } + + this.count = 0; + } + + private void insert(int var1, int var2, Object var3, int var4) { + MCHashEntry var5 = this.slots[var4]; + this.slots[var4] = new MCHashEntry(var1, var2, var3, var5); + if(this.count++ >= this.threshold) { + this.grow(2 * this.slots.length); + } + + } + + static int getHash(int var0) { + return computeHash(var0); + } +} diff --git a/src/net/minecraft/src/MCHashEntry.java b/src/net/minecraft/src/MCHashEntry.java new file mode 100644 index 0000000..bd4b82e --- /dev/null +++ b/src/net/minecraft/src/MCHashEntry.java @@ -0,0 +1,50 @@ +package net.minecraft.src; + +class MCHashEntry { + final int hashEntry; + Object valueEntry; + MCHashEntry nextEntry; + final int slotHash; + + MCHashEntry(int var1, int var2, Object var3, MCHashEntry var4) { + this.valueEntry = var3; + this.nextEntry = var4; + this.hashEntry = var2; + this.slotHash = var1; + } + + public final int getHash() { + return this.hashEntry; + } + + public final Object getValue() { + return this.valueEntry; + } + + public final boolean equals(Object var1) { + if(!(var1 instanceof MCHashEntry)) { + return false; + } else { + MCHashEntry var2 = (MCHashEntry)var1; + Integer var3 = Integer.valueOf(this.getHash()); + Integer var4 = Integer.valueOf(var2.getHash()); + if(var3 == var4 || var3 != null && var3.equals(var4)) { + Object var5 = this.getValue(); + Object var6 = var2.getValue(); + if(var5 == var6 || var5 != null && var5.equals(var6)) { + return true; + } + } + + return false; + } + } + + public final int hashCode() { + return MCHash.getHash(this.hashEntry); + } + + public final String toString() { + return this.getHash() + "=" + this.getValue(); + } +} diff --git a/src/net/minecraft/src/MD5String.java b/src/net/minecraft/src/MD5String.java new file mode 100644 index 0000000..561a24e --- /dev/null +++ b/src/net/minecraft/src/MD5String.java @@ -0,0 +1,24 @@ +package net.minecraft.src; + +import java.math.BigInteger; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; + +public class MD5String { + private String field_27370_a; + + public MD5String(String var1) { + this.field_27370_a = var1; + } + + public String func_27369_a(String var1) { + try { + String var2 = this.field_27370_a + var1; + MessageDigest var3 = MessageDigest.getInstance("MD5"); + var3.update(var2.getBytes(), 0, var2.length()); + return (new BigInteger(1, var3.digest())).toString(16); + } catch (NoSuchAlgorithmException var4) { + throw new RuntimeException(var4); + } + } +} diff --git a/src/net/minecraft/src/MapColor.java b/src/net/minecraft/src/MapColor.java new file mode 100644 index 0000000..e77297d --- /dev/null +++ b/src/net/minecraft/src/MapColor.java @@ -0,0 +1,27 @@ +package net.minecraft.src; + +public class MapColor { + public static final MapColor[] mapColorArray = new MapColor[16]; + public static final MapColor airColor = new MapColor(0, 0); + public static final MapColor grassColor = new MapColor(1, 8368696); + public static final MapColor sandColor = new MapColor(2, 16247203); + public static final MapColor clothColor = new MapColor(3, 10987431); + public static final MapColor tntColor = new MapColor(4, 16711680); + public static final MapColor iceColor = new MapColor(5, 10526975); + public static final MapColor ironColor = new MapColor(6, 10987431); + public static final MapColor foliageColor = new MapColor(7, 31744); + public static final MapColor snowColor = new MapColor(8, 16777215); + public static final MapColor clayColor = new MapColor(9, 10791096); + public static final MapColor dirtColor = new MapColor(10, 12020271); + public static final MapColor stoneColor = new MapColor(11, 7368816); + public static final MapColor waterColor = new MapColor(12, 4210943); + public static final MapColor woodColor = new MapColor(13, 6837042); + public final int colorValue; + public final int colorIndex; + + private MapColor(int var1, int var2) { + this.colorIndex = var1; + this.colorValue = var2; + mapColorArray[var1] = this; + } +} diff --git a/src/net/minecraft/src/MapCoord.java b/src/net/minecraft/src/MapCoord.java new file mode 100644 index 0000000..9819f41 --- /dev/null +++ b/src/net/minecraft/src/MapCoord.java @@ -0,0 +1,17 @@ +package net.minecraft.src; + +public class MapCoord { + public byte field_28217_a; + public byte field_28216_b; + public byte field_28220_c; + public byte field_28219_d; + final MapData field_28218_e; + + public MapCoord(MapData var1, byte var2, byte var3, byte var4, byte var5) { + this.field_28218_e = var1; + this.field_28217_a = var2; + this.field_28216_b = var3; + this.field_28220_c = var4; + this.field_28219_d = var5; + } +} diff --git a/src/net/minecraft/src/MapData.java b/src/net/minecraft/src/MapData.java new file mode 100644 index 0000000..a6dd425 --- /dev/null +++ b/src/net/minecraft/src/MapData.java @@ -0,0 +1,149 @@ +package net.minecraft.src; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class MapData extends MapDataBase { + public int field_28180_b; + public int field_28179_c; + public byte field_28178_d; + public byte field_28177_e; + public byte[] field_28176_f = new byte[16384]; + public int field_28175_g; + public List field_28174_h = new ArrayList(); + private Map field_28172_j = new HashMap(); + public List field_28173_i = new ArrayList(); + + public MapData(String var1) { + super(var1); + } + + public void readFromNBT(NBTTagCompound var1) { + this.field_28178_d = var1.getByte("dimension"); + this.field_28180_b = var1.getInteger("xCenter"); + this.field_28179_c = var1.getInteger("zCenter"); + this.field_28177_e = var1.getByte("scale"); + if(this.field_28177_e < 0) { + this.field_28177_e = 0; + } + + if(this.field_28177_e > 4) { + this.field_28177_e = 4; + } + + short var2 = var1.getShort("width"); + short var3 = var1.getShort("height"); + if(var2 == 128 && var3 == 128) { + this.field_28176_f = var1.getByteArray("colors"); + } else { + byte[] var4 = var1.getByteArray("colors"); + this.field_28176_f = new byte[16384]; + int var5 = (128 - var2) / 2; + int var6 = (128 - var3) / 2; + + for(int var7 = 0; var7 < var3; ++var7) { + int var8 = var7 + var6; + if(var8 >= 0 || var8 < 128) { + for(int var9 = 0; var9 < var2; ++var9) { + int var10 = var9 + var5; + if(var10 >= 0 || var10 < 128) { + this.field_28176_f[var10 + var8 * 128] = var4[var9 + var7 * var2]; + } + } + } + } + } + + } + + public void writeToNBT(NBTTagCompound var1) { + var1.setByte("dimension", this.field_28178_d); + var1.setInteger("xCenter", this.field_28180_b); + var1.setInteger("zCenter", this.field_28179_c); + var1.setByte("scale", this.field_28177_e); + var1.setShort("width", (short)128); + var1.setShort("height", (short)128); + var1.setByteArray("colors", this.field_28176_f); + } + + public void func_28169_a(EntityPlayer var1, ItemStack var2) { + if(!this.field_28172_j.containsKey(var1)) { + MapInfo var3 = new MapInfo(this, var1); + this.field_28172_j.put(var1, var3); + this.field_28174_h.add(var3); + } + + this.field_28173_i.clear(); + + for(int var14 = 0; var14 < this.field_28174_h.size(); ++var14) { + MapInfo var4 = (MapInfo)this.field_28174_h.get(var14); + if(!var4.entityplayerObj.isDead && var4.entityplayerObj.inventory.func_28018_c(var2)) { + float var5 = (float)(var4.entityplayerObj.posX - (double)this.field_28180_b) / (float)(1 << this.field_28177_e); + float var6 = (float)(var4.entityplayerObj.posZ - (double)this.field_28179_c) / (float)(1 << this.field_28177_e); + byte var7 = 64; + byte var8 = 64; + if(var5 >= (float)(-var7) && var6 >= (float)(-var8) && var5 <= (float)var7 && var6 <= (float)var8) { + byte var9 = 0; + byte var10 = (byte)((int)((double)(var5 * 2.0F) + 0.5D)); + byte var11 = (byte)((int)((double)(var6 * 2.0F) + 0.5D)); + byte var12 = (byte)((int)((double)(var1.rotationYaw * 16.0F / 360.0F) + 0.5D)); + if(this.field_28178_d < 0) { + int var13 = this.field_28175_g / 10; + var12 = (byte)(var13 * var13 * 34187121 + var13 * 121 >> 15 & 15); + } + + if(var4.entityplayerObj.dimension == this.field_28178_d) { + this.field_28173_i.add(new MapCoord(this, var9, var10, var11, var12)); + } + } + } else { + this.field_28172_j.remove(var4.entityplayerObj); + this.field_28174_h.remove(var4); + } + } + + } + + public void func_28170_a(int var1, int var2, int var3) { + super.markDirty(); + + for(int var4 = 0; var4 < this.field_28174_h.size(); ++var4) { + MapInfo var5 = (MapInfo)this.field_28174_h.get(var4); + if(var5.field_28119_b[var1] < 0 || var5.field_28119_b[var1] > var2) { + var5.field_28119_b[var1] = var2; + } + + if(var5.field_28124_c[var1] < 0 || var5.field_28124_c[var1] < var3) { + var5.field_28124_c[var1] = var3; + } + } + + } + + public void func_28171_a(byte[] var1) { + int var2; + if(var1[0] == 0) { + var2 = var1[1] & 255; + int var3 = var1[2] & 255; + + for(int var4 = 0; var4 < var1.length - 3; ++var4) { + this.field_28176_f[(var4 + var3) * 128 + var2] = var1[var4 + 3]; + } + + this.markDirty(); + } else if(var1[0] == 1) { + this.field_28173_i.clear(); + + for(var2 = 0; var2 < (var1.length - 1) / 3; ++var2) { + byte var7 = (byte)(var1[var2 * 3 + 1] % 16); + byte var8 = var1[var2 * 3 + 2]; + byte var5 = var1[var2 * 3 + 3]; + byte var6 = (byte)(var1[var2 * 3 + 1] / 16); + this.field_28173_i.add(new MapCoord(this, var7, var8, var5, var6)); + } + } + + } +} diff --git a/src/net/minecraft/src/MapDataBase.java b/src/net/minecraft/src/MapDataBase.java new file mode 100644 index 0000000..585c047 --- /dev/null +++ b/src/net/minecraft/src/MapDataBase.java @@ -0,0 +1,26 @@ +package net.minecraft.src; + +public abstract class MapDataBase { + public final String field_28168_a; + private boolean dirty; + + public MapDataBase(String var1) { + this.field_28168_a = var1; + } + + public abstract void readFromNBT(NBTTagCompound var1); + + public abstract void writeToNBT(NBTTagCompound var1); + + public void markDirty() { + this.setDirty(true); + } + + public void setDirty(boolean var1) { + this.dirty = var1; + } + + public boolean isDirty() { + return this.dirty; + } +} diff --git a/src/net/minecraft/src/MapGenBase.java b/src/net/minecraft/src/MapGenBase.java new file mode 100644 index 0000000..7833aee --- /dev/null +++ b/src/net/minecraft/src/MapGenBase.java @@ -0,0 +1,26 @@ +package net.minecraft.src; + +import java.util.Random; + +public class MapGenBase { + protected int field_1306_a = 8; + protected Random rand = new Random(); + + public void func_867_a(IChunkProvider var1, World var2, int var3, int var4, byte[] var5) { + int var6 = this.field_1306_a; + this.rand.setSeed(var2.getRandomSeed()); + long var7 = this.rand.nextLong() / 2L * 2L + 1L; + long var9 = this.rand.nextLong() / 2L * 2L + 1L; + + for(int var11 = var3 - var6; var11 <= var3 + var6; ++var11) { + for(int var12 = var4 - var6; var12 <= var4 + var6; ++var12) { + this.rand.setSeed((long)var11 * var7 + (long)var12 * var9 ^ var2.getRandomSeed()); + this.func_868_a(var2, var11, var12, var3, var4, var5); + } + } + + } + + protected void func_868_a(World var1, int var2, int var3, int var4, int var5, byte[] var6) { + } +} diff --git a/src/net/minecraft/src/MapGenCaves.java b/src/net/minecraft/src/MapGenCaves.java new file mode 100644 index 0000000..63138dd --- /dev/null +++ b/src/net/minecraft/src/MapGenCaves.java @@ -0,0 +1,186 @@ +package net.minecraft.src; + +import java.util.Random; + +public class MapGenCaves extends MapGenBase { + protected void func_870_a(int var1, int var2, byte[] var3, double var4, double var6, double var8) { + this.releaseEntitySkin(var1, var2, var3, var4, var6, var8, 1.0F + this.rand.nextFloat() * 6.0F, 0.0F, 0.0F, -1, -1, 0.5D); + } + + protected void releaseEntitySkin(int var1, int var2, byte[] var3, double var4, double var6, double var8, float var10, float var11, float var12, int var13, int var14, double var15) { + double var17 = (double)(var1 * 16 + 8); + double var19 = (double)(var2 * 16 + 8); + float var21 = 0.0F; + float var22 = 0.0F; + Random var23 = new Random(this.rand.nextLong()); + if(var14 <= 0) { + int var24 = this.field_1306_a * 16 - 16; + var14 = var24 - var23.nextInt(var24 / 4); + } + + boolean var52 = false; + if(var13 == -1) { + var13 = var14 / 2; + var52 = true; + } + + int var25 = var23.nextInt(var14 / 2) + var14 / 4; + + for(boolean var26 = var23.nextInt(6) == 0; var13 < var14; ++var13) { + double var27 = 1.5D + (double)(MathHelper.sin((float)var13 * (float)Math.PI / (float)var14) * var10 * 1.0F); + double var29 = var27 * var15; + float var31 = MathHelper.cos(var12); + float var32 = MathHelper.sin(var12); + var4 += (double)(MathHelper.cos(var11) * var31); + var6 += (double)var32; + var8 += (double)(MathHelper.sin(var11) * var31); + if(var26) { + var12 *= 0.92F; + } else { + var12 *= 0.7F; + } + + var12 += var22 * 0.1F; + var11 += var21 * 0.1F; + var22 *= 0.9F; + var21 *= 12.0F / 16.0F; + var22 += (var23.nextFloat() - var23.nextFloat()) * var23.nextFloat() * 2.0F; + var21 += (var23.nextFloat() - var23.nextFloat()) * var23.nextFloat() * 4.0F; + if(!var52 && var13 == var25 && var10 > 1.0F) { + this.releaseEntitySkin(var1, var2, var3, var4, var6, var8, var23.nextFloat() * 0.5F + 0.5F, var11 - (float)Math.PI * 0.5F, var12 / 3.0F, var13, var14, 1.0D); + this.releaseEntitySkin(var1, var2, var3, var4, var6, var8, var23.nextFloat() * 0.5F + 0.5F, var11 + (float)Math.PI * 0.5F, var12 / 3.0F, var13, var14, 1.0D); + return; + } + + if(var52 || var23.nextInt(4) != 0) { + double var33 = var4 - var17; + double var35 = var8 - var19; + double var37 = (double)(var14 - var13); + double var39 = (double)(var10 + 2.0F + 16.0F); + if(var33 * var33 + var35 * var35 - var37 * var37 > var39 * var39) { + return; + } + + if(var4 >= var17 - 16.0D - var27 * 2.0D && var8 >= var19 - 16.0D - var27 * 2.0D && var4 <= var17 + 16.0D + var27 * 2.0D && var8 <= var19 + 16.0D + var27 * 2.0D) { + int var53 = MathHelper.floor_double(var4 - var27) - var1 * 16 - 1; + int var34 = MathHelper.floor_double(var4 + var27) - var1 * 16 + 1; + int var54 = MathHelper.floor_double(var6 - var29) - 1; + int var36 = MathHelper.floor_double(var6 + var29) + 1; + int var55 = MathHelper.floor_double(var8 - var27) - var2 * 16 - 1; + int var38 = MathHelper.floor_double(var8 + var27) - var2 * 16 + 1; + if(var53 < 0) { + var53 = 0; + } + + if(var34 > 16) { + var34 = 16; + } + + if(var54 < 1) { + var54 = 1; + } + + if(var36 > 120) { + var36 = 120; + } + + if(var55 < 0) { + var55 = 0; + } + + if(var38 > 16) { + var38 = 16; + } + + boolean var56 = false; + + int var40; + int var43; + for(var40 = var53; !var56 && var40 < var34; ++var40) { + for(int var41 = var55; !var56 && var41 < var38; ++var41) { + for(int var42 = var36 + 1; !var56 && var42 >= var54 - 1; --var42) { + var43 = (var40 * 16 + var41) * 128 + var42; + if(var42 >= 0 && var42 < 128) { + if(var3[var43] == Block.waterMoving.blockID || var3[var43] == Block.waterStill.blockID) { + var56 = true; + } + + if(var42 != var54 - 1 && var40 != var53 && var40 != var34 - 1 && var41 != var55 && var41 != var38 - 1) { + var42 = var54; + } + } + } + } + } + + if(!var56) { + for(var40 = var53; var40 < var34; ++var40) { + double var57 = ((double)(var40 + var1 * 16) + 0.5D - var4) / var27; + + for(var43 = var55; var43 < var38; ++var43) { + double var44 = ((double)(var43 + var2 * 16) + 0.5D - var8) / var27; + int var46 = (var40 * 16 + var43) * 128 + var36; + boolean var47 = false; + if(var57 * var57 + var44 * var44 < 1.0D) { + for(int var48 = var36 - 1; var48 >= var54; --var48) { + double var49 = ((double)var48 + 0.5D - var6) / var29; + if(var49 > -0.7D && var57 * var57 + var49 * var49 + var44 * var44 < 1.0D) { + byte var51 = var3[var46]; + if(var51 == Block.grass.blockID) { + var47 = true; + } + + if(var51 == Block.stone.blockID || var51 == Block.dirt.blockID || var51 == Block.grass.blockID) { + if(var48 < 10) { + var3[var46] = (byte)Block.lavaMoving.blockID; + } else { + var3[var46] = 0; + if(var47 && var3[var46 - 1] == Block.dirt.blockID) { + var3[var46 - 1] = (byte)Block.grass.blockID; + } + } + } + } + + --var46; + } + } + } + } + + if(var52) { + break; + } + } + } + } + } + + } + + protected void func_868_a(World var1, int var2, int var3, int var4, int var5, byte[] var6) { + int var7 = this.rand.nextInt(this.rand.nextInt(this.rand.nextInt(40) + 1) + 1); + if(this.rand.nextInt(15) != 0) { + var7 = 0; + } + + for(int var8 = 0; var8 < var7; ++var8) { + double var9 = (double)(var2 * 16 + this.rand.nextInt(16)); + double var11 = (double)this.rand.nextInt(this.rand.nextInt(120) + 8); + double var13 = (double)(var3 * 16 + this.rand.nextInt(16)); + int var15 = 1; + if(this.rand.nextInt(4) == 0) { + this.func_870_a(var4, var5, var6, var9, var11, var13); + var15 += this.rand.nextInt(4); + } + + for(int var16 = 0; var16 < var15; ++var16) { + float var17 = this.rand.nextFloat() * (float)Math.PI * 2.0F; + float var18 = (this.rand.nextFloat() - 0.5F) * 2.0F / 8.0F; + float var19 = this.rand.nextFloat() * 2.0F + this.rand.nextFloat(); + this.releaseEntitySkin(var4, var5, var6, var9, var11, var13, var19, var17, var18, 0, 0, 1.0D); + } + } + + } +} diff --git a/src/net/minecraft/src/MapGenCavesHell.java b/src/net/minecraft/src/MapGenCavesHell.java new file mode 100644 index 0000000..3448711 --- /dev/null +++ b/src/net/minecraft/src/MapGenCavesHell.java @@ -0,0 +1,173 @@ +package net.minecraft.src; + +import java.util.Random; + +public class MapGenCavesHell extends MapGenBase { + protected void func_4129_a(int var1, int var2, byte[] var3, double var4, double var6, double var8) { + this.func_4128_a(var1, var2, var3, var4, var6, var8, 1.0F + this.rand.nextFloat() * 6.0F, 0.0F, 0.0F, -1, -1, 0.5D); + } + + protected void func_4128_a(int var1, int var2, byte[] var3, double var4, double var6, double var8, float var10, float var11, float var12, int var13, int var14, double var15) { + double var17 = (double)(var1 * 16 + 8); + double var19 = (double)(var2 * 16 + 8); + float var21 = 0.0F; + float var22 = 0.0F; + Random var23 = new Random(this.rand.nextLong()); + if(var14 <= 0) { + int var24 = this.field_1306_a * 16 - 16; + var14 = var24 - var23.nextInt(var24 / 4); + } + + boolean var51 = false; + if(var13 == -1) { + var13 = var14 / 2; + var51 = true; + } + + int var25 = var23.nextInt(var14 / 2) + var14 / 4; + + for(boolean var26 = var23.nextInt(6) == 0; var13 < var14; ++var13) { + double var27 = 1.5D + (double)(MathHelper.sin((float)var13 * (float)Math.PI / (float)var14) * var10 * 1.0F); + double var29 = var27 * var15; + float var31 = MathHelper.cos(var12); + float var32 = MathHelper.sin(var12); + var4 += (double)(MathHelper.cos(var11) * var31); + var6 += (double)var32; + var8 += (double)(MathHelper.sin(var11) * var31); + if(var26) { + var12 *= 0.92F; + } else { + var12 *= 0.7F; + } + + var12 += var22 * 0.1F; + var11 += var21 * 0.1F; + var22 *= 0.9F; + var21 *= 12.0F / 16.0F; + var22 += (var23.nextFloat() - var23.nextFloat()) * var23.nextFloat() * 2.0F; + var21 += (var23.nextFloat() - var23.nextFloat()) * var23.nextFloat() * 4.0F; + if(!var51 && var13 == var25 && var10 > 1.0F) { + this.func_4128_a(var1, var2, var3, var4, var6, var8, var23.nextFloat() * 0.5F + 0.5F, var11 - (float)Math.PI * 0.5F, var12 / 3.0F, var13, var14, 1.0D); + this.func_4128_a(var1, var2, var3, var4, var6, var8, var23.nextFloat() * 0.5F + 0.5F, var11 + (float)Math.PI * 0.5F, var12 / 3.0F, var13, var14, 1.0D); + return; + } + + if(var51 || var23.nextInt(4) != 0) { + double var33 = var4 - var17; + double var35 = var8 - var19; + double var37 = (double)(var14 - var13); + double var39 = (double)(var10 + 2.0F + 16.0F); + if(var33 * var33 + var35 * var35 - var37 * var37 > var39 * var39) { + return; + } + + if(var4 >= var17 - 16.0D - var27 * 2.0D && var8 >= var19 - 16.0D - var27 * 2.0D && var4 <= var17 + 16.0D + var27 * 2.0D && var8 <= var19 + 16.0D + var27 * 2.0D) { + int var52 = MathHelper.floor_double(var4 - var27) - var1 * 16 - 1; + int var34 = MathHelper.floor_double(var4 + var27) - var1 * 16 + 1; + int var53 = MathHelper.floor_double(var6 - var29) - 1; + int var36 = MathHelper.floor_double(var6 + var29) + 1; + int var54 = MathHelper.floor_double(var8 - var27) - var2 * 16 - 1; + int var38 = MathHelper.floor_double(var8 + var27) - var2 * 16 + 1; + if(var52 < 0) { + var52 = 0; + } + + if(var34 > 16) { + var34 = 16; + } + + if(var53 < 1) { + var53 = 1; + } + + if(var36 > 120) { + var36 = 120; + } + + if(var54 < 0) { + var54 = 0; + } + + if(var38 > 16) { + var38 = 16; + } + + boolean var55 = false; + + int var40; + int var43; + for(var40 = var52; !var55 && var40 < var34; ++var40) { + for(int var41 = var54; !var55 && var41 < var38; ++var41) { + for(int var42 = var36 + 1; !var55 && var42 >= var53 - 1; --var42) { + var43 = (var40 * 16 + var41) * 128 + var42; + if(var42 >= 0 && var42 < 128) { + if(var3[var43] == Block.lavaMoving.blockID || var3[var43] == Block.lavaStill.blockID) { + var55 = true; + } + + if(var42 != var53 - 1 && var40 != var52 && var40 != var34 - 1 && var41 != var54 && var41 != var38 - 1) { + var42 = var53; + } + } + } + } + } + + if(!var55) { + for(var40 = var52; var40 < var34; ++var40) { + double var56 = ((double)(var40 + var1 * 16) + 0.5D - var4) / var27; + + for(var43 = var54; var43 < var38; ++var43) { + double var44 = ((double)(var43 + var2 * 16) + 0.5D - var8) / var27; + int var46 = (var40 * 16 + var43) * 128 + var36; + + for(int var47 = var36 - 1; var47 >= var53; --var47) { + double var48 = ((double)var47 + 0.5D - var6) / var29; + if(var48 > -0.7D && var56 * var56 + var48 * var48 + var44 * var44 < 1.0D) { + byte var50 = var3[var46]; + if(var50 == Block.netherrack.blockID || var50 == Block.dirt.blockID || var50 == Block.grass.blockID) { + var3[var46] = 0; + } + } + + --var46; + } + } + } + + if(var51) { + break; + } + } + } + } + } + + } + + protected void func_868_a(World var1, int var2, int var3, int var4, int var5, byte[] var6) { + int var7 = this.rand.nextInt(this.rand.nextInt(this.rand.nextInt(10) + 1) + 1); + if(this.rand.nextInt(5) != 0) { + var7 = 0; + } + + for(int var8 = 0; var8 < var7; ++var8) { + double var9 = (double)(var2 * 16 + this.rand.nextInt(16)); + double var11 = (double)this.rand.nextInt(128); + double var13 = (double)(var3 * 16 + this.rand.nextInt(16)); + int var15 = 1; + if(this.rand.nextInt(4) == 0) { + this.func_4129_a(var4, var5, var6, var9, var11, var13); + var15 += this.rand.nextInt(4); + } + + for(int var16 = 0; var16 < var15; ++var16) { + float var17 = this.rand.nextFloat() * (float)Math.PI * 2.0F; + float var18 = (this.rand.nextFloat() - 0.5F) * 2.0F / 8.0F; + float var19 = this.rand.nextFloat() * 2.0F + this.rand.nextFloat(); + this.func_4128_a(var4, var5, var6, var9, var11, var13, var19 * 2.0F, var17, var18, 0, 0, 0.5D); + } + } + + } +} diff --git a/src/net/minecraft/src/MapInfo.java b/src/net/minecraft/src/MapInfo.java new file mode 100644 index 0000000..e266df9 --- /dev/null +++ b/src/net/minecraft/src/MapInfo.java @@ -0,0 +1,25 @@ +package net.minecraft.src; + +public class MapInfo { + public final EntityPlayer entityplayerObj; + public int[] field_28119_b; + public int[] field_28124_c; + private int field_28122_e; + private int field_28121_f; + final MapData mapDataObj; + + public MapInfo(MapData var1, EntityPlayer var2) { + this.mapDataObj = var1; + this.field_28119_b = new int[128]; + this.field_28124_c = new int[128]; + this.field_28122_e = 0; + this.field_28121_f = 0; + this.entityplayerObj = var2; + + for(int var3 = 0; var3 < this.field_28119_b.length; ++var3) { + this.field_28119_b[var3] = 0; + this.field_28124_c[var3] = 127; + } + + } +} diff --git a/src/net/minecraft/src/MapItemRenderer.java b/src/net/minecraft/src/MapItemRenderer.java new file mode 100644 index 0000000..a8d439f --- /dev/null +++ b/src/net/minecraft/src/MapItemRenderer.java @@ -0,0 +1,102 @@ +package net.minecraft.src; + +import java.awt.image.BufferedImage; +import java.util.Iterator; +import org.lwjgl.opengl.GL11; + +public class MapItemRenderer { + private int[] field_28159_a = new int[16384]; + private int field_28158_b; + private GameSettings field_28161_c; + private FontRenderer field_28160_d; + + public MapItemRenderer(FontRenderer var1, GameSettings var2, RenderEngine var3) { + this.field_28161_c = var2; + this.field_28160_d = var1; + this.field_28158_b = var3.allocateAndSetupTexture(new BufferedImage(128, 128, 2)); + + for(int var4 = 0; var4 < 16384; ++var4) { + this.field_28159_a[var4] = 0; + } + + } + + public void func_28157_a(EntityPlayer var1, RenderEngine var2, MapData var3) { + for(int var4 = 0; var4 < 16384; ++var4) { + byte var5 = var3.field_28176_f[var4]; + if(var5 / 4 == 0) { + this.field_28159_a[var4] = (var4 + var4 / 128 & 1) * 8 + 16 << 24; + } else { + int var6 = MapColor.mapColorArray[var5 / 4].colorValue; + int var7 = var5 & 3; + short var8 = 220; + if(var7 == 2) { + var8 = 255; + } + + if(var7 == 0) { + var8 = 180; + } + + int var9 = (var6 >> 16 & 255) * var8 / 255; + int var10 = (var6 >> 8 & 255) * var8 / 255; + int var11 = (var6 & 255) * var8 / 255; + if(this.field_28161_c.anaglyph) { + int var12 = (var9 * 30 + var10 * 59 + var11 * 11) / 100; + int var13 = (var9 * 30 + var10 * 70) / 100; + int var14 = (var9 * 30 + var11 * 70) / 100; + var9 = var12; + var10 = var13; + var11 = var14; + } + + this.field_28159_a[var4] = -16777216 | var9 << 16 | var10 << 8 | var11; + } + } + + var2.func_28150_a(this.field_28159_a, 128, 128, this.field_28158_b); + byte var15 = 0; + byte var16 = 0; + Tessellator var17 = Tessellator.instance; + float var18 = 0.0F; + GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.field_28158_b); + GL11.glEnable(GL11.GL_BLEND); + GL11.glDisable(GL11.GL_ALPHA_TEST); + var17.startDrawingQuads(); + var17.addVertexWithUV((double)((float)(var15 + 0) + var18), (double)((float)(var16 + 128) - var18), (double)-0.01F, 0.0D, 1.0D); + var17.addVertexWithUV((double)((float)(var15 + 128) - var18), (double)((float)(var16 + 128) - var18), (double)-0.01F, 1.0D, 1.0D); + var17.addVertexWithUV((double)((float)(var15 + 128) - var18), (double)((float)(var16 + 0) + var18), (double)-0.01F, 1.0D, 0.0D); + var17.addVertexWithUV((double)((float)(var15 + 0) + var18), (double)((float)(var16 + 0) + var18), (double)-0.01F, 0.0D, 0.0D); + var17.draw(); + GL11.glEnable(GL11.GL_ALPHA_TEST); + GL11.glDisable(GL11.GL_BLEND); + var2.bindTexture(var2.getTexture("/misc/mapicons.png")); + Iterator var19 = var3.field_28173_i.iterator(); + + while(var19.hasNext()) { + MapCoord var20 = (MapCoord)var19.next(); + GL11.glPushMatrix(); + GL11.glTranslatef((float)var15 + (float)var20.field_28216_b / 2.0F + 64.0F, (float)var16 + (float)var20.field_28220_c / 2.0F + 64.0F, -0.02F); + GL11.glRotatef((float)(var20.field_28219_d * 360) / 16.0F, 0.0F, 0.0F, 1.0F); + GL11.glScalef(4.0F, 4.0F, 3.0F); + GL11.glTranslatef(-(2.0F / 16.0F), 2.0F / 16.0F, 0.0F); + float var21 = (float)(var20.field_28217_a % 4 + 0) / 4.0F; + float var22 = (float)(var20.field_28217_a / 4 + 0) / 4.0F; + float var23 = (float)(var20.field_28217_a % 4 + 1) / 4.0F; + float var24 = (float)(var20.field_28217_a / 4 + 1) / 4.0F; + var17.startDrawingQuads(); + var17.addVertexWithUV(-1.0D, 1.0D, 0.0D, (double)var21, (double)var22); + var17.addVertexWithUV(1.0D, 1.0D, 0.0D, (double)var23, (double)var22); + var17.addVertexWithUV(1.0D, -1.0D, 0.0D, (double)var23, (double)var24); + var17.addVertexWithUV(-1.0D, -1.0D, 0.0D, (double)var21, (double)var24); + var17.draw(); + GL11.glPopMatrix(); + } + + GL11.glPushMatrix(); + GL11.glTranslatef(0.0F, 0.0F, -0.04F); + GL11.glScalef(1.0F, 1.0F, 1.0F); + this.field_28160_d.drawString(var3.field_28168_a, var15, var16, -16777216); + GL11.glPopMatrix(); + } +} diff --git a/src/net/minecraft/src/MapStorage.java b/src/net/minecraft/src/MapStorage.java new file mode 100644 index 0000000..cd56097 --- /dev/null +++ b/src/net/minecraft/src/MapStorage.java @@ -0,0 +1,168 @@ +package net.minecraft.src; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +public class MapStorage { + private ISaveHandler field_28191_a; + private Map loadedDataMap = new HashMap(); + private List loadedDataList = new ArrayList(); + private Map idCounts = new HashMap(); + + public MapStorage(ISaveHandler var1) { + this.field_28191_a = var1; + this.loadIdCounts(); + } + + public MapDataBase loadData(Class var1, String var2) { + MapDataBase var3 = (MapDataBase)this.loadedDataMap.get(var2); + if(var3 != null) { + return var3; + } else { + if(this.field_28191_a != null) { + try { + File var4 = this.field_28191_a.func_28113_a(var2); + if(var4 != null && var4.exists()) { + try { + var3 = (MapDataBase)var1.getConstructor(new Class[]{String.class}).newInstance(new Object[]{var2}); + } catch (Exception var7) { + throw new RuntimeException("Failed to instantiate " + var1.toString(), var7); + } + + FileInputStream var5 = new FileInputStream(var4); + NBTTagCompound var6 = CompressedStreamTools.func_1138_a(var5); + var5.close(); + var3.readFromNBT(var6.getCompoundTag("data")); + } + } catch (Exception var8) { + var8.printStackTrace(); + } + } + + if(var3 != null) { + this.loadedDataMap.put(var2, var3); + this.loadedDataList.add(var3); + } + + return var3; + } + } + + public void setData(String var1, MapDataBase var2) { + if(var2 == null) { + throw new RuntimeException("Can\'t set null data"); + } else { + if(this.loadedDataMap.containsKey(var1)) { + this.loadedDataList.remove(this.loadedDataMap.remove(var1)); + } + + this.loadedDataMap.put(var1, var2); + this.loadedDataList.add(var2); + } + } + + public void saveAllData() { + for(int var1 = 0; var1 < this.loadedDataList.size(); ++var1) { + MapDataBase var2 = (MapDataBase)this.loadedDataList.get(var1); + if(var2.isDirty()) { + this.saveData(var2); + var2.setDirty(false); + } + } + + } + + private void saveData(MapDataBase var1) { + if(this.field_28191_a != null) { + try { + File var2 = this.field_28191_a.func_28113_a(var1.field_28168_a); + if(var2 != null) { + NBTTagCompound var3 = new NBTTagCompound(); + var1.writeToNBT(var3); + NBTTagCompound var4 = new NBTTagCompound(); + var4.setCompoundTag("data", var3); + FileOutputStream var5 = new FileOutputStream(var2); + CompressedStreamTools.writeGzippedCompoundToOutputStream(var4, var5); + var5.close(); + } + } catch (Exception var6) { + var6.printStackTrace(); + } + + } + } + + private void loadIdCounts() { + try { + this.idCounts.clear(); + if(this.field_28191_a == null) { + return; + } + + File var1 = this.field_28191_a.func_28113_a("idcounts"); + if(var1 != null && var1.exists()) { + DataInputStream var2 = new DataInputStream(new FileInputStream(var1)); + NBTTagCompound var3 = CompressedStreamTools.func_1141_a(var2); + var2.close(); + Iterator var4 = var3.func_28110_c().iterator(); + + while(var4.hasNext()) { + NBTBase var5 = (NBTBase)var4.next(); + if(var5 instanceof NBTTagShort) { + NBTTagShort var6 = (NBTTagShort)var5; + String var7 = var6.getKey(); + short var8 = var6.shortValue; + this.idCounts.put(var7, Short.valueOf(var8)); + } + } + } + } catch (Exception var9) { + var9.printStackTrace(); + } + + } + + public int getUniqueDataId(String var1) { + Short var2 = (Short)this.idCounts.get(var1); + if(var2 == null) { + var2 = Short.valueOf((short)0); + } else { + var2 = Short.valueOf((short)(var2.shortValue() + 1)); + } + + this.idCounts.put(var1, var2); + if(this.field_28191_a == null) { + return var2.shortValue(); + } else { + try { + File var3 = this.field_28191_a.func_28113_a("idcounts"); + if(var3 != null) { + NBTTagCompound var4 = new NBTTagCompound(); + Iterator var5 = this.idCounts.keySet().iterator(); + + while(var5.hasNext()) { + String var6 = (String)var5.next(); + short var7 = ((Short)this.idCounts.get(var6)).shortValue(); + var4.setShort(var6, var7); + } + + DataOutputStream var9 = new DataOutputStream(new FileOutputStream(var3)); + CompressedStreamTools.func_1139_a(var4, var9); + var9.close(); + } + } catch (Exception var8) { + var8.printStackTrace(); + } + + return var2.shortValue(); + } + } +} diff --git a/src/net/minecraft/src/Material.java b/src/net/minecraft/src/Material.java new file mode 100644 index 0000000..b36a01a --- /dev/null +++ b/src/net/minecraft/src/Material.java @@ -0,0 +1,108 @@ +package net.minecraft.src; + +public class Material { + public static final Material air = new MaterialTransparent(MapColor.airColor); + public static final Material grassMaterial = new Material(MapColor.grassColor); + public static final Material ground = new Material(MapColor.dirtColor); + public static final Material wood = (new Material(MapColor.woodColor)).setBurning(); + public static final Material rock = (new Material(MapColor.stoneColor)).setNoHarvest(); + public static final Material iron = (new Material(MapColor.ironColor)).setNoHarvest(); + public static final Material water = (new MaterialLiquid(MapColor.waterColor)).setNoPushMobility(); + public static final Material lava = (new MaterialLiquid(MapColor.tntColor)).setNoPushMobility(); + public static final Material leaves = (new Material(MapColor.foliageColor)).setBurning().setIsTranslucent().setNoPushMobility(); + public static final Material plants = (new MaterialLogic(MapColor.foliageColor)).setNoPushMobility(); + public static final Material sponge = new Material(MapColor.clothColor); + public static final Material cloth = (new Material(MapColor.clothColor)).setBurning(); + public static final Material fire = (new MaterialTransparent(MapColor.airColor)).setNoPushMobility(); + public static final Material sand = new Material(MapColor.sandColor); + public static final Material circuits = (new MaterialLogic(MapColor.airColor)).setNoPushMobility(); + public static final Material glass = (new Material(MapColor.airColor)).setIsTranslucent(); + public static final Material tnt = (new Material(MapColor.tntColor)).setBurning().setIsTranslucent(); + public static final Material field_4262_q = (new Material(MapColor.foliageColor)).setNoPushMobility(); + public static final Material ice = (new Material(MapColor.iceColor)).setIsTranslucent(); + public static final Material snow = (new MaterialLogic(MapColor.snowColor)).setIsGroundCover().setIsTranslucent().setNoHarvest().setNoPushMobility(); + public static final Material builtSnow = (new Material(MapColor.snowColor)).setNoHarvest(); + public static final Material cactus = (new Material(MapColor.foliageColor)).setIsTranslucent().setNoPushMobility(); + public static final Material clay = new Material(MapColor.clayColor); + public static final Material pumpkin = (new Material(MapColor.foliageColor)).setNoPushMobility(); + public static final Material portal = (new MaterialPortal(MapColor.airColor)).setImmovableMobility(); + public static final Material cakeMaterial = (new Material(MapColor.airColor)).setNoPushMobility(); + public static final Material field_31068_A = (new Material(MapColor.clothColor)).setNoHarvest().setNoPushMobility(); + public static final Material field_31067_B = (new Material(MapColor.stoneColor)).setImmovableMobility(); + private boolean canBurn; + private boolean groundCover; + private boolean isOpaque; + public final MapColor materialMapColor; + private boolean canHarvest = true; + private int mobilityFlag; + + public Material(MapColor var1) { + this.materialMapColor = var1; + } + + public boolean getIsLiquid() { + return false; + } + + public boolean isSolid() { + return true; + } + + public boolean getCanBlockGrass() { + return true; + } + + public boolean getIsSolid() { + return true; + } + + private Material setIsTranslucent() { + this.isOpaque = true; + return this; + } + + private Material setNoHarvest() { + this.canHarvest = false; + return this; + } + + private Material setBurning() { + this.canBurn = true; + return this; + } + + public boolean getBurning() { + return this.canBurn; + } + + public Material setIsGroundCover() { + this.groundCover = true; + return this; + } + + public boolean getIsGroundCover() { + return this.groundCover; + } + + public boolean getIsTranslucent() { + return this.isOpaque ? false : this.getIsSolid(); + } + + public boolean getIsHarvestable() { + return this.canHarvest; + } + + public int getMaterialMobility() { + return this.mobilityFlag; + } + + protected Material setNoPushMobility() { + this.mobilityFlag = 1; + return this; + } + + protected Material setImmovableMobility() { + this.mobilityFlag = 2; + return this; + } +} diff --git a/src/net/minecraft/src/MaterialLiquid.java b/src/net/minecraft/src/MaterialLiquid.java new file mode 100644 index 0000000..a65558e --- /dev/null +++ b/src/net/minecraft/src/MaterialLiquid.java @@ -0,0 +1,21 @@ +package net.minecraft.src; + +public class MaterialLiquid extends Material { + public MaterialLiquid(MapColor var1) { + super(var1); + this.setIsGroundCover(); + this.setNoPushMobility(); + } + + public boolean getIsLiquid() { + return true; + } + + public boolean getIsSolid() { + return false; + } + + public boolean isSolid() { + return false; + } +} diff --git a/src/net/minecraft/src/MaterialLogic.java b/src/net/minecraft/src/MaterialLogic.java new file mode 100644 index 0000000..e235bc9 --- /dev/null +++ b/src/net/minecraft/src/MaterialLogic.java @@ -0,0 +1,19 @@ +package net.minecraft.src; + +public class MaterialLogic extends Material { + public MaterialLogic(MapColor var1) { + super(var1); + } + + public boolean isSolid() { + return false; + } + + public boolean getCanBlockGrass() { + return false; + } + + public boolean getIsSolid() { + return false; + } +} diff --git a/src/net/minecraft/src/MaterialPortal.java b/src/net/minecraft/src/MaterialPortal.java new file mode 100644 index 0000000..8fabf63 --- /dev/null +++ b/src/net/minecraft/src/MaterialPortal.java @@ -0,0 +1,19 @@ +package net.minecraft.src; + +public class MaterialPortal extends Material { + public MaterialPortal(MapColor var1) { + super(var1); + } + + public boolean isSolid() { + return false; + } + + public boolean getCanBlockGrass() { + return false; + } + + public boolean getIsSolid() { + return false; + } +} diff --git a/src/net/minecraft/src/MaterialTransparent.java b/src/net/minecraft/src/MaterialTransparent.java new file mode 100644 index 0000000..8d50b76 --- /dev/null +++ b/src/net/minecraft/src/MaterialTransparent.java @@ -0,0 +1,20 @@ +package net.minecraft.src; + +public class MaterialTransparent extends Material { + public MaterialTransparent(MapColor var1) { + super(var1); + this.setIsGroundCover(); + } + + public boolean isSolid() { + return false; + } + + public boolean getCanBlockGrass() { + return false; + } + + public boolean getIsSolid() { + return false; + } +} diff --git a/src/net/minecraft/src/MathHelper.java b/src/net/minecraft/src/MathHelper.java new file mode 100644 index 0000000..70bc01a --- /dev/null +++ b/src/net/minecraft/src/MathHelper.java @@ -0,0 +1,62 @@ +package net.minecraft.src; + +public class MathHelper { + private static float[] SIN_TABLE = new float[65536]; + + public static final float sin(float var0) { + return SIN_TABLE[(int)(var0 * 10430.378F) & '\uffff']; + } + + public static final float cos(float var0) { + return SIN_TABLE[(int)(var0 * 10430.378F + 16384.0F) & '\uffff']; + } + + public static final float sqrt_float(float var0) { + return (float)Math.sqrt((double)var0); + } + + public static final float sqrt_double(double var0) { + return (float)Math.sqrt(var0); + } + + public static int floor_float(float var0) { + int var1 = (int)var0; + return var0 < (float)var1 ? var1 - 1 : var1; + } + + public static int floor_double(double var0) { + int var2 = (int)var0; + return var0 < (double)var2 ? var2 - 1 : var2; + } + + public static float abs(float var0) { + return var0 >= 0.0F ? var0 : -var0; + } + + public static double abs_max(double var0, double var2) { + if(var0 < 0.0D) { + var0 = -var0; + } + + if(var2 < 0.0D) { + var2 = -var2; + } + + return var0 > var2 ? var0 : var2; + } + + public static int bucketInt(int var0, int var1) { + return var0 < 0 ? -((-var0 - 1) / var1) - 1 : var0 / var1; + } + + public static boolean stringNullOrLengthZero(String var0) { + return var0 == null || var0.length() == 0; + } + + static { + for(int var0 = 0; var0 < 65536; ++var0) { + SIN_TABLE[var0] = (float)Math.sin((double)var0 * Math.PI * 2.0D / 65536.0D); + } + + } +} diff --git a/src/net/minecraft/src/McRegionChunkLoader.java b/src/net/minecraft/src/McRegionChunkLoader.java new file mode 100644 index 0000000..7d2b9fc --- /dev/null +++ b/src/net/minecraft/src/McRegionChunkLoader.java @@ -0,0 +1,69 @@ +package net.minecraft.src; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.File; +import java.io.IOException; + +public class McRegionChunkLoader implements IChunkLoader { + private final File worldDir; + + public McRegionChunkLoader(File var1) { + this.worldDir = var1; + } + + public Chunk loadChunk(World var1, int var2, int var3) throws IOException { + DataInputStream var4 = RegionFileCache.getChunkInputStream(this.worldDir, var2, var3); + if(var4 != null) { + NBTTagCompound var5 = CompressedStreamTools.func_1141_a(var4); + if(!var5.hasKey("Level")) { + System.out.println("Chunk file at " + var2 + "," + var3 + " is missing level data, skipping"); + return null; + } else if(!var5.getCompoundTag("Level").hasKey("Blocks")) { + System.out.println("Chunk file at " + var2 + "," + var3 + " is missing block data, skipping"); + return null; + } else { + Chunk var6 = ChunkLoader.loadChunkIntoWorldFromCompound(var1, var5.getCompoundTag("Level")); + if(!var6.isAtLocation(var2, var3)) { + System.out.println("Chunk file at " + var2 + "," + var3 + " is in the wrong location; relocating. (Expected " + var2 + ", " + var3 + ", got " + var6.xPosition + ", " + var6.zPosition + ")"); + var5.setInteger("xPos", var2); + var5.setInteger("zPos", var3); + var6 = ChunkLoader.loadChunkIntoWorldFromCompound(var1, var5.getCompoundTag("Level")); + } + + var6.func_25124_i(); + return var6; + } + } else { + return null; + } + } + + public void saveChunk(World var1, Chunk var2) throws IOException { + var1.checkSessionLock(); + + try { + DataOutputStream var3 = RegionFileCache.getChunkOutputStream(this.worldDir, var2.xPosition, var2.zPosition); + NBTTagCompound var4 = new NBTTagCompound(); + NBTTagCompound var5 = new NBTTagCompound(); + var4.setTag("Level", var5); + ChunkLoader.storeChunkInCompound(var2, var1, var5); + CompressedStreamTools.func_1139_a(var4, var3); + var3.close(); + WorldInfo var6 = var1.getWorldInfo(); + var6.setSizeOnDisk(var6.getSizeOnDisk() + (long)RegionFileCache.getSizeDelta(this.worldDir, var2.xPosition, var2.zPosition)); + } catch (Exception var7) { + var7.printStackTrace(); + } + + } + + public void saveExtraChunkData(World var1, Chunk var2) throws IOException { + } + + public void func_814_a() { + } + + public void saveExtraData() { + } +} diff --git a/src/net/minecraft/src/MetadataChunkBlock.java b/src/net/minecraft/src/MetadataChunkBlock.java new file mode 100644 index 0000000..143be99 --- /dev/null +++ b/src/net/minecraft/src/MetadataChunkBlock.java @@ -0,0 +1,207 @@ +package net.minecraft.src; + +public class MetadataChunkBlock { + public final EnumSkyBlock field_1299_a; + public int field_1298_b; + public int field_1304_c; + public int field_1303_d; + public int field_1302_e; + public int field_1301_f; + public int field_1300_g; + + public MetadataChunkBlock(EnumSkyBlock var1, int var2, int var3, int var4, int var5, int var6, int var7) { + this.field_1299_a = var1; + this.field_1298_b = var2; + this.field_1304_c = var3; + this.field_1303_d = var4; + this.field_1302_e = var5; + this.field_1301_f = var6; + this.field_1300_g = var7; + } + + public void func_4127_a(World var1) { + int var2 = this.field_1302_e - this.field_1298_b + 1; + int var3 = this.field_1301_f - this.field_1304_c + 1; + int var4 = this.field_1300_g - this.field_1303_d + 1; + int var5 = var2 * var3 * var4; + if(var5 > -Short.MIN_VALUE) { + System.out.println("Light too large, skipping!"); + } else { + int var6 = 0; + int var7 = 0; + boolean var8 = false; + boolean var9 = false; + + for(int var10 = this.field_1298_b; var10 <= this.field_1302_e; ++var10) { + for(int var11 = this.field_1303_d; var11 <= this.field_1300_g; ++var11) { + int var12 = var10 >> 4; + int var13 = var11 >> 4; + boolean var14 = false; + if(var8 && var12 == var6 && var13 == var7) { + var14 = var9; + } else { + var14 = var1.doChunksNearChunkExist(var10, 0, var11, 1); + if(var14) { + Chunk var15 = var1.getChunkFromChunkCoords(var10 >> 4, var11 >> 4); + if(var15.func_21167_h()) { + var14 = false; + } + } + + var9 = var14; + var6 = var12; + var7 = var13; + } + + if(var14) { + if(this.field_1304_c < 0) { + this.field_1304_c = 0; + } + + if(this.field_1301_f >= 128) { + this.field_1301_f = 127; + } + + for(int var27 = this.field_1304_c; var27 <= this.field_1301_f; ++var27) { + int var16 = var1.getSavedLightValue(this.field_1299_a, var10, var27, var11); + boolean var17 = false; + int var18 = var1.getBlockId(var10, var27, var11); + int var19 = Block.lightOpacity[var18]; + if(var19 == 0) { + var19 = 1; + } + + int var20 = 0; + if(this.field_1299_a == EnumSkyBlock.Sky) { + if(var1.canExistingBlockSeeTheSky(var10, var27, var11)) { + var20 = 15; + } + } else if(this.field_1299_a == EnumSkyBlock.Block) { + var20 = Block.lightValue[var18]; + } + + int var21; + int var28; + if(var19 >= 15 && var20 == 0) { + var28 = 0; + } else { + var21 = var1.getSavedLightValue(this.field_1299_a, var10 - 1, var27, var11); + int var22 = var1.getSavedLightValue(this.field_1299_a, var10 + 1, var27, var11); + int var23 = var1.getSavedLightValue(this.field_1299_a, var10, var27 - 1, var11); + int var24 = var1.getSavedLightValue(this.field_1299_a, var10, var27 + 1, var11); + int var25 = var1.getSavedLightValue(this.field_1299_a, var10, var27, var11 - 1); + int var26 = var1.getSavedLightValue(this.field_1299_a, var10, var27, var11 + 1); + var28 = var21; + if(var22 > var21) { + var28 = var22; + } + + if(var23 > var28) { + var28 = var23; + } + + if(var24 > var28) { + var28 = var24; + } + + if(var25 > var28) { + var28 = var25; + } + + if(var26 > var28) { + var28 = var26; + } + + var28 -= var19; + if(var28 < 0) { + var28 = 0; + } + + if(var20 > var28) { + var28 = var20; + } + } + + if(var16 != var28) { + var1.setLightValue(this.field_1299_a, var10, var27, var11, var28); + var21 = var28 - 1; + if(var21 < 0) { + var21 = 0; + } + + var1.neighborLightPropagationChanged(this.field_1299_a, var10 - 1, var27, var11, var21); + var1.neighborLightPropagationChanged(this.field_1299_a, var10, var27 - 1, var11, var21); + var1.neighborLightPropagationChanged(this.field_1299_a, var10, var27, var11 - 1, var21); + if(var10 + 1 >= this.field_1302_e) { + var1.neighborLightPropagationChanged(this.field_1299_a, var10 + 1, var27, var11, var21); + } + + if(var27 + 1 >= this.field_1301_f) { + var1.neighborLightPropagationChanged(this.field_1299_a, var10, var27 + 1, var11, var21); + } + + if(var11 + 1 >= this.field_1300_g) { + var1.neighborLightPropagationChanged(this.field_1299_a, var10, var27, var11 + 1, var21); + } + } + } + } + } + } + + } + } + + public boolean func_866_a(int var1, int var2, int var3, int var4, int var5, int var6) { + if(var1 >= this.field_1298_b && var2 >= this.field_1304_c && var3 >= this.field_1303_d && var4 <= this.field_1302_e && var5 <= this.field_1301_f && var6 <= this.field_1300_g) { + return true; + } else { + byte var7 = 1; + if(var1 >= this.field_1298_b - var7 && var2 >= this.field_1304_c - var7 && var3 >= this.field_1303_d - var7 && var4 <= this.field_1302_e + var7 && var5 <= this.field_1301_f + var7 && var6 <= this.field_1300_g + var7) { + int var8 = this.field_1302_e - this.field_1298_b; + int var9 = this.field_1301_f - this.field_1304_c; + int var10 = this.field_1300_g - this.field_1303_d; + if(var1 > this.field_1298_b) { + var1 = this.field_1298_b; + } + + if(var2 > this.field_1304_c) { + var2 = this.field_1304_c; + } + + if(var3 > this.field_1303_d) { + var3 = this.field_1303_d; + } + + if(var4 < this.field_1302_e) { + var4 = this.field_1302_e; + } + + if(var5 < this.field_1301_f) { + var5 = this.field_1301_f; + } + + if(var6 < this.field_1300_g) { + var6 = this.field_1300_g; + } + + int var11 = var4 - var1; + int var12 = var5 - var2; + int var13 = var6 - var3; + int var14 = var8 * var9 * var10; + int var15 = var11 * var12 * var13; + if(var15 - var14 <= 2) { + this.field_1298_b = var1; + this.field_1304_c = var2; + this.field_1303_d = var3; + this.field_1302_e = var4; + this.field_1301_f = var5; + this.field_1300_g = var6; + return true; + } + } + + return false; + } + } +} diff --git a/src/net/minecraft/src/MinecraftAppletImpl.java b/src/net/minecraft/src/MinecraftAppletImpl.java new file mode 100644 index 0000000..7ec638a --- /dev/null +++ b/src/net/minecraft/src/MinecraftAppletImpl.java @@ -0,0 +1,23 @@ +package net.minecraft.src; + +import java.awt.BorderLayout; +import java.awt.Canvas; +import java.awt.Component; +import net.minecraft.client.Minecraft; +import net.minecraft.client.MinecraftApplet; + +public class MinecraftAppletImpl extends Minecraft { + final MinecraftApplet mainFrame; + + public MinecraftAppletImpl(MinecraftApplet var1, Component var2, Canvas var3, MinecraftApplet var4, int var5, int var6, boolean var7) { + super(var2, var3, var4, var5, var6, var7); + this.mainFrame = var1; + } + + public void displayUnexpectedThrowable(UnexpectedThrowable var1) { + this.mainFrame.removeAll(); + this.mainFrame.setLayout(new BorderLayout()); + this.mainFrame.add(new PanelCrashReport(var1), "Center"); + this.mainFrame.validate(); + } +} diff --git a/src/net/minecraft/src/MinecraftError.java b/src/net/minecraft/src/MinecraftError.java new file mode 100644 index 0000000..d39c889 --- /dev/null +++ b/src/net/minecraft/src/MinecraftError.java @@ -0,0 +1,4 @@ +package net.minecraft.src; + +public class MinecraftError extends Error { +} diff --git a/src/net/minecraft/src/MinecraftException.java b/src/net/minecraft/src/MinecraftException.java new file mode 100644 index 0000000..0cf8790 --- /dev/null +++ b/src/net/minecraft/src/MinecraftException.java @@ -0,0 +1,7 @@ +package net.minecraft.src; + +public class MinecraftException extends RuntimeException { + public MinecraftException(String var1) { + super(var1); + } +} diff --git a/src/net/minecraft/src/MinecraftImpl.java b/src/net/minecraft/src/MinecraftImpl.java new file mode 100644 index 0000000..1429781 --- /dev/null +++ b/src/net/minecraft/src/MinecraftImpl.java @@ -0,0 +1,22 @@ +package net.minecraft.src; + +import java.awt.Canvas; +import java.awt.Component; +import java.awt.Frame; +import net.minecraft.client.Minecraft; +import net.minecraft.client.MinecraftApplet; + +public final class MinecraftImpl extends Minecraft { + final Frame mcFrame; + + public MinecraftImpl(Component var1, Canvas var2, MinecraftApplet var3, int var4, int var5, boolean var6, Frame var7) { + super(var1, var2, var3, var4, var5, var6); + this.mcFrame = var7; + } + + public void displayUnexpectedThrowable(UnexpectedThrowable var1) { + this.mcFrame.removeAll(); + this.mcFrame.add(new PanelCrashReport(var1), "Center"); + this.mcFrame.validate(); + } +} diff --git a/src/net/minecraft/src/ModelBase.java b/src/net/minecraft/src/ModelBase.java new file mode 100644 index 0000000..709a6ee --- /dev/null +++ b/src/net/minecraft/src/ModelBase.java @@ -0,0 +1,15 @@ +package net.minecraft.src; + +public abstract class ModelBase { + public float onGround; + public boolean isRiding = false; + + public void render(float var1, float var2, float var3, float var4, float var5, float var6) { + } + + public void setRotationAngles(float var1, float var2, float var3, float var4, float var5, float var6) { + } + + public void setLivingAnimations(EntityLiving var1, float var2, float var3, float var4) { + } +} diff --git a/src/net/minecraft/src/ModelBed.java b/src/net/minecraft/src/ModelBed.java new file mode 100644 index 0000000..dd72822 --- /dev/null +++ b/src/net/minecraft/src/ModelBed.java @@ -0,0 +1,7 @@ +package net.minecraft.src; + +public class ModelBed { + public static final int[] field_22280_a = new int[]{3, 4, 2, 5}; + public static final int[] field_22279_b = new int[]{2, 3, 0, 1}; + public static final int[][] bedDirection = new int[][]{{1, 0, 3, 2, 5, 4}, {1, 0, 5, 4, 2, 3}, {1, 0, 2, 3, 4, 5}, {1, 0, 4, 5, 3, 2}}; +} diff --git a/src/net/minecraft/src/ModelBiped.java b/src/net/minecraft/src/ModelBiped.java new file mode 100644 index 0000000..f8bd51f --- /dev/null +++ b/src/net/minecraft/src/ModelBiped.java @@ -0,0 +1,159 @@ +package net.minecraft.src; + +public class ModelBiped extends ModelBase { + public ModelRenderer bipedHead; + public ModelRenderer bipedHeadwear; + public ModelRenderer bipedBody; + public ModelRenderer bipedRightArm; + public ModelRenderer bipedLeftArm; + public ModelRenderer bipedRightLeg; + public ModelRenderer bipedLeftLeg; + public ModelRenderer bipedEars; + public ModelRenderer bipedCloak; + public boolean field_1279_h; + public boolean field_1278_i; + public boolean isSneak; + + public ModelBiped() { + this(0.0F); + } + + public ModelBiped(float var1) { + this(var1, 0.0F); + } + + public ModelBiped(float var1, float var2) { + this.field_1279_h = false; + this.field_1278_i = false; + this.isSneak = false; + this.bipedCloak = new ModelRenderer(0, 0); + this.bipedCloak.addBox(-5.0F, 0.0F, -1.0F, 10, 16, 1, var1); + this.bipedEars = new ModelRenderer(24, 0); + this.bipedEars.addBox(-3.0F, -6.0F, -1.0F, 6, 6, 1, var1); + this.bipedHead = new ModelRenderer(0, 0); + this.bipedHead.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, var1); + this.bipedHead.setRotationPoint(0.0F, 0.0F + var2, 0.0F); + this.bipedHeadwear = new ModelRenderer(32, 0); + this.bipedHeadwear.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, var1 + 0.5F); + this.bipedHeadwear.setRotationPoint(0.0F, 0.0F + var2, 0.0F); + this.bipedBody = new ModelRenderer(16, 16); + this.bipedBody.addBox(-4.0F, 0.0F, -2.0F, 8, 12, 4, var1); + this.bipedBody.setRotationPoint(0.0F, 0.0F + var2, 0.0F); + this.bipedRightArm = new ModelRenderer(40, 16); + this.bipedRightArm.addBox(-3.0F, -2.0F, -2.0F, 4, 12, 4, var1); + this.bipedRightArm.setRotationPoint(-5.0F, 2.0F + var2, 0.0F); + this.bipedLeftArm = new ModelRenderer(40, 16); + this.bipedLeftArm.mirror = true; + this.bipedLeftArm.addBox(-1.0F, -2.0F, -2.0F, 4, 12, 4, var1); + this.bipedLeftArm.setRotationPoint(5.0F, 2.0F + var2, 0.0F); + this.bipedRightLeg = new ModelRenderer(0, 16); + this.bipedRightLeg.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, var1); + this.bipedRightLeg.setRotationPoint(-2.0F, 12.0F + var2, 0.0F); + this.bipedLeftLeg = new ModelRenderer(0, 16); + this.bipedLeftLeg.mirror = true; + this.bipedLeftLeg.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, var1); + this.bipedLeftLeg.setRotationPoint(2.0F, 12.0F + var2, 0.0F); + } + + public void render(float var1, float var2, float var3, float var4, float var5, float var6) { + this.setRotationAngles(var1, var2, var3, var4, var5, var6); + this.bipedHead.render(var6); + this.bipedBody.render(var6); + this.bipedRightArm.render(var6); + this.bipedLeftArm.render(var6); + this.bipedRightLeg.render(var6); + this.bipedLeftLeg.render(var6); + this.bipedHeadwear.render(var6); + } + + public void setRotationAngles(float var1, float var2, float var3, float var4, float var5, float var6) { + this.bipedHead.rotateAngleY = var4 / (180.0F / (float)Math.PI); + this.bipedHead.rotateAngleX = var5 / (180.0F / (float)Math.PI); + this.bipedHeadwear.rotateAngleY = this.bipedHead.rotateAngleY; + this.bipedHeadwear.rotateAngleX = this.bipedHead.rotateAngleX; + this.bipedRightArm.rotateAngleX = MathHelper.cos(var1 * 0.6662F + (float)Math.PI) * 2.0F * var2 * 0.5F; + this.bipedLeftArm.rotateAngleX = MathHelper.cos(var1 * 0.6662F) * 2.0F * var2 * 0.5F; + this.bipedRightArm.rotateAngleZ = 0.0F; + this.bipedLeftArm.rotateAngleZ = 0.0F; + this.bipedRightLeg.rotateAngleX = MathHelper.cos(var1 * 0.6662F) * 1.4F * var2; + this.bipedLeftLeg.rotateAngleX = MathHelper.cos(var1 * 0.6662F + (float)Math.PI) * 1.4F * var2; + this.bipedRightLeg.rotateAngleY = 0.0F; + this.bipedLeftLeg.rotateAngleY = 0.0F; + if(this.isRiding) { + this.bipedRightArm.rotateAngleX += (float)Math.PI * -0.2F; + this.bipedLeftArm.rotateAngleX += (float)Math.PI * -0.2F; + this.bipedRightLeg.rotateAngleX = (float)Math.PI * -0.4F; + this.bipedLeftLeg.rotateAngleX = (float)Math.PI * -0.4F; + this.bipedRightLeg.rotateAngleY = (float)Math.PI * 0.1F; + this.bipedLeftLeg.rotateAngleY = (float)Math.PI * -0.1F; + } + + if(this.field_1279_h) { + this.bipedLeftArm.rotateAngleX = this.bipedLeftArm.rotateAngleX * 0.5F - (float)Math.PI * 0.1F; + } + + if(this.field_1278_i) { + this.bipedRightArm.rotateAngleX = this.bipedRightArm.rotateAngleX * 0.5F - (float)Math.PI * 0.1F; + } + + this.bipedRightArm.rotateAngleY = 0.0F; + this.bipedLeftArm.rotateAngleY = 0.0F; + if(this.onGround > -9990.0F) { + float var7 = this.onGround; + this.bipedBody.rotateAngleY = MathHelper.sin(MathHelper.sqrt_float(var7) * (float)Math.PI * 2.0F) * 0.2F; + this.bipedRightArm.rotationPointZ = MathHelper.sin(this.bipedBody.rotateAngleY) * 5.0F; + this.bipedRightArm.rotationPointX = -MathHelper.cos(this.bipedBody.rotateAngleY) * 5.0F; + this.bipedLeftArm.rotationPointZ = -MathHelper.sin(this.bipedBody.rotateAngleY) * 5.0F; + this.bipedLeftArm.rotationPointX = MathHelper.cos(this.bipedBody.rotateAngleY) * 5.0F; + this.bipedRightArm.rotateAngleY += this.bipedBody.rotateAngleY; + this.bipedLeftArm.rotateAngleY += this.bipedBody.rotateAngleY; + this.bipedLeftArm.rotateAngleX += this.bipedBody.rotateAngleY; + var7 = 1.0F - this.onGround; + var7 *= var7; + var7 *= var7; + var7 = 1.0F - var7; + float var8 = MathHelper.sin(var7 * (float)Math.PI); + float var9 = MathHelper.sin(this.onGround * (float)Math.PI) * -(this.bipedHead.rotateAngleX - 0.7F) * (12.0F / 16.0F); + this.bipedRightArm.rotateAngleX = (float)((double)this.bipedRightArm.rotateAngleX - ((double)var8 * 1.2D + (double)var9)); + this.bipedRightArm.rotateAngleY += this.bipedBody.rotateAngleY * 2.0F; + this.bipedRightArm.rotateAngleZ = MathHelper.sin(this.onGround * (float)Math.PI) * -0.4F; + } + + if(this.isSneak) { + this.bipedBody.rotateAngleX = 0.5F; + this.bipedRightLeg.rotateAngleX -= 0.0F; + this.bipedLeftLeg.rotateAngleX -= 0.0F; + this.bipedRightArm.rotateAngleX += 0.4F; + this.bipedLeftArm.rotateAngleX += 0.4F; + this.bipedRightLeg.rotationPointZ = 4.0F; + this.bipedLeftLeg.rotationPointZ = 4.0F; + this.bipedRightLeg.rotationPointY = 9.0F; + this.bipedLeftLeg.rotationPointY = 9.0F; + this.bipedHead.rotationPointY = 1.0F; + } else { + this.bipedBody.rotateAngleX = 0.0F; + this.bipedRightLeg.rotationPointZ = 0.0F; + this.bipedLeftLeg.rotationPointZ = 0.0F; + this.bipedRightLeg.rotationPointY = 12.0F; + this.bipedLeftLeg.rotationPointY = 12.0F; + this.bipedHead.rotationPointY = 0.0F; + } + + this.bipedRightArm.rotateAngleZ += MathHelper.cos(var3 * 0.09F) * 0.05F + 0.05F; + this.bipedLeftArm.rotateAngleZ -= MathHelper.cos(var3 * 0.09F) * 0.05F + 0.05F; + this.bipedRightArm.rotateAngleX += MathHelper.sin(var3 * 0.067F) * 0.05F; + this.bipedLeftArm.rotateAngleX -= MathHelper.sin(var3 * 0.067F) * 0.05F; + } + + public void renderEars(float var1) { + this.bipedEars.rotateAngleY = this.bipedHead.rotateAngleY; + this.bipedEars.rotateAngleX = this.bipedHead.rotateAngleX; + this.bipedEars.rotationPointX = 0.0F; + this.bipedEars.rotationPointY = 0.0F; + this.bipedEars.render(var1); + } + + public void renderCloak(float var1) { + this.bipedCloak.render(var1); + } +} diff --git a/src/net/minecraft/src/ModelBoat.java b/src/net/minecraft/src/ModelBoat.java new file mode 100644 index 0000000..8c70fd4 --- /dev/null +++ b/src/net/minecraft/src/ModelBoat.java @@ -0,0 +1,41 @@ +package net.minecraft.src; + +public class ModelBoat extends ModelBase { + public ModelRenderer[] boatSides = new ModelRenderer[5]; + + public ModelBoat() { + this.boatSides[0] = new ModelRenderer(0, 8); + this.boatSides[1] = new ModelRenderer(0, 0); + this.boatSides[2] = new ModelRenderer(0, 0); + this.boatSides[3] = new ModelRenderer(0, 0); + this.boatSides[4] = new ModelRenderer(0, 0); + byte var1 = 24; + byte var2 = 6; + byte var3 = 20; + byte var4 = 4; + this.boatSides[0].addBox((float)(-var1 / 2), (float)(-var3 / 2 + 2), -3.0F, var1, var3 - 4, 4, 0.0F); + this.boatSides[0].setRotationPoint(0.0F, (float)(0 + var4), 0.0F); + this.boatSides[1].addBox((float)(-var1 / 2 + 2), (float)(-var2 - 1), -1.0F, var1 - 4, var2, 2, 0.0F); + this.boatSides[1].setRotationPoint((float)(-var1 / 2 + 1), (float)(0 + var4), 0.0F); + this.boatSides[2].addBox((float)(-var1 / 2 + 2), (float)(-var2 - 1), -1.0F, var1 - 4, var2, 2, 0.0F); + this.boatSides[2].setRotationPoint((float)(var1 / 2 - 1), (float)(0 + var4), 0.0F); + this.boatSides[3].addBox((float)(-var1 / 2 + 2), (float)(-var2 - 1), -1.0F, var1 - 4, var2, 2, 0.0F); + this.boatSides[3].setRotationPoint(0.0F, (float)(0 + var4), (float)(-var3 / 2 + 1)); + this.boatSides[4].addBox((float)(-var1 / 2 + 2), (float)(-var2 - 1), -1.0F, var1 - 4, var2, 2, 0.0F); + this.boatSides[4].setRotationPoint(0.0F, (float)(0 + var4), (float)(var3 / 2 - 1)); + this.boatSides[0].rotateAngleX = (float)Math.PI * 0.5F; + this.boatSides[1].rotateAngleY = (float)Math.PI * 3.0F / 2.0F; + this.boatSides[2].rotateAngleY = (float)Math.PI * 0.5F; + this.boatSides[3].rotateAngleY = (float)Math.PI; + } + + public void render(float var1, float var2, float var3, float var4, float var5, float var6) { + for(int var7 = 0; var7 < 5; ++var7) { + this.boatSides[var7].render(var6); + } + + } + + public void setRotationAngles(float var1, float var2, float var3, float var4, float var5, float var6) { + } +} diff --git a/src/net/minecraft/src/ModelChicken.java b/src/net/minecraft/src/ModelChicken.java new file mode 100644 index 0000000..bb7d15b --- /dev/null +++ b/src/net/minecraft/src/ModelChicken.java @@ -0,0 +1,66 @@ +package net.minecraft.src; + +public class ModelChicken extends ModelBase { + public ModelRenderer head; + public ModelRenderer body; + public ModelRenderer rightLeg; + public ModelRenderer leftLeg; + public ModelRenderer rightWing; + public ModelRenderer leftWing; + public ModelRenderer bill; + public ModelRenderer chin; + + public ModelChicken() { + byte var1 = 16; + this.head = new ModelRenderer(0, 0); + this.head.addBox(-2.0F, -6.0F, -2.0F, 4, 6, 3, 0.0F); + this.head.setRotationPoint(0.0F, (float)(-1 + var1), -4.0F); + this.bill = new ModelRenderer(14, 0); + this.bill.addBox(-2.0F, -4.0F, -4.0F, 4, 2, 2, 0.0F); + this.bill.setRotationPoint(0.0F, (float)(-1 + var1), -4.0F); + this.chin = new ModelRenderer(14, 4); + this.chin.addBox(-1.0F, -2.0F, -3.0F, 2, 2, 2, 0.0F); + this.chin.setRotationPoint(0.0F, (float)(-1 + var1), -4.0F); + this.body = new ModelRenderer(0, 9); + this.body.addBox(-3.0F, -4.0F, -3.0F, 6, 8, 6, 0.0F); + this.body.setRotationPoint(0.0F, (float)(0 + var1), 0.0F); + this.rightLeg = new ModelRenderer(26, 0); + this.rightLeg.addBox(-1.0F, 0.0F, -3.0F, 3, 5, 3); + this.rightLeg.setRotationPoint(-2.0F, (float)(3 + var1), 1.0F); + this.leftLeg = new ModelRenderer(26, 0); + this.leftLeg.addBox(-1.0F, 0.0F, -3.0F, 3, 5, 3); + this.leftLeg.setRotationPoint(1.0F, (float)(3 + var1), 1.0F); + this.rightWing = new ModelRenderer(24, 13); + this.rightWing.addBox(0.0F, 0.0F, -3.0F, 1, 4, 6); + this.rightWing.setRotationPoint(-4.0F, (float)(-3 + var1), 0.0F); + this.leftWing = new ModelRenderer(24, 13); + this.leftWing.addBox(-1.0F, 0.0F, -3.0F, 1, 4, 6); + this.leftWing.setRotationPoint(4.0F, (float)(-3 + var1), 0.0F); + } + + public void render(float var1, float var2, float var3, float var4, float var5, float var6) { + this.setRotationAngles(var1, var2, var3, var4, var5, var6); + this.head.render(var6); + this.bill.render(var6); + this.chin.render(var6); + this.body.render(var6); + this.rightLeg.render(var6); + this.leftLeg.render(var6); + this.rightWing.render(var6); + this.leftWing.render(var6); + } + + public void setRotationAngles(float var1, float var2, float var3, float var4, float var5, float var6) { + this.head.rotateAngleX = -(var5 / (180.0F / (float)Math.PI)); + this.head.rotateAngleY = var4 / (180.0F / (float)Math.PI); + this.bill.rotateAngleX = this.head.rotateAngleX; + this.bill.rotateAngleY = this.head.rotateAngleY; + this.chin.rotateAngleX = this.head.rotateAngleX; + this.chin.rotateAngleY = this.head.rotateAngleY; + this.body.rotateAngleX = (float)Math.PI * 0.5F; + this.rightLeg.rotateAngleX = MathHelper.cos(var1 * 0.6662F) * 1.4F * var2; + this.leftLeg.rotateAngleX = MathHelper.cos(var1 * 0.6662F + (float)Math.PI) * 1.4F * var2; + this.rightWing.rotateAngleZ = var3; + this.leftWing.rotateAngleZ = -var3; + } +} diff --git a/src/net/minecraft/src/ModelCow.java b/src/net/minecraft/src/ModelCow.java new file mode 100644 index 0000000..ff33193 --- /dev/null +++ b/src/net/minecraft/src/ModelCow.java @@ -0,0 +1,50 @@ +package net.minecraft.src; + +public class ModelCow extends ModelQuadruped { + ModelRenderer udders; + ModelRenderer horn1; + ModelRenderer horn2; + + public ModelCow() { + super(12, 0.0F); + this.head = new ModelRenderer(0, 0); + this.head.addBox(-4.0F, -4.0F, -6.0F, 8, 8, 6, 0.0F); + this.head.setRotationPoint(0.0F, 4.0F, -8.0F); + this.horn1 = new ModelRenderer(22, 0); + this.horn1.addBox(-4.0F, -5.0F, -4.0F, 1, 3, 1, 0.0F); + this.horn1.setRotationPoint(0.0F, 3.0F, -7.0F); + this.horn2 = new ModelRenderer(22, 0); + this.horn2.addBox(3.0F, -5.0F, -4.0F, 1, 3, 1, 0.0F); + this.horn2.setRotationPoint(0.0F, 3.0F, -7.0F); + this.udders = new ModelRenderer(52, 0); + this.udders.addBox(-2.0F, -3.0F, 0.0F, 4, 6, 2, 0.0F); + this.udders.setRotationPoint(0.0F, 14.0F, 6.0F); + this.udders.rotateAngleX = (float)Math.PI * 0.5F; + this.body = new ModelRenderer(18, 4); + this.body.addBox(-6.0F, -10.0F, -7.0F, 12, 18, 10, 0.0F); + this.body.setRotationPoint(0.0F, 5.0F, 2.0F); + --this.leg1.rotationPointX; + ++this.leg2.rotationPointX; + this.leg1.rotationPointZ += 0.0F; + this.leg2.rotationPointZ += 0.0F; + --this.leg3.rotationPointX; + ++this.leg4.rotationPointX; + --this.leg3.rotationPointZ; + --this.leg4.rotationPointZ; + } + + public void render(float var1, float var2, float var3, float var4, float var5, float var6) { + super.render(var1, var2, var3, var4, var5, var6); + this.horn1.render(var6); + this.horn2.render(var6); + this.udders.render(var6); + } + + public void setRotationAngles(float var1, float var2, float var3, float var4, float var5, float var6) { + super.setRotationAngles(var1, var2, var3, var4, var5, var6); + this.horn1.rotateAngleY = this.head.rotateAngleY; + this.horn1.rotateAngleX = this.head.rotateAngleX; + this.horn2.rotateAngleY = this.head.rotateAngleY; + this.horn2.rotateAngleX = this.head.rotateAngleX; + } +} diff --git a/src/net/minecraft/src/ModelCreeper.java b/src/net/minecraft/src/ModelCreeper.java new file mode 100644 index 0000000..6b93bb5 --- /dev/null +++ b/src/net/minecraft/src/ModelCreeper.java @@ -0,0 +1,59 @@ +package net.minecraft.src; + +public class ModelCreeper extends ModelBase { + public ModelRenderer head; + public ModelRenderer field_1270_b; + public ModelRenderer body; + public ModelRenderer leg1; + public ModelRenderer leg2; + public ModelRenderer leg3; + public ModelRenderer leg4; + + public ModelCreeper() { + this(0.0F); + } + + public ModelCreeper(float var1) { + byte var2 = 4; + this.head = new ModelRenderer(0, 0); + this.head.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, var1); + this.head.setRotationPoint(0.0F, (float)var2, 0.0F); + this.field_1270_b = new ModelRenderer(32, 0); + this.field_1270_b.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, var1 + 0.5F); + this.field_1270_b.setRotationPoint(0.0F, (float)var2, 0.0F); + this.body = new ModelRenderer(16, 16); + this.body.addBox(-4.0F, 0.0F, -2.0F, 8, 12, 4, var1); + this.body.setRotationPoint(0.0F, (float)var2, 0.0F); + this.leg1 = new ModelRenderer(0, 16); + this.leg1.addBox(-2.0F, 0.0F, -2.0F, 4, 6, 4, var1); + this.leg1.setRotationPoint(-2.0F, (float)(12 + var2), 4.0F); + this.leg2 = new ModelRenderer(0, 16); + this.leg2.addBox(-2.0F, 0.0F, -2.0F, 4, 6, 4, var1); + this.leg2.setRotationPoint(2.0F, (float)(12 + var2), 4.0F); + this.leg3 = new ModelRenderer(0, 16); + this.leg3.addBox(-2.0F, 0.0F, -2.0F, 4, 6, 4, var1); + this.leg3.setRotationPoint(-2.0F, (float)(12 + var2), -4.0F); + this.leg4 = new ModelRenderer(0, 16); + this.leg4.addBox(-2.0F, 0.0F, -2.0F, 4, 6, 4, var1); + this.leg4.setRotationPoint(2.0F, (float)(12 + var2), -4.0F); + } + + public void render(float var1, float var2, float var3, float var4, float var5, float var6) { + this.setRotationAngles(var1, var2, var3, var4, var5, var6); + this.head.render(var6); + this.body.render(var6); + this.leg1.render(var6); + this.leg2.render(var6); + this.leg3.render(var6); + this.leg4.render(var6); + } + + public void setRotationAngles(float var1, float var2, float var3, float var4, float var5, float var6) { + this.head.rotateAngleY = var4 / (180.0F / (float)Math.PI); + this.head.rotateAngleX = var5 / (180.0F / (float)Math.PI); + this.leg1.rotateAngleX = MathHelper.cos(var1 * 0.6662F) * 1.4F * var2; + this.leg2.rotateAngleX = MathHelper.cos(var1 * 0.6662F + (float)Math.PI) * 1.4F * var2; + this.leg3.rotateAngleX = MathHelper.cos(var1 * 0.6662F + (float)Math.PI) * 1.4F * var2; + this.leg4.rotateAngleX = MathHelper.cos(var1 * 0.6662F) * 1.4F * var2; + } +} diff --git a/src/net/minecraft/src/ModelGhast.java b/src/net/minecraft/src/ModelGhast.java new file mode 100644 index 0000000..1852c0f --- /dev/null +++ b/src/net/minecraft/src/ModelGhast.java @@ -0,0 +1,45 @@ +package net.minecraft.src; + +import java.util.Random; + +public class ModelGhast extends ModelBase { + ModelRenderer body; + ModelRenderer[] tentacles = new ModelRenderer[9]; + + public ModelGhast() { + byte var1 = -16; + this.body = new ModelRenderer(0, 0); + this.body.addBox(-8.0F, -8.0F, -8.0F, 16, 16, 16); + this.body.rotationPointY += (float)(24 + var1); + Random var2 = new Random(1660L); + + for(int var3 = 0; var3 < this.tentacles.length; ++var3) { + this.tentacles[var3] = new ModelRenderer(0, 0); + float var4 = (((float)(var3 % 3) - (float)(var3 / 3 % 2) * 0.5F + 0.25F) / 2.0F * 2.0F - 1.0F) * 5.0F; + float var5 = ((float)(var3 / 3) / 2.0F * 2.0F - 1.0F) * 5.0F; + int var6 = var2.nextInt(7) + 8; + this.tentacles[var3].addBox(-1.0F, 0.0F, -1.0F, 2, var6, 2); + this.tentacles[var3].rotationPointX = var4; + this.tentacles[var3].rotationPointZ = var5; + this.tentacles[var3].rotationPointY = (float)(31 + var1); + } + + } + + public void setRotationAngles(float var1, float var2, float var3, float var4, float var5, float var6) { + for(int var7 = 0; var7 < this.tentacles.length; ++var7) { + this.tentacles[var7].rotateAngleX = 0.2F * MathHelper.sin(var3 * 0.3F + (float)var7) + 0.4F; + } + + } + + public void render(float var1, float var2, float var3, float var4, float var5, float var6) { + this.setRotationAngles(var1, var2, var3, var4, var5, var6); + this.body.render(var6); + + for(int var7 = 0; var7 < this.tentacles.length; ++var7) { + this.tentacles[var7].render(var6); + } + + } +} diff --git a/src/net/minecraft/src/ModelMinecart.java b/src/net/minecraft/src/ModelMinecart.java new file mode 100644 index 0000000..4258e09 --- /dev/null +++ b/src/net/minecraft/src/ModelMinecart.java @@ -0,0 +1,47 @@ +package net.minecraft.src; + +public class ModelMinecart extends ModelBase { + public ModelRenderer[] sideModels = new ModelRenderer[7]; + + public ModelMinecart() { + this.sideModels[0] = new ModelRenderer(0, 10); + this.sideModels[1] = new ModelRenderer(0, 0); + this.sideModels[2] = new ModelRenderer(0, 0); + this.sideModels[3] = new ModelRenderer(0, 0); + this.sideModels[4] = new ModelRenderer(0, 0); + this.sideModels[5] = new ModelRenderer(44, 10); + byte var1 = 20; + byte var2 = 8; + byte var3 = 16; + byte var4 = 4; + this.sideModels[0].addBox((float)(-var1 / 2), (float)(-var3 / 2), -1.0F, var1, var3, 2, 0.0F); + this.sideModels[0].setRotationPoint(0.0F, (float)(0 + var4), 0.0F); + this.sideModels[5].addBox((float)(-var1 / 2 + 1), (float)(-var3 / 2 + 1), -1.0F, var1 - 2, var3 - 2, 1, 0.0F); + this.sideModels[5].setRotationPoint(0.0F, (float)(0 + var4), 0.0F); + this.sideModels[1].addBox((float)(-var1 / 2 + 2), (float)(-var2 - 1), -1.0F, var1 - 4, var2, 2, 0.0F); + this.sideModels[1].setRotationPoint((float)(-var1 / 2 + 1), (float)(0 + var4), 0.0F); + this.sideModels[2].addBox((float)(-var1 / 2 + 2), (float)(-var2 - 1), -1.0F, var1 - 4, var2, 2, 0.0F); + this.sideModels[2].setRotationPoint((float)(var1 / 2 - 1), (float)(0 + var4), 0.0F); + this.sideModels[3].addBox((float)(-var1 / 2 + 2), (float)(-var2 - 1), -1.0F, var1 - 4, var2, 2, 0.0F); + this.sideModels[3].setRotationPoint(0.0F, (float)(0 + var4), (float)(-var3 / 2 + 1)); + this.sideModels[4].addBox((float)(-var1 / 2 + 2), (float)(-var2 - 1), -1.0F, var1 - 4, var2, 2, 0.0F); + this.sideModels[4].setRotationPoint(0.0F, (float)(0 + var4), (float)(var3 / 2 - 1)); + this.sideModels[0].rotateAngleX = (float)Math.PI * 0.5F; + this.sideModels[1].rotateAngleY = (float)Math.PI * 3.0F / 2.0F; + this.sideModels[2].rotateAngleY = (float)Math.PI * 0.5F; + this.sideModels[3].rotateAngleY = (float)Math.PI; + this.sideModels[5].rotateAngleX = (float)Math.PI * -0.5F; + } + + public void render(float var1, float var2, float var3, float var4, float var5, float var6) { + this.sideModels[5].rotationPointY = 4.0F - var3; + + for(int var7 = 0; var7 < 6; ++var7) { + this.sideModels[var7].render(var6); + } + + } + + public void setRotationAngles(float var1, float var2, float var3, float var4, float var5, float var6) { + } +} diff --git a/src/net/minecraft/src/ModelPig.java b/src/net/minecraft/src/ModelPig.java new file mode 100644 index 0000000..6f25003 --- /dev/null +++ b/src/net/minecraft/src/ModelPig.java @@ -0,0 +1,11 @@ +package net.minecraft.src; + +public class ModelPig extends ModelQuadruped { + public ModelPig() { + super(6, 0.0F); + } + + public ModelPig(float var1) { + super(6, var1); + } +} diff --git a/src/net/minecraft/src/ModelQuadruped.java b/src/net/minecraft/src/ModelQuadruped.java new file mode 100644 index 0000000..ada9b7f --- /dev/null +++ b/src/net/minecraft/src/ModelQuadruped.java @@ -0,0 +1,50 @@ +package net.minecraft.src; + +public class ModelQuadruped extends ModelBase { + public ModelRenderer head = new ModelRenderer(0, 0); + public ModelRenderer body; + public ModelRenderer leg1; + public ModelRenderer leg2; + public ModelRenderer leg3; + public ModelRenderer leg4; + + public ModelQuadruped(int var1, float var2) { + this.head.addBox(-4.0F, -4.0F, -8.0F, 8, 8, 8, var2); + this.head.setRotationPoint(0.0F, (float)(18 - var1), -6.0F); + this.body = new ModelRenderer(28, 8); + this.body.addBox(-5.0F, -10.0F, -7.0F, 10, 16, 8, var2); + this.body.setRotationPoint(0.0F, (float)(17 - var1), 2.0F); + this.leg1 = new ModelRenderer(0, 16); + this.leg1.addBox(-2.0F, 0.0F, -2.0F, 4, var1, 4, var2); + this.leg1.setRotationPoint(-3.0F, (float)(24 - var1), 7.0F); + this.leg2 = new ModelRenderer(0, 16); + this.leg2.addBox(-2.0F, 0.0F, -2.0F, 4, var1, 4, var2); + this.leg2.setRotationPoint(3.0F, (float)(24 - var1), 7.0F); + this.leg3 = new ModelRenderer(0, 16); + this.leg3.addBox(-2.0F, 0.0F, -2.0F, 4, var1, 4, var2); + this.leg3.setRotationPoint(-3.0F, (float)(24 - var1), -5.0F); + this.leg4 = new ModelRenderer(0, 16); + this.leg4.addBox(-2.0F, 0.0F, -2.0F, 4, var1, 4, var2); + this.leg4.setRotationPoint(3.0F, (float)(24 - var1), -5.0F); + } + + public void render(float var1, float var2, float var3, float var4, float var5, float var6) { + this.setRotationAngles(var1, var2, var3, var4, var5, var6); + this.head.render(var6); + this.body.render(var6); + this.leg1.render(var6); + this.leg2.render(var6); + this.leg3.render(var6); + this.leg4.render(var6); + } + + public void setRotationAngles(float var1, float var2, float var3, float var4, float var5, float var6) { + this.head.rotateAngleX = var5 / (180.0F / (float)Math.PI); + this.head.rotateAngleY = var4 / (180.0F / (float)Math.PI); + this.body.rotateAngleX = (float)Math.PI * 0.5F; + this.leg1.rotateAngleX = MathHelper.cos(var1 * 0.6662F) * 1.4F * var2; + this.leg2.rotateAngleX = MathHelper.cos(var1 * 0.6662F + (float)Math.PI) * 1.4F * var2; + this.leg3.rotateAngleX = MathHelper.cos(var1 * 0.6662F + (float)Math.PI) * 1.4F * var2; + this.leg4.rotateAngleX = MathHelper.cos(var1 * 0.6662F) * 1.4F * var2; + } +} diff --git a/src/net/minecraft/src/ModelRenderer.java b/src/net/minecraft/src/ModelRenderer.java new file mode 100644 index 0000000..bd7849b --- /dev/null +++ b/src/net/minecraft/src/ModelRenderer.java @@ -0,0 +1,192 @@ +package net.minecraft.src; + +import org.lwjgl.opengl.GL11; + +public class ModelRenderer { + private PositionTextureVertex[] corners; + private TexturedQuad[] faces; + private int textureOffsetX; + private int textureOffsetY; + public float rotationPointX; + public float rotationPointY; + public float rotationPointZ; + public float rotateAngleX; + public float rotateAngleY; + public float rotateAngleZ; + private boolean compiled = false; + private int displayList = 0; + public boolean mirror = false; + public boolean showModel = true; + public boolean field_1402_i = false; + + public ModelRenderer(int var1, int var2) { + this.textureOffsetX = var1; + this.textureOffsetY = var2; + } + + public void addBox(float var1, float var2, float var3, int var4, int var5, int var6) { + this.addBox(var1, var2, var3, var4, var5, var6, 0.0F); + } + + public void addBox(float var1, float var2, float var3, int var4, int var5, int var6, float var7) { + this.corners = new PositionTextureVertex[8]; + this.faces = new TexturedQuad[6]; + float var8 = var1 + (float)var4; + float var9 = var2 + (float)var5; + float var10 = var3 + (float)var6; + var1 -= var7; + var2 -= var7; + var3 -= var7; + var8 += var7; + var9 += var7; + var10 += var7; + if(this.mirror) { + float var11 = var8; + var8 = var1; + var1 = var11; + } + + PositionTextureVertex var20 = new PositionTextureVertex(var1, var2, var3, 0.0F, 0.0F); + PositionTextureVertex var12 = new PositionTextureVertex(var8, var2, var3, 0.0F, 8.0F); + PositionTextureVertex var13 = new PositionTextureVertex(var8, var9, var3, 8.0F, 8.0F); + PositionTextureVertex var14 = new PositionTextureVertex(var1, var9, var3, 8.0F, 0.0F); + PositionTextureVertex var15 = new PositionTextureVertex(var1, var2, var10, 0.0F, 0.0F); + PositionTextureVertex var16 = new PositionTextureVertex(var8, var2, var10, 0.0F, 8.0F); + PositionTextureVertex var17 = new PositionTextureVertex(var8, var9, var10, 8.0F, 8.0F); + PositionTextureVertex var18 = new PositionTextureVertex(var1, var9, var10, 8.0F, 0.0F); + this.corners[0] = var20; + this.corners[1] = var12; + this.corners[2] = var13; + this.corners[3] = var14; + this.corners[4] = var15; + this.corners[5] = var16; + this.corners[6] = var17; + this.corners[7] = var18; + this.faces[0] = new TexturedQuad(new PositionTextureVertex[]{var16, var12, var13, var17}, this.textureOffsetX + var6 + var4, this.textureOffsetY + var6, this.textureOffsetX + var6 + var4 + var6, this.textureOffsetY + var6 + var5); + this.faces[1] = new TexturedQuad(new PositionTextureVertex[]{var20, var15, var18, var14}, this.textureOffsetX + 0, this.textureOffsetY + var6, this.textureOffsetX + var6, this.textureOffsetY + var6 + var5); + this.faces[2] = new TexturedQuad(new PositionTextureVertex[]{var16, var15, var20, var12}, this.textureOffsetX + var6, this.textureOffsetY + 0, this.textureOffsetX + var6 + var4, this.textureOffsetY + var6); + this.faces[3] = new TexturedQuad(new PositionTextureVertex[]{var13, var14, var18, var17}, this.textureOffsetX + var6 + var4, this.textureOffsetY + 0, this.textureOffsetX + var6 + var4 + var4, this.textureOffsetY + var6); + this.faces[4] = new TexturedQuad(new PositionTextureVertex[]{var12, var20, var14, var13}, this.textureOffsetX + var6, this.textureOffsetY + var6, this.textureOffsetX + var6 + var4, this.textureOffsetY + var6 + var5); + this.faces[5] = new TexturedQuad(new PositionTextureVertex[]{var15, var16, var17, var18}, this.textureOffsetX + var6 + var4 + var6, this.textureOffsetY + var6, this.textureOffsetX + var6 + var4 + var6 + var4, this.textureOffsetY + var6 + var5); + if(this.mirror) { + for(int var19 = 0; var19 < this.faces.length; ++var19) { + this.faces[var19].flipFace(); + } + } + + } + + public void setRotationPoint(float var1, float var2, float var3) { + this.rotationPointX = var1; + this.rotationPointY = var2; + this.rotationPointZ = var3; + } + + public void render(float var1) { + if(!this.field_1402_i) { + if(this.showModel) { + if(!this.compiled) { + this.compileDisplayList(var1); + } + + if(this.rotateAngleX == 0.0F && this.rotateAngleY == 0.0F && this.rotateAngleZ == 0.0F) { + if(this.rotationPointX == 0.0F && this.rotationPointY == 0.0F && this.rotationPointZ == 0.0F) { + GL11.glCallList(this.displayList); + } else { + GL11.glTranslatef(this.rotationPointX * var1, this.rotationPointY * var1, this.rotationPointZ * var1); + GL11.glCallList(this.displayList); + GL11.glTranslatef(-this.rotationPointX * var1, -this.rotationPointY * var1, -this.rotationPointZ * var1); + } + } else { + GL11.glPushMatrix(); + GL11.glTranslatef(this.rotationPointX * var1, this.rotationPointY * var1, this.rotationPointZ * var1); + if(this.rotateAngleZ != 0.0F) { + GL11.glRotatef(this.rotateAngleZ * (180.0F / (float)Math.PI), 0.0F, 0.0F, 1.0F); + } + + if(this.rotateAngleY != 0.0F) { + GL11.glRotatef(this.rotateAngleY * (180.0F / (float)Math.PI), 0.0F, 1.0F, 0.0F); + } + + if(this.rotateAngleX != 0.0F) { + GL11.glRotatef(this.rotateAngleX * (180.0F / (float)Math.PI), 1.0F, 0.0F, 0.0F); + } + + GL11.glCallList(this.displayList); + GL11.glPopMatrix(); + } + + } + } + } + + public void renderWithRotation(float var1) { + if(!this.field_1402_i) { + if(this.showModel) { + if(!this.compiled) { + this.compileDisplayList(var1); + } + + GL11.glPushMatrix(); + GL11.glTranslatef(this.rotationPointX * var1, this.rotationPointY * var1, this.rotationPointZ * var1); + if(this.rotateAngleY != 0.0F) { + GL11.glRotatef(this.rotateAngleY * (180.0F / (float)Math.PI), 0.0F, 1.0F, 0.0F); + } + + if(this.rotateAngleX != 0.0F) { + GL11.glRotatef(this.rotateAngleX * (180.0F / (float)Math.PI), 1.0F, 0.0F, 0.0F); + } + + if(this.rotateAngleZ != 0.0F) { + GL11.glRotatef(this.rotateAngleZ * (180.0F / (float)Math.PI), 0.0F, 0.0F, 1.0F); + } + + GL11.glCallList(this.displayList); + GL11.glPopMatrix(); + } + } + } + + public void postRender(float var1) { + if(!this.field_1402_i) { + if(this.showModel) { + if(!this.compiled) { + this.compileDisplayList(var1); + } + + if(this.rotateAngleX == 0.0F && this.rotateAngleY == 0.0F && this.rotateAngleZ == 0.0F) { + if(this.rotationPointX != 0.0F || this.rotationPointY != 0.0F || this.rotationPointZ != 0.0F) { + GL11.glTranslatef(this.rotationPointX * var1, this.rotationPointY * var1, this.rotationPointZ * var1); + } + } else { + GL11.glTranslatef(this.rotationPointX * var1, this.rotationPointY * var1, this.rotationPointZ * var1); + if(this.rotateAngleZ != 0.0F) { + GL11.glRotatef(this.rotateAngleZ * (180.0F / (float)Math.PI), 0.0F, 0.0F, 1.0F); + } + + if(this.rotateAngleY != 0.0F) { + GL11.glRotatef(this.rotateAngleY * (180.0F / (float)Math.PI), 0.0F, 1.0F, 0.0F); + } + + if(this.rotateAngleX != 0.0F) { + GL11.glRotatef(this.rotateAngleX * (180.0F / (float)Math.PI), 1.0F, 0.0F, 0.0F); + } + } + + } + } + } + + private void compileDisplayList(float var1) { + this.displayList = GLAllocation.generateDisplayLists(1); + GL11.glNewList(this.displayList, GL11.GL_COMPILE); + Tessellator var2 = Tessellator.instance; + + for(int var3 = 0; var3 < this.faces.length; ++var3) { + this.faces[var3].draw(var2, var1); + } + + GL11.glEndList(); + this.compiled = true; + } +} diff --git a/src/net/minecraft/src/ModelSheep1.java b/src/net/minecraft/src/ModelSheep1.java new file mode 100644 index 0000000..150c3e0 --- /dev/null +++ b/src/net/minecraft/src/ModelSheep1.java @@ -0,0 +1,26 @@ +package net.minecraft.src; + +public class ModelSheep1 extends ModelQuadruped { + public ModelSheep1() { + super(12, 0.0F); + this.head = new ModelRenderer(0, 0); + this.head.addBox(-3.0F, -4.0F, -4.0F, 6, 6, 6, 0.6F); + this.head.setRotationPoint(0.0F, 6.0F, -8.0F); + this.body = new ModelRenderer(28, 8); + this.body.addBox(-4.0F, -10.0F, -7.0F, 8, 16, 6, 1.75F); + this.body.setRotationPoint(0.0F, 5.0F, 2.0F); + float var1 = 0.5F; + this.leg1 = new ModelRenderer(0, 16); + this.leg1.addBox(-2.0F, 0.0F, -2.0F, 4, 6, 4, var1); + this.leg1.setRotationPoint(-3.0F, 12.0F, 7.0F); + this.leg2 = new ModelRenderer(0, 16); + this.leg2.addBox(-2.0F, 0.0F, -2.0F, 4, 6, 4, var1); + this.leg2.setRotationPoint(3.0F, 12.0F, 7.0F); + this.leg3 = new ModelRenderer(0, 16); + this.leg3.addBox(-2.0F, 0.0F, -2.0F, 4, 6, 4, var1); + this.leg3.setRotationPoint(-3.0F, 12.0F, -5.0F); + this.leg4 = new ModelRenderer(0, 16); + this.leg4.addBox(-2.0F, 0.0F, -2.0F, 4, 6, 4, var1); + this.leg4.setRotationPoint(3.0F, 12.0F, -5.0F); + } +} diff --git a/src/net/minecraft/src/ModelSheep2.java b/src/net/minecraft/src/ModelSheep2.java new file mode 100644 index 0000000..db5bbc9 --- /dev/null +++ b/src/net/minecraft/src/ModelSheep2.java @@ -0,0 +1,13 @@ +package net.minecraft.src; + +public class ModelSheep2 extends ModelQuadruped { + public ModelSheep2() { + super(12, 0.0F); + this.head = new ModelRenderer(0, 0); + this.head.addBox(-3.0F, -4.0F, -6.0F, 6, 6, 8, 0.0F); + this.head.setRotationPoint(0.0F, 6.0F, -8.0F); + this.body = new ModelRenderer(28, 8); + this.body.addBox(-4.0F, -10.0F, -7.0F, 8, 16, 6, 0.0F); + this.body.setRotationPoint(0.0F, 5.0F, 2.0F); + } +} diff --git a/src/net/minecraft/src/ModelSkeleton.java b/src/net/minecraft/src/ModelSkeleton.java new file mode 100644 index 0000000..9e50d21 --- /dev/null +++ b/src/net/minecraft/src/ModelSkeleton.java @@ -0,0 +1,21 @@ +package net.minecraft.src; + +public class ModelSkeleton extends ModelZombie { + public ModelSkeleton() { + float var1 = 0.0F; + this.bipedRightArm = new ModelRenderer(40, 16); + this.bipedRightArm.addBox(-1.0F, -2.0F, -1.0F, 2, 12, 2, var1); + this.bipedRightArm.setRotationPoint(-5.0F, 2.0F, 0.0F); + this.bipedLeftArm = new ModelRenderer(40, 16); + this.bipedLeftArm.mirror = true; + this.bipedLeftArm.addBox(-1.0F, -2.0F, -1.0F, 2, 12, 2, var1); + this.bipedLeftArm.setRotationPoint(5.0F, 2.0F, 0.0F); + this.bipedRightLeg = new ModelRenderer(0, 16); + this.bipedRightLeg.addBox(-1.0F, 0.0F, -1.0F, 2, 12, 2, var1); + this.bipedRightLeg.setRotationPoint(-2.0F, 12.0F, 0.0F); + this.bipedLeftLeg = new ModelRenderer(0, 16); + this.bipedLeftLeg.mirror = true; + this.bipedLeftLeg.addBox(-1.0F, 0.0F, -1.0F, 2, 12, 2, var1); + this.bipedLeftLeg.setRotationPoint(2.0F, 12.0F, 0.0F); + } +} diff --git a/src/net/minecraft/src/ModelSlime.java b/src/net/minecraft/src/ModelSlime.java new file mode 100644 index 0000000..c548557 --- /dev/null +++ b/src/net/minecraft/src/ModelSlime.java @@ -0,0 +1,38 @@ +package net.minecraft.src; + +public class ModelSlime extends ModelBase { + ModelRenderer slimeBodies; + ModelRenderer slimeRightEye; + ModelRenderer slimeLeftEye; + ModelRenderer slimeMouth; + + public ModelSlime(int var1) { + this.slimeBodies = new ModelRenderer(0, var1); + this.slimeBodies.addBox(-4.0F, 16.0F, -4.0F, 8, 8, 8); + if(var1 > 0) { + this.slimeBodies = new ModelRenderer(0, var1); + this.slimeBodies.addBox(-3.0F, 17.0F, -3.0F, 6, 6, 6); + this.slimeRightEye = new ModelRenderer(32, 0); + this.slimeRightEye.addBox(-3.25F, 18.0F, -3.5F, 2, 2, 2); + this.slimeLeftEye = new ModelRenderer(32, 4); + this.slimeLeftEye.addBox(1.25F, 18.0F, -3.5F, 2, 2, 2); + this.slimeMouth = new ModelRenderer(32, 8); + this.slimeMouth.addBox(0.0F, 21.0F, -3.5F, 1, 1, 1); + } + + } + + public void setRotationAngles(float var1, float var2, float var3, float var4, float var5, float var6) { + } + + public void render(float var1, float var2, float var3, float var4, float var5, float var6) { + this.setRotationAngles(var1, var2, var3, var4, var5, var6); + this.slimeBodies.render(var6); + if(this.slimeRightEye != null) { + this.slimeRightEye.render(var6); + this.slimeLeftEye.render(var6); + this.slimeMouth.render(var6); + } + + } +} diff --git a/src/net/minecraft/src/ModelSpider.java b/src/net/minecraft/src/ModelSpider.java new file mode 100644 index 0000000..6fe8988 --- /dev/null +++ b/src/net/minecraft/src/ModelSpider.java @@ -0,0 +1,116 @@ +package net.minecraft.src; + +public class ModelSpider extends ModelBase { + public ModelRenderer spiderHead; + public ModelRenderer spiderNeck; + public ModelRenderer spiderBody; + public ModelRenderer spiderLeg1; + public ModelRenderer spiderLeg2; + public ModelRenderer spiderLeg3; + public ModelRenderer spiderLeg4; + public ModelRenderer spiderLeg5; + public ModelRenderer spiderLeg6; + public ModelRenderer spiderLeg7; + public ModelRenderer spiderLeg8; + + public ModelSpider() { + float var1 = 0.0F; + byte var2 = 15; + this.spiderHead = new ModelRenderer(32, 4); + this.spiderHead.addBox(-4.0F, -4.0F, -8.0F, 8, 8, 8, var1); + this.spiderHead.setRotationPoint(0.0F, (float)(0 + var2), -3.0F); + this.spiderNeck = new ModelRenderer(0, 0); + this.spiderNeck.addBox(-3.0F, -3.0F, -3.0F, 6, 6, 6, var1); + this.spiderNeck.setRotationPoint(0.0F, (float)var2, 0.0F); + this.spiderBody = new ModelRenderer(0, 12); + this.spiderBody.addBox(-5.0F, -4.0F, -6.0F, 10, 8, 12, var1); + this.spiderBody.setRotationPoint(0.0F, (float)(0 + var2), 9.0F); + this.spiderLeg1 = new ModelRenderer(18, 0); + this.spiderLeg1.addBox(-15.0F, -1.0F, -1.0F, 16, 2, 2, var1); + this.spiderLeg1.setRotationPoint(-4.0F, (float)(0 + var2), 2.0F); + this.spiderLeg2 = new ModelRenderer(18, 0); + this.spiderLeg2.addBox(-1.0F, -1.0F, -1.0F, 16, 2, 2, var1); + this.spiderLeg2.setRotationPoint(4.0F, (float)(0 + var2), 2.0F); + this.spiderLeg3 = new ModelRenderer(18, 0); + this.spiderLeg3.addBox(-15.0F, -1.0F, -1.0F, 16, 2, 2, var1); + this.spiderLeg3.setRotationPoint(-4.0F, (float)(0 + var2), 1.0F); + this.spiderLeg4 = new ModelRenderer(18, 0); + this.spiderLeg4.addBox(-1.0F, -1.0F, -1.0F, 16, 2, 2, var1); + this.spiderLeg4.setRotationPoint(4.0F, (float)(0 + var2), 1.0F); + this.spiderLeg5 = new ModelRenderer(18, 0); + this.spiderLeg5.addBox(-15.0F, -1.0F, -1.0F, 16, 2, 2, var1); + this.spiderLeg5.setRotationPoint(-4.0F, (float)(0 + var2), 0.0F); + this.spiderLeg6 = new ModelRenderer(18, 0); + this.spiderLeg6.addBox(-1.0F, -1.0F, -1.0F, 16, 2, 2, var1); + this.spiderLeg6.setRotationPoint(4.0F, (float)(0 + var2), 0.0F); + this.spiderLeg7 = new ModelRenderer(18, 0); + this.spiderLeg7.addBox(-15.0F, -1.0F, -1.0F, 16, 2, 2, var1); + this.spiderLeg7.setRotationPoint(-4.0F, (float)(0 + var2), -1.0F); + this.spiderLeg8 = new ModelRenderer(18, 0); + this.spiderLeg8.addBox(-1.0F, -1.0F, -1.0F, 16, 2, 2, var1); + this.spiderLeg8.setRotationPoint(4.0F, (float)(0 + var2), -1.0F); + } + + public void render(float var1, float var2, float var3, float var4, float var5, float var6) { + this.setRotationAngles(var1, var2, var3, var4, var5, var6); + this.spiderHead.render(var6); + this.spiderNeck.render(var6); + this.spiderBody.render(var6); + this.spiderLeg1.render(var6); + this.spiderLeg2.render(var6); + this.spiderLeg3.render(var6); + this.spiderLeg4.render(var6); + this.spiderLeg5.render(var6); + this.spiderLeg6.render(var6); + this.spiderLeg7.render(var6); + this.spiderLeg8.render(var6); + } + + public void setRotationAngles(float var1, float var2, float var3, float var4, float var5, float var6) { + this.spiderHead.rotateAngleY = var4 / (180.0F / (float)Math.PI); + this.spiderHead.rotateAngleX = var5 / (180.0F / (float)Math.PI); + float var7 = (float)Math.PI * 0.25F; + this.spiderLeg1.rotateAngleZ = -var7; + this.spiderLeg2.rotateAngleZ = var7; + this.spiderLeg3.rotateAngleZ = -var7 * 0.74F; + this.spiderLeg4.rotateAngleZ = var7 * 0.74F; + this.spiderLeg5.rotateAngleZ = -var7 * 0.74F; + this.spiderLeg6.rotateAngleZ = var7 * 0.74F; + this.spiderLeg7.rotateAngleZ = -var7; + this.spiderLeg8.rotateAngleZ = var7; + float var8 = -0.0F; + float var9 = (float)Math.PI * 0.125F; + this.spiderLeg1.rotateAngleY = var9 * 2.0F + var8; + this.spiderLeg2.rotateAngleY = -var9 * 2.0F - var8; + this.spiderLeg3.rotateAngleY = var9 * 1.0F + var8; + this.spiderLeg4.rotateAngleY = -var9 * 1.0F - var8; + this.spiderLeg5.rotateAngleY = -var9 * 1.0F + var8; + this.spiderLeg6.rotateAngleY = var9 * 1.0F - var8; + this.spiderLeg7.rotateAngleY = -var9 * 2.0F + var8; + this.spiderLeg8.rotateAngleY = var9 * 2.0F - var8; + float var10 = -(MathHelper.cos(var1 * 0.6662F * 2.0F + 0.0F) * 0.4F) * var2; + float var11 = -(MathHelper.cos(var1 * 0.6662F * 2.0F + (float)Math.PI) * 0.4F) * var2; + float var12 = -(MathHelper.cos(var1 * 0.6662F * 2.0F + (float)Math.PI * 0.5F) * 0.4F) * var2; + float var13 = -(MathHelper.cos(var1 * 0.6662F * 2.0F + (float)Math.PI * 3.0F / 2.0F) * 0.4F) * var2; + float var14 = Math.abs(MathHelper.sin(var1 * 0.6662F + 0.0F) * 0.4F) * var2; + float var15 = Math.abs(MathHelper.sin(var1 * 0.6662F + (float)Math.PI) * 0.4F) * var2; + float var16 = Math.abs(MathHelper.sin(var1 * 0.6662F + (float)Math.PI * 0.5F) * 0.4F) * var2; + float var17 = Math.abs(MathHelper.sin(var1 * 0.6662F + (float)Math.PI * 3.0F / 2.0F) * 0.4F) * var2; + this.spiderLeg1.rotateAngleY += var10; + this.spiderLeg2.rotateAngleY += -var10; + this.spiderLeg3.rotateAngleY += var11; + this.spiderLeg4.rotateAngleY += -var11; + this.spiderLeg5.rotateAngleY += var12; + this.spiderLeg6.rotateAngleY += -var12; + this.spiderLeg7.rotateAngleY += var13; + this.spiderLeg8.rotateAngleY += -var13; + this.spiderLeg1.rotateAngleZ += var14; + this.spiderLeg2.rotateAngleZ += -var14; + this.spiderLeg3.rotateAngleZ += var15; + this.spiderLeg4.rotateAngleZ += -var15; + this.spiderLeg5.rotateAngleZ += var16; + this.spiderLeg6.rotateAngleZ += -var16; + this.spiderLeg7.rotateAngleZ += var17; + this.spiderLeg8.rotateAngleZ += -var17; + } +} diff --git a/src/net/minecraft/src/ModelSquid.java b/src/net/minecraft/src/ModelSquid.java new file mode 100644 index 0000000..c4cd0a4 --- /dev/null +++ b/src/net/minecraft/src/ModelSquid.java @@ -0,0 +1,44 @@ +package net.minecraft.src; + +public class ModelSquid extends ModelBase { + ModelRenderer squidBody; + ModelRenderer[] squidTentacles = new ModelRenderer[8]; + + public ModelSquid() { + byte var1 = -16; + this.squidBody = new ModelRenderer(0, 0); + this.squidBody.addBox(-6.0F, -8.0F, -6.0F, 12, 16, 12); + this.squidBody.rotationPointY += (float)(24 + var1); + + for(int var2 = 0; var2 < this.squidTentacles.length; ++var2) { + this.squidTentacles[var2] = new ModelRenderer(48, 0); + double var3 = (double)var2 * Math.PI * 2.0D / (double)this.squidTentacles.length; + float var5 = (float)Math.cos(var3) * 5.0F; + float var6 = (float)Math.sin(var3) * 5.0F; + this.squidTentacles[var2].addBox(-1.0F, 0.0F, -1.0F, 2, 18, 2); + this.squidTentacles[var2].rotationPointX = var5; + this.squidTentacles[var2].rotationPointZ = var6; + this.squidTentacles[var2].rotationPointY = (float)(31 + var1); + var3 = (double)var2 * Math.PI * -2.0D / (double)this.squidTentacles.length + Math.PI * 0.5D; + this.squidTentacles[var2].rotateAngleY = (float)var3; + } + + } + + public void setRotationAngles(float var1, float var2, float var3, float var4, float var5, float var6) { + for(int var7 = 0; var7 < this.squidTentacles.length; ++var7) { + this.squidTentacles[var7].rotateAngleX = var3; + } + + } + + public void render(float var1, float var2, float var3, float var4, float var5, float var6) { + this.setRotationAngles(var1, var2, var3, var4, var5, var6); + this.squidBody.render(var6); + + for(int var7 = 0; var7 < this.squidTentacles.length; ++var7) { + this.squidTentacles[var7].render(var6); + } + + } +} diff --git a/src/net/minecraft/src/ModelWolf.java b/src/net/minecraft/src/ModelWolf.java new file mode 100644 index 0000000..75ebc71 --- /dev/null +++ b/src/net/minecraft/src/ModelWolf.java @@ -0,0 +1,138 @@ +package net.minecraft.src; + +import org.lwjgl.opengl.GL11; + +public class ModelWolf extends ModelBase { + public ModelRenderer wolfHeadMain; + public ModelRenderer wolfBody; + public ModelRenderer wolfLeg1; + public ModelRenderer wolfLeg2; + public ModelRenderer wolfLeg3; + public ModelRenderer wolfLeg4; + ModelRenderer wolfRightEar; + ModelRenderer wolfLeftEar; + ModelRenderer wolfSnout; + ModelRenderer wolfTail; + ModelRenderer wolfMane; + + public ModelWolf() { + float var1 = 0.0F; + float var2 = 13.5F; + this.wolfHeadMain = new ModelRenderer(0, 0); + this.wolfHeadMain.addBox(-3.0F, -3.0F, -2.0F, 6, 6, 4, var1); + this.wolfHeadMain.setRotationPoint(-1.0F, var2, -7.0F); + this.wolfBody = new ModelRenderer(18, 14); + this.wolfBody.addBox(-4.0F, -2.0F, -3.0F, 6, 9, 6, var1); + this.wolfBody.setRotationPoint(0.0F, 14.0F, 2.0F); + this.wolfMane = new ModelRenderer(21, 0); + this.wolfMane.addBox(-4.0F, -3.0F, -3.0F, 8, 6, 7, var1); + this.wolfMane.setRotationPoint(-1.0F, 14.0F, 2.0F); + this.wolfLeg1 = new ModelRenderer(0, 18); + this.wolfLeg1.addBox(-1.0F, 0.0F, -1.0F, 2, 8, 2, var1); + this.wolfLeg1.setRotationPoint(-2.5F, 16.0F, 7.0F); + this.wolfLeg2 = new ModelRenderer(0, 18); + this.wolfLeg2.addBox(-1.0F, 0.0F, -1.0F, 2, 8, 2, var1); + this.wolfLeg2.setRotationPoint(0.5F, 16.0F, 7.0F); + this.wolfLeg3 = new ModelRenderer(0, 18); + this.wolfLeg3.addBox(-1.0F, 0.0F, -1.0F, 2, 8, 2, var1); + this.wolfLeg3.setRotationPoint(-2.5F, 16.0F, -4.0F); + this.wolfLeg4 = new ModelRenderer(0, 18); + this.wolfLeg4.addBox(-1.0F, 0.0F, -1.0F, 2, 8, 2, var1); + this.wolfLeg4.setRotationPoint(0.5F, 16.0F, -4.0F); + this.wolfTail = new ModelRenderer(9, 18); + this.wolfTail.addBox(-1.0F, 0.0F, -1.0F, 2, 8, 2, var1); + this.wolfTail.setRotationPoint(-1.0F, 12.0F, 8.0F); + this.wolfRightEar = new ModelRenderer(16, 14); + this.wolfRightEar.addBox(-3.0F, -5.0F, 0.0F, 2, 2, 1, var1); + this.wolfRightEar.setRotationPoint(-1.0F, var2, -7.0F); + this.wolfLeftEar = new ModelRenderer(16, 14); + this.wolfLeftEar.addBox(1.0F, -5.0F, 0.0F, 2, 2, 1, var1); + this.wolfLeftEar.setRotationPoint(-1.0F, var2, -7.0F); + this.wolfSnout = new ModelRenderer(0, 10); + this.wolfSnout.addBox(-2.0F, 0.0F, -5.0F, 3, 3, 4, var1); + this.wolfSnout.setRotationPoint(-0.5F, var2, -7.0F); + } + + public void render(float var1, float var2, float var3, float var4, float var5, float var6) { + super.render(var1, var2, var3, var4, var5, var6); + this.setRotationAngles(var1, var2, var3, var4, var5, var6); + this.wolfHeadMain.renderWithRotation(var6); + this.wolfBody.render(var6); + this.wolfLeg1.render(var6); + this.wolfLeg2.render(var6); + this.wolfLeg3.render(var6); + this.wolfLeg4.render(var6); + this.wolfRightEar.renderWithRotation(var6); + this.wolfLeftEar.renderWithRotation(var6); + this.wolfSnout.renderWithRotation(var6); + this.wolfTail.renderWithRotation(var6); + this.wolfMane.render(var6); + } + + public void setLivingAnimations(EntityLiving var1, float var2, float var3, float var4) { + EntityWolf var5 = (EntityWolf)var1; + if(var5.isWolfAngry()) { + this.wolfTail.rotateAngleY = 0.0F; + } else { + this.wolfTail.rotateAngleY = MathHelper.cos(var2 * 0.6662F) * 1.4F * var3; + } + + if(var5.isWolfSitting()) { + this.wolfMane.setRotationPoint(-1.0F, 16.0F, -3.0F); + this.wolfMane.rotateAngleX = (float)Math.PI * 0.4F; + this.wolfMane.rotateAngleY = 0.0F; + this.wolfBody.setRotationPoint(0.0F, 18.0F, 0.0F); + this.wolfBody.rotateAngleX = (float)Math.PI * 0.25F; + this.wolfTail.setRotationPoint(-1.0F, 21.0F, 6.0F); + this.wolfLeg1.setRotationPoint(-2.5F, 22.0F, 2.0F); + this.wolfLeg1.rotateAngleX = (float)Math.PI * 3.0F / 2.0F; + this.wolfLeg2.setRotationPoint(0.5F, 22.0F, 2.0F); + this.wolfLeg2.rotateAngleX = (float)Math.PI * 3.0F / 2.0F; + this.wolfLeg3.rotateAngleX = (float)Math.PI * 1.85F; + this.wolfLeg3.setRotationPoint(-2.49F, 17.0F, -4.0F); + this.wolfLeg4.rotateAngleX = (float)Math.PI * 1.85F; + this.wolfLeg4.setRotationPoint(0.51F, 17.0F, -4.0F); + } else { + this.wolfBody.setRotationPoint(0.0F, 14.0F, 2.0F); + this.wolfBody.rotateAngleX = (float)Math.PI * 0.5F; + this.wolfMane.setRotationPoint(-1.0F, 14.0F, -3.0F); + this.wolfMane.rotateAngleX = this.wolfBody.rotateAngleX; + this.wolfTail.setRotationPoint(-1.0F, 12.0F, 8.0F); + this.wolfLeg1.setRotationPoint(-2.5F, 16.0F, 7.0F); + this.wolfLeg2.setRotationPoint(0.5F, 16.0F, 7.0F); + this.wolfLeg3.setRotationPoint(-2.5F, 16.0F, -4.0F); + this.wolfLeg4.setRotationPoint(0.5F, 16.0F, -4.0F); + this.wolfLeg1.rotateAngleX = MathHelper.cos(var2 * 0.6662F) * 1.4F * var3; + this.wolfLeg2.rotateAngleX = MathHelper.cos(var2 * 0.6662F + (float)Math.PI) * 1.4F * var3; + this.wolfLeg3.rotateAngleX = MathHelper.cos(var2 * 0.6662F + (float)Math.PI) * 1.4F * var3; + this.wolfLeg4.rotateAngleX = MathHelper.cos(var2 * 0.6662F) * 1.4F * var3; + } + + float var6 = var5.getInterestedAngle(var4) + var5.getShakeAngle(var4, 0.0F); + this.wolfHeadMain.rotateAngleZ = var6; + this.wolfRightEar.rotateAngleZ = var6; + this.wolfLeftEar.rotateAngleZ = var6; + this.wolfSnout.rotateAngleZ = var6; + this.wolfMane.rotateAngleZ = var5.getShakeAngle(var4, -0.08F); + this.wolfBody.rotateAngleZ = var5.getShakeAngle(var4, -0.16F); + this.wolfTail.rotateAngleZ = var5.getShakeAngle(var4, -0.2F); + if(var5.getWolfShaking()) { + float var7 = var5.getEntityBrightness(var4) * var5.getShadingWhileShaking(var4); + GL11.glColor3f(var7, var7, var7); + } + + } + + public void setRotationAngles(float var1, float var2, float var3, float var4, float var5, float var6) { + super.setRotationAngles(var1, var2, var3, var4, var5, var6); + this.wolfHeadMain.rotateAngleX = var5 / (180.0F / (float)Math.PI); + this.wolfHeadMain.rotateAngleY = var4 / (180.0F / (float)Math.PI); + this.wolfRightEar.rotateAngleY = this.wolfHeadMain.rotateAngleY; + this.wolfRightEar.rotateAngleX = this.wolfHeadMain.rotateAngleX; + this.wolfLeftEar.rotateAngleY = this.wolfHeadMain.rotateAngleY; + this.wolfLeftEar.rotateAngleX = this.wolfHeadMain.rotateAngleX; + this.wolfSnout.rotateAngleY = this.wolfHeadMain.rotateAngleY; + this.wolfSnout.rotateAngleX = this.wolfHeadMain.rotateAngleX; + this.wolfTail.rotateAngleX = var3; + } +} diff --git a/src/net/minecraft/src/ModelZombie.java b/src/net/minecraft/src/ModelZombie.java new file mode 100644 index 0000000..6114f0b --- /dev/null +++ b/src/net/minecraft/src/ModelZombie.java @@ -0,0 +1,21 @@ +package net.minecraft.src; + +public class ModelZombie extends ModelBiped { + public void setRotationAngles(float var1, float var2, float var3, float var4, float var5, float var6) { + super.setRotationAngles(var1, var2, var3, var4, var5, var6); + float var7 = MathHelper.sin(this.onGround * (float)Math.PI); + float var8 = MathHelper.sin((1.0F - (1.0F - this.onGround) * (1.0F - this.onGround)) * (float)Math.PI); + this.bipedRightArm.rotateAngleZ = 0.0F; + this.bipedLeftArm.rotateAngleZ = 0.0F; + this.bipedRightArm.rotateAngleY = -(0.1F - var7 * 0.6F); + this.bipedLeftArm.rotateAngleY = 0.1F - var7 * 0.6F; + this.bipedRightArm.rotateAngleX = (float)Math.PI * -0.5F; + this.bipedLeftArm.rotateAngleX = (float)Math.PI * -0.5F; + this.bipedRightArm.rotateAngleX -= var7 * 1.2F - var8 * 0.4F; + this.bipedLeftArm.rotateAngleX -= var7 * 1.2F - var8 * 0.4F; + this.bipedRightArm.rotateAngleZ += MathHelper.cos(var3 * 0.09F) * 0.05F + 0.05F; + this.bipedLeftArm.rotateAngleZ -= MathHelper.cos(var3 * 0.09F) * 0.05F + 0.05F; + this.bipedRightArm.rotateAngleX += MathHelper.sin(var3 * 0.067F) * 0.05F; + this.bipedLeftArm.rotateAngleX -= MathHelper.sin(var3 * 0.067F) * 0.05F; + } +} diff --git a/src/net/minecraft/src/MouseFilter.java b/src/net/minecraft/src/MouseFilter.java new file mode 100644 index 0000000..e416227 --- /dev/null +++ b/src/net/minecraft/src/MouseFilter.java @@ -0,0 +1,19 @@ +package net.minecraft.src; + +public class MouseFilter { + private float field_22388_a; + private float field_22387_b; + private float field_22389_c; + + public float func_22386_a(float var1, float var2) { + this.field_22388_a += var1; + var1 = (this.field_22388_a - this.field_22387_b) * var2; + this.field_22389_c += (var1 - this.field_22389_c) * 0.5F; + if(var1 > 0.0F && var1 > this.field_22389_c || var1 < 0.0F && var1 < this.field_22389_c) { + var1 = this.field_22389_c; + } + + this.field_22387_b += var1; + return var1; + } +} diff --git a/src/net/minecraft/src/MouseHelper.java b/src/net/minecraft/src/MouseHelper.java new file mode 100644 index 0000000..2bd44d8 --- /dev/null +++ b/src/net/minecraft/src/MouseHelper.java @@ -0,0 +1,46 @@ +package net.minecraft.src; + +import java.awt.Component; +import java.nio.IntBuffer; +import org.lwjgl.LWJGLException; +import org.lwjgl.input.Cursor; +import org.lwjgl.input.Mouse; + +public class MouseHelper { + private Component field_1117_c; + private Cursor cursor; + public int deltaX; + public int deltaY; + private int field_1115_e = 10; + + public MouseHelper(Component var1) { + this.field_1117_c = var1; + IntBuffer var2 = GLAllocation.createDirectIntBuffer(1); + var2.put(0); + var2.flip(); + IntBuffer var3 = GLAllocation.createDirectIntBuffer(1024); + + try { + this.cursor = new Cursor(32, 32, 16, 16, 1, var3, var2); + } catch (LWJGLException var5) { + var5.printStackTrace(); + } + + } + + public void grabMouseCursor() { + Mouse.setGrabbed(true); + this.deltaX = 0; + this.deltaY = 0; + } + + public void ungrabMouseCursor() { + Mouse.setCursorPosition(this.field_1117_c.getWidth() / 2, this.field_1117_c.getHeight() / 2); + Mouse.setGrabbed(false); + } + + public void mouseXYChange() { + this.deltaX = Mouse.getDX(); + this.deltaY = Mouse.getDY(); + } +} diff --git a/src/net/minecraft/src/MovementInput.java b/src/net/minecraft/src/MovementInput.java new file mode 100644 index 0000000..f656918 --- /dev/null +++ b/src/net/minecraft/src/MovementInput.java @@ -0,0 +1,18 @@ +package net.minecraft.src; + +public class MovementInput { + public float moveStrafe = 0.0F; + public float moveForward = 0.0F; + public boolean field_1177_c = false; + public boolean jump = false; + public boolean sneak = false; + + public void updatePlayerMoveState(EntityPlayer var1) { + } + + public void resetKeyState() { + } + + public void checkKeyForMovementInput(int var1, boolean var2) { + } +} diff --git a/src/net/minecraft/src/MovementInputFromOptions.java b/src/net/minecraft/src/MovementInputFromOptions.java new file mode 100644 index 0000000..91ca4c1 --- /dev/null +++ b/src/net/minecraft/src/MovementInputFromOptions.java @@ -0,0 +1,77 @@ +package net.minecraft.src; + +public class MovementInputFromOptions extends MovementInput { + private boolean[] movementKeyStates = new boolean[10]; + private GameSettings gameSettings; + + public MovementInputFromOptions(GameSettings var1) { + this.gameSettings = var1; + } + + public void checkKeyForMovementInput(int var1, boolean var2) { + byte var3 = -1; + if(var1 == this.gameSettings.keyBindForward.keyCode) { + var3 = 0; + } + + if(var1 == this.gameSettings.keyBindBack.keyCode) { + var3 = 1; + } + + if(var1 == this.gameSettings.keyBindLeft.keyCode) { + var3 = 2; + } + + if(var1 == this.gameSettings.keyBindRight.keyCode) { + var3 = 3; + } + + if(var1 == this.gameSettings.keyBindJump.keyCode) { + var3 = 4; + } + + if(var1 == this.gameSettings.keyBindSneak.keyCode) { + var3 = 5; + } + + if(var3 >= 0) { + this.movementKeyStates[var3] = var2; + } + + } + + public void resetKeyState() { + for(int var1 = 0; var1 < 10; ++var1) { + this.movementKeyStates[var1] = false; + } + + } + + public void updatePlayerMoveState(EntityPlayer var1) { + this.moveStrafe = 0.0F; + this.moveForward = 0.0F; + if(this.movementKeyStates[0]) { + ++this.moveForward; + } + + if(this.movementKeyStates[1]) { + --this.moveForward; + } + + if(this.movementKeyStates[2]) { + ++this.moveStrafe; + } + + if(this.movementKeyStates[3]) { + --this.moveStrafe; + } + + this.jump = this.movementKeyStates[4]; + this.sneak = this.movementKeyStates[5]; + if(this.sneak) { + this.moveStrafe = (float)((double)this.moveStrafe * 0.3D); + this.moveForward = (float)((double)this.moveForward * 0.3D); + } + + } +} diff --git a/src/net/minecraft/src/MovingObjectPosition.java b/src/net/minecraft/src/MovingObjectPosition.java new file mode 100644 index 0000000..e6b8c4a --- /dev/null +++ b/src/net/minecraft/src/MovingObjectPosition.java @@ -0,0 +1,26 @@ +package net.minecraft.src; + +public class MovingObjectPosition { + public EnumMovingObjectType typeOfHit; + public int blockX; + public int blockY; + public int blockZ; + public int sideHit; + public Vec3D hitVec; + public Entity entityHit; + + public MovingObjectPosition(int var1, int var2, int var3, int var4, Vec3D var5) { + this.typeOfHit = EnumMovingObjectType.TILE; + this.blockX = var1; + this.blockY = var2; + this.blockZ = var3; + this.sideHit = var4; + this.hitVec = Vec3D.createVector(var5.xCoord, var5.yCoord, var5.zCoord); + } + + public MovingObjectPosition(Entity var1) { + this.typeOfHit = EnumMovingObjectType.ENTITY; + this.entityHit = var1; + this.hitVec = Vec3D.createVector(var1.posX, var1.posY, var1.posZ); + } +} diff --git a/src/net/minecraft/src/MusInputStream.java b/src/net/minecraft/src/MusInputStream.java new file mode 100644 index 0000000..e563d4a --- /dev/null +++ b/src/net/minecraft/src/MusInputStream.java @@ -0,0 +1,37 @@ +package net.minecraft.src; + +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; + +class MusInputStream extends InputStream { + private int hash; + private InputStream inputStream; + byte[] buffer; + final CodecMus codec; + + public MusInputStream(CodecMus var1, URL var2, InputStream var3) { + this.codec = var1; + this.buffer = new byte[1]; + this.inputStream = var3; + String var4 = var2.getPath(); + var4 = var4.substring(var4.lastIndexOf("/") + 1); + this.hash = var4.hashCode(); + } + + public int read() throws IOException { + int var1 = this.read(this.buffer, 0, 1); + return var1 < 0 ? var1 : this.buffer[0]; + } + + public int read(byte[] var1, int var2, int var3) throws IOException { + var3 = this.inputStream.read(var1, var2, var3); + + for(int var4 = 0; var4 < var3; ++var4) { + byte var5 = var1[var2 + var4] = (byte)(var1[var2 + var4] ^ this.hash >> 8); + this.hash = this.hash * 498729871 + 85731 * var5; + } + + return var3; + } +} diff --git a/src/net/minecraft/src/NBTBase.java b/src/net/minecraft/src/NBTBase.java new file mode 100644 index 0000000..cb1b73f --- /dev/null +++ b/src/net/minecraft/src/NBTBase.java @@ -0,0 +1,102 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public abstract class NBTBase { + private String key = null; + + abstract void writeTagContents(DataOutput var1) throws IOException; + + abstract void readTagContents(DataInput var1) throws IOException; + + public abstract byte getType(); + + public String getKey() { + return this.key == null ? "" : this.key; + } + + public NBTBase setKey(String var1) { + this.key = var1; + return this; + } + + public static NBTBase readTag(DataInput var0) throws IOException { + byte var1 = var0.readByte(); + if(var1 == 0) { + return new NBTTagEnd(); + } else { + NBTBase var2 = createTagOfType(var1); + var2.key = var0.readUTF(); + var2.readTagContents(var0); + return var2; + } + } + + public static void writeTag(NBTBase var0, DataOutput var1) throws IOException { + var1.writeByte(var0.getType()); + if(var0.getType() != 0) { + var1.writeUTF(var0.getKey()); + var0.writeTagContents(var1); + } + } + + public static NBTBase createTagOfType(byte var0) { + switch(var0) { + case 0: + return new NBTTagEnd(); + case 1: + return new NBTTagByte(); + case 2: + return new NBTTagShort(); + case 3: + return new NBTTagInt(); + case 4: + return new NBTTagLong(); + case 5: + return new NBTTagFloat(); + case 6: + return new NBTTagDouble(); + case 7: + return new NBTTagByteArray(); + case 8: + return new NBTTagString(); + case 9: + return new NBTTagList(); + case 10: + return new NBTTagCompound(); + default: + return null; + } + } + + public static String getTagName(byte var0) { + switch(var0) { + case 0: + return "TAG_End"; + case 1: + return "TAG_Byte"; + case 2: + return "TAG_Short"; + case 3: + return "TAG_Int"; + case 4: + return "TAG_Long"; + case 5: + return "TAG_Float"; + case 6: + return "TAG_Double"; + case 7: + return "TAG_Byte_Array"; + case 8: + return "TAG_String"; + case 9: + return "TAG_List"; + case 10: + return "TAG_Compound"; + default: + return "UNKNOWN"; + } + } +} diff --git a/src/net/minecraft/src/NBTTagByte.java b/src/net/minecraft/src/NBTTagByte.java new file mode 100644 index 0000000..092f7a3 --- /dev/null +++ b/src/net/minecraft/src/NBTTagByte.java @@ -0,0 +1,32 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class NBTTagByte extends NBTBase { + public byte byteValue; + + public NBTTagByte() { + } + + public NBTTagByte(byte var1) { + this.byteValue = var1; + } + + void writeTagContents(DataOutput var1) throws IOException { + var1.writeByte(this.byteValue); + } + + void readTagContents(DataInput var1) throws IOException { + this.byteValue = var1.readByte(); + } + + public byte getType() { + return (byte)1; + } + + public String toString() { + return "" + this.byteValue; + } +} diff --git a/src/net/minecraft/src/NBTTagByteArray.java b/src/net/minecraft/src/NBTTagByteArray.java new file mode 100644 index 0000000..d35b4a8 --- /dev/null +++ b/src/net/minecraft/src/NBTTagByteArray.java @@ -0,0 +1,35 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class NBTTagByteArray extends NBTBase { + public byte[] byteArray; + + public NBTTagByteArray() { + } + + public NBTTagByteArray(byte[] var1) { + this.byteArray = var1; + } + + void writeTagContents(DataOutput var1) throws IOException { + var1.writeInt(this.byteArray.length); + var1.write(this.byteArray); + } + + void readTagContents(DataInput var1) throws IOException { + int var2 = var1.readInt(); + this.byteArray = new byte[var2]; + var1.readFully(this.byteArray); + } + + public byte getType() { + return (byte)7; + } + + public String toString() { + return "[" + this.byteArray.length + " bytes]"; + } +} diff --git a/src/net/minecraft/src/NBTTagCompound.java b/src/net/minecraft/src/NBTTagCompound.java new file mode 100644 index 0000000..f8704cd --- /dev/null +++ b/src/net/minecraft/src/NBTTagCompound.java @@ -0,0 +1,141 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; +import java.util.Collection; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; + +public class NBTTagCompound extends NBTBase { + private Map tagMap = new HashMap(); + + void writeTagContents(DataOutput var1) throws IOException { + Iterator var2 = this.tagMap.values().iterator(); + + while(var2.hasNext()) { + NBTBase var3 = (NBTBase)var2.next(); + NBTBase.writeTag(var3, var1); + } + + var1.writeByte(0); + } + + void readTagContents(DataInput var1) throws IOException { + this.tagMap.clear(); + + while(true) { + NBTBase var2 = NBTBase.readTag(var1); + if(var2.getType() == 0) { + return; + } + + this.tagMap.put(var2.getKey(), var2); + } + } + + public Collection func_28110_c() { + return this.tagMap.values(); + } + + public byte getType() { + return (byte)10; + } + + public void setTag(String var1, NBTBase var2) { + this.tagMap.put(var1, var2.setKey(var1)); + } + + public void setByte(String var1, byte var2) { + this.tagMap.put(var1, (new NBTTagByte(var2)).setKey(var1)); + } + + public void setShort(String var1, short var2) { + this.tagMap.put(var1, (new NBTTagShort(var2)).setKey(var1)); + } + + public void setInteger(String var1, int var2) { + this.tagMap.put(var1, (new NBTTagInt(var2)).setKey(var1)); + } + + public void setLong(String var1, long var2) { + this.tagMap.put(var1, (new NBTTagLong(var2)).setKey(var1)); + } + + public void setFloat(String var1, float var2) { + this.tagMap.put(var1, (new NBTTagFloat(var2)).setKey(var1)); + } + + public void setDouble(String var1, double var2) { + this.tagMap.put(var1, (new NBTTagDouble(var2)).setKey(var1)); + } + + public void setString(String var1, String var2) { + this.tagMap.put(var1, (new NBTTagString(var2)).setKey(var1)); + } + + public void setByteArray(String var1, byte[] var2) { + this.tagMap.put(var1, (new NBTTagByteArray(var2)).setKey(var1)); + } + + public void setCompoundTag(String var1, NBTTagCompound var2) { + this.tagMap.put(var1, var2.setKey(var1)); + } + + public void setBoolean(String var1, boolean var2) { + this.setByte(var1, (byte)(var2 ? 1 : 0)); + } + + public boolean hasKey(String var1) { + return this.tagMap.containsKey(var1); + } + + public byte getByte(String var1) { + return !this.tagMap.containsKey(var1) ? 0 : ((NBTTagByte)this.tagMap.get(var1)).byteValue; + } + + public short getShort(String var1) { + return !this.tagMap.containsKey(var1) ? 0 : ((NBTTagShort)this.tagMap.get(var1)).shortValue; + } + + public int getInteger(String var1) { + return !this.tagMap.containsKey(var1) ? 0 : ((NBTTagInt)this.tagMap.get(var1)).intValue; + } + + public long getLong(String var1) { + return !this.tagMap.containsKey(var1) ? 0L : ((NBTTagLong)this.tagMap.get(var1)).longValue; + } + + public float getFloat(String var1) { + return !this.tagMap.containsKey(var1) ? 0.0F : ((NBTTagFloat)this.tagMap.get(var1)).floatValue; + } + + public double getDouble(String var1) { + return !this.tagMap.containsKey(var1) ? 0.0D : ((NBTTagDouble)this.tagMap.get(var1)).doubleValue; + } + + public String getString(String var1) { + return !this.tagMap.containsKey(var1) ? "" : ((NBTTagString)this.tagMap.get(var1)).stringValue; + } + + public byte[] getByteArray(String var1) { + return !this.tagMap.containsKey(var1) ? new byte[0] : ((NBTTagByteArray)this.tagMap.get(var1)).byteArray; + } + + public NBTTagCompound getCompoundTag(String var1) { + return !this.tagMap.containsKey(var1) ? new NBTTagCompound() : (NBTTagCompound)this.tagMap.get(var1); + } + + public NBTTagList getTagList(String var1) { + return !this.tagMap.containsKey(var1) ? new NBTTagList() : (NBTTagList)this.tagMap.get(var1); + } + + public boolean getBoolean(String var1) { + return this.getByte(var1) != 0; + } + + public String toString() { + return "" + this.tagMap.size() + " entries"; + } +} diff --git a/src/net/minecraft/src/NBTTagDouble.java b/src/net/minecraft/src/NBTTagDouble.java new file mode 100644 index 0000000..39caa5c --- /dev/null +++ b/src/net/minecraft/src/NBTTagDouble.java @@ -0,0 +1,32 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class NBTTagDouble extends NBTBase { + public double doubleValue; + + public NBTTagDouble() { + } + + public NBTTagDouble(double var1) { + this.doubleValue = var1; + } + + void writeTagContents(DataOutput var1) throws IOException { + var1.writeDouble(this.doubleValue); + } + + void readTagContents(DataInput var1) throws IOException { + this.doubleValue = var1.readDouble(); + } + + public byte getType() { + return (byte)6; + } + + public String toString() { + return "" + this.doubleValue; + } +} diff --git a/src/net/minecraft/src/NBTTagEnd.java b/src/net/minecraft/src/NBTTagEnd.java new file mode 100644 index 0000000..1385764 --- /dev/null +++ b/src/net/minecraft/src/NBTTagEnd.java @@ -0,0 +1,21 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class NBTTagEnd extends NBTBase { + void readTagContents(DataInput var1) throws IOException { + } + + void writeTagContents(DataOutput var1) throws IOException { + } + + public byte getType() { + return (byte)0; + } + + public String toString() { + return "END"; + } +} diff --git a/src/net/minecraft/src/NBTTagFloat.java b/src/net/minecraft/src/NBTTagFloat.java new file mode 100644 index 0000000..d5db8ec --- /dev/null +++ b/src/net/minecraft/src/NBTTagFloat.java @@ -0,0 +1,32 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class NBTTagFloat extends NBTBase { + public float floatValue; + + public NBTTagFloat() { + } + + public NBTTagFloat(float var1) { + this.floatValue = var1; + } + + void writeTagContents(DataOutput var1) throws IOException { + var1.writeFloat(this.floatValue); + } + + void readTagContents(DataInput var1) throws IOException { + this.floatValue = var1.readFloat(); + } + + public byte getType() { + return (byte)5; + } + + public String toString() { + return "" + this.floatValue; + } +} diff --git a/src/net/minecraft/src/NBTTagInt.java b/src/net/minecraft/src/NBTTagInt.java new file mode 100644 index 0000000..77e69ac --- /dev/null +++ b/src/net/minecraft/src/NBTTagInt.java @@ -0,0 +1,32 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class NBTTagInt extends NBTBase { + public int intValue; + + public NBTTagInt() { + } + + public NBTTagInt(int var1) { + this.intValue = var1; + } + + void writeTagContents(DataOutput var1) throws IOException { + var1.writeInt(this.intValue); + } + + void readTagContents(DataInput var1) throws IOException { + this.intValue = var1.readInt(); + } + + public byte getType() { + return (byte)3; + } + + public String toString() { + return "" + this.intValue; + } +} diff --git a/src/net/minecraft/src/NBTTagList.java b/src/net/minecraft/src/NBTTagList.java new file mode 100644 index 0000000..3968e9b --- /dev/null +++ b/src/net/minecraft/src/NBTTagList.java @@ -0,0 +1,62 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +public class NBTTagList extends NBTBase { + private List tagList = new ArrayList(); + private byte tagType; + + void writeTagContents(DataOutput var1) throws IOException { + if(this.tagList.size() > 0) { + this.tagType = ((NBTBase)this.tagList.get(0)).getType(); + } else { + this.tagType = 1; + } + + var1.writeByte(this.tagType); + var1.writeInt(this.tagList.size()); + + for(int var2 = 0; var2 < this.tagList.size(); ++var2) { + ((NBTBase)this.tagList.get(var2)).writeTagContents(var1); + } + + } + + void readTagContents(DataInput var1) throws IOException { + this.tagType = var1.readByte(); + int var2 = var1.readInt(); + this.tagList = new ArrayList(); + + for(int var3 = 0; var3 < var2; ++var3) { + NBTBase var4 = NBTBase.createTagOfType(this.tagType); + var4.readTagContents(var1); + this.tagList.add(var4); + } + + } + + public byte getType() { + return (byte)9; + } + + public String toString() { + return "" + this.tagList.size() + " entries of type " + NBTBase.getTagName(this.tagType); + } + + public void setTag(NBTBase var1) { + this.tagType = var1.getType(); + this.tagList.add(var1); + } + + public NBTBase tagAt(int var1) { + return (NBTBase)this.tagList.get(var1); + } + + public int tagCount() { + return this.tagList.size(); + } +} diff --git a/src/net/minecraft/src/NBTTagLong.java b/src/net/minecraft/src/NBTTagLong.java new file mode 100644 index 0000000..ef65cdd --- /dev/null +++ b/src/net/minecraft/src/NBTTagLong.java @@ -0,0 +1,32 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class NBTTagLong extends NBTBase { + public long longValue; + + public NBTTagLong() { + } + + public NBTTagLong(long var1) { + this.longValue = var1; + } + + void writeTagContents(DataOutput var1) throws IOException { + var1.writeLong(this.longValue); + } + + void readTagContents(DataInput var1) throws IOException { + this.longValue = var1.readLong(); + } + + public byte getType() { + return (byte)4; + } + + public String toString() { + return "" + this.longValue; + } +} diff --git a/src/net/minecraft/src/NBTTagShort.java b/src/net/minecraft/src/NBTTagShort.java new file mode 100644 index 0000000..b22621f --- /dev/null +++ b/src/net/minecraft/src/NBTTagShort.java @@ -0,0 +1,32 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class NBTTagShort extends NBTBase { + public short shortValue; + + public NBTTagShort() { + } + + public NBTTagShort(short var1) { + this.shortValue = var1; + } + + void writeTagContents(DataOutput var1) throws IOException { + var1.writeShort(this.shortValue); + } + + void readTagContents(DataInput var1) throws IOException { + this.shortValue = var1.readShort(); + } + + public byte getType() { + return (byte)2; + } + + public String toString() { + return "" + this.shortValue; + } +} diff --git a/src/net/minecraft/src/NBTTagString.java b/src/net/minecraft/src/NBTTagString.java new file mode 100644 index 0000000..91411d1 --- /dev/null +++ b/src/net/minecraft/src/NBTTagString.java @@ -0,0 +1,35 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class NBTTagString extends NBTBase { + public String stringValue; + + public NBTTagString() { + } + + public NBTTagString(String var1) { + this.stringValue = var1; + if(var1 == null) { + throw new IllegalArgumentException("Empty string not allowed"); + } + } + + void writeTagContents(DataOutput var1) throws IOException { + var1.writeUTF(this.stringValue); + } + + void readTagContents(DataInput var1) throws IOException { + this.stringValue = var1.readUTF(); + } + + public byte getType() { + return (byte)8; + } + + public String toString() { + return "" + this.stringValue; + } +} diff --git a/src/net/minecraft/src/NetClientHandler.java b/src/net/minecraft/src/NetClientHandler.java new file mode 100644 index 0000000..bf16eff --- /dev/null +++ b/src/net/minecraft/src/NetClientHandler.java @@ -0,0 +1,627 @@ +package net.minecraft.src; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.net.InetAddress; +import java.net.Socket; +import java.net.URL; +import java.net.UnknownHostException; +import java.util.List; +import java.util.Random; +import net.minecraft.client.Minecraft; + +public class NetClientHandler extends NetHandler { + private boolean disconnected = false; + private NetworkManager netManager; + public String field_1209_a; + private Minecraft mc; + private WorldClient worldClient; + private boolean field_1210_g = false; + public MapStorage field_28118_b = new MapStorage((ISaveHandler)null); + Random rand = new Random(); + + public NetClientHandler(Minecraft var1, String var2, int var3) throws IOException, UnknownHostException { + this.mc = var1; + Socket var4 = new Socket(InetAddress.getByName(var2), var3); + this.netManager = new NetworkManager(var4, "Client", this); + } + + public void processReadPackets() { + if(!this.disconnected) { + this.netManager.processReadPackets(); + } + + this.netManager.wakeThreads(); + } + + public void handleLogin(Packet1Login var1) { + this.mc.playerController = new PlayerControllerMP(this.mc, this); + this.mc.statFileWriter.readStat(StatList.joinMultiplayerStat, 1); + this.worldClient = new WorldClient(this, var1.mapSeed, var1.dimension); + this.worldClient.multiplayerWorld = true; + this.mc.changeWorld1(this.worldClient); + this.mc.thePlayer.dimension = var1.dimension; + this.mc.displayGuiScreen(new GuiDownloadTerrain(this)); + this.mc.thePlayer.entityId = var1.protocolVersion; + } + + public void handlePickupSpawn(Packet21PickupSpawn var1) { + double var2 = (double)var1.xPosition / 32.0D; + double var4 = (double)var1.yPosition / 32.0D; + double var6 = (double)var1.zPosition / 32.0D; + EntityItem var8 = new EntityItem(this.worldClient, var2, var4, var6, new ItemStack(var1.itemID, var1.count, var1.itemDamage)); + var8.motionX = (double)var1.rotation / 128.0D; + var8.motionY = (double)var1.pitch / 128.0D; + var8.motionZ = (double)var1.roll / 128.0D; + var8.serverPosX = var1.xPosition; + var8.serverPosY = var1.yPosition; + var8.serverPosZ = var1.zPosition; + this.worldClient.func_712_a(var1.entityId, var8); + } + + public void handleVehicleSpawn(Packet23VehicleSpawn var1) { + double var2 = (double)var1.xPosition / 32.0D; + double var4 = (double)var1.yPosition / 32.0D; + double var6 = (double)var1.zPosition / 32.0D; + Object var8 = null; + if(var1.type == 10) { + var8 = new EntityMinecart(this.worldClient, var2, var4, var6, 0); + } + + if(var1.type == 11) { + var8 = new EntityMinecart(this.worldClient, var2, var4, var6, 1); + } + + if(var1.type == 12) { + var8 = new EntityMinecart(this.worldClient, var2, var4, var6, 2); + } + + if(var1.type == 90) { + var8 = new EntityFish(this.worldClient, var2, var4, var6); + } + + if(var1.type == 60) { + var8 = new EntityArrow(this.worldClient, var2, var4, var6); + } + + if(var1.type == 61) { + var8 = new EntitySnowball(this.worldClient, var2, var4, var6); + } + + if(var1.type == 63) { + var8 = new EntityFireball(this.worldClient, var2, var4, var6, (double)var1.field_28047_e / 8000.0D, (double)var1.field_28046_f / 8000.0D, (double)var1.field_28045_g / 8000.0D); + var1.field_28044_i = 0; + } + + if(var1.type == 62) { + var8 = new EntityEgg(this.worldClient, var2, var4, var6); + } + + if(var1.type == 1) { + var8 = new EntityBoat(this.worldClient, var2, var4, var6); + } + + if(var1.type == 50) { + var8 = new EntityTNTPrimed(this.worldClient, var2, var4, var6); + } + + if(var1.type == 70) { + var8 = new EntityFallingSand(this.worldClient, var2, var4, var6, Block.sand.blockID); + } + + if(var1.type == 71) { + var8 = new EntityFallingSand(this.worldClient, var2, var4, var6, Block.gravel.blockID); + } + + if(var8 != null) { + ((Entity)var8).serverPosX = var1.xPosition; + ((Entity)var8).serverPosY = var1.yPosition; + ((Entity)var8).serverPosZ = var1.zPosition; + ((Entity)var8).rotationYaw = 0.0F; + ((Entity)var8).rotationPitch = 0.0F; + ((Entity)var8).entityId = var1.entityId; + this.worldClient.func_712_a(var1.entityId, (Entity)var8); + if(var1.field_28044_i > 0) { + if(var1.type == 60) { + Entity var9 = this.getEntityByID(var1.field_28044_i); + if(var9 instanceof EntityLiving) { + ((EntityArrow)var8).owner = (EntityLiving)var9; + } + } + + ((Entity)var8).setVelocity((double)var1.field_28047_e / 8000.0D, (double)var1.field_28046_f / 8000.0D, (double)var1.field_28045_g / 8000.0D); + } + } + + } + + public void handleWeather(Packet71Weather var1) { + double var2 = (double)var1.field_27053_b / 32.0D; + double var4 = (double)var1.field_27057_c / 32.0D; + double var6 = (double)var1.field_27056_d / 32.0D; + EntityLightningBolt var8 = null; + if(var1.field_27055_e == 1) { + var8 = new EntityLightningBolt(this.worldClient, var2, var4, var6); + } + + if(var8 != null) { + var8.serverPosX = var1.field_27053_b; + var8.serverPosY = var1.field_27057_c; + var8.serverPosZ = var1.field_27056_d; + var8.rotationYaw = 0.0F; + var8.rotationPitch = 0.0F; + var8.entityId = var1.field_27054_a; + this.worldClient.addWeatherEffect(var8); + } + + } + + public void func_21146_a(Packet25EntityPainting var1) { + EntityPainting var2 = new EntityPainting(this.worldClient, var1.xPosition, var1.yPosition, var1.zPosition, var1.direction, var1.title); + this.worldClient.func_712_a(var1.entityId, var2); + } + + public void func_6498_a(Packet28EntityVelocity var1) { + Entity var2 = this.getEntityByID(var1.entityId); + if(var2 != null) { + var2.setVelocity((double)var1.motionX / 8000.0D, (double)var1.motionY / 8000.0D, (double)var1.motionZ / 8000.0D); + } + } + + public void func_21148_a(Packet40EntityMetadata var1) { + Entity var2 = this.getEntityByID(var1.entityId); + if(var2 != null && var1.func_21047_b() != null) { + var2.getDataWatcher().updateWatchedObjectsFromList(var1.func_21047_b()); + } + + } + + public void handleNamedEntitySpawn(Packet20NamedEntitySpawn var1) { + double var2 = (double)var1.xPosition / 32.0D; + double var4 = (double)var1.yPosition / 32.0D; + double var6 = (double)var1.zPosition / 32.0D; + float var8 = (float)(var1.rotation * 360) / 256.0F; + float var9 = (float)(var1.pitch * 360) / 256.0F; + EntityOtherPlayerMP var10 = new EntityOtherPlayerMP(this.mc.theWorld, var1.name); + var10.prevPosX = var10.lastTickPosX = (double)(var10.serverPosX = var1.xPosition); + var10.prevPosY = var10.lastTickPosY = (double)(var10.serverPosY = var1.yPosition); + var10.prevPosZ = var10.lastTickPosZ = (double)(var10.serverPosZ = var1.zPosition); + int var11 = var1.currentItem; + if(var11 == 0) { + var10.inventory.mainInventory[var10.inventory.currentItem] = null; + } else { + var10.inventory.mainInventory[var10.inventory.currentItem] = new ItemStack(var11, 1, 0); + } + + var10.setPositionAndRotation(var2, var4, var6, var8, var9); + this.worldClient.func_712_a(var1.entityId, var10); + } + + public void handleEntityTeleport(Packet34EntityTeleport var1) { + Entity var2 = this.getEntityByID(var1.entityId); + if(var2 != null) { + var2.serverPosX = var1.xPosition; + var2.serverPosY = var1.yPosition; + var2.serverPosZ = var1.zPosition; + double var3 = (double)var2.serverPosX / 32.0D; + double var5 = (double)var2.serverPosY / 32.0D + 1.0D / 64.0D; + double var7 = (double)var2.serverPosZ / 32.0D; + float var9 = (float)(var1.yaw * 360) / 256.0F; + float var10 = (float)(var1.pitch * 360) / 256.0F; + var2.setPositionAndRotation2(var3, var5, var7, var9, var10, 3); + } + } + + public void handleEntity(Packet30Entity var1) { + Entity var2 = this.getEntityByID(var1.entityId); + if(var2 != null) { + var2.serverPosX += var1.xPosition; + var2.serverPosY += var1.yPosition; + var2.serverPosZ += var1.zPosition; + double var3 = (double)var2.serverPosX / 32.0D; + double var5 = (double)var2.serverPosY / 32.0D; + double var7 = (double)var2.serverPosZ / 32.0D; + float var9 = var1.rotating ? (float)(var1.yaw * 360) / 256.0F : var2.rotationYaw; + float var10 = var1.rotating ? (float)(var1.pitch * 360) / 256.0F : var2.rotationPitch; + var2.setPositionAndRotation2(var3, var5, var7, var9, var10, 3); + } + } + + public void handleDestroyEntity(Packet29DestroyEntity var1) { + this.worldClient.removeEntityFromWorld(var1.entityId); + } + + public void handleFlying(Packet10Flying var1) { + EntityPlayerSP var2 = this.mc.thePlayer; + double var3 = var2.posX; + double var5 = var2.posY; + double var7 = var2.posZ; + float var9 = var2.rotationYaw; + float var10 = var2.rotationPitch; + if(var1.moving) { + var3 = var1.xPosition; + var5 = var1.yPosition; + var7 = var1.zPosition; + } + + if(var1.rotating) { + var9 = var1.yaw; + var10 = var1.pitch; + } + + var2.ySize = 0.0F; + var2.motionX = var2.motionY = var2.motionZ = 0.0D; + var2.setPositionAndRotation(var3, var5, var7, var9, var10); + var1.xPosition = var2.posX; + var1.yPosition = var2.boundingBox.minY; + var1.zPosition = var2.posZ; + var1.stance = var2.posY; + this.netManager.addToSendQueue(var1); + if(!this.field_1210_g) { + this.mc.thePlayer.prevPosX = this.mc.thePlayer.posX; + this.mc.thePlayer.prevPosY = this.mc.thePlayer.posY; + this.mc.thePlayer.prevPosZ = this.mc.thePlayer.posZ; + this.field_1210_g = true; + this.mc.displayGuiScreen((GuiScreen)null); + } + + } + + public void handlePreChunk(Packet50PreChunk var1) { + this.worldClient.doPreChunk(var1.xPosition, var1.yPosition, var1.mode); + } + + public void handleMultiBlockChange(Packet52MultiBlockChange var1) { + Chunk var2 = this.worldClient.getChunkFromChunkCoords(var1.xPosition, var1.zPosition); + int var3 = var1.xPosition * 16; + int var4 = var1.zPosition * 16; + + for(int var5 = 0; var5 < var1.size; ++var5) { + short var6 = var1.coordinateArray[var5]; + int var7 = var1.typeArray[var5] & 255; + byte var8 = var1.metadataArray[var5]; + int var9 = var6 >> 12 & 15; + int var10 = var6 >> 8 & 15; + int var11 = var6 & 255; + var2.setBlockIDWithMetadata(var9, var11, var10, var7, var8); + this.worldClient.func_711_c(var9 + var3, var11, var10 + var4, var9 + var3, var11, var10 + var4); + this.worldClient.markBlocksDirty(var9 + var3, var11, var10 + var4, var9 + var3, var11, var10 + var4); + } + + } + + public void handleMapChunk(Packet51MapChunk var1) { + this.worldClient.func_711_c(var1.xPosition, var1.yPosition, var1.zPosition, var1.xPosition + var1.xSize - 1, var1.yPosition + var1.ySize - 1, var1.zPosition + var1.zSize - 1); + this.worldClient.setChunkData(var1.xPosition, var1.yPosition, var1.zPosition, var1.xSize, var1.ySize, var1.zSize, var1.chunk); + } + + public void handleBlockChange(Packet53BlockChange var1) { + this.worldClient.func_714_c(var1.xPosition, var1.yPosition, var1.zPosition, var1.type, var1.metadata); + } + + public void handleKickDisconnect(Packet255KickDisconnect var1) { + this.netManager.networkShutdown("disconnect.kicked", new Object[0]); + this.disconnected = true; + this.mc.changeWorld1((World)null); + this.mc.displayGuiScreen(new GuiConnectFailed("disconnect.disconnected", "disconnect.genericReason", new Object[]{var1.reason})); + } + + public void handleErrorMessage(String var1, Object[] var2) { + if(!this.disconnected) { + this.disconnected = true; + this.mc.changeWorld1((World)null); + this.mc.displayGuiScreen(new GuiConnectFailed("disconnect.lost", var1, var2)); + } + } + + public void func_28117_a(Packet var1) { + if(!this.disconnected) { + this.netManager.addToSendQueue(var1); + this.netManager.func_28142_c(); + } + } + + public void addToSendQueue(Packet var1) { + if(!this.disconnected) { + this.netManager.addToSendQueue(var1); + } + } + + public void handleCollect(Packet22Collect var1) { + Entity var2 = this.getEntityByID(var1.collectedEntityId); + Object var3 = (EntityLiving)this.getEntityByID(var1.collectorEntityId); + if(var3 == null) { + var3 = this.mc.thePlayer; + } + + if(var2 != null) { + this.worldClient.playSoundAtEntity(var2, "random.pop", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); + this.mc.effectRenderer.addEffect(new EntityPickupFX(this.mc.theWorld, var2, (Entity)var3, -0.5F)); + this.worldClient.removeEntityFromWorld(var1.collectedEntityId); + } + + } + + public void handleChat(Packet3Chat var1) { + this.mc.ingameGUI.addChatMessage(var1.message); + } + + public void handleArmAnimation(Packet18Animation var1) { + Entity var2 = this.getEntityByID(var1.entityId); + if(var2 != null) { + EntityPlayer var3; + if(var1.animate == 1) { + var3 = (EntityPlayer)var2; + var3.swingItem(); + } else if(var1.animate == 2) { + var2.performHurtAnimation(); + } else if(var1.animate == 3) { + var3 = (EntityPlayer)var2; + var3.wakeUpPlayer(false, false, false); + } else if(var1.animate == 4) { + var3 = (EntityPlayer)var2; + var3.func_6420_o(); + } + + } + } + + public void func_22186_a(Packet17Sleep var1) { + Entity var2 = this.getEntityByID(var1.field_22045_a); + if(var2 != null) { + if(var1.field_22046_e == 0) { + EntityPlayer var3 = (EntityPlayer)var2; + var3.sleepInBedAt(var1.field_22044_b, var1.field_22048_c, var1.field_22047_d); + } + + } + } + + public void handleHandshake(Packet2Handshake var1) { + if(var1.username.equals("-")) { + this.addToSendQueue(new Packet1Login(this.mc.session.username, 14)); + } else { + try { + URL var2 = new URL("http://www.minecraft.net/game/joinserver.jsp?user=" + this.mc.session.username + "&sessionId=" + this.mc.session.sessionId + "&serverId=" + var1.username); + BufferedReader var3 = new BufferedReader(new InputStreamReader(var2.openStream())); + String var4 = var3.readLine(); + var3.close(); + if(var4.equalsIgnoreCase("ok")) { + this.addToSendQueue(new Packet1Login(this.mc.session.username, 14)); + } else { + this.netManager.networkShutdown("disconnect.loginFailedInfo", new Object[]{var4}); + } + } catch (Exception var5) { + var5.printStackTrace(); + this.netManager.networkShutdown("disconnect.genericReason", new Object[]{"Internal client error: " + var5.toString()}); + } + } + + } + + public void disconnect() { + this.disconnected = true; + this.netManager.wakeThreads(); + this.netManager.networkShutdown("disconnect.closed", new Object[0]); + } + + public void handleMobSpawn(Packet24MobSpawn var1) { + double var2 = (double)var1.xPosition / 32.0D; + double var4 = (double)var1.yPosition / 32.0D; + double var6 = (double)var1.zPosition / 32.0D; + float var8 = (float)(var1.yaw * 360) / 256.0F; + float var9 = (float)(var1.pitch * 360) / 256.0F; + EntityLiving var10 = (EntityLiving)EntityList.createEntity(var1.type, this.mc.theWorld); + var10.serverPosX = var1.xPosition; + var10.serverPosY = var1.yPosition; + var10.serverPosZ = var1.zPosition; + var10.entityId = var1.entityId; + var10.setPositionAndRotation(var2, var4, var6, var8, var9); + var10.isMultiplayerEntity = true; + this.worldClient.func_712_a(var1.entityId, var10); + List var11 = var1.getMetadata(); + if(var11 != null) { + var10.getDataWatcher().updateWatchedObjectsFromList(var11); + } + + } + + public void handleUpdateTime(Packet4UpdateTime var1) { + this.mc.theWorld.setWorldTime(var1.time); + } + + public void handleSpawnPosition(Packet6SpawnPosition var1) { + this.mc.thePlayer.setPlayerSpawnCoordinate(new ChunkCoordinates(var1.xPosition, var1.yPosition, var1.zPosition)); + this.mc.theWorld.getWorldInfo().setSpawn(var1.xPosition, var1.yPosition, var1.zPosition); + } + + public void func_6497_a(Packet39AttachEntity var1) { + Object var2 = this.getEntityByID(var1.entityId); + Entity var3 = this.getEntityByID(var1.vehicleEntityId); + if(var1.entityId == this.mc.thePlayer.entityId) { + var2 = this.mc.thePlayer; + } + + if(var2 != null) { + ((Entity)var2).mountEntity(var3); + } + } + + public void func_9447_a(Packet38EntityStatus var1) { + Entity var2 = this.getEntityByID(var1.entityId); + if(var2 != null) { + var2.handleHealthUpdate(var1.entityStatus); + } + + } + + private Entity getEntityByID(int var1) { + return (Entity)(var1 == this.mc.thePlayer.entityId ? this.mc.thePlayer : this.worldClient.func_709_b(var1)); + } + + public void handleHealth(Packet8UpdateHealth var1) { + this.mc.thePlayer.setHealth(var1.healthMP); + } + + public void func_9448_a(Packet9Respawn var1) { + if(var1.field_28048_a != this.mc.thePlayer.dimension) { + this.field_1210_g = false; + this.worldClient = new WorldClient(this, this.worldClient.getWorldInfo().getRandomSeed(), var1.field_28048_a); + this.worldClient.multiplayerWorld = true; + this.mc.changeWorld1(this.worldClient); + this.mc.thePlayer.dimension = var1.field_28048_a; + this.mc.displayGuiScreen(new GuiDownloadTerrain(this)); + } + + this.mc.respawn(true, var1.field_28048_a); + } + + public void func_12245_a(Packet60Explosion var1) { + Explosion var2 = new Explosion(this.mc.theWorld, (Entity)null, var1.explosionX, var1.explosionY, var1.explosionZ, var1.explosionSize); + var2.destroyedBlockPositions = var1.destroyedBlockPositions; + var2.doExplosionB(true); + } + + public void func_20087_a(Packet100OpenWindow var1) { + if(var1.inventoryType == 0) { + InventoryBasic var2 = new InventoryBasic(var1.windowTitle, var1.slotsCount); + this.mc.thePlayer.displayGUIChest(var2); + this.mc.thePlayer.craftingInventory.windowId = var1.windowId; + } else if(var1.inventoryType == 2) { + TileEntityFurnace var3 = new TileEntityFurnace(); + this.mc.thePlayer.displayGUIFurnace(var3); + this.mc.thePlayer.craftingInventory.windowId = var1.windowId; + } else if(var1.inventoryType == 3) { + TileEntityDispenser var4 = new TileEntityDispenser(); + this.mc.thePlayer.displayGUIDispenser(var4); + this.mc.thePlayer.craftingInventory.windowId = var1.windowId; + } else if(var1.inventoryType == 1) { + EntityPlayerSP var5 = this.mc.thePlayer; + this.mc.thePlayer.displayWorkbenchGUI(MathHelper.floor_double(var5.posX), MathHelper.floor_double(var5.posY), MathHelper.floor_double(var5.posZ)); + this.mc.thePlayer.craftingInventory.windowId = var1.windowId; + } + + } + + public void func_20088_a(Packet103SetSlot var1) { + if(var1.windowId == -1) { + this.mc.thePlayer.inventory.setItemStack(var1.myItemStack); + } else if(var1.windowId == 0 && var1.itemSlot >= 36 && var1.itemSlot < 45) { + ItemStack var2 = this.mc.thePlayer.inventorySlots.getSlot(var1.itemSlot).getStack(); + if(var1.myItemStack != null && (var2 == null || var2.stackSize < var1.myItemStack.stackSize)) { + var1.myItemStack.animationsToGo = 5; + } + + this.mc.thePlayer.inventorySlots.putStackInSlot(var1.itemSlot, var1.myItemStack); + } else if(var1.windowId == this.mc.thePlayer.craftingInventory.windowId) { + this.mc.thePlayer.craftingInventory.putStackInSlot(var1.itemSlot, var1.myItemStack); + } + + } + + public void func_20089_a(Packet106Transaction var1) { + Container var2 = null; + if(var1.windowId == 0) { + var2 = this.mc.thePlayer.inventorySlots; + } else if(var1.windowId == this.mc.thePlayer.craftingInventory.windowId) { + var2 = this.mc.thePlayer.craftingInventory; + } + + if(var2 != null) { + if(var1.field_20030_c) { + var2.func_20113_a(var1.field_20028_b); + } else { + var2.func_20110_b(var1.field_20028_b); + this.addToSendQueue(new Packet106Transaction(var1.windowId, var1.field_20028_b, true)); + } + } + + } + + public void func_20094_a(Packet104WindowItems var1) { + if(var1.windowId == 0) { + this.mc.thePlayer.inventorySlots.putStacksInSlots(var1.itemStack); + } else if(var1.windowId == this.mc.thePlayer.craftingInventory.windowId) { + this.mc.thePlayer.craftingInventory.putStacksInSlots(var1.itemStack); + } + + } + + public void handleSignUpdate(Packet130UpdateSign var1) { + if(this.mc.theWorld.blockExists(var1.xPosition, var1.yPosition, var1.zPosition)) { + TileEntity var2 = this.mc.theWorld.getBlockTileEntity(var1.xPosition, var1.yPosition, var1.zPosition); + if(var2 instanceof TileEntitySign) { + TileEntitySign var3 = (TileEntitySign)var2; + + for(int var4 = 0; var4 < 4; ++var4) { + var3.signText[var4] = var1.signLines[var4]; + } + + var3.onInventoryChanged(); + } + } + + } + + public void func_20090_a(Packet105UpdateProgressbar var1) { + this.registerPacket(var1); + if(this.mc.thePlayer.craftingInventory != null && this.mc.thePlayer.craftingInventory.windowId == var1.windowId) { + this.mc.thePlayer.craftingInventory.func_20112_a(var1.progressBar, var1.progressBarValue); + } + + } + + public void handlePlayerInventory(Packet5PlayerInventory var1) { + Entity var2 = this.getEntityByID(var1.entityID); + if(var2 != null) { + var2.outfitWithItem(var1.slot, var1.itemID, var1.itemDamage); + } + + } + + public void func_20092_a(Packet101CloseWindow var1) { + this.mc.thePlayer.closeScreen(); + } + + public void handleNotePlay(Packet54PlayNoteBlock var1) { + this.mc.theWorld.playNoteAt(var1.xLocation, var1.yLocation, var1.zLocation, var1.instrumentType, var1.pitch); + } + + public void func_25118_a(Packet70Bed var1) { + int var2 = var1.field_25019_b; + if(var2 >= 0 && var2 < Packet70Bed.field_25020_a.length && Packet70Bed.field_25020_a[var2] != null) { + this.mc.thePlayer.addChatMessage(Packet70Bed.field_25020_a[var2]); + } + + if(var2 == 1) { + this.worldClient.getWorldInfo().setRaining(true); + this.worldClient.func_27158_h(1.0F); + } else if(var2 == 2) { + this.worldClient.getWorldInfo().setRaining(false); + this.worldClient.func_27158_h(0.0F); + } + + } + + public void func_28116_a(Packet131MapData var1) { + if(var1.field_28055_a == Item.mapItem.shiftedIndex) { + ItemMap.func_28013_a(var1.field_28054_b, this.mc.theWorld).func_28171_a(var1.field_28056_c); + } else { + System.out.println("Unknown itemid: " + var1.field_28054_b); + } + + } + + public void func_28115_a(Packet61DoorChange var1) { + this.mc.theWorld.func_28106_e(var1.field_28050_a, var1.field_28053_c, var1.field_28052_d, var1.field_28051_e, var1.field_28049_b); + } + + public void func_27245_a(Packet200Statistic var1) { + ((EntityClientPlayerMP)this.mc.thePlayer).func_27027_b(StatList.func_27361_a(var1.field_27052_a), var1.field_27051_b); + } + + public boolean isServerHandler() { + return false; + } +} diff --git a/src/net/minecraft/src/NetHandler.java b/src/net/minecraft/src/NetHandler.java new file mode 100644 index 0000000..43805de --- /dev/null +++ b/src/net/minecraft/src/NetHandler.java @@ -0,0 +1,210 @@ +package net.minecraft.src; + +public abstract class NetHandler { + public abstract boolean isServerHandler(); + + public void handleMapChunk(Packet51MapChunk var1) { + } + + public void registerPacket(Packet var1) { + } + + public void handleErrorMessage(String var1, Object[] var2) { + } + + public void handleKickDisconnect(Packet255KickDisconnect var1) { + this.registerPacket(var1); + } + + public void handleLogin(Packet1Login var1) { + this.registerPacket(var1); + } + + public void handleFlying(Packet10Flying var1) { + this.registerPacket(var1); + } + + public void handleMultiBlockChange(Packet52MultiBlockChange var1) { + this.registerPacket(var1); + } + + public void handleBlockDig(Packet14BlockDig var1) { + this.registerPacket(var1); + } + + public void handleBlockChange(Packet53BlockChange var1) { + this.registerPacket(var1); + } + + public void handlePreChunk(Packet50PreChunk var1) { + this.registerPacket(var1); + } + + public void handleNamedEntitySpawn(Packet20NamedEntitySpawn var1) { + this.registerPacket(var1); + } + + public void handleEntity(Packet30Entity var1) { + this.registerPacket(var1); + } + + public void handleEntityTeleport(Packet34EntityTeleport var1) { + this.registerPacket(var1); + } + + public void handlePlace(Packet15Place var1) { + this.registerPacket(var1); + } + + public void handleBlockItemSwitch(Packet16BlockItemSwitch var1) { + this.registerPacket(var1); + } + + public void handleDestroyEntity(Packet29DestroyEntity var1) { + this.registerPacket(var1); + } + + public void handlePickupSpawn(Packet21PickupSpawn var1) { + this.registerPacket(var1); + } + + public void handleCollect(Packet22Collect var1) { + this.registerPacket(var1); + } + + public void handleChat(Packet3Chat var1) { + this.registerPacket(var1); + } + + public void handleVehicleSpawn(Packet23VehicleSpawn var1) { + this.registerPacket(var1); + } + + public void handleArmAnimation(Packet18Animation var1) { + this.registerPacket(var1); + } + + public void func_21147_a(Packet19EntityAction var1) { + this.registerPacket(var1); + } + + public void handleHandshake(Packet2Handshake var1) { + this.registerPacket(var1); + } + + public void handleMobSpawn(Packet24MobSpawn var1) { + this.registerPacket(var1); + } + + public void handleUpdateTime(Packet4UpdateTime var1) { + this.registerPacket(var1); + } + + public void handleSpawnPosition(Packet6SpawnPosition var1) { + this.registerPacket(var1); + } + + public void func_6498_a(Packet28EntityVelocity var1) { + this.registerPacket(var1); + } + + public void func_21148_a(Packet40EntityMetadata var1) { + this.registerPacket(var1); + } + + public void func_6497_a(Packet39AttachEntity var1) { + this.registerPacket(var1); + } + + public void handleUseEntity(Packet7UseEntity var1) { + this.registerPacket(var1); + } + + public void func_9447_a(Packet38EntityStatus var1) { + this.registerPacket(var1); + } + + public void handleHealth(Packet8UpdateHealth var1) { + this.registerPacket(var1); + } + + public void func_9448_a(Packet9Respawn var1) { + this.registerPacket(var1); + } + + public void func_12245_a(Packet60Explosion var1) { + this.registerPacket(var1); + } + + public void func_20087_a(Packet100OpenWindow var1) { + this.registerPacket(var1); + } + + public void func_20092_a(Packet101CloseWindow var1) { + this.registerPacket(var1); + } + + public void func_20091_a(Packet102WindowClick var1) { + this.registerPacket(var1); + } + + public void func_20088_a(Packet103SetSlot var1) { + this.registerPacket(var1); + } + + public void func_20094_a(Packet104WindowItems var1) { + this.registerPacket(var1); + } + + public void handleSignUpdate(Packet130UpdateSign var1) { + this.registerPacket(var1); + } + + public void func_20090_a(Packet105UpdateProgressbar var1) { + this.registerPacket(var1); + } + + public void handlePlayerInventory(Packet5PlayerInventory var1) { + this.registerPacket(var1); + } + + public void func_20089_a(Packet106Transaction var1) { + this.registerPacket(var1); + } + + public void func_21146_a(Packet25EntityPainting var1) { + this.registerPacket(var1); + } + + public void handleNotePlay(Packet54PlayNoteBlock var1) { + this.registerPacket(var1); + } + + public void func_27245_a(Packet200Statistic var1) { + this.registerPacket(var1); + } + + public void func_22186_a(Packet17Sleep var1) { + this.registerPacket(var1); + } + + public void func_22185_a(Packet27Position var1) { + this.registerPacket(var1); + } + + public void func_25118_a(Packet70Bed var1) { + this.registerPacket(var1); + } + + public void handleWeather(Packet71Weather var1) { + this.registerPacket(var1); + } + + public void func_28116_a(Packet131MapData var1) { + this.registerPacket(var1); + } + + public void func_28115_a(Packet61DoorChange var1) { + this.registerPacket(var1); + } +} diff --git a/src/net/minecraft/src/NetworkManager.java b/src/net/minecraft/src/NetworkManager.java new file mode 100644 index 0000000..5d1415f --- /dev/null +++ b/src/net/minecraft/src/NetworkManager.java @@ -0,0 +1,256 @@ +package net.minecraft.src; + +import java.io.BufferedOutputStream; +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; +import java.net.Socket; +import java.net.SocketAddress; +import java.net.SocketException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +public class NetworkManager { + public static final Object threadSyncObject = new Object(); + public static int numReadThreads; + public static int numWriteThreads; + private Object sendQueueLock = new Object(); + private Socket networkSocket; + private final SocketAddress remoteSocketAddress; + private DataInputStream socketInputStream; + private DataOutputStream socketOutputStream; + private boolean isRunning = true; + private List readPackets = Collections.synchronizedList(new ArrayList()); + private List dataPackets = Collections.synchronizedList(new ArrayList()); + private List chunkDataPackets = Collections.synchronizedList(new ArrayList()); + private NetHandler netHandler; + private boolean isServerTerminating = false; + private Thread writeThread; + private Thread readThread; + private boolean isTerminating = false; + private String terminationReason = ""; + private Object[] field_20101_t; + private int timeSinceLastRead = 0; + private int sendQueueByteLength = 0; + public static int[] field_28145_d = new int[256]; + public static int[] field_28144_e = new int[256]; + public int chunkDataSendCounter = 0; + private int field_20100_w = 50; + + public NetworkManager(Socket var1, String var2, NetHandler var3) throws IOException { + this.networkSocket = var1; + this.remoteSocketAddress = var1.getRemoteSocketAddress(); + this.netHandler = var3; + + try { + var1.setSoTimeout(30000); + var1.setTrafficClass(24); + } catch (SocketException var5) { + System.err.println(var5.getMessage()); + } + + this.socketInputStream = new DataInputStream(var1.getInputStream()); + this.socketOutputStream = new DataOutputStream(new BufferedOutputStream(var1.getOutputStream(), 5120)); + this.readThread = new NetworkReaderThread(this, var2 + " read thread"); + this.writeThread = new NetworkWriterThread(this, var2 + " write thread"); + this.readThread.start(); + this.writeThread.start(); + } + + public void addToSendQueue(Packet var1) { + if(!this.isServerTerminating) { + Object var2 = this.sendQueueLock; + synchronized(var2) { + this.sendQueueByteLength += var1.getPacketSize() + 1; + if(var1.isChunkDataPacket) { + this.chunkDataPackets.add(var1); + } else { + this.dataPackets.add(var1); + } + + } + } + } + + private boolean sendPacket() { + boolean var1 = false; + + try { + int[] var10000; + int var10001; + Packet var2; + Object var3; + if(!this.dataPackets.isEmpty() && (this.chunkDataSendCounter == 0 || System.currentTimeMillis() - ((Packet)this.dataPackets.get(0)).creationTimeMillis >= (long)this.chunkDataSendCounter)) { + var3 = this.sendQueueLock; + synchronized(var3) { + var2 = (Packet)this.dataPackets.remove(0); + this.sendQueueByteLength -= var2.getPacketSize() + 1; + } + + Packet.writePacket(var2, this.socketOutputStream); + var10000 = field_28144_e; + var10001 = var2.getPacketId(); + var10000[var10001] += var2.getPacketSize() + 1; + var1 = true; + } + + if(this.field_20100_w-- <= 0 && !this.chunkDataPackets.isEmpty() && (this.chunkDataSendCounter == 0 || System.currentTimeMillis() - ((Packet)this.chunkDataPackets.get(0)).creationTimeMillis >= (long)this.chunkDataSendCounter)) { + var3 = this.sendQueueLock; + synchronized(var3) { + var2 = (Packet)this.chunkDataPackets.remove(0); + this.sendQueueByteLength -= var2.getPacketSize() + 1; + } + + Packet.writePacket(var2, this.socketOutputStream); + var10000 = field_28144_e; + var10001 = var2.getPacketId(); + var10000[var10001] += var2.getPacketSize() + 1; + this.field_20100_w = 0; + var1 = true; + } + + return var1; + } catch (Exception var8) { + if(!this.isTerminating) { + this.onNetworkError(var8); + } + + return false; + } + } + + public void wakeThreads() { + this.readThread.interrupt(); + this.writeThread.interrupt(); + } + + private boolean readPacket() { + boolean var1 = false; + + try { + Packet var2 = Packet.readPacket(this.socketInputStream, this.netHandler.isServerHandler()); + if(var2 != null) { + int[] var10000 = field_28145_d; + int var10001 = var2.getPacketId(); + var10000[var10001] += var2.getPacketSize() + 1; + this.readPackets.add(var2); + var1 = true; + } else { + this.networkShutdown("disconnect.endOfStream", new Object[0]); + } + + return var1; + } catch (Exception var3) { + if(!this.isTerminating) { + this.onNetworkError(var3); + } + + return false; + } + } + + private void onNetworkError(Exception var1) { + var1.printStackTrace(); + this.networkShutdown("disconnect.genericReason", new Object[]{"Internal exception: " + var1.toString()}); + } + + public void networkShutdown(String var1, Object... var2) { + if(this.isRunning) { + this.isTerminating = true; + this.terminationReason = var1; + this.field_20101_t = var2; + (new NetworkMasterThread(this)).start(); + this.isRunning = false; + + try { + this.socketInputStream.close(); + this.socketInputStream = null; + } catch (Throwable var6) { + } + + try { + this.socketOutputStream.close(); + this.socketOutputStream = null; + } catch (Throwable var5) { + } + + try { + this.networkSocket.close(); + this.networkSocket = null; + } catch (Throwable var4) { + } + + } + } + + public void processReadPackets() { + if(this.sendQueueByteLength > 1048576) { + this.networkShutdown("disconnect.overflow", new Object[0]); + } + + if(this.readPackets.isEmpty()) { + if(this.timeSinceLastRead++ == 1200) { + this.networkShutdown("disconnect.timeout", new Object[0]); + } + } else { + this.timeSinceLastRead = 0; + } + + int var1 = 100; + + while(!this.readPackets.isEmpty() && var1-- >= 0) { + Packet var2 = (Packet)this.readPackets.remove(0); + var2.processPacket(this.netHandler); + } + + this.wakeThreads(); + if(this.isTerminating && this.readPackets.isEmpty()) { + this.netHandler.handleErrorMessage(this.terminationReason, this.field_20101_t); + } + + } + + public void func_28142_c() { + this.wakeThreads(); + this.isServerTerminating = true; + this.readThread.interrupt(); + (new ThreadCloseConnection(this)).start(); + } + + static boolean isRunning(NetworkManager var0) { + return var0.isRunning; + } + + static boolean isServerTerminating(NetworkManager var0) { + return var0.isServerTerminating; + } + + static boolean readNetworkPacket(NetworkManager var0) { + return var0.readPacket(); + } + + static boolean sendNetworkPacket(NetworkManager var0) { + return var0.sendPacket(); + } + + static DataOutputStream func_28140_f(NetworkManager var0) { + return var0.socketOutputStream; + } + + static boolean func_28138_e(NetworkManager var0) { + return var0.isTerminating; + } + + static void func_30005_a(NetworkManager var0, Exception var1) { + var0.onNetworkError(var1); + } + + static Thread getReadThread(NetworkManager var0) { + return var0.readThread; + } + + static Thread getWriteThread(NetworkManager var0) { + return var0.writeThread; + } +} diff --git a/src/net/minecraft/src/NetworkMasterThread.java b/src/net/minecraft/src/NetworkMasterThread.java new file mode 100644 index 0000000..bd6085c --- /dev/null +++ b/src/net/minecraft/src/NetworkMasterThread.java @@ -0,0 +1,31 @@ +package net.minecraft.src; + +class NetworkMasterThread extends Thread { + final NetworkManager netManager; + + NetworkMasterThread(NetworkManager var1) { + this.netManager = var1; + } + + public void run() { + try { + Thread.sleep(5000L); + if(NetworkManager.getReadThread(this.netManager).isAlive()) { + try { + NetworkManager.getReadThread(this.netManager).stop(); + } catch (Throwable var3) { + } + } + + if(NetworkManager.getWriteThread(this.netManager).isAlive()) { + try { + NetworkManager.getWriteThread(this.netManager).stop(); + } catch (Throwable var2) { + } + } + } catch (InterruptedException var4) { + var4.printStackTrace(); + } + + } +} diff --git a/src/net/minecraft/src/NetworkReaderThread.java b/src/net/minecraft/src/NetworkReaderThread.java new file mode 100644 index 0000000..85808dd --- /dev/null +++ b/src/net/minecraft/src/NetworkReaderThread.java @@ -0,0 +1,54 @@ +package net.minecraft.src; + +class NetworkReaderThread extends Thread { + final NetworkManager netManager; + + NetworkReaderThread(NetworkManager var1, String var2) { + super(var2); + this.netManager = var1; + } + + public void run() { + Object var1 = NetworkManager.threadSyncObject; + synchronized(var1) { + ++NetworkManager.numReadThreads; + } + + while(true) { + boolean var12 = false; + + try { + var12 = true; + if(!NetworkManager.isRunning(this.netManager)) { + var12 = false; + break; + } + + if(NetworkManager.isServerTerminating(this.netManager)) { + var12 = false; + break; + } + + while(NetworkManager.readNetworkPacket(this.netManager)) { + } + + try { + sleep(100L); + } catch (InterruptedException var15) { + } + } finally { + if(var12) { + Object var5 = NetworkManager.threadSyncObject; + synchronized(var5) { + --NetworkManager.numReadThreads; + } + } + } + } + + var1 = NetworkManager.threadSyncObject; + synchronized(var1) { + --NetworkManager.numReadThreads; + } + } +} diff --git a/src/net/minecraft/src/NetworkWriterThread.java b/src/net/minecraft/src/NetworkWriterThread.java new file mode 100644 index 0000000..83fd579 --- /dev/null +++ b/src/net/minecraft/src/NetworkWriterThread.java @@ -0,0 +1,63 @@ +package net.minecraft.src; + +import java.io.IOException; + +class NetworkWriterThread extends Thread { + final NetworkManager netManager; + + NetworkWriterThread(NetworkManager var1, String var2) { + super(var2); + this.netManager = var1; + } + + public void run() { + Object var1 = NetworkManager.threadSyncObject; + synchronized(var1) { + ++NetworkManager.numWriteThreads; + } + + while(true) { + boolean var13 = false; + + try { + var13 = true; + if(!NetworkManager.isRunning(this.netManager)) { + var13 = false; + break; + } + + while(NetworkManager.sendNetworkPacket(this.netManager)) { + } + + try { + sleep(100L); + } catch (InterruptedException var16) { + } + + try { + if(NetworkManager.func_28140_f(this.netManager) != null) { + NetworkManager.func_28140_f(this.netManager).flush(); + } + } catch (IOException var18) { + if(!NetworkManager.func_28138_e(this.netManager)) { + NetworkManager.func_30005_a(this.netManager, var18); + } + + var18.printStackTrace(); + } + } finally { + if(var13) { + Object var5 = NetworkManager.threadSyncObject; + synchronized(var5) { + --NetworkManager.numWriteThreads; + } + } + } + } + + var1 = NetworkManager.threadSyncObject; + synchronized(var1) { + --NetworkManager.numWriteThreads; + } + } +} diff --git a/src/net/minecraft/src/NextTickListEntry.java b/src/net/minecraft/src/NextTickListEntry.java new file mode 100644 index 0000000..1783a28 --- /dev/null +++ b/src/net/minecraft/src/NextTickListEntry.java @@ -0,0 +1,44 @@ +package net.minecraft.src; + +public class NextTickListEntry implements Comparable { + private static long nextTickEntryID = 0L; + public int xCoord; + public int yCoord; + public int zCoord; + public int blockID; + public long scheduledTime; + private long tickEntryID = nextTickEntryID++; + + public NextTickListEntry(int var1, int var2, int var3, int var4) { + this.xCoord = var1; + this.yCoord = var2; + this.zCoord = var3; + this.blockID = var4; + } + + public boolean equals(Object var1) { + if(!(var1 instanceof NextTickListEntry)) { + return false; + } else { + NextTickListEntry var2 = (NextTickListEntry)var1; + return this.xCoord == var2.xCoord && this.yCoord == var2.yCoord && this.zCoord == var2.zCoord && this.blockID == var2.blockID; + } + } + + public int hashCode() { + return (this.xCoord * 128 * 1024 + this.zCoord * 128 + this.yCoord) * 256 + this.blockID; + } + + public NextTickListEntry setScheduledTime(long var1) { + this.scheduledTime = var1; + return this; + } + + public int comparer(NextTickListEntry var1) { + return this.scheduledTime < var1.scheduledTime ? -1 : (this.scheduledTime > var1.scheduledTime ? 1 : (this.tickEntryID < var1.tickEntryID ? -1 : (this.tickEntryID > var1.tickEntryID ? 1 : 0))); + } + + public int compareTo(Object var1) { + return this.comparer((NextTickListEntry)var1); + } +} diff --git a/src/net/minecraft/src/NibbleArray.java b/src/net/minecraft/src/NibbleArray.java new file mode 100644 index 0000000..6966128 --- /dev/null +++ b/src/net/minecraft/src/NibbleArray.java @@ -0,0 +1,36 @@ +package net.minecraft.src; + +public class NibbleArray { + public final byte[] data; + + public NibbleArray(int var1) { + this.data = new byte[var1 >> 1]; + } + + public NibbleArray(byte[] var1) { + this.data = var1; + } + + public int getNibble(int var1, int var2, int var3) { + int var4 = var1 << 11 | var3 << 7 | var2; + int var5 = var4 >> 1; + int var6 = var4 & 1; + return var6 == 0 ? this.data[var5] & 15 : this.data[var5] >> 4 & 15; + } + + public void setNibble(int var1, int var2, int var3, int var4) { + int var5 = var1 << 11 | var3 << 7 | var2; + int var6 = var5 >> 1; + int var7 = var5 & 1; + if(var7 == 0) { + this.data[var6] = (byte)(this.data[var6] & 240 | var4 & 15); + } else { + this.data[var6] = (byte)(this.data[var6] & 15 | (var4 & 15) << 4); + } + + } + + public boolean isValid() { + return this.data != null; + } +} diff --git a/src/net/minecraft/src/NoiseGenerator.java b/src/net/minecraft/src/NoiseGenerator.java new file mode 100644 index 0000000..bb08431 --- /dev/null +++ b/src/net/minecraft/src/NoiseGenerator.java @@ -0,0 +1,4 @@ +package net.minecraft.src; + +public abstract class NoiseGenerator { +} diff --git a/src/net/minecraft/src/NoiseGenerator2.java b/src/net/minecraft/src/NoiseGenerator2.java new file mode 100644 index 0000000..634bfc1 --- /dev/null +++ b/src/net/minecraft/src/NoiseGenerator2.java @@ -0,0 +1,114 @@ +package net.minecraft.src; + +import java.util.Random; + +public class NoiseGenerator2 { + private static int[][] field_4296_d = new int[][]{{1, 1, 0}, {-1, 1, 0}, {1, -1, 0}, {-1, -1, 0}, {1, 0, 1}, {-1, 0, 1}, {1, 0, -1}, {-1, 0, -1}, {0, 1, 1}, {0, -1, 1}, {0, 1, -1}, {0, -1, -1}}; + private int[] field_4295_e; + public double field_4292_a; + public double field_4291_b; + public double field_4297_c; + private static final double field_4294_f = 0.5D * (Math.sqrt(3.0D) - 1.0D); + private static final double field_4293_g = (3.0D - Math.sqrt(3.0D)) / 6.0D; + + public NoiseGenerator2() { + this(new Random()); + } + + public NoiseGenerator2(Random var1) { + this.field_4295_e = new int[512]; + this.field_4292_a = var1.nextDouble() * 256.0D; + this.field_4291_b = var1.nextDouble() * 256.0D; + this.field_4297_c = var1.nextDouble() * 256.0D; + + int var2; + for(var2 = 0; var2 < 256; this.field_4295_e[var2] = var2++) { + } + + for(var2 = 0; var2 < 256; ++var2) { + int var3 = var1.nextInt(256 - var2) + var2; + int var4 = this.field_4295_e[var2]; + this.field_4295_e[var2] = this.field_4295_e[var3]; + this.field_4295_e[var3] = var4; + this.field_4295_e[var2 + 256] = this.field_4295_e[var2]; + } + + } + + private static int wrap(double var0) { + return var0 > 0.0D ? (int)var0 : (int)var0 - 1; + } + + private static double func_4156_a(int[] var0, double var1, double var3) { + return (double)var0[0] * var1 + (double)var0[1] * var3; + } + + public void func_4157_a(double[] var1, double var2, double var4, int var6, int var7, double var8, double var10, double var12) { + int var14 = 0; + + for(int var15 = 0; var15 < var6; ++var15) { + double var16 = (var2 + (double)var15) * var8 + this.field_4292_a; + + for(int var18 = 0; var18 < var7; ++var18) { + double var19 = (var4 + (double)var18) * var10 + this.field_4291_b; + double var27 = (var16 + var19) * field_4294_f; + int var29 = wrap(var16 + var27); + int var30 = wrap(var19 + var27); + double var31 = (double)(var29 + var30) * field_4293_g; + double var33 = (double)var29 - var31; + double var35 = (double)var30 - var31; + double var37 = var16 - var33; + double var39 = var19 - var35; + byte var41; + byte var42; + if(var37 > var39) { + var41 = 1; + var42 = 0; + } else { + var41 = 0; + var42 = 1; + } + + double var43 = var37 - (double)var41 + field_4293_g; + double var45 = var39 - (double)var42 + field_4293_g; + double var47 = var37 - 1.0D + 2.0D * field_4293_g; + double var49 = var39 - 1.0D + 2.0D * field_4293_g; + int var51 = var29 & 255; + int var52 = var30 & 255; + int var53 = this.field_4295_e[var51 + this.field_4295_e[var52]] % 12; + int var54 = this.field_4295_e[var51 + var41 + this.field_4295_e[var52 + var42]] % 12; + int var55 = this.field_4295_e[var51 + 1 + this.field_4295_e[var52 + 1]] % 12; + double var56 = 0.5D - var37 * var37 - var39 * var39; + double var21; + if(var56 < 0.0D) { + var21 = 0.0D; + } else { + var56 *= var56; + var21 = var56 * var56 * func_4156_a(field_4296_d[var53], var37, var39); + } + + double var58 = 0.5D - var43 * var43 - var45 * var45; + double var23; + if(var58 < 0.0D) { + var23 = 0.0D; + } else { + var58 *= var58; + var23 = var58 * var58 * func_4156_a(field_4296_d[var54], var43, var45); + } + + double var60 = 0.5D - var47 * var47 - var49 * var49; + double var25; + if(var60 < 0.0D) { + var25 = 0.0D; + } else { + var60 *= var60; + var25 = var60 * var60 * func_4156_a(field_4296_d[var55], var47, var49); + } + + int var10001 = var14++; + var1[var10001] += 70.0D * (var21 + var23 + var25) * var12; + } + } + + } +} diff --git a/src/net/minecraft/src/NoiseGeneratorOctaves.java b/src/net/minecraft/src/NoiseGeneratorOctaves.java new file mode 100644 index 0000000..28ae73d --- /dev/null +++ b/src/net/minecraft/src/NoiseGeneratorOctaves.java @@ -0,0 +1,53 @@ +package net.minecraft.src; + +import java.util.Random; + +public class NoiseGeneratorOctaves extends NoiseGenerator { + private NoiseGeneratorPerlin[] generatorCollection; + private int field_1191_b; + + public NoiseGeneratorOctaves(Random var1, int var2) { + this.field_1191_b = var2; + this.generatorCollection = new NoiseGeneratorPerlin[var2]; + + for(int var3 = 0; var3 < var2; ++var3) { + this.generatorCollection[var3] = new NoiseGeneratorPerlin(var1); + } + + } + + public double func_806_a(double var1, double var3) { + double var5 = 0.0D; + double var7 = 1.0D; + + for(int var9 = 0; var9 < this.field_1191_b; ++var9) { + var5 += this.generatorCollection[var9].func_801_a(var1 * var7, var3 * var7) / var7; + var7 /= 2.0D; + } + + return var5; + } + + public double[] generateNoiseOctaves(double[] var1, double var2, double var4, double var6, int var8, int var9, int var10, double var11, double var13, double var15) { + if(var1 == null) { + var1 = new double[var8 * var9 * var10]; + } else { + for(int var17 = 0; var17 < var1.length; ++var17) { + var1[var17] = 0.0D; + } + } + + double var20 = 1.0D; + + for(int var19 = 0; var19 < this.field_1191_b; ++var19) { + this.generatorCollection[var19].func_805_a(var1, var2, var4, var6, var8, var9, var10, var11 * var20, var13 * var20, var15 * var20, var20); + var20 /= 2.0D; + } + + return var1; + } + + public double[] func_4109_a(double[] var1, int var2, int var3, int var4, int var5, double var6, double var8, double var10) { + return this.generateNoiseOctaves(var1, (double)var2, 10.0D, (double)var3, var4, 1, var5, var6, 1.0D, var8); + } +} diff --git a/src/net/minecraft/src/NoiseGeneratorOctaves2.java b/src/net/minecraft/src/NoiseGeneratorOctaves2.java new file mode 100644 index 0000000..8424a7b --- /dev/null +++ b/src/net/minecraft/src/NoiseGeneratorOctaves2.java @@ -0,0 +1,45 @@ +package net.minecraft.src; + +import java.util.Random; + +public class NoiseGeneratorOctaves2 extends NoiseGenerator { + private NoiseGenerator2[] field_4234_a; + private int field_4233_b; + + public NoiseGeneratorOctaves2(Random var1, int var2) { + this.field_4233_b = var2; + this.field_4234_a = new NoiseGenerator2[var2]; + + for(int var3 = 0; var3 < var2; ++var3) { + this.field_4234_a[var3] = new NoiseGenerator2(var1); + } + + } + + public double[] func_4112_a(double[] var1, double var2, double var4, int var6, int var7, double var8, double var10, double var12) { + return this.func_4111_a(var1, var2, var4, var6, var7, var8, var10, var12, 0.5D); + } + + public double[] func_4111_a(double[] var1, double var2, double var4, int var6, int var7, double var8, double var10, double var12, double var14) { + var8 /= 1.5D; + var10 /= 1.5D; + if(var1 != null && var1.length >= var6 * var7) { + for(int var16 = 0; var16 < var1.length; ++var16) { + var1[var16] = 0.0D; + } + } else { + var1 = new double[var6 * var7]; + } + + double var21 = 1.0D; + double var18 = 1.0D; + + for(int var20 = 0; var20 < this.field_4233_b; ++var20) { + this.field_4234_a[var20].func_4157_a(var1, var2, var4, var6, var7, var8 * var18, var10 * var18, 0.55D / var21); + var18 *= var12; + var21 *= var14; + } + + return var1; + } +} diff --git a/src/net/minecraft/src/NoiseGeneratorPerlin.java b/src/net/minecraft/src/NoiseGeneratorPerlin.java new file mode 100644 index 0000000..ceec127 --- /dev/null +++ b/src/net/minecraft/src/NoiseGeneratorPerlin.java @@ -0,0 +1,221 @@ +package net.minecraft.src; + +import java.util.Random; + +public class NoiseGeneratorPerlin extends NoiseGenerator { + private int[] permutations; + public double xCoord; + public double yCoord; + public double zCoord; + + public NoiseGeneratorPerlin() { + this(new Random()); + } + + public NoiseGeneratorPerlin(Random var1) { + this.permutations = new int[512]; + this.xCoord = var1.nextDouble() * 256.0D; + this.yCoord = var1.nextDouble() * 256.0D; + this.zCoord = var1.nextDouble() * 256.0D; + + int var2; + for(var2 = 0; var2 < 256; this.permutations[var2] = var2++) { + } + + for(var2 = 0; var2 < 256; ++var2) { + int var3 = var1.nextInt(256 - var2) + var2; + int var4 = this.permutations[var2]; + this.permutations[var2] = this.permutations[var3]; + this.permutations[var3] = var4; + this.permutations[var2 + 256] = this.permutations[var2]; + } + + } + + public double generateNoise(double var1, double var3, double var5) { + double var7 = var1 + this.xCoord; + double var9 = var3 + this.yCoord; + double var11 = var5 + this.zCoord; + int var13 = (int)var7; + int var14 = (int)var9; + int var15 = (int)var11; + if(var7 < (double)var13) { + --var13; + } + + if(var9 < (double)var14) { + --var14; + } + + if(var11 < (double)var15) { + --var15; + } + + int var16 = var13 & 255; + int var17 = var14 & 255; + int var18 = var15 & 255; + var7 -= (double)var13; + var9 -= (double)var14; + var11 -= (double)var15; + double var19 = var7 * var7 * var7 * (var7 * (var7 * 6.0D - 15.0D) + 10.0D); + double var21 = var9 * var9 * var9 * (var9 * (var9 * 6.0D - 15.0D) + 10.0D); + double var23 = var11 * var11 * var11 * (var11 * (var11 * 6.0D - 15.0D) + 10.0D); + int var25 = this.permutations[var16] + var17; + int var26 = this.permutations[var25] + var18; + int var27 = this.permutations[var25 + 1] + var18; + int var28 = this.permutations[var16 + 1] + var17; + int var29 = this.permutations[var28] + var18; + int var30 = this.permutations[var28 + 1] + var18; + return this.lerp(var23, this.lerp(var21, this.lerp(var19, this.grad(this.permutations[var26], var7, var9, var11), this.grad(this.permutations[var29], var7 - 1.0D, var9, var11)), this.lerp(var19, this.grad(this.permutations[var27], var7, var9 - 1.0D, var11), this.grad(this.permutations[var30], var7 - 1.0D, var9 - 1.0D, var11))), this.lerp(var21, this.lerp(var19, this.grad(this.permutations[var26 + 1], var7, var9, var11 - 1.0D), this.grad(this.permutations[var29 + 1], var7 - 1.0D, var9, var11 - 1.0D)), this.lerp(var19, this.grad(this.permutations[var27 + 1], var7, var9 - 1.0D, var11 - 1.0D), this.grad(this.permutations[var30 + 1], var7 - 1.0D, var9 - 1.0D, var11 - 1.0D)))); + } + + public final double lerp(double var1, double var3, double var5) { + return var3 + var1 * (var5 - var3); + } + + public final double func_4110_a(int var1, double var2, double var4) { + int var6 = var1 & 15; + double var7 = (double)(1 - ((var6 & 8) >> 3)) * var2; + double var9 = var6 < 4 ? 0.0D : (var6 != 12 && var6 != 14 ? var4 : var2); + return ((var6 & 1) == 0 ? var7 : -var7) + ((var6 & 2) == 0 ? var9 : -var9); + } + + public final double grad(int var1, double var2, double var4, double var6) { + int var8 = var1 & 15; + double var9 = var8 < 8 ? var2 : var4; + double var11 = var8 < 4 ? var4 : (var8 != 12 && var8 != 14 ? var6 : var2); + return ((var8 & 1) == 0 ? var9 : -var9) + ((var8 & 2) == 0 ? var11 : -var11); + } + + public double func_801_a(double var1, double var3) { + return this.generateNoise(var1, var3, 0.0D); + } + + public void func_805_a(double[] var1, double var2, double var4, double var6, int var8, int var9, int var10, double var11, double var13, double var15, double var17) { + int var10001; + int var19; + int var22; + double var31; + double var35; + int var37; + double var38; + int var40; + int var41; + double var42; + int var75; + if(var9 == 1) { + boolean var64 = false; + boolean var65 = false; + boolean var21 = false; + boolean var68 = false; + double var70 = 0.0D; + double var73 = 0.0D; + var75 = 0; + double var77 = 1.0D / var17; + + for(int var30 = 0; var30 < var8; ++var30) { + var31 = (var2 + (double)var30) * var11 + this.xCoord; + int var78 = (int)var31; + if(var31 < (double)var78) { + --var78; + } + + int var34 = var78 & 255; + var31 -= (double)var78; + var35 = var31 * var31 * var31 * (var31 * (var31 * 6.0D - 15.0D) + 10.0D); + + for(var37 = 0; var37 < var10; ++var37) { + var38 = (var6 + (double)var37) * var15 + this.zCoord; + var40 = (int)var38; + if(var38 < (double)var40) { + --var40; + } + + var41 = var40 & 255; + var38 -= (double)var40; + var42 = var38 * var38 * var38 * (var38 * (var38 * 6.0D - 15.0D) + 10.0D); + var19 = this.permutations[var34] + 0; + int var66 = this.permutations[var19] + var41; + int var67 = this.permutations[var34 + 1] + 0; + var22 = this.permutations[var67] + var41; + var70 = this.lerp(var35, this.func_4110_a(this.permutations[var66], var31, var38), this.grad(this.permutations[var22], var31 - 1.0D, 0.0D, var38)); + var73 = this.lerp(var35, this.grad(this.permutations[var66 + 1], var31, 0.0D, var38 - 1.0D), this.grad(this.permutations[var22 + 1], var31 - 1.0D, 0.0D, var38 - 1.0D)); + double var79 = this.lerp(var42, var70, var73); + var10001 = var75++; + var1[var10001] += var79 * var77; + } + } + + } else { + var19 = 0; + double var20 = 1.0D / var17; + var22 = -1; + boolean var23 = false; + boolean var24 = false; + boolean var25 = false; + boolean var26 = false; + boolean var27 = false; + boolean var28 = false; + double var29 = 0.0D; + var31 = 0.0D; + double var33 = 0.0D; + var35 = 0.0D; + + for(var37 = 0; var37 < var8; ++var37) { + var38 = (var2 + (double)var37) * var11 + this.xCoord; + var40 = (int)var38; + if(var38 < (double)var40) { + --var40; + } + + var41 = var40 & 255; + var38 -= (double)var40; + var42 = var38 * var38 * var38 * (var38 * (var38 * 6.0D - 15.0D) + 10.0D); + + for(int var44 = 0; var44 < var10; ++var44) { + double var45 = (var6 + (double)var44) * var15 + this.zCoord; + int var47 = (int)var45; + if(var45 < (double)var47) { + --var47; + } + + int var48 = var47 & 255; + var45 -= (double)var47; + double var49 = var45 * var45 * var45 * (var45 * (var45 * 6.0D - 15.0D) + 10.0D); + + for(int var51 = 0; var51 < var9; ++var51) { + double var52 = (var4 + (double)var51) * var13 + this.yCoord; + int var54 = (int)var52; + if(var52 < (double)var54) { + --var54; + } + + int var55 = var54 & 255; + var52 -= (double)var54; + double var56 = var52 * var52 * var52 * (var52 * (var52 * 6.0D - 15.0D) + 10.0D); + if(var51 == 0 || var55 != var22) { + var22 = var55; + int var69 = this.permutations[var41] + var55; + int var71 = this.permutations[var69] + var48; + int var72 = this.permutations[var69 + 1] + var48; + int var74 = this.permutations[var41 + 1] + var55; + var75 = this.permutations[var74] + var48; + int var76 = this.permutations[var74 + 1] + var48; + var29 = this.lerp(var42, this.grad(this.permutations[var71], var38, var52, var45), this.grad(this.permutations[var75], var38 - 1.0D, var52, var45)); + var31 = this.lerp(var42, this.grad(this.permutations[var72], var38, var52 - 1.0D, var45), this.grad(this.permutations[var76], var38 - 1.0D, var52 - 1.0D, var45)); + var33 = this.lerp(var42, this.grad(this.permutations[var71 + 1], var38, var52, var45 - 1.0D), this.grad(this.permutations[var75 + 1], var38 - 1.0D, var52, var45 - 1.0D)); + var35 = this.lerp(var42, this.grad(this.permutations[var72 + 1], var38, var52 - 1.0D, var45 - 1.0D), this.grad(this.permutations[var76 + 1], var38 - 1.0D, var52 - 1.0D, var45 - 1.0D)); + } + + double var58 = this.lerp(var56, var29, var31); + double var60 = this.lerp(var56, var33, var35); + double var62 = this.lerp(var49, var58, var60); + var10001 = var19++; + var1[var10001] += var62 * var20; + } + } + } + + } + } +} diff --git a/src/net/minecraft/src/OpenGlCapsChecker.java b/src/net/minecraft/src/OpenGlCapsChecker.java new file mode 100644 index 0000000..35dfac3 --- /dev/null +++ b/src/net/minecraft/src/OpenGlCapsChecker.java @@ -0,0 +1,11 @@ +package net.minecraft.src; + +import org.lwjgl.opengl.GLContext; + +public class OpenGlCapsChecker { + private static boolean tryCheckOcclusionCapable = true; + + public boolean checkARBOcclusion() { + return tryCheckOcclusionCapable && GLContext.getCapabilities().GL_ARB_occlusion_query; + } +} diff --git a/src/net/minecraft/src/OsMap.java b/src/net/minecraft/src/OsMap.java new file mode 100644 index 0000000..357b9d4 --- /dev/null +++ b/src/net/minecraft/src/OsMap.java @@ -0,0 +1,28 @@ +package net.minecraft.src; + +class OsMap { + static final int[] field_1193_a = new int[EnumOS1.values().length]; + + static { + try { + field_1193_a[EnumOS1.linux.ordinal()] = 1; + } catch (NoSuchFieldError var4) { + } + + try { + field_1193_a[EnumOS1.solaris.ordinal()] = 2; + } catch (NoSuchFieldError var3) { + } + + try { + field_1193_a[EnumOS1.windows.ordinal()] = 3; + } catch (NoSuchFieldError var2) { + } + + try { + field_1193_a[EnumOS1.macos.ordinal()] = 4; + } catch (NoSuchFieldError var1) { + } + + } +} diff --git a/src/net/minecraft/src/Packet.java b/src/net/minecraft/src/Packet.java new file mode 100644 index 0000000..2cdf256 --- /dev/null +++ b/src/net/minecraft/src/Packet.java @@ -0,0 +1,196 @@ +package net.minecraft.src; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.EOFException; +import java.io.IOException; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +public abstract class Packet { + private static Map packetIdToClassMap = new HashMap(); + private static Map packetClassToIdMap = new HashMap(); + private static Set clientPacketIdList = new HashSet(); + private static Set serverPacketIdList = new HashSet(); + public final long creationTimeMillis = System.currentTimeMillis(); + public boolean isChunkDataPacket = false; + private static HashMap packetStats; + private static int totalPacketsCount; + + static void addIdClassMapping(int var0, boolean var1, boolean var2, Class var3) { + if(packetIdToClassMap.containsKey(Integer.valueOf(var0))) { + throw new IllegalArgumentException("Duplicate packet id:" + var0); + } else if(packetClassToIdMap.containsKey(var3)) { + throw new IllegalArgumentException("Duplicate packet class:" + var3); + } else { + packetIdToClassMap.put(Integer.valueOf(var0), var3); + packetClassToIdMap.put(var3, Integer.valueOf(var0)); + if(var1) { + clientPacketIdList.add(Integer.valueOf(var0)); + } + + if(var2) { + serverPacketIdList.add(Integer.valueOf(var0)); + } + + } + } + + public static Packet getNewPacket(int var0) { + try { + Class var1 = (Class)packetIdToClassMap.get(Integer.valueOf(var0)); + return var1 == null ? null : (Packet)var1.newInstance(); + } catch (Exception var2) { + var2.printStackTrace(); + System.out.println("Skipping packet with id " + var0); + return null; + } + } + + public final int getPacketId() { + return ((Integer)packetClassToIdMap.get(this.getClass())).intValue(); + } + + public static Packet readPacket(DataInputStream var0, boolean var1) throws IOException { + boolean var2 = false; + Packet var3 = null; + + int var6; + try { + var6 = var0.read(); + if(var6 == -1) { + return null; + } + + if(var1 && !serverPacketIdList.contains(Integer.valueOf(var6)) || !var1 && !clientPacketIdList.contains(Integer.valueOf(var6))) { + throw new IOException("Bad packet id " + var6); + } + + var3 = getNewPacket(var6); + if(var3 == null) { + throw new IOException("Bad packet id " + var6); + } + + var3.readPacketData(var0); + } catch (EOFException var5) { + System.out.println("Reached end of stream"); + return null; + } + + PacketCounter var4 = (PacketCounter)packetStats.get(Integer.valueOf(var6)); + if(var4 == null) { + var4 = new PacketCounter((Empty1)null); + packetStats.put(Integer.valueOf(var6), var4); + } + + var4.addPacket(var3.getPacketSize()); + ++totalPacketsCount; + if(totalPacketsCount % 1000 == 0) { + } + + return var3; + } + + public static void writePacket(Packet var0, DataOutputStream var1) throws IOException { + var1.write(var0.getPacketId()); + var0.writePacketData(var1); + } + + public static void writeString(String var0, DataOutputStream var1) throws IOException { + if(var0.length() > Short.MAX_VALUE) { + throw new IOException("String too big"); + } else { + var1.writeShort(var0.length()); + var1.writeChars(var0); + } + } + + public static String readString(DataInputStream var0, int var1) throws IOException { + short var2 = var0.readShort(); + if(var2 > var1) { + throw new IOException("Received string length longer than maximum allowed (" + var2 + " > " + var1 + ")"); + } else if(var2 < 0) { + throw new IOException("Received string length is less than zero! Weird string!"); + } else { + StringBuilder var3 = new StringBuilder(); + + for(int var4 = 0; var4 < var2; ++var4) { + var3.append(var0.readChar()); + } + + return var3.toString(); + } + } + + public abstract void readPacketData(DataInputStream var1) throws IOException; + + public abstract void writePacketData(DataOutputStream var1) throws IOException; + + public abstract void processPacket(NetHandler var1); + + public abstract int getPacketSize(); + + static { + addIdClassMapping(0, true, true, Packet0KeepAlive.class); + addIdClassMapping(1, true, true, Packet1Login.class); + addIdClassMapping(2, true, true, Packet2Handshake.class); + addIdClassMapping(3, true, true, Packet3Chat.class); + addIdClassMapping(4, true, false, Packet4UpdateTime.class); + addIdClassMapping(5, true, false, Packet5PlayerInventory.class); + addIdClassMapping(6, true, false, Packet6SpawnPosition.class); + addIdClassMapping(7, false, true, Packet7UseEntity.class); + addIdClassMapping(8, true, false, Packet8UpdateHealth.class); + addIdClassMapping(9, true, true, Packet9Respawn.class); + addIdClassMapping(10, true, true, Packet10Flying.class); + addIdClassMapping(11, true, true, Packet11PlayerPosition.class); + addIdClassMapping(12, true, true, Packet12PlayerLook.class); + addIdClassMapping(13, true, true, Packet13PlayerLookMove.class); + addIdClassMapping(14, false, true, Packet14BlockDig.class); + addIdClassMapping(15, false, true, Packet15Place.class); + addIdClassMapping(16, false, true, Packet16BlockItemSwitch.class); + addIdClassMapping(17, true, false, Packet17Sleep.class); + addIdClassMapping(18, true, true, Packet18Animation.class); + addIdClassMapping(19, false, true, Packet19EntityAction.class); + addIdClassMapping(20, true, false, Packet20NamedEntitySpawn.class); + addIdClassMapping(21, true, false, Packet21PickupSpawn.class); + addIdClassMapping(22, true, false, Packet22Collect.class); + addIdClassMapping(23, true, false, Packet23VehicleSpawn.class); + addIdClassMapping(24, true, false, Packet24MobSpawn.class); + addIdClassMapping(25, true, false, Packet25EntityPainting.class); + addIdClassMapping(27, false, true, Packet27Position.class); + addIdClassMapping(28, true, false, Packet28EntityVelocity.class); + addIdClassMapping(29, true, false, Packet29DestroyEntity.class); + addIdClassMapping(30, true, false, Packet30Entity.class); + addIdClassMapping(31, true, false, Packet31RelEntityMove.class); + addIdClassMapping(32, true, false, Packet32EntityLook.class); + addIdClassMapping(33, true, false, Packet33RelEntityMoveLook.class); + addIdClassMapping(34, true, false, Packet34EntityTeleport.class); + addIdClassMapping(38, true, false, Packet38EntityStatus.class); + addIdClassMapping(39, true, false, Packet39AttachEntity.class); + addIdClassMapping(40, true, false, Packet40EntityMetadata.class); + addIdClassMapping(50, true, false, Packet50PreChunk.class); + addIdClassMapping(51, true, false, Packet51MapChunk.class); + addIdClassMapping(52, true, false, Packet52MultiBlockChange.class); + addIdClassMapping(53, true, false, Packet53BlockChange.class); + addIdClassMapping(54, true, false, Packet54PlayNoteBlock.class); + addIdClassMapping(60, true, false, Packet60Explosion.class); + addIdClassMapping(61, true, false, Packet61DoorChange.class); + addIdClassMapping(70, true, false, Packet70Bed.class); + addIdClassMapping(71, true, false, Packet71Weather.class); + addIdClassMapping(100, true, false, Packet100OpenWindow.class); + addIdClassMapping(101, true, true, Packet101CloseWindow.class); + addIdClassMapping(102, false, true, Packet102WindowClick.class); + addIdClassMapping(103, true, false, Packet103SetSlot.class); + addIdClassMapping(104, true, false, Packet104WindowItems.class); + addIdClassMapping(105, true, false, Packet105UpdateProgressbar.class); + addIdClassMapping(106, true, true, Packet106Transaction.class); + addIdClassMapping(130, true, true, Packet130UpdateSign.class); + addIdClassMapping(131, true, false, Packet131MapData.class); + addIdClassMapping(200, true, false, Packet200Statistic.class); + addIdClassMapping(255, true, true, Packet255KickDisconnect.class); + packetStats = new HashMap(); + totalPacketsCount = 0; + } +} diff --git a/src/net/minecraft/src/Packet0KeepAlive.java b/src/net/minecraft/src/Packet0KeepAlive.java new file mode 100644 index 0000000..08bfb61 --- /dev/null +++ b/src/net/minecraft/src/Packet0KeepAlive.java @@ -0,0 +1,20 @@ +package net.minecraft.src; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; + +public class Packet0KeepAlive extends Packet { + public void processPacket(NetHandler var1) { + } + + public void readPacketData(DataInputStream var1) throws IOException { + } + + public void writePacketData(DataOutputStream var1) throws IOException { + } + + public int getPacketSize() { + return 0; + } +} diff --git a/src/net/minecraft/src/Packet100OpenWindow.java b/src/net/minecraft/src/Packet100OpenWindow.java new file mode 100644 index 0000000..b7a83f7 --- /dev/null +++ b/src/net/minecraft/src/Packet100OpenWindow.java @@ -0,0 +1,34 @@ +package net.minecraft.src; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; + +public class Packet100OpenWindow extends Packet { + public int windowId; + public int inventoryType; + public String windowTitle; + public int slotsCount; + + public void processPacket(NetHandler var1) { + var1.func_20087_a(this); + } + + public void readPacketData(DataInputStream var1) throws IOException { + this.windowId = var1.readByte(); + this.inventoryType = var1.readByte(); + this.windowTitle = var1.readUTF(); + this.slotsCount = var1.readByte(); + } + + public void writePacketData(DataOutputStream var1) throws IOException { + var1.writeByte(this.windowId); + var1.writeByte(this.inventoryType); + var1.writeUTF(this.windowTitle); + var1.writeByte(this.slotsCount); + } + + public int getPacketSize() { + return 3 + this.windowTitle.length(); + } +} diff --git a/src/net/minecraft/src/Packet101CloseWindow.java b/src/net/minecraft/src/Packet101CloseWindow.java new file mode 100644 index 0000000..f580738 --- /dev/null +++ b/src/net/minecraft/src/Packet101CloseWindow.java @@ -0,0 +1,32 @@ +package net.minecraft.src; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; + +public class Packet101CloseWindow extends Packet { + public int windowId; + + public Packet101CloseWindow() { + } + + public Packet101CloseWindow(int var1) { + this.windowId = var1; + } + + public void processPacket(NetHandler var1) { + var1.func_20092_a(this); + } + + public void readPacketData(DataInputStream var1) throws IOException { + this.windowId = var1.readByte(); + } + + public void writePacketData(DataOutputStream var1) throws IOException { + var1.writeByte(this.windowId); + } + + public int getPacketSize() { + return 1; + } +} diff --git a/src/net/minecraft/src/Packet102WindowClick.java b/src/net/minecraft/src/Packet102WindowClick.java new file mode 100644 index 0000000..42bf048 --- /dev/null +++ b/src/net/minecraft/src/Packet102WindowClick.java @@ -0,0 +1,67 @@ +package net.minecraft.src; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; + +public class Packet102WindowClick extends Packet { + public int window_Id; + public int inventorySlot; + public int mouseClick; + public short action; + public ItemStack itemStack; + public boolean field_27050_f; + + public Packet102WindowClick() { + } + + public Packet102WindowClick(int var1, int var2, int var3, boolean var4, ItemStack var5, short var6) { + this.window_Id = var1; + this.inventorySlot = var2; + this.mouseClick = var3; + this.itemStack = var5; + this.action = var6; + this.field_27050_f = var4; + } + + public void processPacket(NetHandler var1) { + var1.func_20091_a(this); + } + + public void readPacketData(DataInputStream var1) throws IOException { + this.window_Id = var1.readByte(); + this.inventorySlot = var1.readShort(); + this.mouseClick = var1.readByte(); + this.action = var1.readShort(); + this.field_27050_f = var1.readBoolean(); + short var2 = var1.readShort(); + if(var2 >= 0) { + byte var3 = var1.readByte(); + short var4 = var1.readShort(); + this.itemStack = new ItemStack(var2, var3, var4); + } else { + this.itemStack = null; + } + + } + + public void writePacketData(DataOutputStream var1) throws IOException { + var1.writeByte(this.window_Id); + var1.writeShort(this.inventorySlot); + var1.writeByte(this.mouseClick); + var1.writeShort(this.action); + var1.writeBoolean(this.field_27050_f); + if(this.itemStack == null) { + var1.writeShort(-1); + } else { + var1.writeShort(this.itemStack.itemID); + var1.writeByte(this.itemStack.stackSize); + var1.writeShort(this.itemStack.getItemDamage()); + } + + } + + public int getPacketSize() { + return 11; + } +} diff --git a/src/net/minecraft/src/Packet103SetSlot.java b/src/net/minecraft/src/Packet103SetSlot.java new file mode 100644 index 0000000..e2c8f23 --- /dev/null +++ b/src/net/minecraft/src/Packet103SetSlot.java @@ -0,0 +1,46 @@ +package net.minecraft.src; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; + +public class Packet103SetSlot extends Packet { + public int windowId; + public int itemSlot; + public ItemStack myItemStack; + + public void processPacket(NetHandler var1) { + var1.func_20088_a(this); + } + + public void readPacketData(DataInputStream var1) throws IOException { + this.windowId = var1.readByte(); + this.itemSlot = var1.readShort(); + short var2 = var1.readShort(); + if(var2 >= 0) { + byte var3 = var1.readByte(); + short var4 = var1.readShort(); + this.myItemStack = new ItemStack(var2, var3, var4); + } else { + this.myItemStack = null; + } + + } + + public void writePacketData(DataOutputStream var1) throws IOException { + var1.writeByte(this.windowId); + var1.writeShort(this.itemSlot); + if(this.myItemStack == null) { + var1.writeShort(-1); + } else { + var1.writeShort(this.myItemStack.itemID); + var1.writeByte(this.myItemStack.stackSize); + var1.writeShort(this.myItemStack.getItemDamage()); + } + + } + + public int getPacketSize() { + return 8; + } +} diff --git a/src/net/minecraft/src/Packet104WindowItems.java b/src/net/minecraft/src/Packet104WindowItems.java new file mode 100644 index 0000000..1cd2c60 --- /dev/null +++ b/src/net/minecraft/src/Packet104WindowItems.java @@ -0,0 +1,50 @@ +package net.minecraft.src; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; + +public class Packet104WindowItems extends Packet { + public int windowId; + public ItemStack[] itemStack; + + public void readPacketData(DataInputStream var1) throws IOException { + this.windowId = var1.readByte(); + short var2 = var1.readShort(); + this.itemStack = new ItemStack[var2]; + + for(int var3 = 0; var3 < var2; ++var3) { + short var4 = var1.readShort(); + if(var4 >= 0) { + byte var5 = var1.readByte(); + short var6 = var1.readShort(); + this.itemStack[var3] = new ItemStack(var4, var5, var6); + } + } + + } + + public void writePacketData(DataOutputStream var1) throws IOException { + var1.writeByte(this.windowId); + var1.writeShort(this.itemStack.length); + + for(int var2 = 0; var2 < this.itemStack.length; ++var2) { + if(this.itemStack[var2] == null) { + var1.writeShort(-1); + } else { + var1.writeShort((short)this.itemStack[var2].itemID); + var1.writeByte((byte)this.itemStack[var2].stackSize); + var1.writeShort((short)this.itemStack[var2].getItemDamage()); + } + } + + } + + public void processPacket(NetHandler var1) { + var1.func_20094_a(this); + } + + public int getPacketSize() { + return 3 + this.itemStack.length * 5; + } +} diff --git a/src/net/minecraft/src/Packet105UpdateProgressbar.java b/src/net/minecraft/src/Packet105UpdateProgressbar.java new file mode 100644 index 0000000..42df19d --- /dev/null +++ b/src/net/minecraft/src/Packet105UpdateProgressbar.java @@ -0,0 +1,31 @@ +package net.minecraft.src; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; + +public class Packet105UpdateProgressbar extends Packet { + public int windowId; + public int progressBar; + public int progressBarValue; + + public void processPacket(NetHandler var1) { + var1.func_20090_a(this); + } + + public void readPacketData(DataInputStream var1) throws IOException { + this.windowId = var1.readByte(); + this.progressBar = var1.readShort(); + this.progressBarValue = var1.readShort(); + } + + public void writePacketData(DataOutputStream var1) throws IOException { + var1.writeByte(this.windowId); + var1.writeShort(this.progressBar); + var1.writeShort(this.progressBarValue); + } + + public int getPacketSize() { + return 5; + } +} diff --git a/src/net/minecraft/src/Packet106Transaction.java b/src/net/minecraft/src/Packet106Transaction.java new file mode 100644 index 0000000..38c5203 --- /dev/null +++ b/src/net/minecraft/src/Packet106Transaction.java @@ -0,0 +1,40 @@ +package net.minecraft.src; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; + +public class Packet106Transaction extends Packet { + public int windowId; + public short field_20028_b; + public boolean field_20030_c; + + public Packet106Transaction() { + } + + public Packet106Transaction(int var1, short var2, boolean var3) { + this.windowId = var1; + this.field_20028_b = var2; + this.field_20030_c = var3; + } + + public void processPacket(NetHandler var1) { + var1.func_20089_a(this); + } + + public void readPacketData(DataInputStream var1) throws IOException { + this.windowId = var1.readByte(); + this.field_20028_b = var1.readShort(); + this.field_20030_c = var1.readByte() != 0; + } + + public void writePacketData(DataOutputStream var1) throws IOException { + var1.writeByte(this.windowId); + var1.writeShort(this.field_20028_b); + var1.writeByte(this.field_20030_c ? 1 : 0); + } + + public int getPacketSize() { + return 4; + } +} diff --git a/src/net/minecraft/src/Packet10Flying.java b/src/net/minecraft/src/Packet10Flying.java new file mode 100644 index 0000000..1ab0a37 --- /dev/null +++ b/src/net/minecraft/src/Packet10Flying.java @@ -0,0 +1,40 @@ +package net.minecraft.src; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; + +public class Packet10Flying extends Packet { + public double xPosition; + public double yPosition; + public double zPosition; + public double stance; + public float yaw; + public float pitch; + public boolean onGround; + public boolean moving; + public boolean rotating; + + public Packet10Flying() { + } + + public Packet10Flying(boolean var1) { + this.onGround = var1; + } + + public void processPacket(NetHandler var1) { + var1.handleFlying(this); + } + + public void readPacketData(DataInputStream var1) throws IOException { + this.onGround = var1.read() != 0; + } + + public void writePacketData(DataOutputStream var1) throws IOException { + var1.write(this.onGround ? 1 : 0); + } + + public int getPacketSize() { + return 1; + } +} diff --git a/src/net/minecraft/src/Packet11PlayerPosition.java b/src/net/minecraft/src/Packet11PlayerPosition.java new file mode 100644 index 0000000..de9449c --- /dev/null +++ b/src/net/minecraft/src/Packet11PlayerPosition.java @@ -0,0 +1,40 @@ +package net.minecraft.src; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; + +public class Packet11PlayerPosition extends Packet10Flying { + public Packet11PlayerPosition() { + this.moving = true; + } + + public Packet11PlayerPosition(double var1, double var3, double var5, double var7, boolean var9) { + this.xPosition = var1; + this.yPosition = var3; + this.stance = var5; + this.zPosition = var7; + this.onGround = var9; + this.moving = true; + } + + public void readPacketData(DataInputStream var1) throws IOException { + this.xPosition = var1.readDouble(); + this.yPosition = var1.readDouble(); + this.stance = var1.readDouble(); + this.zPosition = var1.readDouble(); + super.readPacketData(var1); + } + + public void writePacketData(DataOutputStream var1) throws IOException { + var1.writeDouble(this.xPosition); + var1.writeDouble(this.yPosition); + var1.writeDouble(this.stance); + var1.writeDouble(this.zPosition); + super.writePacketData(var1); + } + + public int getPacketSize() { + return 33; + } +} diff --git a/src/net/minecraft/src/Packet12PlayerLook.java b/src/net/minecraft/src/Packet12PlayerLook.java new file mode 100644 index 0000000..9a20f39 --- /dev/null +++ b/src/net/minecraft/src/Packet12PlayerLook.java @@ -0,0 +1,34 @@ +package net.minecraft.src; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; + +public class Packet12PlayerLook extends Packet10Flying { + public Packet12PlayerLook() { + this.rotating = true; + } + + public Packet12PlayerLook(float var1, float var2, boolean var3) { + this.yaw = var1; + this.pitch = var2; + this.onGround = var3; + this.rotating = true; + } + + public void readPacketData(DataInputStream var1) throws IOException { + this.yaw = var1.readFloat(); + this.pitch = var1.readFloat(); + super.readPacketData(var1); + } + + public void writePacketData(DataOutputStream var1) throws IOException { + var1.writeFloat(this.yaw); + var1.writeFloat(this.pitch); + super.writePacketData(var1); + } + + public int getPacketSize() { + return 9; + } +} diff --git a/src/net/minecraft/src/Packet130UpdateSign.java b/src/net/minecraft/src/Packet130UpdateSign.java new file mode 100644 index 0000000..06c11ff --- /dev/null +++ b/src/net/minecraft/src/Packet130UpdateSign.java @@ -0,0 +1,61 @@ +package net.minecraft.src; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; + +public class Packet130UpdateSign extends Packet { + public int xPosition; + public int yPosition; + public int zPosition; + public String[] signLines; + + public Packet130UpdateSign() { + this.isChunkDataPacket = true; + } + + public Packet130UpdateSign(int var1, int var2, int var3, String[] var4) { + this.isChunkDataPacket = true; + this.xPosition = var1; + this.yPosition = var2; + this.zPosition = var3; + this.signLines = var4; + } + + public void readPacketData(DataInputStream var1) throws IOException { + this.xPosition = var1.readInt(); + this.yPosition = var1.readShort(); + this.zPosition = var1.readInt(); + this.signLines = new String[4]; + + for(int var2 = 0; var2 < 4; ++var2) { + this.signLines[var2] = readString(var1, 15); + } + + } + + public void writePacketData(DataOutputStream var1) throws IOException { + var1.writeInt(this.xPosition); + var1.writeShort(this.yPosition); + var1.writeInt(this.zPosition); + + for(int var2 = 0; var2 < 4; ++var2) { + writeString(this.signLines[var2], var1); + } + + } + + public void processPacket(NetHandler var1) { + var1.handleSignUpdate(this); + } + + public int getPacketSize() { + int var1 = 0; + + for(int var2 = 0; var2 < 4; ++var2) { + var1 += this.signLines[var2].length(); + } + + return var1; + } +} diff --git a/src/net/minecraft/src/Packet131MapData.java b/src/net/minecraft/src/Packet131MapData.java new file mode 100644 index 0000000..8fdc089 --- /dev/null +++ b/src/net/minecraft/src/Packet131MapData.java @@ -0,0 +1,37 @@ +package net.minecraft.src; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; + +public class Packet131MapData extends Packet { + public short field_28055_a; + public short field_28054_b; + public byte[] field_28056_c; + + public Packet131MapData() { + this.isChunkDataPacket = true; + } + + public void readPacketData(DataInputStream var1) throws IOException { + this.field_28055_a = var1.readShort(); + this.field_28054_b = var1.readShort(); + this.field_28056_c = new byte[var1.readByte() & 255]; + var1.readFully(this.field_28056_c); + } + + public void writePacketData(DataOutputStream var1) throws IOException { + var1.writeShort(this.field_28055_a); + var1.writeShort(this.field_28054_b); + var1.writeByte(this.field_28056_c.length); + var1.write(this.field_28056_c); + } + + public void processPacket(NetHandler var1) { + var1.func_28116_a(this); + } + + public int getPacketSize() { + return 4 + this.field_28056_c.length; + } +} diff --git a/src/net/minecraft/src/Packet13PlayerLookMove.java b/src/net/minecraft/src/Packet13PlayerLookMove.java new file mode 100644 index 0000000..db7001e --- /dev/null +++ b/src/net/minecraft/src/Packet13PlayerLookMove.java @@ -0,0 +1,48 @@ +package net.minecraft.src; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; + +public class Packet13PlayerLookMove extends Packet10Flying { + public Packet13PlayerLookMove() { + this.rotating = true; + this.moving = true; + } + + public Packet13PlayerLookMove(double var1, double var3, double var5, double var7, float var9, float var10, boolean var11) { + this.xPosition = var1; + this.yPosition = var3; + this.stance = var5; + this.zPosition = var7; + this.yaw = var9; + this.pitch = var10; + this.onGround = var11; + this.rotating = true; + this.moving = true; + } + + public void readPacketData(DataInputStream var1) throws IOException { + this.xPosition = var1.readDouble(); + this.yPosition = var1.readDouble(); + this.stance = var1.readDouble(); + this.zPosition = var1.readDouble(); + this.yaw = var1.readFloat(); + this.pitch = var1.readFloat(); + super.readPacketData(var1); + } + + public void writePacketData(DataOutputStream var1) throws IOException { + var1.writeDouble(this.xPosition); + var1.writeDouble(this.yPosition); + var1.writeDouble(this.stance); + var1.writeDouble(this.zPosition); + var1.writeFloat(this.yaw); + var1.writeFloat(this.pitch); + super.writePacketData(var1); + } + + public int getPacketSize() { + return 41; + } +} diff --git a/src/net/minecraft/src/Packet14BlockDig.java b/src/net/minecraft/src/Packet14BlockDig.java new file mode 100644 index 0000000..336de4a --- /dev/null +++ b/src/net/minecraft/src/Packet14BlockDig.java @@ -0,0 +1,48 @@ +package net.minecraft.src; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; + +public class Packet14BlockDig extends Packet { + public int xPosition; + public int yPosition; + public int zPosition; + public int face; + public int status; + + public Packet14BlockDig() { + } + + public Packet14BlockDig(int var1, int var2, int var3, int var4, int var5) { + this.status = var1; + this.xPosition = var2; + this.yPosition = var3; + this.zPosition = var4; + this.face = var5; + } + + public void readPacketData(DataInputStream var1) throws IOException { + this.status = var1.read(); + this.xPosition = var1.readInt(); + this.yPosition = var1.read(); + this.zPosition = var1.readInt(); + this.face = var1.read(); + } + + public void writePacketData(DataOutputStream var1) throws IOException { + var1.write(this.status); + var1.writeInt(this.xPosition); + var1.write(this.yPosition); + var1.writeInt(this.zPosition); + var1.write(this.face); + } + + public void processPacket(NetHandler var1) { + var1.handleBlockDig(this); + } + + public int getPacketSize() { + return 11; + } +} diff --git a/src/net/minecraft/src/Packet15Place.java b/src/net/minecraft/src/Packet15Place.java new file mode 100644 index 0000000..e656836 --- /dev/null +++ b/src/net/minecraft/src/Packet15Place.java @@ -0,0 +1,63 @@ +package net.minecraft.src; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; + +public class Packet15Place extends Packet { + public int xPosition; + public int yPosition; + public int zPosition; + public int direction; + public ItemStack itemStack; + + public Packet15Place() { + } + + public Packet15Place(int var1, int var2, int var3, int var4, ItemStack var5) { + this.xPosition = var1; + this.yPosition = var2; + this.zPosition = var3; + this.direction = var4; + this.itemStack = var5; + } + + public void readPacketData(DataInputStream var1) throws IOException { + this.xPosition = var1.readInt(); + this.yPosition = var1.read(); + this.zPosition = var1.readInt(); + this.direction = var1.read(); + short var2 = var1.readShort(); + if(var2 >= 0) { + byte var3 = var1.readByte(); + short var4 = var1.readShort(); + this.itemStack = new ItemStack(var2, var3, var4); + } else { + this.itemStack = null; + } + + } + + public void writePacketData(DataOutputStream var1) throws IOException { + var1.writeInt(this.xPosition); + var1.write(this.yPosition); + var1.writeInt(this.zPosition); + var1.write(this.direction); + if(this.itemStack == null) { + var1.writeShort(-1); + } else { + var1.writeShort(this.itemStack.itemID); + var1.writeByte(this.itemStack.stackSize); + var1.writeShort(this.itemStack.getItemDamage()); + } + + } + + public void processPacket(NetHandler var1) { + var1.handlePlace(this); + } + + public int getPacketSize() { + return 15; + } +} diff --git a/src/net/minecraft/src/Packet16BlockItemSwitch.java b/src/net/minecraft/src/Packet16BlockItemSwitch.java new file mode 100644 index 0000000..efeab76 --- /dev/null +++ b/src/net/minecraft/src/Packet16BlockItemSwitch.java @@ -0,0 +1,32 @@ +package net.minecraft.src; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; + +public class Packet16BlockItemSwitch extends Packet { + public int id; + + public Packet16BlockItemSwitch() { + } + + public Packet16BlockItemSwitch(int var1) { + this.id = var1; + } + + public void readPacketData(DataInputStream var1) throws IOException { + this.id = var1.readShort(); + } + + public void writePacketData(DataOutputStream var1) throws IOException { + var1.writeShort(this.id); + } + + public void processPacket(NetHandler var1) { + var1.handleBlockItemSwitch(this); + } + + public int getPacketSize() { + return 2; + } +} diff --git a/src/net/minecraft/src/Packet17Sleep.java b/src/net/minecraft/src/Packet17Sleep.java new file mode 100644 index 0000000..01a829e --- /dev/null +++ b/src/net/minecraft/src/Packet17Sleep.java @@ -0,0 +1,37 @@ +package net.minecraft.src; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; + +public class Packet17Sleep extends Packet { + public int field_22045_a; + public int field_22044_b; + public int field_22048_c; + public int field_22047_d; + public int field_22046_e; + + public void readPacketData(DataInputStream var1) throws IOException { + this.field_22045_a = var1.readInt(); + this.field_22046_e = var1.readByte(); + this.field_22044_b = var1.readInt(); + this.field_22048_c = var1.readByte(); + this.field_22047_d = var1.readInt(); + } + + public void writePacketData(DataOutputStream var1) throws IOException { + var1.writeInt(this.field_22045_a); + var1.writeByte(this.field_22046_e); + var1.writeInt(this.field_22044_b); + var1.writeByte(this.field_22048_c); + var1.writeInt(this.field_22047_d); + } + + public void processPacket(NetHandler var1) { + var1.func_22186_a(this); + } + + public int getPacketSize() { + return 14; + } +} diff --git a/src/net/minecraft/src/Packet18Animation.java b/src/net/minecraft/src/Packet18Animation.java new file mode 100644 index 0000000..7bf60e9 --- /dev/null +++ b/src/net/minecraft/src/Packet18Animation.java @@ -0,0 +1,36 @@ +package net.minecraft.src; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; + +public class Packet18Animation extends Packet { + public int entityId; + public int animate; + + public Packet18Animation() { + } + + public Packet18Animation(Entity var1, int var2) { + this.entityId = var1.entityId; + this.animate = var2; + } + + public void readPacketData(DataInputStream var1) throws IOException { + this.entityId = var1.readInt(); + this.animate = var1.readByte(); + } + + public void writePacketData(DataOutputStream var1) throws IOException { + var1.writeInt(this.entityId); + var1.writeByte(this.animate); + } + + public void processPacket(NetHandler var1) { + var1.handleArmAnimation(this); + } + + public int getPacketSize() { + return 5; + } +} diff --git a/src/net/minecraft/src/Packet19EntityAction.java b/src/net/minecraft/src/Packet19EntityAction.java new file mode 100644 index 0000000..8432ac5 --- /dev/null +++ b/src/net/minecraft/src/Packet19EntityAction.java @@ -0,0 +1,36 @@ +package net.minecraft.src; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; + +public class Packet19EntityAction extends Packet { + public int entityId; + public int state; + + public Packet19EntityAction() { + } + + public Packet19EntityAction(Entity var1, int var2) { + this.entityId = var1.entityId; + this.state = var2; + } + + public void readPacketData(DataInputStream var1) throws IOException { + this.entityId = var1.readInt(); + this.state = var1.readByte(); + } + + public void writePacketData(DataOutputStream var1) throws IOException { + var1.writeInt(this.entityId); + var1.writeByte(this.state); + } + + public void processPacket(NetHandler var1) { + var1.func_21147_a(this); + } + + public int getPacketSize() { + return 5; + } +} diff --git a/src/net/minecraft/src/Packet1Login.java b/src/net/minecraft/src/Packet1Login.java new file mode 100644 index 0000000..2c4d39c --- /dev/null +++ b/src/net/minecraft/src/Packet1Login.java @@ -0,0 +1,42 @@ +package net.minecraft.src; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; + +public class Packet1Login extends Packet { + public int protocolVersion; + public String username; + public long mapSeed; + public byte dimension; + + public Packet1Login() { + } + + public Packet1Login(String var1, int var2) { + this.username = var1; + this.protocolVersion = var2; + } + + public void readPacketData(DataInputStream var1) throws IOException { + this.protocolVersion = var1.readInt(); + this.username = readString(var1, 16); + this.mapSeed = var1.readLong(); + this.dimension = var1.readByte(); + } + + public void writePacketData(DataOutputStream var1) throws IOException { + var1.writeInt(this.protocolVersion); + writeString(this.username, var1); + var1.writeLong(this.mapSeed); + var1.writeByte(this.dimension); + } + + public void processPacket(NetHandler var1) { + var1.handleLogin(this); + } + + public int getPacketSize() { + return 4 + this.username.length() + 4 + 5; + } +} diff --git a/src/net/minecraft/src/Packet200Statistic.java b/src/net/minecraft/src/Packet200Statistic.java new file mode 100644 index 0000000..840cb5e --- /dev/null +++ b/src/net/minecraft/src/Packet200Statistic.java @@ -0,0 +1,28 @@ +package net.minecraft.src; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; + +public class Packet200Statistic extends Packet { + public int field_27052_a; + public int field_27051_b; + + public void processPacket(NetHandler var1) { + var1.func_27245_a(this); + } + + public void readPacketData(DataInputStream var1) throws IOException { + this.field_27052_a = var1.readInt(); + this.field_27051_b = var1.readByte(); + } + + public void writePacketData(DataOutputStream var1) throws IOException { + var1.writeInt(this.field_27052_a); + var1.writeByte(this.field_27051_b); + } + + public int getPacketSize() { + return 6; + } +} diff --git a/src/net/minecraft/src/Packet20NamedEntitySpawn.java b/src/net/minecraft/src/Packet20NamedEntitySpawn.java new file mode 100644 index 0000000..a189c0d --- /dev/null +++ b/src/net/minecraft/src/Packet20NamedEntitySpawn.java @@ -0,0 +1,61 @@ +package net.minecraft.src; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; + +public class Packet20NamedEntitySpawn extends Packet { + public int entityId; + public String name; + public int xPosition; + public int yPosition; + public int zPosition; + public byte rotation; + public byte pitch; + public int currentItem; + + public Packet20NamedEntitySpawn() { + } + + public Packet20NamedEntitySpawn(EntityPlayer var1) { + this.entityId = var1.entityId; + this.name = var1.username; + this.xPosition = MathHelper.floor_double(var1.posX * 32.0D); + this.yPosition = MathHelper.floor_double(var1.posY * 32.0D); + this.zPosition = MathHelper.floor_double(var1.posZ * 32.0D); + this.rotation = (byte)((int)(var1.rotationYaw * 256.0F / 360.0F)); + this.pitch = (byte)((int)(var1.rotationPitch * 256.0F / 360.0F)); + ItemStack var2 = var1.inventory.getCurrentItem(); + this.currentItem = var2 == null ? 0 : var2.itemID; + } + + public void readPacketData(DataInputStream var1) throws IOException { + this.entityId = var1.readInt(); + this.name = readString(var1, 16); + this.xPosition = var1.readInt(); + this.yPosition = var1.readInt(); + this.zPosition = var1.readInt(); + this.rotation = var1.readByte(); + this.pitch = var1.readByte(); + this.currentItem = var1.readShort(); + } + + public void writePacketData(DataOutputStream var1) throws IOException { + var1.writeInt(this.entityId); + writeString(this.name, var1); + var1.writeInt(this.xPosition); + var1.writeInt(this.yPosition); + var1.writeInt(this.zPosition); + var1.writeByte(this.rotation); + var1.writeByte(this.pitch); + var1.writeShort(this.currentItem); + } + + public void processPacket(NetHandler var1) { + var1.handleNamedEntitySpawn(this); + } + + public int getPacketSize() { + return 28; + } +} diff --git a/src/net/minecraft/src/Packet21PickupSpawn.java b/src/net/minecraft/src/Packet21PickupSpawn.java new file mode 100644 index 0000000..c4aee66 --- /dev/null +++ b/src/net/minecraft/src/Packet21PickupSpawn.java @@ -0,0 +1,68 @@ +package net.minecraft.src; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; + +public class Packet21PickupSpawn extends Packet { + public int entityId; + public int xPosition; + public int yPosition; + public int zPosition; + public byte rotation; + public byte pitch; + public byte roll; + public int itemID; + public int count; + public int itemDamage; + + public Packet21PickupSpawn() { + } + + public Packet21PickupSpawn(EntityItem var1) { + this.entityId = var1.entityId; + this.itemID = var1.item.itemID; + this.count = var1.item.stackSize; + this.itemDamage = var1.item.getItemDamage(); + this.xPosition = MathHelper.floor_double(var1.posX * 32.0D); + this.yPosition = MathHelper.floor_double(var1.posY * 32.0D); + this.zPosition = MathHelper.floor_double(var1.posZ * 32.0D); + this.rotation = (byte)((int)(var1.motionX * 128.0D)); + this.pitch = (byte)((int)(var1.motionY * 128.0D)); + this.roll = (byte)((int)(var1.motionZ * 128.0D)); + } + + public void readPacketData(DataInputStream var1) throws IOException { + this.entityId = var1.readInt(); + this.itemID = var1.readShort(); + this.count = var1.readByte(); + this.itemDamage = var1.readShort(); + this.xPosition = var1.readInt(); + this.yPosition = var1.readInt(); + this.zPosition = var1.readInt(); + this.rotation = var1.readByte(); + this.pitch = var1.readByte(); + this.roll = var1.readByte(); + } + + public void writePacketData(DataOutputStream var1) throws IOException { + var1.writeInt(this.entityId); + var1.writeShort(this.itemID); + var1.writeByte(this.count); + var1.writeShort(this.itemDamage); + var1.writeInt(this.xPosition); + var1.writeInt(this.yPosition); + var1.writeInt(this.zPosition); + var1.writeByte(this.rotation); + var1.writeByte(this.pitch); + var1.writeByte(this.roll); + } + + public void processPacket(NetHandler var1) { + var1.handlePickupSpawn(this); + } + + public int getPacketSize() { + return 24; + } +} diff --git a/src/net/minecraft/src/Packet22Collect.java b/src/net/minecraft/src/Packet22Collect.java new file mode 100644 index 0000000..81f2729 --- /dev/null +++ b/src/net/minecraft/src/Packet22Collect.java @@ -0,0 +1,28 @@ +package net.minecraft.src; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; + +public class Packet22Collect extends Packet { + public int collectedEntityId; + public int collectorEntityId; + + public void readPacketData(DataInputStream var1) throws IOException { + this.collectedEntityId = var1.readInt(); + this.collectorEntityId = var1.readInt(); + } + + public void writePacketData(DataOutputStream var1) throws IOException { + var1.writeInt(this.collectedEntityId); + var1.writeInt(this.collectorEntityId); + } + + public void processPacket(NetHandler var1) { + var1.handleCollect(this); + } + + public int getPacketSize() { + return 8; + } +} diff --git a/src/net/minecraft/src/Packet23VehicleSpawn.java b/src/net/minecraft/src/Packet23VehicleSpawn.java new file mode 100644 index 0000000..f77b5e0 --- /dev/null +++ b/src/net/minecraft/src/Packet23VehicleSpawn.java @@ -0,0 +1,55 @@ +package net.minecraft.src; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; + +public class Packet23VehicleSpawn extends Packet { + public int entityId; + public int xPosition; + public int yPosition; + public int zPosition; + public int field_28047_e; + public int field_28046_f; + public int field_28045_g; + public int type; + public int field_28044_i; + + public void readPacketData(DataInputStream var1) throws IOException { + this.entityId = var1.readInt(); + this.type = var1.readByte(); + this.xPosition = var1.readInt(); + this.yPosition = var1.readInt(); + this.zPosition = var1.readInt(); + this.field_28044_i = var1.readInt(); + if(this.field_28044_i > 0) { + this.field_28047_e = var1.readShort(); + this.field_28046_f = var1.readShort(); + this.field_28045_g = var1.readShort(); + } + + } + + public void writePacketData(DataOutputStream var1) throws IOException { + var1.writeInt(this.entityId); + var1.writeByte(this.type); + var1.writeInt(this.xPosition); + var1.writeInt(this.yPosition); + var1.writeInt(this.zPosition); + var1.writeInt(this.field_28044_i); + if(this.field_28044_i > 0) { + var1.writeShort(this.field_28047_e); + var1.writeShort(this.field_28046_f); + var1.writeShort(this.field_28045_g); + } + + } + + public void processPacket(NetHandler var1) { + var1.handleVehicleSpawn(this); + } + + public int getPacketSize() { + return 21 + this.field_28044_i > 0 ? 6 : 0; + } +} diff --git a/src/net/minecraft/src/Packet24MobSpawn.java b/src/net/minecraft/src/Packet24MobSpawn.java new file mode 100644 index 0000000..dc3477a --- /dev/null +++ b/src/net/minecraft/src/Packet24MobSpawn.java @@ -0,0 +1,66 @@ +package net.minecraft.src; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; +import java.util.List; + +public class Packet24MobSpawn extends Packet { + public int entityId; + public byte type; + public int xPosition; + public int yPosition; + public int zPosition; + public byte yaw; + public byte pitch; + private DataWatcher metaData; + private List receivedMetadata; + + public Packet24MobSpawn() { + } + + public Packet24MobSpawn(EntityLiving var1) { + this.entityId = var1.entityId; + this.type = (byte)EntityList.getEntityID(var1); + this.xPosition = MathHelper.floor_double(var1.posX * 32.0D); + this.yPosition = MathHelper.floor_double(var1.posY * 32.0D); + this.zPosition = MathHelper.floor_double(var1.posZ * 32.0D); + this.yaw = (byte)((int)(var1.rotationYaw * 256.0F / 360.0F)); + this.pitch = (byte)((int)(var1.rotationPitch * 256.0F / 360.0F)); + this.metaData = var1.getDataWatcher(); + } + + public void readPacketData(DataInputStream var1) throws IOException { + this.entityId = var1.readInt(); + this.type = var1.readByte(); + this.xPosition = var1.readInt(); + this.yPosition = var1.readInt(); + this.zPosition = var1.readInt(); + this.yaw = var1.readByte(); + this.pitch = var1.readByte(); + this.receivedMetadata = DataWatcher.readWatchableObjects(var1); + } + + public void writePacketData(DataOutputStream var1) throws IOException { + var1.writeInt(this.entityId); + var1.writeByte(this.type); + var1.writeInt(this.xPosition); + var1.writeInt(this.yPosition); + var1.writeInt(this.zPosition); + var1.writeByte(this.yaw); + var1.writeByte(this.pitch); + this.metaData.writeWatchableObjects(var1); + } + + public void processPacket(NetHandler var1) { + var1.handleMobSpawn(this); + } + + public int getPacketSize() { + return 20; + } + + public List getMetadata() { + return this.receivedMetadata; + } +} diff --git a/src/net/minecraft/src/Packet255KickDisconnect.java b/src/net/minecraft/src/Packet255KickDisconnect.java new file mode 100644 index 0000000..538c368 --- /dev/null +++ b/src/net/minecraft/src/Packet255KickDisconnect.java @@ -0,0 +1,32 @@ +package net.minecraft.src; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; + +public class Packet255KickDisconnect extends Packet { + public String reason; + + public Packet255KickDisconnect() { + } + + public Packet255KickDisconnect(String var1) { + this.reason = var1; + } + + public void readPacketData(DataInputStream var1) throws IOException { + this.reason = readString(var1, 100); + } + + public void writePacketData(DataOutputStream var1) throws IOException { + writeString(this.reason, var1); + } + + public void processPacket(NetHandler var1) { + var1.handleKickDisconnect(this); + } + + public int getPacketSize() { + return this.reason.length(); + } +} diff --git a/src/net/minecraft/src/Packet25EntityPainting.java b/src/net/minecraft/src/Packet25EntityPainting.java new file mode 100644 index 0000000..6463e58 --- /dev/null +++ b/src/net/minecraft/src/Packet25EntityPainting.java @@ -0,0 +1,52 @@ +package net.minecraft.src; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; + +public class Packet25EntityPainting extends Packet { + public int entityId; + public int xPosition; + public int yPosition; + public int zPosition; + public int direction; + public String title; + + public Packet25EntityPainting() { + } + + public Packet25EntityPainting(EntityPainting var1) { + this.entityId = var1.entityId; + this.xPosition = var1.xPosition; + this.yPosition = var1.yPosition; + this.zPosition = var1.zPosition; + this.direction = var1.direction; + this.title = var1.art.title; + } + + public void readPacketData(DataInputStream var1) throws IOException { + this.entityId = var1.readInt(); + this.title = readString(var1, EnumArt.maxArtTitleLength); + this.xPosition = var1.readInt(); + this.yPosition = var1.readInt(); + this.zPosition = var1.readInt(); + this.direction = var1.readInt(); + } + + public void writePacketData(DataOutputStream var1) throws IOException { + var1.writeInt(this.entityId); + writeString(this.title, var1); + var1.writeInt(this.xPosition); + var1.writeInt(this.yPosition); + var1.writeInt(this.zPosition); + var1.writeInt(this.direction); + } + + public void processPacket(NetHandler var1) { + var1.func_21146_a(this); + } + + public int getPacketSize() { + return 24; + } +} diff --git a/src/net/minecraft/src/Packet27Position.java b/src/net/minecraft/src/Packet27Position.java new file mode 100644 index 0000000..ef127f9 --- /dev/null +++ b/src/net/minecraft/src/Packet27Position.java @@ -0,0 +1,40 @@ +package net.minecraft.src; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; + +public class Packet27Position extends Packet { + private float field_22039_a; + private float field_22038_b; + private boolean field_22043_c; + private boolean field_22042_d; + private float field_22041_e; + private float field_22040_f; + + public void readPacketData(DataInputStream var1) throws IOException { + this.field_22039_a = var1.readFloat(); + this.field_22038_b = var1.readFloat(); + this.field_22041_e = var1.readFloat(); + this.field_22040_f = var1.readFloat(); + this.field_22043_c = var1.readBoolean(); + this.field_22042_d = var1.readBoolean(); + } + + public void writePacketData(DataOutputStream var1) throws IOException { + var1.writeFloat(this.field_22039_a); + var1.writeFloat(this.field_22038_b); + var1.writeFloat(this.field_22041_e); + var1.writeFloat(this.field_22040_f); + var1.writeBoolean(this.field_22043_c); + var1.writeBoolean(this.field_22042_d); + } + + public void processPacket(NetHandler var1) { + var1.func_22185_a(this); + } + + public int getPacketSize() { + return 18; + } +} diff --git a/src/net/minecraft/src/Packet28EntityVelocity.java b/src/net/minecraft/src/Packet28EntityVelocity.java new file mode 100644 index 0000000..e2a8bf2 --- /dev/null +++ b/src/net/minecraft/src/Packet28EntityVelocity.java @@ -0,0 +1,73 @@ +package net.minecraft.src; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; + +public class Packet28EntityVelocity extends Packet { + public int entityId; + public int motionX; + public int motionY; + public int motionZ; + + public Packet28EntityVelocity() { + } + + public Packet28EntityVelocity(Entity var1) { + this(var1.entityId, var1.motionX, var1.motionY, var1.motionZ); + } + + public Packet28EntityVelocity(int var1, double var2, double var4, double var6) { + this.entityId = var1; + double var8 = 3.9D; + if(var2 < -var8) { + var2 = -var8; + } + + if(var4 < -var8) { + var4 = -var8; + } + + if(var6 < -var8) { + var6 = -var8; + } + + if(var2 > var8) { + var2 = var8; + } + + if(var4 > var8) { + var4 = var8; + } + + if(var6 > var8) { + var6 = var8; + } + + this.motionX = (int)(var2 * 8000.0D); + this.motionY = (int)(var4 * 8000.0D); + this.motionZ = (int)(var6 * 8000.0D); + } + + public void readPacketData(DataInputStream var1) throws IOException { + this.entityId = var1.readInt(); + this.motionX = var1.readShort(); + this.motionY = var1.readShort(); + this.motionZ = var1.readShort(); + } + + public void writePacketData(DataOutputStream var1) throws IOException { + var1.writeInt(this.entityId); + var1.writeShort(this.motionX); + var1.writeShort(this.motionY); + var1.writeShort(this.motionZ); + } + + public void processPacket(NetHandler var1) { + var1.func_6498_a(this); + } + + public int getPacketSize() { + return 10; + } +} diff --git a/src/net/minecraft/src/Packet29DestroyEntity.java b/src/net/minecraft/src/Packet29DestroyEntity.java new file mode 100644 index 0000000..bb40d19 --- /dev/null +++ b/src/net/minecraft/src/Packet29DestroyEntity.java @@ -0,0 +1,25 @@ +package net.minecraft.src; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; + +public class Packet29DestroyEntity extends Packet { + public int entityId; + + public void readPacketData(DataInputStream var1) throws IOException { + this.entityId = var1.readInt(); + } + + public void writePacketData(DataOutputStream var1) throws IOException { + var1.writeInt(this.entityId); + } + + public void processPacket(NetHandler var1) { + var1.handleDestroyEntity(this); + } + + public int getPacketSize() { + return 4; + } +} diff --git a/src/net/minecraft/src/Packet2Handshake.java b/src/net/minecraft/src/Packet2Handshake.java new file mode 100644 index 0000000..ff08c3f --- /dev/null +++ b/src/net/minecraft/src/Packet2Handshake.java @@ -0,0 +1,32 @@ +package net.minecraft.src; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; + +public class Packet2Handshake extends Packet { + public String username; + + public Packet2Handshake() { + } + + public Packet2Handshake(String var1) { + this.username = var1; + } + + public void readPacketData(DataInputStream var1) throws IOException { + this.username = readString(var1, 32); + } + + public void writePacketData(DataOutputStream var1) throws IOException { + writeString(this.username, var1); + } + + public void processPacket(NetHandler var1) { + var1.handleHandshake(this); + } + + public int getPacketSize() { + return 4 + this.username.length() + 4; + } +} diff --git a/src/net/minecraft/src/Packet30Entity.java b/src/net/minecraft/src/Packet30Entity.java new file mode 100644 index 0000000..0603594 --- /dev/null +++ b/src/net/minecraft/src/Packet30Entity.java @@ -0,0 +1,31 @@ +package net.minecraft.src; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; + +public class Packet30Entity extends Packet { + public int entityId; + public byte xPosition; + public byte yPosition; + public byte zPosition; + public byte yaw; + public byte pitch; + public boolean rotating = false; + + public void readPacketData(DataInputStream var1) throws IOException { + this.entityId = var1.readInt(); + } + + public void writePacketData(DataOutputStream var1) throws IOException { + var1.writeInt(this.entityId); + } + + public void processPacket(NetHandler var1) { + var1.handleEntity(this); + } + + public int getPacketSize() { + return 4; + } +} diff --git a/src/net/minecraft/src/Packet31RelEntityMove.java b/src/net/minecraft/src/Packet31RelEntityMove.java new file mode 100644 index 0000000..fef88de --- /dev/null +++ b/src/net/minecraft/src/Packet31RelEntityMove.java @@ -0,0 +1,25 @@ +package net.minecraft.src; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; + +public class Packet31RelEntityMove extends Packet30Entity { + public void readPacketData(DataInputStream var1) throws IOException { + super.readPacketData(var1); + this.xPosition = var1.readByte(); + this.yPosition = var1.readByte(); + this.zPosition = var1.readByte(); + } + + public void writePacketData(DataOutputStream var1) throws IOException { + super.writePacketData(var1); + var1.writeByte(this.xPosition); + var1.writeByte(this.yPosition); + var1.writeByte(this.zPosition); + } + + public int getPacketSize() { + return 7; + } +} diff --git a/src/net/minecraft/src/Packet32EntityLook.java b/src/net/minecraft/src/Packet32EntityLook.java new file mode 100644 index 0000000..a43e022 --- /dev/null +++ b/src/net/minecraft/src/Packet32EntityLook.java @@ -0,0 +1,27 @@ +package net.minecraft.src; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; + +public class Packet32EntityLook extends Packet30Entity { + public Packet32EntityLook() { + this.rotating = true; + } + + public void readPacketData(DataInputStream var1) throws IOException { + super.readPacketData(var1); + this.yaw = var1.readByte(); + this.pitch = var1.readByte(); + } + + public void writePacketData(DataOutputStream var1) throws IOException { + super.writePacketData(var1); + var1.writeByte(this.yaw); + var1.writeByte(this.pitch); + } + + public int getPacketSize() { + return 6; + } +} diff --git a/src/net/minecraft/src/Packet33RelEntityMoveLook.java b/src/net/minecraft/src/Packet33RelEntityMoveLook.java new file mode 100644 index 0000000..29dca13 --- /dev/null +++ b/src/net/minecraft/src/Packet33RelEntityMoveLook.java @@ -0,0 +1,33 @@ +package net.minecraft.src; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; + +public class Packet33RelEntityMoveLook extends Packet30Entity { + public Packet33RelEntityMoveLook() { + this.rotating = true; + } + + public void readPacketData(DataInputStream var1) throws IOException { + super.readPacketData(var1); + this.xPosition = var1.readByte(); + this.yPosition = var1.readByte(); + this.zPosition = var1.readByte(); + this.yaw = var1.readByte(); + this.pitch = var1.readByte(); + } + + public void writePacketData(DataOutputStream var1) throws IOException { + super.writePacketData(var1); + var1.writeByte(this.xPosition); + var1.writeByte(this.yPosition); + var1.writeByte(this.zPosition); + var1.writeByte(this.yaw); + var1.writeByte(this.pitch); + } + + public int getPacketSize() { + return 9; + } +} diff --git a/src/net/minecraft/src/Packet34EntityTeleport.java b/src/net/minecraft/src/Packet34EntityTeleport.java new file mode 100644 index 0000000..3be74cb --- /dev/null +++ b/src/net/minecraft/src/Packet34EntityTeleport.java @@ -0,0 +1,52 @@ +package net.minecraft.src; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; + +public class Packet34EntityTeleport extends Packet { + public int entityId; + public int xPosition; + public int yPosition; + public int zPosition; + public byte yaw; + public byte pitch; + + public Packet34EntityTeleport() { + } + + public Packet34EntityTeleport(Entity var1) { + this.entityId = var1.entityId; + this.xPosition = MathHelper.floor_double(var1.posX * 32.0D); + this.yPosition = MathHelper.floor_double(var1.posY * 32.0D); + this.zPosition = MathHelper.floor_double(var1.posZ * 32.0D); + this.yaw = (byte)((int)(var1.rotationYaw * 256.0F / 360.0F)); + this.pitch = (byte)((int)(var1.rotationPitch * 256.0F / 360.0F)); + } + + public void readPacketData(DataInputStream var1) throws IOException { + this.entityId = var1.readInt(); + this.xPosition = var1.readInt(); + this.yPosition = var1.readInt(); + this.zPosition = var1.readInt(); + this.yaw = (byte)var1.read(); + this.pitch = (byte)var1.read(); + } + + public void writePacketData(DataOutputStream var1) throws IOException { + var1.writeInt(this.entityId); + var1.writeInt(this.xPosition); + var1.writeInt(this.yPosition); + var1.writeInt(this.zPosition); + var1.write(this.yaw); + var1.write(this.pitch); + } + + public void processPacket(NetHandler var1) { + var1.handleEntityTeleport(this); + } + + public int getPacketSize() { + return 34; + } +} diff --git a/src/net/minecraft/src/Packet38EntityStatus.java b/src/net/minecraft/src/Packet38EntityStatus.java new file mode 100644 index 0000000..83b4ad8 --- /dev/null +++ b/src/net/minecraft/src/Packet38EntityStatus.java @@ -0,0 +1,28 @@ +package net.minecraft.src; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; + +public class Packet38EntityStatus extends Packet { + public int entityId; + public byte entityStatus; + + public void readPacketData(DataInputStream var1) throws IOException { + this.entityId = var1.readInt(); + this.entityStatus = var1.readByte(); + } + + public void writePacketData(DataOutputStream var1) throws IOException { + var1.writeInt(this.entityId); + var1.writeByte(this.entityStatus); + } + + public void processPacket(NetHandler var1) { + var1.func_9447_a(this); + } + + public int getPacketSize() { + return 5; + } +} diff --git a/src/net/minecraft/src/Packet39AttachEntity.java b/src/net/minecraft/src/Packet39AttachEntity.java new file mode 100644 index 0000000..7b67e66 --- /dev/null +++ b/src/net/minecraft/src/Packet39AttachEntity.java @@ -0,0 +1,28 @@ +package net.minecraft.src; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; + +public class Packet39AttachEntity extends Packet { + public int entityId; + public int vehicleEntityId; + + public int getPacketSize() { + return 8; + } + + public void readPacketData(DataInputStream var1) throws IOException { + this.entityId = var1.readInt(); + this.vehicleEntityId = var1.readInt(); + } + + public void writePacketData(DataOutputStream var1) throws IOException { + var1.writeInt(this.entityId); + var1.writeInt(this.vehicleEntityId); + } + + public void processPacket(NetHandler var1) { + var1.func_6497_a(this); + } +} diff --git a/src/net/minecraft/src/Packet3Chat.java b/src/net/minecraft/src/Packet3Chat.java new file mode 100644 index 0000000..2a8a010 --- /dev/null +++ b/src/net/minecraft/src/Packet3Chat.java @@ -0,0 +1,36 @@ +package net.minecraft.src; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; + +public class Packet3Chat extends Packet { + public String message; + + public Packet3Chat() { + } + + public Packet3Chat(String var1) { + if(var1.length() > 119) { + var1 = var1.substring(0, 119); + } + + this.message = var1; + } + + public void readPacketData(DataInputStream var1) throws IOException { + this.message = readString(var1, 119); + } + + public void writePacketData(DataOutputStream var1) throws IOException { + writeString(this.message, var1); + } + + public void processPacket(NetHandler var1) { + var1.handleChat(this); + } + + public int getPacketSize() { + return this.message.length(); + } +} diff --git a/src/net/minecraft/src/Packet40EntityMetadata.java b/src/net/minecraft/src/Packet40EntityMetadata.java new file mode 100644 index 0000000..b3060b9 --- /dev/null +++ b/src/net/minecraft/src/Packet40EntityMetadata.java @@ -0,0 +1,33 @@ +package net.minecraft.src; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; +import java.util.List; + +public class Packet40EntityMetadata extends Packet { + public int entityId; + private List field_21048_b; + + public void readPacketData(DataInputStream var1) throws IOException { + this.entityId = var1.readInt(); + this.field_21048_b = DataWatcher.readWatchableObjects(var1); + } + + public void writePacketData(DataOutputStream var1) throws IOException { + var1.writeInt(this.entityId); + DataWatcher.writeObjectsInListToStream(this.field_21048_b, var1); + } + + public void processPacket(NetHandler var1) { + var1.func_21148_a(this); + } + + public int getPacketSize() { + return 5; + } + + public List func_21047_b() { + return this.field_21048_b; + } +} diff --git a/src/net/minecraft/src/Packet4UpdateTime.java b/src/net/minecraft/src/Packet4UpdateTime.java new file mode 100644 index 0000000..3b4b84e --- /dev/null +++ b/src/net/minecraft/src/Packet4UpdateTime.java @@ -0,0 +1,25 @@ +package net.minecraft.src; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; + +public class Packet4UpdateTime extends Packet { + public long time; + + public void readPacketData(DataInputStream var1) throws IOException { + this.time = var1.readLong(); + } + + public void writePacketData(DataOutputStream var1) throws IOException { + var1.writeLong(this.time); + } + + public void processPacket(NetHandler var1) { + var1.handleUpdateTime(this); + } + + public int getPacketSize() { + return 8; + } +} diff --git a/src/net/minecraft/src/Packet50PreChunk.java b/src/net/minecraft/src/Packet50PreChunk.java new file mode 100644 index 0000000..59e985d --- /dev/null +++ b/src/net/minecraft/src/Packet50PreChunk.java @@ -0,0 +1,35 @@ +package net.minecraft.src; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; + +public class Packet50PreChunk extends Packet { + public int xPosition; + public int yPosition; + public boolean mode; + + public Packet50PreChunk() { + this.isChunkDataPacket = false; + } + + public void readPacketData(DataInputStream var1) throws IOException { + this.xPosition = var1.readInt(); + this.yPosition = var1.readInt(); + this.mode = var1.read() != 0; + } + + public void writePacketData(DataOutputStream var1) throws IOException { + var1.writeInt(this.xPosition); + var1.writeInt(this.yPosition); + var1.write(this.mode ? 1 : 0); + } + + public void processPacket(NetHandler var1) { + var1.handlePreChunk(this); + } + + public int getPacketSize() { + return 9; + } +} diff --git a/src/net/minecraft/src/Packet51MapChunk.java b/src/net/minecraft/src/Packet51MapChunk.java new file mode 100644 index 0000000..64d42ce --- /dev/null +++ b/src/net/minecraft/src/Packet51MapChunk.java @@ -0,0 +1,65 @@ +package net.minecraft.src; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; +import java.util.zip.DataFormatException; +import java.util.zip.Inflater; + +public class Packet51MapChunk extends Packet { + public int xPosition; + public int yPosition; + public int zPosition; + public int xSize; + public int ySize; + public int zSize; + public byte[] chunk; + private int chunkSize; + + public Packet51MapChunk() { + this.isChunkDataPacket = true; + } + + public void readPacketData(DataInputStream var1) throws IOException { + this.xPosition = var1.readInt(); + this.yPosition = var1.readShort(); + this.zPosition = var1.readInt(); + this.xSize = var1.read() + 1; + this.ySize = var1.read() + 1; + this.zSize = var1.read() + 1; + this.chunkSize = var1.readInt(); + byte[] var2 = new byte[this.chunkSize]; + var1.readFully(var2); + this.chunk = new byte[this.xSize * this.ySize * this.zSize * 5 / 2]; + Inflater var3 = new Inflater(); + var3.setInput(var2); + + try { + var3.inflate(this.chunk); + } catch (DataFormatException var8) { + throw new IOException("Bad compressed data format"); + } finally { + var3.end(); + } + + } + + public void writePacketData(DataOutputStream var1) throws IOException { + var1.writeInt(this.xPosition); + var1.writeShort(this.yPosition); + var1.writeInt(this.zPosition); + var1.write(this.xSize - 1); + var1.write(this.ySize - 1); + var1.write(this.zSize - 1); + var1.writeInt(this.chunkSize); + var1.write(this.chunk, 0, this.chunkSize); + } + + public void processPacket(NetHandler var1) { + var1.handleMapChunk(this); + } + + public int getPacketSize() { + return 17 + this.chunkSize; + } +} diff --git a/src/net/minecraft/src/Packet52MultiBlockChange.java b/src/net/minecraft/src/Packet52MultiBlockChange.java new file mode 100644 index 0000000..8735a49 --- /dev/null +++ b/src/net/minecraft/src/Packet52MultiBlockChange.java @@ -0,0 +1,55 @@ +package net.minecraft.src; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; + +public class Packet52MultiBlockChange extends Packet { + public int xPosition; + public int zPosition; + public short[] coordinateArray; + public byte[] typeArray; + public byte[] metadataArray; + public int size; + + public Packet52MultiBlockChange() { + this.isChunkDataPacket = true; + } + + public void readPacketData(DataInputStream var1) throws IOException { + this.xPosition = var1.readInt(); + this.zPosition = var1.readInt(); + this.size = var1.readShort() & '\uffff'; + this.coordinateArray = new short[this.size]; + this.typeArray = new byte[this.size]; + this.metadataArray = new byte[this.size]; + + for(int var2 = 0; var2 < this.size; ++var2) { + this.coordinateArray[var2] = var1.readShort(); + } + + var1.readFully(this.typeArray); + var1.readFully(this.metadataArray); + } + + public void writePacketData(DataOutputStream var1) throws IOException { + var1.writeInt(this.xPosition); + var1.writeInt(this.zPosition); + var1.writeShort((short)this.size); + + for(int var2 = 0; var2 < this.size; ++var2) { + var1.writeShort(this.coordinateArray[var2]); + } + + var1.write(this.typeArray); + var1.write(this.metadataArray); + } + + public void processPacket(NetHandler var1) { + var1.handleMultiBlockChange(this); + } + + public int getPacketSize() { + return 10 + this.size * 4; + } +} diff --git a/src/net/minecraft/src/Packet53BlockChange.java b/src/net/minecraft/src/Packet53BlockChange.java new file mode 100644 index 0000000..9d04e50 --- /dev/null +++ b/src/net/minecraft/src/Packet53BlockChange.java @@ -0,0 +1,41 @@ +package net.minecraft.src; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; + +public class Packet53BlockChange extends Packet { + public int xPosition; + public int yPosition; + public int zPosition; + public int type; + public int metadata; + + public Packet53BlockChange() { + this.isChunkDataPacket = true; + } + + public void readPacketData(DataInputStream var1) throws IOException { + this.xPosition = var1.readInt(); + this.yPosition = var1.read(); + this.zPosition = var1.readInt(); + this.type = var1.read(); + this.metadata = var1.read(); + } + + public void writePacketData(DataOutputStream var1) throws IOException { + var1.writeInt(this.xPosition); + var1.write(this.yPosition); + var1.writeInt(this.zPosition); + var1.write(this.type); + var1.write(this.metadata); + } + + public void processPacket(NetHandler var1) { + var1.handleBlockChange(this); + } + + public int getPacketSize() { + return 11; + } +} diff --git a/src/net/minecraft/src/Packet54PlayNoteBlock.java b/src/net/minecraft/src/Packet54PlayNoteBlock.java new file mode 100644 index 0000000..db64d14 --- /dev/null +++ b/src/net/minecraft/src/Packet54PlayNoteBlock.java @@ -0,0 +1,37 @@ +package net.minecraft.src; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; + +public class Packet54PlayNoteBlock extends Packet { + public int xLocation; + public int yLocation; + public int zLocation; + public int instrumentType; + public int pitch; + + public void readPacketData(DataInputStream var1) throws IOException { + this.xLocation = var1.readInt(); + this.yLocation = var1.readShort(); + this.zLocation = var1.readInt(); + this.instrumentType = var1.read(); + this.pitch = var1.read(); + } + + public void writePacketData(DataOutputStream var1) throws IOException { + var1.writeInt(this.xLocation); + var1.writeShort(this.yLocation); + var1.writeInt(this.zLocation); + var1.write(this.instrumentType); + var1.write(this.pitch); + } + + public void processPacket(NetHandler var1) { + var1.handleNotePlay(this); + } + + public int getPacketSize() { + return 12; + } +} diff --git a/src/net/minecraft/src/Packet5PlayerInventory.java b/src/net/minecraft/src/Packet5PlayerInventory.java new file mode 100644 index 0000000..82fb173 --- /dev/null +++ b/src/net/minecraft/src/Packet5PlayerInventory.java @@ -0,0 +1,34 @@ +package net.minecraft.src; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; + +public class Packet5PlayerInventory extends Packet { + public int entityID; + public int slot; + public int itemID; + public int itemDamage; + + public void readPacketData(DataInputStream var1) throws IOException { + this.entityID = var1.readInt(); + this.slot = var1.readShort(); + this.itemID = var1.readShort(); + this.itemDamage = var1.readShort(); + } + + public void writePacketData(DataOutputStream var1) throws IOException { + var1.writeInt(this.entityID); + var1.writeShort(this.slot); + var1.writeShort(this.itemID); + var1.writeShort(this.itemDamage); + } + + public void processPacket(NetHandler var1) { + var1.handlePlayerInventory(this); + } + + public int getPacketSize() { + return 8; + } +} diff --git a/src/net/minecraft/src/Packet60Explosion.java b/src/net/minecraft/src/Packet60Explosion.java new file mode 100644 index 0000000..601959e --- /dev/null +++ b/src/net/minecraft/src/Packet60Explosion.java @@ -0,0 +1,67 @@ +package net.minecraft.src; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Set; + +public class Packet60Explosion extends Packet { + public double explosionX; + public double explosionY; + public double explosionZ; + public float explosionSize; + public Set destroyedBlockPositions; + + public void readPacketData(DataInputStream var1) throws IOException { + this.explosionX = var1.readDouble(); + this.explosionY = var1.readDouble(); + this.explosionZ = var1.readDouble(); + this.explosionSize = var1.readFloat(); + int var2 = var1.readInt(); + this.destroyedBlockPositions = new HashSet(); + int var3 = (int)this.explosionX; + int var4 = (int)this.explosionY; + int var5 = (int)this.explosionZ; + + for(int var6 = 0; var6 < var2; ++var6) { + int var7 = var1.readByte() + var3; + int var8 = var1.readByte() + var4; + int var9 = var1.readByte() + var5; + this.destroyedBlockPositions.add(new ChunkPosition(var7, var8, var9)); + } + + } + + public void writePacketData(DataOutputStream var1) throws IOException { + var1.writeDouble(this.explosionX); + var1.writeDouble(this.explosionY); + var1.writeDouble(this.explosionZ); + var1.writeFloat(this.explosionSize); + var1.writeInt(this.destroyedBlockPositions.size()); + int var2 = (int)this.explosionX; + int var3 = (int)this.explosionY; + int var4 = (int)this.explosionZ; + Iterator var5 = this.destroyedBlockPositions.iterator(); + + while(var5.hasNext()) { + ChunkPosition var6 = (ChunkPosition)var5.next(); + int var7 = var6.x - var2; + int var8 = var6.y - var3; + int var9 = var6.z - var4; + var1.writeByte(var7); + var1.writeByte(var8); + var1.writeByte(var9); + } + + } + + public void processPacket(NetHandler var1) { + var1.func_12245_a(this); + } + + public int getPacketSize() { + return 32 + this.destroyedBlockPositions.size() * 3; + } +} diff --git a/src/net/minecraft/src/Packet61DoorChange.java b/src/net/minecraft/src/Packet61DoorChange.java new file mode 100644 index 0000000..6446d06 --- /dev/null +++ b/src/net/minecraft/src/Packet61DoorChange.java @@ -0,0 +1,37 @@ +package net.minecraft.src; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; + +public class Packet61DoorChange extends Packet { + public int field_28050_a; + public int field_28049_b; + public int field_28053_c; + public int field_28052_d; + public int field_28051_e; + + public void readPacketData(DataInputStream var1) throws IOException { + this.field_28050_a = var1.readInt(); + this.field_28053_c = var1.readInt(); + this.field_28052_d = var1.readByte(); + this.field_28051_e = var1.readInt(); + this.field_28049_b = var1.readInt(); + } + + public void writePacketData(DataOutputStream var1) throws IOException { + var1.writeInt(this.field_28050_a); + var1.writeInt(this.field_28053_c); + var1.writeByte(this.field_28052_d); + var1.writeInt(this.field_28051_e); + var1.writeInt(this.field_28049_b); + } + + public void processPacket(NetHandler var1) { + var1.func_28115_a(this); + } + + public int getPacketSize() { + return 20; + } +} diff --git a/src/net/minecraft/src/Packet6SpawnPosition.java b/src/net/minecraft/src/Packet6SpawnPosition.java new file mode 100644 index 0000000..7a65218 --- /dev/null +++ b/src/net/minecraft/src/Packet6SpawnPosition.java @@ -0,0 +1,31 @@ +package net.minecraft.src; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; + +public class Packet6SpawnPosition extends Packet { + public int xPosition; + public int yPosition; + public int zPosition; + + public void readPacketData(DataInputStream var1) throws IOException { + this.xPosition = var1.readInt(); + this.yPosition = var1.readInt(); + this.zPosition = var1.readInt(); + } + + public void writePacketData(DataOutputStream var1) throws IOException { + var1.writeInt(this.xPosition); + var1.writeInt(this.yPosition); + var1.writeInt(this.zPosition); + } + + public void processPacket(NetHandler var1) { + var1.handleSpawnPosition(this); + } + + public int getPacketSize() { + return 12; + } +} diff --git a/src/net/minecraft/src/Packet70Bed.java b/src/net/minecraft/src/Packet70Bed.java new file mode 100644 index 0000000..eb4e721 --- /dev/null +++ b/src/net/minecraft/src/Packet70Bed.java @@ -0,0 +1,26 @@ +package net.minecraft.src; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; + +public class Packet70Bed extends Packet { + public static final String[] field_25020_a = new String[]{"tile.bed.notValid", null, null}; + public int field_25019_b; + + public void readPacketData(DataInputStream var1) throws IOException { + this.field_25019_b = var1.readByte(); + } + + public void writePacketData(DataOutputStream var1) throws IOException { + var1.writeByte(this.field_25019_b); + } + + public void processPacket(NetHandler var1) { + var1.func_25118_a(this); + } + + public int getPacketSize() { + return 1; + } +} diff --git a/src/net/minecraft/src/Packet71Weather.java b/src/net/minecraft/src/Packet71Weather.java new file mode 100644 index 0000000..648106e --- /dev/null +++ b/src/net/minecraft/src/Packet71Weather.java @@ -0,0 +1,51 @@ +package net.minecraft.src; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; + +public class Packet71Weather extends Packet { + public int field_27054_a; + public int field_27053_b; + public int field_27057_c; + public int field_27056_d; + public int field_27055_e; + + public Packet71Weather() { + } + + public Packet71Weather(Entity var1) { + this.field_27054_a = var1.entityId; + this.field_27053_b = MathHelper.floor_double(var1.posX * 32.0D); + this.field_27057_c = MathHelper.floor_double(var1.posY * 32.0D); + this.field_27056_d = MathHelper.floor_double(var1.posZ * 32.0D); + if(var1 instanceof EntityLightningBolt) { + this.field_27055_e = 1; + } + + } + + public void readPacketData(DataInputStream var1) throws IOException { + this.field_27054_a = var1.readInt(); + this.field_27055_e = var1.readByte(); + this.field_27053_b = var1.readInt(); + this.field_27057_c = var1.readInt(); + this.field_27056_d = var1.readInt(); + } + + public void writePacketData(DataOutputStream var1) throws IOException { + var1.writeInt(this.field_27054_a); + var1.writeByte(this.field_27055_e); + var1.writeInt(this.field_27053_b); + var1.writeInt(this.field_27057_c); + var1.writeInt(this.field_27056_d); + } + + public void processPacket(NetHandler var1) { + var1.handleWeather(this); + } + + public int getPacketSize() { + return 17; + } +} diff --git a/src/net/minecraft/src/Packet7UseEntity.java b/src/net/minecraft/src/Packet7UseEntity.java new file mode 100644 index 0000000..fe83289 --- /dev/null +++ b/src/net/minecraft/src/Packet7UseEntity.java @@ -0,0 +1,40 @@ +package net.minecraft.src; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; + +public class Packet7UseEntity extends Packet { + public int playerEntityId; + public int targetEntity; + public int isLeftClick; + + public Packet7UseEntity() { + } + + public Packet7UseEntity(int var1, int var2, int var3) { + this.playerEntityId = var1; + this.targetEntity = var2; + this.isLeftClick = var3; + } + + public void readPacketData(DataInputStream var1) throws IOException { + this.playerEntityId = var1.readInt(); + this.targetEntity = var1.readInt(); + this.isLeftClick = var1.readByte(); + } + + public void writePacketData(DataOutputStream var1) throws IOException { + var1.writeInt(this.playerEntityId); + var1.writeInt(this.targetEntity); + var1.writeByte(this.isLeftClick); + } + + public void processPacket(NetHandler var1) { + var1.handleUseEntity(this); + } + + public int getPacketSize() { + return 9; + } +} diff --git a/src/net/minecraft/src/Packet8UpdateHealth.java b/src/net/minecraft/src/Packet8UpdateHealth.java new file mode 100644 index 0000000..7568760 --- /dev/null +++ b/src/net/minecraft/src/Packet8UpdateHealth.java @@ -0,0 +1,25 @@ +package net.minecraft.src; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; + +public class Packet8UpdateHealth extends Packet { + public int healthMP; + + public void readPacketData(DataInputStream var1) throws IOException { + this.healthMP = var1.readShort(); + } + + public void writePacketData(DataOutputStream var1) throws IOException { + var1.writeShort(this.healthMP); + } + + public void processPacket(NetHandler var1) { + var1.handleHealth(this); + } + + public int getPacketSize() { + return 2; + } +} diff --git a/src/net/minecraft/src/Packet9Respawn.java b/src/net/minecraft/src/Packet9Respawn.java new file mode 100644 index 0000000..b52a89e --- /dev/null +++ b/src/net/minecraft/src/Packet9Respawn.java @@ -0,0 +1,32 @@ +package net.minecraft.src; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; + +public class Packet9Respawn extends Packet { + public byte field_28048_a; + + public Packet9Respawn() { + } + + public Packet9Respawn(byte var1) { + this.field_28048_a = var1; + } + + public void processPacket(NetHandler var1) { + var1.func_9448_a(this); + } + + public void readPacketData(DataInputStream var1) throws IOException { + this.field_28048_a = var1.readByte(); + } + + public void writePacketData(DataOutputStream var1) throws IOException { + var1.writeByte(this.field_28048_a); + } + + public int getPacketSize() { + return 1; + } +} diff --git a/src/net/minecraft/src/PacketCounter.java b/src/net/minecraft/src/PacketCounter.java new file mode 100644 index 0000000..8929a3c --- /dev/null +++ b/src/net/minecraft/src/PacketCounter.java @@ -0,0 +1,18 @@ +package net.minecraft.src; + +class PacketCounter { + private int totalPackets; + private long totalBytes; + + private PacketCounter() { + } + + public void addPacket(int var1) { + ++this.totalPackets; + this.totalBytes += (long)var1; + } + + PacketCounter(Empty1 var1) { + this(); + } +} diff --git a/src/net/minecraft/src/PanelCrashReport.java b/src/net/minecraft/src/PanelCrashReport.java new file mode 100644 index 0000000..f514b32 --- /dev/null +++ b/src/net/minecraft/src/PanelCrashReport.java @@ -0,0 +1,85 @@ +package net.minecraft.src; + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Font; +import java.awt.Panel; +import java.awt.TextArea; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.text.SimpleDateFormat; +import java.util.Date; +import org.lwjgl.Sys; +import org.lwjgl.opengl.GL11; + +public class PanelCrashReport extends Panel { + public PanelCrashReport(UnexpectedThrowable var1) { + this.setBackground(new Color(3028036)); + this.setLayout(new BorderLayout()); + StringWriter var2 = new StringWriter(); + var1.exception.printStackTrace(new PrintWriter(var2)); + String var3 = var2.toString(); + String var4 = ""; + String var5 = ""; + + try { + var5 = var5 + "Generated " + (new SimpleDateFormat()).format(new Date()) + "\n"; + var5 = var5 + "\n"; + var5 = var5 + "Minecraft: Minecraft Beta 1.7.3\n"; + var5 = var5 + "OS: " + System.getProperty("os.name") + " (" + System.getProperty("os.arch") + ") version " + System.getProperty("os.version") + "\n"; + var5 = var5 + "Java: " + System.getProperty("java.version") + ", " + System.getProperty("java.vendor") + "\n"; + var5 = var5 + "VM: " + System.getProperty("java.vm.name") + " (" + System.getProperty("java.vm.info") + "), " + System.getProperty("java.vm.vendor") + "\n"; + var5 = var5 + "LWJGL: " + Sys.getVersion() + "\n"; + var4 = GL11.glGetString(GL11.GL_VENDOR); + var5 = var5 + "OpenGL: " + GL11.glGetString(GL11.GL_RENDERER) + " version " + GL11.glGetString(GL11.GL_VERSION) + ", " + GL11.glGetString(GL11.GL_VENDOR) + "\n"; + } catch (Throwable var8) { + var5 = var5 + "[failed to get system properties (" + var8 + ")]\n"; + } + + var5 = var5 + "\n"; + var5 = var5 + var3; + String var6 = ""; + var6 = var6 + "\n"; + var6 = var6 + "\n"; + if(var3.contains("Pixel format not accelerated")) { + var6 = var6 + " Bad video card drivers! \n"; + var6 = var6 + " ----------------------- \n"; + var6 = var6 + "\n"; + var6 = var6 + "Minecraft was unable to start because it failed to find an accelerated OpenGL mode.\n"; + var6 = var6 + "This can usually be fixed by updating the video card drivers.\n"; + if(var4.toLowerCase().contains("nvidia")) { + var6 = var6 + "\n"; + var6 = var6 + "You might be able to find drivers for your video card here:\n"; + var6 = var6 + " http://www.nvidia.com/\n"; + } else if(var4.toLowerCase().contains("ati")) { + var6 = var6 + "\n"; + var6 = var6 + "You might be able to find drivers for your video card here:\n"; + var6 = var6 + " http://www.amd.com/\n"; + } + } else { + var6 = var6 + " Minecraft has crashed! \n"; + var6 = var6 + " ---------------------- \n"; + var6 = var6 + "\n"; + var6 = var6 + "Minecraft has stopped running because it encountered a problem.\n"; + var6 = var6 + "\n"; + var6 = var6 + "If you wish to report this, please copy this entire text and email it to support@mojang.com.\n"; + var6 = var6 + "Please include a description of what you did when the error occured.\n"; + } + + var6 = var6 + "\n"; + var6 = var6 + "\n"; + var6 = var6 + "\n"; + var6 = var6 + "--- BEGIN ERROR REPORT " + Integer.toHexString(var6.hashCode()) + " --------\n"; + var6 = var6 + var5; + var6 = var6 + "--- END ERROR REPORT " + Integer.toHexString(var6.hashCode()) + " ----------\n"; + var6 = var6 + "\n"; + var6 = var6 + "\n"; + TextArea var7 = new TextArea(var6, 0, 0, 1); + var7.setFont(new Font("Monospaced", 0, 12)); + this.add(new CanvasMojangLogo(), "North"); + this.add(new CanvasCrashReport(80), "East"); + this.add(new CanvasCrashReport(80), "West"); + this.add(new CanvasCrashReport(100), "South"); + this.add(var7, "Center"); + } +} diff --git a/src/net/minecraft/src/Particle.java b/src/net/minecraft/src/Particle.java new file mode 100644 index 0000000..6da9609 --- /dev/null +++ b/src/net/minecraft/src/Particle.java @@ -0,0 +1,57 @@ +package net.minecraft.src; + +import java.util.Random; + +public class Particle { + private static Random field_25128_s = new Random(); + public double field_25146_a; + public double field_25145_b; + public double field_25144_c; + public double field_25143_d; + public double field_25142_e; + public double field_25141_f; + public double field_25140_g; + public boolean field_25139_h; + public int field_25138_i; + public int field_25137_j; + public double field_25136_k; + public double field_25135_l; + public double field_25134_m; + public double field_25133_n; + public double field_25132_o; + public double field_25131_p; + public double field_25130_q; + public double field_25129_r; + + public void func_25125_a(GuiParticle var1) { + this.field_25146_a += this.field_25142_e; + this.field_25145_b += this.field_25141_f; + this.field_25142_e *= this.field_25140_g; + this.field_25141_f *= this.field_25140_g; + this.field_25141_f += 0.1D; + if(++this.field_25138_i > this.field_25137_j) { + this.func_25126_b(); + } + + this.field_25133_n = 2.0D - (double)this.field_25138_i / (double)this.field_25137_j * 2.0D; + if(this.field_25133_n > 1.0D) { + this.field_25133_n = 1.0D; + } + + this.field_25133_n *= this.field_25133_n; + this.field_25133_n *= 0.5D; + } + + public void func_25127_a() { + this.field_25132_o = this.field_25136_k; + this.field_25131_p = this.field_25135_l; + this.field_25130_q = this.field_25134_m; + this.field_25129_r = this.field_25133_n; + this.field_25144_c = this.field_25146_a; + this.field_25143_d = this.field_25145_b; + } + + public void func_25126_b() { + this.field_25139_h = true; + } +} diff --git a/src/net/minecraft/src/Path.java b/src/net/minecraft/src/Path.java new file mode 100644 index 0000000..fc08afe --- /dev/null +++ b/src/net/minecraft/src/Path.java @@ -0,0 +1,119 @@ +package net.minecraft.src; + +public class Path { + private PathPoint[] pathPoints = new PathPoint[1024]; + private int count = 0; + + public PathPoint addPoint(PathPoint var1) { + if(var1.index >= 0) { + throw new IllegalStateException("OW KNOWS!"); + } else { + if(this.count == this.pathPoints.length) { + PathPoint[] var2 = new PathPoint[this.count << 1]; + System.arraycopy(this.pathPoints, 0, var2, 0, this.count); + this.pathPoints = var2; + } + + this.pathPoints[this.count] = var1; + var1.index = this.count; + this.sortBack(this.count++); + return var1; + } + } + + public void clearPath() { + this.count = 0; + } + + public PathPoint dequeue() { + PathPoint var1 = this.pathPoints[0]; + this.pathPoints[0] = this.pathPoints[--this.count]; + this.pathPoints[this.count] = null; + if(this.count > 0) { + this.sortForward(0); + } + + var1.index = -1; + return var1; + } + + public void changeDistance(PathPoint var1, float var2) { + float var3 = var1.distanceToTarget; + var1.distanceToTarget = var2; + if(var2 < var3) { + this.sortBack(var1.index); + } else { + this.sortForward(var1.index); + } + + } + + private void sortBack(int var1) { + PathPoint var2 = this.pathPoints[var1]; + + int var4; + for(float var3 = var2.distanceToTarget; var1 > 0; var1 = var4) { + var4 = var1 - 1 >> 1; + PathPoint var5 = this.pathPoints[var4]; + if(var3 >= var5.distanceToTarget) { + break; + } + + this.pathPoints[var1] = var5; + var5.index = var1; + } + + this.pathPoints[var1] = var2; + var2.index = var1; + } + + private void sortForward(int var1) { + PathPoint var2 = this.pathPoints[var1]; + float var3 = var2.distanceToTarget; + + while(true) { + int var4 = 1 + (var1 << 1); + int var5 = var4 + 1; + if(var4 >= this.count) { + break; + } + + PathPoint var6 = this.pathPoints[var4]; + float var7 = var6.distanceToTarget; + PathPoint var8; + float var9; + if(var5 >= this.count) { + var8 = null; + var9 = Float.POSITIVE_INFINITY; + } else { + var8 = this.pathPoints[var5]; + var9 = var8.distanceToTarget; + } + + if(var7 < var9) { + if(var7 >= var3) { + break; + } + + this.pathPoints[var1] = var6; + var6.index = var1; + var1 = var4; + } else { + if(var9 >= var3) { + break; + } + + this.pathPoints[var1] = var8; + var8.index = var1; + var1 = var5; + } + } + + this.pathPoints[var1] = var2; + var2.index = var1; + } + + public boolean isPathEmpty() { + return this.count == 0; + } +} diff --git a/src/net/minecraft/src/PathEntity.java b/src/net/minecraft/src/PathEntity.java new file mode 100644 index 0000000..6bcf9d5 --- /dev/null +++ b/src/net/minecraft/src/PathEntity.java @@ -0,0 +1,31 @@ +package net.minecraft.src; + +public class PathEntity { + private final PathPoint[] points; + public final int pathLength; + private int pathIndex; + + public PathEntity(PathPoint[] var1) { + this.points = var1; + this.pathLength = var1.length; + } + + public void incrementPathIndex() { + ++this.pathIndex; + } + + public boolean isFinished() { + return this.pathIndex >= this.points.length; + } + + public PathPoint func_22328_c() { + return this.pathLength > 0 ? this.points[this.pathLength - 1] : null; + } + + public Vec3D getPosition(Entity var1) { + double var2 = (double)this.points[this.pathIndex].xCoord + (double)((int)(var1.width + 1.0F)) * 0.5D; + double var4 = (double)this.points[this.pathIndex].yCoord; + double var6 = (double)this.points[this.pathIndex].zCoord + (double)((int)(var1.width + 1.0F)) * 0.5D; + return Vec3D.createVector(var2, var4, var6); + } +} diff --git a/src/net/minecraft/src/PathPoint.java b/src/net/minecraft/src/PathPoint.java new file mode 100644 index 0000000..85dcbf4 --- /dev/null +++ b/src/net/minecraft/src/PathPoint.java @@ -0,0 +1,53 @@ +package net.minecraft.src; + +public class PathPoint { + public final int xCoord; + public final int yCoord; + public final int zCoord; + private final int hash; + int index = -1; + float totalPathDistance; + float distanceToNext; + float distanceToTarget; + PathPoint previous; + public boolean isFirst = false; + + public PathPoint(int var1, int var2, int var3) { + this.xCoord = var1; + this.yCoord = var2; + this.zCoord = var3; + this.hash = func_22329_a(var1, var2, var3); + } + + public static int func_22329_a(int var0, int var1, int var2) { + return var1 & 255 | (var0 & Short.MAX_VALUE) << 8 | (var2 & Short.MAX_VALUE) << 24 | (var0 < 0 ? Integer.MIN_VALUE : 0) | (var2 < 0 ? -Short.MIN_VALUE : 0); + } + + public float distanceTo(PathPoint var1) { + float var2 = (float)(var1.xCoord - this.xCoord); + float var3 = (float)(var1.yCoord - this.yCoord); + float var4 = (float)(var1.zCoord - this.zCoord); + return MathHelper.sqrt_float(var2 * var2 + var3 * var3 + var4 * var4); + } + + public boolean equals(Object var1) { + if(!(var1 instanceof PathPoint)) { + return false; + } else { + PathPoint var2 = (PathPoint)var1; + return this.hash == var2.hash && this.xCoord == var2.xCoord && this.yCoord == var2.yCoord && this.zCoord == var2.zCoord; + } + } + + public int hashCode() { + return this.hash; + } + + public boolean isAssigned() { + return this.index >= 0; + } + + public String toString() { + return this.xCoord + ", " + this.yCoord + ", " + this.zCoord; + } +} diff --git a/src/net/minecraft/src/Pathfinder.java b/src/net/minecraft/src/Pathfinder.java new file mode 100644 index 0000000..f36d88f --- /dev/null +++ b/src/net/minecraft/src/Pathfinder.java @@ -0,0 +1,209 @@ +package net.minecraft.src; + +public class Pathfinder { + private IBlockAccess worldMap; + private Path path = new Path(); + private MCHash pointMap = new MCHash(); + private PathPoint[] pathOptions = new PathPoint[32]; + + public Pathfinder(IBlockAccess var1) { + this.worldMap = var1; + } + + public PathEntity createEntityPathTo(Entity var1, Entity var2, float var3) { + return this.createEntityPathTo(var1, var2.posX, var2.boundingBox.minY, var2.posZ, var3); + } + + public PathEntity createEntityPathTo(Entity var1, int var2, int var3, int var4, float var5) { + return this.createEntityPathTo(var1, (double)((float)var2 + 0.5F), (double)((float)var3 + 0.5F), (double)((float)var4 + 0.5F), var5); + } + + private PathEntity createEntityPathTo(Entity var1, double var2, double var4, double var6, float var8) { + this.path.clearPath(); + this.pointMap.clearMap(); + PathPoint var9 = this.openPoint(MathHelper.floor_double(var1.boundingBox.minX), MathHelper.floor_double(var1.boundingBox.minY), MathHelper.floor_double(var1.boundingBox.minZ)); + PathPoint var10 = this.openPoint(MathHelper.floor_double(var2 - (double)(var1.width / 2.0F)), MathHelper.floor_double(var4), MathHelper.floor_double(var6 - (double)(var1.width / 2.0F))); + PathPoint var11 = new PathPoint(MathHelper.floor_float(var1.width + 1.0F), MathHelper.floor_float(var1.height + 1.0F), MathHelper.floor_float(var1.width + 1.0F)); + PathEntity var12 = this.addToPath(var1, var9, var10, var11, var8); + return var12; + } + + private PathEntity addToPath(Entity var1, PathPoint var2, PathPoint var3, PathPoint var4, float var5) { + var2.totalPathDistance = 0.0F; + var2.distanceToNext = var2.distanceTo(var3); + var2.distanceToTarget = var2.distanceToNext; + this.path.clearPath(); + this.path.addPoint(var2); + PathPoint var6 = var2; + + while(!this.path.isPathEmpty()) { + PathPoint var7 = this.path.dequeue(); + if(var7.equals(var3)) { + return this.createEntityPath(var2, var3); + } + + if(var7.distanceTo(var3) < var6.distanceTo(var3)) { + var6 = var7; + } + + var7.isFirst = true; + int var8 = this.findPathOptions(var1, var7, var4, var3, var5); + + for(int var9 = 0; var9 < var8; ++var9) { + PathPoint var10 = this.pathOptions[var9]; + float var11 = var7.totalPathDistance + var7.distanceTo(var10); + if(!var10.isAssigned() || var11 < var10.totalPathDistance) { + var10.previous = var7; + var10.totalPathDistance = var11; + var10.distanceToNext = var10.distanceTo(var3); + if(var10.isAssigned()) { + this.path.changeDistance(var10, var10.totalPathDistance + var10.distanceToNext); + } else { + var10.distanceToTarget = var10.totalPathDistance + var10.distanceToNext; + this.path.addPoint(var10); + } + } + } + } + + if(var6 == var2) { + return null; + } else { + return this.createEntityPath(var2, var6); + } + } + + private int findPathOptions(Entity var1, PathPoint var2, PathPoint var3, PathPoint var4, float var5) { + int var6 = 0; + byte var7 = 0; + if(this.getVerticalOffset(var1, var2.xCoord, var2.yCoord + 1, var2.zCoord, var3) == 1) { + var7 = 1; + } + + PathPoint var8 = this.getSafePoint(var1, var2.xCoord, var2.yCoord, var2.zCoord + 1, var3, var7); + PathPoint var9 = this.getSafePoint(var1, var2.xCoord - 1, var2.yCoord, var2.zCoord, var3, var7); + PathPoint var10 = this.getSafePoint(var1, var2.xCoord + 1, var2.yCoord, var2.zCoord, var3, var7); + PathPoint var11 = this.getSafePoint(var1, var2.xCoord, var2.yCoord, var2.zCoord - 1, var3, var7); + if(var8 != null && !var8.isFirst && var8.distanceTo(var4) < var5) { + this.pathOptions[var6++] = var8; + } + + if(var9 != null && !var9.isFirst && var9.distanceTo(var4) < var5) { + this.pathOptions[var6++] = var9; + } + + if(var10 != null && !var10.isFirst && var10.distanceTo(var4) < var5) { + this.pathOptions[var6++] = var10; + } + + if(var11 != null && !var11.isFirst && var11.distanceTo(var4) < var5) { + this.pathOptions[var6++] = var11; + } + + return var6; + } + + private PathPoint getSafePoint(Entity var1, int var2, int var3, int var4, PathPoint var5, int var6) { + PathPoint var7 = null; + if(this.getVerticalOffset(var1, var2, var3, var4, var5) == 1) { + var7 = this.openPoint(var2, var3, var4); + } + + if(var7 == null && var6 > 0 && this.getVerticalOffset(var1, var2, var3 + var6, var4, var5) == 1) { + var7 = this.openPoint(var2, var3 + var6, var4); + var3 += var6; + } + + if(var7 != null) { + int var8 = 0; + int var9 = 0; + + while(var3 > 0) { + var9 = this.getVerticalOffset(var1, var2, var3 - 1, var4, var5); + if(var9 != 1) { + break; + } + + ++var8; + if(var8 >= 4) { + return null; + } + + --var3; + if(var3 > 0) { + var7 = this.openPoint(var2, var3, var4); + } + } + + if(var9 == -2) { + return null; + } + } + + return var7; + } + + private final PathPoint openPoint(int var1, int var2, int var3) { + int var4 = PathPoint.func_22329_a(var1, var2, var3); + PathPoint var5 = (PathPoint)this.pointMap.lookup(var4); + if(var5 == null) { + var5 = new PathPoint(var1, var2, var3); + this.pointMap.addKey(var4, var5); + } + + return var5; + } + + private int getVerticalOffset(Entity var1, int var2, int var3, int var4, PathPoint var5) { + for(int var6 = var2; var6 < var2 + var5.xCoord; ++var6) { + for(int var7 = var3; var7 < var3 + var5.yCoord; ++var7) { + for(int var8 = var4; var8 < var4 + var5.zCoord; ++var8) { + int var9 = this.worldMap.getBlockId(var6, var7, var8); + if(var9 > 0) { + if(var9 != Block.doorSteel.blockID && var9 != Block.doorWood.blockID) { + Material var11 = Block.blocksList[var9].blockMaterial; + if(var11.getIsSolid()) { + return 0; + } + + if(var11 == Material.water) { + return -1; + } + + if(var11 == Material.lava) { + return -2; + } + } else { + int var10 = this.worldMap.getBlockMetadata(var6, var7, var8); + if(!BlockDoor.isOpen(var10)) { + return 0; + } + } + } + } + } + } + + return 1; + } + + private PathEntity createEntityPath(PathPoint var1, PathPoint var2) { + int var3 = 1; + + PathPoint var4; + for(var4 = var2; var4.previous != null; var4 = var4.previous) { + ++var3; + } + + PathPoint[] var5 = new PathPoint[var3]; + var4 = var2; + --var3; + + for(var5[var3] = var2; var4.previous != null; var5[var3] = var4) { + var4 = var4.previous; + --var3; + } + + return new PathEntity(var5); + } +} diff --git a/src/net/minecraft/src/PistonBlockTextures.java b/src/net/minecraft/src/PistonBlockTextures.java new file mode 100644 index 0000000..a5b751e --- /dev/null +++ b/src/net/minecraft/src/PistonBlockTextures.java @@ -0,0 +1,8 @@ +package net.minecraft.src; + +public class PistonBlockTextures { + public static final int[] field_31057_a = new int[]{1, 0, 3, 2, 5, 4}; + public static final int[] field_31056_b = new int[]{0, 0, 0, 0, -1, 1}; + public static final int[] field_31059_c = new int[]{-1, 1, 0, 0, 0, 0}; + public static final int[] field_31058_d = new int[]{0, 0, -1, 1, 0, 0}; +} diff --git a/src/net/minecraft/src/PlayerController.java b/src/net/minecraft/src/PlayerController.java new file mode 100644 index 0000000..75856a4 --- /dev/null +++ b/src/net/minecraft/src/PlayerController.java @@ -0,0 +1,100 @@ +package net.minecraft.src; + +import net.minecraft.client.Minecraft; + +public class PlayerController { + protected final Minecraft mc; + public boolean field_1064_b = false; + + public PlayerController(Minecraft var1) { + this.mc = var1; + } + + public void func_717_a(World var1) { + } + + public void clickBlock(int var1, int var2, int var3, int var4) { + this.mc.theWorld.onBlockHit(this.mc.thePlayer, var1, var2, var3, var4); + this.sendBlockRemoved(var1, var2, var3, var4); + } + + public boolean sendBlockRemoved(int var1, int var2, int var3, int var4) { + World var5 = this.mc.theWorld; + Block var6 = Block.blocksList[var5.getBlockId(var1, var2, var3)]; + var5.func_28106_e(2001, var1, var2, var3, var6.blockID + var5.getBlockMetadata(var1, var2, var3) * 256); + int var7 = var5.getBlockMetadata(var1, var2, var3); + boolean var8 = var5.setBlockWithNotify(var1, var2, var3, 0); + if(var6 != null && var8) { + var6.onBlockDestroyedByPlayer(var5, var1, var2, var3, var7); + } + + return var8; + } + + public void sendBlockRemoving(int var1, int var2, int var3, int var4) { + } + + public void resetBlockRemoving() { + } + + public void setPartialTime(float var1) { + } + + public float getBlockReachDistance() { + return 5.0F; + } + + public boolean sendUseItem(EntityPlayer var1, World var2, ItemStack var3) { + int var4 = var3.stackSize; + ItemStack var5 = var3.useItemRightClick(var2, var1); + if(var5 != var3 || var5 != null && var5.stackSize != var4) { + var1.inventory.mainInventory[var1.inventory.currentItem] = var5; + if(var5.stackSize == 0) { + var1.inventory.mainInventory[var1.inventory.currentItem] = null; + } + + return true; + } else { + return false; + } + } + + public void flipPlayer(EntityPlayer var1) { + } + + public void updateController() { + } + + public boolean shouldDrawHUD() { + return true; + } + + public void func_6473_b(EntityPlayer var1) { + } + + public boolean sendPlaceBlock(EntityPlayer var1, World var2, ItemStack var3, int var4, int var5, int var6, int var7) { + int var8 = var2.getBlockId(var4, var5, var6); + return var8 > 0 && Block.blocksList[var8].blockActivated(var2, var4, var5, var6, var1) ? true : (var3 == null ? false : var3.useItem(var1, var2, var4, var5, var6, var7)); + } + + public EntityPlayer createPlayer(World var1) { + return new EntityPlayerSP(this.mc, var1, this.mc.session, var1.worldProvider.worldType); + } + + public void interactWithEntity(EntityPlayer var1, Entity var2) { + var1.useCurrentItemOnEntity(var2); + } + + public void attackEntity(EntityPlayer var1, Entity var2) { + var1.attackTargetEntityWithCurrentItem(var2); + } + + public ItemStack func_27174_a(int var1, int var2, int var3, boolean var4, EntityPlayer var5) { + return var5.craftingInventory.func_27280_a(var2, var3, var4, var5); + } + + public void func_20086_a(int var1, EntityPlayer var2) { + var2.craftingInventory.onCraftGuiClosed(var2); + var2.craftingInventory = var2.inventorySlots; + } +} diff --git a/src/net/minecraft/src/PlayerControllerMP.java b/src/net/minecraft/src/PlayerControllerMP.java new file mode 100644 index 0000000..7d3b37a --- /dev/null +++ b/src/net/minecraft/src/PlayerControllerMP.java @@ -0,0 +1,182 @@ +package net.minecraft.src; + +import net.minecraft.client.Minecraft; + +public class PlayerControllerMP extends PlayerController { + private int currentBlockX = -1; + private int currentBlockY = -1; + private int currentblockZ = -1; + private float curBlockDamageMP = 0.0F; + private float prevBlockDamageMP = 0.0F; + private float field_9441_h = 0.0F; + private int blockHitDelay = 0; + private boolean isHittingBlock = false; + private NetClientHandler netClientHandler; + private int currentPlayerItem = 0; + + public PlayerControllerMP(Minecraft var1, NetClientHandler var2) { + super(var1); + this.netClientHandler = var2; + } + + public void flipPlayer(EntityPlayer var1) { + var1.rotationYaw = -180.0F; + } + + public boolean sendBlockRemoved(int var1, int var2, int var3, int var4) { + int var5 = this.mc.theWorld.getBlockId(var1, var2, var3); + boolean var6 = super.sendBlockRemoved(var1, var2, var3, var4); + ItemStack var7 = this.mc.thePlayer.getCurrentEquippedItem(); + if(var7 != null) { + var7.onDestroyBlock(var5, var1, var2, var3, this.mc.thePlayer); + if(var7.stackSize == 0) { + var7.func_1097_a(this.mc.thePlayer); + this.mc.thePlayer.destroyCurrentEquippedItem(); + } + } + + return var6; + } + + public void clickBlock(int var1, int var2, int var3, int var4) { + if(!this.isHittingBlock || var1 != this.currentBlockX || var2 != this.currentBlockY || var3 != this.currentblockZ) { + this.netClientHandler.addToSendQueue(new Packet14BlockDig(0, var1, var2, var3, var4)); + int var5 = this.mc.theWorld.getBlockId(var1, var2, var3); + if(var5 > 0 && this.curBlockDamageMP == 0.0F) { + Block.blocksList[var5].onBlockClicked(this.mc.theWorld, var1, var2, var3, this.mc.thePlayer); + } + + if(var5 > 0 && Block.blocksList[var5].blockStrength(this.mc.thePlayer) >= 1.0F) { + this.sendBlockRemoved(var1, var2, var3, var4); + } else { + this.isHittingBlock = true; + this.currentBlockX = var1; + this.currentBlockY = var2; + this.currentblockZ = var3; + this.curBlockDamageMP = 0.0F; + this.prevBlockDamageMP = 0.0F; + this.field_9441_h = 0.0F; + } + } + + } + + public void resetBlockRemoving() { + this.curBlockDamageMP = 0.0F; + this.isHittingBlock = false; + } + + public void sendBlockRemoving(int var1, int var2, int var3, int var4) { + if(this.isHittingBlock) { + this.syncCurrentPlayItem(); + if(this.blockHitDelay > 0) { + --this.blockHitDelay; + } else { + if(var1 == this.currentBlockX && var2 == this.currentBlockY && var3 == this.currentblockZ) { + int var5 = this.mc.theWorld.getBlockId(var1, var2, var3); + if(var5 == 0) { + this.isHittingBlock = false; + return; + } + + Block var6 = Block.blocksList[var5]; + this.curBlockDamageMP += var6.blockStrength(this.mc.thePlayer); + if(this.field_9441_h % 4.0F == 0.0F && var6 != null) { + this.mc.sndManager.playSound(var6.stepSound.func_1145_d(), (float)var1 + 0.5F, (float)var2 + 0.5F, (float)var3 + 0.5F, (var6.stepSound.getVolume() + 1.0F) / 8.0F, var6.stepSound.getPitch() * 0.5F); + } + + ++this.field_9441_h; + if(this.curBlockDamageMP >= 1.0F) { + this.isHittingBlock = false; + this.netClientHandler.addToSendQueue(new Packet14BlockDig(2, var1, var2, var3, var4)); + this.sendBlockRemoved(var1, var2, var3, var4); + this.curBlockDamageMP = 0.0F; + this.prevBlockDamageMP = 0.0F; + this.field_9441_h = 0.0F; + this.blockHitDelay = 5; + } + } else { + this.clickBlock(var1, var2, var3, var4); + } + + } + } + } + + public void setPartialTime(float var1) { + if(this.curBlockDamageMP <= 0.0F) { + this.mc.ingameGUI.damageGuiPartialTime = 0.0F; + this.mc.renderGlobal.damagePartialTime = 0.0F; + } else { + float var2 = this.prevBlockDamageMP + (this.curBlockDamageMP - this.prevBlockDamageMP) * var1; + this.mc.ingameGUI.damageGuiPartialTime = var2; + this.mc.renderGlobal.damagePartialTime = var2; + } + + } + + public float getBlockReachDistance() { + return 4.0F; + } + + public void func_717_a(World var1) { + super.func_717_a(var1); + } + + public void updateController() { + this.syncCurrentPlayItem(); + this.prevBlockDamageMP = this.curBlockDamageMP; + this.mc.sndManager.playRandomMusicIfReady(); + } + + private void syncCurrentPlayItem() { + int var1 = this.mc.thePlayer.inventory.currentItem; + if(var1 != this.currentPlayerItem) { + this.currentPlayerItem = var1; + this.netClientHandler.addToSendQueue(new Packet16BlockItemSwitch(this.currentPlayerItem)); + } + + } + + public boolean sendPlaceBlock(EntityPlayer var1, World var2, ItemStack var3, int var4, int var5, int var6, int var7) { + this.syncCurrentPlayItem(); + this.netClientHandler.addToSendQueue(new Packet15Place(var4, var5, var6, var7, var1.inventory.getCurrentItem())); + boolean var8 = super.sendPlaceBlock(var1, var2, var3, var4, var5, var6, var7); + return var8; + } + + public boolean sendUseItem(EntityPlayer var1, World var2, ItemStack var3) { + this.syncCurrentPlayItem(); + this.netClientHandler.addToSendQueue(new Packet15Place(-1, -1, -1, 255, var1.inventory.getCurrentItem())); + boolean var4 = super.sendUseItem(var1, var2, var3); + return var4; + } + + public EntityPlayer createPlayer(World var1) { + return new EntityClientPlayerMP(this.mc, var1, this.mc.session, this.netClientHandler); + } + + public void attackEntity(EntityPlayer var1, Entity var2) { + this.syncCurrentPlayItem(); + this.netClientHandler.addToSendQueue(new Packet7UseEntity(var1.entityId, var2.entityId, 1)); + var1.attackTargetEntityWithCurrentItem(var2); + } + + public void interactWithEntity(EntityPlayer var1, Entity var2) { + this.syncCurrentPlayItem(); + this.netClientHandler.addToSendQueue(new Packet7UseEntity(var1.entityId, var2.entityId, 0)); + var1.useCurrentItemOnEntity(var2); + } + + public ItemStack func_27174_a(int var1, int var2, int var3, boolean var4, EntityPlayer var5) { + short var6 = var5.craftingInventory.func_20111_a(var5.inventory); + ItemStack var7 = super.func_27174_a(var1, var2, var3, var4, var5); + this.netClientHandler.addToSendQueue(new Packet102WindowClick(var1, var2, var3, var4, var7, var6)); + return var7; + } + + public void func_20086_a(int var1, EntityPlayer var2) { + if(var1 != -9999) { + } + } +} diff --git a/src/net/minecraft/src/PlayerControllerSP.java b/src/net/minecraft/src/PlayerControllerSP.java new file mode 100644 index 0000000..e3c14e1 --- /dev/null +++ b/src/net/minecraft/src/PlayerControllerSP.java @@ -0,0 +1,121 @@ +package net.minecraft.src; + +import net.minecraft.client.Minecraft; + +public class PlayerControllerSP extends PlayerController { + private int field_1074_c = -1; + private int field_1073_d = -1; + private int field_1072_e = -1; + private float curBlockDamage = 0.0F; + private float prevBlockDamage = 0.0F; + private float field_1069_h = 0.0F; + private int blockHitWait = 0; + + public PlayerControllerSP(Minecraft var1) { + super(var1); + } + + public void flipPlayer(EntityPlayer var1) { + var1.rotationYaw = -180.0F; + } + + public boolean sendBlockRemoved(int var1, int var2, int var3, int var4) { + int var5 = this.mc.theWorld.getBlockId(var1, var2, var3); + int var6 = this.mc.theWorld.getBlockMetadata(var1, var2, var3); + boolean var7 = super.sendBlockRemoved(var1, var2, var3, var4); + ItemStack var8 = this.mc.thePlayer.getCurrentEquippedItem(); + boolean var9 = this.mc.thePlayer.canHarvestBlock(Block.blocksList[var5]); + if(var8 != null) { + var8.onDestroyBlock(var5, var1, var2, var3, this.mc.thePlayer); + if(var8.stackSize == 0) { + var8.func_1097_a(this.mc.thePlayer); + this.mc.thePlayer.destroyCurrentEquippedItem(); + } + } + + if(var7 && var9) { + Block.blocksList[var5].harvestBlock(this.mc.theWorld, this.mc.thePlayer, var1, var2, var3, var6); + } + + return var7; + } + + public void clickBlock(int var1, int var2, int var3, int var4) { + this.mc.theWorld.onBlockHit(this.mc.thePlayer, var1, var2, var3, var4); + int var5 = this.mc.theWorld.getBlockId(var1, var2, var3); + if(var5 > 0 && this.curBlockDamage == 0.0F) { + Block.blocksList[var5].onBlockClicked(this.mc.theWorld, var1, var2, var3, this.mc.thePlayer); + } + + if(var5 > 0 && Block.blocksList[var5].blockStrength(this.mc.thePlayer) >= 1.0F) { + this.sendBlockRemoved(var1, var2, var3, var4); + } + + } + + public void resetBlockRemoving() { + this.curBlockDamage = 0.0F; + this.blockHitWait = 0; + } + + public void sendBlockRemoving(int var1, int var2, int var3, int var4) { + if(this.blockHitWait > 0) { + --this.blockHitWait; + } else { + if(var1 == this.field_1074_c && var2 == this.field_1073_d && var3 == this.field_1072_e) { + int var5 = this.mc.theWorld.getBlockId(var1, var2, var3); + if(var5 == 0) { + return; + } + + Block var6 = Block.blocksList[var5]; + this.curBlockDamage += var6.blockStrength(this.mc.thePlayer); + if(this.field_1069_h % 4.0F == 0.0F && var6 != null) { + this.mc.sndManager.playSound(var6.stepSound.func_1145_d(), (float)var1 + 0.5F, (float)var2 + 0.5F, (float)var3 + 0.5F, (var6.stepSound.getVolume() + 1.0F) / 8.0F, var6.stepSound.getPitch() * 0.5F); + } + + ++this.field_1069_h; + if(this.curBlockDamage >= 1.0F) { + this.sendBlockRemoved(var1, var2, var3, var4); + this.curBlockDamage = 0.0F; + this.prevBlockDamage = 0.0F; + this.field_1069_h = 0.0F; + this.blockHitWait = 5; + } + } else { + this.curBlockDamage = 0.0F; + this.prevBlockDamage = 0.0F; + this.field_1069_h = 0.0F; + this.field_1074_c = var1; + this.field_1073_d = var2; + this.field_1072_e = var3; + } + + } + } + + public void setPartialTime(float var1) { + if(this.curBlockDamage <= 0.0F) { + this.mc.ingameGUI.damageGuiPartialTime = 0.0F; + this.mc.renderGlobal.damagePartialTime = 0.0F; + } else { + float var2 = this.prevBlockDamage + (this.curBlockDamage - this.prevBlockDamage) * var1; + this.mc.ingameGUI.damageGuiPartialTime = var2; + this.mc.renderGlobal.damagePartialTime = var2; + } + + } + + public float getBlockReachDistance() { + return 4.0F; + } + + public void func_717_a(World var1) { + super.func_717_a(var1); + } + + public void updateController() { + this.prevBlockDamage = this.curBlockDamage; + this.mc.sndManager.playRandomMusicIfReady(); + } +} diff --git a/src/net/minecraft/src/PlayerControllerTest.java b/src/net/minecraft/src/PlayerControllerTest.java new file mode 100644 index 0000000..5dc52b2 --- /dev/null +++ b/src/net/minecraft/src/PlayerControllerTest.java @@ -0,0 +1,32 @@ +package net.minecraft.src; + +import net.minecraft.client.Minecraft; + +public class PlayerControllerTest extends PlayerController { + public PlayerControllerTest(Minecraft var1) { + super(var1); + this.field_1064_b = true; + } + + public void func_6473_b(EntityPlayer var1) { + for(int var2 = 0; var2 < 9; ++var2) { + if(var1.inventory.mainInventory[var2] == null) { + this.mc.thePlayer.inventory.mainInventory[var2] = new ItemStack((Block)Session.registeredBlocksList.get(var2)); + } else { + this.mc.thePlayer.inventory.mainInventory[var2].stackSize = 1; + } + } + + } + + public boolean shouldDrawHUD() { + return false; + } + + public void func_717_a(World var1) { + super.func_717_a(var1); + } + + public void updateController() { + } +} diff --git a/src/net/minecraft/src/PositionTextureVertex.java b/src/net/minecraft/src/PositionTextureVertex.java new file mode 100644 index 0000000..a7b5649 --- /dev/null +++ b/src/net/minecraft/src/PositionTextureVertex.java @@ -0,0 +1,27 @@ +package net.minecraft.src; + +public class PositionTextureVertex { + public Vec3D vector3D; + public float texturePositionX; + public float texturePositionY; + + public PositionTextureVertex(float var1, float var2, float var3, float var4, float var5) { + this(Vec3D.createVectorHelper((double)var1, (double)var2, (double)var3), var4, var5); + } + + public PositionTextureVertex setTexturePosition(float var1, float var2) { + return new PositionTextureVertex(this, var1, var2); + } + + public PositionTextureVertex(PositionTextureVertex var1, float var2, float var3) { + this.vector3D = var1.vector3D; + this.texturePositionX = var2; + this.texturePositionY = var3; + } + + public PositionTextureVertex(Vec3D var1, float var2, float var3) { + this.vector3D = var1; + this.texturePositionX = var2; + this.texturePositionY = var3; + } +} diff --git a/src/net/minecraft/src/RailLogic.java b/src/net/minecraft/src/RailLogic.java new file mode 100644 index 0000000..1a1e06c --- /dev/null +++ b/src/net/minecraft/src/RailLogic.java @@ -0,0 +1,348 @@ +package net.minecraft.src; + +import java.util.ArrayList; +import java.util.List; + +class RailLogic { + private World worldObj; + private int trackX; + private int trackY; + private int trackZ; + private final boolean isPoweredRail; + private List connectedTracks; + final BlockRail rail; + + public RailLogic(BlockRail var1, World var2, int var3, int var4, int var5) { + this.rail = var1; + this.connectedTracks = new ArrayList(); + this.worldObj = var2; + this.trackX = var3; + this.trackY = var4; + this.trackZ = var5; + int var6 = var2.getBlockId(var3, var4, var5); + int var7 = var2.getBlockMetadata(var3, var4, var5); + if(BlockRail.isPoweredBlockRail((BlockRail)Block.blocksList[var6])) { + this.isPoweredRail = true; + var7 &= -9; + } else { + this.isPoweredRail = false; + } + + this.setConnections(var7); + } + + private void setConnections(int var1) { + this.connectedTracks.clear(); + if(var1 == 0) { + this.connectedTracks.add(new ChunkPosition(this.trackX, this.trackY, this.trackZ - 1)); + this.connectedTracks.add(new ChunkPosition(this.trackX, this.trackY, this.trackZ + 1)); + } else if(var1 == 1) { + this.connectedTracks.add(new ChunkPosition(this.trackX - 1, this.trackY, this.trackZ)); + this.connectedTracks.add(new ChunkPosition(this.trackX + 1, this.trackY, this.trackZ)); + } else if(var1 == 2) { + this.connectedTracks.add(new ChunkPosition(this.trackX - 1, this.trackY, this.trackZ)); + this.connectedTracks.add(new ChunkPosition(this.trackX + 1, this.trackY + 1, this.trackZ)); + } else if(var1 == 3) { + this.connectedTracks.add(new ChunkPosition(this.trackX - 1, this.trackY + 1, this.trackZ)); + this.connectedTracks.add(new ChunkPosition(this.trackX + 1, this.trackY, this.trackZ)); + } else if(var1 == 4) { + this.connectedTracks.add(new ChunkPosition(this.trackX, this.trackY + 1, this.trackZ - 1)); + this.connectedTracks.add(new ChunkPosition(this.trackX, this.trackY, this.trackZ + 1)); + } else if(var1 == 5) { + this.connectedTracks.add(new ChunkPosition(this.trackX, this.trackY, this.trackZ - 1)); + this.connectedTracks.add(new ChunkPosition(this.trackX, this.trackY + 1, this.trackZ + 1)); + } else if(var1 == 6) { + this.connectedTracks.add(new ChunkPosition(this.trackX + 1, this.trackY, this.trackZ)); + this.connectedTracks.add(new ChunkPosition(this.trackX, this.trackY, this.trackZ + 1)); + } else if(var1 == 7) { + this.connectedTracks.add(new ChunkPosition(this.trackX - 1, this.trackY, this.trackZ)); + this.connectedTracks.add(new ChunkPosition(this.trackX, this.trackY, this.trackZ + 1)); + } else if(var1 == 8) { + this.connectedTracks.add(new ChunkPosition(this.trackX - 1, this.trackY, this.trackZ)); + this.connectedTracks.add(new ChunkPosition(this.trackX, this.trackY, this.trackZ - 1)); + } else if(var1 == 9) { + this.connectedTracks.add(new ChunkPosition(this.trackX + 1, this.trackY, this.trackZ)); + this.connectedTracks.add(new ChunkPosition(this.trackX, this.trackY, this.trackZ - 1)); + } + + } + + private void func_785_b() { + for(int var1 = 0; var1 < this.connectedTracks.size(); ++var1) { + RailLogic var2 = this.getMinecartTrackLogic((ChunkPosition)this.connectedTracks.get(var1)); + if(var2 != null && var2.isConnectedTo(this)) { + this.connectedTracks.set(var1, new ChunkPosition(var2.trackX, var2.trackY, var2.trackZ)); + } else { + this.connectedTracks.remove(var1--); + } + } + + } + + private boolean isMinecartTrack(int var1, int var2, int var3) { + return BlockRail.isRailBlockAt(this.worldObj, var1, var2, var3) ? true : (BlockRail.isRailBlockAt(this.worldObj, var1, var2 + 1, var3) ? true : BlockRail.isRailBlockAt(this.worldObj, var1, var2 - 1, var3)); + } + + private RailLogic getMinecartTrackLogic(ChunkPosition var1) { + return BlockRail.isRailBlockAt(this.worldObj, var1.x, var1.y, var1.z) ? new RailLogic(this.rail, this.worldObj, var1.x, var1.y, var1.z) : (BlockRail.isRailBlockAt(this.worldObj, var1.x, var1.y + 1, var1.z) ? new RailLogic(this.rail, this.worldObj, var1.x, var1.y + 1, var1.z) : (BlockRail.isRailBlockAt(this.worldObj, var1.x, var1.y - 1, var1.z) ? new RailLogic(this.rail, this.worldObj, var1.x, var1.y - 1, var1.z) : null)); + } + + private boolean isConnectedTo(RailLogic var1) { + for(int var2 = 0; var2 < this.connectedTracks.size(); ++var2) { + ChunkPosition var3 = (ChunkPosition)this.connectedTracks.get(var2); + if(var3.x == var1.trackX && var3.z == var1.trackZ) { + return true; + } + } + + return false; + } + + private boolean isInTrack(int var1, int var2, int var3) { + for(int var4 = 0; var4 < this.connectedTracks.size(); ++var4) { + ChunkPosition var5 = (ChunkPosition)this.connectedTracks.get(var4); + if(var5.x == var1 && var5.z == var3) { + return true; + } + } + + return false; + } + + private int getAdjacentTracks() { + int var1 = 0; + if(this.isMinecartTrack(this.trackX, this.trackY, this.trackZ - 1)) { + ++var1; + } + + if(this.isMinecartTrack(this.trackX, this.trackY, this.trackZ + 1)) { + ++var1; + } + + if(this.isMinecartTrack(this.trackX - 1, this.trackY, this.trackZ)) { + ++var1; + } + + if(this.isMinecartTrack(this.trackX + 1, this.trackY, this.trackZ)) { + ++var1; + } + + return var1; + } + + private boolean handleKeyPress(RailLogic var1) { + if(this.isConnectedTo(var1)) { + return true; + } else if(this.connectedTracks.size() == 2) { + return false; + } else if(this.connectedTracks.size() == 0) { + return true; + } else { + ChunkPosition var2 = (ChunkPosition)this.connectedTracks.get(0); + return var1.trackY == this.trackY && var2.y == this.trackY ? true : true; + } + } + + private void func_788_d(RailLogic var1) { + this.connectedTracks.add(new ChunkPosition(var1.trackX, var1.trackY, var1.trackZ)); + boolean var2 = this.isInTrack(this.trackX, this.trackY, this.trackZ - 1); + boolean var3 = this.isInTrack(this.trackX, this.trackY, this.trackZ + 1); + boolean var4 = this.isInTrack(this.trackX - 1, this.trackY, this.trackZ); + boolean var5 = this.isInTrack(this.trackX + 1, this.trackY, this.trackZ); + byte var6 = -1; + if(var2 || var3) { + var6 = 0; + } + + if(var4 || var5) { + var6 = 1; + } + + if(!this.isPoweredRail) { + if(var3 && var5 && !var2 && !var4) { + var6 = 6; + } + + if(var3 && var4 && !var2 && !var5) { + var6 = 7; + } + + if(var2 && var4 && !var3 && !var5) { + var6 = 8; + } + + if(var2 && var5 && !var3 && !var4) { + var6 = 9; + } + } + + if(var6 == 0) { + if(BlockRail.isRailBlockAt(this.worldObj, this.trackX, this.trackY + 1, this.trackZ - 1)) { + var6 = 4; + } + + if(BlockRail.isRailBlockAt(this.worldObj, this.trackX, this.trackY + 1, this.trackZ + 1)) { + var6 = 5; + } + } + + if(var6 == 1) { + if(BlockRail.isRailBlockAt(this.worldObj, this.trackX + 1, this.trackY + 1, this.trackZ)) { + var6 = 2; + } + + if(BlockRail.isRailBlockAt(this.worldObj, this.trackX - 1, this.trackY + 1, this.trackZ)) { + var6 = 3; + } + } + + if(var6 < 0) { + var6 = 0; + } + + int var7 = var6; + if(this.isPoweredRail) { + var7 = this.worldObj.getBlockMetadata(this.trackX, this.trackY, this.trackZ) & 8 | var6; + } + + this.worldObj.setBlockMetadataWithNotify(this.trackX, this.trackY, this.trackZ, var7); + } + + private boolean func_786_c(int var1, int var2, int var3) { + RailLogic var4 = this.getMinecartTrackLogic(new ChunkPosition(var1, var2, var3)); + if(var4 == null) { + return false; + } else { + var4.func_785_b(); + return var4.handleKeyPress(this); + } + } + + public void func_792_a(boolean var1, boolean var2) { + boolean var3 = this.func_786_c(this.trackX, this.trackY, this.trackZ - 1); + boolean var4 = this.func_786_c(this.trackX, this.trackY, this.trackZ + 1); + boolean var5 = this.func_786_c(this.trackX - 1, this.trackY, this.trackZ); + boolean var6 = this.func_786_c(this.trackX + 1, this.trackY, this.trackZ); + byte var7 = -1; + if((var3 || var4) && !var5 && !var6) { + var7 = 0; + } + + if((var5 || var6) && !var3 && !var4) { + var7 = 1; + } + + if(!this.isPoweredRail) { + if(var4 && var6 && !var3 && !var5) { + var7 = 6; + } + + if(var4 && var5 && !var3 && !var6) { + var7 = 7; + } + + if(var3 && var5 && !var4 && !var6) { + var7 = 8; + } + + if(var3 && var6 && !var4 && !var5) { + var7 = 9; + } + } + + if(var7 == -1) { + if(var3 || var4) { + var7 = 0; + } + + if(var5 || var6) { + var7 = 1; + } + + if(!this.isPoweredRail) { + if(var1) { + if(var4 && var6) { + var7 = 6; + } + + if(var5 && var4) { + var7 = 7; + } + + if(var6 && var3) { + var7 = 9; + } + + if(var3 && var5) { + var7 = 8; + } + } else { + if(var3 && var5) { + var7 = 8; + } + + if(var6 && var3) { + var7 = 9; + } + + if(var5 && var4) { + var7 = 7; + } + + if(var4 && var6) { + var7 = 6; + } + } + } + } + + if(var7 == 0) { + if(BlockRail.isRailBlockAt(this.worldObj, this.trackX, this.trackY + 1, this.trackZ - 1)) { + var7 = 4; + } + + if(BlockRail.isRailBlockAt(this.worldObj, this.trackX, this.trackY + 1, this.trackZ + 1)) { + var7 = 5; + } + } + + if(var7 == 1) { + if(BlockRail.isRailBlockAt(this.worldObj, this.trackX + 1, this.trackY + 1, this.trackZ)) { + var7 = 2; + } + + if(BlockRail.isRailBlockAt(this.worldObj, this.trackX - 1, this.trackY + 1, this.trackZ)) { + var7 = 3; + } + } + + if(var7 < 0) { + var7 = 0; + } + + this.setConnections(var7); + int var8 = var7; + if(this.isPoweredRail) { + var8 = this.worldObj.getBlockMetadata(this.trackX, this.trackY, this.trackZ) & 8 | var7; + } + + if(var2 || this.worldObj.getBlockMetadata(this.trackX, this.trackY, this.trackZ) != var8) { + this.worldObj.setBlockMetadataWithNotify(this.trackX, this.trackY, this.trackZ, var8); + + for(int var9 = 0; var9 < this.connectedTracks.size(); ++var9) { + RailLogic var10 = this.getMinecartTrackLogic((ChunkPosition)this.connectedTracks.get(var9)); + if(var10 != null) { + var10.func_785_b(); + if(var10.handleKeyPress(this)) { + var10.func_788_d(this); + } + } + } + } + + } + + static int getNAdjacentTracks(RailLogic var0) { + return var0.getAdjacentTracks(); + } +} diff --git a/src/net/minecraft/src/RecipeSorter.java b/src/net/minecraft/src/RecipeSorter.java new file mode 100644 index 0000000..bc28af1 --- /dev/null +++ b/src/net/minecraft/src/RecipeSorter.java @@ -0,0 +1,19 @@ +package net.minecraft.src; + +import java.util.Comparator; + +class RecipeSorter implements Comparator { + final CraftingManager craftingManager; + + RecipeSorter(CraftingManager var1) { + this.craftingManager = var1; + } + + public int compareRecipes(IRecipe var1, IRecipe var2) { + return var1 instanceof ShapelessRecipes && var2 instanceof ShapedRecipes ? 1 : (var2 instanceof ShapelessRecipes && var1 instanceof ShapedRecipes ? -1 : (var2.getRecipeSize() < var1.getRecipeSize() ? -1 : (var2.getRecipeSize() > var1.getRecipeSize() ? 1 : 0))); + } + + public int compare(Object var1, Object var2) { + return this.compareRecipes((IRecipe)var1, (IRecipe)var2); + } +} diff --git a/src/net/minecraft/src/RecipesArmor.java b/src/net/minecraft/src/RecipesArmor.java new file mode 100644 index 0000000..c1daca5 --- /dev/null +++ b/src/net/minecraft/src/RecipesArmor.java @@ -0,0 +1,18 @@ +package net.minecraft.src; + +public class RecipesArmor { + private String[][] recipePatterns = new String[][]{{"XXX", "X X"}, {"X X", "XXX", "XXX"}, {"XXX", "X X", "X X"}, {"X X", "X X"}}; + private Object[][] recipeItems = new Object[][]{{Item.leather, Block.fire, Item.ingotIron, Item.diamond, Item.ingotGold}, {Item.helmetLeather, Item.helmetChain, Item.helmetSteel, Item.helmetDiamond, Item.helmetGold}, {Item.plateLeather, Item.plateChain, Item.plateSteel, Item.plateDiamond, Item.plateGold}, {Item.legsLeather, Item.legsChain, Item.legsSteel, Item.legsDiamond, Item.legsGold}, {Item.bootsLeather, Item.bootsChain, Item.bootsSteel, Item.bootsDiamond, Item.bootsGold}}; + + public void addRecipes(CraftingManager var1) { + for(int var2 = 0; var2 < this.recipeItems[0].length; ++var2) { + Object var3 = this.recipeItems[0][var2]; + + for(int var4 = 0; var4 < this.recipeItems.length - 1; ++var4) { + Item var5 = (Item)this.recipeItems[var4 + 1][var2]; + var1.addRecipe(new ItemStack(var5), new Object[]{this.recipePatterns[var4], Character.valueOf('X'), var3}); + } + } + + } +} diff --git a/src/net/minecraft/src/RecipesCrafting.java b/src/net/minecraft/src/RecipesCrafting.java new file mode 100644 index 0000000..20fa0b9 --- /dev/null +++ b/src/net/minecraft/src/RecipesCrafting.java @@ -0,0 +1,10 @@ +package net.minecraft.src; + +public class RecipesCrafting { + public void addRecipes(CraftingManager var1) { + var1.addRecipe(new ItemStack(Block.chest), new Object[]{"###", "# #", "###", Character.valueOf('#'), Block.planks}); + var1.addRecipe(new ItemStack(Block.stoneOvenIdle), new Object[]{"###", "# #", "###", Character.valueOf('#'), Block.cobblestone}); + var1.addRecipe(new ItemStack(Block.workbench), new Object[]{"##", "##", Character.valueOf('#'), Block.planks}); + var1.addRecipe(new ItemStack(Block.sandStone), new Object[]{"##", "##", Character.valueOf('#'), Block.sand}); + } +} diff --git a/src/net/minecraft/src/RecipesDyes.java b/src/net/minecraft/src/RecipesDyes.java new file mode 100644 index 0000000..7e4832c --- /dev/null +++ b/src/net/minecraft/src/RecipesDyes.java @@ -0,0 +1,25 @@ +package net.minecraft.src; + +public class RecipesDyes { + public void addRecipes(CraftingManager var1) { + for(int var2 = 0; var2 < 16; ++var2) { + var1.addShapelessRecipe(new ItemStack(Block.cloth, 1, BlockCloth.func_21035_d(var2)), new Object[]{new ItemStack(Item.dyePowder, 1, var2), new ItemStack(Item.itemsList[Block.cloth.blockID], 1, 0)}); + } + + var1.addShapelessRecipe(new ItemStack(Item.dyePowder, 2, 11), new Object[]{Block.plantYellow}); + var1.addShapelessRecipe(new ItemStack(Item.dyePowder, 2, 1), new Object[]{Block.plantRed}); + var1.addShapelessRecipe(new ItemStack(Item.dyePowder, 3, 15), new Object[]{Item.bone}); + var1.addShapelessRecipe(new ItemStack(Item.dyePowder, 2, 9), new Object[]{new ItemStack(Item.dyePowder, 1, 1), new ItemStack(Item.dyePowder, 1, 15)}); + var1.addShapelessRecipe(new ItemStack(Item.dyePowder, 2, 14), new Object[]{new ItemStack(Item.dyePowder, 1, 1), new ItemStack(Item.dyePowder, 1, 11)}); + var1.addShapelessRecipe(new ItemStack(Item.dyePowder, 2, 10), new Object[]{new ItemStack(Item.dyePowder, 1, 2), new ItemStack(Item.dyePowder, 1, 15)}); + var1.addShapelessRecipe(new ItemStack(Item.dyePowder, 2, 8), new Object[]{new ItemStack(Item.dyePowder, 1, 0), new ItemStack(Item.dyePowder, 1, 15)}); + var1.addShapelessRecipe(new ItemStack(Item.dyePowder, 2, 7), new Object[]{new ItemStack(Item.dyePowder, 1, 8), new ItemStack(Item.dyePowder, 1, 15)}); + var1.addShapelessRecipe(new ItemStack(Item.dyePowder, 3, 7), new Object[]{new ItemStack(Item.dyePowder, 1, 0), new ItemStack(Item.dyePowder, 1, 15), new ItemStack(Item.dyePowder, 1, 15)}); + var1.addShapelessRecipe(new ItemStack(Item.dyePowder, 2, 12), new Object[]{new ItemStack(Item.dyePowder, 1, 4), new ItemStack(Item.dyePowder, 1, 15)}); + var1.addShapelessRecipe(new ItemStack(Item.dyePowder, 2, 6), new Object[]{new ItemStack(Item.dyePowder, 1, 4), new ItemStack(Item.dyePowder, 1, 2)}); + var1.addShapelessRecipe(new ItemStack(Item.dyePowder, 2, 5), new Object[]{new ItemStack(Item.dyePowder, 1, 4), new ItemStack(Item.dyePowder, 1, 1)}); + var1.addShapelessRecipe(new ItemStack(Item.dyePowder, 2, 13), new Object[]{new ItemStack(Item.dyePowder, 1, 5), new ItemStack(Item.dyePowder, 1, 9)}); + var1.addShapelessRecipe(new ItemStack(Item.dyePowder, 3, 13), new Object[]{new ItemStack(Item.dyePowder, 1, 4), new ItemStack(Item.dyePowder, 1, 1), new ItemStack(Item.dyePowder, 1, 9)}); + var1.addShapelessRecipe(new ItemStack(Item.dyePowder, 4, 13), new Object[]{new ItemStack(Item.dyePowder, 1, 4), new ItemStack(Item.dyePowder, 1, 1), new ItemStack(Item.dyePowder, 1, 1), new ItemStack(Item.dyePowder, 1, 15)}); + } +} diff --git a/src/net/minecraft/src/RecipesFood.java b/src/net/minecraft/src/RecipesFood.java new file mode 100644 index 0000000..e7c2c78 --- /dev/null +++ b/src/net/minecraft/src/RecipesFood.java @@ -0,0 +1,9 @@ +package net.minecraft.src; + +public class RecipesFood { + public void addRecipes(CraftingManager var1) { + var1.addRecipe(new ItemStack(Item.bowlSoup), new Object[]{"Y", "X", "#", Character.valueOf('X'), Block.mushroomBrown, Character.valueOf('Y'), Block.mushroomRed, Character.valueOf('#'), Item.bowlEmpty}); + var1.addRecipe(new ItemStack(Item.bowlSoup), new Object[]{"Y", "X", "#", Character.valueOf('X'), Block.mushroomRed, Character.valueOf('Y'), Block.mushroomBrown, Character.valueOf('#'), Item.bowlEmpty}); + var1.addRecipe(new ItemStack(Item.cookie, 8), new Object[]{"#X#", Character.valueOf('X'), new ItemStack(Item.dyePowder, 1, 3), Character.valueOf('#'), Item.wheat}); + } +} diff --git a/src/net/minecraft/src/RecipesIngots.java b/src/net/minecraft/src/RecipesIngots.java new file mode 100644 index 0000000..d99c0f9 --- /dev/null +++ b/src/net/minecraft/src/RecipesIngots.java @@ -0,0 +1,15 @@ +package net.minecraft.src; + +public class RecipesIngots { + private Object[][] recipeItems = new Object[][]{{Block.blockGold, new ItemStack(Item.ingotGold, 9)}, {Block.blockSteel, new ItemStack(Item.ingotIron, 9)}, {Block.blockDiamond, new ItemStack(Item.diamond, 9)}, {Block.blockLapis, new ItemStack(Item.dyePowder, 9, 4)}}; + + public void addRecipes(CraftingManager var1) { + for(int var2 = 0; var2 < this.recipeItems.length; ++var2) { + Block var3 = (Block)this.recipeItems[var2][0]; + ItemStack var4 = (ItemStack)this.recipeItems[var2][1]; + var1.addRecipe(new ItemStack(var3), new Object[]{"###", "###", "###", Character.valueOf('#'), var4}); + var1.addRecipe(var4, new Object[]{"#", Character.valueOf('#'), var3}); + } + + } +} diff --git a/src/net/minecraft/src/RecipesTools.java b/src/net/minecraft/src/RecipesTools.java new file mode 100644 index 0000000..87d9e75 --- /dev/null +++ b/src/net/minecraft/src/RecipesTools.java @@ -0,0 +1,19 @@ +package net.minecraft.src; + +public class RecipesTools { + private String[][] recipePatterns = new String[][]{{"XXX", " # ", " # "}, {"X", "#", "#"}, {"XX", "X#", " #"}, {"XX", " #", " #"}}; + private Object[][] recipeItems = new Object[][]{{Block.planks, Block.cobblestone, Item.ingotIron, Item.diamond, Item.ingotGold}, {Item.pickaxeWood, Item.pickaxeStone, Item.pickaxeSteel, Item.pickaxeDiamond, Item.pickaxeGold}, {Item.shovelWood, Item.shovelStone, Item.shovelSteel, Item.shovelDiamond, Item.shovelGold}, {Item.axeWood, Item.axeStone, Item.axeSteel, Item.axeDiamond, Item.axeGold}, {Item.hoeWood, Item.hoeStone, Item.hoeSteel, Item.hoeDiamond, Item.hoeGold}}; + + public void addRecipes(CraftingManager var1) { + for(int var2 = 0; var2 < this.recipeItems[0].length; ++var2) { + Object var3 = this.recipeItems[0][var2]; + + for(int var4 = 0; var4 < this.recipeItems.length - 1; ++var4) { + Item var5 = (Item)this.recipeItems[var4 + 1][var2]; + var1.addRecipe(new ItemStack(var5), new Object[]{this.recipePatterns[var4], Character.valueOf('#'), Item.stick, Character.valueOf('X'), var3}); + } + } + + var1.addRecipe(new ItemStack(Item.shears), new Object[]{" #", "# ", Character.valueOf('#'), Item.ingotIron}); + } +} diff --git a/src/net/minecraft/src/RecipesWeapons.java b/src/net/minecraft/src/RecipesWeapons.java new file mode 100644 index 0000000..80afa16 --- /dev/null +++ b/src/net/minecraft/src/RecipesWeapons.java @@ -0,0 +1,20 @@ +package net.minecraft.src; + +public class RecipesWeapons { + private String[][] recipePatterns = new String[][]{{"X", "X", "#"}}; + private Object[][] recipeItems = new Object[][]{{Block.planks, Block.cobblestone, Item.ingotIron, Item.diamond, Item.ingotGold}, {Item.swordWood, Item.swordStone, Item.swordSteel, Item.swordDiamond, Item.swordGold}}; + + public void addRecipes(CraftingManager var1) { + for(int var2 = 0; var2 < this.recipeItems[0].length; ++var2) { + Object var3 = this.recipeItems[0][var2]; + + for(int var4 = 0; var4 < this.recipeItems.length - 1; ++var4) { + Item var5 = (Item)this.recipeItems[var4 + 1][var2]; + var1.addRecipe(new ItemStack(var5), new Object[]{this.recipePatterns[var4], Character.valueOf('#'), Item.stick, Character.valueOf('X'), var3}); + } + } + + var1.addRecipe(new ItemStack(Item.bow, 1), new Object[]{" #X", "# X", " #X", Character.valueOf('X'), Item.silk, Character.valueOf('#'), Item.stick}); + var1.addRecipe(new ItemStack(Item.arrow, 4), new Object[]{"X", "#", "Y", Character.valueOf('Y'), Item.feather, Character.valueOf('X'), Item.flint, Character.valueOf('#'), Item.stick}); + } +} diff --git a/src/net/minecraft/src/RedstoneUpdateInfo.java b/src/net/minecraft/src/RedstoneUpdateInfo.java new file mode 100644 index 0000000..6474573 --- /dev/null +++ b/src/net/minecraft/src/RedstoneUpdateInfo.java @@ -0,0 +1,15 @@ +package net.minecraft.src; + +class RedstoneUpdateInfo { + int x; + int y; + int z; + long updateTime; + + public RedstoneUpdateInfo(int var1, int var2, int var3, long var4) { + this.x = var1; + this.y = var2; + this.z = var3; + this.updateTime = var4; + } +} diff --git a/src/net/minecraft/src/RegionFile.java b/src/net/minecraft/src/RegionFile.java new file mode 100644 index 0000000..b9bb88c --- /dev/null +++ b/src/net/minecraft/src/RegionFile.java @@ -0,0 +1,274 @@ +package net.minecraft.src; + +import java.io.ByteArrayInputStream; +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.File; +import java.io.IOException; +import java.io.RandomAccessFile; +import java.util.ArrayList; +import java.util.zip.DeflaterOutputStream; +import java.util.zip.GZIPInputStream; +import java.util.zip.InflaterInputStream; + +public class RegionFile { + private static final byte[] emptySector = new byte[4096]; + private final File fileName; + private RandomAccessFile dataFile; + private final int[] offsets = new int[1024]; + private final int[] field_22217_e = new int[1024]; + private ArrayList sectorFree; + private int sizeDelta; + private long field_22214_h = 0L; + + public RegionFile(File var1) { + this.fileName = var1; + this.debugln("REGION LOAD " + this.fileName); + this.sizeDelta = 0; + + try { + if(var1.exists()) { + this.field_22214_h = var1.lastModified(); + } + + this.dataFile = new RandomAccessFile(var1, "rw"); + int var2; + if(this.dataFile.length() < 4096L) { + for(var2 = 0; var2 < 1024; ++var2) { + this.dataFile.writeInt(0); + } + + for(var2 = 0; var2 < 1024; ++var2) { + this.dataFile.writeInt(0); + } + + this.sizeDelta += 8192; + } + + if((this.dataFile.length() & 4095L) != 0L) { + for(var2 = 0; (long)var2 < (this.dataFile.length() & 4095L); ++var2) { + this.dataFile.write(0); + } + } + + var2 = (int)this.dataFile.length() / 4096; + this.sectorFree = new ArrayList(var2); + + int var3; + for(var3 = 0; var3 < var2; ++var3) { + this.sectorFree.add(Boolean.valueOf(true)); + } + + this.sectorFree.set(0, Boolean.valueOf(false)); + this.sectorFree.set(1, Boolean.valueOf(false)); + this.dataFile.seek(0L); + + int var4; + for(var3 = 0; var3 < 1024; ++var3) { + var4 = this.dataFile.readInt(); + this.offsets[var3] = var4; + if(var4 != 0 && (var4 >> 8) + (var4 & 255) <= this.sectorFree.size()) { + for(int var5 = 0; var5 < (var4 & 255); ++var5) { + this.sectorFree.set((var4 >> 8) + var5, Boolean.valueOf(false)); + } + } + } + + for(var3 = 0; var3 < 1024; ++var3) { + var4 = this.dataFile.readInt(); + this.field_22217_e[var3] = var4; + } + } catch (IOException var6) { + var6.printStackTrace(); + } + + } + + public synchronized int func_22209_a() { + int var1 = this.sizeDelta; + this.sizeDelta = 0; + return var1; + } + + private void func_22211_a(String var1) { + } + + private void debugln(String var1) { + this.func_22211_a(var1 + "\n"); + } + + private void func_22199_a(String var1, int var2, int var3, String var4) { + this.func_22211_a("REGION " + var1 + " " + this.fileName.getName() + "[" + var2 + "," + var3 + "] = " + var4); + } + + private void func_22197_a(String var1, int var2, int var3, int var4, String var5) { + this.func_22211_a("REGION " + var1 + " " + this.fileName.getName() + "[" + var2 + "," + var3 + "] " + var4 + "B = " + var5); + } + + private void debugln(String var1, int var2, int var3, String var4) { + this.func_22199_a(var1, var2, var3, var4 + "\n"); + } + + public synchronized DataInputStream getChunkDataInputStream(int var1, int var2) { + if(this.outOfBounds(var1, var2)) { + this.debugln("READ", var1, var2, "out of bounds"); + return null; + } else { + try { + int var3 = this.getOffset(var1, var2); + if(var3 == 0) { + return null; + } else { + int var4 = var3 >> 8; + int var5 = var3 & 255; + if(var4 + var5 > this.sectorFree.size()) { + this.debugln("READ", var1, var2, "invalid sector"); + return null; + } else { + this.dataFile.seek((long)(var4 * 4096)); + int var6 = this.dataFile.readInt(); + if(var6 > 4096 * var5) { + this.debugln("READ", var1, var2, "invalid length: " + var6 + " > 4096 * " + var5); + return null; + } else { + byte var7 = this.dataFile.readByte(); + byte[] var8; + DataInputStream var9; + if(var7 == 1) { + var8 = new byte[var6 - 1]; + this.dataFile.read(var8); + var9 = new DataInputStream(new GZIPInputStream(new ByteArrayInputStream(var8))); + return var9; + } else if(var7 == 2) { + var8 = new byte[var6 - 1]; + this.dataFile.read(var8); + var9 = new DataInputStream(new InflaterInputStream(new ByteArrayInputStream(var8))); + return var9; + } else { + this.debugln("READ", var1, var2, "unknown version " + var7); + return null; + } + } + } + } + } catch (IOException var10) { + this.debugln("READ", var1, var2, "exception"); + return null; + } + } + } + + public DataOutputStream getChunkDataOutputStream(int var1, int var2) { + return this.outOfBounds(var1, var2) ? null : new DataOutputStream(new DeflaterOutputStream(new RegionFileChunkBuffer(this, var1, var2))); + } + + protected synchronized void write(int var1, int var2, byte[] var3, int var4) { + try { + int var5 = this.getOffset(var1, var2); + int var6 = var5 >> 8; + int var7 = var5 & 255; + int var8 = (var4 + 5) / 4096 + 1; + if(var8 >= 256) { + return; + } + + if(var6 != 0 && var7 == var8) { + this.func_22197_a("SAVE", var1, var2, var4, "rewrite"); + this.write(var6, var3, var4); + } else { + int var9; + for(var9 = 0; var9 < var7; ++var9) { + this.sectorFree.set(var6 + var9, Boolean.valueOf(true)); + } + + var9 = this.sectorFree.indexOf(Boolean.valueOf(true)); + int var10 = 0; + int var11; + if(var9 != -1) { + for(var11 = var9; var11 < this.sectorFree.size(); ++var11) { + if(var10 != 0) { + if(((Boolean)this.sectorFree.get(var11)).booleanValue()) { + ++var10; + } else { + var10 = 0; + } + } else if(((Boolean)this.sectorFree.get(var11)).booleanValue()) { + var9 = var11; + var10 = 1; + } + + if(var10 >= var8) { + break; + } + } + } + + if(var10 >= var8) { + this.func_22197_a("SAVE", var1, var2, var4, "reuse"); + var6 = var9; + this.setOffset(var1, var2, var9 << 8 | var8); + + for(var11 = 0; var11 < var8; ++var11) { + this.sectorFree.set(var6 + var11, Boolean.valueOf(false)); + } + + this.write(var6, var3, var4); + } else { + this.func_22197_a("SAVE", var1, var2, var4, "grow"); + this.dataFile.seek(this.dataFile.length()); + var6 = this.sectorFree.size(); + + for(var11 = 0; var11 < var8; ++var11) { + this.dataFile.write(emptySector); + this.sectorFree.add(Boolean.valueOf(false)); + } + + this.sizeDelta += 4096 * var8; + this.write(var6, var3, var4); + this.setOffset(var1, var2, var6 << 8 | var8); + } + } + + this.func_22208_b(var1, var2, (int)(System.currentTimeMillis() / 1000L)); + } catch (IOException var12) { + var12.printStackTrace(); + } + + } + + private void write(int var1, byte[] var2, int var3) throws IOException { + this.debugln(" " + var1); + this.dataFile.seek((long)(var1 * 4096)); + this.dataFile.writeInt(var3 + 1); + this.dataFile.writeByte(2); + this.dataFile.write(var2, 0, var3); + } + + private boolean outOfBounds(int var1, int var2) { + return var1 < 0 || var1 >= 32 || var2 < 0 || var2 >= 32; + } + + private int getOffset(int var1, int var2) { + return this.offsets[var1 + var2 * 32]; + } + + public boolean func_22202_c(int var1, int var2) { + return this.getOffset(var1, var2) != 0; + } + + private void setOffset(int var1, int var2, int var3) throws IOException { + this.offsets[var1 + var2 * 32] = var3; + this.dataFile.seek((long)((var1 + var2 * 32) * 4)); + this.dataFile.writeInt(var3); + } + + private void func_22208_b(int var1, int var2, int var3) throws IOException { + this.field_22217_e[var1 + var2 * 32] = var3; + this.dataFile.seek((long)(4096 + (var1 + var2 * 32) * 4)); + this.dataFile.writeInt(var3); + } + + public void func_22196_b() throws IOException { + this.dataFile.close(); + } +} diff --git a/src/net/minecraft/src/RegionFileCache.java b/src/net/minecraft/src/RegionFileCache.java new file mode 100644 index 0000000..53446fe --- /dev/null +++ b/src/net/minecraft/src/RegionFileCache.java @@ -0,0 +1,74 @@ +package net.minecraft.src; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.File; +import java.io.IOException; +import java.lang.ref.Reference; +import java.lang.ref.SoftReference; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; + +public class RegionFileCache { + private static final Map cache = new HashMap(); + + public static synchronized RegionFile func_22193_a(File var0, int var1, int var2) { + File var3 = new File(var0, "region"); + File var4 = new File(var3, "r." + (var1 >> 5) + "." + (var2 >> 5) + ".mcr"); + Reference var5 = (Reference)cache.get(var4); + RegionFile var6; + if(var5 != null) { + var6 = (RegionFile)var5.get(); + if(var6 != null) { + return var6; + } + } + + if(!var3.exists()) { + var3.mkdirs(); + } + + if(cache.size() >= 256) { + func_22192_a(); + } + + var6 = new RegionFile(var4); + cache.put(var4, new SoftReference(var6)); + return var6; + } + + public static synchronized void func_22192_a() { + Iterator var0 = cache.values().iterator(); + + while(var0.hasNext()) { + Reference var1 = (Reference)var0.next(); + + try { + RegionFile var2 = (RegionFile)var1.get(); + if(var2 != null) { + var2.func_22196_b(); + } + } catch (IOException var3) { + var3.printStackTrace(); + } + } + + cache.clear(); + } + + public static int getSizeDelta(File var0, int var1, int var2) { + RegionFile var3 = func_22193_a(var0, var1, var2); + return var3.func_22209_a(); + } + + public static DataInputStream getChunkInputStream(File var0, int var1, int var2) { + RegionFile var3 = func_22193_a(var0, var1, var2); + return var3.getChunkDataInputStream(var1 & 31, var2 & 31); + } + + public static DataOutputStream getChunkOutputStream(File var0, int var1, int var2) { + RegionFile var3 = func_22193_a(var0, var1, var2); + return var3.getChunkDataOutputStream(var1 & 31, var2 & 31); + } +} diff --git a/src/net/minecraft/src/RegionFileChunkBuffer.java b/src/net/minecraft/src/RegionFileChunkBuffer.java new file mode 100644 index 0000000..7bbaf66 --- /dev/null +++ b/src/net/minecraft/src/RegionFileChunkBuffer.java @@ -0,0 +1,20 @@ +package net.minecraft.src; + +import java.io.ByteArrayOutputStream; + +class RegionFileChunkBuffer extends ByteArrayOutputStream { + private int field_22283_b; + private int field_22285_c; + final RegionFile field_22284_a; + + public RegionFileChunkBuffer(RegionFile var1, int var2, int var3) { + super(8096); + this.field_22284_a = var1; + this.field_22283_b = var2; + this.field_22285_c = var3; + } + + public void close() { + this.field_22284_a.write(this.field_22283_b, this.field_22285_c, this.buf, this.count); + } +} diff --git a/src/net/minecraft/src/Render.java b/src/net/minecraft/src/Render.java new file mode 100644 index 0000000..f8745fc --- /dev/null +++ b/src/net/minecraft/src/Render.java @@ -0,0 +1,255 @@ +package net.minecraft.src; + +import org.lwjgl.opengl.GL11; + +public abstract class Render { + protected RenderManager renderManager; + private ModelBase modelBase = new ModelBiped(); + private RenderBlocks renderBlocks = new RenderBlocks(); + protected float shadowSize = 0.0F; + protected float field_194_c = 1.0F; + + public abstract void doRender(Entity var1, double var2, double var4, double var6, float var8, float var9); + + protected void loadTexture(String var1) { + RenderEngine var2 = this.renderManager.renderEngine; + var2.bindTexture(var2.getTexture(var1)); + } + + protected boolean loadDownloadableImageTexture(String var1, String var2) { + RenderEngine var3 = this.renderManager.renderEngine; + int var4 = var3.getTextureForDownloadableImage(var1, var2); + if(var4 >= 0) { + var3.bindTexture(var4); + return true; + } else { + return false; + } + } + + private void renderEntityOnFire(Entity var1, double var2, double var4, double var6, float var8) { + GL11.glDisable(GL11.GL_LIGHTING); + int var9 = Block.fire.blockIndexInTexture; + int var10 = (var9 & 15) << 4; + int var11 = var9 & 240; + float var12 = (float)var10 / 256.0F; + float var13 = ((float)var10 + 15.99F) / 256.0F; + float var14 = (float)var11 / 256.0F; + float var15 = ((float)var11 + 15.99F) / 256.0F; + GL11.glPushMatrix(); + GL11.glTranslatef((float)var2, (float)var4, (float)var6); + float var16 = var1.width * 1.4F; + GL11.glScalef(var16, var16, var16); + this.loadTexture("/terrain.png"); + Tessellator var17 = Tessellator.instance; + float var18 = 0.5F; + float var19 = 0.0F; + float var20 = var1.height / var16; + float var21 = (float)(var1.posY - var1.boundingBox.minY); + GL11.glRotatef(-this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F); + GL11.glTranslatef(0.0F, 0.0F, -0.3F + (float)((int)var20) * 0.02F); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + float var22 = 0.0F; + int var23 = 0; + var17.startDrawingQuads(); + + while(var20 > 0.0F) { + if(var23 % 2 == 0) { + var12 = (float)var10 / 256.0F; + var13 = ((float)var10 + 15.99F) / 256.0F; + var14 = (float)var11 / 256.0F; + var15 = ((float)var11 + 15.99F) / 256.0F; + } else { + var12 = (float)var10 / 256.0F; + var13 = ((float)var10 + 15.99F) / 256.0F; + var14 = (float)(var11 + 16) / 256.0F; + var15 = ((float)(var11 + 16) + 15.99F) / 256.0F; + } + + if(var23 / 2 % 2 == 0) { + float var24 = var13; + var13 = var12; + var12 = var24; + } + + var17.addVertexWithUV((double)(var18 - var19), (double)(0.0F - var21), (double)var22, (double)var13, (double)var15); + var17.addVertexWithUV((double)(-var18 - var19), (double)(0.0F - var21), (double)var22, (double)var12, (double)var15); + var17.addVertexWithUV((double)(-var18 - var19), (double)(1.4F - var21), (double)var22, (double)var12, (double)var14); + var17.addVertexWithUV((double)(var18 - var19), (double)(1.4F - var21), (double)var22, (double)var13, (double)var14); + var20 -= 0.45F; + var21 -= 0.45F; + var18 *= 0.9F; + var22 += 0.03F; + ++var23; + } + + var17.draw(); + GL11.glPopMatrix(); + GL11.glEnable(GL11.GL_LIGHTING); + } + + private void renderShadow(Entity var1, double var2, double var4, double var6, float var8, float var9) { + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + RenderEngine var10 = this.renderManager.renderEngine; + var10.bindTexture(var10.getTexture("%clamp%/misc/shadow.png")); + World var11 = this.getWorldFromRenderManager(); + GL11.glDepthMask(false); + float var12 = this.shadowSize; + double var13 = var1.lastTickPosX + (var1.posX - var1.lastTickPosX) * (double)var9; + double var15 = var1.lastTickPosY + (var1.posY - var1.lastTickPosY) * (double)var9 + (double)var1.getShadowSize(); + double var17 = var1.lastTickPosZ + (var1.posZ - var1.lastTickPosZ) * (double)var9; + int var19 = MathHelper.floor_double(var13 - (double)var12); + int var20 = MathHelper.floor_double(var13 + (double)var12); + int var21 = MathHelper.floor_double(var15 - (double)var12); + int var22 = MathHelper.floor_double(var15); + int var23 = MathHelper.floor_double(var17 - (double)var12); + int var24 = MathHelper.floor_double(var17 + (double)var12); + double var25 = var2 - var13; + double var27 = var4 - var15; + double var29 = var6 - var17; + Tessellator var31 = Tessellator.instance; + var31.startDrawingQuads(); + + for(int var32 = var19; var32 <= var20; ++var32) { + for(int var33 = var21; var33 <= var22; ++var33) { + for(int var34 = var23; var34 <= var24; ++var34) { + int var35 = var11.getBlockId(var32, var33 - 1, var34); + if(var35 > 0 && var11.getBlockLightValue(var32, var33, var34) > 3) { + this.renderShadowOnBlock(Block.blocksList[var35], var2, var4 + (double)var1.getShadowSize(), var6, var32, var33, var34, var8, var12, var25, var27 + (double)var1.getShadowSize(), var29); + } + } + } + } + + var31.draw(); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glDisable(GL11.GL_BLEND); + GL11.glDepthMask(true); + } + + private World getWorldFromRenderManager() { + return this.renderManager.worldObj; + } + + private void renderShadowOnBlock(Block var1, double var2, double var4, double var6, int var8, int var9, int var10, float var11, float var12, double var13, double var15, double var17) { + Tessellator var19 = Tessellator.instance; + if(var1.renderAsNormalBlock()) { + double var20 = ((double)var11 - (var4 - ((double)var9 + var15)) / 2.0D) * 0.5D * (double)this.getWorldFromRenderManager().getLightBrightness(var8, var9, var10); + if(var20 >= 0.0D) { + if(var20 > 1.0D) { + var20 = 1.0D; + } + + var19.setColorRGBA_F(1.0F, 1.0F, 1.0F, (float)var20); + double var22 = (double)var8 + var1.minX + var13; + double var24 = (double)var8 + var1.maxX + var13; + double var26 = (double)var9 + var1.minY + var15 + 1.0D / 64.0D; + double var28 = (double)var10 + var1.minZ + var17; + double var30 = (double)var10 + var1.maxZ + var17; + float var32 = (float)((var2 - var22) / 2.0D / (double)var12 + 0.5D); + float var33 = (float)((var2 - var24) / 2.0D / (double)var12 + 0.5D); + float var34 = (float)((var6 - var28) / 2.0D / (double)var12 + 0.5D); + float var35 = (float)((var6 - var30) / 2.0D / (double)var12 + 0.5D); + var19.addVertexWithUV(var22, var26, var28, (double)var32, (double)var34); + var19.addVertexWithUV(var22, var26, var30, (double)var32, (double)var35); + var19.addVertexWithUV(var24, var26, var30, (double)var33, (double)var35); + var19.addVertexWithUV(var24, var26, var28, (double)var33, (double)var34); + } + } + } + + public static void renderOffsetAABB(AxisAlignedBB var0, double var1, double var3, double var5) { + GL11.glDisable(GL11.GL_TEXTURE_2D); + Tessellator var7 = Tessellator.instance; + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + var7.startDrawingQuads(); + var7.setTranslationD(var1, var3, var5); + var7.setNormal(0.0F, 0.0F, -1.0F); + var7.addVertex(var0.minX, var0.maxY, var0.minZ); + var7.addVertex(var0.maxX, var0.maxY, var0.minZ); + var7.addVertex(var0.maxX, var0.minY, var0.minZ); + var7.addVertex(var0.minX, var0.minY, var0.minZ); + var7.setNormal(0.0F, 0.0F, 1.0F); + var7.addVertex(var0.minX, var0.minY, var0.maxZ); + var7.addVertex(var0.maxX, var0.minY, var0.maxZ); + var7.addVertex(var0.maxX, var0.maxY, var0.maxZ); + var7.addVertex(var0.minX, var0.maxY, var0.maxZ); + var7.setNormal(0.0F, -1.0F, 0.0F); + var7.addVertex(var0.minX, var0.minY, var0.minZ); + var7.addVertex(var0.maxX, var0.minY, var0.minZ); + var7.addVertex(var0.maxX, var0.minY, var0.maxZ); + var7.addVertex(var0.minX, var0.minY, var0.maxZ); + var7.setNormal(0.0F, 1.0F, 0.0F); + var7.addVertex(var0.minX, var0.maxY, var0.maxZ); + var7.addVertex(var0.maxX, var0.maxY, var0.maxZ); + var7.addVertex(var0.maxX, var0.maxY, var0.minZ); + var7.addVertex(var0.minX, var0.maxY, var0.minZ); + var7.setNormal(-1.0F, 0.0F, 0.0F); + var7.addVertex(var0.minX, var0.minY, var0.maxZ); + var7.addVertex(var0.minX, var0.maxY, var0.maxZ); + var7.addVertex(var0.minX, var0.maxY, var0.minZ); + var7.addVertex(var0.minX, var0.minY, var0.minZ); + var7.setNormal(1.0F, 0.0F, 0.0F); + var7.addVertex(var0.maxX, var0.minY, var0.minZ); + var7.addVertex(var0.maxX, var0.maxY, var0.minZ); + var7.addVertex(var0.maxX, var0.maxY, var0.maxZ); + var7.addVertex(var0.maxX, var0.minY, var0.maxZ); + var7.setTranslationD(0.0D, 0.0D, 0.0D); + var7.draw(); + GL11.glEnable(GL11.GL_TEXTURE_2D); + } + + public static void renderAABB(AxisAlignedBB var0) { + Tessellator var1 = Tessellator.instance; + var1.startDrawingQuads(); + var1.addVertex(var0.minX, var0.maxY, var0.minZ); + var1.addVertex(var0.maxX, var0.maxY, var0.minZ); + var1.addVertex(var0.maxX, var0.minY, var0.minZ); + var1.addVertex(var0.minX, var0.minY, var0.minZ); + var1.addVertex(var0.minX, var0.minY, var0.maxZ); + var1.addVertex(var0.maxX, var0.minY, var0.maxZ); + var1.addVertex(var0.maxX, var0.maxY, var0.maxZ); + var1.addVertex(var0.minX, var0.maxY, var0.maxZ); + var1.addVertex(var0.minX, var0.minY, var0.minZ); + var1.addVertex(var0.maxX, var0.minY, var0.minZ); + var1.addVertex(var0.maxX, var0.minY, var0.maxZ); + var1.addVertex(var0.minX, var0.minY, var0.maxZ); + var1.addVertex(var0.minX, var0.maxY, var0.maxZ); + var1.addVertex(var0.maxX, var0.maxY, var0.maxZ); + var1.addVertex(var0.maxX, var0.maxY, var0.minZ); + var1.addVertex(var0.minX, var0.maxY, var0.minZ); + var1.addVertex(var0.minX, var0.minY, var0.maxZ); + var1.addVertex(var0.minX, var0.maxY, var0.maxZ); + var1.addVertex(var0.minX, var0.maxY, var0.minZ); + var1.addVertex(var0.minX, var0.minY, var0.minZ); + var1.addVertex(var0.maxX, var0.minY, var0.minZ); + var1.addVertex(var0.maxX, var0.maxY, var0.minZ); + var1.addVertex(var0.maxX, var0.maxY, var0.maxZ); + var1.addVertex(var0.maxX, var0.minY, var0.maxZ); + var1.draw(); + } + + public void setRenderManager(RenderManager var1) { + this.renderManager = var1; + } + + public void doRenderShadowAndFire(Entity var1, double var2, double var4, double var6, float var8, float var9) { + if(this.renderManager.options.fancyGraphics && this.shadowSize > 0.0F) { + double var10 = this.renderManager.func_851_a(var1.posX, var1.posY, var1.posZ); + float var12 = (float)((1.0D - var10 / 256.0D) * (double)this.field_194_c); + if(var12 > 0.0F) { + this.renderShadow(var1, var2, var4, var6, var12, var9); + } + } + + if(var1.isBurning()) { + this.renderEntityOnFire(var1, var2, var4, var6, var9); + } + + } + + public FontRenderer getFontRendererFromRenderManager() { + return this.renderManager.getFontRenderer(); + } +} diff --git a/src/net/minecraft/src/RenderArrow.java b/src/net/minecraft/src/RenderArrow.java new file mode 100644 index 0000000..3cddbeb --- /dev/null +++ b/src/net/minecraft/src/RenderArrow.java @@ -0,0 +1,69 @@ +package net.minecraft.src; + +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +public class RenderArrow extends Render { + public void renderArrow(EntityArrow var1, double var2, double var4, double var6, float var8, float var9) { + if(var1.prevRotationYaw != 0.0F || var1.prevRotationPitch != 0.0F) { + this.loadTexture("/item/arrows.png"); + GL11.glPushMatrix(); + GL11.glTranslatef((float)var2, (float)var4, (float)var6); + GL11.glRotatef(var1.prevRotationYaw + (var1.rotationYaw - var1.prevRotationYaw) * var9 - 90.0F, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(var1.prevRotationPitch + (var1.rotationPitch - var1.prevRotationPitch) * var9, 0.0F, 0.0F, 1.0F); + Tessellator var10 = Tessellator.instance; + byte var11 = 0; + float var12 = 0.0F; + float var13 = 0.5F; + float var14 = (float)(0 + var11 * 10) / 32.0F; + float var15 = (float)(5 + var11 * 10) / 32.0F; + float var16 = 0.0F; + float var17 = 0.15625F; + float var18 = (float)(5 + var11 * 10) / 32.0F; + float var19 = (float)(10 + var11 * 10) / 32.0F; + float var20 = 0.05625F; + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + float var21 = (float)var1.arrowShake - var9; + if(var21 > 0.0F) { + float var22 = -MathHelper.sin(var21 * 3.0F) * var21; + GL11.glRotatef(var22, 0.0F, 0.0F, 1.0F); + } + + GL11.glRotatef(45.0F, 1.0F, 0.0F, 0.0F); + GL11.glScalef(var20, var20, var20); + GL11.glTranslatef(-4.0F, 0.0F, 0.0F); + GL11.glNormal3f(var20, 0.0F, 0.0F); + var10.startDrawingQuads(); + var10.addVertexWithUV(-7.0D, -2.0D, -2.0D, (double)var16, (double)var18); + var10.addVertexWithUV(-7.0D, -2.0D, 2.0D, (double)var17, (double)var18); + var10.addVertexWithUV(-7.0D, 2.0D, 2.0D, (double)var17, (double)var19); + var10.addVertexWithUV(-7.0D, 2.0D, -2.0D, (double)var16, (double)var19); + var10.draw(); + GL11.glNormal3f(-var20, 0.0F, 0.0F); + var10.startDrawingQuads(); + var10.addVertexWithUV(-7.0D, 2.0D, -2.0D, (double)var16, (double)var18); + var10.addVertexWithUV(-7.0D, 2.0D, 2.0D, (double)var17, (double)var18); + var10.addVertexWithUV(-7.0D, -2.0D, 2.0D, (double)var17, (double)var19); + var10.addVertexWithUV(-7.0D, -2.0D, -2.0D, (double)var16, (double)var19); + var10.draw(); + + for(int var23 = 0; var23 < 4; ++var23) { + GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F); + GL11.glNormal3f(0.0F, 0.0F, var20); + var10.startDrawingQuads(); + var10.addVertexWithUV(-8.0D, -2.0D, 0.0D, (double)var12, (double)var14); + var10.addVertexWithUV(8.0D, -2.0D, 0.0D, (double)var13, (double)var14); + var10.addVertexWithUV(8.0D, 2.0D, 0.0D, (double)var13, (double)var15); + var10.addVertexWithUV(-8.0D, 2.0D, 0.0D, (double)var12, (double)var15); + var10.draw(); + } + + GL11.glDisable(GL12.GL_RESCALE_NORMAL); + GL11.glPopMatrix(); + } + } + + public void doRender(Entity var1, double var2, double var4, double var6, float var8, float var9) { + this.renderArrow((EntityArrow)var1, var2, var4, var6, var8, var9); + } +} diff --git a/src/net/minecraft/src/RenderBiped.java b/src/net/minecraft/src/RenderBiped.java new file mode 100644 index 0000000..a6f7ec4 --- /dev/null +++ b/src/net/minecraft/src/RenderBiped.java @@ -0,0 +1,47 @@ +package net.minecraft.src; + +import org.lwjgl.opengl.GL11; + +public class RenderBiped extends RenderLiving { + protected ModelBiped modelBipedMain; + + public RenderBiped(ModelBiped var1, float var2) { + super(var1, var2); + this.modelBipedMain = var1; + } + + protected void renderEquippedItems(EntityLiving var1, float var2) { + ItemStack var3 = var1.getHeldItem(); + if(var3 != null) { + GL11.glPushMatrix(); + this.modelBipedMain.bipedRightArm.postRender(1.0F / 16.0F); + GL11.glTranslatef(-(1.0F / 16.0F), 7.0F / 16.0F, 1.0F / 16.0F); + float var4; + if(var3.itemID < 256 && RenderBlocks.renderItemIn3d(Block.blocksList[var3.itemID].getRenderType())) { + var4 = 0.5F; + GL11.glTranslatef(0.0F, 3.0F / 16.0F, -(5.0F / 16.0F)); + var4 *= 12.0F / 16.0F; + GL11.glRotatef(20.0F, 1.0F, 0.0F, 0.0F); + GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F); + GL11.glScalef(var4, -var4, var4); + } else if(Item.itemsList[var3.itemID].isFull3D()) { + var4 = 10.0F / 16.0F; + GL11.glTranslatef(0.0F, 3.0F / 16.0F, 0.0F); + GL11.glScalef(var4, -var4, var4); + GL11.glRotatef(-100.0F, 1.0F, 0.0F, 0.0F); + GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F); + } else { + var4 = 6.0F / 16.0F; + GL11.glTranslatef(0.25F, 3.0F / 16.0F, -(3.0F / 16.0F)); + GL11.glScalef(var4, var4, var4); + GL11.glRotatef(60.0F, 0.0F, 0.0F, 1.0F); + GL11.glRotatef(-90.0F, 1.0F, 0.0F, 0.0F); + GL11.glRotatef(20.0F, 0.0F, 0.0F, 1.0F); + } + + this.renderManager.itemRenderer.renderItem(var1, var3); + GL11.glPopMatrix(); + } + + } +} diff --git a/src/net/minecraft/src/RenderBlocks.java b/src/net/minecraft/src/RenderBlocks.java new file mode 100644 index 0000000..c764aec --- /dev/null +++ b/src/net/minecraft/src/RenderBlocks.java @@ -0,0 +1,3376 @@ +package net.minecraft.src; + +import net.minecraft.client.Minecraft; +import org.lwjgl.opengl.GL11; + +public class RenderBlocks { + private IBlockAccess blockAccess; + private int overrideBlockTexture = -1; + private boolean flipTexture = false; + private boolean renderAllFaces = false; + public static boolean fancyGrass = true; + public boolean field_31088_b = true; + private int field_31087_g = 0; + private int field_31086_h = 0; + private int field_31085_i = 0; + private int field_31084_j = 0; + private int field_31083_k = 0; + private int field_31082_l = 0; + private boolean enableAO; + private float lightValueOwn; + private float aoLightValueXNeg; + private float aoLightValueYNeg; + private float aoLightValueZNeg; + private float aoLightValueXPos; + private float aoLightValueYPos; + private float aoLightValueZPos; + private float field_22377_m; + private float field_22376_n; + private float field_22375_o; + private float field_22374_p; + private float field_22373_q; + private float field_22372_r; + private float field_22371_s; + private float field_22370_t; + private float field_22369_u; + private float field_22368_v; + private float field_22367_w; + private float field_22366_x; + private float field_22365_y; + private float field_22364_z; + private float field_22362_A; + private float field_22360_B; + private float field_22358_C; + private float field_22356_D; + private float field_22354_E; + private float field_22353_F; + private int field_22352_G = 1; + private float colorRedTopLeft; + private float colorRedBottomLeft; + private float colorRedBottomRight; + private float colorRedTopRight; + private float colorGreenTopLeft; + private float colorGreenBottomLeft; + private float colorGreenBottomRight; + private float colorGreenTopRight; + private float colorBlueTopLeft; + private float colorBlueBottomLeft; + private float colorBlueBottomRight; + private float colorBlueTopRight; + private boolean field_22339_T; + private boolean field_22338_U; + private boolean field_22337_V; + private boolean field_22336_W; + private boolean field_22335_X; + private boolean field_22334_Y; + private boolean field_22333_Z; + private boolean field_22363_aa; + private boolean field_22361_ab; + private boolean field_22359_ac; + private boolean field_22357_ad; + private boolean field_22355_ae; + + public RenderBlocks(IBlockAccess var1) { + this.blockAccess = var1; + } + + public RenderBlocks() { + } + + public void renderBlockUsingTexture(Block var1, int var2, int var3, int var4, int var5) { + this.overrideBlockTexture = var5; + this.renderBlockByRenderType(var1, var2, var3, var4); + this.overrideBlockTexture = -1; + } + + public void func_31075_a(Block var1, int var2, int var3, int var4) { + this.renderAllFaces = true; + this.renderBlockByRenderType(var1, var2, var3, var4); + this.renderAllFaces = false; + } + + public boolean renderBlockByRenderType(Block var1, int var2, int var3, int var4) { + int var5 = var1.getRenderType(); + var1.setBlockBoundsBasedOnState(this.blockAccess, var2, var3, var4); + return var5 == 0 ? this.renderStandardBlock(var1, var2, var3, var4) : (var5 == 4 ? this.renderBlockFluids(var1, var2, var3, var4) : (var5 == 13 ? this.renderBlockCactus(var1, var2, var3, var4) : (var5 == 1 ? this.renderBlockReed(var1, var2, var3, var4) : (var5 == 6 ? this.renderBlockCrops(var1, var2, var3, var4) : (var5 == 2 ? this.renderBlockTorch(var1, var2, var3, var4) : (var5 == 3 ? this.renderBlockFire(var1, var2, var3, var4) : (var5 == 5 ? this.renderBlockRedstoneWire(var1, var2, var3, var4) : (var5 == 8 ? this.renderBlockLadder(var1, var2, var3, var4) : (var5 == 7 ? this.renderBlockDoor(var1, var2, var3, var4) : (var5 == 9 ? this.renderBlockMinecartTrack((BlockRail)var1, var2, var3, var4) : (var5 == 10 ? this.renderBlockStairs(var1, var2, var3, var4) : (var5 == 11 ? this.renderBlockFence(var1, var2, var3, var4) : (var5 == 12 ? this.renderBlockLever(var1, var2, var3, var4) : (var5 == 14 ? this.renderBlockBed(var1, var2, var3, var4) : (var5 == 15 ? this.renderBlockRepeater(var1, var2, var3, var4) : (var5 == 16 ? this.func_31074_b(var1, var2, var3, var4, false) : (var5 == 17 ? this.func_31080_c(var1, var2, var3, var4, true) : false))))))))))))))))); + } + + private boolean renderBlockBed(Block var1, int var2, int var3, int var4) { + Tessellator var5 = Tessellator.instance; + int var6 = this.blockAccess.getBlockMetadata(var2, var3, var4); + int var7 = BlockBed.getDirectionFromMetadata(var6); + boolean var8 = BlockBed.isBlockFootOfBed(var6); + float var9 = 0.5F; + float var10 = 1.0F; + float var11 = 0.8F; + float var12 = 0.6F; + float var25 = var1.getBlockBrightness(this.blockAccess, var2, var3, var4); + var5.setColorOpaque_F(var9 * var25, var9 * var25, var9 * var25); + int var26 = var1.getBlockTexture(this.blockAccess, var2, var3, var4, 0); + int var27 = (var26 & 15) << 4; + int var28 = var26 & 240; + double var29 = (double)((float)var27 / 256.0F); + double var31 = ((double)(var27 + 16) - 0.01D) / 256.0D; + double var33 = (double)((float)var28 / 256.0F); + double var35 = ((double)(var28 + 16) - 0.01D) / 256.0D; + double var37 = (double)var2 + var1.minX; + double var39 = (double)var2 + var1.maxX; + double var41 = (double)var3 + var1.minY + 0.1875D; + double var43 = (double)var4 + var1.minZ; + double var45 = (double)var4 + var1.maxZ; + var5.addVertexWithUV(var37, var41, var45, var29, var35); + var5.addVertexWithUV(var37, var41, var43, var29, var33); + var5.addVertexWithUV(var39, var41, var43, var31, var33); + var5.addVertexWithUV(var39, var41, var45, var31, var35); + float var64 = var1.getBlockBrightness(this.blockAccess, var2, var3 + 1, var4); + var5.setColorOpaque_F(var10 * var64, var10 * var64, var10 * var64); + var27 = var1.getBlockTexture(this.blockAccess, var2, var3, var4, 1); + var28 = (var27 & 15) << 4; + int var67 = var27 & 240; + double var30 = (double)((float)var28 / 256.0F); + double var32 = ((double)(var28 + 16) - 0.01D) / 256.0D; + double var34 = (double)((float)var67 / 256.0F); + double var36 = ((double)(var67 + 16) - 0.01D) / 256.0D; + double var38 = var30; + double var40 = var32; + double var42 = var34; + double var44 = var34; + double var46 = var30; + double var48 = var32; + double var50 = var36; + double var52 = var36; + if(var7 == 0) { + var40 = var30; + var42 = var36; + var46 = var32; + var52 = var34; + } else if(var7 == 2) { + var38 = var32; + var44 = var36; + var48 = var30; + var50 = var34; + } else if(var7 == 3) { + var38 = var32; + var44 = var36; + var48 = var30; + var50 = var34; + var40 = var30; + var42 = var36; + var46 = var32; + var52 = var34; + } + + double var54 = (double)var2 + var1.minX; + double var56 = (double)var2 + var1.maxX; + double var58 = (double)var3 + var1.maxY; + double var60 = (double)var4 + var1.minZ; + double var62 = (double)var4 + var1.maxZ; + var5.addVertexWithUV(var56, var58, var62, var46, var50); + var5.addVertexWithUV(var56, var58, var60, var38, var42); + var5.addVertexWithUV(var54, var58, var60, var40, var44); + var5.addVertexWithUV(var54, var58, var62, var48, var52); + var26 = ModelBed.field_22280_a[var7]; + if(var8) { + var26 = ModelBed.field_22280_a[ModelBed.field_22279_b[var7]]; + } + + byte var65 = 4; + switch(var7) { + case 0: + var65 = 5; + break; + case 1: + var65 = 3; + case 2: + default: + break; + case 3: + var65 = 2; + } + + float var66; + if(var26 != 2 && (this.renderAllFaces || var1.shouldSideBeRendered(this.blockAccess, var2, var3, var4 - 1, 2))) { + var66 = var1.getBlockBrightness(this.blockAccess, var2, var3, var4 - 1); + if(var1.minZ > 0.0D) { + var66 = var25; + } + + var5.setColorOpaque_F(var11 * var66, var11 * var66, var11 * var66); + this.flipTexture = var65 == 2; + this.renderEastFace(var1, (double)var2, (double)var3, (double)var4, var1.getBlockTexture(this.blockAccess, var2, var3, var4, 2)); + } + + if(var26 != 3 && (this.renderAllFaces || var1.shouldSideBeRendered(this.blockAccess, var2, var3, var4 + 1, 3))) { + var66 = var1.getBlockBrightness(this.blockAccess, var2, var3, var4 + 1); + if(var1.maxZ < 1.0D) { + var66 = var25; + } + + var5.setColorOpaque_F(var11 * var66, var11 * var66, var11 * var66); + this.flipTexture = var65 == 3; + this.renderWestFace(var1, (double)var2, (double)var3, (double)var4, var1.getBlockTexture(this.blockAccess, var2, var3, var4, 3)); + } + + if(var26 != 4 && (this.renderAllFaces || var1.shouldSideBeRendered(this.blockAccess, var2 - 1, var3, var4, 4))) { + var66 = var1.getBlockBrightness(this.blockAccess, var2 - 1, var3, var4); + if(var1.minX > 0.0D) { + var66 = var25; + } + + var5.setColorOpaque_F(var12 * var66, var12 * var66, var12 * var66); + this.flipTexture = var65 == 4; + this.renderNorthFace(var1, (double)var2, (double)var3, (double)var4, var1.getBlockTexture(this.blockAccess, var2, var3, var4, 4)); + } + + if(var26 != 5 && (this.renderAllFaces || var1.shouldSideBeRendered(this.blockAccess, var2 + 1, var3, var4, 5))) { + var66 = var1.getBlockBrightness(this.blockAccess, var2 + 1, var3, var4); + if(var1.maxX < 1.0D) { + var66 = var25; + } + + var5.setColorOpaque_F(var12 * var66, var12 * var66, var12 * var66); + this.flipTexture = var65 == 5; + this.renderSouthFace(var1, (double)var2, (double)var3, (double)var4, var1.getBlockTexture(this.blockAccess, var2, var3, var4, 5)); + } + + this.flipTexture = false; + return true; + } + + public boolean renderBlockTorch(Block var1, int var2, int var3, int var4) { + int var5 = this.blockAccess.getBlockMetadata(var2, var3, var4); + Tessellator var6 = Tessellator.instance; + float var7 = var1.getBlockBrightness(this.blockAccess, var2, var3, var4); + if(Block.lightValue[var1.blockID] > 0) { + var7 = 1.0F; + } + + var6.setColorOpaque_F(var7, var7, var7); + double var8 = (double)0.4F; + double var10 = 0.5D - var8; + double var12 = (double)0.2F; + if(var5 == 1) { + this.renderTorchAtAngle(var1, (double)var2 - var10, (double)var3 + var12, (double)var4, -var8, 0.0D); + } else if(var5 == 2) { + this.renderTorchAtAngle(var1, (double)var2 + var10, (double)var3 + var12, (double)var4, var8, 0.0D); + } else if(var5 == 3) { + this.renderTorchAtAngle(var1, (double)var2, (double)var3 + var12, (double)var4 - var10, 0.0D, -var8); + } else if(var5 == 4) { + this.renderTorchAtAngle(var1, (double)var2, (double)var3 + var12, (double)var4 + var10, 0.0D, var8); + } else { + this.renderTorchAtAngle(var1, (double)var2, (double)var3, (double)var4, 0.0D, 0.0D); + } + + return true; + } + + private boolean renderBlockRepeater(Block var1, int var2, int var3, int var4) { + int var5 = this.blockAccess.getBlockMetadata(var2, var3, var4); + int var6 = var5 & 3; + int var7 = (var5 & 12) >> 2; + this.renderStandardBlock(var1, var2, var3, var4); + Tessellator var8 = Tessellator.instance; + float var9 = var1.getBlockBrightness(this.blockAccess, var2, var3, var4); + if(Block.lightValue[var1.blockID] > 0) { + var9 = (var9 + 1.0F) * 0.5F; + } + + var8.setColorOpaque_F(var9, var9, var9); + double var10 = -0.1875D; + double var12 = 0.0D; + double var14 = 0.0D; + double var16 = 0.0D; + double var18 = 0.0D; + switch(var6) { + case 0: + var18 = -0.3125D; + var14 = BlockRedstoneRepeater.field_22024_a[var7]; + break; + case 1: + var16 = 0.3125D; + var12 = -BlockRedstoneRepeater.field_22024_a[var7]; + break; + case 2: + var18 = 0.3125D; + var14 = -BlockRedstoneRepeater.field_22024_a[var7]; + break; + case 3: + var16 = -0.3125D; + var12 = BlockRedstoneRepeater.field_22024_a[var7]; + } + + this.renderTorchAtAngle(var1, (double)var2 + var12, (double)var3 + var10, (double)var4 + var14, 0.0D, 0.0D); + this.renderTorchAtAngle(var1, (double)var2 + var16, (double)var3 + var10, (double)var4 + var18, 0.0D, 0.0D); + int var20 = var1.getBlockTextureFromSide(1); + int var21 = (var20 & 15) << 4; + int var22 = var20 & 240; + double var23 = (double)((float)var21 / 256.0F); + double var25 = (double)(((float)var21 + 15.99F) / 256.0F); + double var27 = (double)((float)var22 / 256.0F); + double var29 = (double)(((float)var22 + 15.99F) / 256.0F); + float var31 = 2.0F / 16.0F; + float var32 = (float)(var2 + 1); + float var33 = (float)(var2 + 1); + float var34 = (float)(var2 + 0); + float var35 = (float)(var2 + 0); + float var36 = (float)(var4 + 0); + float var37 = (float)(var4 + 1); + float var38 = (float)(var4 + 1); + float var39 = (float)(var4 + 0); + float var40 = (float)var3 + var31; + if(var6 == 2) { + var33 = (float)(var2 + 0); + var32 = var33; + var35 = (float)(var2 + 1); + var34 = var35; + var39 = (float)(var4 + 1); + var36 = var39; + var38 = (float)(var4 + 0); + var37 = var38; + } else if(var6 == 3) { + var35 = (float)(var2 + 0); + var32 = var35; + var34 = (float)(var2 + 1); + var33 = var34; + var37 = (float)(var4 + 0); + var36 = var37; + var39 = (float)(var4 + 1); + var38 = var39; + } else if(var6 == 1) { + var35 = (float)(var2 + 1); + var32 = var35; + var34 = (float)(var2 + 0); + var33 = var34; + var37 = (float)(var4 + 1); + var36 = var37; + var39 = (float)(var4 + 0); + var38 = var39; + } + + var8.addVertexWithUV((double)var35, (double)var40, (double)var39, var23, var27); + var8.addVertexWithUV((double)var34, (double)var40, (double)var38, var23, var29); + var8.addVertexWithUV((double)var33, (double)var40, (double)var37, var25, var29); + var8.addVertexWithUV((double)var32, (double)var40, (double)var36, var25, var27); + return true; + } + + public void func_31078_d(Block var1, int var2, int var3, int var4) { + this.renderAllFaces = true; + this.func_31074_b(var1, var2, var3, var4, true); + this.renderAllFaces = false; + } + + private boolean func_31074_b(Block var1, int var2, int var3, int var4, boolean var5) { + int var6 = this.blockAccess.getBlockMetadata(var2, var3, var4); + boolean var7 = var5 || (var6 & 8) != 0; + int var8 = BlockPistonBase.func_31044_d(var6); + if(var7) { + switch(var8) { + case 0: + this.field_31087_g = 3; + this.field_31086_h = 3; + this.field_31085_i = 3; + this.field_31084_j = 3; + var1.setBlockBounds(0.0F, 0.25F, 0.0F, 1.0F, 1.0F, 1.0F); + break; + case 1: + var1.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 12.0F / 16.0F, 1.0F); + break; + case 2: + this.field_31085_i = 1; + this.field_31084_j = 2; + var1.setBlockBounds(0.0F, 0.0F, 0.25F, 1.0F, 1.0F, 1.0F); + break; + case 3: + this.field_31085_i = 2; + this.field_31084_j = 1; + this.field_31083_k = 3; + this.field_31082_l = 3; + var1.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 12.0F / 16.0F); + break; + case 4: + this.field_31087_g = 1; + this.field_31086_h = 2; + this.field_31083_k = 2; + this.field_31082_l = 1; + var1.setBlockBounds(0.25F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + break; + case 5: + this.field_31087_g = 2; + this.field_31086_h = 1; + this.field_31083_k = 1; + this.field_31082_l = 2; + var1.setBlockBounds(0.0F, 0.0F, 0.0F, 12.0F / 16.0F, 1.0F, 1.0F); + } + + this.renderStandardBlock(var1, var2, var3, var4); + this.field_31087_g = 0; + this.field_31086_h = 0; + this.field_31085_i = 0; + this.field_31084_j = 0; + this.field_31083_k = 0; + this.field_31082_l = 0; + var1.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + } else { + switch(var8) { + case 0: + this.field_31087_g = 3; + this.field_31086_h = 3; + this.field_31085_i = 3; + this.field_31084_j = 3; + case 1: + default: + break; + case 2: + this.field_31085_i = 1; + this.field_31084_j = 2; + break; + case 3: + this.field_31085_i = 2; + this.field_31084_j = 1; + this.field_31083_k = 3; + this.field_31082_l = 3; + break; + case 4: + this.field_31087_g = 1; + this.field_31086_h = 2; + this.field_31083_k = 2; + this.field_31082_l = 1; + break; + case 5: + this.field_31087_g = 2; + this.field_31086_h = 1; + this.field_31083_k = 1; + this.field_31082_l = 2; + } + + this.renderStandardBlock(var1, var2, var3, var4); + this.field_31087_g = 0; + this.field_31086_h = 0; + this.field_31085_i = 0; + this.field_31084_j = 0; + this.field_31083_k = 0; + this.field_31082_l = 0; + } + + return true; + } + + private void func_31076_a(double var1, double var3, double var5, double var7, double var9, double var11, float var13, double var14) { + int var16 = 108; + if(this.overrideBlockTexture >= 0) { + var16 = this.overrideBlockTexture; + } + + int var17 = (var16 & 15) << 4; + int var18 = var16 & 240; + Tessellator var19 = Tessellator.instance; + double var20 = (double)((float)(var17 + 0) / 256.0F); + double var22 = (double)((float)(var18 + 0) / 256.0F); + double var24 = ((double)var17 + var14 - 0.01D) / 256.0D; + double var26 = ((double)((float)var18 + 4.0F) - 0.01D) / 256.0D; + var19.setColorOpaque_F(var13, var13, var13); + var19.addVertexWithUV(var1, var7, var9, var24, var22); + var19.addVertexWithUV(var1, var5, var9, var20, var22); + var19.addVertexWithUV(var3, var5, var11, var20, var26); + var19.addVertexWithUV(var3, var7, var11, var24, var26); + } + + private void func_31081_b(double var1, double var3, double var5, double var7, double var9, double var11, float var13, double var14) { + int var16 = 108; + if(this.overrideBlockTexture >= 0) { + var16 = this.overrideBlockTexture; + } + + int var17 = (var16 & 15) << 4; + int var18 = var16 & 240; + Tessellator var19 = Tessellator.instance; + double var20 = (double)((float)(var17 + 0) / 256.0F); + double var22 = (double)((float)(var18 + 0) / 256.0F); + double var24 = ((double)var17 + var14 - 0.01D) / 256.0D; + double var26 = ((double)((float)var18 + 4.0F) - 0.01D) / 256.0D; + var19.setColorOpaque_F(var13, var13, var13); + var19.addVertexWithUV(var1, var5, var11, var24, var22); + var19.addVertexWithUV(var1, var5, var9, var20, var22); + var19.addVertexWithUV(var3, var7, var9, var20, var26); + var19.addVertexWithUV(var3, var7, var11, var24, var26); + } + + private void func_31077_c(double var1, double var3, double var5, double var7, double var9, double var11, float var13, double var14) { + int var16 = 108; + if(this.overrideBlockTexture >= 0) { + var16 = this.overrideBlockTexture; + } + + int var17 = (var16 & 15) << 4; + int var18 = var16 & 240; + Tessellator var19 = Tessellator.instance; + double var20 = (double)((float)(var17 + 0) / 256.0F); + double var22 = (double)((float)(var18 + 0) / 256.0F); + double var24 = ((double)var17 + var14 - 0.01D) / 256.0D; + double var26 = ((double)((float)var18 + 4.0F) - 0.01D) / 256.0D; + var19.setColorOpaque_F(var13, var13, var13); + var19.addVertexWithUV(var3, var5, var9, var24, var22); + var19.addVertexWithUV(var1, var5, var9, var20, var22); + var19.addVertexWithUV(var1, var7, var11, var20, var26); + var19.addVertexWithUV(var3, var7, var11, var24, var26); + } + + public void func_31079_a(Block var1, int var2, int var3, int var4, boolean var5) { + this.renderAllFaces = true; + this.func_31080_c(var1, var2, var3, var4, var5); + this.renderAllFaces = false; + } + + private boolean func_31080_c(Block var1, int var2, int var3, int var4, boolean var5) { + int var6 = this.blockAccess.getBlockMetadata(var2, var3, var4); + int var7 = BlockPistonExtension.func_31050_c(var6); + float var11 = var1.getBlockBrightness(this.blockAccess, var2, var3, var4); + float var12 = var5 ? 1.0F : 0.5F; + double var13 = var5 ? 16.0D : 8.0D; + switch(var7) { + case 0: + this.field_31087_g = 3; + this.field_31086_h = 3; + this.field_31085_i = 3; + this.field_31084_j = 3; + var1.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.25F, 1.0F); + this.renderStandardBlock(var1, var2, var3, var4); + this.func_31076_a((double)((float)var2 + 6.0F / 16.0F), (double)((float)var2 + 10.0F / 16.0F), (double)((float)var3 + 0.25F), (double)((float)var3 + 0.25F + var12), (double)((float)var4 + 10.0F / 16.0F), (double)((float)var4 + 10.0F / 16.0F), var11 * 0.8F, var13); + this.func_31076_a((double)((float)var2 + 10.0F / 16.0F), (double)((float)var2 + 6.0F / 16.0F), (double)((float)var3 + 0.25F), (double)((float)var3 + 0.25F + var12), (double)((float)var4 + 6.0F / 16.0F), (double)((float)var4 + 6.0F / 16.0F), var11 * 0.8F, var13); + this.func_31076_a((double)((float)var2 + 6.0F / 16.0F), (double)((float)var2 + 6.0F / 16.0F), (double)((float)var3 + 0.25F), (double)((float)var3 + 0.25F + var12), (double)((float)var4 + 6.0F / 16.0F), (double)((float)var4 + 10.0F / 16.0F), var11 * 0.6F, var13); + this.func_31076_a((double)((float)var2 + 10.0F / 16.0F), (double)((float)var2 + 10.0F / 16.0F), (double)((float)var3 + 0.25F), (double)((float)var3 + 0.25F + var12), (double)((float)var4 + 10.0F / 16.0F), (double)((float)var4 + 6.0F / 16.0F), var11 * 0.6F, var13); + break; + case 1: + var1.setBlockBounds(0.0F, 12.0F / 16.0F, 0.0F, 1.0F, 1.0F, 1.0F); + this.renderStandardBlock(var1, var2, var3, var4); + this.func_31076_a((double)((float)var2 + 6.0F / 16.0F), (double)((float)var2 + 10.0F / 16.0F), (double)((float)var3 - 0.25F + 1.0F - var12), (double)((float)var3 - 0.25F + 1.0F), (double)((float)var4 + 10.0F / 16.0F), (double)((float)var4 + 10.0F / 16.0F), var11 * 0.8F, var13); + this.func_31076_a((double)((float)var2 + 10.0F / 16.0F), (double)((float)var2 + 6.0F / 16.0F), (double)((float)var3 - 0.25F + 1.0F - var12), (double)((float)var3 - 0.25F + 1.0F), (double)((float)var4 + 6.0F / 16.0F), (double)((float)var4 + 6.0F / 16.0F), var11 * 0.8F, var13); + this.func_31076_a((double)((float)var2 + 6.0F / 16.0F), (double)((float)var2 + 6.0F / 16.0F), (double)((float)var3 - 0.25F + 1.0F - var12), (double)((float)var3 - 0.25F + 1.0F), (double)((float)var4 + 6.0F / 16.0F), (double)((float)var4 + 10.0F / 16.0F), var11 * 0.6F, var13); + this.func_31076_a((double)((float)var2 + 10.0F / 16.0F), (double)((float)var2 + 10.0F / 16.0F), (double)((float)var3 - 0.25F + 1.0F - var12), (double)((float)var3 - 0.25F + 1.0F), (double)((float)var4 + 10.0F / 16.0F), (double)((float)var4 + 6.0F / 16.0F), var11 * 0.6F, var13); + break; + case 2: + this.field_31085_i = 1; + this.field_31084_j = 2; + var1.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 0.25F); + this.renderStandardBlock(var1, var2, var3, var4); + this.func_31081_b((double)((float)var2 + 6.0F / 16.0F), (double)((float)var2 + 6.0F / 16.0F), (double)((float)var3 + 10.0F / 16.0F), (double)((float)var3 + 6.0F / 16.0F), (double)((float)var4 + 0.25F), (double)((float)var4 + 0.25F + var12), var11 * 0.6F, var13); + this.func_31081_b((double)((float)var2 + 10.0F / 16.0F), (double)((float)var2 + 10.0F / 16.0F), (double)((float)var3 + 6.0F / 16.0F), (double)((float)var3 + 10.0F / 16.0F), (double)((float)var4 + 0.25F), (double)((float)var4 + 0.25F + var12), var11 * 0.6F, var13); + this.func_31081_b((double)((float)var2 + 6.0F / 16.0F), (double)((float)var2 + 10.0F / 16.0F), (double)((float)var3 + 6.0F / 16.0F), (double)((float)var3 + 6.0F / 16.0F), (double)((float)var4 + 0.25F), (double)((float)var4 + 0.25F + var12), var11 * 0.5F, var13); + this.func_31081_b((double)((float)var2 + 10.0F / 16.0F), (double)((float)var2 + 6.0F / 16.0F), (double)((float)var3 + 10.0F / 16.0F), (double)((float)var3 + 10.0F / 16.0F), (double)((float)var4 + 0.25F), (double)((float)var4 + 0.25F + var12), var11, var13); + break; + case 3: + this.field_31085_i = 2; + this.field_31084_j = 1; + this.field_31083_k = 3; + this.field_31082_l = 3; + var1.setBlockBounds(0.0F, 0.0F, 12.0F / 16.0F, 1.0F, 1.0F, 1.0F); + this.renderStandardBlock(var1, var2, var3, var4); + this.func_31081_b((double)((float)var2 + 6.0F / 16.0F), (double)((float)var2 + 6.0F / 16.0F), (double)((float)var3 + 10.0F / 16.0F), (double)((float)var3 + 6.0F / 16.0F), (double)((float)var4 - 0.25F + 1.0F - var12), (double)((float)var4 - 0.25F + 1.0F), var11 * 0.6F, var13); + this.func_31081_b((double)((float)var2 + 10.0F / 16.0F), (double)((float)var2 + 10.0F / 16.0F), (double)((float)var3 + 6.0F / 16.0F), (double)((float)var3 + 10.0F / 16.0F), (double)((float)var4 - 0.25F + 1.0F - var12), (double)((float)var4 - 0.25F + 1.0F), var11 * 0.6F, var13); + this.func_31081_b((double)((float)var2 + 6.0F / 16.0F), (double)((float)var2 + 10.0F / 16.0F), (double)((float)var3 + 6.0F / 16.0F), (double)((float)var3 + 6.0F / 16.0F), (double)((float)var4 - 0.25F + 1.0F - var12), (double)((float)var4 - 0.25F + 1.0F), var11 * 0.5F, var13); + this.func_31081_b((double)((float)var2 + 10.0F / 16.0F), (double)((float)var2 + 6.0F / 16.0F), (double)((float)var3 + 10.0F / 16.0F), (double)((float)var3 + 10.0F / 16.0F), (double)((float)var4 - 0.25F + 1.0F - var12), (double)((float)var4 - 0.25F + 1.0F), var11, var13); + break; + case 4: + this.field_31087_g = 1; + this.field_31086_h = 2; + this.field_31083_k = 2; + this.field_31082_l = 1; + var1.setBlockBounds(0.0F, 0.0F, 0.0F, 0.25F, 1.0F, 1.0F); + this.renderStandardBlock(var1, var2, var3, var4); + this.func_31077_c((double)((float)var2 + 0.25F), (double)((float)var2 + 0.25F + var12), (double)((float)var3 + 6.0F / 16.0F), (double)((float)var3 + 6.0F / 16.0F), (double)((float)var4 + 10.0F / 16.0F), (double)((float)var4 + 6.0F / 16.0F), var11 * 0.5F, var13); + this.func_31077_c((double)((float)var2 + 0.25F), (double)((float)var2 + 0.25F + var12), (double)((float)var3 + 10.0F / 16.0F), (double)((float)var3 + 10.0F / 16.0F), (double)((float)var4 + 6.0F / 16.0F), (double)((float)var4 + 10.0F / 16.0F), var11, var13); + this.func_31077_c((double)((float)var2 + 0.25F), (double)((float)var2 + 0.25F + var12), (double)((float)var3 + 6.0F / 16.0F), (double)((float)var3 + 10.0F / 16.0F), (double)((float)var4 + 6.0F / 16.0F), (double)((float)var4 + 6.0F / 16.0F), var11 * 0.6F, var13); + this.func_31077_c((double)((float)var2 + 0.25F), (double)((float)var2 + 0.25F + var12), (double)((float)var3 + 10.0F / 16.0F), (double)((float)var3 + 6.0F / 16.0F), (double)((float)var4 + 10.0F / 16.0F), (double)((float)var4 + 10.0F / 16.0F), var11 * 0.6F, var13); + break; + case 5: + this.field_31087_g = 2; + this.field_31086_h = 1; + this.field_31083_k = 1; + this.field_31082_l = 2; + var1.setBlockBounds(12.0F / 16.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + this.renderStandardBlock(var1, var2, var3, var4); + this.func_31077_c((double)((float)var2 - 0.25F + 1.0F - var12), (double)((float)var2 - 0.25F + 1.0F), (double)((float)var3 + 6.0F / 16.0F), (double)((float)var3 + 6.0F / 16.0F), (double)((float)var4 + 10.0F / 16.0F), (double)((float)var4 + 6.0F / 16.0F), var11 * 0.5F, var13); + this.func_31077_c((double)((float)var2 - 0.25F + 1.0F - var12), (double)((float)var2 - 0.25F + 1.0F), (double)((float)var3 + 10.0F / 16.0F), (double)((float)var3 + 10.0F / 16.0F), (double)((float)var4 + 6.0F / 16.0F), (double)((float)var4 + 10.0F / 16.0F), var11, var13); + this.func_31077_c((double)((float)var2 - 0.25F + 1.0F - var12), (double)((float)var2 - 0.25F + 1.0F), (double)((float)var3 + 6.0F / 16.0F), (double)((float)var3 + 10.0F / 16.0F), (double)((float)var4 + 6.0F / 16.0F), (double)((float)var4 + 6.0F / 16.0F), var11 * 0.6F, var13); + this.func_31077_c((double)((float)var2 - 0.25F + 1.0F - var12), (double)((float)var2 - 0.25F + 1.0F), (double)((float)var3 + 10.0F / 16.0F), (double)((float)var3 + 6.0F / 16.0F), (double)((float)var4 + 10.0F / 16.0F), (double)((float)var4 + 10.0F / 16.0F), var11 * 0.6F, var13); + } + + this.field_31087_g = 0; + this.field_31086_h = 0; + this.field_31085_i = 0; + this.field_31084_j = 0; + this.field_31083_k = 0; + this.field_31082_l = 0; + var1.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + return true; + } + + public boolean renderBlockLever(Block var1, int var2, int var3, int var4) { + int var5 = this.blockAccess.getBlockMetadata(var2, var3, var4); + int var6 = var5 & 7; + boolean var7 = (var5 & 8) > 0; + Tessellator var8 = Tessellator.instance; + boolean var9 = this.overrideBlockTexture >= 0; + if(!var9) { + this.overrideBlockTexture = Block.cobblestone.blockIndexInTexture; + } + + float var10 = 0.25F; + float var11 = 3.0F / 16.0F; + float var12 = 3.0F / 16.0F; + if(var6 == 5) { + var1.setBlockBounds(0.5F - var11, 0.0F, 0.5F - var10, 0.5F + var11, var12, 0.5F + var10); + } else if(var6 == 6) { + var1.setBlockBounds(0.5F - var10, 0.0F, 0.5F - var11, 0.5F + var10, var12, 0.5F + var11); + } else if(var6 == 4) { + var1.setBlockBounds(0.5F - var11, 0.5F - var10, 1.0F - var12, 0.5F + var11, 0.5F + var10, 1.0F); + } else if(var6 == 3) { + var1.setBlockBounds(0.5F - var11, 0.5F - var10, 0.0F, 0.5F + var11, 0.5F + var10, var12); + } else if(var6 == 2) { + var1.setBlockBounds(1.0F - var12, 0.5F - var10, 0.5F - var11, 1.0F, 0.5F + var10, 0.5F + var11); + } else if(var6 == 1) { + var1.setBlockBounds(0.0F, 0.5F - var10, 0.5F - var11, var12, 0.5F + var10, 0.5F + var11); + } + + this.renderStandardBlock(var1, var2, var3, var4); + if(!var9) { + this.overrideBlockTexture = -1; + } + + float var13 = var1.getBlockBrightness(this.blockAccess, var2, var3, var4); + if(Block.lightValue[var1.blockID] > 0) { + var13 = 1.0F; + } + + var8.setColorOpaque_F(var13, var13, var13); + int var14 = var1.getBlockTextureFromSide(0); + if(this.overrideBlockTexture >= 0) { + var14 = this.overrideBlockTexture; + } + + int var15 = (var14 & 15) << 4; + int var16 = var14 & 240; + float var17 = (float)var15 / 256.0F; + float var18 = ((float)var15 + 15.99F) / 256.0F; + float var19 = (float)var16 / 256.0F; + float var20 = ((float)var16 + 15.99F) / 256.0F; + Vec3D[] var21 = new Vec3D[8]; + float var22 = 1.0F / 16.0F; + float var23 = 1.0F / 16.0F; + float var24 = 10.0F / 16.0F; + var21[0] = Vec3D.createVector((double)(-var22), 0.0D, (double)(-var23)); + var21[1] = Vec3D.createVector((double)var22, 0.0D, (double)(-var23)); + var21[2] = Vec3D.createVector((double)var22, 0.0D, (double)var23); + var21[3] = Vec3D.createVector((double)(-var22), 0.0D, (double)var23); + var21[4] = Vec3D.createVector((double)(-var22), (double)var24, (double)(-var23)); + var21[5] = Vec3D.createVector((double)var22, (double)var24, (double)(-var23)); + var21[6] = Vec3D.createVector((double)var22, (double)var24, (double)var23); + var21[7] = Vec3D.createVector((double)(-var22), (double)var24, (double)var23); + + for(int var25 = 0; var25 < 8; ++var25) { + if(var7) { + var21[var25].zCoord -= 1.0D / 16.0D; + var21[var25].rotateAroundX((float)Math.PI * 2.0F / 9.0F); + } else { + var21[var25].zCoord += 1.0D / 16.0D; + var21[var25].rotateAroundX(-((float)Math.PI * 2.0F / 9.0F)); + } + + if(var6 == 6) { + var21[var25].rotateAroundY((float)Math.PI * 0.5F); + } + + if(var6 < 5) { + var21[var25].yCoord -= 0.375D; + var21[var25].rotateAroundX((float)Math.PI * 0.5F); + if(var6 == 4) { + var21[var25].rotateAroundY(0.0F); + } + + if(var6 == 3) { + var21[var25].rotateAroundY((float)Math.PI); + } + + if(var6 == 2) { + var21[var25].rotateAroundY((float)Math.PI * 0.5F); + } + + if(var6 == 1) { + var21[var25].rotateAroundY((float)Math.PI * -0.5F); + } + + var21[var25].xCoord += (double)var2 + 0.5D; + var21[var25].yCoord += (double)((float)var3 + 0.5F); + var21[var25].zCoord += (double)var4 + 0.5D; + } else { + var21[var25].xCoord += (double)var2 + 0.5D; + var21[var25].yCoord += (double)((float)var3 + 2.0F / 16.0F); + var21[var25].zCoord += (double)var4 + 0.5D; + } + } + + Vec3D var30 = null; + Vec3D var26 = null; + Vec3D var27 = null; + Vec3D var28 = null; + + for(int var29 = 0; var29 < 6; ++var29) { + if(var29 == 0) { + var17 = (float)(var15 + 7) / 256.0F; + var18 = ((float)(var15 + 9) - 0.01F) / 256.0F; + var19 = (float)(var16 + 6) / 256.0F; + var20 = ((float)(var16 + 8) - 0.01F) / 256.0F; + } else if(var29 == 2) { + var17 = (float)(var15 + 7) / 256.0F; + var18 = ((float)(var15 + 9) - 0.01F) / 256.0F; + var19 = (float)(var16 + 6) / 256.0F; + var20 = ((float)(var16 + 16) - 0.01F) / 256.0F; + } + + if(var29 == 0) { + var30 = var21[0]; + var26 = var21[1]; + var27 = var21[2]; + var28 = var21[3]; + } else if(var29 == 1) { + var30 = var21[7]; + var26 = var21[6]; + var27 = var21[5]; + var28 = var21[4]; + } else if(var29 == 2) { + var30 = var21[1]; + var26 = var21[0]; + var27 = var21[4]; + var28 = var21[5]; + } else if(var29 == 3) { + var30 = var21[2]; + var26 = var21[1]; + var27 = var21[5]; + var28 = var21[6]; + } else if(var29 == 4) { + var30 = var21[3]; + var26 = var21[2]; + var27 = var21[6]; + var28 = var21[7]; + } else if(var29 == 5) { + var30 = var21[0]; + var26 = var21[3]; + var27 = var21[7]; + var28 = var21[4]; + } + + var8.addVertexWithUV(var30.xCoord, var30.yCoord, var30.zCoord, (double)var17, (double)var20); + var8.addVertexWithUV(var26.xCoord, var26.yCoord, var26.zCoord, (double)var18, (double)var20); + var8.addVertexWithUV(var27.xCoord, var27.yCoord, var27.zCoord, (double)var18, (double)var19); + var8.addVertexWithUV(var28.xCoord, var28.yCoord, var28.zCoord, (double)var17, (double)var19); + } + + return true; + } + + public boolean renderBlockFire(Block var1, int var2, int var3, int var4) { + Tessellator var5 = Tessellator.instance; + int var6 = var1.getBlockTextureFromSide(0); + if(this.overrideBlockTexture >= 0) { + var6 = this.overrideBlockTexture; + } + + float var7 = var1.getBlockBrightness(this.blockAccess, var2, var3, var4); + var5.setColorOpaque_F(var7, var7, var7); + int var8 = (var6 & 15) << 4; + int var9 = var6 & 240; + double var10 = (double)((float)var8 / 256.0F); + double var12 = (double)(((float)var8 + 15.99F) / 256.0F); + double var14 = (double)((float)var9 / 256.0F); + double var16 = (double)(((float)var9 + 15.99F) / 256.0F); + float var18 = 1.4F; + double var21; + double var23; + double var25; + double var27; + double var29; + double var31; + double var33; + if(!this.blockAccess.isBlockNormalCube(var2, var3 - 1, var4) && !Block.fire.canBlockCatchFire(this.blockAccess, var2, var3 - 1, var4)) { + float var37 = 0.2F; + float var20 = 1.0F / 16.0F; + if((var2 + var3 + var4 & 1) == 1) { + var10 = (double)((float)var8 / 256.0F); + var12 = (double)(((float)var8 + 15.99F) / 256.0F); + var14 = (double)((float)(var9 + 16) / 256.0F); + var16 = (double)(((float)var9 + 15.99F + 16.0F) / 256.0F); + } + + if((var2 / 2 + var3 / 2 + var4 / 2 & 1) == 1) { + var21 = var12; + var12 = var10; + var10 = var21; + } + + if(Block.fire.canBlockCatchFire(this.blockAccess, var2 - 1, var3, var4)) { + var5.addVertexWithUV((double)((float)var2 + var37), (double)((float)var3 + var18 + var20), (double)(var4 + 1), var12, var14); + var5.addVertexWithUV((double)(var2 + 0), (double)((float)(var3 + 0) + var20), (double)(var4 + 1), var12, var16); + var5.addVertexWithUV((double)(var2 + 0), (double)((float)(var3 + 0) + var20), (double)(var4 + 0), var10, var16); + var5.addVertexWithUV((double)((float)var2 + var37), (double)((float)var3 + var18 + var20), (double)(var4 + 0), var10, var14); + var5.addVertexWithUV((double)((float)var2 + var37), (double)((float)var3 + var18 + var20), (double)(var4 + 0), var10, var14); + var5.addVertexWithUV((double)(var2 + 0), (double)((float)(var3 + 0) + var20), (double)(var4 + 0), var10, var16); + var5.addVertexWithUV((double)(var2 + 0), (double)((float)(var3 + 0) + var20), (double)(var4 + 1), var12, var16); + var5.addVertexWithUV((double)((float)var2 + var37), (double)((float)var3 + var18 + var20), (double)(var4 + 1), var12, var14); + } + + if(Block.fire.canBlockCatchFire(this.blockAccess, var2 + 1, var3, var4)) { + var5.addVertexWithUV((double)((float)(var2 + 1) - var37), (double)((float)var3 + var18 + var20), (double)(var4 + 0), var10, var14); + var5.addVertexWithUV((double)(var2 + 1 - 0), (double)((float)(var3 + 0) + var20), (double)(var4 + 0), var10, var16); + var5.addVertexWithUV((double)(var2 + 1 - 0), (double)((float)(var3 + 0) + var20), (double)(var4 + 1), var12, var16); + var5.addVertexWithUV((double)((float)(var2 + 1) - var37), (double)((float)var3 + var18 + var20), (double)(var4 + 1), var12, var14); + var5.addVertexWithUV((double)((float)(var2 + 1) - var37), (double)((float)var3 + var18 + var20), (double)(var4 + 1), var12, var14); + var5.addVertexWithUV((double)(var2 + 1 - 0), (double)((float)(var3 + 0) + var20), (double)(var4 + 1), var12, var16); + var5.addVertexWithUV((double)(var2 + 1 - 0), (double)((float)(var3 + 0) + var20), (double)(var4 + 0), var10, var16); + var5.addVertexWithUV((double)((float)(var2 + 1) - var37), (double)((float)var3 + var18 + var20), (double)(var4 + 0), var10, var14); + } + + if(Block.fire.canBlockCatchFire(this.blockAccess, var2, var3, var4 - 1)) { + var5.addVertexWithUV((double)(var2 + 0), (double)((float)var3 + var18 + var20), (double)((float)var4 + var37), var12, var14); + var5.addVertexWithUV((double)(var2 + 0), (double)((float)(var3 + 0) + var20), (double)(var4 + 0), var12, var16); + var5.addVertexWithUV((double)(var2 + 1), (double)((float)(var3 + 0) + var20), (double)(var4 + 0), var10, var16); + var5.addVertexWithUV((double)(var2 + 1), (double)((float)var3 + var18 + var20), (double)((float)var4 + var37), var10, var14); + var5.addVertexWithUV((double)(var2 + 1), (double)((float)var3 + var18 + var20), (double)((float)var4 + var37), var10, var14); + var5.addVertexWithUV((double)(var2 + 1), (double)((float)(var3 + 0) + var20), (double)(var4 + 0), var10, var16); + var5.addVertexWithUV((double)(var2 + 0), (double)((float)(var3 + 0) + var20), (double)(var4 + 0), var12, var16); + var5.addVertexWithUV((double)(var2 + 0), (double)((float)var3 + var18 + var20), (double)((float)var4 + var37), var12, var14); + } + + if(Block.fire.canBlockCatchFire(this.blockAccess, var2, var3, var4 + 1)) { + var5.addVertexWithUV((double)(var2 + 1), (double)((float)var3 + var18 + var20), (double)((float)(var4 + 1) - var37), var10, var14); + var5.addVertexWithUV((double)(var2 + 1), (double)((float)(var3 + 0) + var20), (double)(var4 + 1 - 0), var10, var16); + var5.addVertexWithUV((double)(var2 + 0), (double)((float)(var3 + 0) + var20), (double)(var4 + 1 - 0), var12, var16); + var5.addVertexWithUV((double)(var2 + 0), (double)((float)var3 + var18 + var20), (double)((float)(var4 + 1) - var37), var12, var14); + var5.addVertexWithUV((double)(var2 + 0), (double)((float)var3 + var18 + var20), (double)((float)(var4 + 1) - var37), var12, var14); + var5.addVertexWithUV((double)(var2 + 0), (double)((float)(var3 + 0) + var20), (double)(var4 + 1 - 0), var12, var16); + var5.addVertexWithUV((double)(var2 + 1), (double)((float)(var3 + 0) + var20), (double)(var4 + 1 - 0), var10, var16); + var5.addVertexWithUV((double)(var2 + 1), (double)((float)var3 + var18 + var20), (double)((float)(var4 + 1) - var37), var10, var14); + } + + if(Block.fire.canBlockCatchFire(this.blockAccess, var2, var3 + 1, var4)) { + var21 = (double)var2 + 0.5D + 0.5D; + var23 = (double)var2 + 0.5D - 0.5D; + var25 = (double)var4 + 0.5D + 0.5D; + var27 = (double)var4 + 0.5D - 0.5D; + var29 = (double)var2 + 0.5D - 0.5D; + var31 = (double)var2 + 0.5D + 0.5D; + var33 = (double)var4 + 0.5D - 0.5D; + double var35 = (double)var4 + 0.5D + 0.5D; + var10 = (double)((float)var8 / 256.0F); + var12 = (double)(((float)var8 + 15.99F) / 256.0F); + var14 = (double)((float)var9 / 256.0F); + var16 = (double)(((float)var9 + 15.99F) / 256.0F); + ++var3; + var18 = -0.2F; + if((var2 + var3 + var4 & 1) == 0) { + var5.addVertexWithUV(var29, (double)((float)var3 + var18), (double)(var4 + 0), var12, var14); + var5.addVertexWithUV(var21, (double)(var3 + 0), (double)(var4 + 0), var12, var16); + var5.addVertexWithUV(var21, (double)(var3 + 0), (double)(var4 + 1), var10, var16); + var5.addVertexWithUV(var29, (double)((float)var3 + var18), (double)(var4 + 1), var10, var14); + var10 = (double)((float)var8 / 256.0F); + var12 = (double)(((float)var8 + 15.99F) / 256.0F); + var14 = (double)((float)(var9 + 16) / 256.0F); + var16 = (double)(((float)var9 + 15.99F + 16.0F) / 256.0F); + var5.addVertexWithUV(var31, (double)((float)var3 + var18), (double)(var4 + 1), var12, var14); + var5.addVertexWithUV(var23, (double)(var3 + 0), (double)(var4 + 1), var12, var16); + var5.addVertexWithUV(var23, (double)(var3 + 0), (double)(var4 + 0), var10, var16); + var5.addVertexWithUV(var31, (double)((float)var3 + var18), (double)(var4 + 0), var10, var14); + } else { + var5.addVertexWithUV((double)(var2 + 0), (double)((float)var3 + var18), var35, var12, var14); + var5.addVertexWithUV((double)(var2 + 0), (double)(var3 + 0), var27, var12, var16); + var5.addVertexWithUV((double)(var2 + 1), (double)(var3 + 0), var27, var10, var16); + var5.addVertexWithUV((double)(var2 + 1), (double)((float)var3 + var18), var35, var10, var14); + var10 = (double)((float)var8 / 256.0F); + var12 = (double)(((float)var8 + 15.99F) / 256.0F); + var14 = (double)((float)(var9 + 16) / 256.0F); + var16 = (double)(((float)var9 + 15.99F + 16.0F) / 256.0F); + var5.addVertexWithUV((double)(var2 + 1), (double)((float)var3 + var18), var33, var12, var14); + var5.addVertexWithUV((double)(var2 + 1), (double)(var3 + 0), var25, var12, var16); + var5.addVertexWithUV((double)(var2 + 0), (double)(var3 + 0), var25, var10, var16); + var5.addVertexWithUV((double)(var2 + 0), (double)((float)var3 + var18), var33, var10, var14); + } + } + } else { + double var19 = (double)var2 + 0.5D + 0.2D; + var21 = (double)var2 + 0.5D - 0.2D; + var23 = (double)var4 + 0.5D + 0.2D; + var25 = (double)var4 + 0.5D - 0.2D; + var27 = (double)var2 + 0.5D - 0.3D; + var29 = (double)var2 + 0.5D + 0.3D; + var31 = (double)var4 + 0.5D - 0.3D; + var33 = (double)var4 + 0.5D + 0.3D; + var5.addVertexWithUV(var27, (double)((float)var3 + var18), (double)(var4 + 1), var12, var14); + var5.addVertexWithUV(var19, (double)(var3 + 0), (double)(var4 + 1), var12, var16); + var5.addVertexWithUV(var19, (double)(var3 + 0), (double)(var4 + 0), var10, var16); + var5.addVertexWithUV(var27, (double)((float)var3 + var18), (double)(var4 + 0), var10, var14); + var5.addVertexWithUV(var29, (double)((float)var3 + var18), (double)(var4 + 0), var12, var14); + var5.addVertexWithUV(var21, (double)(var3 + 0), (double)(var4 + 0), var12, var16); + var5.addVertexWithUV(var21, (double)(var3 + 0), (double)(var4 + 1), var10, var16); + var5.addVertexWithUV(var29, (double)((float)var3 + var18), (double)(var4 + 1), var10, var14); + var10 = (double)((float)var8 / 256.0F); + var12 = (double)(((float)var8 + 15.99F) / 256.0F); + var14 = (double)((float)(var9 + 16) / 256.0F); + var16 = (double)(((float)var9 + 15.99F + 16.0F) / 256.0F); + var5.addVertexWithUV((double)(var2 + 1), (double)((float)var3 + var18), var33, var12, var14); + var5.addVertexWithUV((double)(var2 + 1), (double)(var3 + 0), var25, var12, var16); + var5.addVertexWithUV((double)(var2 + 0), (double)(var3 + 0), var25, var10, var16); + var5.addVertexWithUV((double)(var2 + 0), (double)((float)var3 + var18), var33, var10, var14); + var5.addVertexWithUV((double)(var2 + 0), (double)((float)var3 + var18), var31, var12, var14); + var5.addVertexWithUV((double)(var2 + 0), (double)(var3 + 0), var23, var12, var16); + var5.addVertexWithUV((double)(var2 + 1), (double)(var3 + 0), var23, var10, var16); + var5.addVertexWithUV((double)(var2 + 1), (double)((float)var3 + var18), var31, var10, var14); + var19 = (double)var2 + 0.5D - 0.5D; + var21 = (double)var2 + 0.5D + 0.5D; + var23 = (double)var4 + 0.5D - 0.5D; + var25 = (double)var4 + 0.5D + 0.5D; + var27 = (double)var2 + 0.5D - 0.4D; + var29 = (double)var2 + 0.5D + 0.4D; + var31 = (double)var4 + 0.5D - 0.4D; + var33 = (double)var4 + 0.5D + 0.4D; + var5.addVertexWithUV(var27, (double)((float)var3 + var18), (double)(var4 + 0), var10, var14); + var5.addVertexWithUV(var19, (double)(var3 + 0), (double)(var4 + 0), var10, var16); + var5.addVertexWithUV(var19, (double)(var3 + 0), (double)(var4 + 1), var12, var16); + var5.addVertexWithUV(var27, (double)((float)var3 + var18), (double)(var4 + 1), var12, var14); + var5.addVertexWithUV(var29, (double)((float)var3 + var18), (double)(var4 + 1), var10, var14); + var5.addVertexWithUV(var21, (double)(var3 + 0), (double)(var4 + 1), var10, var16); + var5.addVertexWithUV(var21, (double)(var3 + 0), (double)(var4 + 0), var12, var16); + var5.addVertexWithUV(var29, (double)((float)var3 + var18), (double)(var4 + 0), var12, var14); + var10 = (double)((float)var8 / 256.0F); + var12 = (double)(((float)var8 + 15.99F) / 256.0F); + var14 = (double)((float)var9 / 256.0F); + var16 = (double)(((float)var9 + 15.99F) / 256.0F); + var5.addVertexWithUV((double)(var2 + 0), (double)((float)var3 + var18), var33, var10, var14); + var5.addVertexWithUV((double)(var2 + 0), (double)(var3 + 0), var25, var10, var16); + var5.addVertexWithUV((double)(var2 + 1), (double)(var3 + 0), var25, var12, var16); + var5.addVertexWithUV((double)(var2 + 1), (double)((float)var3 + var18), var33, var12, var14); + var5.addVertexWithUV((double)(var2 + 1), (double)((float)var3 + var18), var31, var10, var14); + var5.addVertexWithUV((double)(var2 + 1), (double)(var3 + 0), var23, var10, var16); + var5.addVertexWithUV((double)(var2 + 0), (double)(var3 + 0), var23, var12, var16); + var5.addVertexWithUV((double)(var2 + 0), (double)((float)var3 + var18), var31, var12, var14); + } + + return true; + } + + public boolean renderBlockRedstoneWire(Block var1, int var2, int var3, int var4) { + Tessellator var5 = Tessellator.instance; + int var6 = this.blockAccess.getBlockMetadata(var2, var3, var4); + int var7 = var1.getBlockTextureFromSideAndMetadata(1, var6); + if(this.overrideBlockTexture >= 0) { + var7 = this.overrideBlockTexture; + } + + float var8 = var1.getBlockBrightness(this.blockAccess, var2, var3, var4); + float var9 = (float)var6 / 15.0F; + float var10 = var9 * 0.6F + 0.4F; + if(var6 == 0) { + var10 = 0.3F; + } + + float var11 = var9 * var9 * 0.7F - 0.5F; + float var12 = var9 * var9 * 0.6F - 0.7F; + if(var11 < 0.0F) { + var11 = 0.0F; + } + + if(var12 < 0.0F) { + var12 = 0.0F; + } + + var5.setColorOpaque_F(var8 * var10, var8 * var11, var8 * var12); + int var13 = (var7 & 15) << 4; + int var14 = var7 & 240; + double var15 = (double)((float)var13 / 256.0F); + double var17 = (double)(((float)var13 + 15.99F) / 256.0F); + double var19 = (double)((float)var14 / 256.0F); + double var21 = (double)(((float)var14 + 15.99F) / 256.0F); + boolean var26 = BlockRedstoneWire.isPowerProviderOrWire(this.blockAccess, var2 - 1, var3, var4, 1) || !this.blockAccess.isBlockNormalCube(var2 - 1, var3, var4) && BlockRedstoneWire.isPowerProviderOrWire(this.blockAccess, var2 - 1, var3 - 1, var4, -1); + boolean var27 = BlockRedstoneWire.isPowerProviderOrWire(this.blockAccess, var2 + 1, var3, var4, 3) || !this.blockAccess.isBlockNormalCube(var2 + 1, var3, var4) && BlockRedstoneWire.isPowerProviderOrWire(this.blockAccess, var2 + 1, var3 - 1, var4, -1); + boolean var28 = BlockRedstoneWire.isPowerProviderOrWire(this.blockAccess, var2, var3, var4 - 1, 2) || !this.blockAccess.isBlockNormalCube(var2, var3, var4 - 1) && BlockRedstoneWire.isPowerProviderOrWire(this.blockAccess, var2, var3 - 1, var4 - 1, -1); + boolean var29 = BlockRedstoneWire.isPowerProviderOrWire(this.blockAccess, var2, var3, var4 + 1, 0) || !this.blockAccess.isBlockNormalCube(var2, var3, var4 + 1) && BlockRedstoneWire.isPowerProviderOrWire(this.blockAccess, var2, var3 - 1, var4 + 1, -1); + if(!this.blockAccess.isBlockNormalCube(var2, var3 + 1, var4)) { + if(this.blockAccess.isBlockNormalCube(var2 - 1, var3, var4) && BlockRedstoneWire.isPowerProviderOrWire(this.blockAccess, var2 - 1, var3 + 1, var4, -1)) { + var26 = true; + } + + if(this.blockAccess.isBlockNormalCube(var2 + 1, var3, var4) && BlockRedstoneWire.isPowerProviderOrWire(this.blockAccess, var2 + 1, var3 + 1, var4, -1)) { + var27 = true; + } + + if(this.blockAccess.isBlockNormalCube(var2, var3, var4 - 1) && BlockRedstoneWire.isPowerProviderOrWire(this.blockAccess, var2, var3 + 1, var4 - 1, -1)) { + var28 = true; + } + + if(this.blockAccess.isBlockNormalCube(var2, var3, var4 + 1) && BlockRedstoneWire.isPowerProviderOrWire(this.blockAccess, var2, var3 + 1, var4 + 1, -1)) { + var29 = true; + } + } + + float var31 = (float)(var2 + 0); + float var32 = (float)(var2 + 1); + float var33 = (float)(var4 + 0); + float var34 = (float)(var4 + 1); + byte var35 = 0; + if((var26 || var27) && !var28 && !var29) { + var35 = 1; + } + + if((var28 || var29) && !var27 && !var26) { + var35 = 2; + } + + if(var35 != 0) { + var15 = (double)((float)(var13 + 16) / 256.0F); + var17 = (double)(((float)(var13 + 16) + 15.99F) / 256.0F); + var19 = (double)((float)var14 / 256.0F); + var21 = (double)(((float)var14 + 15.99F) / 256.0F); + } + + if(var35 == 0) { + if(var27 || var28 || var29 || var26) { + if(!var26) { + var31 += 5.0F / 16.0F; + } + + if(!var26) { + var15 += 1.25D / 64.0D; + } + + if(!var27) { + var32 -= 5.0F / 16.0F; + } + + if(!var27) { + var17 -= 1.25D / 64.0D; + } + + if(!var28) { + var33 += 5.0F / 16.0F; + } + + if(!var28) { + var19 += 1.25D / 64.0D; + } + + if(!var29) { + var34 -= 5.0F / 16.0F; + } + + if(!var29) { + var21 -= 1.25D / 64.0D; + } + } + + var5.addVertexWithUV((double)var32, (double)((float)var3 + 0.015625F), (double)var34, var17, var21); + var5.addVertexWithUV((double)var32, (double)((float)var3 + 0.015625F), (double)var33, var17, var19); + var5.addVertexWithUV((double)var31, (double)((float)var3 + 0.015625F), (double)var33, var15, var19); + var5.addVertexWithUV((double)var31, (double)((float)var3 + 0.015625F), (double)var34, var15, var21); + var5.setColorOpaque_F(var8, var8, var8); + var5.addVertexWithUV((double)var32, (double)((float)var3 + 0.015625F), (double)var34, var17, var21 + 1.0D / 16.0D); + var5.addVertexWithUV((double)var32, (double)((float)var3 + 0.015625F), (double)var33, var17, var19 + 1.0D / 16.0D); + var5.addVertexWithUV((double)var31, (double)((float)var3 + 0.015625F), (double)var33, var15, var19 + 1.0D / 16.0D); + var5.addVertexWithUV((double)var31, (double)((float)var3 + 0.015625F), (double)var34, var15, var21 + 1.0D / 16.0D); + } else if(var35 == 1) { + var5.addVertexWithUV((double)var32, (double)((float)var3 + 0.015625F), (double)var34, var17, var21); + var5.addVertexWithUV((double)var32, (double)((float)var3 + 0.015625F), (double)var33, var17, var19); + var5.addVertexWithUV((double)var31, (double)((float)var3 + 0.015625F), (double)var33, var15, var19); + var5.addVertexWithUV((double)var31, (double)((float)var3 + 0.015625F), (double)var34, var15, var21); + var5.setColorOpaque_F(var8, var8, var8); + var5.addVertexWithUV((double)var32, (double)((float)var3 + 0.015625F), (double)var34, var17, var21 + 1.0D / 16.0D); + var5.addVertexWithUV((double)var32, (double)((float)var3 + 0.015625F), (double)var33, var17, var19 + 1.0D / 16.0D); + var5.addVertexWithUV((double)var31, (double)((float)var3 + 0.015625F), (double)var33, var15, var19 + 1.0D / 16.0D); + var5.addVertexWithUV((double)var31, (double)((float)var3 + 0.015625F), (double)var34, var15, var21 + 1.0D / 16.0D); + } else if(var35 == 2) { + var5.addVertexWithUV((double)var32, (double)((float)var3 + 0.015625F), (double)var34, var17, var21); + var5.addVertexWithUV((double)var32, (double)((float)var3 + 0.015625F), (double)var33, var15, var21); + var5.addVertexWithUV((double)var31, (double)((float)var3 + 0.015625F), (double)var33, var15, var19); + var5.addVertexWithUV((double)var31, (double)((float)var3 + 0.015625F), (double)var34, var17, var19); + var5.setColorOpaque_F(var8, var8, var8); + var5.addVertexWithUV((double)var32, (double)((float)var3 + 0.015625F), (double)var34, var17, var21 + 1.0D / 16.0D); + var5.addVertexWithUV((double)var32, (double)((float)var3 + 0.015625F), (double)var33, var15, var21 + 1.0D / 16.0D); + var5.addVertexWithUV((double)var31, (double)((float)var3 + 0.015625F), (double)var33, var15, var19 + 1.0D / 16.0D); + var5.addVertexWithUV((double)var31, (double)((float)var3 + 0.015625F), (double)var34, var17, var19 + 1.0D / 16.0D); + } + + if(!this.blockAccess.isBlockNormalCube(var2, var3 + 1, var4)) { + var15 = (double)((float)(var13 + 16) / 256.0F); + var17 = (double)(((float)(var13 + 16) + 15.99F) / 256.0F); + var19 = (double)((float)var14 / 256.0F); + var21 = (double)(((float)var14 + 15.99F) / 256.0F); + if(this.blockAccess.isBlockNormalCube(var2 - 1, var3, var4) && this.blockAccess.getBlockId(var2 - 1, var3 + 1, var4) == Block.redstoneWire.blockID) { + var5.setColorOpaque_F(var8 * var10, var8 * var11, var8 * var12); + var5.addVertexWithUV((double)((float)var2 + 0.015625F), (double)((float)(var3 + 1) + 7.0F / 320.0F), (double)(var4 + 1), var17, var19); + var5.addVertexWithUV((double)((float)var2 + 0.015625F), (double)(var3 + 0), (double)(var4 + 1), var15, var19); + var5.addVertexWithUV((double)((float)var2 + 0.015625F), (double)(var3 + 0), (double)(var4 + 0), var15, var21); + var5.addVertexWithUV((double)((float)var2 + 0.015625F), (double)((float)(var3 + 1) + 7.0F / 320.0F), (double)(var4 + 0), var17, var21); + var5.setColorOpaque_F(var8, var8, var8); + var5.addVertexWithUV((double)((float)var2 + 0.015625F), (double)((float)(var3 + 1) + 7.0F / 320.0F), (double)(var4 + 1), var17, var19 + 1.0D / 16.0D); + var5.addVertexWithUV((double)((float)var2 + 0.015625F), (double)(var3 + 0), (double)(var4 + 1), var15, var19 + 1.0D / 16.0D); + var5.addVertexWithUV((double)((float)var2 + 0.015625F), (double)(var3 + 0), (double)(var4 + 0), var15, var21 + 1.0D / 16.0D); + var5.addVertexWithUV((double)((float)var2 + 0.015625F), (double)((float)(var3 + 1) + 7.0F / 320.0F), (double)(var4 + 0), var17, var21 + 1.0D / 16.0D); + } + + if(this.blockAccess.isBlockNormalCube(var2 + 1, var3, var4) && this.blockAccess.getBlockId(var2 + 1, var3 + 1, var4) == Block.redstoneWire.blockID) { + var5.setColorOpaque_F(var8 * var10, var8 * var11, var8 * var12); + var5.addVertexWithUV((double)((float)(var2 + 1) - 0.015625F), (double)(var3 + 0), (double)(var4 + 1), var15, var21); + var5.addVertexWithUV((double)((float)(var2 + 1) - 0.015625F), (double)((float)(var3 + 1) + 7.0F / 320.0F), (double)(var4 + 1), var17, var21); + var5.addVertexWithUV((double)((float)(var2 + 1) - 0.015625F), (double)((float)(var3 + 1) + 7.0F / 320.0F), (double)(var4 + 0), var17, var19); + var5.addVertexWithUV((double)((float)(var2 + 1) - 0.015625F), (double)(var3 + 0), (double)(var4 + 0), var15, var19); + var5.setColorOpaque_F(var8, var8, var8); + var5.addVertexWithUV((double)((float)(var2 + 1) - 0.015625F), (double)(var3 + 0), (double)(var4 + 1), var15, var21 + 1.0D / 16.0D); + var5.addVertexWithUV((double)((float)(var2 + 1) - 0.015625F), (double)((float)(var3 + 1) + 7.0F / 320.0F), (double)(var4 + 1), var17, var21 + 1.0D / 16.0D); + var5.addVertexWithUV((double)((float)(var2 + 1) - 0.015625F), (double)((float)(var3 + 1) + 7.0F / 320.0F), (double)(var4 + 0), var17, var19 + 1.0D / 16.0D); + var5.addVertexWithUV((double)((float)(var2 + 1) - 0.015625F), (double)(var3 + 0), (double)(var4 + 0), var15, var19 + 1.0D / 16.0D); + } + + if(this.blockAccess.isBlockNormalCube(var2, var3, var4 - 1) && this.blockAccess.getBlockId(var2, var3 + 1, var4 - 1) == Block.redstoneWire.blockID) { + var5.setColorOpaque_F(var8 * var10, var8 * var11, var8 * var12); + var5.addVertexWithUV((double)(var2 + 1), (double)(var3 + 0), (double)((float)var4 + 0.015625F), var15, var21); + var5.addVertexWithUV((double)(var2 + 1), (double)((float)(var3 + 1) + 7.0F / 320.0F), (double)((float)var4 + 0.015625F), var17, var21); + var5.addVertexWithUV((double)(var2 + 0), (double)((float)(var3 + 1) + 7.0F / 320.0F), (double)((float)var4 + 0.015625F), var17, var19); + var5.addVertexWithUV((double)(var2 + 0), (double)(var3 + 0), (double)((float)var4 + 0.015625F), var15, var19); + var5.setColorOpaque_F(var8, var8, var8); + var5.addVertexWithUV((double)(var2 + 1), (double)(var3 + 0), (double)((float)var4 + 0.015625F), var15, var21 + 1.0D / 16.0D); + var5.addVertexWithUV((double)(var2 + 1), (double)((float)(var3 + 1) + 7.0F / 320.0F), (double)((float)var4 + 0.015625F), var17, var21 + 1.0D / 16.0D); + var5.addVertexWithUV((double)(var2 + 0), (double)((float)(var3 + 1) + 7.0F / 320.0F), (double)((float)var4 + 0.015625F), var17, var19 + 1.0D / 16.0D); + var5.addVertexWithUV((double)(var2 + 0), (double)(var3 + 0), (double)((float)var4 + 0.015625F), var15, var19 + 1.0D / 16.0D); + } + + if(this.blockAccess.isBlockNormalCube(var2, var3, var4 + 1) && this.blockAccess.getBlockId(var2, var3 + 1, var4 + 1) == Block.redstoneWire.blockID) { + var5.setColorOpaque_F(var8 * var10, var8 * var11, var8 * var12); + var5.addVertexWithUV((double)(var2 + 1), (double)((float)(var3 + 1) + 7.0F / 320.0F), (double)((float)(var4 + 1) - 0.015625F), var17, var19); + var5.addVertexWithUV((double)(var2 + 1), (double)(var3 + 0), (double)((float)(var4 + 1) - 0.015625F), var15, var19); + var5.addVertexWithUV((double)(var2 + 0), (double)(var3 + 0), (double)((float)(var4 + 1) - 0.015625F), var15, var21); + var5.addVertexWithUV((double)(var2 + 0), (double)((float)(var3 + 1) + 7.0F / 320.0F), (double)((float)(var4 + 1) - 0.015625F), var17, var21); + var5.setColorOpaque_F(var8, var8, var8); + var5.addVertexWithUV((double)(var2 + 1), (double)((float)(var3 + 1) + 7.0F / 320.0F), (double)((float)(var4 + 1) - 0.015625F), var17, var19 + 1.0D / 16.0D); + var5.addVertexWithUV((double)(var2 + 1), (double)(var3 + 0), (double)((float)(var4 + 1) - 0.015625F), var15, var19 + 1.0D / 16.0D); + var5.addVertexWithUV((double)(var2 + 0), (double)(var3 + 0), (double)((float)(var4 + 1) - 0.015625F), var15, var21 + 1.0D / 16.0D); + var5.addVertexWithUV((double)(var2 + 0), (double)((float)(var3 + 1) + 7.0F / 320.0F), (double)((float)(var4 + 1) - 0.015625F), var17, var21 + 1.0D / 16.0D); + } + } + + return true; + } + + public boolean renderBlockMinecartTrack(BlockRail var1, int var2, int var3, int var4) { + Tessellator var5 = Tessellator.instance; + int var6 = this.blockAccess.getBlockMetadata(var2, var3, var4); + int var7 = var1.getBlockTextureFromSideAndMetadata(0, var6); + if(this.overrideBlockTexture >= 0) { + var7 = this.overrideBlockTexture; + } + + if(var1.getIsPowered()) { + var6 &= 7; + } + + float var8 = var1.getBlockBrightness(this.blockAccess, var2, var3, var4); + var5.setColorOpaque_F(var8, var8, var8); + int var9 = (var7 & 15) << 4; + int var10 = var7 & 240; + double var11 = (double)((float)var9 / 256.0F); + double var13 = (double)(((float)var9 + 15.99F) / 256.0F); + double var15 = (double)((float)var10 / 256.0F); + double var17 = (double)(((float)var10 + 15.99F) / 256.0F); + float var19 = 1.0F / 16.0F; + float var20 = (float)(var2 + 1); + float var21 = (float)(var2 + 1); + float var22 = (float)(var2 + 0); + float var23 = (float)(var2 + 0); + float var24 = (float)(var4 + 0); + float var25 = (float)(var4 + 1); + float var26 = (float)(var4 + 1); + float var27 = (float)(var4 + 0); + float var28 = (float)var3 + var19; + float var29 = (float)var3 + var19; + float var30 = (float)var3 + var19; + float var31 = (float)var3 + var19; + if(var6 != 1 && var6 != 2 && var6 != 3 && var6 != 7) { + if(var6 == 8) { + var21 = (float)(var2 + 0); + var20 = var21; + var23 = (float)(var2 + 1); + var22 = var23; + var27 = (float)(var4 + 1); + var24 = var27; + var26 = (float)(var4 + 0); + var25 = var26; + } else if(var6 == 9) { + var23 = (float)(var2 + 0); + var20 = var23; + var22 = (float)(var2 + 1); + var21 = var22; + var25 = (float)(var4 + 0); + var24 = var25; + var27 = (float)(var4 + 1); + var26 = var27; + } + } else { + var23 = (float)(var2 + 1); + var20 = var23; + var22 = (float)(var2 + 0); + var21 = var22; + var25 = (float)(var4 + 1); + var24 = var25; + var27 = (float)(var4 + 0); + var26 = var27; + } + + if(var6 != 2 && var6 != 4) { + if(var6 == 3 || var6 == 5) { + ++var29; + ++var30; + } + } else { + ++var28; + ++var31; + } + + var5.addVertexWithUV((double)var20, (double)var28, (double)var24, var13, var15); + var5.addVertexWithUV((double)var21, (double)var29, (double)var25, var13, var17); + var5.addVertexWithUV((double)var22, (double)var30, (double)var26, var11, var17); + var5.addVertexWithUV((double)var23, (double)var31, (double)var27, var11, var15); + var5.addVertexWithUV((double)var23, (double)var31, (double)var27, var11, var15); + var5.addVertexWithUV((double)var22, (double)var30, (double)var26, var11, var17); + var5.addVertexWithUV((double)var21, (double)var29, (double)var25, var13, var17); + var5.addVertexWithUV((double)var20, (double)var28, (double)var24, var13, var15); + return true; + } + + public boolean renderBlockLadder(Block var1, int var2, int var3, int var4) { + Tessellator var5 = Tessellator.instance; + int var6 = var1.getBlockTextureFromSide(0); + if(this.overrideBlockTexture >= 0) { + var6 = this.overrideBlockTexture; + } + + float var7 = var1.getBlockBrightness(this.blockAccess, var2, var3, var4); + var5.setColorOpaque_F(var7, var7, var7); + int var8 = (var6 & 15) << 4; + int var9 = var6 & 240; + double var10 = (double)((float)var8 / 256.0F); + double var12 = (double)(((float)var8 + 15.99F) / 256.0F); + double var14 = (double)((float)var9 / 256.0F); + double var16 = (double)(((float)var9 + 15.99F) / 256.0F); + int var18 = this.blockAccess.getBlockMetadata(var2, var3, var4); + float var19 = 0.0F; + float var20 = 0.05F; + if(var18 == 5) { + var5.addVertexWithUV((double)((float)var2 + var20), (double)((float)(var3 + 1) + var19), (double)((float)(var4 + 1) + var19), var10, var14); + var5.addVertexWithUV((double)((float)var2 + var20), (double)((float)(var3 + 0) - var19), (double)((float)(var4 + 1) + var19), var10, var16); + var5.addVertexWithUV((double)((float)var2 + var20), (double)((float)(var3 + 0) - var19), (double)((float)(var4 + 0) - var19), var12, var16); + var5.addVertexWithUV((double)((float)var2 + var20), (double)((float)(var3 + 1) + var19), (double)((float)(var4 + 0) - var19), var12, var14); + } + + if(var18 == 4) { + var5.addVertexWithUV((double)((float)(var2 + 1) - var20), (double)((float)(var3 + 0) - var19), (double)((float)(var4 + 1) + var19), var12, var16); + var5.addVertexWithUV((double)((float)(var2 + 1) - var20), (double)((float)(var3 + 1) + var19), (double)((float)(var4 + 1) + var19), var12, var14); + var5.addVertexWithUV((double)((float)(var2 + 1) - var20), (double)((float)(var3 + 1) + var19), (double)((float)(var4 + 0) - var19), var10, var14); + var5.addVertexWithUV((double)((float)(var2 + 1) - var20), (double)((float)(var3 + 0) - var19), (double)((float)(var4 + 0) - var19), var10, var16); + } + + if(var18 == 3) { + var5.addVertexWithUV((double)((float)(var2 + 1) + var19), (double)((float)(var3 + 0) - var19), (double)((float)var4 + var20), var12, var16); + var5.addVertexWithUV((double)((float)(var2 + 1) + var19), (double)((float)(var3 + 1) + var19), (double)((float)var4 + var20), var12, var14); + var5.addVertexWithUV((double)((float)(var2 + 0) - var19), (double)((float)(var3 + 1) + var19), (double)((float)var4 + var20), var10, var14); + var5.addVertexWithUV((double)((float)(var2 + 0) - var19), (double)((float)(var3 + 0) - var19), (double)((float)var4 + var20), var10, var16); + } + + if(var18 == 2) { + var5.addVertexWithUV((double)((float)(var2 + 1) + var19), (double)((float)(var3 + 1) + var19), (double)((float)(var4 + 1) - var20), var10, var14); + var5.addVertexWithUV((double)((float)(var2 + 1) + var19), (double)((float)(var3 + 0) - var19), (double)((float)(var4 + 1) - var20), var10, var16); + var5.addVertexWithUV((double)((float)(var2 + 0) - var19), (double)((float)(var3 + 0) - var19), (double)((float)(var4 + 1) - var20), var12, var16); + var5.addVertexWithUV((double)((float)(var2 + 0) - var19), (double)((float)(var3 + 1) + var19), (double)((float)(var4 + 1) - var20), var12, var14); + } + + return true; + } + + public boolean renderBlockReed(Block var1, int var2, int var3, int var4) { + Tessellator var5 = Tessellator.instance; + float var6 = var1.getBlockBrightness(this.blockAccess, var2, var3, var4); + int var7 = var1.colorMultiplier(this.blockAccess, var2, var3, var4); + float var8 = (float)(var7 >> 16 & 255) / 255.0F; + float var9 = (float)(var7 >> 8 & 255) / 255.0F; + float var10 = (float)(var7 & 255) / 255.0F; + if(EntityRenderer.field_28135_a) { + float var11 = (var8 * 30.0F + var9 * 59.0F + var10 * 11.0F) / 100.0F; + float var12 = (var8 * 30.0F + var9 * 70.0F) / 100.0F; + float var13 = (var8 * 30.0F + var10 * 70.0F) / 100.0F; + var8 = var11; + var9 = var12; + var10 = var13; + } + + var5.setColorOpaque_F(var6 * var8, var6 * var9, var6 * var10); + double var19 = (double)var2; + double var20 = (double)var3; + double var15 = (double)var4; + if(var1 == Block.tallGrass) { + long var17 = (long)(var2 * 3129871) ^ (long)var4 * 116129781L ^ (long)var3; + var17 = var17 * var17 * 42317861L + var17 * 11L; + var19 += ((double)((float)(var17 >> 16 & 15L) / 15.0F) - 0.5D) * 0.5D; + var20 += ((double)((float)(var17 >> 20 & 15L) / 15.0F) - 1.0D) * 0.2D; + var15 += ((double)((float)(var17 >> 24 & 15L) / 15.0F) - 0.5D) * 0.5D; + } + + this.renderCrossedSquares(var1, this.blockAccess.getBlockMetadata(var2, var3, var4), var19, var20, var15); + return true; + } + + public boolean renderBlockCrops(Block var1, int var2, int var3, int var4) { + Tessellator var5 = Tessellator.instance; + float var6 = var1.getBlockBrightness(this.blockAccess, var2, var3, var4); + var5.setColorOpaque_F(var6, var6, var6); + this.func_1245_b(var1, this.blockAccess.getBlockMetadata(var2, var3, var4), (double)var2, (double)((float)var3 - 1.0F / 16.0F), (double)var4); + return true; + } + + public void renderTorchAtAngle(Block var1, double var2, double var4, double var6, double var8, double var10) { + Tessellator var12 = Tessellator.instance; + int var13 = var1.getBlockTextureFromSide(0); + if(this.overrideBlockTexture >= 0) { + var13 = this.overrideBlockTexture; + } + + int var14 = (var13 & 15) << 4; + int var15 = var13 & 240; + float var16 = (float)var14 / 256.0F; + float var17 = ((float)var14 + 15.99F) / 256.0F; + float var18 = (float)var15 / 256.0F; + float var19 = ((float)var15 + 15.99F) / 256.0F; + double var20 = (double)var16 + 1.75D / 64.0D; + double var22 = (double)var18 + 6.0D / 256.0D; + double var24 = (double)var16 + 9.0D / 256.0D; + double var26 = (double)var18 + 1.0D / 32.0D; + var2 += 0.5D; + var6 += 0.5D; + double var28 = var2 - 0.5D; + double var30 = var2 + 0.5D; + double var32 = var6 - 0.5D; + double var34 = var6 + 0.5D; + double var36 = 1.0D / 16.0D; + double var38 = 0.625D; + var12.addVertexWithUV(var2 + var8 * (1.0D - var38) - var36, var4 + var38, var6 + var10 * (1.0D - var38) - var36, var20, var22); + var12.addVertexWithUV(var2 + var8 * (1.0D - var38) - var36, var4 + var38, var6 + var10 * (1.0D - var38) + var36, var20, var26); + var12.addVertexWithUV(var2 + var8 * (1.0D - var38) + var36, var4 + var38, var6 + var10 * (1.0D - var38) + var36, var24, var26); + var12.addVertexWithUV(var2 + var8 * (1.0D - var38) + var36, var4 + var38, var6 + var10 * (1.0D - var38) - var36, var24, var22); + var12.addVertexWithUV(var2 - var36, var4 + 1.0D, var32, (double)var16, (double)var18); + var12.addVertexWithUV(var2 - var36 + var8, var4 + 0.0D, var32 + var10, (double)var16, (double)var19); + var12.addVertexWithUV(var2 - var36 + var8, var4 + 0.0D, var34 + var10, (double)var17, (double)var19); + var12.addVertexWithUV(var2 - var36, var4 + 1.0D, var34, (double)var17, (double)var18); + var12.addVertexWithUV(var2 + var36, var4 + 1.0D, var34, (double)var16, (double)var18); + var12.addVertexWithUV(var2 + var8 + var36, var4 + 0.0D, var34 + var10, (double)var16, (double)var19); + var12.addVertexWithUV(var2 + var8 + var36, var4 + 0.0D, var32 + var10, (double)var17, (double)var19); + var12.addVertexWithUV(var2 + var36, var4 + 1.0D, var32, (double)var17, (double)var18); + var12.addVertexWithUV(var28, var4 + 1.0D, var6 + var36, (double)var16, (double)var18); + var12.addVertexWithUV(var28 + var8, var4 + 0.0D, var6 + var36 + var10, (double)var16, (double)var19); + var12.addVertexWithUV(var30 + var8, var4 + 0.0D, var6 + var36 + var10, (double)var17, (double)var19); + var12.addVertexWithUV(var30, var4 + 1.0D, var6 + var36, (double)var17, (double)var18); + var12.addVertexWithUV(var30, var4 + 1.0D, var6 - var36, (double)var16, (double)var18); + var12.addVertexWithUV(var30 + var8, var4 + 0.0D, var6 - var36 + var10, (double)var16, (double)var19); + var12.addVertexWithUV(var28 + var8, var4 + 0.0D, var6 - var36 + var10, (double)var17, (double)var19); + var12.addVertexWithUV(var28, var4 + 1.0D, var6 - var36, (double)var17, (double)var18); + } + + public void renderCrossedSquares(Block var1, int var2, double var3, double var5, double var7) { + Tessellator var9 = Tessellator.instance; + int var10 = var1.getBlockTextureFromSideAndMetadata(0, var2); + if(this.overrideBlockTexture >= 0) { + var10 = this.overrideBlockTexture; + } + + int var11 = (var10 & 15) << 4; + int var12 = var10 & 240; + double var13 = (double)((float)var11 / 256.0F); + double var15 = (double)(((float)var11 + 15.99F) / 256.0F); + double var17 = (double)((float)var12 / 256.0F); + double var19 = (double)(((float)var12 + 15.99F) / 256.0F); + double var21 = var3 + 0.5D - (double)0.45F; + double var23 = var3 + 0.5D + (double)0.45F; + double var25 = var7 + 0.5D - (double)0.45F; + double var27 = var7 + 0.5D + (double)0.45F; + var9.addVertexWithUV(var21, var5 + 1.0D, var25, var13, var17); + var9.addVertexWithUV(var21, var5 + 0.0D, var25, var13, var19); + var9.addVertexWithUV(var23, var5 + 0.0D, var27, var15, var19); + var9.addVertexWithUV(var23, var5 + 1.0D, var27, var15, var17); + var9.addVertexWithUV(var23, var5 + 1.0D, var27, var13, var17); + var9.addVertexWithUV(var23, var5 + 0.0D, var27, var13, var19); + var9.addVertexWithUV(var21, var5 + 0.0D, var25, var15, var19); + var9.addVertexWithUV(var21, var5 + 1.0D, var25, var15, var17); + var9.addVertexWithUV(var21, var5 + 1.0D, var27, var13, var17); + var9.addVertexWithUV(var21, var5 + 0.0D, var27, var13, var19); + var9.addVertexWithUV(var23, var5 + 0.0D, var25, var15, var19); + var9.addVertexWithUV(var23, var5 + 1.0D, var25, var15, var17); + var9.addVertexWithUV(var23, var5 + 1.0D, var25, var13, var17); + var9.addVertexWithUV(var23, var5 + 0.0D, var25, var13, var19); + var9.addVertexWithUV(var21, var5 + 0.0D, var27, var15, var19); + var9.addVertexWithUV(var21, var5 + 1.0D, var27, var15, var17); + } + + public void func_1245_b(Block var1, int var2, double var3, double var5, double var7) { + Tessellator var9 = Tessellator.instance; + int var10 = var1.getBlockTextureFromSideAndMetadata(0, var2); + if(this.overrideBlockTexture >= 0) { + var10 = this.overrideBlockTexture; + } + + int var11 = (var10 & 15) << 4; + int var12 = var10 & 240; + double var13 = (double)((float)var11 / 256.0F); + double var15 = (double)(((float)var11 + 15.99F) / 256.0F); + double var17 = (double)((float)var12 / 256.0F); + double var19 = (double)(((float)var12 + 15.99F) / 256.0F); + double var21 = var3 + 0.5D - 0.25D; + double var23 = var3 + 0.5D + 0.25D; + double var25 = var7 + 0.5D - 0.5D; + double var27 = var7 + 0.5D + 0.5D; + var9.addVertexWithUV(var21, var5 + 1.0D, var25, var13, var17); + var9.addVertexWithUV(var21, var5 + 0.0D, var25, var13, var19); + var9.addVertexWithUV(var21, var5 + 0.0D, var27, var15, var19); + var9.addVertexWithUV(var21, var5 + 1.0D, var27, var15, var17); + var9.addVertexWithUV(var21, var5 + 1.0D, var27, var13, var17); + var9.addVertexWithUV(var21, var5 + 0.0D, var27, var13, var19); + var9.addVertexWithUV(var21, var5 + 0.0D, var25, var15, var19); + var9.addVertexWithUV(var21, var5 + 1.0D, var25, var15, var17); + var9.addVertexWithUV(var23, var5 + 1.0D, var27, var13, var17); + var9.addVertexWithUV(var23, var5 + 0.0D, var27, var13, var19); + var9.addVertexWithUV(var23, var5 + 0.0D, var25, var15, var19); + var9.addVertexWithUV(var23, var5 + 1.0D, var25, var15, var17); + var9.addVertexWithUV(var23, var5 + 1.0D, var25, var13, var17); + var9.addVertexWithUV(var23, var5 + 0.0D, var25, var13, var19); + var9.addVertexWithUV(var23, var5 + 0.0D, var27, var15, var19); + var9.addVertexWithUV(var23, var5 + 1.0D, var27, var15, var17); + var21 = var3 + 0.5D - 0.5D; + var23 = var3 + 0.5D + 0.5D; + var25 = var7 + 0.5D - 0.25D; + var27 = var7 + 0.5D + 0.25D; + var9.addVertexWithUV(var21, var5 + 1.0D, var25, var13, var17); + var9.addVertexWithUV(var21, var5 + 0.0D, var25, var13, var19); + var9.addVertexWithUV(var23, var5 + 0.0D, var25, var15, var19); + var9.addVertexWithUV(var23, var5 + 1.0D, var25, var15, var17); + var9.addVertexWithUV(var23, var5 + 1.0D, var25, var13, var17); + var9.addVertexWithUV(var23, var5 + 0.0D, var25, var13, var19); + var9.addVertexWithUV(var21, var5 + 0.0D, var25, var15, var19); + var9.addVertexWithUV(var21, var5 + 1.0D, var25, var15, var17); + var9.addVertexWithUV(var23, var5 + 1.0D, var27, var13, var17); + var9.addVertexWithUV(var23, var5 + 0.0D, var27, var13, var19); + var9.addVertexWithUV(var21, var5 + 0.0D, var27, var15, var19); + var9.addVertexWithUV(var21, var5 + 1.0D, var27, var15, var17); + var9.addVertexWithUV(var21, var5 + 1.0D, var27, var13, var17); + var9.addVertexWithUV(var21, var5 + 0.0D, var27, var13, var19); + var9.addVertexWithUV(var23, var5 + 0.0D, var27, var15, var19); + var9.addVertexWithUV(var23, var5 + 1.0D, var27, var15, var17); + } + + public boolean renderBlockFluids(Block var1, int var2, int var3, int var4) { + Tessellator var5 = Tessellator.instance; + int var6 = var1.colorMultiplier(this.blockAccess, var2, var3, var4); + float var7 = (float)(var6 >> 16 & 255) / 255.0F; + float var8 = (float)(var6 >> 8 & 255) / 255.0F; + float var9 = (float)(var6 & 255) / 255.0F; + boolean var10 = var1.shouldSideBeRendered(this.blockAccess, var2, var3 + 1, var4, 1); + boolean var11 = var1.shouldSideBeRendered(this.blockAccess, var2, var3 - 1, var4, 0); + boolean[] var12 = new boolean[]{var1.shouldSideBeRendered(this.blockAccess, var2, var3, var4 - 1, 2), var1.shouldSideBeRendered(this.blockAccess, var2, var3, var4 + 1, 3), var1.shouldSideBeRendered(this.blockAccess, var2 - 1, var3, var4, 4), var1.shouldSideBeRendered(this.blockAccess, var2 + 1, var3, var4, 5)}; + if(!var10 && !var11 && !var12[0] && !var12[1] && !var12[2] && !var12[3]) { + return false; + } else { + boolean var13 = false; + float var14 = 0.5F; + float var15 = 1.0F; + float var16 = 0.8F; + float var17 = 0.6F; + double var18 = 0.0D; + double var20 = 1.0D; + Material var22 = var1.blockMaterial; + int var23 = this.blockAccess.getBlockMetadata(var2, var3, var4); + float var24 = this.func_1224_a(var2, var3, var4, var22); + float var25 = this.func_1224_a(var2, var3, var4 + 1, var22); + float var26 = this.func_1224_a(var2 + 1, var3, var4 + 1, var22); + float var27 = this.func_1224_a(var2 + 1, var3, var4, var22); + int var28; + int var31; + float var36; + float var37; + float var38; + if(this.renderAllFaces || var10) { + var13 = true; + var28 = var1.getBlockTextureFromSideAndMetadata(1, var23); + float var29 = (float)BlockFluid.func_293_a(this.blockAccess, var2, var3, var4, var22); + if(var29 > -999.0F) { + var28 = var1.getBlockTextureFromSideAndMetadata(2, var23); + } + + int var30 = (var28 & 15) << 4; + var31 = var28 & 240; + double var32 = ((double)var30 + 8.0D) / 256.0D; + double var34 = ((double)var31 + 8.0D) / 256.0D; + if(var29 < -999.0F) { + var29 = 0.0F; + } else { + var32 = (double)((float)(var30 + 16) / 256.0F); + var34 = (double)((float)(var31 + 16) / 256.0F); + } + + var36 = MathHelper.sin(var29) * 8.0F / 256.0F; + var37 = MathHelper.cos(var29) * 8.0F / 256.0F; + var38 = var1.getBlockBrightness(this.blockAccess, var2, var3, var4); + var5.setColorOpaque_F(var15 * var38 * var7, var15 * var38 * var8, var15 * var38 * var9); + var5.addVertexWithUV((double)(var2 + 0), (double)((float)var3 + var24), (double)(var4 + 0), var32 - (double)var37 - (double)var36, var34 - (double)var37 + (double)var36); + var5.addVertexWithUV((double)(var2 + 0), (double)((float)var3 + var25), (double)(var4 + 1), var32 - (double)var37 + (double)var36, var34 + (double)var37 + (double)var36); + var5.addVertexWithUV((double)(var2 + 1), (double)((float)var3 + var26), (double)(var4 + 1), var32 + (double)var37 + (double)var36, var34 + (double)var37 - (double)var36); + var5.addVertexWithUV((double)(var2 + 1), (double)((float)var3 + var27), (double)(var4 + 0), var32 + (double)var37 - (double)var36, var34 - (double)var37 - (double)var36); + } + + if(this.renderAllFaces || var11) { + float var52 = var1.getBlockBrightness(this.blockAccess, var2, var3 - 1, var4); + var5.setColorOpaque_F(var14 * var52, var14 * var52, var14 * var52); + this.renderBottomFace(var1, (double)var2, (double)var3, (double)var4, var1.getBlockTextureFromSide(0)); + var13 = true; + } + + for(var28 = 0; var28 < 4; ++var28) { + int var53 = var2; + var31 = var4; + if(var28 == 0) { + var31 = var4 - 1; + } + + if(var28 == 1) { + ++var31; + } + + if(var28 == 2) { + var53 = var2 - 1; + } + + if(var28 == 3) { + ++var53; + } + + int var54 = var1.getBlockTextureFromSideAndMetadata(var28 + 2, var23); + int var33 = (var54 & 15) << 4; + int var55 = var54 & 240; + if(this.renderAllFaces || var12[var28]) { + float var35; + float var39; + float var40; + if(var28 == 0) { + var35 = var24; + var36 = var27; + var37 = (float)var2; + var39 = (float)(var2 + 1); + var38 = (float)var4; + var40 = (float)var4; + } else if(var28 == 1) { + var35 = var26; + var36 = var25; + var37 = (float)(var2 + 1); + var39 = (float)var2; + var38 = (float)(var4 + 1); + var40 = (float)(var4 + 1); + } else if(var28 == 2) { + var35 = var25; + var36 = var24; + var37 = (float)var2; + var39 = (float)var2; + var38 = (float)(var4 + 1); + var40 = (float)var4; + } else { + var35 = var27; + var36 = var26; + var37 = (float)(var2 + 1); + var39 = (float)(var2 + 1); + var38 = (float)var4; + var40 = (float)(var4 + 1); + } + + var13 = true; + double var41 = (double)((float)(var33 + 0) / 256.0F); + double var43 = ((double)(var33 + 16) - 0.01D) / 256.0D; + double var45 = (double)(((float)var55 + (1.0F - var35) * 16.0F) / 256.0F); + double var47 = (double)(((float)var55 + (1.0F - var36) * 16.0F) / 256.0F); + double var49 = ((double)(var55 + 16) - 0.01D) / 256.0D; + float var51 = var1.getBlockBrightness(this.blockAccess, var53, var3, var31); + if(var28 < 2) { + var51 *= var16; + } else { + var51 *= var17; + } + + var5.setColorOpaque_F(var15 * var51 * var7, var15 * var51 * var8, var15 * var51 * var9); + var5.addVertexWithUV((double)var37, (double)((float)var3 + var35), (double)var38, var41, var45); + var5.addVertexWithUV((double)var39, (double)((float)var3 + var36), (double)var40, var43, var47); + var5.addVertexWithUV((double)var39, (double)(var3 + 0), (double)var40, var43, var49); + var5.addVertexWithUV((double)var37, (double)(var3 + 0), (double)var38, var41, var49); + } + } + + var1.minY = var18; + var1.maxY = var20; + return var13; + } + } + + private float func_1224_a(int var1, int var2, int var3, Material var4) { + int var5 = 0; + float var6 = 0.0F; + + for(int var7 = 0; var7 < 4; ++var7) { + int var8 = var1 - (var7 & 1); + int var10 = var3 - (var7 >> 1 & 1); + if(this.blockAccess.getBlockMaterial(var8, var2 + 1, var10) == var4) { + return 1.0F; + } + + Material var11 = this.blockAccess.getBlockMaterial(var8, var2, var10); + if(var11 != var4) { + if(!var11.isSolid()) { + ++var6; + ++var5; + } + } else { + int var12 = this.blockAccess.getBlockMetadata(var8, var2, var10); + if(var12 >= 8 || var12 == 0) { + var6 += BlockFluid.getPercentAir(var12) * 10.0F; + var5 += 10; + } + + var6 += BlockFluid.getPercentAir(var12); + ++var5; + } + } + + return 1.0F - var6 / (float)var5; + } + + public void renderBlockFallingSand(Block var1, World var2, int var3, int var4, int var5) { + float var6 = 0.5F; + float var7 = 1.0F; + float var8 = 0.8F; + float var9 = 0.6F; + Tessellator var10 = Tessellator.instance; + var10.startDrawingQuads(); + float var11 = var1.getBlockBrightness(var2, var3, var4, var5); + float var12 = var1.getBlockBrightness(var2, var3, var4 - 1, var5); + if(var12 < var11) { + var12 = var11; + } + + var10.setColorOpaque_F(var6 * var12, var6 * var12, var6 * var12); + this.renderBottomFace(var1, -0.5D, -0.5D, -0.5D, var1.getBlockTextureFromSide(0)); + var12 = var1.getBlockBrightness(var2, var3, var4 + 1, var5); + if(var12 < var11) { + var12 = var11; + } + + var10.setColorOpaque_F(var7 * var12, var7 * var12, var7 * var12); + this.renderTopFace(var1, -0.5D, -0.5D, -0.5D, var1.getBlockTextureFromSide(1)); + var12 = var1.getBlockBrightness(var2, var3, var4, var5 - 1); + if(var12 < var11) { + var12 = var11; + } + + var10.setColorOpaque_F(var8 * var12, var8 * var12, var8 * var12); + this.renderEastFace(var1, -0.5D, -0.5D, -0.5D, var1.getBlockTextureFromSide(2)); + var12 = var1.getBlockBrightness(var2, var3, var4, var5 + 1); + if(var12 < var11) { + var12 = var11; + } + + var10.setColorOpaque_F(var8 * var12, var8 * var12, var8 * var12); + this.renderWestFace(var1, -0.5D, -0.5D, -0.5D, var1.getBlockTextureFromSide(3)); + var12 = var1.getBlockBrightness(var2, var3 - 1, var4, var5); + if(var12 < var11) { + var12 = var11; + } + + var10.setColorOpaque_F(var9 * var12, var9 * var12, var9 * var12); + this.renderNorthFace(var1, -0.5D, -0.5D, -0.5D, var1.getBlockTextureFromSide(4)); + var12 = var1.getBlockBrightness(var2, var3 + 1, var4, var5); + if(var12 < var11) { + var12 = var11; + } + + var10.setColorOpaque_F(var9 * var12, var9 * var12, var9 * var12); + this.renderSouthFace(var1, -0.5D, -0.5D, -0.5D, var1.getBlockTextureFromSide(5)); + var10.draw(); + } + + public boolean renderStandardBlock(Block var1, int var2, int var3, int var4) { + int var5 = var1.colorMultiplier(this.blockAccess, var2, var3, var4); + float var6 = (float)(var5 >> 16 & 255) / 255.0F; + float var7 = (float)(var5 >> 8 & 255) / 255.0F; + float var8 = (float)(var5 & 255) / 255.0F; + if(EntityRenderer.field_28135_a) { + float var9 = (var6 * 30.0F + var7 * 59.0F + var8 * 11.0F) / 100.0F; + float var10 = (var6 * 30.0F + var7 * 70.0F) / 100.0F; + float var11 = (var6 * 30.0F + var8 * 70.0F) / 100.0F; + var6 = var9; + var7 = var10; + var8 = var11; + } + + return Minecraft.isAmbientOcclusionEnabled() ? this.renderStandardBlockWithAmbientOcclusion(var1, var2, var3, var4, var6, var7, var8) : this.renderStandardBlockWithColorMultiplier(var1, var2, var3, var4, var6, var7, var8); + } + + public boolean renderStandardBlockWithAmbientOcclusion(Block var1, int var2, int var3, int var4, float var5, float var6, float var7) { + this.enableAO = true; + boolean var8 = false; + float var9 = this.lightValueOwn; + float var10 = this.lightValueOwn; + float var11 = this.lightValueOwn; + float var12 = this.lightValueOwn; + boolean var13 = true; + boolean var14 = true; + boolean var15 = true; + boolean var16 = true; + boolean var17 = true; + boolean var18 = true; + this.lightValueOwn = var1.getBlockBrightness(this.blockAccess, var2, var3, var4); + this.aoLightValueXNeg = var1.getBlockBrightness(this.blockAccess, var2 - 1, var3, var4); + this.aoLightValueYNeg = var1.getBlockBrightness(this.blockAccess, var2, var3 - 1, var4); + this.aoLightValueZNeg = var1.getBlockBrightness(this.blockAccess, var2, var3, var4 - 1); + this.aoLightValueXPos = var1.getBlockBrightness(this.blockAccess, var2 + 1, var3, var4); + this.aoLightValueYPos = var1.getBlockBrightness(this.blockAccess, var2, var3 + 1, var4); + this.aoLightValueZPos = var1.getBlockBrightness(this.blockAccess, var2, var3, var4 + 1); + this.field_22338_U = Block.canBlockGrass[this.blockAccess.getBlockId(var2 + 1, var3 + 1, var4)]; + this.field_22359_ac = Block.canBlockGrass[this.blockAccess.getBlockId(var2 + 1, var3 - 1, var4)]; + this.field_22334_Y = Block.canBlockGrass[this.blockAccess.getBlockId(var2 + 1, var3, var4 + 1)]; + this.field_22363_aa = Block.canBlockGrass[this.blockAccess.getBlockId(var2 + 1, var3, var4 - 1)]; + this.field_22337_V = Block.canBlockGrass[this.blockAccess.getBlockId(var2 - 1, var3 + 1, var4)]; + this.field_22357_ad = Block.canBlockGrass[this.blockAccess.getBlockId(var2 - 1, var3 - 1, var4)]; + this.field_22335_X = Block.canBlockGrass[this.blockAccess.getBlockId(var2 - 1, var3, var4 - 1)]; + this.field_22333_Z = Block.canBlockGrass[this.blockAccess.getBlockId(var2 - 1, var3, var4 + 1)]; + this.field_22336_W = Block.canBlockGrass[this.blockAccess.getBlockId(var2, var3 + 1, var4 + 1)]; + this.field_22339_T = Block.canBlockGrass[this.blockAccess.getBlockId(var2, var3 + 1, var4 - 1)]; + this.field_22355_ae = Block.canBlockGrass[this.blockAccess.getBlockId(var2, var3 - 1, var4 + 1)]; + this.field_22361_ab = Block.canBlockGrass[this.blockAccess.getBlockId(var2, var3 - 1, var4 - 1)]; + if(var1.blockIndexInTexture == 3) { + var18 = false; + var17 = var18; + var16 = var18; + var15 = var18; + var13 = var18; + } + + if(this.overrideBlockTexture >= 0) { + var18 = false; + var17 = var18; + var16 = var18; + var15 = var18; + var13 = var18; + } + + if(this.renderAllFaces || var1.shouldSideBeRendered(this.blockAccess, var2, var3 - 1, var4, 0)) { + if(this.field_22352_G <= 0) { + var12 = this.aoLightValueYNeg; + var11 = var12; + var10 = var12; + var9 = var12; + } else { + --var3; + this.field_22376_n = var1.getBlockBrightness(this.blockAccess, var2 - 1, var3, var4); + this.field_22374_p = var1.getBlockBrightness(this.blockAccess, var2, var3, var4 - 1); + this.field_22373_q = var1.getBlockBrightness(this.blockAccess, var2, var3, var4 + 1); + this.field_22371_s = var1.getBlockBrightness(this.blockAccess, var2 + 1, var3, var4); + if(!this.field_22361_ab && !this.field_22357_ad) { + this.field_22377_m = this.field_22376_n; + } else { + this.field_22377_m = var1.getBlockBrightness(this.blockAccess, var2 - 1, var3, var4 - 1); + } + + if(!this.field_22355_ae && !this.field_22357_ad) { + this.field_22375_o = this.field_22376_n; + } else { + this.field_22375_o = var1.getBlockBrightness(this.blockAccess, var2 - 1, var3, var4 + 1); + } + + if(!this.field_22361_ab && !this.field_22359_ac) { + this.field_22372_r = this.field_22371_s; + } else { + this.field_22372_r = var1.getBlockBrightness(this.blockAccess, var2 + 1, var3, var4 - 1); + } + + if(!this.field_22355_ae && !this.field_22359_ac) { + this.field_22370_t = this.field_22371_s; + } else { + this.field_22370_t = var1.getBlockBrightness(this.blockAccess, var2 + 1, var3, var4 + 1); + } + + ++var3; + var9 = (this.field_22375_o + this.field_22376_n + this.field_22373_q + this.aoLightValueYNeg) / 4.0F; + var12 = (this.field_22373_q + this.aoLightValueYNeg + this.field_22370_t + this.field_22371_s) / 4.0F; + var11 = (this.aoLightValueYNeg + this.field_22374_p + this.field_22371_s + this.field_22372_r) / 4.0F; + var10 = (this.field_22376_n + this.field_22377_m + this.aoLightValueYNeg + this.field_22374_p) / 4.0F; + } + + this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = (var13 ? var5 : 1.0F) * 0.5F; + this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = (var13 ? var6 : 1.0F) * 0.5F; + this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = (var13 ? var7 : 1.0F) * 0.5F; + this.colorRedTopLeft *= var9; + this.colorGreenTopLeft *= var9; + this.colorBlueTopLeft *= var9; + this.colorRedBottomLeft *= var10; + this.colorGreenBottomLeft *= var10; + this.colorBlueBottomLeft *= var10; + this.colorRedBottomRight *= var11; + this.colorGreenBottomRight *= var11; + this.colorBlueBottomRight *= var11; + this.colorRedTopRight *= var12; + this.colorGreenTopRight *= var12; + this.colorBlueTopRight *= var12; + this.renderBottomFace(var1, (double)var2, (double)var3, (double)var4, var1.getBlockTexture(this.blockAccess, var2, var3, var4, 0)); + var8 = true; + } + + if(this.renderAllFaces || var1.shouldSideBeRendered(this.blockAccess, var2, var3 + 1, var4, 1)) { + if(this.field_22352_G <= 0) { + var12 = this.aoLightValueYPos; + var11 = var12; + var10 = var12; + var9 = var12; + } else { + ++var3; + this.field_22368_v = var1.getBlockBrightness(this.blockAccess, var2 - 1, var3, var4); + this.field_22364_z = var1.getBlockBrightness(this.blockAccess, var2 + 1, var3, var4); + this.field_22366_x = var1.getBlockBrightness(this.blockAccess, var2, var3, var4 - 1); + this.field_22362_A = var1.getBlockBrightness(this.blockAccess, var2, var3, var4 + 1); + if(!this.field_22339_T && !this.field_22337_V) { + this.field_22369_u = this.field_22368_v; + } else { + this.field_22369_u = var1.getBlockBrightness(this.blockAccess, var2 - 1, var3, var4 - 1); + } + + if(!this.field_22339_T && !this.field_22338_U) { + this.field_22365_y = this.field_22364_z; + } else { + this.field_22365_y = var1.getBlockBrightness(this.blockAccess, var2 + 1, var3, var4 - 1); + } + + if(!this.field_22336_W && !this.field_22337_V) { + this.field_22367_w = this.field_22368_v; + } else { + this.field_22367_w = var1.getBlockBrightness(this.blockAccess, var2 - 1, var3, var4 + 1); + } + + if(!this.field_22336_W && !this.field_22338_U) { + this.field_22360_B = this.field_22364_z; + } else { + this.field_22360_B = var1.getBlockBrightness(this.blockAccess, var2 + 1, var3, var4 + 1); + } + + --var3; + var12 = (this.field_22367_w + this.field_22368_v + this.field_22362_A + this.aoLightValueYPos) / 4.0F; + var9 = (this.field_22362_A + this.aoLightValueYPos + this.field_22360_B + this.field_22364_z) / 4.0F; + var10 = (this.aoLightValueYPos + this.field_22366_x + this.field_22364_z + this.field_22365_y) / 4.0F; + var11 = (this.field_22368_v + this.field_22369_u + this.aoLightValueYPos + this.field_22366_x) / 4.0F; + } + + this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = var14 ? var5 : 1.0F; + this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = var14 ? var6 : 1.0F; + this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = var14 ? var7 : 1.0F; + this.colorRedTopLeft *= var9; + this.colorGreenTopLeft *= var9; + this.colorBlueTopLeft *= var9; + this.colorRedBottomLeft *= var10; + this.colorGreenBottomLeft *= var10; + this.colorBlueBottomLeft *= var10; + this.colorRedBottomRight *= var11; + this.colorGreenBottomRight *= var11; + this.colorBlueBottomRight *= var11; + this.colorRedTopRight *= var12; + this.colorGreenTopRight *= var12; + this.colorBlueTopRight *= var12; + this.renderTopFace(var1, (double)var2, (double)var3, (double)var4, var1.getBlockTexture(this.blockAccess, var2, var3, var4, 1)); + var8 = true; + } + + int var19; + if(this.renderAllFaces || var1.shouldSideBeRendered(this.blockAccess, var2, var3, var4 - 1, 2)) { + if(this.field_22352_G <= 0) { + var12 = this.aoLightValueZNeg; + var11 = var12; + var10 = var12; + var9 = var12; + } else { + --var4; + this.field_22358_C = var1.getBlockBrightness(this.blockAccess, var2 - 1, var3, var4); + this.field_22374_p = var1.getBlockBrightness(this.blockAccess, var2, var3 - 1, var4); + this.field_22366_x = var1.getBlockBrightness(this.blockAccess, var2, var3 + 1, var4); + this.field_22356_D = var1.getBlockBrightness(this.blockAccess, var2 + 1, var3, var4); + if(!this.field_22335_X && !this.field_22361_ab) { + this.field_22377_m = this.field_22358_C; + } else { + this.field_22377_m = var1.getBlockBrightness(this.blockAccess, var2 - 1, var3 - 1, var4); + } + + if(!this.field_22335_X && !this.field_22339_T) { + this.field_22369_u = this.field_22358_C; + } else { + this.field_22369_u = var1.getBlockBrightness(this.blockAccess, var2 - 1, var3 + 1, var4); + } + + if(!this.field_22363_aa && !this.field_22361_ab) { + this.field_22372_r = this.field_22356_D; + } else { + this.field_22372_r = var1.getBlockBrightness(this.blockAccess, var2 + 1, var3 - 1, var4); + } + + if(!this.field_22363_aa && !this.field_22339_T) { + this.field_22365_y = this.field_22356_D; + } else { + this.field_22365_y = var1.getBlockBrightness(this.blockAccess, var2 + 1, var3 + 1, var4); + } + + ++var4; + var9 = (this.field_22358_C + this.field_22369_u + this.aoLightValueZNeg + this.field_22366_x) / 4.0F; + var10 = (this.aoLightValueZNeg + this.field_22366_x + this.field_22356_D + this.field_22365_y) / 4.0F; + var11 = (this.field_22374_p + this.aoLightValueZNeg + this.field_22372_r + this.field_22356_D) / 4.0F; + var12 = (this.field_22377_m + this.field_22358_C + this.field_22374_p + this.aoLightValueZNeg) / 4.0F; + } + + this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = (var15 ? var5 : 1.0F) * 0.8F; + this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = (var15 ? var6 : 1.0F) * 0.8F; + this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = (var15 ? var7 : 1.0F) * 0.8F; + this.colorRedTopLeft *= var9; + this.colorGreenTopLeft *= var9; + this.colorBlueTopLeft *= var9; + this.colorRedBottomLeft *= var10; + this.colorGreenBottomLeft *= var10; + this.colorBlueBottomLeft *= var10; + this.colorRedBottomRight *= var11; + this.colorGreenBottomRight *= var11; + this.colorBlueBottomRight *= var11; + this.colorRedTopRight *= var12; + this.colorGreenTopRight *= var12; + this.colorBlueTopRight *= var12; + var19 = var1.getBlockTexture(this.blockAccess, var2, var3, var4, 2); + this.renderEastFace(var1, (double)var2, (double)var3, (double)var4, var19); + if(fancyGrass && var19 == 3 && this.overrideBlockTexture < 0) { + this.colorRedTopLeft *= var5; + this.colorRedBottomLeft *= var5; + this.colorRedBottomRight *= var5; + this.colorRedTopRight *= var5; + this.colorGreenTopLeft *= var6; + this.colorGreenBottomLeft *= var6; + this.colorGreenBottomRight *= var6; + this.colorGreenTopRight *= var6; + this.colorBlueTopLeft *= var7; + this.colorBlueBottomLeft *= var7; + this.colorBlueBottomRight *= var7; + this.colorBlueTopRight *= var7; + this.renderEastFace(var1, (double)var2, (double)var3, (double)var4, 38); + } + + var8 = true; + } + + if(this.renderAllFaces || var1.shouldSideBeRendered(this.blockAccess, var2, var3, var4 + 1, 3)) { + if(this.field_22352_G <= 0) { + var12 = this.aoLightValueZPos; + var11 = var12; + var10 = var12; + var9 = var12; + } else { + ++var4; + this.field_22354_E = var1.getBlockBrightness(this.blockAccess, var2 - 1, var3, var4); + this.field_22353_F = var1.getBlockBrightness(this.blockAccess, var2 + 1, var3, var4); + this.field_22373_q = var1.getBlockBrightness(this.blockAccess, var2, var3 - 1, var4); + this.field_22362_A = var1.getBlockBrightness(this.blockAccess, var2, var3 + 1, var4); + if(!this.field_22333_Z && !this.field_22355_ae) { + this.field_22375_o = this.field_22354_E; + } else { + this.field_22375_o = var1.getBlockBrightness(this.blockAccess, var2 - 1, var3 - 1, var4); + } + + if(!this.field_22333_Z && !this.field_22336_W) { + this.field_22367_w = this.field_22354_E; + } else { + this.field_22367_w = var1.getBlockBrightness(this.blockAccess, var2 - 1, var3 + 1, var4); + } + + if(!this.field_22334_Y && !this.field_22355_ae) { + this.field_22370_t = this.field_22353_F; + } else { + this.field_22370_t = var1.getBlockBrightness(this.blockAccess, var2 + 1, var3 - 1, var4); + } + + if(!this.field_22334_Y && !this.field_22336_W) { + this.field_22360_B = this.field_22353_F; + } else { + this.field_22360_B = var1.getBlockBrightness(this.blockAccess, var2 + 1, var3 + 1, var4); + } + + --var4; + var9 = (this.field_22354_E + this.field_22367_w + this.aoLightValueZPos + this.field_22362_A) / 4.0F; + var12 = (this.aoLightValueZPos + this.field_22362_A + this.field_22353_F + this.field_22360_B) / 4.0F; + var11 = (this.field_22373_q + this.aoLightValueZPos + this.field_22370_t + this.field_22353_F) / 4.0F; + var10 = (this.field_22375_o + this.field_22354_E + this.field_22373_q + this.aoLightValueZPos) / 4.0F; + } + + this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = (var16 ? var5 : 1.0F) * 0.8F; + this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = (var16 ? var6 : 1.0F) * 0.8F; + this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = (var16 ? var7 : 1.0F) * 0.8F; + this.colorRedTopLeft *= var9; + this.colorGreenTopLeft *= var9; + this.colorBlueTopLeft *= var9; + this.colorRedBottomLeft *= var10; + this.colorGreenBottomLeft *= var10; + this.colorBlueBottomLeft *= var10; + this.colorRedBottomRight *= var11; + this.colorGreenBottomRight *= var11; + this.colorBlueBottomRight *= var11; + this.colorRedTopRight *= var12; + this.colorGreenTopRight *= var12; + this.colorBlueTopRight *= var12; + var19 = var1.getBlockTexture(this.blockAccess, var2, var3, var4, 3); + this.renderWestFace(var1, (double)var2, (double)var3, (double)var4, var1.getBlockTexture(this.blockAccess, var2, var3, var4, 3)); + if(fancyGrass && var19 == 3 && this.overrideBlockTexture < 0) { + this.colorRedTopLeft *= var5; + this.colorRedBottomLeft *= var5; + this.colorRedBottomRight *= var5; + this.colorRedTopRight *= var5; + this.colorGreenTopLeft *= var6; + this.colorGreenBottomLeft *= var6; + this.colorGreenBottomRight *= var6; + this.colorGreenTopRight *= var6; + this.colorBlueTopLeft *= var7; + this.colorBlueBottomLeft *= var7; + this.colorBlueBottomRight *= var7; + this.colorBlueTopRight *= var7; + this.renderWestFace(var1, (double)var2, (double)var3, (double)var4, 38); + } + + var8 = true; + } + + if(this.renderAllFaces || var1.shouldSideBeRendered(this.blockAccess, var2 - 1, var3, var4, 4)) { + if(this.field_22352_G <= 0) { + var12 = this.aoLightValueXNeg; + var11 = var12; + var10 = var12; + var9 = var12; + } else { + --var2; + this.field_22376_n = var1.getBlockBrightness(this.blockAccess, var2, var3 - 1, var4); + this.field_22358_C = var1.getBlockBrightness(this.blockAccess, var2, var3, var4 - 1); + this.field_22354_E = var1.getBlockBrightness(this.blockAccess, var2, var3, var4 + 1); + this.field_22368_v = var1.getBlockBrightness(this.blockAccess, var2, var3 + 1, var4); + if(!this.field_22335_X && !this.field_22357_ad) { + this.field_22377_m = this.field_22358_C; + } else { + this.field_22377_m = var1.getBlockBrightness(this.blockAccess, var2, var3 - 1, var4 - 1); + } + + if(!this.field_22333_Z && !this.field_22357_ad) { + this.field_22375_o = this.field_22354_E; + } else { + this.field_22375_o = var1.getBlockBrightness(this.blockAccess, var2, var3 - 1, var4 + 1); + } + + if(!this.field_22335_X && !this.field_22337_V) { + this.field_22369_u = this.field_22358_C; + } else { + this.field_22369_u = var1.getBlockBrightness(this.blockAccess, var2, var3 + 1, var4 - 1); + } + + if(!this.field_22333_Z && !this.field_22337_V) { + this.field_22367_w = this.field_22354_E; + } else { + this.field_22367_w = var1.getBlockBrightness(this.blockAccess, var2, var3 + 1, var4 + 1); + } + + ++var2; + var12 = (this.field_22376_n + this.field_22375_o + this.aoLightValueXNeg + this.field_22354_E) / 4.0F; + var9 = (this.aoLightValueXNeg + this.field_22354_E + this.field_22368_v + this.field_22367_w) / 4.0F; + var10 = (this.field_22358_C + this.aoLightValueXNeg + this.field_22369_u + this.field_22368_v) / 4.0F; + var11 = (this.field_22377_m + this.field_22376_n + this.field_22358_C + this.aoLightValueXNeg) / 4.0F; + } + + this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = (var17 ? var5 : 1.0F) * 0.6F; + this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = (var17 ? var6 : 1.0F) * 0.6F; + this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = (var17 ? var7 : 1.0F) * 0.6F; + this.colorRedTopLeft *= var9; + this.colorGreenTopLeft *= var9; + this.colorBlueTopLeft *= var9; + this.colorRedBottomLeft *= var10; + this.colorGreenBottomLeft *= var10; + this.colorBlueBottomLeft *= var10; + this.colorRedBottomRight *= var11; + this.colorGreenBottomRight *= var11; + this.colorBlueBottomRight *= var11; + this.colorRedTopRight *= var12; + this.colorGreenTopRight *= var12; + this.colorBlueTopRight *= var12; + var19 = var1.getBlockTexture(this.blockAccess, var2, var3, var4, 4); + this.renderNorthFace(var1, (double)var2, (double)var3, (double)var4, var19); + if(fancyGrass && var19 == 3 && this.overrideBlockTexture < 0) { + this.colorRedTopLeft *= var5; + this.colorRedBottomLeft *= var5; + this.colorRedBottomRight *= var5; + this.colorRedTopRight *= var5; + this.colorGreenTopLeft *= var6; + this.colorGreenBottomLeft *= var6; + this.colorGreenBottomRight *= var6; + this.colorGreenTopRight *= var6; + this.colorBlueTopLeft *= var7; + this.colorBlueBottomLeft *= var7; + this.colorBlueBottomRight *= var7; + this.colorBlueTopRight *= var7; + this.renderNorthFace(var1, (double)var2, (double)var3, (double)var4, 38); + } + + var8 = true; + } + + if(this.renderAllFaces || var1.shouldSideBeRendered(this.blockAccess, var2 + 1, var3, var4, 5)) { + if(this.field_22352_G <= 0) { + var12 = this.aoLightValueXPos; + var11 = var12; + var10 = var12; + var9 = var12; + } else { + ++var2; + this.field_22371_s = var1.getBlockBrightness(this.blockAccess, var2, var3 - 1, var4); + this.field_22356_D = var1.getBlockBrightness(this.blockAccess, var2, var3, var4 - 1); + this.field_22353_F = var1.getBlockBrightness(this.blockAccess, var2, var3, var4 + 1); + this.field_22364_z = var1.getBlockBrightness(this.blockAccess, var2, var3 + 1, var4); + if(!this.field_22359_ac && !this.field_22363_aa) { + this.field_22372_r = this.field_22356_D; + } else { + this.field_22372_r = var1.getBlockBrightness(this.blockAccess, var2, var3 - 1, var4 - 1); + } + + if(!this.field_22359_ac && !this.field_22334_Y) { + this.field_22370_t = this.field_22353_F; + } else { + this.field_22370_t = var1.getBlockBrightness(this.blockAccess, var2, var3 - 1, var4 + 1); + } + + if(!this.field_22338_U && !this.field_22363_aa) { + this.field_22365_y = this.field_22356_D; + } else { + this.field_22365_y = var1.getBlockBrightness(this.blockAccess, var2, var3 + 1, var4 - 1); + } + + if(!this.field_22338_U && !this.field_22334_Y) { + this.field_22360_B = this.field_22353_F; + } else { + this.field_22360_B = var1.getBlockBrightness(this.blockAccess, var2, var3 + 1, var4 + 1); + } + + --var2; + var9 = (this.field_22371_s + this.field_22370_t + this.aoLightValueXPos + this.field_22353_F) / 4.0F; + var12 = (this.aoLightValueXPos + this.field_22353_F + this.field_22364_z + this.field_22360_B) / 4.0F; + var11 = (this.field_22356_D + this.aoLightValueXPos + this.field_22365_y + this.field_22364_z) / 4.0F; + var10 = (this.field_22372_r + this.field_22371_s + this.field_22356_D + this.aoLightValueXPos) / 4.0F; + } + + this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = (var18 ? var5 : 1.0F) * 0.6F; + this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = (var18 ? var6 : 1.0F) * 0.6F; + this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = (var18 ? var7 : 1.0F) * 0.6F; + this.colorRedTopLeft *= var9; + this.colorGreenTopLeft *= var9; + this.colorBlueTopLeft *= var9; + this.colorRedBottomLeft *= var10; + this.colorGreenBottomLeft *= var10; + this.colorBlueBottomLeft *= var10; + this.colorRedBottomRight *= var11; + this.colorGreenBottomRight *= var11; + this.colorBlueBottomRight *= var11; + this.colorRedTopRight *= var12; + this.colorGreenTopRight *= var12; + this.colorBlueTopRight *= var12; + var19 = var1.getBlockTexture(this.blockAccess, var2, var3, var4, 5); + this.renderSouthFace(var1, (double)var2, (double)var3, (double)var4, var19); + if(fancyGrass && var19 == 3 && this.overrideBlockTexture < 0) { + this.colorRedTopLeft *= var5; + this.colorRedBottomLeft *= var5; + this.colorRedBottomRight *= var5; + this.colorRedTopRight *= var5; + this.colorGreenTopLeft *= var6; + this.colorGreenBottomLeft *= var6; + this.colorGreenBottomRight *= var6; + this.colorGreenTopRight *= var6; + this.colorBlueTopLeft *= var7; + this.colorBlueBottomLeft *= var7; + this.colorBlueBottomRight *= var7; + this.colorBlueTopRight *= var7; + this.renderSouthFace(var1, (double)var2, (double)var3, (double)var4, 38); + } + + var8 = true; + } + + this.enableAO = false; + return var8; + } + + public boolean renderStandardBlockWithColorMultiplier(Block var1, int var2, int var3, int var4, float var5, float var6, float var7) { + this.enableAO = false; + Tessellator var8 = Tessellator.instance; + boolean var9 = false; + float var10 = 0.5F; + float var11 = 1.0F; + float var12 = 0.8F; + float var13 = 0.6F; + float var14 = var11 * var5; + float var15 = var11 * var6; + float var16 = var11 * var7; + float var17 = var10; + float var18 = var12; + float var19 = var13; + float var20 = var10; + float var21 = var12; + float var22 = var13; + float var23 = var10; + float var24 = var12; + float var25 = var13; + if(var1 != Block.grass) { + var17 = var10 * var5; + var18 = var12 * var5; + var19 = var13 * var5; + var20 = var10 * var6; + var21 = var12 * var6; + var22 = var13 * var6; + var23 = var10 * var7; + var24 = var12 * var7; + var25 = var13 * var7; + } + + float var26 = var1.getBlockBrightness(this.blockAccess, var2, var3, var4); + float var27; + if(this.renderAllFaces || var1.shouldSideBeRendered(this.blockAccess, var2, var3 - 1, var4, 0)) { + var27 = var1.getBlockBrightness(this.blockAccess, var2, var3 - 1, var4); + var8.setColorOpaque_F(var17 * var27, var20 * var27, var23 * var27); + this.renderBottomFace(var1, (double)var2, (double)var3, (double)var4, var1.getBlockTexture(this.blockAccess, var2, var3, var4, 0)); + var9 = true; + } + + if(this.renderAllFaces || var1.shouldSideBeRendered(this.blockAccess, var2, var3 + 1, var4, 1)) { + var27 = var1.getBlockBrightness(this.blockAccess, var2, var3 + 1, var4); + if(var1.maxY != 1.0D && !var1.blockMaterial.getIsLiquid()) { + var27 = var26; + } + + var8.setColorOpaque_F(var14 * var27, var15 * var27, var16 * var27); + this.renderTopFace(var1, (double)var2, (double)var3, (double)var4, var1.getBlockTexture(this.blockAccess, var2, var3, var4, 1)); + var9 = true; + } + + int var28; + if(this.renderAllFaces || var1.shouldSideBeRendered(this.blockAccess, var2, var3, var4 - 1, 2)) { + var27 = var1.getBlockBrightness(this.blockAccess, var2, var3, var4 - 1); + if(var1.minZ > 0.0D) { + var27 = var26; + } + + var8.setColorOpaque_F(var18 * var27, var21 * var27, var24 * var27); + var28 = var1.getBlockTexture(this.blockAccess, var2, var3, var4, 2); + this.renderEastFace(var1, (double)var2, (double)var3, (double)var4, var28); + if(fancyGrass && var28 == 3 && this.overrideBlockTexture < 0) { + var8.setColorOpaque_F(var18 * var27 * var5, var21 * var27 * var6, var24 * var27 * var7); + this.renderEastFace(var1, (double)var2, (double)var3, (double)var4, 38); + } + + var9 = true; + } + + if(this.renderAllFaces || var1.shouldSideBeRendered(this.blockAccess, var2, var3, var4 + 1, 3)) { + var27 = var1.getBlockBrightness(this.blockAccess, var2, var3, var4 + 1); + if(var1.maxZ < 1.0D) { + var27 = var26; + } + + var8.setColorOpaque_F(var18 * var27, var21 * var27, var24 * var27); + var28 = var1.getBlockTexture(this.blockAccess, var2, var3, var4, 3); + this.renderWestFace(var1, (double)var2, (double)var3, (double)var4, var28); + if(fancyGrass && var28 == 3 && this.overrideBlockTexture < 0) { + var8.setColorOpaque_F(var18 * var27 * var5, var21 * var27 * var6, var24 * var27 * var7); + this.renderWestFace(var1, (double)var2, (double)var3, (double)var4, 38); + } + + var9 = true; + } + + if(this.renderAllFaces || var1.shouldSideBeRendered(this.blockAccess, var2 - 1, var3, var4, 4)) { + var27 = var1.getBlockBrightness(this.blockAccess, var2 - 1, var3, var4); + if(var1.minX > 0.0D) { + var27 = var26; + } + + var8.setColorOpaque_F(var19 * var27, var22 * var27, var25 * var27); + var28 = var1.getBlockTexture(this.blockAccess, var2, var3, var4, 4); + this.renderNorthFace(var1, (double)var2, (double)var3, (double)var4, var28); + if(fancyGrass && var28 == 3 && this.overrideBlockTexture < 0) { + var8.setColorOpaque_F(var19 * var27 * var5, var22 * var27 * var6, var25 * var27 * var7); + this.renderNorthFace(var1, (double)var2, (double)var3, (double)var4, 38); + } + + var9 = true; + } + + if(this.renderAllFaces || var1.shouldSideBeRendered(this.blockAccess, var2 + 1, var3, var4, 5)) { + var27 = var1.getBlockBrightness(this.blockAccess, var2 + 1, var3, var4); + if(var1.maxX < 1.0D) { + var27 = var26; + } + + var8.setColorOpaque_F(var19 * var27, var22 * var27, var25 * var27); + var28 = var1.getBlockTexture(this.blockAccess, var2, var3, var4, 5); + this.renderSouthFace(var1, (double)var2, (double)var3, (double)var4, var28); + if(fancyGrass && var28 == 3 && this.overrideBlockTexture < 0) { + var8.setColorOpaque_F(var19 * var27 * var5, var22 * var27 * var6, var25 * var27 * var7); + this.renderSouthFace(var1, (double)var2, (double)var3, (double)var4, 38); + } + + var9 = true; + } + + return var9; + } + + public boolean renderBlockCactus(Block var1, int var2, int var3, int var4) { + int var5 = var1.colorMultiplier(this.blockAccess, var2, var3, var4); + float var6 = (float)(var5 >> 16 & 255) / 255.0F; + float var7 = (float)(var5 >> 8 & 255) / 255.0F; + float var8 = (float)(var5 & 255) / 255.0F; + if(EntityRenderer.field_28135_a) { + float var9 = (var6 * 30.0F + var7 * 59.0F + var8 * 11.0F) / 100.0F; + float var10 = (var6 * 30.0F + var7 * 70.0F) / 100.0F; + float var11 = (var6 * 30.0F + var8 * 70.0F) / 100.0F; + var6 = var9; + var7 = var10; + var8 = var11; + } + + return this.func_1230_b(var1, var2, var3, var4, var6, var7, var8); + } + + public boolean func_1230_b(Block var1, int var2, int var3, int var4, float var5, float var6, float var7) { + Tessellator var8 = Tessellator.instance; + boolean var9 = false; + float var10 = 0.5F; + float var11 = 1.0F; + float var12 = 0.8F; + float var13 = 0.6F; + float var14 = var10 * var5; + float var15 = var11 * var5; + float var16 = var12 * var5; + float var17 = var13 * var5; + float var18 = var10 * var6; + float var19 = var11 * var6; + float var20 = var12 * var6; + float var21 = var13 * var6; + float var22 = var10 * var7; + float var23 = var11 * var7; + float var24 = var12 * var7; + float var25 = var13 * var7; + float var26 = 1.0F / 16.0F; + float var27 = var1.getBlockBrightness(this.blockAccess, var2, var3, var4); + float var28; + if(this.renderAllFaces || var1.shouldSideBeRendered(this.blockAccess, var2, var3 - 1, var4, 0)) { + var28 = var1.getBlockBrightness(this.blockAccess, var2, var3 - 1, var4); + var8.setColorOpaque_F(var14 * var28, var18 * var28, var22 * var28); + this.renderBottomFace(var1, (double)var2, (double)var3, (double)var4, var1.getBlockTexture(this.blockAccess, var2, var3, var4, 0)); + var9 = true; + } + + if(this.renderAllFaces || var1.shouldSideBeRendered(this.blockAccess, var2, var3 + 1, var4, 1)) { + var28 = var1.getBlockBrightness(this.blockAccess, var2, var3 + 1, var4); + if(var1.maxY != 1.0D && !var1.blockMaterial.getIsLiquid()) { + var28 = var27; + } + + var8.setColorOpaque_F(var15 * var28, var19 * var28, var23 * var28); + this.renderTopFace(var1, (double)var2, (double)var3, (double)var4, var1.getBlockTexture(this.blockAccess, var2, var3, var4, 1)); + var9 = true; + } + + if(this.renderAllFaces || var1.shouldSideBeRendered(this.blockAccess, var2, var3, var4 - 1, 2)) { + var28 = var1.getBlockBrightness(this.blockAccess, var2, var3, var4 - 1); + if(var1.minZ > 0.0D) { + var28 = var27; + } + + var8.setColorOpaque_F(var16 * var28, var20 * var28, var24 * var28); + var8.setTranslationF(0.0F, 0.0F, var26); + this.renderEastFace(var1, (double)var2, (double)var3, (double)var4, var1.getBlockTexture(this.blockAccess, var2, var3, var4, 2)); + var8.setTranslationF(0.0F, 0.0F, -var26); + var9 = true; + } + + if(this.renderAllFaces || var1.shouldSideBeRendered(this.blockAccess, var2, var3, var4 + 1, 3)) { + var28 = var1.getBlockBrightness(this.blockAccess, var2, var3, var4 + 1); + if(var1.maxZ < 1.0D) { + var28 = var27; + } + + var8.setColorOpaque_F(var16 * var28, var20 * var28, var24 * var28); + var8.setTranslationF(0.0F, 0.0F, -var26); + this.renderWestFace(var1, (double)var2, (double)var3, (double)var4, var1.getBlockTexture(this.blockAccess, var2, var3, var4, 3)); + var8.setTranslationF(0.0F, 0.0F, var26); + var9 = true; + } + + if(this.renderAllFaces || var1.shouldSideBeRendered(this.blockAccess, var2 - 1, var3, var4, 4)) { + var28 = var1.getBlockBrightness(this.blockAccess, var2 - 1, var3, var4); + if(var1.minX > 0.0D) { + var28 = var27; + } + + var8.setColorOpaque_F(var17 * var28, var21 * var28, var25 * var28); + var8.setTranslationF(var26, 0.0F, 0.0F); + this.renderNorthFace(var1, (double)var2, (double)var3, (double)var4, var1.getBlockTexture(this.blockAccess, var2, var3, var4, 4)); + var8.setTranslationF(-var26, 0.0F, 0.0F); + var9 = true; + } + + if(this.renderAllFaces || var1.shouldSideBeRendered(this.blockAccess, var2 + 1, var3, var4, 5)) { + var28 = var1.getBlockBrightness(this.blockAccess, var2 + 1, var3, var4); + if(var1.maxX < 1.0D) { + var28 = var27; + } + + var8.setColorOpaque_F(var17 * var28, var21 * var28, var25 * var28); + var8.setTranslationF(-var26, 0.0F, 0.0F); + this.renderSouthFace(var1, (double)var2, (double)var3, (double)var4, var1.getBlockTexture(this.blockAccess, var2, var3, var4, 5)); + var8.setTranslationF(var26, 0.0F, 0.0F); + var9 = true; + } + + return var9; + } + + public boolean renderBlockFence(Block var1, int var2, int var3, int var4) { + boolean var5 = false; + float var6 = 6.0F / 16.0F; + float var7 = 10.0F / 16.0F; + var1.setBlockBounds(var6, 0.0F, var6, var7, 1.0F, var7); + this.renderStandardBlock(var1, var2, var3, var4); + var5 = true; + boolean var8 = false; + boolean var9 = false; + if(this.blockAccess.getBlockId(var2 - 1, var3, var4) == var1.blockID || this.blockAccess.getBlockId(var2 + 1, var3, var4) == var1.blockID) { + var8 = true; + } + + if(this.blockAccess.getBlockId(var2, var3, var4 - 1) == var1.blockID || this.blockAccess.getBlockId(var2, var3, var4 + 1) == var1.blockID) { + var9 = true; + } + + boolean var10 = this.blockAccess.getBlockId(var2 - 1, var3, var4) == var1.blockID; + boolean var11 = this.blockAccess.getBlockId(var2 + 1, var3, var4) == var1.blockID; + boolean var12 = this.blockAccess.getBlockId(var2, var3, var4 - 1) == var1.blockID; + boolean var13 = this.blockAccess.getBlockId(var2, var3, var4 + 1) == var1.blockID; + if(!var8 && !var9) { + var8 = true; + } + + var6 = 7.0F / 16.0F; + var7 = 9.0F / 16.0F; + float var14 = 12.0F / 16.0F; + float var15 = 15.0F / 16.0F; + float var16 = var10 ? 0.0F : var6; + float var17 = var11 ? 1.0F : var7; + float var18 = var12 ? 0.0F : var6; + float var19 = var13 ? 1.0F : var7; + if(var8) { + var1.setBlockBounds(var16, var14, var6, var17, var15, var7); + this.renderStandardBlock(var1, var2, var3, var4); + var5 = true; + } + + if(var9) { + var1.setBlockBounds(var6, var14, var18, var7, var15, var19); + this.renderStandardBlock(var1, var2, var3, var4); + var5 = true; + } + + var14 = 6.0F / 16.0F; + var15 = 9.0F / 16.0F; + if(var8) { + var1.setBlockBounds(var16, var14, var6, var17, var15, var7); + this.renderStandardBlock(var1, var2, var3, var4); + var5 = true; + } + + if(var9) { + var1.setBlockBounds(var6, var14, var18, var7, var15, var19); + this.renderStandardBlock(var1, var2, var3, var4); + var5 = true; + } + + var1.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + return var5; + } + + public boolean renderBlockStairs(Block var1, int var2, int var3, int var4) { + boolean var5 = false; + int var6 = this.blockAccess.getBlockMetadata(var2, var3, var4); + if(var6 == 0) { + var1.setBlockBounds(0.0F, 0.0F, 0.0F, 0.5F, 0.5F, 1.0F); + this.renderStandardBlock(var1, var2, var3, var4); + var1.setBlockBounds(0.5F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + this.renderStandardBlock(var1, var2, var3, var4); + var5 = true; + } else if(var6 == 1) { + var1.setBlockBounds(0.0F, 0.0F, 0.0F, 0.5F, 1.0F, 1.0F); + this.renderStandardBlock(var1, var2, var3, var4); + var1.setBlockBounds(0.5F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F); + this.renderStandardBlock(var1, var2, var3, var4); + var5 = true; + } else if(var6 == 2) { + var1.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 0.5F); + this.renderStandardBlock(var1, var2, var3, var4); + var1.setBlockBounds(0.0F, 0.0F, 0.5F, 1.0F, 1.0F, 1.0F); + this.renderStandardBlock(var1, var2, var3, var4); + var5 = true; + } else if(var6 == 3) { + var1.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 0.5F); + this.renderStandardBlock(var1, var2, var3, var4); + var1.setBlockBounds(0.0F, 0.0F, 0.5F, 1.0F, 0.5F, 1.0F); + this.renderStandardBlock(var1, var2, var3, var4); + var5 = true; + } + + var1.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + return var5; + } + + public boolean renderBlockDoor(Block var1, int var2, int var3, int var4) { + Tessellator var5 = Tessellator.instance; + BlockDoor var6 = (BlockDoor)var1; + boolean var7 = false; + float var8 = 0.5F; + float var9 = 1.0F; + float var10 = 0.8F; + float var11 = 0.6F; + float var12 = var1.getBlockBrightness(this.blockAccess, var2, var3, var4); + float var13 = var1.getBlockBrightness(this.blockAccess, var2, var3 - 1, var4); + if(var6.minY > 0.0D) { + var13 = var12; + } + + if(Block.lightValue[var1.blockID] > 0) { + var13 = 1.0F; + } + + var5.setColorOpaque_F(var8 * var13, var8 * var13, var8 * var13); + this.renderBottomFace(var1, (double)var2, (double)var3, (double)var4, var1.getBlockTexture(this.blockAccess, var2, var3, var4, 0)); + var7 = true; + var13 = var1.getBlockBrightness(this.blockAccess, var2, var3 + 1, var4); + if(var6.maxY < 1.0D) { + var13 = var12; + } + + if(Block.lightValue[var1.blockID] > 0) { + var13 = 1.0F; + } + + var5.setColorOpaque_F(var9 * var13, var9 * var13, var9 * var13); + this.renderTopFace(var1, (double)var2, (double)var3, (double)var4, var1.getBlockTexture(this.blockAccess, var2, var3, var4, 1)); + var7 = true; + var13 = var1.getBlockBrightness(this.blockAccess, var2, var3, var4 - 1); + if(var6.minZ > 0.0D) { + var13 = var12; + } + + if(Block.lightValue[var1.blockID] > 0) { + var13 = 1.0F; + } + + var5.setColorOpaque_F(var10 * var13, var10 * var13, var10 * var13); + int var14 = var1.getBlockTexture(this.blockAccess, var2, var3, var4, 2); + if(var14 < 0) { + this.flipTexture = true; + var14 = -var14; + } + + this.renderEastFace(var1, (double)var2, (double)var3, (double)var4, var14); + var7 = true; + this.flipTexture = false; + var13 = var1.getBlockBrightness(this.blockAccess, var2, var3, var4 + 1); + if(var6.maxZ < 1.0D) { + var13 = var12; + } + + if(Block.lightValue[var1.blockID] > 0) { + var13 = 1.0F; + } + + var5.setColorOpaque_F(var10 * var13, var10 * var13, var10 * var13); + var14 = var1.getBlockTexture(this.blockAccess, var2, var3, var4, 3); + if(var14 < 0) { + this.flipTexture = true; + var14 = -var14; + } + + this.renderWestFace(var1, (double)var2, (double)var3, (double)var4, var14); + var7 = true; + this.flipTexture = false; + var13 = var1.getBlockBrightness(this.blockAccess, var2 - 1, var3, var4); + if(var6.minX > 0.0D) { + var13 = var12; + } + + if(Block.lightValue[var1.blockID] > 0) { + var13 = 1.0F; + } + + var5.setColorOpaque_F(var11 * var13, var11 * var13, var11 * var13); + var14 = var1.getBlockTexture(this.blockAccess, var2, var3, var4, 4); + if(var14 < 0) { + this.flipTexture = true; + var14 = -var14; + } + + this.renderNorthFace(var1, (double)var2, (double)var3, (double)var4, var14); + var7 = true; + this.flipTexture = false; + var13 = var1.getBlockBrightness(this.blockAccess, var2 + 1, var3, var4); + if(var6.maxX < 1.0D) { + var13 = var12; + } + + if(Block.lightValue[var1.blockID] > 0) { + var13 = 1.0F; + } + + var5.setColorOpaque_F(var11 * var13, var11 * var13, var11 * var13); + var14 = var1.getBlockTexture(this.blockAccess, var2, var3, var4, 5); + if(var14 < 0) { + this.flipTexture = true; + var14 = -var14; + } + + this.renderSouthFace(var1, (double)var2, (double)var3, (double)var4, var14); + var7 = true; + this.flipTexture = false; + return var7; + } + + public void renderBottomFace(Block var1, double var2, double var4, double var6, int var8) { + Tessellator var9 = Tessellator.instance; + if(this.overrideBlockTexture >= 0) { + var8 = this.overrideBlockTexture; + } + + int var10 = (var8 & 15) << 4; + int var11 = var8 & 240; + double var12 = ((double)var10 + var1.minX * 16.0D) / 256.0D; + double var14 = ((double)var10 + var1.maxX * 16.0D - 0.01D) / 256.0D; + double var16 = ((double)var11 + var1.minZ * 16.0D) / 256.0D; + double var18 = ((double)var11 + var1.maxZ * 16.0D - 0.01D) / 256.0D; + if(var1.minX < 0.0D || var1.maxX > 1.0D) { + var12 = (double)(((float)var10 + 0.0F) / 256.0F); + var14 = (double)(((float)var10 + 15.99F) / 256.0F); + } + + if(var1.minZ < 0.0D || var1.maxZ > 1.0D) { + var16 = (double)(((float)var11 + 0.0F) / 256.0F); + var18 = (double)(((float)var11 + 15.99F) / 256.0F); + } + + double var20 = var14; + double var22 = var12; + double var24 = var16; + double var26 = var18; + if(this.field_31082_l == 2) { + var12 = ((double)var10 + var1.minZ * 16.0D) / 256.0D; + var16 = ((double)(var11 + 16) - var1.maxX * 16.0D) / 256.0D; + var14 = ((double)var10 + var1.maxZ * 16.0D) / 256.0D; + var18 = ((double)(var11 + 16) - var1.minX * 16.0D) / 256.0D; + var24 = var16; + var26 = var18; + var20 = var12; + var22 = var14; + var16 = var18; + var18 = var24; + } else if(this.field_31082_l == 1) { + var12 = ((double)(var10 + 16) - var1.maxZ * 16.0D) / 256.0D; + var16 = ((double)var11 + var1.minX * 16.0D) / 256.0D; + var14 = ((double)(var10 + 16) - var1.minZ * 16.0D) / 256.0D; + var18 = ((double)var11 + var1.maxX * 16.0D) / 256.0D; + var20 = var14; + var22 = var12; + var12 = var14; + var14 = var22; + var24 = var18; + var26 = var16; + } else if(this.field_31082_l == 3) { + var12 = ((double)(var10 + 16) - var1.minX * 16.0D) / 256.0D; + var14 = ((double)(var10 + 16) - var1.maxX * 16.0D - 0.01D) / 256.0D; + var16 = ((double)(var11 + 16) - var1.minZ * 16.0D) / 256.0D; + var18 = ((double)(var11 + 16) - var1.maxZ * 16.0D - 0.01D) / 256.0D; + var20 = var14; + var22 = var12; + var24 = var16; + var26 = var18; + } + + double var28 = var2 + var1.minX; + double var30 = var2 + var1.maxX; + double var32 = var4 + var1.minY; + double var34 = var6 + var1.minZ; + double var36 = var6 + var1.maxZ; + if(this.enableAO) { + var9.setColorOpaque_F(this.colorRedTopLeft, this.colorGreenTopLeft, this.colorBlueTopLeft); + var9.addVertexWithUV(var28, var32, var36, var22, var26); + var9.setColorOpaque_F(this.colorRedBottomLeft, this.colorGreenBottomLeft, this.colorBlueBottomLeft); + var9.addVertexWithUV(var28, var32, var34, var12, var16); + var9.setColorOpaque_F(this.colorRedBottomRight, this.colorGreenBottomRight, this.colorBlueBottomRight); + var9.addVertexWithUV(var30, var32, var34, var20, var24); + var9.setColorOpaque_F(this.colorRedTopRight, this.colorGreenTopRight, this.colorBlueTopRight); + var9.addVertexWithUV(var30, var32, var36, var14, var18); + } else { + var9.addVertexWithUV(var28, var32, var36, var22, var26); + var9.addVertexWithUV(var28, var32, var34, var12, var16); + var9.addVertexWithUV(var30, var32, var34, var20, var24); + var9.addVertexWithUV(var30, var32, var36, var14, var18); + } + + } + + public void renderTopFace(Block var1, double var2, double var4, double var6, int var8) { + Tessellator var9 = Tessellator.instance; + if(this.overrideBlockTexture >= 0) { + var8 = this.overrideBlockTexture; + } + + int var10 = (var8 & 15) << 4; + int var11 = var8 & 240; + double var12 = ((double)var10 + var1.minX * 16.0D) / 256.0D; + double var14 = ((double)var10 + var1.maxX * 16.0D - 0.01D) / 256.0D; + double var16 = ((double)var11 + var1.minZ * 16.0D) / 256.0D; + double var18 = ((double)var11 + var1.maxZ * 16.0D - 0.01D) / 256.0D; + if(var1.minX < 0.0D || var1.maxX > 1.0D) { + var12 = (double)(((float)var10 + 0.0F) / 256.0F); + var14 = (double)(((float)var10 + 15.99F) / 256.0F); + } + + if(var1.minZ < 0.0D || var1.maxZ > 1.0D) { + var16 = (double)(((float)var11 + 0.0F) / 256.0F); + var18 = (double)(((float)var11 + 15.99F) / 256.0F); + } + + double var20 = var14; + double var22 = var12; + double var24 = var16; + double var26 = var18; + if(this.field_31083_k == 1) { + var12 = ((double)var10 + var1.minZ * 16.0D) / 256.0D; + var16 = ((double)(var11 + 16) - var1.maxX * 16.0D) / 256.0D; + var14 = ((double)var10 + var1.maxZ * 16.0D) / 256.0D; + var18 = ((double)(var11 + 16) - var1.minX * 16.0D) / 256.0D; + var24 = var16; + var26 = var18; + var20 = var12; + var22 = var14; + var16 = var18; + var18 = var24; + } else if(this.field_31083_k == 2) { + var12 = ((double)(var10 + 16) - var1.maxZ * 16.0D) / 256.0D; + var16 = ((double)var11 + var1.minX * 16.0D) / 256.0D; + var14 = ((double)(var10 + 16) - var1.minZ * 16.0D) / 256.0D; + var18 = ((double)var11 + var1.maxX * 16.0D) / 256.0D; + var20 = var14; + var22 = var12; + var12 = var14; + var14 = var22; + var24 = var18; + var26 = var16; + } else if(this.field_31083_k == 3) { + var12 = ((double)(var10 + 16) - var1.minX * 16.0D) / 256.0D; + var14 = ((double)(var10 + 16) - var1.maxX * 16.0D - 0.01D) / 256.0D; + var16 = ((double)(var11 + 16) - var1.minZ * 16.0D) / 256.0D; + var18 = ((double)(var11 + 16) - var1.maxZ * 16.0D - 0.01D) / 256.0D; + var20 = var14; + var22 = var12; + var24 = var16; + var26 = var18; + } + + double var28 = var2 + var1.minX; + double var30 = var2 + var1.maxX; + double var32 = var4 + var1.maxY; + double var34 = var6 + var1.minZ; + double var36 = var6 + var1.maxZ; + if(this.enableAO) { + var9.setColorOpaque_F(this.colorRedTopLeft, this.colorGreenTopLeft, this.colorBlueTopLeft); + var9.addVertexWithUV(var30, var32, var36, var14, var18); + var9.setColorOpaque_F(this.colorRedBottomLeft, this.colorGreenBottomLeft, this.colorBlueBottomLeft); + var9.addVertexWithUV(var30, var32, var34, var20, var24); + var9.setColorOpaque_F(this.colorRedBottomRight, this.colorGreenBottomRight, this.colorBlueBottomRight); + var9.addVertexWithUV(var28, var32, var34, var12, var16); + var9.setColorOpaque_F(this.colorRedTopRight, this.colorGreenTopRight, this.colorBlueTopRight); + var9.addVertexWithUV(var28, var32, var36, var22, var26); + } else { + var9.addVertexWithUV(var30, var32, var36, var14, var18); + var9.addVertexWithUV(var30, var32, var34, var20, var24); + var9.addVertexWithUV(var28, var32, var34, var12, var16); + var9.addVertexWithUV(var28, var32, var36, var22, var26); + } + + } + + public void renderEastFace(Block var1, double var2, double var4, double var6, int var8) { + Tessellator var9 = Tessellator.instance; + if(this.overrideBlockTexture >= 0) { + var8 = this.overrideBlockTexture; + } + + int var10 = (var8 & 15) << 4; + int var11 = var8 & 240; + double var12 = ((double)var10 + var1.minX * 16.0D) / 256.0D; + double var14 = ((double)var10 + var1.maxX * 16.0D - 0.01D) / 256.0D; + double var16 = ((double)(var11 + 16) - var1.maxY * 16.0D) / 256.0D; + double var18 = ((double)(var11 + 16) - var1.minY * 16.0D - 0.01D) / 256.0D; + double var20; + if(this.flipTexture) { + var20 = var12; + var12 = var14; + var14 = var20; + } + + if(var1.minX < 0.0D || var1.maxX > 1.0D) { + var12 = (double)(((float)var10 + 0.0F) / 256.0F); + var14 = (double)(((float)var10 + 15.99F) / 256.0F); + } + + if(var1.minY < 0.0D || var1.maxY > 1.0D) { + var16 = (double)(((float)var11 + 0.0F) / 256.0F); + var18 = (double)(((float)var11 + 15.99F) / 256.0F); + } + + var20 = var14; + double var22 = var12; + double var24 = var16; + double var26 = var18; + if(this.field_31087_g == 2) { + var12 = ((double)var10 + var1.minY * 16.0D) / 256.0D; + var16 = ((double)(var11 + 16) - var1.minX * 16.0D) / 256.0D; + var14 = ((double)var10 + var1.maxY * 16.0D) / 256.0D; + var18 = ((double)(var11 + 16) - var1.maxX * 16.0D) / 256.0D; + var24 = var16; + var26 = var18; + var20 = var12; + var22 = var14; + var16 = var18; + var18 = var24; + } else if(this.field_31087_g == 1) { + var12 = ((double)(var10 + 16) - var1.maxY * 16.0D) / 256.0D; + var16 = ((double)var11 + var1.maxX * 16.0D) / 256.0D; + var14 = ((double)(var10 + 16) - var1.minY * 16.0D) / 256.0D; + var18 = ((double)var11 + var1.minX * 16.0D) / 256.0D; + var20 = var14; + var22 = var12; + var12 = var14; + var14 = var22; + var24 = var18; + var26 = var16; + } else if(this.field_31087_g == 3) { + var12 = ((double)(var10 + 16) - var1.minX * 16.0D) / 256.0D; + var14 = ((double)(var10 + 16) - var1.maxX * 16.0D - 0.01D) / 256.0D; + var16 = ((double)var11 + var1.maxY * 16.0D) / 256.0D; + var18 = ((double)var11 + var1.minY * 16.0D - 0.01D) / 256.0D; + var20 = var14; + var22 = var12; + var24 = var16; + var26 = var18; + } + + double var28 = var2 + var1.minX; + double var30 = var2 + var1.maxX; + double var32 = var4 + var1.minY; + double var34 = var4 + var1.maxY; + double var36 = var6 + var1.minZ; + if(this.enableAO) { + var9.setColorOpaque_F(this.colorRedTopLeft, this.colorGreenTopLeft, this.colorBlueTopLeft); + var9.addVertexWithUV(var28, var34, var36, var20, var24); + var9.setColorOpaque_F(this.colorRedBottomLeft, this.colorGreenBottomLeft, this.colorBlueBottomLeft); + var9.addVertexWithUV(var30, var34, var36, var12, var16); + var9.setColorOpaque_F(this.colorRedBottomRight, this.colorGreenBottomRight, this.colorBlueBottomRight); + var9.addVertexWithUV(var30, var32, var36, var22, var26); + var9.setColorOpaque_F(this.colorRedTopRight, this.colorGreenTopRight, this.colorBlueTopRight); + var9.addVertexWithUV(var28, var32, var36, var14, var18); + } else { + var9.addVertexWithUV(var28, var34, var36, var20, var24); + var9.addVertexWithUV(var30, var34, var36, var12, var16); + var9.addVertexWithUV(var30, var32, var36, var22, var26); + var9.addVertexWithUV(var28, var32, var36, var14, var18); + } + + } + + public void renderWestFace(Block var1, double var2, double var4, double var6, int var8) { + Tessellator var9 = Tessellator.instance; + if(this.overrideBlockTexture >= 0) { + var8 = this.overrideBlockTexture; + } + + int var10 = (var8 & 15) << 4; + int var11 = var8 & 240; + double var12 = ((double)var10 + var1.minX * 16.0D) / 256.0D; + double var14 = ((double)var10 + var1.maxX * 16.0D - 0.01D) / 256.0D; + double var16 = ((double)(var11 + 16) - var1.maxY * 16.0D) / 256.0D; + double var18 = ((double)(var11 + 16) - var1.minY * 16.0D - 0.01D) / 256.0D; + double var20; + if(this.flipTexture) { + var20 = var12; + var12 = var14; + var14 = var20; + } + + if(var1.minX < 0.0D || var1.maxX > 1.0D) { + var12 = (double)(((float)var10 + 0.0F) / 256.0F); + var14 = (double)(((float)var10 + 15.99F) / 256.0F); + } + + if(var1.minY < 0.0D || var1.maxY > 1.0D) { + var16 = (double)(((float)var11 + 0.0F) / 256.0F); + var18 = (double)(((float)var11 + 15.99F) / 256.0F); + } + + var20 = var14; + double var22 = var12; + double var24 = var16; + double var26 = var18; + if(this.field_31086_h == 1) { + var12 = ((double)var10 + var1.minY * 16.0D) / 256.0D; + var18 = ((double)(var11 + 16) - var1.minX * 16.0D) / 256.0D; + var14 = ((double)var10 + var1.maxY * 16.0D) / 256.0D; + var16 = ((double)(var11 + 16) - var1.maxX * 16.0D) / 256.0D; + var24 = var16; + var26 = var18; + var20 = var12; + var22 = var14; + var16 = var18; + var18 = var24; + } else if(this.field_31086_h == 2) { + var12 = ((double)(var10 + 16) - var1.maxY * 16.0D) / 256.0D; + var16 = ((double)var11 + var1.minX * 16.0D) / 256.0D; + var14 = ((double)(var10 + 16) - var1.minY * 16.0D) / 256.0D; + var18 = ((double)var11 + var1.maxX * 16.0D) / 256.0D; + var20 = var14; + var22 = var12; + var12 = var14; + var14 = var22; + var24 = var18; + var26 = var16; + } else if(this.field_31086_h == 3) { + var12 = ((double)(var10 + 16) - var1.minX * 16.0D) / 256.0D; + var14 = ((double)(var10 + 16) - var1.maxX * 16.0D - 0.01D) / 256.0D; + var16 = ((double)var11 + var1.maxY * 16.0D) / 256.0D; + var18 = ((double)var11 + var1.minY * 16.0D - 0.01D) / 256.0D; + var20 = var14; + var22 = var12; + var24 = var16; + var26 = var18; + } + + double var28 = var2 + var1.minX; + double var30 = var2 + var1.maxX; + double var32 = var4 + var1.minY; + double var34 = var4 + var1.maxY; + double var36 = var6 + var1.maxZ; + if(this.enableAO) { + var9.setColorOpaque_F(this.colorRedTopLeft, this.colorGreenTopLeft, this.colorBlueTopLeft); + var9.addVertexWithUV(var28, var34, var36, var12, var16); + var9.setColorOpaque_F(this.colorRedBottomLeft, this.colorGreenBottomLeft, this.colorBlueBottomLeft); + var9.addVertexWithUV(var28, var32, var36, var22, var26); + var9.setColorOpaque_F(this.colorRedBottomRight, this.colorGreenBottomRight, this.colorBlueBottomRight); + var9.addVertexWithUV(var30, var32, var36, var14, var18); + var9.setColorOpaque_F(this.colorRedTopRight, this.colorGreenTopRight, this.colorBlueTopRight); + var9.addVertexWithUV(var30, var34, var36, var20, var24); + } else { + var9.addVertexWithUV(var28, var34, var36, var12, var16); + var9.addVertexWithUV(var28, var32, var36, var22, var26); + var9.addVertexWithUV(var30, var32, var36, var14, var18); + var9.addVertexWithUV(var30, var34, var36, var20, var24); + } + + } + + public void renderNorthFace(Block var1, double var2, double var4, double var6, int var8) { + Tessellator var9 = Tessellator.instance; + if(this.overrideBlockTexture >= 0) { + var8 = this.overrideBlockTexture; + } + + int var10 = (var8 & 15) << 4; + int var11 = var8 & 240; + double var12 = ((double)var10 + var1.minZ * 16.0D) / 256.0D; + double var14 = ((double)var10 + var1.maxZ * 16.0D - 0.01D) / 256.0D; + double var16 = ((double)(var11 + 16) - var1.maxY * 16.0D) / 256.0D; + double var18 = ((double)(var11 + 16) - var1.minY * 16.0D - 0.01D) / 256.0D; + double var20; + if(this.flipTexture) { + var20 = var12; + var12 = var14; + var14 = var20; + } + + if(var1.minZ < 0.0D || var1.maxZ > 1.0D) { + var12 = (double)(((float)var10 + 0.0F) / 256.0F); + var14 = (double)(((float)var10 + 15.99F) / 256.0F); + } + + if(var1.minY < 0.0D || var1.maxY > 1.0D) { + var16 = (double)(((float)var11 + 0.0F) / 256.0F); + var18 = (double)(((float)var11 + 15.99F) / 256.0F); + } + + var20 = var14; + double var22 = var12; + double var24 = var16; + double var26 = var18; + if(this.field_31084_j == 1) { + var12 = ((double)var10 + var1.minY * 16.0D) / 256.0D; + var16 = ((double)(var11 + 16) - var1.maxZ * 16.0D) / 256.0D; + var14 = ((double)var10 + var1.maxY * 16.0D) / 256.0D; + var18 = ((double)(var11 + 16) - var1.minZ * 16.0D) / 256.0D; + var24 = var16; + var26 = var18; + var20 = var12; + var22 = var14; + var16 = var18; + var18 = var24; + } else if(this.field_31084_j == 2) { + var12 = ((double)(var10 + 16) - var1.maxY * 16.0D) / 256.0D; + var16 = ((double)var11 + var1.minZ * 16.0D) / 256.0D; + var14 = ((double)(var10 + 16) - var1.minY * 16.0D) / 256.0D; + var18 = ((double)var11 + var1.maxZ * 16.0D) / 256.0D; + var20 = var14; + var22 = var12; + var12 = var14; + var14 = var22; + var24 = var18; + var26 = var16; + } else if(this.field_31084_j == 3) { + var12 = ((double)(var10 + 16) - var1.minZ * 16.0D) / 256.0D; + var14 = ((double)(var10 + 16) - var1.maxZ * 16.0D - 0.01D) / 256.0D; + var16 = ((double)var11 + var1.maxY * 16.0D) / 256.0D; + var18 = ((double)var11 + var1.minY * 16.0D - 0.01D) / 256.0D; + var20 = var14; + var22 = var12; + var24 = var16; + var26 = var18; + } + + double var28 = var2 + var1.minX; + double var30 = var4 + var1.minY; + double var32 = var4 + var1.maxY; + double var34 = var6 + var1.minZ; + double var36 = var6 + var1.maxZ; + if(this.enableAO) { + var9.setColorOpaque_F(this.colorRedTopLeft, this.colorGreenTopLeft, this.colorBlueTopLeft); + var9.addVertexWithUV(var28, var32, var36, var20, var24); + var9.setColorOpaque_F(this.colorRedBottomLeft, this.colorGreenBottomLeft, this.colorBlueBottomLeft); + var9.addVertexWithUV(var28, var32, var34, var12, var16); + var9.setColorOpaque_F(this.colorRedBottomRight, this.colorGreenBottomRight, this.colorBlueBottomRight); + var9.addVertexWithUV(var28, var30, var34, var22, var26); + var9.setColorOpaque_F(this.colorRedTopRight, this.colorGreenTopRight, this.colorBlueTopRight); + var9.addVertexWithUV(var28, var30, var36, var14, var18); + } else { + var9.addVertexWithUV(var28, var32, var36, var20, var24); + var9.addVertexWithUV(var28, var32, var34, var12, var16); + var9.addVertexWithUV(var28, var30, var34, var22, var26); + var9.addVertexWithUV(var28, var30, var36, var14, var18); + } + + } + + public void renderSouthFace(Block var1, double var2, double var4, double var6, int var8) { + Tessellator var9 = Tessellator.instance; + if(this.overrideBlockTexture >= 0) { + var8 = this.overrideBlockTexture; + } + + int var10 = (var8 & 15) << 4; + int var11 = var8 & 240; + double var12 = ((double)var10 + var1.minZ * 16.0D) / 256.0D; + double var14 = ((double)var10 + var1.maxZ * 16.0D - 0.01D) / 256.0D; + double var16 = ((double)(var11 + 16) - var1.maxY * 16.0D) / 256.0D; + double var18 = ((double)(var11 + 16) - var1.minY * 16.0D - 0.01D) / 256.0D; + double var20; + if(this.flipTexture) { + var20 = var12; + var12 = var14; + var14 = var20; + } + + if(var1.minZ < 0.0D || var1.maxZ > 1.0D) { + var12 = (double)(((float)var10 + 0.0F) / 256.0F); + var14 = (double)(((float)var10 + 15.99F) / 256.0F); + } + + if(var1.minY < 0.0D || var1.maxY > 1.0D) { + var16 = (double)(((float)var11 + 0.0F) / 256.0F); + var18 = (double)(((float)var11 + 15.99F) / 256.0F); + } + + var20 = var14; + double var22 = var12; + double var24 = var16; + double var26 = var18; + if(this.field_31085_i == 2) { + var12 = ((double)var10 + var1.minY * 16.0D) / 256.0D; + var16 = ((double)(var11 + 16) - var1.minZ * 16.0D) / 256.0D; + var14 = ((double)var10 + var1.maxY * 16.0D) / 256.0D; + var18 = ((double)(var11 + 16) - var1.maxZ * 16.0D) / 256.0D; + var24 = var16; + var26 = var18; + var20 = var12; + var22 = var14; + var16 = var18; + var18 = var24; + } else if(this.field_31085_i == 1) { + var12 = ((double)(var10 + 16) - var1.maxY * 16.0D) / 256.0D; + var16 = ((double)var11 + var1.maxZ * 16.0D) / 256.0D; + var14 = ((double)(var10 + 16) - var1.minY * 16.0D) / 256.0D; + var18 = ((double)var11 + var1.minZ * 16.0D) / 256.0D; + var20 = var14; + var22 = var12; + var12 = var14; + var14 = var22; + var24 = var18; + var26 = var16; + } else if(this.field_31085_i == 3) { + var12 = ((double)(var10 + 16) - var1.minZ * 16.0D) / 256.0D; + var14 = ((double)(var10 + 16) - var1.maxZ * 16.0D - 0.01D) / 256.0D; + var16 = ((double)var11 + var1.maxY * 16.0D) / 256.0D; + var18 = ((double)var11 + var1.minY * 16.0D - 0.01D) / 256.0D; + var20 = var14; + var22 = var12; + var24 = var16; + var26 = var18; + } + + double var28 = var2 + var1.maxX; + double var30 = var4 + var1.minY; + double var32 = var4 + var1.maxY; + double var34 = var6 + var1.minZ; + double var36 = var6 + var1.maxZ; + if(this.enableAO) { + var9.setColorOpaque_F(this.colorRedTopLeft, this.colorGreenTopLeft, this.colorBlueTopLeft); + var9.addVertexWithUV(var28, var30, var36, var22, var26); + var9.setColorOpaque_F(this.colorRedBottomLeft, this.colorGreenBottomLeft, this.colorBlueBottomLeft); + var9.addVertexWithUV(var28, var30, var34, var14, var18); + var9.setColorOpaque_F(this.colorRedBottomRight, this.colorGreenBottomRight, this.colorBlueBottomRight); + var9.addVertexWithUV(var28, var32, var34, var20, var24); + var9.setColorOpaque_F(this.colorRedTopRight, this.colorGreenTopRight, this.colorBlueTopRight); + var9.addVertexWithUV(var28, var32, var36, var12, var16); + } else { + var9.addVertexWithUV(var28, var30, var36, var22, var26); + var9.addVertexWithUV(var28, var30, var34, var14, var18); + var9.addVertexWithUV(var28, var32, var34, var20, var24); + var9.addVertexWithUV(var28, var32, var36, var12, var16); + } + + } + + public void renderBlockOnInventory(Block var1, int var2, float var3) { + Tessellator var4 = Tessellator.instance; + int var5; + float var6; + float var7; + if(this.field_31088_b) { + var5 = var1.getRenderColor(var2); + var6 = (float)(var5 >> 16 & 255) / 255.0F; + var7 = (float)(var5 >> 8 & 255) / 255.0F; + float var8 = (float)(var5 & 255) / 255.0F; + GL11.glColor4f(var6 * var3, var7 * var3, var8 * var3, 1.0F); + } + + var5 = var1.getRenderType(); + if(var5 != 0 && var5 != 16) { + if(var5 == 1) { + var4.startDrawingQuads(); + var4.setNormal(0.0F, -1.0F, 0.0F); + this.renderCrossedSquares(var1, var2, -0.5D, -0.5D, -0.5D); + var4.draw(); + } else if(var5 == 13) { + var1.setBlockBoundsForItemRender(); + GL11.glTranslatef(-0.5F, -0.5F, -0.5F); + var6 = 1.0F / 16.0F; + var4.startDrawingQuads(); + var4.setNormal(0.0F, -1.0F, 0.0F); + this.renderBottomFace(var1, 0.0D, 0.0D, 0.0D, var1.getBlockTextureFromSide(0)); + var4.draw(); + var4.startDrawingQuads(); + var4.setNormal(0.0F, 1.0F, 0.0F); + this.renderTopFace(var1, 0.0D, 0.0D, 0.0D, var1.getBlockTextureFromSide(1)); + var4.draw(); + var4.startDrawingQuads(); + var4.setNormal(0.0F, 0.0F, -1.0F); + var4.setTranslationF(0.0F, 0.0F, var6); + this.renderEastFace(var1, 0.0D, 0.0D, 0.0D, var1.getBlockTextureFromSide(2)); + var4.setTranslationF(0.0F, 0.0F, -var6); + var4.draw(); + var4.startDrawingQuads(); + var4.setNormal(0.0F, 0.0F, 1.0F); + var4.setTranslationF(0.0F, 0.0F, -var6); + this.renderWestFace(var1, 0.0D, 0.0D, 0.0D, var1.getBlockTextureFromSide(3)); + var4.setTranslationF(0.0F, 0.0F, var6); + var4.draw(); + var4.startDrawingQuads(); + var4.setNormal(-1.0F, 0.0F, 0.0F); + var4.setTranslationF(var6, 0.0F, 0.0F); + this.renderNorthFace(var1, 0.0D, 0.0D, 0.0D, var1.getBlockTextureFromSide(4)); + var4.setTranslationF(-var6, 0.0F, 0.0F); + var4.draw(); + var4.startDrawingQuads(); + var4.setNormal(1.0F, 0.0F, 0.0F); + var4.setTranslationF(-var6, 0.0F, 0.0F); + this.renderSouthFace(var1, 0.0D, 0.0D, 0.0D, var1.getBlockTextureFromSide(5)); + var4.setTranslationF(var6, 0.0F, 0.0F); + var4.draw(); + GL11.glTranslatef(0.5F, 0.5F, 0.5F); + } else if(var5 == 6) { + var4.startDrawingQuads(); + var4.setNormal(0.0F, -1.0F, 0.0F); + this.func_1245_b(var1, var2, -0.5D, -0.5D, -0.5D); + var4.draw(); + } else if(var5 == 2) { + var4.startDrawingQuads(); + var4.setNormal(0.0F, -1.0F, 0.0F); + this.renderTorchAtAngle(var1, -0.5D, -0.5D, -0.5D, 0.0D, 0.0D); + var4.draw(); + } else { + int var9; + if(var5 == 10) { + for(var9 = 0; var9 < 2; ++var9) { + if(var9 == 0) { + var1.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 0.5F); + } + + if(var9 == 1) { + var1.setBlockBounds(0.0F, 0.0F, 0.5F, 1.0F, 0.5F, 1.0F); + } + + GL11.glTranslatef(-0.5F, -0.5F, -0.5F); + var4.startDrawingQuads(); + var4.setNormal(0.0F, -1.0F, 0.0F); + this.renderBottomFace(var1, 0.0D, 0.0D, 0.0D, var1.getBlockTextureFromSide(0)); + var4.draw(); + var4.startDrawingQuads(); + var4.setNormal(0.0F, 1.0F, 0.0F); + this.renderTopFace(var1, 0.0D, 0.0D, 0.0D, var1.getBlockTextureFromSide(1)); + var4.draw(); + var4.startDrawingQuads(); + var4.setNormal(0.0F, 0.0F, -1.0F); + this.renderEastFace(var1, 0.0D, 0.0D, 0.0D, var1.getBlockTextureFromSide(2)); + var4.draw(); + var4.startDrawingQuads(); + var4.setNormal(0.0F, 0.0F, 1.0F); + this.renderWestFace(var1, 0.0D, 0.0D, 0.0D, var1.getBlockTextureFromSide(3)); + var4.draw(); + var4.startDrawingQuads(); + var4.setNormal(-1.0F, 0.0F, 0.0F); + this.renderNorthFace(var1, 0.0D, 0.0D, 0.0D, var1.getBlockTextureFromSide(4)); + var4.draw(); + var4.startDrawingQuads(); + var4.setNormal(1.0F, 0.0F, 0.0F); + this.renderSouthFace(var1, 0.0D, 0.0D, 0.0D, var1.getBlockTextureFromSide(5)); + var4.draw(); + GL11.glTranslatef(0.5F, 0.5F, 0.5F); + } + } else if(var5 == 11) { + for(var9 = 0; var9 < 4; ++var9) { + var7 = 2.0F / 16.0F; + if(var9 == 0) { + var1.setBlockBounds(0.5F - var7, 0.0F, 0.0F, 0.5F + var7, 1.0F, var7 * 2.0F); + } + + if(var9 == 1) { + var1.setBlockBounds(0.5F - var7, 0.0F, 1.0F - var7 * 2.0F, 0.5F + var7, 1.0F, 1.0F); + } + + var7 = 1.0F / 16.0F; + if(var9 == 2) { + var1.setBlockBounds(0.5F - var7, 1.0F - var7 * 3.0F, -var7 * 2.0F, 0.5F + var7, 1.0F - var7, 1.0F + var7 * 2.0F); + } + + if(var9 == 3) { + var1.setBlockBounds(0.5F - var7, 0.5F - var7 * 3.0F, -var7 * 2.0F, 0.5F + var7, 0.5F - var7, 1.0F + var7 * 2.0F); + } + + GL11.glTranslatef(-0.5F, -0.5F, -0.5F); + var4.startDrawingQuads(); + var4.setNormal(0.0F, -1.0F, 0.0F); + this.renderBottomFace(var1, 0.0D, 0.0D, 0.0D, var1.getBlockTextureFromSide(0)); + var4.draw(); + var4.startDrawingQuads(); + var4.setNormal(0.0F, 1.0F, 0.0F); + this.renderTopFace(var1, 0.0D, 0.0D, 0.0D, var1.getBlockTextureFromSide(1)); + var4.draw(); + var4.startDrawingQuads(); + var4.setNormal(0.0F, 0.0F, -1.0F); + this.renderEastFace(var1, 0.0D, 0.0D, 0.0D, var1.getBlockTextureFromSide(2)); + var4.draw(); + var4.startDrawingQuads(); + var4.setNormal(0.0F, 0.0F, 1.0F); + this.renderWestFace(var1, 0.0D, 0.0D, 0.0D, var1.getBlockTextureFromSide(3)); + var4.draw(); + var4.startDrawingQuads(); + var4.setNormal(-1.0F, 0.0F, 0.0F); + this.renderNorthFace(var1, 0.0D, 0.0D, 0.0D, var1.getBlockTextureFromSide(4)); + var4.draw(); + var4.startDrawingQuads(); + var4.setNormal(1.0F, 0.0F, 0.0F); + this.renderSouthFace(var1, 0.0D, 0.0D, 0.0D, var1.getBlockTextureFromSide(5)); + var4.draw(); + GL11.glTranslatef(0.5F, 0.5F, 0.5F); + } + + var1.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + } + } + } else { + if(var5 == 16) { + var2 = 1; + } + + var1.setBlockBoundsForItemRender(); + GL11.glTranslatef(-0.5F, -0.5F, -0.5F); + var4.startDrawingQuads(); + var4.setNormal(0.0F, -1.0F, 0.0F); + this.renderBottomFace(var1, 0.0D, 0.0D, 0.0D, var1.getBlockTextureFromSideAndMetadata(0, var2)); + var4.draw(); + var4.startDrawingQuads(); + var4.setNormal(0.0F, 1.0F, 0.0F); + this.renderTopFace(var1, 0.0D, 0.0D, 0.0D, var1.getBlockTextureFromSideAndMetadata(1, var2)); + var4.draw(); + var4.startDrawingQuads(); + var4.setNormal(0.0F, 0.0F, -1.0F); + this.renderEastFace(var1, 0.0D, 0.0D, 0.0D, var1.getBlockTextureFromSideAndMetadata(2, var2)); + var4.draw(); + var4.startDrawingQuads(); + var4.setNormal(0.0F, 0.0F, 1.0F); + this.renderWestFace(var1, 0.0D, 0.0D, 0.0D, var1.getBlockTextureFromSideAndMetadata(3, var2)); + var4.draw(); + var4.startDrawingQuads(); + var4.setNormal(-1.0F, 0.0F, 0.0F); + this.renderNorthFace(var1, 0.0D, 0.0D, 0.0D, var1.getBlockTextureFromSideAndMetadata(4, var2)); + var4.draw(); + var4.startDrawingQuads(); + var4.setNormal(1.0F, 0.0F, 0.0F); + this.renderSouthFace(var1, 0.0D, 0.0D, 0.0D, var1.getBlockTextureFromSideAndMetadata(5, var2)); + var4.draw(); + GL11.glTranslatef(0.5F, 0.5F, 0.5F); + } + + } + + public static boolean renderItemIn3d(int var0) { + return var0 == 0 ? true : (var0 == 13 ? true : (var0 == 10 ? true : (var0 == 11 ? true : var0 == 16))); + } +} diff --git a/src/net/minecraft/src/RenderBoat.java b/src/net/minecraft/src/RenderBoat.java new file mode 100644 index 0000000..de02b9e --- /dev/null +++ b/src/net/minecraft/src/RenderBoat.java @@ -0,0 +1,40 @@ +package net.minecraft.src; + +import org.lwjgl.opengl.GL11; + +public class RenderBoat extends Render { + protected ModelBase modelBoat; + + public RenderBoat() { + this.shadowSize = 0.5F; + this.modelBoat = new ModelBoat(); + } + + public void func_157_a(EntityBoat var1, double var2, double var4, double var6, float var8, float var9) { + GL11.glPushMatrix(); + GL11.glTranslatef((float)var2, (float)var4, (float)var6); + GL11.glRotatef(180.0F - var8, 0.0F, 1.0F, 0.0F); + float var10 = (float)var1.boatTimeSinceHit - var9; + float var11 = (float)var1.boatCurrentDamage - var9; + if(var11 < 0.0F) { + var11 = 0.0F; + } + + if(var10 > 0.0F) { + GL11.glRotatef(MathHelper.sin(var10) * var10 * var11 / 10.0F * (float)var1.boatRockDirection, 1.0F, 0.0F, 0.0F); + } + + this.loadTexture("/terrain.png"); + float var12 = 12.0F / 16.0F; + GL11.glScalef(var12, var12, var12); + GL11.glScalef(1.0F / var12, 1.0F / var12, 1.0F / var12); + this.loadTexture("/item/boat.png"); + GL11.glScalef(-1.0F, -1.0F, 1.0F); + this.modelBoat.render(0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 1.0F / 16.0F); + GL11.glPopMatrix(); + } + + public void doRender(Entity var1, double var2, double var4, double var6, float var8, float var9) { + this.func_157_a((EntityBoat)var1, var2, var4, var6, var8, var9); + } +} diff --git a/src/net/minecraft/src/RenderChicken.java b/src/net/minecraft/src/RenderChicken.java new file mode 100644 index 0000000..f5fd182 --- /dev/null +++ b/src/net/minecraft/src/RenderChicken.java @@ -0,0 +1,29 @@ +package net.minecraft.src; + +public class RenderChicken extends RenderLiving { + public RenderChicken(ModelBase var1, float var2) { + super(var1, var2); + } + + public void renderChicken(EntityChicken var1, double var2, double var4, double var6, float var8, float var9) { + super.doRenderLiving(var1, var2, var4, var6, var8, var9); + } + + protected float getWingRotation(EntityChicken var1, float var2) { + float var3 = var1.field_756_e + (var1.field_752_b - var1.field_756_e) * var2; + float var4 = var1.field_757_d + (var1.destPos - var1.field_757_d) * var2; + return (MathHelper.sin(var3) + 1.0F) * var4; + } + + protected float func_170_d(EntityLiving var1, float var2) { + return this.getWingRotation((EntityChicken)var1, var2); + } + + public void doRenderLiving(EntityLiving var1, double var2, double var4, double var6, float var8, float var9) { + this.renderChicken((EntityChicken)var1, var2, var4, var6, var8, var9); + } + + public void doRender(Entity var1, double var2, double var4, double var6, float var8, float var9) { + this.renderChicken((EntityChicken)var1, var2, var4, var6, var8, var9); + } +} diff --git a/src/net/minecraft/src/RenderCow.java b/src/net/minecraft/src/RenderCow.java new file mode 100644 index 0000000..190a426 --- /dev/null +++ b/src/net/minecraft/src/RenderCow.java @@ -0,0 +1,19 @@ +package net.minecraft.src; + +public class RenderCow extends RenderLiving { + public RenderCow(ModelBase var1, float var2) { + super(var1, var2); + } + + public void renderCow(EntityCow var1, double var2, double var4, double var6, float var8, float var9) { + super.doRenderLiving(var1, var2, var4, var6, var8, var9); + } + + public void doRenderLiving(EntityLiving var1, double var2, double var4, double var6, float var8, float var9) { + this.renderCow((EntityCow)var1, var2, var4, var6, var8, var9); + } + + public void doRender(Entity var1, double var2, double var4, double var6, float var8, float var9) { + this.renderCow((EntityCow)var1, var2, var4, var6, var8, var9); + } +} diff --git a/src/net/minecraft/src/RenderCreeper.java b/src/net/minecraft/src/RenderCreeper.java new file mode 100644 index 0000000..69730a3 --- /dev/null +++ b/src/net/minecraft/src/RenderCreeper.java @@ -0,0 +1,102 @@ +package net.minecraft.src; + +import org.lwjgl.opengl.GL11; + +public class RenderCreeper extends RenderLiving { + private ModelBase field_27008_a = new ModelCreeper(2.0F); + + public RenderCreeper() { + super(new ModelCreeper(), 0.5F); + } + + protected void updateCreeperScale(EntityCreeper var1, float var2) { + float var4 = var1.setCreeperFlashTime(var2); + float var5 = 1.0F + MathHelper.sin(var4 * 100.0F) * var4 * 0.01F; + if(var4 < 0.0F) { + var4 = 0.0F; + } + + if(var4 > 1.0F) { + var4 = 1.0F; + } + + var4 *= var4; + var4 *= var4; + float var6 = (1.0F + var4 * 0.4F) * var5; + float var7 = (1.0F + var4 * 0.1F) / var5; + GL11.glScalef(var6, var7, var6); + } + + protected int updateCreeperColorMultiplier(EntityCreeper var1, float var2, float var3) { + float var5 = var1.setCreeperFlashTime(var3); + if((int)(var5 * 10.0F) % 2 == 0) { + return 0; + } else { + int var6 = (int)(var5 * 0.2F * 255.0F); + if(var6 < 0) { + var6 = 0; + } + + if(var6 > 255) { + var6 = 255; + } + + short var7 = 255; + short var8 = 255; + short var9 = 255; + return var6 << 24 | var7 << 16 | var8 << 8 | var9; + } + } + + protected boolean func_27006_a(EntityCreeper var1, int var2, float var3) { + if(var1.getPowered()) { + if(var2 == 1) { + float var4 = (float)var1.ticksExisted + var3; + this.loadTexture("/armor/power.png"); + GL11.glMatrixMode(GL11.GL_TEXTURE); + GL11.glLoadIdentity(); + float var5 = var4 * 0.01F; + float var6 = var4 * 0.01F; + GL11.glTranslatef(var5, var6, 0.0F); + this.setRenderPassModel(this.field_27008_a); + GL11.glMatrixMode(GL11.GL_MODELVIEW); + GL11.glEnable(GL11.GL_BLEND); + float var7 = 0.5F; + GL11.glColor4f(var7, var7, var7, 1.0F); + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE); + return true; + } + + if(var2 == 2) { + GL11.glMatrixMode(GL11.GL_TEXTURE); + GL11.glLoadIdentity(); + GL11.glMatrixMode(GL11.GL_MODELVIEW); + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glDisable(GL11.GL_BLEND); + } + } + + return false; + } + + protected boolean func_27007_b(EntityCreeper var1, int var2, float var3) { + return false; + } + + protected void preRenderCallback(EntityLiving var1, float var2) { + this.updateCreeperScale((EntityCreeper)var1, var2); + } + + protected int getColorMultiplier(EntityLiving var1, float var2, float var3) { + return this.updateCreeperColorMultiplier((EntityCreeper)var1, var2, var3); + } + + protected boolean shouldRenderPass(EntityLiving var1, int var2, float var3) { + return this.func_27006_a((EntityCreeper)var1, var2, var3); + } + + protected boolean func_27005_b(EntityLiving var1, int var2, float var3) { + return this.func_27007_b((EntityCreeper)var1, var2, var3); + } +} diff --git a/src/net/minecraft/src/RenderEngine.java b/src/net/minecraft/src/RenderEngine.java new file mode 100644 index 0000000..bfebeb7 --- /dev/null +++ b/src/net/minecraft/src/RenderEngine.java @@ -0,0 +1,542 @@ +package net.minecraft.src; + +import java.awt.Color; +import java.awt.Graphics; +import java.awt.image.BufferedImage; +import java.awt.image.ImageObserver; +import java.io.IOException; +import java.io.InputStream; +import java.nio.ByteBuffer; +import java.nio.IntBuffer; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import javax.imageio.ImageIO; +import org.lwjgl.opengl.GL11; + +public class RenderEngine { + public static boolean useMipmaps = false; + private HashMap textureMap = new HashMap(); + private HashMap field_28151_c = new HashMap(); + private HashMap textureNameToImageMap = new HashMap(); + private IntBuffer singleIntBuffer = GLAllocation.createDirectIntBuffer(1); + private ByteBuffer imageData = GLAllocation.createDirectByteBuffer(1048576); + private List textureList = new ArrayList(); + private Map urlToImageDataMap = new HashMap(); + private GameSettings options; + private boolean clampTexture = false; + private boolean blurTexture = false; + private TexturePackList texturePack; + private BufferedImage missingTextureImage = new BufferedImage(64, 64, 2); + + public RenderEngine(TexturePackList var1, GameSettings var2) { + this.texturePack = var1; + this.options = var2; + Graphics var3 = this.missingTextureImage.getGraphics(); + var3.setColor(Color.WHITE); + var3.fillRect(0, 0, 64, 64); + var3.setColor(Color.BLACK); + var3.drawString("missingtex", 1, 10); + var3.dispose(); + } + + public int[] func_28149_a(String var1) { + TexturePackBase var2 = this.texturePack.selectedTexturePack; + int[] var3 = (int[])this.field_28151_c.get(var1); + if(var3 != null) { + return var3; + } else { + try { + Object var6 = null; + if(var1.startsWith("##")) { + var3 = this.func_28148_b(this.unwrapImageByColumns(this.readTextureImage(var2.getResourceAsStream(var1.substring(2))))); + } else if(var1.startsWith("%clamp%")) { + this.clampTexture = true; + var3 = this.func_28148_b(this.readTextureImage(var2.getResourceAsStream(var1.substring(7)))); + this.clampTexture = false; + } else if(var1.startsWith("%blur%")) { + this.blurTexture = true; + var3 = this.func_28148_b(this.readTextureImage(var2.getResourceAsStream(var1.substring(6)))); + this.blurTexture = false; + } else { + InputStream var7 = var2.getResourceAsStream(var1); + if(var7 == null) { + var3 = this.func_28148_b(this.missingTextureImage); + } else { + var3 = this.func_28148_b(this.readTextureImage(var7)); + } + } + + this.field_28151_c.put(var1, var3); + return var3; + } catch (IOException var5) { + var5.printStackTrace(); + int[] var4 = this.func_28148_b(this.missingTextureImage); + this.field_28151_c.put(var1, var4); + return var4; + } + } + } + + private int[] func_28148_b(BufferedImage var1) { + int var2 = var1.getWidth(); + int var3 = var1.getHeight(); + int[] var4 = new int[var2 * var3]; + var1.getRGB(0, 0, var2, var3, var4, 0, var2); + return var4; + } + + private int[] func_28147_a(BufferedImage var1, int[] var2) { + int var3 = var1.getWidth(); + int var4 = var1.getHeight(); + var1.getRGB(0, 0, var3, var4, var2, 0, var3); + return var2; + } + + public int getTexture(String var1) { + TexturePackBase var2 = this.texturePack.selectedTexturePack; + Integer var3 = (Integer)this.textureMap.get(var1); + if(var3 != null) { + return var3.intValue(); + } else { + try { + this.singleIntBuffer.clear(); + GLAllocation.generateTextureNames(this.singleIntBuffer); + int var6 = this.singleIntBuffer.get(0); + if(var1.startsWith("##")) { + this.setupTexture(this.unwrapImageByColumns(this.readTextureImage(var2.getResourceAsStream(var1.substring(2)))), var6); + } else if(var1.startsWith("%clamp%")) { + this.clampTexture = true; + this.setupTexture(this.readTextureImage(var2.getResourceAsStream(var1.substring(7))), var6); + this.clampTexture = false; + } else if(var1.startsWith("%blur%")) { + this.blurTexture = true; + this.setupTexture(this.readTextureImage(var2.getResourceAsStream(var1.substring(6))), var6); + this.blurTexture = false; + } else { + InputStream var7 = var2.getResourceAsStream(var1); + if(var7 == null) { + this.setupTexture(this.missingTextureImage, var6); + } else { + this.setupTexture(this.readTextureImage(var7), var6); + } + } + + this.textureMap.put(var1, Integer.valueOf(var6)); + return var6; + } catch (IOException var5) { + var5.printStackTrace(); + GLAllocation.generateTextureNames(this.singleIntBuffer); + int var4 = this.singleIntBuffer.get(0); + this.setupTexture(this.missingTextureImage, var4); + this.textureMap.put(var1, Integer.valueOf(var4)); + return var4; + } + } + } + + private BufferedImage unwrapImageByColumns(BufferedImage var1) { + int var2 = var1.getWidth() / 16; + BufferedImage var3 = new BufferedImage(16, var1.getHeight() * var2, 2); + Graphics var4 = var3.getGraphics(); + + for(int var5 = 0; var5 < var2; ++var5) { + var4.drawImage(var1, -var5 * 16, var5 * var1.getHeight(), (ImageObserver)null); + } + + var4.dispose(); + return var3; + } + + public int allocateAndSetupTexture(BufferedImage var1) { + this.singleIntBuffer.clear(); + GLAllocation.generateTextureNames(this.singleIntBuffer); + int var2 = this.singleIntBuffer.get(0); + this.setupTexture(var1, var2); + this.textureNameToImageMap.put(Integer.valueOf(var2), var1); + return var2; + } + + public void setupTexture(BufferedImage var1, int var2) { + GL11.glBindTexture(GL11.GL_TEXTURE_2D, var2); + if(useMipmaps) { + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST_MIPMAP_LINEAR); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST); + } else { + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST); + } + + if(this.blurTexture) { + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR); + } + + if(this.clampTexture) { + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_CLAMP); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_CLAMP); + } else { + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_REPEAT); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_REPEAT); + } + + int var3 = var1.getWidth(); + int var4 = var1.getHeight(); + int[] var5 = new int[var3 * var4]; + byte[] var6 = new byte[var3 * var4 * 4]; + var1.getRGB(0, 0, var3, var4, var5, 0, var3); + + int var7; + int var8; + int var9; + int var10; + int var11; + int var12; + int var13; + int var14; + for(var7 = 0; var7 < var5.length; ++var7) { + var8 = var5[var7] >> 24 & 255; + var9 = var5[var7] >> 16 & 255; + var10 = var5[var7] >> 8 & 255; + var11 = var5[var7] & 255; + if(this.options != null && this.options.anaglyph) { + var12 = (var9 * 30 + var10 * 59 + var11 * 11) / 100; + var13 = (var9 * 30 + var10 * 70) / 100; + var14 = (var9 * 30 + var11 * 70) / 100; + var9 = var12; + var10 = var13; + var11 = var14; + } + + var6[var7 * 4 + 0] = (byte)var9; + var6[var7 * 4 + 1] = (byte)var10; + var6[var7 * 4 + 2] = (byte)var11; + var6[var7 * 4 + 3] = (byte)var8; + } + + this.imageData.clear(); + this.imageData.put(var6); + this.imageData.position(0).limit(var6.length); + GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA, var3, var4, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, (ByteBuffer)this.imageData); + if(useMipmaps) { + for(var7 = 1; var7 <= 4; ++var7) { + var8 = var3 >> var7 - 1; + var9 = var3 >> var7; + var10 = var4 >> var7; + + for(var11 = 0; var11 < var9; ++var11) { + for(var12 = 0; var12 < var10; ++var12) { + var13 = this.imageData.getInt((var11 * 2 + 0 + (var12 * 2 + 0) * var8) * 4); + var14 = this.imageData.getInt((var11 * 2 + 1 + (var12 * 2 + 0) * var8) * 4); + int var15 = this.imageData.getInt((var11 * 2 + 1 + (var12 * 2 + 1) * var8) * 4); + int var16 = this.imageData.getInt((var11 * 2 + 0 + (var12 * 2 + 1) * var8) * 4); + int var17 = this.weightedAverageColor(this.weightedAverageColor(var13, var14), this.weightedAverageColor(var15, var16)); + this.imageData.putInt((var11 + var12 * var9) * 4, var17); + } + } + + GL11.glTexImage2D(GL11.GL_TEXTURE_2D, var7, GL11.GL_RGBA, var9, var10, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, (ByteBuffer)this.imageData); + } + } + + } + + public void func_28150_a(int[] var1, int var2, int var3, int var4) { + GL11.glBindTexture(GL11.GL_TEXTURE_2D, var4); + if(useMipmaps) { + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST_MIPMAP_LINEAR); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST); + } else { + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST); + } + + if(this.blurTexture) { + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR); + } + + if(this.clampTexture) { + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_CLAMP); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_CLAMP); + } else { + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_REPEAT); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_REPEAT); + } + + byte[] var5 = new byte[var2 * var3 * 4]; + + for(int var6 = 0; var6 < var1.length; ++var6) { + int var7 = var1[var6] >> 24 & 255; + int var8 = var1[var6] >> 16 & 255; + int var9 = var1[var6] >> 8 & 255; + int var10 = var1[var6] & 255; + if(this.options != null && this.options.anaglyph) { + int var11 = (var8 * 30 + var9 * 59 + var10 * 11) / 100; + int var12 = (var8 * 30 + var9 * 70) / 100; + int var13 = (var8 * 30 + var10 * 70) / 100; + var8 = var11; + var9 = var12; + var10 = var13; + } + + var5[var6 * 4 + 0] = (byte)var8; + var5[var6 * 4 + 1] = (byte)var9; + var5[var6 * 4 + 2] = (byte)var10; + var5[var6 * 4 + 3] = (byte)var7; + } + + this.imageData.clear(); + this.imageData.put(var5); + this.imageData.position(0).limit(var5.length); + GL11.glTexSubImage2D(GL11.GL_TEXTURE_2D, 0, 0, 0, var2, var3, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, (ByteBuffer)this.imageData); + } + + public void deleteTexture(int var1) { + this.textureNameToImageMap.remove(Integer.valueOf(var1)); + this.singleIntBuffer.clear(); + this.singleIntBuffer.put(var1); + this.singleIntBuffer.flip(); + GL11.glDeleteTextures(this.singleIntBuffer); + } + + public int getTextureForDownloadableImage(String var1, String var2) { + ThreadDownloadImageData var3 = (ThreadDownloadImageData)this.urlToImageDataMap.get(var1); + if(var3 != null && var3.image != null && !var3.textureSetupComplete) { + if(var3.textureName < 0) { + var3.textureName = this.allocateAndSetupTexture(var3.image); + } else { + this.setupTexture(var3.image, var3.textureName); + } + + var3.textureSetupComplete = true; + } + + return var3 != null && var3.textureName >= 0 ? var3.textureName : (var2 == null ? -1 : this.getTexture(var2)); + } + + public ThreadDownloadImageData obtainImageData(String var1, ImageBuffer var2) { + ThreadDownloadImageData var3 = (ThreadDownloadImageData)this.urlToImageDataMap.get(var1); + if(var3 == null) { + this.urlToImageDataMap.put(var1, new ThreadDownloadImageData(var1, var2)); + } else { + ++var3.referenceCount; + } + + return var3; + } + + public void releaseImageData(String var1) { + ThreadDownloadImageData var2 = (ThreadDownloadImageData)this.urlToImageDataMap.get(var1); + if(var2 != null) { + --var2.referenceCount; + if(var2.referenceCount == 0) { + if(var2.textureName >= 0) { + this.deleteTexture(var2.textureName); + } + + this.urlToImageDataMap.remove(var1); + } + } + + } + + public void registerTextureFX(TextureFX var1) { + this.textureList.add(var1); + var1.onTick(); + } + + public void updateDynamicTextures() { + int var1; + TextureFX var2; + int var3; + int var4; + int var5; + int var6; + int var7; + int var8; + int var9; + int var10; + int var11; + int var12; + for(var1 = 0; var1 < this.textureList.size(); ++var1) { + var2 = (TextureFX)this.textureList.get(var1); + var2.anaglyphEnabled = this.options.anaglyph; + var2.onTick(); + this.imageData.clear(); + this.imageData.put(var2.imageData); + this.imageData.position(0).limit(var2.imageData.length); + var2.bindImage(this); + + for(var3 = 0; var3 < var2.tileSize; ++var3) { + for(var4 = 0; var4 < var2.tileSize; ++var4) { + GL11.glTexSubImage2D(GL11.GL_TEXTURE_2D, 0, var2.iconIndex % 16 * 16 + var3 * 16, var2.iconIndex / 16 * 16 + var4 * 16, 16, 16, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, (ByteBuffer)this.imageData); + if(useMipmaps) { + for(var5 = 1; var5 <= 4; ++var5) { + var6 = 16 >> var5 - 1; + var7 = 16 >> var5; + + for(var8 = 0; var8 < var7; ++var8) { + for(var9 = 0; var9 < var7; ++var9) { + var10 = this.imageData.getInt((var8 * 2 + 0 + (var9 * 2 + 0) * var6) * 4); + var11 = this.imageData.getInt((var8 * 2 + 1 + (var9 * 2 + 0) * var6) * 4); + var12 = this.imageData.getInt((var8 * 2 + 1 + (var9 * 2 + 1) * var6) * 4); + int var13 = this.imageData.getInt((var8 * 2 + 0 + (var9 * 2 + 1) * var6) * 4); + int var14 = this.averageColor(this.averageColor(var10, var11), this.averageColor(var12, var13)); + this.imageData.putInt((var8 + var9 * var7) * 4, var14); + } + } + + GL11.glTexSubImage2D(GL11.GL_TEXTURE_2D, var5, var2.iconIndex % 16 * var7, var2.iconIndex / 16 * var7, var7, var7, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, this.imageData); + } + } + } + } + } + + for(var1 = 0; var1 < this.textureList.size(); ++var1) { + var2 = (TextureFX)this.textureList.get(var1); + if(var2.textureId > 0) { + this.imageData.clear(); + this.imageData.put(var2.imageData); + this.imageData.position(0).limit(var2.imageData.length); + GL11.glBindTexture(GL11.GL_TEXTURE_2D, var2.textureId); + GL11.glTexSubImage2D(GL11.GL_TEXTURE_2D, 0, 0, 0, 16, 16, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, (ByteBuffer)this.imageData); + if(useMipmaps) { + for(var3 = 1; var3 <= 4; ++var3) { + var4 = 16 >> var3 - 1; + var5 = 16 >> var3; + + for(var6 = 0; var6 < var5; ++var6) { + for(var7 = 0; var7 < var5; ++var7) { + var8 = this.imageData.getInt((var6 * 2 + 0 + (var7 * 2 + 0) * var4) * 4); + var9 = this.imageData.getInt((var6 * 2 + 1 + (var7 * 2 + 0) * var4) * 4); + var10 = this.imageData.getInt((var6 * 2 + 1 + (var7 * 2 + 1) * var4) * 4); + var11 = this.imageData.getInt((var6 * 2 + 0 + (var7 * 2 + 1) * var4) * 4); + var12 = this.averageColor(this.averageColor(var8, var9), this.averageColor(var10, var11)); + this.imageData.putInt((var6 + var7 * var5) * 4, var12); + } + } + + GL11.glTexSubImage2D(GL11.GL_TEXTURE_2D, var3, 0, 0, var5, var5, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, (ByteBuffer)this.imageData); + } + } + } + } + + } + + private int averageColor(int var1, int var2) { + int var3 = (var1 & -16777216) >> 24 & 255; + int var4 = (var2 & -16777216) >> 24 & 255; + return (var3 + var4 >> 1 << 24) + ((var1 & 16711422) + (var2 & 16711422) >> 1); + } + + private int weightedAverageColor(int var1, int var2) { + int var3 = (var1 & -16777216) >> 24 & 255; + int var4 = (var2 & -16777216) >> 24 & 255; + short var5 = 255; + if(var3 + var4 == 0) { + var3 = 1; + var4 = 1; + var5 = 0; + } + + int var6 = (var1 >> 16 & 255) * var3; + int var7 = (var1 >> 8 & 255) * var3; + int var8 = (var1 & 255) * var3; + int var9 = (var2 >> 16 & 255) * var4; + int var10 = (var2 >> 8 & 255) * var4; + int var11 = (var2 & 255) * var4; + int var12 = (var6 + var9) / (var3 + var4); + int var13 = (var7 + var10) / (var3 + var4); + int var14 = (var8 + var11) / (var3 + var4); + return var5 << 24 | var12 << 16 | var13 << 8 | var14; + } + + public void refreshTextures() { + TexturePackBase var1 = this.texturePack.selectedTexturePack; + Iterator var2 = this.textureNameToImageMap.keySet().iterator(); + + BufferedImage var4; + while(var2.hasNext()) { + int var3 = ((Integer)var2.next()).intValue(); + var4 = (BufferedImage)this.textureNameToImageMap.get(Integer.valueOf(var3)); + this.setupTexture(var4, var3); + } + + ThreadDownloadImageData var8; + for(var2 = this.urlToImageDataMap.values().iterator(); var2.hasNext(); var8.textureSetupComplete = false) { + var8 = (ThreadDownloadImageData)var2.next(); + } + + var2 = this.textureMap.keySet().iterator(); + + String var9; + while(var2.hasNext()) { + var9 = (String)var2.next(); + + try { + if(var9.startsWith("##")) { + var4 = this.unwrapImageByColumns(this.readTextureImage(var1.getResourceAsStream(var9.substring(2)))); + } else if(var9.startsWith("%clamp%")) { + this.clampTexture = true; + var4 = this.readTextureImage(var1.getResourceAsStream(var9.substring(7))); + } else if(var9.startsWith("%blur%")) { + this.blurTexture = true; + var4 = this.readTextureImage(var1.getResourceAsStream(var9.substring(6))); + } else { + var4 = this.readTextureImage(var1.getResourceAsStream(var9)); + } + + int var5 = ((Integer)this.textureMap.get(var9)).intValue(); + this.setupTexture(var4, var5); + this.blurTexture = false; + this.clampTexture = false; + } catch (IOException var7) { + var7.printStackTrace(); + } + } + + var2 = this.field_28151_c.keySet().iterator(); + + while(var2.hasNext()) { + var9 = (String)var2.next(); + + try { + if(var9.startsWith("##")) { + var4 = this.unwrapImageByColumns(this.readTextureImage(var1.getResourceAsStream(var9.substring(2)))); + } else if(var9.startsWith("%clamp%")) { + this.clampTexture = true; + var4 = this.readTextureImage(var1.getResourceAsStream(var9.substring(7))); + } else if(var9.startsWith("%blur%")) { + this.blurTexture = true; + var4 = this.readTextureImage(var1.getResourceAsStream(var9.substring(6))); + } else { + var4 = this.readTextureImage(var1.getResourceAsStream(var9)); + } + + this.func_28147_a(var4, (int[])this.field_28151_c.get(var9)); + this.blurTexture = false; + this.clampTexture = false; + } catch (IOException var6) { + var6.printStackTrace(); + } + } + + } + + private BufferedImage readTextureImage(InputStream var1) throws IOException { + BufferedImage var2 = ImageIO.read(var1); + var1.close(); + return var2; + } + + public void bindTexture(int var1) { + if(var1 >= 0) { + GL11.glBindTexture(GL11.GL_TEXTURE_2D, var1); + } + } +} diff --git a/src/net/minecraft/src/RenderEntity.java b/src/net/minecraft/src/RenderEntity.java new file mode 100644 index 0000000..c884ea8 --- /dev/null +++ b/src/net/minecraft/src/RenderEntity.java @@ -0,0 +1,11 @@ +package net.minecraft.src; + +import org.lwjgl.opengl.GL11; + +public class RenderEntity extends Render { + public void doRender(Entity var1, double var2, double var4, double var6, float var8, float var9) { + GL11.glPushMatrix(); + renderOffsetAABB(var1.boundingBox, var2 - var1.lastTickPosX, var4 - var1.lastTickPosY, var6 - var1.lastTickPosZ); + GL11.glPopMatrix(); + } +} diff --git a/src/net/minecraft/src/RenderFallingSand.java b/src/net/minecraft/src/RenderFallingSand.java new file mode 100644 index 0000000..ed667f9 --- /dev/null +++ b/src/net/minecraft/src/RenderFallingSand.java @@ -0,0 +1,27 @@ +package net.minecraft.src; + +import org.lwjgl.opengl.GL11; + +public class RenderFallingSand extends Render { + private RenderBlocks field_197_d = new RenderBlocks(); + + public RenderFallingSand() { + this.shadowSize = 0.5F; + } + + public void doRenderFallingSand(EntityFallingSand var1, double var2, double var4, double var6, float var8, float var9) { + GL11.glPushMatrix(); + GL11.glTranslatef((float)var2, (float)var4, (float)var6); + this.loadTexture("/terrain.png"); + Block var10 = Block.blocksList[var1.blockID]; + World var11 = var1.getWorld(); + GL11.glDisable(GL11.GL_LIGHTING); + this.field_197_d.renderBlockFallingSand(var10, var11, MathHelper.floor_double(var1.posX), MathHelper.floor_double(var1.posY), MathHelper.floor_double(var1.posZ)); + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glPopMatrix(); + } + + public void doRender(Entity var1, double var2, double var4, double var6, float var8, float var9) { + this.doRenderFallingSand((EntityFallingSand)var1, var2, var4, var6, var8, var9); + } +} diff --git a/src/net/minecraft/src/RenderFireball.java b/src/net/minecraft/src/RenderFireball.java new file mode 100644 index 0000000..1e91eef --- /dev/null +++ b/src/net/minecraft/src/RenderFireball.java @@ -0,0 +1,39 @@ +package net.minecraft.src; + +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +public class RenderFireball extends Render { + public void func_4012_a(EntityFireball var1, double var2, double var4, double var6, float var8, float var9) { + GL11.glPushMatrix(); + GL11.glTranslatef((float)var2, (float)var4, (float)var6); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + float var10 = 2.0F; + GL11.glScalef(var10 / 1.0F, var10 / 1.0F, var10 / 1.0F); + int var11 = Item.snowball.getIconFromDamage(0); + this.loadTexture("/gui/items.png"); + Tessellator var12 = Tessellator.instance; + float var13 = (float)(var11 % 16 * 16 + 0) / 256.0F; + float var14 = (float)(var11 % 16 * 16 + 16) / 256.0F; + float var15 = (float)(var11 / 16 * 16 + 0) / 256.0F; + float var16 = (float)(var11 / 16 * 16 + 16) / 256.0F; + float var17 = 1.0F; + float var18 = 0.5F; + float var19 = 0.25F; + GL11.glRotatef(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(-this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F); + var12.startDrawingQuads(); + var12.setNormal(0.0F, 1.0F, 0.0F); + var12.addVertexWithUV((double)(0.0F - var18), (double)(0.0F - var19), 0.0D, (double)var13, (double)var16); + var12.addVertexWithUV((double)(var17 - var18), (double)(0.0F - var19), 0.0D, (double)var14, (double)var16); + var12.addVertexWithUV((double)(var17 - var18), (double)(1.0F - var19), 0.0D, (double)var14, (double)var15); + var12.addVertexWithUV((double)(0.0F - var18), (double)(1.0F - var19), 0.0D, (double)var13, (double)var15); + var12.draw(); + GL11.glDisable(GL12.GL_RESCALE_NORMAL); + GL11.glPopMatrix(); + } + + public void doRender(Entity var1, double var2, double var4, double var6, float var8, float var9) { + this.func_4012_a((EntityFireball)var1, var2, var4, var6, var8, var9); + } +} diff --git a/src/net/minecraft/src/RenderFish.java b/src/net/minecraft/src/RenderFish.java new file mode 100644 index 0000000..5b4ba7b --- /dev/null +++ b/src/net/minecraft/src/RenderFish.java @@ -0,0 +1,84 @@ +package net.minecraft.src; + +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +public class RenderFish extends Render { + public void func_4011_a(EntityFish var1, double var2, double var4, double var6, float var8, float var9) { + GL11.glPushMatrix(); + GL11.glTranslatef((float)var2, (float)var4, (float)var6); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + GL11.glScalef(0.5F, 0.5F, 0.5F); + byte var10 = 1; + byte var11 = 2; + this.loadTexture("/particles.png"); + Tessellator var12 = Tessellator.instance; + float var13 = (float)(var10 * 8 + 0) / 128.0F; + float var14 = (float)(var10 * 8 + 8) / 128.0F; + float var15 = (float)(var11 * 8 + 0) / 128.0F; + float var16 = (float)(var11 * 8 + 8) / 128.0F; + float var17 = 1.0F; + float var18 = 0.5F; + float var19 = 0.5F; + GL11.glRotatef(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(-this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F); + var12.startDrawingQuads(); + var12.setNormal(0.0F, 1.0F, 0.0F); + var12.addVertexWithUV((double)(0.0F - var18), (double)(0.0F - var19), 0.0D, (double)var13, (double)var16); + var12.addVertexWithUV((double)(var17 - var18), (double)(0.0F - var19), 0.0D, (double)var14, (double)var16); + var12.addVertexWithUV((double)(var17 - var18), (double)(1.0F - var19), 0.0D, (double)var14, (double)var15); + var12.addVertexWithUV((double)(0.0F - var18), (double)(1.0F - var19), 0.0D, (double)var13, (double)var15); + var12.draw(); + GL11.glDisable(GL12.GL_RESCALE_NORMAL); + GL11.glPopMatrix(); + if(var1.angler != null) { + float var20 = (var1.angler.prevRotationYaw + (var1.angler.rotationYaw - var1.angler.prevRotationYaw) * var9) * (float)Math.PI / 180.0F; + double var21 = (double)MathHelper.sin(var20); + double var23 = (double)MathHelper.cos(var20); + float var25 = var1.angler.getSwingProgress(var9); + float var26 = MathHelper.sin(MathHelper.sqrt_float(var25) * (float)Math.PI); + Vec3D var27 = Vec3D.createVector(-0.5D, 0.03D, 0.8D); + var27.rotateAroundX(-(var1.angler.prevRotationPitch + (var1.angler.rotationPitch - var1.angler.prevRotationPitch) * var9) * (float)Math.PI / 180.0F); + var27.rotateAroundY(-(var1.angler.prevRotationYaw + (var1.angler.rotationYaw - var1.angler.prevRotationYaw) * var9) * (float)Math.PI / 180.0F); + var27.rotateAroundY(var26 * 0.5F); + var27.rotateAroundX(-var26 * 0.7F); + double var28 = var1.angler.prevPosX + (var1.angler.posX - var1.angler.prevPosX) * (double)var9 + var27.xCoord; + double var30 = var1.angler.prevPosY + (var1.angler.posY - var1.angler.prevPosY) * (double)var9 + var27.yCoord; + double var32 = var1.angler.prevPosZ + (var1.angler.posZ - var1.angler.prevPosZ) * (double)var9 + var27.zCoord; + if(this.renderManager.options.thirdPersonView) { + var20 = (var1.angler.prevRenderYawOffset + (var1.angler.renderYawOffset - var1.angler.prevRenderYawOffset) * var9) * (float)Math.PI / 180.0F; + var21 = (double)MathHelper.sin(var20); + var23 = (double)MathHelper.cos(var20); + var28 = var1.angler.prevPosX + (var1.angler.posX - var1.angler.prevPosX) * (double)var9 - var23 * 0.35D - var21 * 0.85D; + var30 = var1.angler.prevPosY + (var1.angler.posY - var1.angler.prevPosY) * (double)var9 - 0.45D; + var32 = var1.angler.prevPosZ + (var1.angler.posZ - var1.angler.prevPosZ) * (double)var9 - var21 * 0.35D + var23 * 0.85D; + } + + double var34 = var1.prevPosX + (var1.posX - var1.prevPosX) * (double)var9; + double var36 = var1.prevPosY + (var1.posY - var1.prevPosY) * (double)var9 + 0.25D; + double var38 = var1.prevPosZ + (var1.posZ - var1.prevPosZ) * (double)var9; + double var40 = (double)((float)(var28 - var34)); + double var42 = (double)((float)(var30 - var36)); + double var44 = (double)((float)(var32 - var38)); + GL11.glDisable(GL11.GL_TEXTURE_2D); + GL11.glDisable(GL11.GL_LIGHTING); + var12.startDrawing(3); + var12.setColorOpaque_I(0); + byte var46 = 16; + + for(int var47 = 0; var47 <= var46; ++var47) { + float var48 = (float)var47 / (float)var46; + var12.addVertex(var2 + var40 * (double)var48, var4 + var42 * (double)(var48 * var48 + var48) * 0.5D + 0.25D, var6 + var44 * (double)var48); + } + + var12.draw(); + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glEnable(GL11.GL_TEXTURE_2D); + } + + } + + public void doRender(Entity var1, double var2, double var4, double var6, float var8, float var9) { + this.func_4011_a((EntityFish)var1, var2, var4, var6, var8, var9); + } +} diff --git a/src/net/minecraft/src/RenderGhast.java b/src/net/minecraft/src/RenderGhast.java new file mode 100644 index 0000000..1dffd90 --- /dev/null +++ b/src/net/minecraft/src/RenderGhast.java @@ -0,0 +1,26 @@ +package net.minecraft.src; + +import org.lwjgl.opengl.GL11; + +public class RenderGhast extends RenderLiving { + public RenderGhast() { + super(new ModelGhast(), 0.5F); + } + + protected void func_4014_a(EntityGhast var1, float var2) { + float var4 = ((float)var1.prevAttackCounter + (float)(var1.attackCounter - var1.prevAttackCounter) * var2) / 20.0F; + if(var4 < 0.0F) { + var4 = 0.0F; + } + + var4 = 1.0F / (var4 * var4 * var4 * var4 * var4 * 2.0F + 1.0F); + float var5 = (8.0F + var4) / 2.0F; + float var6 = (8.0F + 1.0F / var4) / 2.0F; + GL11.glScalef(var6, var5, var6); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + } + + protected void preRenderCallback(EntityLiving var1, float var2) { + this.func_4014_a((EntityGhast)var1, var2); + } +} diff --git a/src/net/minecraft/src/RenderGiantZombie.java b/src/net/minecraft/src/RenderGiantZombie.java new file mode 100644 index 0000000..8cf8667 --- /dev/null +++ b/src/net/minecraft/src/RenderGiantZombie.java @@ -0,0 +1,20 @@ +package net.minecraft.src; + +import org.lwjgl.opengl.GL11; + +public class RenderGiantZombie extends RenderLiving { + private float scale; + + public RenderGiantZombie(ModelBase var1, float var2, float var3) { + super(var1, var2 * var3); + this.scale = var3; + } + + protected void preRenderScale(EntityGiantZombie var1, float var2) { + GL11.glScalef(this.scale, this.scale, this.scale); + } + + protected void preRenderCallback(EntityLiving var1, float var2) { + this.preRenderScale((EntityGiantZombie)var1, var2); + } +} diff --git a/src/net/minecraft/src/RenderGlobal.java b/src/net/minecraft/src/RenderGlobal.java new file mode 100644 index 0000000..7c39d24 --- /dev/null +++ b/src/net/minecraft/src/RenderGlobal.java @@ -0,0 +1,1419 @@ +package net.minecraft.src; + +import java.nio.IntBuffer; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Random; +import net.minecraft.client.Minecraft; +import org.lwjgl.opengl.ARBOcclusionQuery; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL15; + +public class RenderGlobal implements IWorldAccess { + public List tileEntities = new ArrayList(); + private World worldObj; + private RenderEngine renderEngine; + private List worldRenderersToUpdate = new ArrayList(); + private WorldRenderer[] sortedWorldRenderers; + private WorldRenderer[] worldRenderers; + private int renderChunksWide; + private int renderChunksTall; + private int renderChunksDeep; + private int glRenderListBase; + private Minecraft mc; + private RenderBlocks globalRenderBlocks; + private IntBuffer glOcclusionQueryBase; + private boolean occlusionEnabled = false; + private int cloudOffsetX = 0; + private int starGLCallList; + private int glSkyList; + private int glSkyList2; + private int minBlockX; + private int minBlockY; + private int minBlockZ; + private int maxBlockX; + private int maxBlockY; + private int maxBlockZ; + private int renderDistance = -1; + private int renderEntitiesStartupCounter = 2; + private int countEntitiesTotal; + private int countEntitiesRendered; + private int countEntitiesHidden; + int[] dummyBuf50k = new int['\uc350']; + IntBuffer occlusionResult = GLAllocation.createDirectIntBuffer(64); + private int renderersLoaded; + private int renderersBeingClipped; + private int renderersBeingOccluded; + private int renderersBeingRendered; + private int renderersSkippingRenderPass; + private int worldRenderersCheckIndex; + private List glRenderLists = new ArrayList(); + private RenderList[] allRenderLists = new RenderList[]{new RenderList(), new RenderList(), new RenderList(), new RenderList()}; + int dummyInt0 = 0; + int glDummyList = GLAllocation.generateDisplayLists(1); + double prevSortX = -9999.0D; + double prevSortY = -9999.0D; + double prevSortZ = -9999.0D; + public float damagePartialTime; + int frustrumCheckOffset = 0; + + public RenderGlobal(Minecraft var1, RenderEngine var2) { + this.mc = var1; + this.renderEngine = var2; + byte var3 = 64; + this.glRenderListBase = GLAllocation.generateDisplayLists(var3 * var3 * var3 * 3); + this.occlusionEnabled = var1.getOpenGlCapsChecker().checkARBOcclusion(); + if(this.occlusionEnabled) { + this.occlusionResult.clear(); + this.glOcclusionQueryBase = GLAllocation.createDirectIntBuffer(var3 * var3 * var3); + this.glOcclusionQueryBase.clear(); + this.glOcclusionQueryBase.position(0); + this.glOcclusionQueryBase.limit(var3 * var3 * var3); + ARBOcclusionQuery.glGenQueriesARB(this.glOcclusionQueryBase); + } + + this.starGLCallList = GLAllocation.generateDisplayLists(3); + GL11.glPushMatrix(); + GL11.glNewList(this.starGLCallList, GL11.GL_COMPILE); + this.renderStars(); + GL11.glEndList(); + GL11.glPopMatrix(); + Tessellator var4 = Tessellator.instance; + this.glSkyList = this.starGLCallList + 1; + GL11.glNewList(this.glSkyList, GL11.GL_COMPILE); + byte var6 = 64; + int var7 = 256 / var6 + 2; + float var5 = 16.0F; + + int var8; + int var9; + for(var8 = -var6 * var7; var8 <= var6 * var7; var8 += var6) { + for(var9 = -var6 * var7; var9 <= var6 * var7; var9 += var6) { + var4.startDrawingQuads(); + var4.addVertex((double)(var8 + 0), (double)var5, (double)(var9 + 0)); + var4.addVertex((double)(var8 + var6), (double)var5, (double)(var9 + 0)); + var4.addVertex((double)(var8 + var6), (double)var5, (double)(var9 + var6)); + var4.addVertex((double)(var8 + 0), (double)var5, (double)(var9 + var6)); + var4.draw(); + } + } + + GL11.glEndList(); + this.glSkyList2 = this.starGLCallList + 2; + GL11.glNewList(this.glSkyList2, GL11.GL_COMPILE); + var5 = -16.0F; + var4.startDrawingQuads(); + + for(var8 = -var6 * var7; var8 <= var6 * var7; var8 += var6) { + for(var9 = -var6 * var7; var9 <= var6 * var7; var9 += var6) { + var4.addVertex((double)(var8 + var6), (double)var5, (double)(var9 + 0)); + var4.addVertex((double)(var8 + 0), (double)var5, (double)(var9 + 0)); + var4.addVertex((double)(var8 + 0), (double)var5, (double)(var9 + var6)); + var4.addVertex((double)(var8 + var6), (double)var5, (double)(var9 + var6)); + } + } + + var4.draw(); + GL11.glEndList(); + } + + private void renderStars() { + Random var1 = new Random(10842L); + Tessellator var2 = Tessellator.instance; + var2.startDrawingQuads(); + + for(int var3 = 0; var3 < 1500; ++var3) { + double var4 = (double)(var1.nextFloat() * 2.0F - 1.0F); + double var6 = (double)(var1.nextFloat() * 2.0F - 1.0F); + double var8 = (double)(var1.nextFloat() * 2.0F - 1.0F); + double var10 = (double)(0.25F + var1.nextFloat() * 0.25F); + double var12 = var4 * var4 + var6 * var6 + var8 * var8; + if(var12 < 1.0D && var12 > 0.01D) { + var12 = 1.0D / Math.sqrt(var12); + var4 *= var12; + var6 *= var12; + var8 *= var12; + double var14 = var4 * 100.0D; + double var16 = var6 * 100.0D; + double var18 = var8 * 100.0D; + double var20 = Math.atan2(var4, var8); + double var22 = Math.sin(var20); + double var24 = Math.cos(var20); + double var26 = Math.atan2(Math.sqrt(var4 * var4 + var8 * var8), var6); + double var28 = Math.sin(var26); + double var30 = Math.cos(var26); + double var32 = var1.nextDouble() * Math.PI * 2.0D; + double var34 = Math.sin(var32); + double var36 = Math.cos(var32); + + for(int var38 = 0; var38 < 4; ++var38) { + double var39 = 0.0D; + double var41 = (double)((var38 & 2) - 1) * var10; + double var43 = (double)((var38 + 1 & 2) - 1) * var10; + double var47 = var41 * var36 - var43 * var34; + double var49 = var43 * var36 + var41 * var34; + double var53 = var47 * var28 + var39 * var30; + double var55 = var39 * var28 - var47 * var30; + double var57 = var55 * var22 - var49 * var24; + double var61 = var49 * var22 + var55 * var24; + var2.addVertex(var14 + var57, var16 + var53, var18 + var61); + } + } + } + + var2.draw(); + } + + public void changeWorld(World var1) { + if(this.worldObj != null) { + this.worldObj.removeWorldAccess(this); + } + + this.prevSortX = -9999.0D; + this.prevSortY = -9999.0D; + this.prevSortZ = -9999.0D; + RenderManager.instance.func_852_a(var1); + this.worldObj = var1; + this.globalRenderBlocks = new RenderBlocks(var1); + if(var1 != null) { + var1.addWorldAccess(this); + this.loadRenderers(); + } + + } + + public void loadRenderers() { + Block.leaves.setGraphicsLevel(this.mc.gameSettings.fancyGraphics); + this.renderDistance = this.mc.gameSettings.renderDistance; + int var1; + if(this.worldRenderers != null) { + for(var1 = 0; var1 < this.worldRenderers.length; ++var1) { + this.worldRenderers[var1].func_1204_c(); + } + } + + var1 = 64 << 3 - this.renderDistance; + if(var1 > 400) { + var1 = 400; + } + + this.renderChunksWide = var1 / 16 + 1; + this.renderChunksTall = 8; + this.renderChunksDeep = var1 / 16 + 1; + this.worldRenderers = new WorldRenderer[this.renderChunksWide * this.renderChunksTall * this.renderChunksDeep]; + this.sortedWorldRenderers = new WorldRenderer[this.renderChunksWide * this.renderChunksTall * this.renderChunksDeep]; + int var2 = 0; + int var3 = 0; + this.minBlockX = 0; + this.minBlockY = 0; + this.minBlockZ = 0; + this.maxBlockX = this.renderChunksWide; + this.maxBlockY = this.renderChunksTall; + this.maxBlockZ = this.renderChunksDeep; + + int var4; + for(var4 = 0; var4 < this.worldRenderersToUpdate.size(); ++var4) { + ((WorldRenderer)this.worldRenderersToUpdate.get(var4)).needsUpdate = false; + } + + this.worldRenderersToUpdate.clear(); + this.tileEntities.clear(); + + for(var4 = 0; var4 < this.renderChunksWide; ++var4) { + for(int var5 = 0; var5 < this.renderChunksTall; ++var5) { + for(int var6 = 0; var6 < this.renderChunksDeep; ++var6) { + this.worldRenderers[(var6 * this.renderChunksTall + var5) * this.renderChunksWide + var4] = new WorldRenderer(this.worldObj, this.tileEntities, var4 * 16, var5 * 16, var6 * 16, 16, this.glRenderListBase + var2); + if(this.occlusionEnabled) { + this.worldRenderers[(var6 * this.renderChunksTall + var5) * this.renderChunksWide + var4].glOcclusionQuery = this.glOcclusionQueryBase.get(var3); + } + + this.worldRenderers[(var6 * this.renderChunksTall + var5) * this.renderChunksWide + var4].isWaitingOnOcclusionQuery = false; + this.worldRenderers[(var6 * this.renderChunksTall + var5) * this.renderChunksWide + var4].isVisible = true; + this.worldRenderers[(var6 * this.renderChunksTall + var5) * this.renderChunksWide + var4].isInFrustum = true; + this.worldRenderers[(var6 * this.renderChunksTall + var5) * this.renderChunksWide + var4].chunkIndex = var3++; + this.worldRenderers[(var6 * this.renderChunksTall + var5) * this.renderChunksWide + var4].markDirty(); + this.sortedWorldRenderers[(var6 * this.renderChunksTall + var5) * this.renderChunksWide + var4] = this.worldRenderers[(var6 * this.renderChunksTall + var5) * this.renderChunksWide + var4]; + this.worldRenderersToUpdate.add(this.worldRenderers[(var6 * this.renderChunksTall + var5) * this.renderChunksWide + var4]); + var2 += 3; + } + } + } + + if(this.worldObj != null) { + EntityLiving var7 = this.mc.renderViewEntity; + if(var7 != null) { + this.markRenderersForNewPosition(MathHelper.floor_double(var7.posX), MathHelper.floor_double(var7.posY), MathHelper.floor_double(var7.posZ)); + Arrays.sort(this.sortedWorldRenderers, new EntitySorter(var7)); + } + } + + this.renderEntitiesStartupCounter = 2; + } + + public void renderEntities(Vec3D var1, ICamera var2, float var3) { + if(this.renderEntitiesStartupCounter > 0) { + --this.renderEntitiesStartupCounter; + } else { + TileEntityRenderer.instance.cacheActiveRenderInfo(this.worldObj, this.renderEngine, this.mc.fontRenderer, this.mc.renderViewEntity, var3); + RenderManager.instance.cacheActiveRenderInfo(this.worldObj, this.renderEngine, this.mc.fontRenderer, this.mc.renderViewEntity, this.mc.gameSettings, var3); + this.countEntitiesTotal = 0; + this.countEntitiesRendered = 0; + this.countEntitiesHidden = 0; + EntityLiving var4 = this.mc.renderViewEntity; + RenderManager.renderPosX = var4.lastTickPosX + (var4.posX - var4.lastTickPosX) * (double)var3; + RenderManager.renderPosY = var4.lastTickPosY + (var4.posY - var4.lastTickPosY) * (double)var3; + RenderManager.renderPosZ = var4.lastTickPosZ + (var4.posZ - var4.lastTickPosZ) * (double)var3; + TileEntityRenderer.staticPlayerX = var4.lastTickPosX + (var4.posX - var4.lastTickPosX) * (double)var3; + TileEntityRenderer.staticPlayerY = var4.lastTickPosY + (var4.posY - var4.lastTickPosY) * (double)var3; + TileEntityRenderer.staticPlayerZ = var4.lastTickPosZ + (var4.posZ - var4.lastTickPosZ) * (double)var3; + List var5 = this.worldObj.getLoadedEntityList(); + this.countEntitiesTotal = var5.size(); + + int var6; + Entity var7; + for(var6 = 0; var6 < this.worldObj.weatherEffects.size(); ++var6) { + var7 = (Entity)this.worldObj.weatherEffects.get(var6); + ++this.countEntitiesRendered; + if(var7.isInRangeToRenderVec3D(var1)) { + RenderManager.instance.renderEntity(var7, var3); + } + } + + for(var6 = 0; var6 < var5.size(); ++var6) { + var7 = (Entity)var5.get(var6); + if(var7.isInRangeToRenderVec3D(var1) && (var7.ignoreFrustumCheck || var2.isBoundingBoxInFrustum(var7.boundingBox)) && (var7 != this.mc.renderViewEntity || this.mc.gameSettings.thirdPersonView || this.mc.renderViewEntity.isPlayerSleeping())) { + int var8 = MathHelper.floor_double(var7.posY); + if(var8 < 0) { + var8 = 0; + } + + if(var8 >= 128) { + var8 = 127; + } + + if(this.worldObj.blockExists(MathHelper.floor_double(var7.posX), var8, MathHelper.floor_double(var7.posZ))) { + ++this.countEntitiesRendered; + RenderManager.instance.renderEntity(var7, var3); + } + } + } + + for(var6 = 0; var6 < this.tileEntities.size(); ++var6) { + TileEntityRenderer.instance.renderTileEntity((TileEntity)this.tileEntities.get(var6), var3); + } + + } + } + + public String getDebugInfoRenders() { + return "C: " + this.renderersBeingRendered + "/" + this.renderersLoaded + ". F: " + this.renderersBeingClipped + ", O: " + this.renderersBeingOccluded + ", E: " + this.renderersSkippingRenderPass; + } + + public String getDebugInfoEntities() { + return "E: " + this.countEntitiesRendered + "/" + this.countEntitiesTotal + ". B: " + this.countEntitiesHidden + ", I: " + (this.countEntitiesTotal - this.countEntitiesHidden - this.countEntitiesRendered); + } + + private void markRenderersForNewPosition(int var1, int var2, int var3) { + var1 -= 8; + var2 -= 8; + var3 -= 8; + this.minBlockX = Integer.MAX_VALUE; + this.minBlockY = Integer.MAX_VALUE; + this.minBlockZ = Integer.MAX_VALUE; + this.maxBlockX = Integer.MIN_VALUE; + this.maxBlockY = Integer.MIN_VALUE; + this.maxBlockZ = Integer.MIN_VALUE; + int var4 = this.renderChunksWide * 16; + int var5 = var4 / 2; + + for(int var6 = 0; var6 < this.renderChunksWide; ++var6) { + int var7 = var6 * 16; + int var8 = var7 + var5 - var1; + if(var8 < 0) { + var8 -= var4 - 1; + } + + var8 /= var4; + var7 -= var8 * var4; + if(var7 < this.minBlockX) { + this.minBlockX = var7; + } + + if(var7 > this.maxBlockX) { + this.maxBlockX = var7; + } + + for(int var9 = 0; var9 < this.renderChunksDeep; ++var9) { + int var10 = var9 * 16; + int var11 = var10 + var5 - var3; + if(var11 < 0) { + var11 -= var4 - 1; + } + + var11 /= var4; + var10 -= var11 * var4; + if(var10 < this.minBlockZ) { + this.minBlockZ = var10; + } + + if(var10 > this.maxBlockZ) { + this.maxBlockZ = var10; + } + + for(int var12 = 0; var12 < this.renderChunksTall; ++var12) { + int var13 = var12 * 16; + if(var13 < this.minBlockY) { + this.minBlockY = var13; + } + + if(var13 > this.maxBlockY) { + this.maxBlockY = var13; + } + + WorldRenderer var14 = this.worldRenderers[(var9 * this.renderChunksTall + var12) * this.renderChunksWide + var6]; + boolean var15 = var14.needsUpdate; + var14.setPosition(var7, var13, var10); + if(!var15 && var14.needsUpdate) { + this.worldRenderersToUpdate.add(var14); + } + } + } + } + + } + + public int sortAndRender(EntityLiving var1, int var2, double var3) { + for(int var5 = 0; var5 < 10; ++var5) { + this.worldRenderersCheckIndex = (this.worldRenderersCheckIndex + 1) % this.worldRenderers.length; + WorldRenderer var6 = this.worldRenderers[this.worldRenderersCheckIndex]; + if(var6.needsUpdate && !this.worldRenderersToUpdate.contains(var6)) { + this.worldRenderersToUpdate.add(var6); + } + } + + if(this.mc.gameSettings.renderDistance != this.renderDistance) { + this.loadRenderers(); + } + + if(var2 == 0) { + this.renderersLoaded = 0; + this.renderersBeingClipped = 0; + this.renderersBeingOccluded = 0; + this.renderersBeingRendered = 0; + this.renderersSkippingRenderPass = 0; + } + + double var33 = var1.lastTickPosX + (var1.posX - var1.lastTickPosX) * var3; + double var7 = var1.lastTickPosY + (var1.posY - var1.lastTickPosY) * var3; + double var9 = var1.lastTickPosZ + (var1.posZ - var1.lastTickPosZ) * var3; + double var11 = var1.posX - this.prevSortX; + double var13 = var1.posY - this.prevSortY; + double var15 = var1.posZ - this.prevSortZ; + if(var11 * var11 + var13 * var13 + var15 * var15 > 16.0D) { + this.prevSortX = var1.posX; + this.prevSortY = var1.posY; + this.prevSortZ = var1.posZ; + this.markRenderersForNewPosition(MathHelper.floor_double(var1.posX), MathHelper.floor_double(var1.posY), MathHelper.floor_double(var1.posZ)); + Arrays.sort(this.sortedWorldRenderers, new EntitySorter(var1)); + } + + RenderHelper.disableStandardItemLighting(); + byte var17 = 0; + int var34; + if(this.occlusionEnabled && this.mc.gameSettings.advancedOpengl && !this.mc.gameSettings.anaglyph && var2 == 0) { + byte var18 = 0; + int var19 = 16; + this.checkOcclusionQueryResult(var18, var19); + + for(int var20 = var18; var20 < var19; ++var20) { + this.sortedWorldRenderers[var20].isVisible = true; + } + + var34 = var17 + this.renderSortedRenderers(var18, var19, var2, var3); + + do { + int var35 = var19; + var19 *= 2; + if(var19 > this.sortedWorldRenderers.length) { + var19 = this.sortedWorldRenderers.length; + } + + GL11.glDisable(GL11.GL_TEXTURE_2D); + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glDisable(GL11.GL_ALPHA_TEST); + GL11.glDisable(GL11.GL_FOG); + GL11.glColorMask(false, false, false, false); + GL11.glDepthMask(false); + this.checkOcclusionQueryResult(var35, var19); + GL11.glPushMatrix(); + float var36 = 0.0F; + float var21 = 0.0F; + float var22 = 0.0F; + + for(int var23 = var35; var23 < var19; ++var23) { + if(this.sortedWorldRenderers[var23].skipAllRenderPasses()) { + this.sortedWorldRenderers[var23].isInFrustum = false; + } else { + if(!this.sortedWorldRenderers[var23].isInFrustum) { + this.sortedWorldRenderers[var23].isVisible = true; + } + + if(this.sortedWorldRenderers[var23].isInFrustum && !this.sortedWorldRenderers[var23].isWaitingOnOcclusionQuery) { + float var24 = MathHelper.sqrt_float(this.sortedWorldRenderers[var23].distanceToEntitySquared(var1)); + int var25 = (int)(1.0F + var24 / 128.0F); + if(this.cloudOffsetX % var25 == var23 % var25) { + WorldRenderer var26 = this.sortedWorldRenderers[var23]; + float var27 = (float)((double)var26.posXMinus - var33); + float var28 = (float)((double)var26.posYMinus - var7); + float var29 = (float)((double)var26.posZMinus - var9); + float var30 = var27 - var36; + float var31 = var28 - var21; + float var32 = var29 - var22; + if(var30 != 0.0F || var31 != 0.0F || var32 != 0.0F) { + GL11.glTranslatef(var30, var31, var32); + var36 += var30; + var21 += var31; + var22 += var32; + } + + ARBOcclusionQuery.glBeginQueryARB(GL15.GL_SAMPLES_PASSED, this.sortedWorldRenderers[var23].glOcclusionQuery); + this.sortedWorldRenderers[var23].callOcclusionQueryList(); + ARBOcclusionQuery.glEndQueryARB(GL15.GL_SAMPLES_PASSED); + this.sortedWorldRenderers[var23].isWaitingOnOcclusionQuery = true; + } + } + } + } + + GL11.glPopMatrix(); + if(this.mc.gameSettings.anaglyph) { + if(EntityRenderer.anaglyphField == 0) { + GL11.glColorMask(false, true, true, true); + } else { + GL11.glColorMask(true, false, false, true); + } + } else { + GL11.glColorMask(true, true, true, true); + } + + GL11.glDepthMask(true); + GL11.glEnable(GL11.GL_TEXTURE_2D); + GL11.glEnable(GL11.GL_ALPHA_TEST); + GL11.glEnable(GL11.GL_FOG); + var34 += this.renderSortedRenderers(var35, var19, var2, var3); + } while(var19 < this.sortedWorldRenderers.length); + } else { + var34 = var17 + this.renderSortedRenderers(0, this.sortedWorldRenderers.length, var2, var3); + } + + return var34; + } + + private void checkOcclusionQueryResult(int var1, int var2) { + for(int var3 = var1; var3 < var2; ++var3) { + if(this.sortedWorldRenderers[var3].isWaitingOnOcclusionQuery) { + this.occlusionResult.clear(); + ARBOcclusionQuery.glGetQueryObjectuARB(this.sortedWorldRenderers[var3].glOcclusionQuery, GL15.GL_QUERY_RESULT_AVAILABLE, this.occlusionResult); + if(this.occlusionResult.get(0) != 0) { + this.sortedWorldRenderers[var3].isWaitingOnOcclusionQuery = false; + this.occlusionResult.clear(); + ARBOcclusionQuery.glGetQueryObjectuARB(this.sortedWorldRenderers[var3].glOcclusionQuery, GL15.GL_QUERY_RESULT, this.occlusionResult); + this.sortedWorldRenderers[var3].isVisible = this.occlusionResult.get(0) != 0; + } + } + } + + } + + private int renderSortedRenderers(int var1, int var2, int var3, double var4) { + this.glRenderLists.clear(); + int var6 = 0; + + for(int var7 = var1; var7 < var2; ++var7) { + if(var3 == 0) { + ++this.renderersLoaded; + if(this.sortedWorldRenderers[var7].skipRenderPass[var3]) { + ++this.renderersSkippingRenderPass; + } else if(!this.sortedWorldRenderers[var7].isInFrustum) { + ++this.renderersBeingClipped; + } else if(this.occlusionEnabled && !this.sortedWorldRenderers[var7].isVisible) { + ++this.renderersBeingOccluded; + } else { + ++this.renderersBeingRendered; + } + } + + if(!this.sortedWorldRenderers[var7].skipRenderPass[var3] && this.sortedWorldRenderers[var7].isInFrustum && (!this.occlusionEnabled || this.sortedWorldRenderers[var7].isVisible)) { + int var8 = this.sortedWorldRenderers[var7].getGLCallListForPass(var3); + if(var8 >= 0) { + this.glRenderLists.add(this.sortedWorldRenderers[var7]); + ++var6; + } + } + } + + EntityLiving var19 = this.mc.renderViewEntity; + double var20 = var19.lastTickPosX + (var19.posX - var19.lastTickPosX) * var4; + double var10 = var19.lastTickPosY + (var19.posY - var19.lastTickPosY) * var4; + double var12 = var19.lastTickPosZ + (var19.posZ - var19.lastTickPosZ) * var4; + int var14 = 0; + + int var15; + for(var15 = 0; var15 < this.allRenderLists.length; ++var15) { + this.allRenderLists[var15].func_859_b(); + } + + for(var15 = 0; var15 < this.glRenderLists.size(); ++var15) { + WorldRenderer var16 = (WorldRenderer)this.glRenderLists.get(var15); + int var17 = -1; + + for(int var18 = 0; var18 < var14; ++var18) { + if(this.allRenderLists[var18].func_862_a(var16.posXMinus, var16.posYMinus, var16.posZMinus)) { + var17 = var18; + } + } + + if(var17 < 0) { + var17 = var14++; + this.allRenderLists[var17].func_861_a(var16.posXMinus, var16.posYMinus, var16.posZMinus, var20, var10, var12); + } + + this.allRenderLists[var17].func_858_a(var16.getGLCallListForPass(var3)); + } + + this.renderAllRenderLists(var3, var4); + return var6; + } + + public void renderAllRenderLists(int var1, double var2) { + for(int var4 = 0; var4 < this.allRenderLists.length; ++var4) { + this.allRenderLists[var4].func_860_a(); + } + + } + + public void updateClouds() { + ++this.cloudOffsetX; + } + + public void renderSky(float var1) { + if(!this.mc.theWorld.worldProvider.isNether) { + GL11.glDisable(GL11.GL_TEXTURE_2D); + Vec3D var2 = this.worldObj.func_4079_a(this.mc.renderViewEntity, var1); + float var3 = (float)var2.xCoord; + float var4 = (float)var2.yCoord; + float var5 = (float)var2.zCoord; + float var7; + float var8; + if(this.mc.gameSettings.anaglyph) { + float var6 = (var3 * 30.0F + var4 * 59.0F + var5 * 11.0F) / 100.0F; + var7 = (var3 * 30.0F + var4 * 70.0F) / 100.0F; + var8 = (var3 * 30.0F + var5 * 70.0F) / 100.0F; + var3 = var6; + var4 = var7; + var5 = var8; + } + + GL11.glColor3f(var3, var4, var5); + Tessellator var17 = Tessellator.instance; + GL11.glDepthMask(false); + GL11.glEnable(GL11.GL_FOG); + GL11.glColor3f(var3, var4, var5); + GL11.glCallList(this.glSkyList); + GL11.glDisable(GL11.GL_FOG); + GL11.glDisable(GL11.GL_ALPHA_TEST); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + RenderHelper.disableStandardItemLighting(); + float[] var18 = this.worldObj.worldProvider.calcSunriseSunsetColors(this.worldObj.getCelestialAngle(var1), var1); + float var9; + float var10; + float var11; + float var12; + if(var18 != null) { + GL11.glDisable(GL11.GL_TEXTURE_2D); + GL11.glShadeModel(GL11.GL_SMOOTH); + GL11.glPushMatrix(); + GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F); + var8 = this.worldObj.getCelestialAngle(var1); + GL11.glRotatef(var8 > 0.5F ? 180.0F : 0.0F, 0.0F, 0.0F, 1.0F); + var9 = var18[0]; + var10 = var18[1]; + var11 = var18[2]; + float var14; + if(this.mc.gameSettings.anaglyph) { + var12 = (var9 * 30.0F + var10 * 59.0F + var11 * 11.0F) / 100.0F; + float var13 = (var9 * 30.0F + var10 * 70.0F) / 100.0F; + var14 = (var9 * 30.0F + var11 * 70.0F) / 100.0F; + var9 = var12; + var10 = var13; + var11 = var14; + } + + var17.startDrawing(6); + var17.setColorRGBA_F(var9, var10, var11, var18[3]); + var17.addVertex(0.0D, 100.0D, 0.0D); + byte var19 = 16; + var17.setColorRGBA_F(var18[0], var18[1], var18[2], 0.0F); + + for(int var20 = 0; var20 <= var19; ++var20) { + var14 = (float)var20 * (float)Math.PI * 2.0F / (float)var19; + float var15 = MathHelper.sin(var14); + float var16 = MathHelper.cos(var14); + var17.addVertex((double)(var15 * 120.0F), (double)(var16 * 120.0F), (double)(-var16 * 40.0F * var18[3])); + } + + var17.draw(); + GL11.glPopMatrix(); + GL11.glShadeModel(GL11.GL_FLAT); + } + + GL11.glEnable(GL11.GL_TEXTURE_2D); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); + GL11.glPushMatrix(); + var7 = 1.0F - this.worldObj.func_27162_g(var1); + var8 = 0.0F; + var9 = 0.0F; + var10 = 0.0F; + GL11.glColor4f(1.0F, 1.0F, 1.0F, var7); + GL11.glTranslatef(var8, var9, var10); + GL11.glRotatef(0.0F, 0.0F, 0.0F, 1.0F); + GL11.glRotatef(this.worldObj.getCelestialAngle(var1) * 360.0F, 1.0F, 0.0F, 0.0F); + var11 = 30.0F; + GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.renderEngine.getTexture("/terrain/sun.png")); + var17.startDrawingQuads(); + var17.addVertexWithUV((double)(-var11), 100.0D, (double)(-var11), 0.0D, 0.0D); + var17.addVertexWithUV((double)var11, 100.0D, (double)(-var11), 1.0D, 0.0D); + var17.addVertexWithUV((double)var11, 100.0D, (double)var11, 1.0D, 1.0D); + var17.addVertexWithUV((double)(-var11), 100.0D, (double)var11, 0.0D, 1.0D); + var17.draw(); + var11 = 20.0F; + GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.renderEngine.getTexture("/terrain/moon.png")); + var17.startDrawingQuads(); + var17.addVertexWithUV((double)(-var11), -100.0D, (double)var11, 1.0D, 1.0D); + var17.addVertexWithUV((double)var11, -100.0D, (double)var11, 0.0D, 1.0D); + var17.addVertexWithUV((double)var11, -100.0D, (double)(-var11), 0.0D, 0.0D); + var17.addVertexWithUV((double)(-var11), -100.0D, (double)(-var11), 1.0D, 0.0D); + var17.draw(); + GL11.glDisable(GL11.GL_TEXTURE_2D); + var12 = this.worldObj.getStarBrightness(var1) * var7; + if(var12 > 0.0F) { + GL11.glColor4f(var12, var12, var12, var12); + GL11.glCallList(this.starGLCallList); + } + + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glDisable(GL11.GL_BLEND); + GL11.glEnable(GL11.GL_ALPHA_TEST); + GL11.glEnable(GL11.GL_FOG); + GL11.glPopMatrix(); + if(this.worldObj.worldProvider.func_28112_c()) { + GL11.glColor3f(var3 * 0.2F + 0.04F, var4 * 0.2F + 0.04F, var5 * 0.6F + 0.1F); + } else { + GL11.glColor3f(var3, var4, var5); + } + + GL11.glDisable(GL11.GL_TEXTURE_2D); + GL11.glCallList(this.glSkyList2); + GL11.glEnable(GL11.GL_TEXTURE_2D); + GL11.glDepthMask(true); + } + } + + public void renderClouds(float var1) { + if(!this.mc.theWorld.worldProvider.isNether) { + if(this.mc.gameSettings.fancyGraphics) { + this.renderCloudsFancy(var1); + } else { + GL11.glDisable(GL11.GL_CULL_FACE); + float var2 = (float)(this.mc.renderViewEntity.lastTickPosY + (this.mc.renderViewEntity.posY - this.mc.renderViewEntity.lastTickPosY) * (double)var1); + byte var3 = 32; + int var4 = 256 / var3; + Tessellator var5 = Tessellator.instance; + GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.renderEngine.getTexture("/environment/clouds.png")); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + Vec3D var6 = this.worldObj.func_628_d(var1); + float var7 = (float)var6.xCoord; + float var8 = (float)var6.yCoord; + float var9 = (float)var6.zCoord; + float var10; + if(this.mc.gameSettings.anaglyph) { + var10 = (var7 * 30.0F + var8 * 59.0F + var9 * 11.0F) / 100.0F; + float var11 = (var7 * 30.0F + var8 * 70.0F) / 100.0F; + float var12 = (var7 * 30.0F + var9 * 70.0F) / 100.0F; + var7 = var10; + var8 = var11; + var9 = var12; + } + + var10 = 0.5F / 1024.0F; + double var22 = this.mc.renderViewEntity.prevPosX + (this.mc.renderViewEntity.posX - this.mc.renderViewEntity.prevPosX) * (double)var1 + (double)(((float)this.cloudOffsetX + var1) * 0.03F); + double var13 = this.mc.renderViewEntity.prevPosZ + (this.mc.renderViewEntity.posZ - this.mc.renderViewEntity.prevPosZ) * (double)var1; + int var15 = MathHelper.floor_double(var22 / 2048.0D); + int var16 = MathHelper.floor_double(var13 / 2048.0D); + var22 -= (double)(var15 * 2048); + var13 -= (double)(var16 * 2048); + float var17 = this.worldObj.worldProvider.getCloudHeight() - var2 + 0.33F; + float var18 = (float)(var22 * (double)var10); + float var19 = (float)(var13 * (double)var10); + var5.startDrawingQuads(); + var5.setColorRGBA_F(var7, var8, var9, 0.8F); + + for(int var20 = -var3 * var4; var20 < var3 * var4; var20 += var3) { + for(int var21 = -var3 * var4; var21 < var3 * var4; var21 += var3) { + var5.addVertexWithUV((double)(var20 + 0), (double)var17, (double)(var21 + var3), (double)((float)(var20 + 0) * var10 + var18), (double)((float)(var21 + var3) * var10 + var19)); + var5.addVertexWithUV((double)(var20 + var3), (double)var17, (double)(var21 + var3), (double)((float)(var20 + var3) * var10 + var18), (double)((float)(var21 + var3) * var10 + var19)); + var5.addVertexWithUV((double)(var20 + var3), (double)var17, (double)(var21 + 0), (double)((float)(var20 + var3) * var10 + var18), (double)((float)(var21 + 0) * var10 + var19)); + var5.addVertexWithUV((double)(var20 + 0), (double)var17, (double)(var21 + 0), (double)((float)(var20 + 0) * var10 + var18), (double)((float)(var21 + 0) * var10 + var19)); + } + } + + var5.draw(); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glDisable(GL11.GL_BLEND); + GL11.glEnable(GL11.GL_CULL_FACE); + } + } + } + + public boolean func_27307_a(double var1, double var3, double var5, float var7) { + return false; + } + + public void renderCloudsFancy(float var1) { + GL11.glDisable(GL11.GL_CULL_FACE); + float var2 = (float)(this.mc.renderViewEntity.lastTickPosY + (this.mc.renderViewEntity.posY - this.mc.renderViewEntity.lastTickPosY) * (double)var1); + Tessellator var3 = Tessellator.instance; + float var4 = 12.0F; + float var5 = 4.0F; + double var6 = (this.mc.renderViewEntity.prevPosX + (this.mc.renderViewEntity.posX - this.mc.renderViewEntity.prevPosX) * (double)var1 + (double)(((float)this.cloudOffsetX + var1) * 0.03F)) / (double)var4; + double var8 = (this.mc.renderViewEntity.prevPosZ + (this.mc.renderViewEntity.posZ - this.mc.renderViewEntity.prevPosZ) * (double)var1) / (double)var4 + (double)0.33F; + float var10 = this.worldObj.worldProvider.getCloudHeight() - var2 + 0.33F; + int var11 = MathHelper.floor_double(var6 / 2048.0D); + int var12 = MathHelper.floor_double(var8 / 2048.0D); + var6 -= (double)(var11 * 2048); + var8 -= (double)(var12 * 2048); + GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.renderEngine.getTexture("/environment/clouds.png")); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + Vec3D var13 = this.worldObj.func_628_d(var1); + float var14 = (float)var13.xCoord; + float var15 = (float)var13.yCoord; + float var16 = (float)var13.zCoord; + float var17; + float var18; + float var19; + if(this.mc.gameSettings.anaglyph) { + var17 = (var14 * 30.0F + var15 * 59.0F + var16 * 11.0F) / 100.0F; + var18 = (var14 * 30.0F + var15 * 70.0F) / 100.0F; + var19 = (var14 * 30.0F + var16 * 70.0F) / 100.0F; + var14 = var17; + var15 = var18; + var16 = var19; + } + + var17 = (float)(var6 * 0.0D); + var18 = (float)(var8 * 0.0D); + var19 = 0.00390625F; + var17 = (float)MathHelper.floor_double(var6) * var19; + var18 = (float)MathHelper.floor_double(var8) * var19; + float var20 = (float)(var6 - (double)MathHelper.floor_double(var6)); + float var21 = (float)(var8 - (double)MathHelper.floor_double(var8)); + byte var22 = 8; + byte var23 = 3; + float var24 = 1.0F / 1024.0F; + GL11.glScalef(var4, 1.0F, var4); + + for(int var25 = 0; var25 < 2; ++var25) { + if(var25 == 0) { + GL11.glColorMask(false, false, false, false); + } else if(this.mc.gameSettings.anaglyph) { + if(EntityRenderer.anaglyphField == 0) { + GL11.glColorMask(false, true, true, true); + } else { + GL11.glColorMask(true, false, false, true); + } + } else { + GL11.glColorMask(true, true, true, true); + } + + for(int var26 = -var23 + 1; var26 <= var23; ++var26) { + for(int var27 = -var23 + 1; var27 <= var23; ++var27) { + var3.startDrawingQuads(); + float var28 = (float)(var26 * var22); + float var29 = (float)(var27 * var22); + float var30 = var28 - var20; + float var31 = var29 - var21; + if(var10 > -var5 - 1.0F) { + var3.setColorRGBA_F(var14 * 0.7F, var15 * 0.7F, var16 * 0.7F, 0.8F); + var3.setNormal(0.0F, -1.0F, 0.0F); + var3.addVertexWithUV((double)(var30 + 0.0F), (double)(var10 + 0.0F), (double)(var31 + (float)var22), (double)((var28 + 0.0F) * var19 + var17), (double)((var29 + (float)var22) * var19 + var18)); + var3.addVertexWithUV((double)(var30 + (float)var22), (double)(var10 + 0.0F), (double)(var31 + (float)var22), (double)((var28 + (float)var22) * var19 + var17), (double)((var29 + (float)var22) * var19 + var18)); + var3.addVertexWithUV((double)(var30 + (float)var22), (double)(var10 + 0.0F), (double)(var31 + 0.0F), (double)((var28 + (float)var22) * var19 + var17), (double)((var29 + 0.0F) * var19 + var18)); + var3.addVertexWithUV((double)(var30 + 0.0F), (double)(var10 + 0.0F), (double)(var31 + 0.0F), (double)((var28 + 0.0F) * var19 + var17), (double)((var29 + 0.0F) * var19 + var18)); + } + + if(var10 <= var5 + 1.0F) { + var3.setColorRGBA_F(var14, var15, var16, 0.8F); + var3.setNormal(0.0F, 1.0F, 0.0F); + var3.addVertexWithUV((double)(var30 + 0.0F), (double)(var10 + var5 - var24), (double)(var31 + (float)var22), (double)((var28 + 0.0F) * var19 + var17), (double)((var29 + (float)var22) * var19 + var18)); + var3.addVertexWithUV((double)(var30 + (float)var22), (double)(var10 + var5 - var24), (double)(var31 + (float)var22), (double)((var28 + (float)var22) * var19 + var17), (double)((var29 + (float)var22) * var19 + var18)); + var3.addVertexWithUV((double)(var30 + (float)var22), (double)(var10 + var5 - var24), (double)(var31 + 0.0F), (double)((var28 + (float)var22) * var19 + var17), (double)((var29 + 0.0F) * var19 + var18)); + var3.addVertexWithUV((double)(var30 + 0.0F), (double)(var10 + var5 - var24), (double)(var31 + 0.0F), (double)((var28 + 0.0F) * var19 + var17), (double)((var29 + 0.0F) * var19 + var18)); + } + + var3.setColorRGBA_F(var14 * 0.9F, var15 * 0.9F, var16 * 0.9F, 0.8F); + int var32; + if(var26 > -1) { + var3.setNormal(-1.0F, 0.0F, 0.0F); + + for(var32 = 0; var32 < var22; ++var32) { + var3.addVertexWithUV((double)(var30 + (float)var32 + 0.0F), (double)(var10 + 0.0F), (double)(var31 + (float)var22), (double)((var28 + (float)var32 + 0.5F) * var19 + var17), (double)((var29 + (float)var22) * var19 + var18)); + var3.addVertexWithUV((double)(var30 + (float)var32 + 0.0F), (double)(var10 + var5), (double)(var31 + (float)var22), (double)((var28 + (float)var32 + 0.5F) * var19 + var17), (double)((var29 + (float)var22) * var19 + var18)); + var3.addVertexWithUV((double)(var30 + (float)var32 + 0.0F), (double)(var10 + var5), (double)(var31 + 0.0F), (double)((var28 + (float)var32 + 0.5F) * var19 + var17), (double)((var29 + 0.0F) * var19 + var18)); + var3.addVertexWithUV((double)(var30 + (float)var32 + 0.0F), (double)(var10 + 0.0F), (double)(var31 + 0.0F), (double)((var28 + (float)var32 + 0.5F) * var19 + var17), (double)((var29 + 0.0F) * var19 + var18)); + } + } + + if(var26 <= 1) { + var3.setNormal(1.0F, 0.0F, 0.0F); + + for(var32 = 0; var32 < var22; ++var32) { + var3.addVertexWithUV((double)(var30 + (float)var32 + 1.0F - var24), (double)(var10 + 0.0F), (double)(var31 + (float)var22), (double)((var28 + (float)var32 + 0.5F) * var19 + var17), (double)((var29 + (float)var22) * var19 + var18)); + var3.addVertexWithUV((double)(var30 + (float)var32 + 1.0F - var24), (double)(var10 + var5), (double)(var31 + (float)var22), (double)((var28 + (float)var32 + 0.5F) * var19 + var17), (double)((var29 + (float)var22) * var19 + var18)); + var3.addVertexWithUV((double)(var30 + (float)var32 + 1.0F - var24), (double)(var10 + var5), (double)(var31 + 0.0F), (double)((var28 + (float)var32 + 0.5F) * var19 + var17), (double)((var29 + 0.0F) * var19 + var18)); + var3.addVertexWithUV((double)(var30 + (float)var32 + 1.0F - var24), (double)(var10 + 0.0F), (double)(var31 + 0.0F), (double)((var28 + (float)var32 + 0.5F) * var19 + var17), (double)((var29 + 0.0F) * var19 + var18)); + } + } + + var3.setColorRGBA_F(var14 * 0.8F, var15 * 0.8F, var16 * 0.8F, 0.8F); + if(var27 > -1) { + var3.setNormal(0.0F, 0.0F, -1.0F); + + for(var32 = 0; var32 < var22; ++var32) { + var3.addVertexWithUV((double)(var30 + 0.0F), (double)(var10 + var5), (double)(var31 + (float)var32 + 0.0F), (double)((var28 + 0.0F) * var19 + var17), (double)((var29 + (float)var32 + 0.5F) * var19 + var18)); + var3.addVertexWithUV((double)(var30 + (float)var22), (double)(var10 + var5), (double)(var31 + (float)var32 + 0.0F), (double)((var28 + (float)var22) * var19 + var17), (double)((var29 + (float)var32 + 0.5F) * var19 + var18)); + var3.addVertexWithUV((double)(var30 + (float)var22), (double)(var10 + 0.0F), (double)(var31 + (float)var32 + 0.0F), (double)((var28 + (float)var22) * var19 + var17), (double)((var29 + (float)var32 + 0.5F) * var19 + var18)); + var3.addVertexWithUV((double)(var30 + 0.0F), (double)(var10 + 0.0F), (double)(var31 + (float)var32 + 0.0F), (double)((var28 + 0.0F) * var19 + var17), (double)((var29 + (float)var32 + 0.5F) * var19 + var18)); + } + } + + if(var27 <= 1) { + var3.setNormal(0.0F, 0.0F, 1.0F); + + for(var32 = 0; var32 < var22; ++var32) { + var3.addVertexWithUV((double)(var30 + 0.0F), (double)(var10 + var5), (double)(var31 + (float)var32 + 1.0F - var24), (double)((var28 + 0.0F) * var19 + var17), (double)((var29 + (float)var32 + 0.5F) * var19 + var18)); + var3.addVertexWithUV((double)(var30 + (float)var22), (double)(var10 + var5), (double)(var31 + (float)var32 + 1.0F - var24), (double)((var28 + (float)var22) * var19 + var17), (double)((var29 + (float)var32 + 0.5F) * var19 + var18)); + var3.addVertexWithUV((double)(var30 + (float)var22), (double)(var10 + 0.0F), (double)(var31 + (float)var32 + 1.0F - var24), (double)((var28 + (float)var22) * var19 + var17), (double)((var29 + (float)var32 + 0.5F) * var19 + var18)); + var3.addVertexWithUV((double)(var30 + 0.0F), (double)(var10 + 0.0F), (double)(var31 + (float)var32 + 1.0F - var24), (double)((var28 + 0.0F) * var19 + var17), (double)((var29 + (float)var32 + 0.5F) * var19 + var18)); + } + } + + var3.draw(); + } + } + } + + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glDisable(GL11.GL_BLEND); + GL11.glEnable(GL11.GL_CULL_FACE); + } + + public boolean updateRenderers(EntityLiving var1, boolean var2) { + boolean var3 = false; + if(var3) { + Collections.sort(this.worldRenderersToUpdate, new RenderSorter(var1)); + int var17 = this.worldRenderersToUpdate.size() - 1; + int var18 = this.worldRenderersToUpdate.size(); + + for(int var19 = 0; var19 < var18; ++var19) { + WorldRenderer var20 = (WorldRenderer)this.worldRenderersToUpdate.get(var17 - var19); + if(!var2) { + if(var20.distanceToEntitySquared(var1) > 256.0F) { + if(var20.isInFrustum) { + if(var19 >= 3) { + return false; + } + } else if(var19 >= 1) { + return false; + } + } + } else if(!var20.isInFrustum) { + continue; + } + + var20.updateRenderer(); + this.worldRenderersToUpdate.remove(var20); + var20.needsUpdate = false; + } + + return this.worldRenderersToUpdate.size() == 0; + } else { + byte var4 = 2; + RenderSorter var5 = new RenderSorter(var1); + WorldRenderer[] var6 = new WorldRenderer[var4]; + ArrayList var7 = null; + int var8 = this.worldRenderersToUpdate.size(); + int var9 = 0; + + int var10; + WorldRenderer var11; + int var12; + int var13; + label169: + for(var10 = 0; var10 < var8; ++var10) { + var11 = (WorldRenderer)this.worldRenderersToUpdate.get(var10); + if(!var2) { + if(var11.distanceToEntitySquared(var1) > 256.0F) { + for(var12 = 0; var12 < var4 && (var6[var12] == null || var5.doCompare(var6[var12], var11) <= 0); ++var12) { + } + + --var12; + if(var12 <= 0) { + continue; + } + + var13 = var12; + + while(true) { + --var13; + if(var13 == 0) { + var6[var12] = var11; + continue label169; + } + + var6[var13 - 1] = var6[var13]; + } + } + } else if(!var11.isInFrustum) { + continue; + } + + if(var7 == null) { + var7 = new ArrayList(); + } + + ++var9; + var7.add(var11); + this.worldRenderersToUpdate.set(var10, (Object)null); + } + + if(var7 != null) { + if(var7.size() > 1) { + Collections.sort(var7, var5); + } + + for(var10 = var7.size() - 1; var10 >= 0; --var10) { + var11 = (WorldRenderer)var7.get(var10); + var11.updateRenderer(); + var11.needsUpdate = false; + } + } + + var10 = 0; + + int var21; + for(var21 = var4 - 1; var21 >= 0; --var21) { + WorldRenderer var22 = var6[var21]; + if(var22 != null) { + if(!var22.isInFrustum && var21 != var4 - 1) { + var6[var21] = null; + var6[0] = null; + break; + } + + var6[var21].updateRenderer(); + var6[var21].needsUpdate = false; + ++var10; + } + } + + var21 = 0; + var12 = 0; + + for(var13 = this.worldRenderersToUpdate.size(); var21 != var13; ++var21) { + WorldRenderer var14 = (WorldRenderer)this.worldRenderersToUpdate.get(var21); + if(var14 != null) { + boolean var15 = false; + + for(int var16 = 0; var16 < var4 && !var15; ++var16) { + if(var14 == var6[var16]) { + var15 = true; + } + } + + if(!var15) { + if(var12 != var21) { + this.worldRenderersToUpdate.set(var12, var14); + } + + ++var12; + } + } + } + + while(true) { + --var21; + if(var21 < var12) { + return var8 == var9 + var10; + } + + this.worldRenderersToUpdate.remove(var21); + } + } + } + + public void drawBlockBreaking(EntityPlayer var1, MovingObjectPosition var2, int var3, ItemStack var4, float var5) { + Tessellator var6 = Tessellator.instance; + GL11.glEnable(GL11.GL_BLEND); + GL11.glEnable(GL11.GL_ALPHA_TEST); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); + GL11.glColor4f(1.0F, 1.0F, 1.0F, (MathHelper.sin((float)System.currentTimeMillis() / 100.0F) * 0.2F + 0.4F) * 0.5F); + int var8; + if(var3 == 0) { + if(this.damagePartialTime > 0.0F) { + GL11.glBlendFunc(GL11.GL_DST_COLOR, GL11.GL_SRC_COLOR); + int var7 = this.renderEngine.getTexture("/terrain.png"); + GL11.glBindTexture(GL11.GL_TEXTURE_2D, var7); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.5F); + GL11.glPushMatrix(); + var8 = this.worldObj.getBlockId(var2.blockX, var2.blockY, var2.blockZ); + Block var9 = var8 > 0 ? Block.blocksList[var8] : null; + GL11.glDisable(GL11.GL_ALPHA_TEST); + GL11.glPolygonOffset(-3.0F, -3.0F); + GL11.glEnable(GL11.GL_POLYGON_OFFSET_FILL); + double var10 = var1.lastTickPosX + (var1.posX - var1.lastTickPosX) * (double)var5; + double var12 = var1.lastTickPosY + (var1.posY - var1.lastTickPosY) * (double)var5; + double var14 = var1.lastTickPosZ + (var1.posZ - var1.lastTickPosZ) * (double)var5; + if(var9 == null) { + var9 = Block.stone; + } + + GL11.glEnable(GL11.GL_ALPHA_TEST); + var6.startDrawingQuads(); + var6.setTranslationD(-var10, -var12, -var14); + var6.disableColor(); + this.globalRenderBlocks.renderBlockUsingTexture(var9, var2.blockX, var2.blockY, var2.blockZ, 240 + (int)(this.damagePartialTime * 10.0F)); + var6.draw(); + var6.setTranslationD(0.0D, 0.0D, 0.0D); + GL11.glDisable(GL11.GL_ALPHA_TEST); + GL11.glPolygonOffset(0.0F, 0.0F); + GL11.glDisable(GL11.GL_POLYGON_OFFSET_FILL); + GL11.glEnable(GL11.GL_ALPHA_TEST); + GL11.glDepthMask(true); + GL11.glPopMatrix(); + } + } else if(var4 != null) { + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + float var16 = MathHelper.sin((float)System.currentTimeMillis() / 100.0F) * 0.2F + 0.8F; + GL11.glColor4f(var16, var16, var16, MathHelper.sin((float)System.currentTimeMillis() / 200.0F) * 0.2F + 0.5F); + var8 = this.renderEngine.getTexture("/terrain.png"); + GL11.glBindTexture(GL11.GL_TEXTURE_2D, var8); + int var17 = var2.blockX; + int var18 = var2.blockY; + int var11 = var2.blockZ; + if(var2.sideHit == 0) { + --var18; + } + + if(var2.sideHit == 1) { + ++var18; + } + + if(var2.sideHit == 2) { + --var11; + } + + if(var2.sideHit == 3) { + ++var11; + } + + if(var2.sideHit == 4) { + --var17; + } + + if(var2.sideHit == 5) { + ++var17; + } + } + + GL11.glDisable(GL11.GL_BLEND); + GL11.glDisable(GL11.GL_ALPHA_TEST); + } + + public void drawSelectionBox(EntityPlayer var1, MovingObjectPosition var2, int var3, ItemStack var4, float var5) { + if(var3 == 0 && var2.typeOfHit == EnumMovingObjectType.TILE) { + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + GL11.glColor4f(0.0F, 0.0F, 0.0F, 0.4F); + GL11.glLineWidth(2.0F); + GL11.glDisable(GL11.GL_TEXTURE_2D); + GL11.glDepthMask(false); + float var6 = 0.002F; + int var7 = this.worldObj.getBlockId(var2.blockX, var2.blockY, var2.blockZ); + if(var7 > 0) { + Block.blocksList[var7].setBlockBoundsBasedOnState(this.worldObj, var2.blockX, var2.blockY, var2.blockZ); + double var8 = var1.lastTickPosX + (var1.posX - var1.lastTickPosX) * (double)var5; + double var10 = var1.lastTickPosY + (var1.posY - var1.lastTickPosY) * (double)var5; + double var12 = var1.lastTickPosZ + (var1.posZ - var1.lastTickPosZ) * (double)var5; + this.drawOutlinedBoundingBox(Block.blocksList[var7].getSelectedBoundingBoxFromPool(this.worldObj, var2.blockX, var2.blockY, var2.blockZ).expand((double)var6, (double)var6, (double)var6).getOffsetBoundingBox(-var8, -var10, -var12)); + } + + GL11.glDepthMask(true); + GL11.glEnable(GL11.GL_TEXTURE_2D); + GL11.glDisable(GL11.GL_BLEND); + } + + } + + private void drawOutlinedBoundingBox(AxisAlignedBB var1) { + Tessellator var2 = Tessellator.instance; + var2.startDrawing(3); + var2.addVertex(var1.minX, var1.minY, var1.minZ); + var2.addVertex(var1.maxX, var1.minY, var1.minZ); + var2.addVertex(var1.maxX, var1.minY, var1.maxZ); + var2.addVertex(var1.minX, var1.minY, var1.maxZ); + var2.addVertex(var1.minX, var1.minY, var1.minZ); + var2.draw(); + var2.startDrawing(3); + var2.addVertex(var1.minX, var1.maxY, var1.minZ); + var2.addVertex(var1.maxX, var1.maxY, var1.minZ); + var2.addVertex(var1.maxX, var1.maxY, var1.maxZ); + var2.addVertex(var1.minX, var1.maxY, var1.maxZ); + var2.addVertex(var1.minX, var1.maxY, var1.minZ); + var2.draw(); + var2.startDrawing(1); + var2.addVertex(var1.minX, var1.minY, var1.minZ); + var2.addVertex(var1.minX, var1.maxY, var1.minZ); + var2.addVertex(var1.maxX, var1.minY, var1.minZ); + var2.addVertex(var1.maxX, var1.maxY, var1.minZ); + var2.addVertex(var1.maxX, var1.minY, var1.maxZ); + var2.addVertex(var1.maxX, var1.maxY, var1.maxZ); + var2.addVertex(var1.minX, var1.minY, var1.maxZ); + var2.addVertex(var1.minX, var1.maxY, var1.maxZ); + var2.draw(); + } + + public void func_949_a(int var1, int var2, int var3, int var4, int var5, int var6) { + int var7 = MathHelper.bucketInt(var1, 16); + int var8 = MathHelper.bucketInt(var2, 16); + int var9 = MathHelper.bucketInt(var3, 16); + int var10 = MathHelper.bucketInt(var4, 16); + int var11 = MathHelper.bucketInt(var5, 16); + int var12 = MathHelper.bucketInt(var6, 16); + + for(int var13 = var7; var13 <= var10; ++var13) { + int var14 = var13 % this.renderChunksWide; + if(var14 < 0) { + var14 += this.renderChunksWide; + } + + for(int var15 = var8; var15 <= var11; ++var15) { + int var16 = var15 % this.renderChunksTall; + if(var16 < 0) { + var16 += this.renderChunksTall; + } + + for(int var17 = var9; var17 <= var12; ++var17) { + int var18 = var17 % this.renderChunksDeep; + if(var18 < 0) { + var18 += this.renderChunksDeep; + } + + int var19 = (var18 * this.renderChunksTall + var16) * this.renderChunksWide + var14; + WorldRenderer var20 = this.worldRenderers[var19]; + if(!var20.needsUpdate) { + this.worldRenderersToUpdate.add(var20); + var20.markDirty(); + } + } + } + } + + } + + public void markBlockAndNeighborsNeedsUpdate(int var1, int var2, int var3) { + this.func_949_a(var1 - 1, var2 - 1, var3 - 1, var1 + 1, var2 + 1, var3 + 1); + } + + public void markBlockRangeNeedsUpdate(int var1, int var2, int var3, int var4, int var5, int var6) { + this.func_949_a(var1 - 1, var2 - 1, var3 - 1, var4 + 1, var5 + 1, var6 + 1); + } + + public void clipRenderersByFrustrum(ICamera var1, float var2) { + for(int var3 = 0; var3 < this.worldRenderers.length; ++var3) { + if(!this.worldRenderers[var3].skipAllRenderPasses() && (!this.worldRenderers[var3].isInFrustum || (var3 + this.frustrumCheckOffset & 15) == 0)) { + this.worldRenderers[var3].updateInFrustrum(var1); + } + } + + ++this.frustrumCheckOffset; + } + + public void playRecord(String var1, int var2, int var3, int var4) { + if(var1 != null) { + this.mc.ingameGUI.setRecordPlayingMessage("C418 - " + var1); + } + + this.mc.sndManager.playStreaming(var1, (float)var2, (float)var3, (float)var4, 1.0F, 1.0F); + } + + public void playSound(String var1, double var2, double var4, double var6, float var8, float var9) { + float var10 = 16.0F; + if(var8 > 1.0F) { + var10 *= var8; + } + + if(this.mc.renderViewEntity.getDistanceSq(var2, var4, var6) < (double)(var10 * var10)) { + this.mc.sndManager.playSound(var1, (float)var2, (float)var4, (float)var6, var8, var9); + } + + } + + public void spawnParticle(String var1, double var2, double var4, double var6, double var8, double var10, double var12) { + if(this.mc != null && this.mc.renderViewEntity != null && this.mc.effectRenderer != null) { + double var14 = this.mc.renderViewEntity.posX - var2; + double var16 = this.mc.renderViewEntity.posY - var4; + double var18 = this.mc.renderViewEntity.posZ - var6; + double var20 = 16.0D; + if(var14 * var14 + var16 * var16 + var18 * var18 <= var20 * var20) { + if(var1.equals("bubble")) { + this.mc.effectRenderer.addEffect(new EntityBubbleFX(this.worldObj, var2, var4, var6, var8, var10, var12)); + } else if(var1.equals("smoke")) { + this.mc.effectRenderer.addEffect(new EntitySmokeFX(this.worldObj, var2, var4, var6, var8, var10, var12)); + } else if(var1.equals("note")) { + this.mc.effectRenderer.addEffect(new EntityNoteFX(this.worldObj, var2, var4, var6, var8, var10, var12)); + } else if(var1.equals("portal")) { + this.mc.effectRenderer.addEffect(new EntityPortalFX(this.worldObj, var2, var4, var6, var8, var10, var12)); + } else if(var1.equals("explode")) { + this.mc.effectRenderer.addEffect(new EntityExplodeFX(this.worldObj, var2, var4, var6, var8, var10, var12)); + } else if(var1.equals("flame")) { + this.mc.effectRenderer.addEffect(new EntityFlameFX(this.worldObj, var2, var4, var6, var8, var10, var12)); + } else if(var1.equals("lava")) { + this.mc.effectRenderer.addEffect(new EntityLavaFX(this.worldObj, var2, var4, var6)); + } else if(var1.equals("footstep")) { + this.mc.effectRenderer.addEffect(new EntityFootStepFX(this.renderEngine, this.worldObj, var2, var4, var6)); + } else if(var1.equals("splash")) { + this.mc.effectRenderer.addEffect(new EntitySplashFX(this.worldObj, var2, var4, var6, var8, var10, var12)); + } else if(var1.equals("largesmoke")) { + this.mc.effectRenderer.addEffect(new EntitySmokeFX(this.worldObj, var2, var4, var6, var8, var10, var12, 2.5F)); + } else if(var1.equals("reddust")) { + this.mc.effectRenderer.addEffect(new EntityReddustFX(this.worldObj, var2, var4, var6, (float)var8, (float)var10, (float)var12)); + } else if(var1.equals("snowballpoof")) { + this.mc.effectRenderer.addEffect(new EntitySlimeFX(this.worldObj, var2, var4, var6, Item.snowball)); + } else if(var1.equals("snowshovel")) { + this.mc.effectRenderer.addEffect(new EntitySnowShovelFX(this.worldObj, var2, var4, var6, var8, var10, var12)); + } else if(var1.equals("slime")) { + this.mc.effectRenderer.addEffect(new EntitySlimeFX(this.worldObj, var2, var4, var6, Item.slimeBall)); + } else if(var1.equals("heart")) { + this.mc.effectRenderer.addEffect(new EntityHeartFX(this.worldObj, var2, var4, var6, var8, var10, var12)); + } + + } + } + } + + public void obtainEntitySkin(Entity var1) { + var1.updateCloak(); + if(var1.skinUrl != null) { + this.renderEngine.obtainImageData(var1.skinUrl, new ImageBufferDownload()); + } + + if(var1.cloakUrl != null) { + this.renderEngine.obtainImageData(var1.cloakUrl, new ImageBufferDownload()); + } + + } + + public void releaseEntitySkin(Entity var1) { + if(var1.skinUrl != null) { + this.renderEngine.releaseImageData(var1.skinUrl); + } + + if(var1.cloakUrl != null) { + this.renderEngine.releaseImageData(var1.cloakUrl); + } + + } + + public void updateAllRenderers() { + for(int var1 = 0; var1 < this.worldRenderers.length; ++var1) { + if(this.worldRenderers[var1].isChunkLit && !this.worldRenderers[var1].needsUpdate) { + this.worldRenderersToUpdate.add(this.worldRenderers[var1]); + this.worldRenderers[var1].markDirty(); + } + } + + } + + public void doNothingWithTileEntity(int var1, int var2, int var3, TileEntity var4) { + } + + public void func_28137_f() { + GLAllocation.func_28194_b(this.glRenderListBase); + } + + public void func_28136_a(EntityPlayer var1, int var2, int var3, int var4, int var5, int var6) { + Random var7 = this.worldObj.rand; + int var16; + switch(var2) { + case 1000: + this.worldObj.playSoundEffect((double)var3, (double)var4, (double)var5, "random.click", 1.0F, 1.0F); + break; + case 1001: + this.worldObj.playSoundEffect((double)var3, (double)var4, (double)var5, "random.click", 1.0F, 1.2F); + break; + case 1002: + this.worldObj.playSoundEffect((double)var3, (double)var4, (double)var5, "random.bow", 1.0F, 1.2F); + break; + case 1003: + if(Math.random() < 0.5D) { + this.worldObj.playSoundEffect((double)var3 + 0.5D, (double)var4 + 0.5D, (double)var5 + 0.5D, "random.door_open", 1.0F, this.worldObj.rand.nextFloat() * 0.1F + 0.9F); + } else { + this.worldObj.playSoundEffect((double)var3 + 0.5D, (double)var4 + 0.5D, (double)var5 + 0.5D, "random.door_close", 1.0F, this.worldObj.rand.nextFloat() * 0.1F + 0.9F); + } + break; + case 1004: + this.worldObj.playSoundEffect((double)((float)var3 + 0.5F), (double)((float)var4 + 0.5F), (double)((float)var5 + 0.5F), "random.fizz", 0.5F, 2.6F + (var7.nextFloat() - var7.nextFloat()) * 0.8F); + break; + case 1005: + if(Item.itemsList[var6] instanceof ItemRecord) { + this.worldObj.playRecord(((ItemRecord)Item.itemsList[var6]).recordName, var3, var4, var5); + } else { + this.worldObj.playRecord((String)null, var3, var4, var5); + } + break; + case 2000: + int var8 = var6 % 3 - 1; + int var9 = var6 / 3 % 3 - 1; + double var10 = (double)var3 + (double)var8 * 0.6D + 0.5D; + double var12 = (double)var4 + 0.5D; + double var14 = (double)var5 + (double)var9 * 0.6D + 0.5D; + + for(var16 = 0; var16 < 10; ++var16) { + double var31 = var7.nextDouble() * 0.2D + 0.01D; + double var19 = var10 + (double)var8 * 0.01D + (var7.nextDouble() - 0.5D) * (double)var9 * 0.5D; + double var21 = var12 + (var7.nextDouble() - 0.5D) * 0.5D; + double var23 = var14 + (double)var9 * 0.01D + (var7.nextDouble() - 0.5D) * (double)var8 * 0.5D; + double var25 = (double)var8 * var31 + var7.nextGaussian() * 0.01D; + double var27 = -0.03D + var7.nextGaussian() * 0.01D; + double var29 = (double)var9 * var31 + var7.nextGaussian() * 0.01D; + this.spawnParticle("smoke", var19, var21, var23, var25, var27, var29); + } + + return; + case 2001: + var16 = var6 & 255; + if(var16 > 0) { + Block var17 = Block.blocksList[var16]; + this.mc.sndManager.playSound(var17.stepSound.stepSoundDir(), (float)var3 + 0.5F, (float)var4 + 0.5F, (float)var5 + 0.5F, (var17.stepSound.getVolume() + 1.0F) / 2.0F, var17.stepSound.getPitch() * 0.8F); + } + + this.mc.effectRenderer.addBlockDestroyEffects(var3, var4, var5, var6 & 255, var6 >> 8 & 255); + } + + } +} diff --git a/src/net/minecraft/src/RenderHelper.java b/src/net/minecraft/src/RenderHelper.java new file mode 100644 index 0000000..86d5f99 --- /dev/null +++ b/src/net/minecraft/src/RenderHelper.java @@ -0,0 +1,49 @@ +package net.minecraft.src; + +import java.nio.FloatBuffer; +import org.lwjgl.opengl.GL11; + +public class RenderHelper { + private static FloatBuffer field_1695_a = GLAllocation.createDirectFloatBuffer(16); + + public static void disableStandardItemLighting() { + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glDisable(GL11.GL_LIGHT0); + GL11.glDisable(GL11.GL_LIGHT1); + GL11.glDisable(GL11.GL_COLOR_MATERIAL); + } + + public static void enableStandardItemLighting() { + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glEnable(GL11.GL_LIGHT0); + GL11.glEnable(GL11.GL_LIGHT1); + GL11.glEnable(GL11.GL_COLOR_MATERIAL); + GL11.glColorMaterial(GL11.GL_FRONT_AND_BACK, GL11.GL_AMBIENT_AND_DIFFUSE); + float var0 = 0.4F; + float var1 = 0.6F; + float var2 = 0.0F; + Vec3D var3 = Vec3D.createVector((double)0.2F, 1.0D, (double)-0.7F).normalize(); + GL11.glLight(GL11.GL_LIGHT0, GL11.GL_POSITION, func_1157_a(var3.xCoord, var3.yCoord, var3.zCoord, 0.0D)); + GL11.glLight(GL11.GL_LIGHT0, GL11.GL_DIFFUSE, func_1156_a(var1, var1, var1, 1.0F)); + GL11.glLight(GL11.GL_LIGHT0, GL11.GL_AMBIENT, func_1156_a(0.0F, 0.0F, 0.0F, 1.0F)); + GL11.glLight(GL11.GL_LIGHT0, GL11.GL_SPECULAR, func_1156_a(var2, var2, var2, 1.0F)); + var3 = Vec3D.createVector((double)-0.2F, 1.0D, (double)0.7F).normalize(); + GL11.glLight(GL11.GL_LIGHT1, GL11.GL_POSITION, func_1157_a(var3.xCoord, var3.yCoord, var3.zCoord, 0.0D)); + GL11.glLight(GL11.GL_LIGHT1, GL11.GL_DIFFUSE, func_1156_a(var1, var1, var1, 1.0F)); + GL11.glLight(GL11.GL_LIGHT1, GL11.GL_AMBIENT, func_1156_a(0.0F, 0.0F, 0.0F, 1.0F)); + GL11.glLight(GL11.GL_LIGHT1, GL11.GL_SPECULAR, func_1156_a(var2, var2, var2, 1.0F)); + GL11.glShadeModel(GL11.GL_FLAT); + GL11.glLightModel(GL11.GL_LIGHT_MODEL_AMBIENT, func_1156_a(var0, var0, var0, 1.0F)); + } + + private static FloatBuffer func_1157_a(double var0, double var2, double var4, double var6) { + return func_1156_a((float)var0, (float)var2, (float)var4, (float)var6); + } + + private static FloatBuffer func_1156_a(float var0, float var1, float var2, float var3) { + field_1695_a.clear(); + field_1695_a.put(var0).put(var1).put(var2).put(var3); + field_1695_a.flip(); + return field_1695_a; + } +} diff --git a/src/net/minecraft/src/RenderItem.java b/src/net/minecraft/src/RenderItem.java new file mode 100644 index 0000000..da0b2f9 --- /dev/null +++ b/src/net/minecraft/src/RenderItem.java @@ -0,0 +1,230 @@ +package net.minecraft.src; + +import java.util.Random; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +public class RenderItem extends Render { + private RenderBlocks renderBlocks = new RenderBlocks(); + private Random random = new Random(); + public boolean field_27004_a = true; + + public RenderItem() { + this.shadowSize = 0.15F; + this.field_194_c = 12.0F / 16.0F; + } + + public void doRenderItem(EntityItem var1, double var2, double var4, double var6, float var8, float var9) { + this.random.setSeed(187L); + ItemStack var10 = var1.item; + GL11.glPushMatrix(); + float var11 = MathHelper.sin(((float)var1.age + var9) / 10.0F + var1.field_804_d) * 0.1F + 0.1F; + float var12 = (((float)var1.age + var9) / 20.0F + var1.field_804_d) * (180.0F / (float)Math.PI); + byte var13 = 1; + if(var1.item.stackSize > 1) { + var13 = 2; + } + + if(var1.item.stackSize > 5) { + var13 = 3; + } + + if(var1.item.stackSize > 20) { + var13 = 4; + } + + GL11.glTranslatef((float)var2, (float)var4 + var11, (float)var6); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + float var16; + float var17; + float var18; + if(var10.itemID < 256 && RenderBlocks.renderItemIn3d(Block.blocksList[var10.itemID].getRenderType())) { + GL11.glRotatef(var12, 0.0F, 1.0F, 0.0F); + this.loadTexture("/terrain.png"); + float var28 = 0.25F; + if(!Block.blocksList[var10.itemID].renderAsNormalBlock() && var10.itemID != Block.stairSingle.blockID && Block.blocksList[var10.itemID].getRenderType() != 16) { + var28 = 0.5F; + } + + GL11.glScalef(var28, var28, var28); + + for(int var29 = 0; var29 < var13; ++var29) { + GL11.glPushMatrix(); + if(var29 > 0) { + var16 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.2F / var28; + var17 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.2F / var28; + var18 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.2F / var28; + GL11.glTranslatef(var16, var17, var18); + } + + this.renderBlocks.renderBlockOnInventory(Block.blocksList[var10.itemID], var10.getItemDamage(), var1.getEntityBrightness(var9)); + GL11.glPopMatrix(); + } + } else { + GL11.glScalef(0.5F, 0.5F, 0.5F); + int var14 = var10.getIconIndex(); + if(var10.itemID < 256) { + this.loadTexture("/terrain.png"); + } else { + this.loadTexture("/gui/items.png"); + } + + Tessellator var15 = Tessellator.instance; + var16 = (float)(var14 % 16 * 16 + 0) / 256.0F; + var17 = (float)(var14 % 16 * 16 + 16) / 256.0F; + var18 = (float)(var14 / 16 * 16 + 0) / 256.0F; + float var19 = (float)(var14 / 16 * 16 + 16) / 256.0F; + float var20 = 1.0F; + float var21 = 0.5F; + float var22 = 0.25F; + int var23; + float var24; + float var25; + float var26; + if(this.field_27004_a) { + var23 = Item.itemsList[var10.itemID].getColorFromDamage(var10.getItemDamage()); + var24 = (float)(var23 >> 16 & 255) / 255.0F; + var25 = (float)(var23 >> 8 & 255) / 255.0F; + var26 = (float)(var23 & 255) / 255.0F; + float var27 = var1.getEntityBrightness(var9); + GL11.glColor4f(var24 * var27, var25 * var27, var26 * var27, 1.0F); + } + + for(var23 = 0; var23 < var13; ++var23) { + GL11.glPushMatrix(); + if(var23 > 0) { + var24 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.3F; + var25 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.3F; + var26 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.3F; + GL11.glTranslatef(var24, var25, var26); + } + + GL11.glRotatef(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F); + var15.startDrawingQuads(); + var15.setNormal(0.0F, 1.0F, 0.0F); + var15.addVertexWithUV((double)(0.0F - var21), (double)(0.0F - var22), 0.0D, (double)var16, (double)var19); + var15.addVertexWithUV((double)(var20 - var21), (double)(0.0F - var22), 0.0D, (double)var17, (double)var19); + var15.addVertexWithUV((double)(var20 - var21), (double)(1.0F - var22), 0.0D, (double)var17, (double)var18); + var15.addVertexWithUV((double)(0.0F - var21), (double)(1.0F - var22), 0.0D, (double)var16, (double)var18); + var15.draw(); + GL11.glPopMatrix(); + } + } + + GL11.glDisable(GL12.GL_RESCALE_NORMAL); + GL11.glPopMatrix(); + } + + public void drawItemIntoGui(FontRenderer var1, RenderEngine var2, int var3, int var4, int var5, int var6, int var7) { + float var11; + if(var3 < 256 && RenderBlocks.renderItemIn3d(Block.blocksList[var3].getRenderType())) { + var2.bindTexture(var2.getTexture("/terrain.png")); + Block var14 = Block.blocksList[var3]; + GL11.glPushMatrix(); + GL11.glTranslatef((float)(var6 - 2), (float)(var7 + 3), -3.0F); + GL11.glScalef(10.0F, 10.0F, 10.0F); + GL11.glTranslatef(1.0F, 0.5F, 1.0F); + GL11.glScalef(1.0F, 1.0F, -1.0F); + GL11.glRotatef(210.0F, 1.0F, 0.0F, 0.0F); + GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F); + int var15 = Item.itemsList[var3].getColorFromDamage(var4); + var11 = (float)(var15 >> 16 & 255) / 255.0F; + float var12 = (float)(var15 >> 8 & 255) / 255.0F; + float var13 = (float)(var15 & 255) / 255.0F; + if(this.field_27004_a) { + GL11.glColor4f(var11, var12, var13, 1.0F); + } + + GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F); + this.renderBlocks.field_31088_b = this.field_27004_a; + this.renderBlocks.renderBlockOnInventory(var14, var4, 1.0F); + this.renderBlocks.field_31088_b = true; + GL11.glPopMatrix(); + } else if(var5 >= 0) { + GL11.glDisable(GL11.GL_LIGHTING); + if(var3 < 256) { + var2.bindTexture(var2.getTexture("/terrain.png")); + } else { + var2.bindTexture(var2.getTexture("/gui/items.png")); + } + + int var8 = Item.itemsList[var3].getColorFromDamage(var4); + float var9 = (float)(var8 >> 16 & 255) / 255.0F; + float var10 = (float)(var8 >> 8 & 255) / 255.0F; + var11 = (float)(var8 & 255) / 255.0F; + if(this.field_27004_a) { + GL11.glColor4f(var9, var10, var11, 1.0F); + } + + this.renderTexturedQuad(var6, var7, var5 % 16 * 16, var5 / 16 * 16, 16, 16); + GL11.glEnable(GL11.GL_LIGHTING); + } + + GL11.glEnable(GL11.GL_CULL_FACE); + } + + public void renderItemIntoGUI(FontRenderer var1, RenderEngine var2, ItemStack var3, int var4, int var5) { + if(var3 != null) { + this.drawItemIntoGui(var1, var2, var3.itemID, var3.getItemDamage(), var3.getIconIndex(), var4, var5); + } + } + + public void renderItemOverlayIntoGUI(FontRenderer var1, RenderEngine var2, ItemStack var3, int var4, int var5) { + if(var3 != null) { + if(var3.stackSize > 1) { + String var6 = "" + var3.stackSize; + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glDisable(GL11.GL_DEPTH_TEST); + var1.drawStringWithShadow(var6, var4 + 19 - 2 - var1.getStringWidth(var6), var5 + 6 + 3, 16777215); + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glEnable(GL11.GL_DEPTH_TEST); + } + + if(var3.isItemDamaged()) { + int var11 = (int)Math.round(13.0D - (double)var3.getItemDamageForDisplay() * 13.0D / (double)var3.getMaxDamage()); + int var7 = (int)Math.round(255.0D - (double)var3.getItemDamageForDisplay() * 255.0D / (double)var3.getMaxDamage()); + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glDisable(GL11.GL_DEPTH_TEST); + GL11.glDisable(GL11.GL_TEXTURE_2D); + Tessellator var8 = Tessellator.instance; + int var9 = 255 - var7 << 16 | var7 << 8; + int var10 = (255 - var7) / 4 << 16 | 16128; + this.renderQuad(var8, var4 + 2, var5 + 13, 13, 2, 0); + this.renderQuad(var8, var4 + 2, var5 + 13, 12, 1, var10); + this.renderQuad(var8, var4 + 2, var5 + 13, var11, 1, var9); + GL11.glEnable(GL11.GL_TEXTURE_2D); + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glEnable(GL11.GL_DEPTH_TEST); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + } + + } + } + + private void renderQuad(Tessellator var1, int var2, int var3, int var4, int var5, int var6) { + var1.startDrawingQuads(); + var1.setColorOpaque_I(var6); + var1.addVertex((double)(var2 + 0), (double)(var3 + 0), 0.0D); + var1.addVertex((double)(var2 + 0), (double)(var3 + var5), 0.0D); + var1.addVertex((double)(var2 + var4), (double)(var3 + var5), 0.0D); + var1.addVertex((double)(var2 + var4), (double)(var3 + 0), 0.0D); + var1.draw(); + } + + public void renderTexturedQuad(int var1, int var2, int var3, int var4, int var5, int var6) { + float var7 = 0.0F; + float var8 = 0.00390625F; + float var9 = 0.00390625F; + Tessellator var10 = Tessellator.instance; + var10.startDrawingQuads(); + var10.addVertexWithUV((double)(var1 + 0), (double)(var2 + var6), (double)var7, (double)((float)(var3 + 0) * var8), (double)((float)(var4 + var6) * var9)); + var10.addVertexWithUV((double)(var1 + var5), (double)(var2 + var6), (double)var7, (double)((float)(var3 + var5) * var8), (double)((float)(var4 + var6) * var9)); + var10.addVertexWithUV((double)(var1 + var5), (double)(var2 + 0), (double)var7, (double)((float)(var3 + var5) * var8), (double)((float)(var4 + 0) * var9)); + var10.addVertexWithUV((double)(var1 + 0), (double)(var2 + 0), (double)var7, (double)((float)(var3 + 0) * var8), (double)((float)(var4 + 0) * var9)); + var10.draw(); + } + + public void doRender(Entity var1, double var2, double var4, double var6, float var8, float var9) { + this.doRenderItem((EntityItem)var1, var2, var4, var6, var8, var9); + } +} diff --git a/src/net/minecraft/src/RenderLightningBolt.java b/src/net/minecraft/src/RenderLightningBolt.java new file mode 100644 index 0000000..f85a23d --- /dev/null +++ b/src/net/minecraft/src/RenderLightningBolt.java @@ -0,0 +1,105 @@ +package net.minecraft.src; + +import java.util.Random; +import org.lwjgl.opengl.GL11; + +public class RenderLightningBolt extends Render { + public void func_27002_a(EntityLightningBolt var1, double var2, double var4, double var6, float var8, float var9) { + Tessellator var10 = Tessellator.instance; + GL11.glDisable(GL11.GL_TEXTURE_2D); + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); + double[] var11 = new double[8]; + double[] var12 = new double[8]; + double var13 = 0.0D; + double var15 = 0.0D; + Random var17 = new Random(var1.field_27029_a); + + for(int var18 = 7; var18 >= 0; --var18) { + var11[var18] = var13; + var12[var18] = var15; + var13 += (double)(var17.nextInt(11) - 5); + var15 += (double)(var17.nextInt(11) - 5); + } + + for(int var45 = 0; var45 < 4; ++var45) { + Random var46 = new Random(var1.field_27029_a); + + for(int var19 = 0; var19 < 3; ++var19) { + int var20 = 7; + int var21 = 0; + if(var19 > 0) { + var20 = 7 - var19; + } + + if(var19 > 0) { + var21 = var20 - 2; + } + + double var22 = var11[var20] - var13; + double var24 = var12[var20] - var15; + + for(int var26 = var20; var26 >= var21; --var26) { + double var27 = var22; + double var29 = var24; + if(var19 == 0) { + var22 += (double)(var46.nextInt(11) - 5); + var24 += (double)(var46.nextInt(11) - 5); + } else { + var22 += (double)(var46.nextInt(31) - 15); + var24 += (double)(var46.nextInt(31) - 15); + } + + var10.startDrawing(5); + float var31 = 0.5F; + var10.setColorRGBA_F(0.9F * var31, 0.9F * var31, 1.0F * var31, 0.3F); + double var32 = 0.1D + (double)var45 * 0.2D; + if(var19 == 0) { + var32 *= (double)var26 * 0.1D + 1.0D; + } + + double var34 = 0.1D + (double)var45 * 0.2D; + if(var19 == 0) { + var34 *= (double)(var26 - 1) * 0.1D + 1.0D; + } + + for(int var36 = 0; var36 < 5; ++var36) { + double var37 = var2 + 0.5D - var32; + double var39 = var6 + 0.5D - var32; + if(var36 == 1 || var36 == 2) { + var37 += var32 * 2.0D; + } + + if(var36 == 2 || var36 == 3) { + var39 += var32 * 2.0D; + } + + double var41 = var2 + 0.5D - var34; + double var43 = var6 + 0.5D - var34; + if(var36 == 1 || var36 == 2) { + var41 += var34 * 2.0D; + } + + if(var36 == 2 || var36 == 3) { + var43 += var34 * 2.0D; + } + + var10.addVertex(var41 + var22, var4 + (double)(var26 * 16), var43 + var24); + var10.addVertex(var37 + var27, var4 + (double)((var26 + 1) * 16), var39 + var29); + } + + var10.draw(); + } + } + } + + GL11.glDisable(GL11.GL_BLEND); + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glEnable(GL11.GL_TEXTURE_2D); + } + + public void doRender(Entity var1, double var2, double var4, double var6, float var8, float var9) { + this.func_27002_a((EntityLightningBolt)var1, var2, var4, var6, var8, var9); + } +} diff --git a/src/net/minecraft/src/RenderList.java b/src/net/minecraft/src/RenderList.java new file mode 100644 index 0000000..29afa79 --- /dev/null +++ b/src/net/minecraft/src/RenderList.java @@ -0,0 +1,61 @@ +package net.minecraft.src; + +import java.nio.IntBuffer; +import org.lwjgl.opengl.GL11; + +public class RenderList { + private int field_1242_a; + private int field_1241_b; + private int field_1240_c; + private float field_1239_d; + private float field_1238_e; + private float field_1237_f; + private IntBuffer field_1236_g = GLAllocation.createDirectIntBuffer(65536); + private boolean field_1235_h = false; + private boolean field_1234_i = false; + + public void func_861_a(int var1, int var2, int var3, double var4, double var6, double var8) { + this.field_1235_h = true; + this.field_1236_g.clear(); + this.field_1242_a = var1; + this.field_1241_b = var2; + this.field_1240_c = var3; + this.field_1239_d = (float)var4; + this.field_1238_e = (float)var6; + this.field_1237_f = (float)var8; + } + + public boolean func_862_a(int var1, int var2, int var3) { + return !this.field_1235_h ? false : var1 == this.field_1242_a && var2 == this.field_1241_b && var3 == this.field_1240_c; + } + + public void func_858_a(int var1) { + this.field_1236_g.put(var1); + if(this.field_1236_g.remaining() == 0) { + this.func_860_a(); + } + + } + + public void func_860_a() { + if(this.field_1235_h) { + if(!this.field_1234_i) { + this.field_1236_g.flip(); + this.field_1234_i = true; + } + + if(this.field_1236_g.remaining() > 0) { + GL11.glPushMatrix(); + GL11.glTranslatef((float)this.field_1242_a - this.field_1239_d, (float)this.field_1241_b - this.field_1238_e, (float)this.field_1240_c - this.field_1237_f); + GL11.glCallLists(this.field_1236_g); + GL11.glPopMatrix(); + } + + } + } + + public void func_859_b() { + this.field_1235_h = false; + this.field_1234_i = false; + } +} diff --git a/src/net/minecraft/src/RenderLiving.java b/src/net/minecraft/src/RenderLiving.java new file mode 100644 index 0000000..f925389 --- /dev/null +++ b/src/net/minecraft/src/RenderLiving.java @@ -0,0 +1,219 @@ +package net.minecraft.src; + +import net.minecraft.client.Minecraft; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +public class RenderLiving extends Render { + protected ModelBase mainModel; + protected ModelBase renderPassModel; + + public RenderLiving(ModelBase var1, float var2) { + this.mainModel = var1; + this.shadowSize = var2; + } + + public void setRenderPassModel(ModelBase var1) { + this.renderPassModel = var1; + } + + public void doRenderLiving(EntityLiving var1, double var2, double var4, double var6, float var8, float var9) { + GL11.glPushMatrix(); + GL11.glDisable(GL11.GL_CULL_FACE); + this.mainModel.onGround = this.func_167_c(var1, var9); + if(this.renderPassModel != null) { + this.renderPassModel.onGround = this.mainModel.onGround; + } + + this.mainModel.isRiding = var1.isRiding(); + if(this.renderPassModel != null) { + this.renderPassModel.isRiding = this.mainModel.isRiding; + } + + try { + float var10 = var1.prevRenderYawOffset + (var1.renderYawOffset - var1.prevRenderYawOffset) * var9; + float var11 = var1.prevRotationYaw + (var1.rotationYaw - var1.prevRotationYaw) * var9; + float var12 = var1.prevRotationPitch + (var1.rotationPitch - var1.prevRotationPitch) * var9; + this.func_22012_b(var1, var2, var4, var6); + float var13 = this.func_170_d(var1, var9); + this.rotateCorpse(var1, var13, var10, var9); + float var14 = 1.0F / 16.0F; + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + GL11.glScalef(-1.0F, -1.0F, 1.0F); + this.preRenderCallback(var1, var9); + GL11.glTranslatef(0.0F, -24.0F * var14 - 0.0078125F, 0.0F); + float var15 = var1.field_705_Q + (var1.field_704_R - var1.field_705_Q) * var9; + float var16 = var1.field_703_S - var1.field_704_R * (1.0F - var9); + if(var15 > 1.0F) { + var15 = 1.0F; + } + + this.loadDownloadableImageTexture(var1.skinUrl, var1.getEntityTexture()); + GL11.glEnable(GL11.GL_ALPHA_TEST); + this.mainModel.setLivingAnimations(var1, var16, var15, var9); + this.mainModel.render(var16, var15, var13, var11 - var10, var12, var14); + + for(int var17 = 0; var17 < 4; ++var17) { + if(this.shouldRenderPass(var1, var17, var9)) { + this.renderPassModel.render(var16, var15, var13, var11 - var10, var12, var14); + GL11.glDisable(GL11.GL_BLEND); + GL11.glEnable(GL11.GL_ALPHA_TEST); + } + } + + this.renderEquippedItems(var1, var9); + float var25 = var1.getEntityBrightness(var9); + int var18 = this.getColorMultiplier(var1, var25, var9); + if((var18 >> 24 & 255) > 0 || var1.hurtTime > 0 || var1.deathTime > 0) { + GL11.glDisable(GL11.GL_TEXTURE_2D); + GL11.glDisable(GL11.GL_ALPHA_TEST); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + GL11.glDepthFunc(GL11.GL_EQUAL); + if(var1.hurtTime > 0 || var1.deathTime > 0) { + GL11.glColor4f(var25, 0.0F, 0.0F, 0.4F); + this.mainModel.render(var16, var15, var13, var11 - var10, var12, var14); + + for(int var19 = 0; var19 < 4; ++var19) { + if(this.func_27005_b(var1, var19, var9)) { + GL11.glColor4f(var25, 0.0F, 0.0F, 0.4F); + this.renderPassModel.render(var16, var15, var13, var11 - var10, var12, var14); + } + } + } + + if((var18 >> 24 & 255) > 0) { + float var26 = (float)(var18 >> 16 & 255) / 255.0F; + float var20 = (float)(var18 >> 8 & 255) / 255.0F; + float var21 = (float)(var18 & 255) / 255.0F; + float var22 = (float)(var18 >> 24 & 255) / 255.0F; + GL11.glColor4f(var26, var20, var21, var22); + this.mainModel.render(var16, var15, var13, var11 - var10, var12, var14); + + for(int var23 = 0; var23 < 4; ++var23) { + if(this.func_27005_b(var1, var23, var9)) { + GL11.glColor4f(var26, var20, var21, var22); + this.renderPassModel.render(var16, var15, var13, var11 - var10, var12, var14); + } + } + } + + GL11.glDepthFunc(GL11.GL_LEQUAL); + GL11.glDisable(GL11.GL_BLEND); + GL11.glEnable(GL11.GL_ALPHA_TEST); + GL11.glEnable(GL11.GL_TEXTURE_2D); + } + + GL11.glDisable(GL12.GL_RESCALE_NORMAL); + } catch (Exception var24) { + var24.printStackTrace(); + } + + GL11.glEnable(GL11.GL_CULL_FACE); + GL11.glPopMatrix(); + this.passSpecialRender(var1, var2, var4, var6); + } + + protected void func_22012_b(EntityLiving var1, double var2, double var4, double var6) { + GL11.glTranslatef((float)var2, (float)var4, (float)var6); + } + + protected void rotateCorpse(EntityLiving var1, float var2, float var3, float var4) { + GL11.glRotatef(180.0F - var3, 0.0F, 1.0F, 0.0F); + if(var1.deathTime > 0) { + float var5 = ((float)var1.deathTime + var4 - 1.0F) / 20.0F * 1.6F; + var5 = MathHelper.sqrt_float(var5); + if(var5 > 1.0F) { + var5 = 1.0F; + } + + GL11.glRotatef(var5 * this.getDeathMaxRotation(var1), 0.0F, 0.0F, 1.0F); + } + + } + + protected float func_167_c(EntityLiving var1, float var2) { + return var1.getSwingProgress(var2); + } + + protected float func_170_d(EntityLiving var1, float var2) { + return (float)var1.ticksExisted + var2; + } + + protected void renderEquippedItems(EntityLiving var1, float var2) { + } + + protected boolean func_27005_b(EntityLiving var1, int var2, float var3) { + return this.shouldRenderPass(var1, var2, var3); + } + + protected boolean shouldRenderPass(EntityLiving var1, int var2, float var3) { + return false; + } + + protected float getDeathMaxRotation(EntityLiving var1) { + return 90.0F; + } + + protected int getColorMultiplier(EntityLiving var1, float var2, float var3) { + return 0; + } + + protected void preRenderCallback(EntityLiving var1, float var2) { + } + + protected void passSpecialRender(EntityLiving var1, double var2, double var4, double var6) { + if(Minecraft.isDebugInfoEnabled()) { + this.renderLivingLabel(var1, Integer.toString(var1.entityId), var2, var4, var6, 64); + } + + } + + protected void renderLivingLabel(EntityLiving var1, String var2, double var3, double var5, double var7, int var9) { + float var10 = var1.getDistanceToEntity(this.renderManager.livingPlayer); + if(var10 <= (float)var9) { + FontRenderer var11 = this.getFontRendererFromRenderManager(); + float var12 = 1.6F; + float var13 = (float)(1.0D / 60.0D) * var12; + GL11.glPushMatrix(); + GL11.glTranslatef((float)var3 + 0.0F, (float)var5 + 2.3F, (float)var7); + GL11.glNormal3f(0.0F, 1.0F, 0.0F); + GL11.glRotatef(-this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F); + GL11.glScalef(-var13, -var13, var13); + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glDepthMask(false); + GL11.glDisable(GL11.GL_DEPTH_TEST); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + Tessellator var14 = Tessellator.instance; + byte var15 = 0; + if(var2.equals("deadmau5")) { + var15 = -10; + } + + GL11.glDisable(GL11.GL_TEXTURE_2D); + var14.startDrawingQuads(); + int var16 = var11.getStringWidth(var2) / 2; + var14.setColorRGBA_F(0.0F, 0.0F, 0.0F, 0.25F); + var14.addVertex((double)(-var16 - 1), (double)(-1 + var15), 0.0D); + var14.addVertex((double)(-var16 - 1), (double)(8 + var15), 0.0D); + var14.addVertex((double)(var16 + 1), (double)(8 + var15), 0.0D); + var14.addVertex((double)(var16 + 1), (double)(-1 + var15), 0.0D); + var14.draw(); + GL11.glEnable(GL11.GL_TEXTURE_2D); + var11.drawString(var2, -var11.getStringWidth(var2) / 2, var15, 553648127); + GL11.glEnable(GL11.GL_DEPTH_TEST); + GL11.glDepthMask(true); + var11.drawString(var2, -var11.getStringWidth(var2) / 2, var15, -1); + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glDisable(GL11.GL_BLEND); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glPopMatrix(); + } + } + + public void doRender(Entity var1, double var2, double var4, double var6, float var8, float var9) { + this.doRenderLiving((EntityLiving)var1, var2, var4, var6, var8, var9); + } +} diff --git a/src/net/minecraft/src/RenderManager.java b/src/net/minecraft/src/RenderManager.java new file mode 100644 index 0000000..08854a2 --- /dev/null +++ b/src/net/minecraft/src/RenderManager.java @@ -0,0 +1,135 @@ +package net.minecraft.src; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import org.lwjgl.opengl.GL11; + +public class RenderManager { + private Map entityRenderMap = new HashMap(); + public static RenderManager instance = new RenderManager(); + private FontRenderer fontRenderer; + public static double renderPosX; + public static double renderPosY; + public static double renderPosZ; + public RenderEngine renderEngine; + public ItemRenderer itemRenderer; + public World worldObj; + public EntityLiving livingPlayer; + public float playerViewY; + public float playerViewX; + public GameSettings options; + public double field_1222_l; + public double field_1221_m; + public double field_1220_n; + + private RenderManager() { + this.entityRenderMap.put(EntitySpider.class, new RenderSpider()); + this.entityRenderMap.put(EntityPig.class, new RenderPig(new ModelPig(), new ModelPig(0.5F), 0.7F)); + this.entityRenderMap.put(EntitySheep.class, new RenderSheep(new ModelSheep2(), new ModelSheep1(), 0.7F)); + this.entityRenderMap.put(EntityCow.class, new RenderCow(new ModelCow(), 0.7F)); + this.entityRenderMap.put(EntityWolf.class, new RenderWolf(new ModelWolf(), 0.5F)); + this.entityRenderMap.put(EntityChicken.class, new RenderChicken(new ModelChicken(), 0.3F)); + this.entityRenderMap.put(EntityCreeper.class, new RenderCreeper()); + this.entityRenderMap.put(EntitySkeleton.class, new RenderBiped(new ModelSkeleton(), 0.5F)); + this.entityRenderMap.put(EntityZombie.class, new RenderBiped(new ModelZombie(), 0.5F)); + this.entityRenderMap.put(EntitySlime.class, new RenderSlime(new ModelSlime(16), new ModelSlime(0), 0.25F)); + this.entityRenderMap.put(EntityPlayer.class, new RenderPlayer()); + this.entityRenderMap.put(EntityGiantZombie.class, new RenderGiantZombie(new ModelZombie(), 0.5F, 6.0F)); + this.entityRenderMap.put(EntityGhast.class, new RenderGhast()); + this.entityRenderMap.put(EntitySquid.class, new RenderSquid(new ModelSquid(), 0.7F)); + this.entityRenderMap.put(EntityLiving.class, new RenderLiving(new ModelBiped(), 0.5F)); + this.entityRenderMap.put(Entity.class, new RenderEntity()); + this.entityRenderMap.put(EntityPainting.class, new RenderPainting()); + this.entityRenderMap.put(EntityArrow.class, new RenderArrow()); + this.entityRenderMap.put(EntitySnowball.class, new RenderSnowball(Item.snowball.getIconFromDamage(0))); + this.entityRenderMap.put(EntityEgg.class, new RenderSnowball(Item.egg.getIconFromDamage(0))); + this.entityRenderMap.put(EntityFireball.class, new RenderFireball()); + this.entityRenderMap.put(EntityItem.class, new RenderItem()); + this.entityRenderMap.put(EntityTNTPrimed.class, new RenderTNTPrimed()); + this.entityRenderMap.put(EntityFallingSand.class, new RenderFallingSand()); + this.entityRenderMap.put(EntityMinecart.class, new RenderMinecart()); + this.entityRenderMap.put(EntityBoat.class, new RenderBoat()); + this.entityRenderMap.put(EntityFish.class, new RenderFish()); + this.entityRenderMap.put(EntityLightningBolt.class, new RenderLightningBolt()); + Iterator var1 = this.entityRenderMap.values().iterator(); + + while(var1.hasNext()) { + Render var2 = (Render)var1.next(); + var2.setRenderManager(this); + } + + } + + public Render getEntityClassRenderObject(Class var1) { + Render var2 = (Render)this.entityRenderMap.get(var1); + if(var2 == null && var1 != Entity.class) { + var2 = this.getEntityClassRenderObject(var1.getSuperclass()); + this.entityRenderMap.put(var1, var2); + } + + return var2; + } + + public Render getEntityRenderObject(Entity var1) { + return this.getEntityClassRenderObject(var1.getClass()); + } + + public void cacheActiveRenderInfo(World var1, RenderEngine var2, FontRenderer var3, EntityLiving var4, GameSettings var5, float var6) { + this.worldObj = var1; + this.renderEngine = var2; + this.options = var5; + this.livingPlayer = var4; + this.fontRenderer = var3; + if(var4.isPlayerSleeping()) { + int var7 = var1.getBlockId(MathHelper.floor_double(var4.posX), MathHelper.floor_double(var4.posY), MathHelper.floor_double(var4.posZ)); + if(var7 == Block.blockBed.blockID) { + int var8 = var1.getBlockMetadata(MathHelper.floor_double(var4.posX), MathHelper.floor_double(var4.posY), MathHelper.floor_double(var4.posZ)); + int var9 = var8 & 3; + this.playerViewY = (float)(var9 * 90 + 180); + this.playerViewX = 0.0F; + } + } else { + this.playerViewY = var4.prevRotationYaw + (var4.rotationYaw - var4.prevRotationYaw) * var6; + this.playerViewX = var4.prevRotationPitch + (var4.rotationPitch - var4.prevRotationPitch) * var6; + } + + this.field_1222_l = var4.lastTickPosX + (var4.posX - var4.lastTickPosX) * (double)var6; + this.field_1221_m = var4.lastTickPosY + (var4.posY - var4.lastTickPosY) * (double)var6; + this.field_1220_n = var4.lastTickPosZ + (var4.posZ - var4.lastTickPosZ) * (double)var6; + } + + public void renderEntity(Entity var1, float var2) { + double var3 = var1.lastTickPosX + (var1.posX - var1.lastTickPosX) * (double)var2; + double var5 = var1.lastTickPosY + (var1.posY - var1.lastTickPosY) * (double)var2; + double var7 = var1.lastTickPosZ + (var1.posZ - var1.lastTickPosZ) * (double)var2; + float var9 = var1.prevRotationYaw + (var1.rotationYaw - var1.prevRotationYaw) * var2; + float var10 = var1.getEntityBrightness(var2); + GL11.glColor3f(var10, var10, var10); + this.renderEntityWithPosYaw(var1, var3 - renderPosX, var5 - renderPosY, var7 - renderPosZ, var9, var2); + } + + public void renderEntityWithPosYaw(Entity var1, double var2, double var4, double var6, float var8, float var9) { + Render var10 = this.getEntityRenderObject(var1); + if(var10 != null) { + var10.doRender(var1, var2, var4, var6, var8, var9); + var10.doRenderShadowAndFire(var1, var2, var4, var6, var8, var9); + } + + } + + public void func_852_a(World var1) { + this.worldObj = var1; + } + + public double func_851_a(double var1, double var3, double var5) { + double var7 = var1 - this.field_1222_l; + double var9 = var3 - this.field_1221_m; + double var11 = var5 - this.field_1220_n; + return var7 * var7 + var9 * var9 + var11 * var11; + } + + public FontRenderer getFontRenderer() { + return this.fontRenderer; + } +} diff --git a/src/net/minecraft/src/RenderMinecart.java b/src/net/minecraft/src/RenderMinecart.java new file mode 100644 index 0000000..7aac72b --- /dev/null +++ b/src/net/minecraft/src/RenderMinecart.java @@ -0,0 +1,82 @@ +package net.minecraft.src; + +import org.lwjgl.opengl.GL11; + +public class RenderMinecart extends Render { + protected ModelBase modelMinecart; + + public RenderMinecart() { + this.shadowSize = 0.5F; + this.modelMinecart = new ModelMinecart(); + } + + public void func_152_a(EntityMinecart var1, double var2, double var4, double var6, float var8, float var9) { + GL11.glPushMatrix(); + double var10 = var1.lastTickPosX + (var1.posX - var1.lastTickPosX) * (double)var9; + double var12 = var1.lastTickPosY + (var1.posY - var1.lastTickPosY) * (double)var9; + double var14 = var1.lastTickPosZ + (var1.posZ - var1.lastTickPosZ) * (double)var9; + double var16 = (double)0.3F; + Vec3D var18 = var1.func_514_g(var10, var12, var14); + float var19 = var1.prevRotationPitch + (var1.rotationPitch - var1.prevRotationPitch) * var9; + if(var18 != null) { + Vec3D var20 = var1.func_515_a(var10, var12, var14, var16); + Vec3D var21 = var1.func_515_a(var10, var12, var14, -var16); + if(var20 == null) { + var20 = var18; + } + + if(var21 == null) { + var21 = var18; + } + + var2 += var18.xCoord - var10; + var4 += (var20.yCoord + var21.yCoord) / 2.0D - var12; + var6 += var18.zCoord - var14; + Vec3D var22 = var21.addVector(-var20.xCoord, -var20.yCoord, -var20.zCoord); + if(var22.lengthVector() != 0.0D) { + var22 = var22.normalize(); + var8 = (float)(Math.atan2(var22.zCoord, var22.xCoord) * 180.0D / Math.PI); + var19 = (float)(Math.atan(var22.yCoord) * 73.0D); + } + } + + GL11.glTranslatef((float)var2, (float)var4, (float)var6); + GL11.glRotatef(180.0F - var8, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(-var19, 0.0F, 0.0F, 1.0F); + float var23 = (float)var1.minecartTimeSinceHit - var9; + float var24 = (float)var1.minecartCurrentDamage - var9; + if(var24 < 0.0F) { + var24 = 0.0F; + } + + if(var23 > 0.0F) { + GL11.glRotatef(MathHelper.sin(var23) * var23 * var24 / 10.0F * (float)var1.minecartRockDirection, 1.0F, 0.0F, 0.0F); + } + + if(var1.minecartType != 0) { + this.loadTexture("/terrain.png"); + float var25 = 12.0F / 16.0F; + GL11.glScalef(var25, var25, var25); + GL11.glTranslatef(0.0F, 5.0F / 16.0F, 0.0F); + GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F); + if(var1.minecartType == 1) { + (new RenderBlocks()).renderBlockOnInventory(Block.chest, 0, var1.getEntityBrightness(var9)); + } else if(var1.minecartType == 2) { + (new RenderBlocks()).renderBlockOnInventory(Block.stoneOvenIdle, 0, var1.getEntityBrightness(var9)); + } + + GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F); + GL11.glTranslatef(0.0F, -(5.0F / 16.0F), 0.0F); + GL11.glScalef(1.0F / var25, 1.0F / var25, 1.0F / var25); + } + + this.loadTexture("/item/cart.png"); + GL11.glScalef(-1.0F, -1.0F, 1.0F); + this.modelMinecart.render(0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 1.0F / 16.0F); + GL11.glPopMatrix(); + } + + public void doRender(Entity var1, double var2, double var4, double var6, float var8, float var9) { + this.func_152_a((EntityMinecart)var1, var2, var4, var6, var8, var9); + } +} diff --git a/src/net/minecraft/src/RenderPainting.java b/src/net/minecraft/src/RenderPainting.java new file mode 100644 index 0000000..6a62cea --- /dev/null +++ b/src/net/minecraft/src/RenderPainting.java @@ -0,0 +1,119 @@ +package net.minecraft.src; + +import java.util.Random; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +public class RenderPainting extends Render { + private Random rand = new Random(); + + public void func_158_a(EntityPainting var1, double var2, double var4, double var6, float var8, float var9) { + this.rand.setSeed(187L); + GL11.glPushMatrix(); + GL11.glTranslatef((float)var2, (float)var4, (float)var6); + GL11.glRotatef(var8, 0.0F, 1.0F, 0.0F); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + this.loadTexture("/art/kz.png"); + EnumArt var10 = var1.art; + float var11 = 1.0F / 16.0F; + GL11.glScalef(var11, var11, var11); + this.func_159_a(var1, var10.sizeX, var10.sizeY, var10.offsetX, var10.offsetY); + GL11.glDisable(GL12.GL_RESCALE_NORMAL); + GL11.glPopMatrix(); + } + + private void func_159_a(EntityPainting var1, int var2, int var3, int var4, int var5) { + float var6 = (float)(-var2) / 2.0F; + float var7 = (float)(-var3) / 2.0F; + float var8 = -0.5F; + float var9 = 0.5F; + + for(int var10 = 0; var10 < var2 / 16; ++var10) { + for(int var11 = 0; var11 < var3 / 16; ++var11) { + float var12 = var6 + (float)((var10 + 1) * 16); + float var13 = var6 + (float)(var10 * 16); + float var14 = var7 + (float)((var11 + 1) * 16); + float var15 = var7 + (float)(var11 * 16); + this.func_160_a(var1, (var12 + var13) / 2.0F, (var14 + var15) / 2.0F); + float var16 = (float)(var4 + var2 - var10 * 16) / 256.0F; + float var17 = (float)(var4 + var2 - (var10 + 1) * 16) / 256.0F; + float var18 = (float)(var5 + var3 - var11 * 16) / 256.0F; + float var19 = (float)(var5 + var3 - (var11 + 1) * 16) / 256.0F; + float var20 = 12.0F / 16.0F; + float var21 = 13.0F / 16.0F; + float var22 = 0.0F; + float var23 = 1.0F / 16.0F; + float var24 = 12.0F / 16.0F; + float var25 = 13.0F / 16.0F; + float var26 = 0.001953125F; + float var27 = 0.001953125F; + float var28 = 385.0F / 512.0F; + float var29 = 385.0F / 512.0F; + float var30 = 0.0F; + float var31 = 1.0F / 16.0F; + Tessellator var32 = Tessellator.instance; + var32.startDrawingQuads(); + var32.setNormal(0.0F, 0.0F, -1.0F); + var32.addVertexWithUV((double)var12, (double)var15, (double)var8, (double)var17, (double)var18); + var32.addVertexWithUV((double)var13, (double)var15, (double)var8, (double)var16, (double)var18); + var32.addVertexWithUV((double)var13, (double)var14, (double)var8, (double)var16, (double)var19); + var32.addVertexWithUV((double)var12, (double)var14, (double)var8, (double)var17, (double)var19); + var32.setNormal(0.0F, 0.0F, 1.0F); + var32.addVertexWithUV((double)var12, (double)var14, (double)var9, (double)var20, (double)var22); + var32.addVertexWithUV((double)var13, (double)var14, (double)var9, (double)var21, (double)var22); + var32.addVertexWithUV((double)var13, (double)var15, (double)var9, (double)var21, (double)var23); + var32.addVertexWithUV((double)var12, (double)var15, (double)var9, (double)var20, (double)var23); + var32.setNormal(0.0F, -1.0F, 0.0F); + var32.addVertexWithUV((double)var12, (double)var14, (double)var8, (double)var24, (double)var26); + var32.addVertexWithUV((double)var13, (double)var14, (double)var8, (double)var25, (double)var26); + var32.addVertexWithUV((double)var13, (double)var14, (double)var9, (double)var25, (double)var27); + var32.addVertexWithUV((double)var12, (double)var14, (double)var9, (double)var24, (double)var27); + var32.setNormal(0.0F, 1.0F, 0.0F); + var32.addVertexWithUV((double)var12, (double)var15, (double)var9, (double)var24, (double)var26); + var32.addVertexWithUV((double)var13, (double)var15, (double)var9, (double)var25, (double)var26); + var32.addVertexWithUV((double)var13, (double)var15, (double)var8, (double)var25, (double)var27); + var32.addVertexWithUV((double)var12, (double)var15, (double)var8, (double)var24, (double)var27); + var32.setNormal(-1.0F, 0.0F, 0.0F); + var32.addVertexWithUV((double)var12, (double)var14, (double)var9, (double)var29, (double)var30); + var32.addVertexWithUV((double)var12, (double)var15, (double)var9, (double)var29, (double)var31); + var32.addVertexWithUV((double)var12, (double)var15, (double)var8, (double)var28, (double)var31); + var32.addVertexWithUV((double)var12, (double)var14, (double)var8, (double)var28, (double)var30); + var32.setNormal(1.0F, 0.0F, 0.0F); + var32.addVertexWithUV((double)var13, (double)var14, (double)var8, (double)var29, (double)var30); + var32.addVertexWithUV((double)var13, (double)var15, (double)var8, (double)var29, (double)var31); + var32.addVertexWithUV((double)var13, (double)var15, (double)var9, (double)var28, (double)var31); + var32.addVertexWithUV((double)var13, (double)var14, (double)var9, (double)var28, (double)var30); + var32.draw(); + } + } + + } + + private void func_160_a(EntityPainting var1, float var2, float var3) { + int var4 = MathHelper.floor_double(var1.posX); + int var5 = MathHelper.floor_double(var1.posY + (double)(var3 / 16.0F)); + int var6 = MathHelper.floor_double(var1.posZ); + if(var1.direction == 0) { + var4 = MathHelper.floor_double(var1.posX + (double)(var2 / 16.0F)); + } + + if(var1.direction == 1) { + var6 = MathHelper.floor_double(var1.posZ - (double)(var2 / 16.0F)); + } + + if(var1.direction == 2) { + var4 = MathHelper.floor_double(var1.posX - (double)(var2 / 16.0F)); + } + + if(var1.direction == 3) { + var6 = MathHelper.floor_double(var1.posZ + (double)(var2 / 16.0F)); + } + + float var7 = this.renderManager.worldObj.getLightBrightness(var4, var5, var6); + GL11.glColor3f(var7, var7, var7); + } + + public void doRender(Entity var1, double var2, double var4, double var6, float var8, float var9) { + this.func_158_a((EntityPainting)var1, var2, var4, var6, var8, var9); + } +} diff --git a/src/net/minecraft/src/RenderPig.java b/src/net/minecraft/src/RenderPig.java new file mode 100644 index 0000000..78292f0 --- /dev/null +++ b/src/net/minecraft/src/RenderPig.java @@ -0,0 +1,17 @@ +package net.minecraft.src; + +public class RenderPig extends RenderLiving { + public RenderPig(ModelBase var1, ModelBase var2, float var3) { + super(var1, var3); + this.setRenderPassModel(var2); + } + + protected boolean renderSaddledPig(EntityPig var1, int var2, float var3) { + this.loadTexture("/mob/saddle.png"); + return var2 == 0 && var1.getSaddled(); + } + + protected boolean shouldRenderPass(EntityLiving var1, int var2, float var3) { + return this.renderSaddledPig((EntityPig)var1, var2, var3); + } +} diff --git a/src/net/minecraft/src/RenderPlayer.java b/src/net/minecraft/src/RenderPlayer.java new file mode 100644 index 0000000..ea90e9f --- /dev/null +++ b/src/net/minecraft/src/RenderPlayer.java @@ -0,0 +1,280 @@ +package net.minecraft.src; + +import net.minecraft.client.Minecraft; +import org.lwjgl.opengl.GL11; + +public class RenderPlayer extends RenderLiving { + private ModelBiped modelBipedMain = (ModelBiped)this.mainModel; + private ModelBiped modelArmorChestplate = new ModelBiped(1.0F); + private ModelBiped modelArmor = new ModelBiped(0.5F); + private static final String[] armorFilenamePrefix = new String[]{"cloth", "chain", "iron", "diamond", "gold"}; + + public RenderPlayer() { + super(new ModelBiped(0.0F), 0.5F); + } + + protected boolean setArmorModel(EntityPlayer var1, int var2, float var3) { + ItemStack var4 = var1.inventory.armorItemInSlot(3 - var2); + if(var4 != null) { + Item var5 = var4.getItem(); + if(var5 instanceof ItemArmor) { + ItemArmor var6 = (ItemArmor)var5; + this.loadTexture("/armor/" + armorFilenamePrefix[var6.renderIndex] + "_" + (var2 == 2 ? 2 : 1) + ".png"); + ModelBiped var7 = var2 == 2 ? this.modelArmor : this.modelArmorChestplate; + var7.bipedHead.showModel = var2 == 0; + var7.bipedHeadwear.showModel = var2 == 0; + var7.bipedBody.showModel = var2 == 1 || var2 == 2; + var7.bipedRightArm.showModel = var2 == 1; + var7.bipedLeftArm.showModel = var2 == 1; + var7.bipedRightLeg.showModel = var2 == 2 || var2 == 3; + var7.bipedLeftLeg.showModel = var2 == 2 || var2 == 3; + this.setRenderPassModel(var7); + return true; + } + } + + return false; + } + + public void renderPlayer(EntityPlayer var1, double var2, double var4, double var6, float var8, float var9) { + ItemStack var10 = var1.inventory.getCurrentItem(); + this.modelArmorChestplate.field_1278_i = this.modelArmor.field_1278_i = this.modelBipedMain.field_1278_i = var10 != null; + this.modelArmorChestplate.isSneak = this.modelArmor.isSneak = this.modelBipedMain.isSneak = var1.isSneaking(); + double var11 = var4 - (double)var1.yOffset; + if(var1.isSneaking() && !(var1 instanceof EntityPlayerSP)) { + var11 -= 0.125D; + } + + super.doRenderLiving(var1, var2, var11, var6, var8, var9); + this.modelArmorChestplate.isSneak = this.modelArmor.isSneak = this.modelBipedMain.isSneak = false; + this.modelArmorChestplate.field_1278_i = this.modelArmor.field_1278_i = this.modelBipedMain.field_1278_i = false; + } + + protected void renderName(EntityPlayer var1, double var2, double var4, double var6) { + if(Minecraft.isGuiEnabled() && var1 != this.renderManager.livingPlayer) { + float var8 = 1.6F; + float var9 = (float)(1.0D / 60.0D) * var8; + float var10 = var1.getDistanceToEntity(this.renderManager.livingPlayer); + float var11 = var1.isSneaking() ? 32.0F : 64.0F; + if(var10 < var11) { + String var12 = var1.username; + if(!var1.isSneaking()) { + if(var1.isPlayerSleeping()) { + this.renderLivingLabel(var1, var12, var2, var4 - 1.5D, var6, 64); + } else { + this.renderLivingLabel(var1, var12, var2, var4, var6, 64); + } + } else { + FontRenderer var13 = this.getFontRendererFromRenderManager(); + GL11.glPushMatrix(); + GL11.glTranslatef((float)var2 + 0.0F, (float)var4 + 2.3F, (float)var6); + GL11.glNormal3f(0.0F, 1.0F, 0.0F); + GL11.glRotatef(-this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F); + GL11.glScalef(-var9, -var9, var9); + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glTranslatef(0.0F, 0.25F / var9, 0.0F); + GL11.glDepthMask(false); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + Tessellator var14 = Tessellator.instance; + GL11.glDisable(GL11.GL_TEXTURE_2D); + var14.startDrawingQuads(); + int var15 = var13.getStringWidth(var12) / 2; + var14.setColorRGBA_F(0.0F, 0.0F, 0.0F, 0.25F); + var14.addVertex((double)(-var15 - 1), -1.0D, 0.0D); + var14.addVertex((double)(-var15 - 1), 8.0D, 0.0D); + var14.addVertex((double)(var15 + 1), 8.0D, 0.0D); + var14.addVertex((double)(var15 + 1), -1.0D, 0.0D); + var14.draw(); + GL11.glEnable(GL11.GL_TEXTURE_2D); + GL11.glDepthMask(true); + var13.drawString(var12, -var13.getStringWidth(var12) / 2, 0, 553648127); + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glDisable(GL11.GL_BLEND); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glPopMatrix(); + } + } + } + + } + + protected void renderSpecials(EntityPlayer var1, float var2) { + ItemStack var3 = var1.inventory.armorItemInSlot(3); + if(var3 != null && var3.getItem().shiftedIndex < 256) { + GL11.glPushMatrix(); + this.modelBipedMain.bipedHead.postRender(1.0F / 16.0F); + if(RenderBlocks.renderItemIn3d(Block.blocksList[var3.itemID].getRenderType())) { + float var4 = 10.0F / 16.0F; + GL11.glTranslatef(0.0F, -0.25F, 0.0F); + GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F); + GL11.glScalef(var4, -var4, var4); + } + + this.renderManager.itemRenderer.renderItem(var1, var3); + GL11.glPopMatrix(); + } + + float var5; + if(var1.username.equals("deadmau5") && this.loadDownloadableImageTexture(var1.skinUrl, (String)null)) { + for(int var19 = 0; var19 < 2; ++var19) { + var5 = var1.prevRotationYaw + (var1.rotationYaw - var1.prevRotationYaw) * var2 - (var1.prevRenderYawOffset + (var1.renderYawOffset - var1.prevRenderYawOffset) * var2); + float var6 = var1.prevRotationPitch + (var1.rotationPitch - var1.prevRotationPitch) * var2; + GL11.glPushMatrix(); + GL11.glRotatef(var5, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(var6, 1.0F, 0.0F, 0.0F); + GL11.glTranslatef(6.0F / 16.0F * (float)(var19 * 2 - 1), 0.0F, 0.0F); + GL11.glTranslatef(0.0F, -(6.0F / 16.0F), 0.0F); + GL11.glRotatef(-var6, 1.0F, 0.0F, 0.0F); + GL11.glRotatef(-var5, 0.0F, 1.0F, 0.0F); + float var7 = 4.0F / 3.0F; + GL11.glScalef(var7, var7, var7); + this.modelBipedMain.renderEars(1.0F / 16.0F); + GL11.glPopMatrix(); + } + } + + if(this.loadDownloadableImageTexture(var1.playerCloakUrl, (String)null)) { + GL11.glPushMatrix(); + GL11.glTranslatef(0.0F, 0.0F, 2.0F / 16.0F); + double var20 = var1.field_20066_r + (var1.field_20063_u - var1.field_20066_r) * (double)var2 - (var1.prevPosX + (var1.posX - var1.prevPosX) * (double)var2); + double var22 = var1.field_20065_s + (var1.field_20062_v - var1.field_20065_s) * (double)var2 - (var1.prevPosY + (var1.posY - var1.prevPosY) * (double)var2); + double var8 = var1.field_20064_t + (var1.field_20061_w - var1.field_20064_t) * (double)var2 - (var1.prevPosZ + (var1.posZ - var1.prevPosZ) * (double)var2); + float var10 = var1.prevRenderYawOffset + (var1.renderYawOffset - var1.prevRenderYawOffset) * var2; + double var11 = (double)MathHelper.sin(var10 * (float)Math.PI / 180.0F); + double var13 = (double)(-MathHelper.cos(var10 * (float)Math.PI / 180.0F)); + float var15 = (float)var22 * 10.0F; + if(var15 < -6.0F) { + var15 = -6.0F; + } + + if(var15 > 32.0F) { + var15 = 32.0F; + } + + float var16 = (float)(var20 * var11 + var8 * var13) * 100.0F; + float var17 = (float)(var20 * var13 - var8 * var11) * 100.0F; + if(var16 < 0.0F) { + var16 = 0.0F; + } + + float var18 = var1.field_775_e + (var1.field_774_f - var1.field_775_e) * var2; + var15 += MathHelper.sin((var1.prevDistanceWalkedModified + (var1.distanceWalkedModified - var1.prevDistanceWalkedModified) * var2) * 6.0F) * 32.0F * var18; + if(var1.isSneaking()) { + var15 += 25.0F; + } + + GL11.glRotatef(6.0F + var16 / 2.0F + var15, 1.0F, 0.0F, 0.0F); + GL11.glRotatef(var17 / 2.0F, 0.0F, 0.0F, 1.0F); + GL11.glRotatef(-var17 / 2.0F, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F); + this.modelBipedMain.renderCloak(1.0F / 16.0F); + GL11.glPopMatrix(); + } + + ItemStack var21 = var1.inventory.getCurrentItem(); + if(var21 != null) { + GL11.glPushMatrix(); + this.modelBipedMain.bipedRightArm.postRender(1.0F / 16.0F); + GL11.glTranslatef(-(1.0F / 16.0F), 7.0F / 16.0F, 1.0F / 16.0F); + if(var1.fishEntity != null) { + var21 = new ItemStack(Item.stick); + } + + if(var21.itemID < 256 && RenderBlocks.renderItemIn3d(Block.blocksList[var21.itemID].getRenderType())) { + var5 = 0.5F; + GL11.glTranslatef(0.0F, 3.0F / 16.0F, -(5.0F / 16.0F)); + var5 *= 12.0F / 16.0F; + GL11.glRotatef(20.0F, 1.0F, 0.0F, 0.0F); + GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F); + GL11.glScalef(var5, -var5, var5); + } else if(Item.itemsList[var21.itemID].isFull3D()) { + var5 = 10.0F / 16.0F; + if(Item.itemsList[var21.itemID].shouldRotateAroundWhenRendering()) { + GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F); + GL11.glTranslatef(0.0F, -(2.0F / 16.0F), 0.0F); + } + + GL11.glTranslatef(0.0F, 3.0F / 16.0F, 0.0F); + GL11.glScalef(var5, -var5, var5); + GL11.glRotatef(-100.0F, 1.0F, 0.0F, 0.0F); + GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F); + } else { + var5 = 6.0F / 16.0F; + GL11.glTranslatef(0.25F, 3.0F / 16.0F, -(3.0F / 16.0F)); + GL11.glScalef(var5, var5, var5); + GL11.glRotatef(60.0F, 0.0F, 0.0F, 1.0F); + GL11.glRotatef(-90.0F, 1.0F, 0.0F, 0.0F); + GL11.glRotatef(20.0F, 0.0F, 0.0F, 1.0F); + } + + this.renderManager.itemRenderer.renderItem(var1, var21); + GL11.glPopMatrix(); + } + + } + + protected void func_186_b(EntityPlayer var1, float var2) { + float var3 = 15.0F / 16.0F; + GL11.glScalef(var3, var3, var3); + } + + public void drawFirstPersonHand() { + this.modelBipedMain.onGround = 0.0F; + this.modelBipedMain.setRotationAngles(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 1.0F / 16.0F); + this.modelBipedMain.bipedRightArm.render(1.0F / 16.0F); + } + + protected void func_22016_b(EntityPlayer var1, double var2, double var4, double var6) { + if(var1.isEntityAlive() && var1.isPlayerSleeping()) { + super.func_22012_b(var1, var2 + (double)var1.field_22063_x, var4 + (double)var1.field_22062_y, var6 + (double)var1.field_22061_z); + } else { + super.func_22012_b(var1, var2, var4, var6); + } + + } + + protected void func_22017_a(EntityPlayer var1, float var2, float var3, float var4) { + if(var1.isEntityAlive() && var1.isPlayerSleeping()) { + GL11.glRotatef(var1.getBedOrientationInDegrees(), 0.0F, 1.0F, 0.0F); + GL11.glRotatef(this.getDeathMaxRotation(var1), 0.0F, 0.0F, 1.0F); + GL11.glRotatef(270.0F, 0.0F, 1.0F, 0.0F); + } else { + super.rotateCorpse(var1, var2, var3, var4); + } + + } + + protected void passSpecialRender(EntityLiving var1, double var2, double var4, double var6) { + this.renderName((EntityPlayer)var1, var2, var4, var6); + } + + protected void preRenderCallback(EntityLiving var1, float var2) { + this.func_186_b((EntityPlayer)var1, var2); + } + + protected boolean shouldRenderPass(EntityLiving var1, int var2, float var3) { + return this.setArmorModel((EntityPlayer)var1, var2, var3); + } + + protected void renderEquippedItems(EntityLiving var1, float var2) { + this.renderSpecials((EntityPlayer)var1, var2); + } + + protected void rotateCorpse(EntityLiving var1, float var2, float var3, float var4) { + this.func_22017_a((EntityPlayer)var1, var2, var3, var4); + } + + protected void func_22012_b(EntityLiving var1, double var2, double var4, double var6) { + this.func_22016_b((EntityPlayer)var1, var2, var4, var6); + } + + public void doRenderLiving(EntityLiving var1, double var2, double var4, double var6, float var8, float var9) { + this.renderPlayer((EntityPlayer)var1, var2, var4, var6, var8, var9); + } + + public void doRender(Entity var1, double var2, double var4, double var6, float var8, float var9) { + this.renderPlayer((EntityPlayer)var1, var2, var4, var6, var8, var9); + } +} diff --git a/src/net/minecraft/src/RenderSheep.java b/src/net/minecraft/src/RenderSheep.java new file mode 100644 index 0000000..7677505 --- /dev/null +++ b/src/net/minecraft/src/RenderSheep.java @@ -0,0 +1,26 @@ +package net.minecraft.src; + +import org.lwjgl.opengl.GL11; + +public class RenderSheep extends RenderLiving { + public RenderSheep(ModelBase var1, ModelBase var2, float var3) { + super(var1, var3); + this.setRenderPassModel(var2); + } + + protected boolean setWoolColorAndRender(EntitySheep var1, int var2, float var3) { + if(var2 == 0 && !var1.getSheared()) { + this.loadTexture("/mob/sheep_fur.png"); + float var4 = var1.getEntityBrightness(var3); + int var5 = var1.getFleeceColor(); + GL11.glColor3f(var4 * EntitySheep.fleeceColorTable[var5][0], var4 * EntitySheep.fleeceColorTable[var5][1], var4 * EntitySheep.fleeceColorTable[var5][2]); + return true; + } else { + return false; + } + } + + protected boolean shouldRenderPass(EntityLiving var1, int var2, float var3) { + return this.setWoolColorAndRender((EntitySheep)var1, var2, var3); + } +} diff --git a/src/net/minecraft/src/RenderSlime.java b/src/net/minecraft/src/RenderSlime.java new file mode 100644 index 0000000..4fd782a --- /dev/null +++ b/src/net/minecraft/src/RenderSlime.java @@ -0,0 +1,45 @@ +package net.minecraft.src; + +import org.lwjgl.opengl.GL11; + +public class RenderSlime extends RenderLiving { + private ModelBase scaleAmount; + + public RenderSlime(ModelBase var1, ModelBase var2, float var3) { + super(var1, var3); + this.scaleAmount = var2; + } + + protected boolean renderSlimePassModel(EntitySlime var1, int var2, float var3) { + if(var2 == 0) { + this.setRenderPassModel(this.scaleAmount); + GL11.glEnable(GL11.GL_NORMALIZE); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + return true; + } else { + if(var2 == 1) { + GL11.glDisable(GL11.GL_BLEND); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + } + + return false; + } + } + + protected void scaleSlime(EntitySlime var1, float var2) { + int var3 = var1.getSlimeSize(); + float var4 = (var1.field_767_b + (var1.field_768_a - var1.field_767_b) * var2) / ((float)var3 * 0.5F + 1.0F); + float var5 = 1.0F / (var4 + 1.0F); + float var6 = (float)var3; + GL11.glScalef(var5 * var6, 1.0F / var5 * var6, var5 * var6); + } + + protected void preRenderCallback(EntityLiving var1, float var2) { + this.scaleSlime((EntitySlime)var1, var2); + } + + protected boolean shouldRenderPass(EntityLiving var1, int var2, float var3) { + return this.renderSlimePassModel((EntitySlime)var1, var2, var3); + } +} diff --git a/src/net/minecraft/src/RenderSnowball.java b/src/net/minecraft/src/RenderSnowball.java new file mode 100644 index 0000000..0900c55 --- /dev/null +++ b/src/net/minecraft/src/RenderSnowball.java @@ -0,0 +1,39 @@ +package net.minecraft.src; + +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +public class RenderSnowball extends Render { + private int itemIconIndex; + + public RenderSnowball(int var1) { + this.itemIconIndex = var1; + } + + public void doRender(Entity var1, double var2, double var4, double var6, float var8, float var9) { + GL11.glPushMatrix(); + GL11.glTranslatef((float)var2, (float)var4, (float)var6); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + GL11.glScalef(0.5F, 0.5F, 0.5F); + this.loadTexture("/gui/items.png"); + Tessellator var10 = Tessellator.instance; + float var11 = (float)(this.itemIconIndex % 16 * 16 + 0) / 256.0F; + float var12 = (float)(this.itemIconIndex % 16 * 16 + 16) / 256.0F; + float var13 = (float)(this.itemIconIndex / 16 * 16 + 0) / 256.0F; + float var14 = (float)(this.itemIconIndex / 16 * 16 + 16) / 256.0F; + float var15 = 1.0F; + float var16 = 0.5F; + float var17 = 0.25F; + GL11.glRotatef(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(-this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F); + var10.startDrawingQuads(); + var10.setNormal(0.0F, 1.0F, 0.0F); + var10.addVertexWithUV((double)(0.0F - var16), (double)(0.0F - var17), 0.0D, (double)var11, (double)var14); + var10.addVertexWithUV((double)(var15 - var16), (double)(0.0F - var17), 0.0D, (double)var12, (double)var14); + var10.addVertexWithUV((double)(var15 - var16), (double)(1.0F - var17), 0.0D, (double)var12, (double)var13); + var10.addVertexWithUV((double)(0.0F - var16), (double)(1.0F - var17), 0.0D, (double)var11, (double)var13); + var10.draw(); + GL11.glDisable(GL12.GL_RESCALE_NORMAL); + GL11.glPopMatrix(); + } +} diff --git a/src/net/minecraft/src/RenderSorter.java b/src/net/minecraft/src/RenderSorter.java new file mode 100644 index 0000000..ca045d2 --- /dev/null +++ b/src/net/minecraft/src/RenderSorter.java @@ -0,0 +1,29 @@ +package net.minecraft.src; + +import java.util.Comparator; + +public class RenderSorter implements Comparator { + private EntityLiving baseEntity; + + public RenderSorter(EntityLiving var1) { + this.baseEntity = var1; + } + + public int doCompare(WorldRenderer var1, WorldRenderer var2) { + boolean var3 = var1.isInFrustum; + boolean var4 = var2.isInFrustum; + if(var3 && !var4) { + return 1; + } else if(var4 && !var3) { + return -1; + } else { + double var5 = (double)var1.distanceToEntitySquared(this.baseEntity); + double var7 = (double)var2.distanceToEntitySquared(this.baseEntity); + return var5 < var7 ? 1 : (var5 > var7 ? -1 : (var1.chunkIndex < var2.chunkIndex ? 1 : -1)); + } + } + + public int compare(Object var1, Object var2) { + return this.doCompare((WorldRenderer)var1, (WorldRenderer)var2); + } +} diff --git a/src/net/minecraft/src/RenderSpider.java b/src/net/minecraft/src/RenderSpider.java new file mode 100644 index 0000000..fa03f2c --- /dev/null +++ b/src/net/minecraft/src/RenderSpider.java @@ -0,0 +1,38 @@ +package net.minecraft.src; + +import org.lwjgl.opengl.GL11; + +public class RenderSpider extends RenderLiving { + public RenderSpider() { + super(new ModelSpider(), 1.0F); + this.setRenderPassModel(new ModelSpider()); + } + + protected float setSpiderDeathMaxRotation(EntitySpider var1) { + return 180.0F; + } + + protected boolean setSpiderEyeBrightness(EntitySpider var1, int var2, float var3) { + if(var2 != 0) { + return false; + } else if(var2 != 0) { + return false; + } else { + this.loadTexture("/mob/spider_eyes.png"); + float var4 = (1.0F - var1.getEntityBrightness(1.0F)) * 0.5F; + GL11.glEnable(GL11.GL_BLEND); + GL11.glDisable(GL11.GL_ALPHA_TEST); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + GL11.glColor4f(1.0F, 1.0F, 1.0F, var4); + return true; + } + } + + protected float getDeathMaxRotation(EntityLiving var1) { + return this.setSpiderDeathMaxRotation((EntitySpider)var1); + } + + protected boolean shouldRenderPass(EntityLiving var1, int var2, float var3) { + return this.setSpiderEyeBrightness((EntitySpider)var1, var2, var3); + } +} diff --git a/src/net/minecraft/src/RenderSquid.java b/src/net/minecraft/src/RenderSquid.java new file mode 100644 index 0000000..e09f204 --- /dev/null +++ b/src/net/minecraft/src/RenderSquid.java @@ -0,0 +1,51 @@ +package net.minecraft.src; + +import org.lwjgl.opengl.GL11; + +public class RenderSquid extends RenderLiving { + public RenderSquid(ModelBase var1, float var2) { + super(var1, var2); + } + + public void func_21008_a(EntitySquid var1, double var2, double var4, double var6, float var8, float var9) { + super.doRenderLiving(var1, var2, var4, var6, var8, var9); + } + + protected void func_21007_a(EntitySquid var1, float var2, float var3, float var4) { + float var5 = var1.field_21088_b + (var1.field_21089_a - var1.field_21088_b) * var4; + float var6 = var1.field_21086_f + (var1.field_21087_c - var1.field_21086_f) * var4; + GL11.glTranslatef(0.0F, 0.5F, 0.0F); + GL11.glRotatef(180.0F - var3, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(var5, 1.0F, 0.0F, 0.0F); + GL11.glRotatef(var6, 0.0F, 1.0F, 0.0F); + GL11.glTranslatef(0.0F, -1.2F, 0.0F); + } + + protected void func_21005_a(EntitySquid var1, float var2) { + } + + protected float func_21006_b(EntitySquid var1, float var2) { + float var3 = var1.field_21082_j + (var1.field_21083_i - var1.field_21082_j) * var2; + return var3; + } + + protected void preRenderCallback(EntityLiving var1, float var2) { + this.func_21005_a((EntitySquid)var1, var2); + } + + protected float func_170_d(EntityLiving var1, float var2) { + return this.func_21006_b((EntitySquid)var1, var2); + } + + protected void rotateCorpse(EntityLiving var1, float var2, float var3, float var4) { + this.func_21007_a((EntitySquid)var1, var2, var3, var4); + } + + public void doRenderLiving(EntityLiving var1, double var2, double var4, double var6, float var8, float var9) { + this.func_21008_a((EntitySquid)var1, var2, var4, var6, var8, var9); + } + + public void doRender(Entity var1, double var2, double var4, double var6, float var8, float var9) { + this.func_21008_a((EntitySquid)var1, var2, var4, var6, var8, var9); + } +} diff --git a/src/net/minecraft/src/RenderTNTPrimed.java b/src/net/minecraft/src/RenderTNTPrimed.java new file mode 100644 index 0000000..81617ee --- /dev/null +++ b/src/net/minecraft/src/RenderTNTPrimed.java @@ -0,0 +1,54 @@ +package net.minecraft.src; + +import org.lwjgl.opengl.GL11; + +public class RenderTNTPrimed extends Render { + private RenderBlocks blockRenderer = new RenderBlocks(); + + public RenderTNTPrimed() { + this.shadowSize = 0.5F; + } + + public void func_153_a(EntityTNTPrimed var1, double var2, double var4, double var6, float var8, float var9) { + GL11.glPushMatrix(); + GL11.glTranslatef((float)var2, (float)var4, (float)var6); + float var10; + if((float)var1.fuse - var9 + 1.0F < 10.0F) { + var10 = 1.0F - ((float)var1.fuse - var9 + 1.0F) / 10.0F; + if(var10 < 0.0F) { + var10 = 0.0F; + } + + if(var10 > 1.0F) { + var10 = 1.0F; + } + + var10 *= var10; + var10 *= var10; + float var11 = 1.0F + var10 * 0.3F; + GL11.glScalef(var11, var11, var11); + } + + var10 = (1.0F - ((float)var1.fuse - var9 + 1.0F) / 100.0F) * 0.8F; + this.loadTexture("/terrain.png"); + this.blockRenderer.renderBlockOnInventory(Block.tnt, 0, var1.getEntityBrightness(var9)); + if(var1.fuse / 5 % 2 == 0) { + GL11.glDisable(GL11.GL_TEXTURE_2D); + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_DST_ALPHA); + GL11.glColor4f(1.0F, 1.0F, 1.0F, var10); + this.blockRenderer.renderBlockOnInventory(Block.tnt, 0, 1.0F); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glDisable(GL11.GL_BLEND); + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glEnable(GL11.GL_TEXTURE_2D); + } + + GL11.glPopMatrix(); + } + + public void doRender(Entity var1, double var2, double var4, double var6, float var8, float var9) { + this.func_153_a((EntityTNTPrimed)var1, var2, var4, var6, var8, var9); + } +} diff --git a/src/net/minecraft/src/RenderWolf.java b/src/net/minecraft/src/RenderWolf.java new file mode 100644 index 0000000..90fd7cb --- /dev/null +++ b/src/net/minecraft/src/RenderWolf.java @@ -0,0 +1,34 @@ +package net.minecraft.src; + +public class RenderWolf extends RenderLiving { + public RenderWolf(ModelBase var1, float var2) { + super(var1, var2); + } + + public void renderWolf(EntityWolf var1, double var2, double var4, double var6, float var8, float var9) { + super.doRenderLiving(var1, var2, var4, var6, var8, var9); + } + + protected float func_25004_a(EntityWolf var1, float var2) { + return var1.setTailRotation(); + } + + protected void func_25006_b(EntityWolf var1, float var2) { + } + + protected void preRenderCallback(EntityLiving var1, float var2) { + this.func_25006_b((EntityWolf)var1, var2); + } + + protected float func_170_d(EntityLiving var1, float var2) { + return this.func_25004_a((EntityWolf)var1, var2); + } + + public void doRenderLiving(EntityLiving var1, double var2, double var4, double var6, float var8, float var9) { + this.renderWolf((EntityWolf)var1, var2, var4, var6, var8, var9); + } + + public void doRender(Entity var1, double var2, double var4, double var6, float var8, float var9) { + this.renderWolf((EntityWolf)var1, var2, var4, var6, var8, var9); + } +} diff --git a/src/net/minecraft/src/SaveConverterMcRegion.java b/src/net/minecraft/src/SaveConverterMcRegion.java new file mode 100644 index 0000000..15f5fbe --- /dev/null +++ b/src/net/minecraft/src/SaveConverterMcRegion.java @@ -0,0 +1,174 @@ +package net.minecraft.src; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.zip.GZIPInputStream; + +public class SaveConverterMcRegion extends SaveFormatOld { + public SaveConverterMcRegion(File var1) { + super(var1); + } + + public String func_22178_a() { + return "Scaevolus\' McRegion"; + } + + public List func_22176_b() { + ArrayList var1 = new ArrayList(); + File[] var2 = this.field_22180_a.listFiles(); + File[] var3 = var2; + int var4 = var2.length; + + for(int var5 = 0; var5 < var4; ++var5) { + File var6 = var3[var5]; + if(var6.isDirectory()) { + String var7 = var6.getName(); + WorldInfo var8 = this.func_22173_b(var7); + if(var8 != null) { + boolean var9 = var8.getSaveVersion() != 19132; + String var10 = var8.getWorldName(); + if(var10 == null || MathHelper.stringNullOrLengthZero(var10)) { + var10 = var7; + } + + var1.add(new SaveFormatComparator(var7, var10, var8.getLastTimePlayed(), var8.getSizeOnDisk(), var9)); + } + } + } + + return var1; + } + + public void flushCache() { + RegionFileCache.func_22192_a(); + } + + public ISaveHandler getSaveLoader(String var1, boolean var2) { + return new SaveOldDir(this.field_22180_a, var1, var2); + } + + public boolean isOldMapFormat(String var1) { + WorldInfo var2 = this.func_22173_b(var1); + return var2 != null && var2.getSaveVersion() == 0; + } + + public boolean convertMapFormat(String var1, IProgressUpdate var2) { + var2.setLoadingProgress(0); + ArrayList var3 = new ArrayList(); + ArrayList var4 = new ArrayList(); + ArrayList var5 = new ArrayList(); + ArrayList var6 = new ArrayList(); + File var7 = new File(this.field_22180_a, var1); + File var8 = new File(var7, "DIM-1"); + System.out.println("Scanning folders..."); + this.func_22183_a(var7, var3, var4); + if(var8.exists()) { + this.func_22183_a(var8, var5, var6); + } + + int var9 = var3.size() + var5.size() + var4.size() + var6.size(); + System.out.println("Total conversion count is " + var9); + this.func_22181_a(var7, var3, 0, var9, var2); + this.func_22181_a(var8, var5, var3.size(), var9, var2); + WorldInfo var10 = this.func_22173_b(var1); + var10.setSaveVersion(19132); + ISaveHandler var11 = this.getSaveLoader(var1, false); + var11.saveWorldInfo(var10); + this.func_22182_a(var4, var3.size() + var5.size(), var9, var2); + if(var8.exists()) { + this.func_22182_a(var6, var3.size() + var5.size() + var4.size(), var9, var2); + } + + return true; + } + + private void func_22183_a(File var1, ArrayList var2, ArrayList var3) { + ChunkFolderPattern var4 = new ChunkFolderPattern((Empty2)null); + ChunkFilePattern var5 = new ChunkFilePattern((Empty2)null); + File[] var6 = var1.listFiles(var4); + File[] var7 = var6; + int var8 = var6.length; + + for(int var9 = 0; var9 < var8; ++var9) { + File var10 = var7[var9]; + var3.add(var10); + File[] var11 = var10.listFiles(var4); + File[] var12 = var11; + int var13 = var11.length; + + for(int var14 = 0; var14 < var13; ++var14) { + File var15 = var12[var14]; + File[] var16 = var15.listFiles(var5); + File[] var17 = var16; + int var18 = var16.length; + + for(int var19 = 0; var19 < var18; ++var19) { + File var20 = var17[var19]; + var2.add(new ChunkFile(var20)); + } + } + } + + } + + private void func_22181_a(File var1, ArrayList var2, int var3, int var4, IProgressUpdate var5) { + Collections.sort(var2); + byte[] var6 = new byte[4096]; + Iterator var7 = var2.iterator(); + + while(var7.hasNext()) { + ChunkFile var8 = (ChunkFile)var7.next(); + int var9 = var8.func_22323_b(); + int var10 = var8.func_22321_c(); + RegionFile var11 = RegionFileCache.func_22193_a(var1, var9, var10); + if(!var11.func_22202_c(var9 & 31, var10 & 31)) { + try { + DataInputStream var12 = new DataInputStream(new GZIPInputStream(new FileInputStream(var8.func_22324_a()))); + DataOutputStream var13 = var11.getChunkDataOutputStream(var9 & 31, var10 & 31); + boolean var14 = false; + + while(true) { + int var17 = var12.read(var6); + if(var17 == -1) { + var13.close(); + var12.close(); + break; + } + + var13.write(var6, 0, var17); + } + } catch (IOException var15) { + var15.printStackTrace(); + } + } + + ++var3; + int var16 = (int)Math.round(100.0D * (double)var3 / (double)var4); + var5.setLoadingProgress(var16); + } + + RegionFileCache.func_22192_a(); + } + + private void func_22182_a(ArrayList var1, int var2, int var3, IProgressUpdate var4) { + Iterator var5 = var1.iterator(); + + while(var5.hasNext()) { + File var6 = (File)var5.next(); + File[] var7 = var6.listFiles(); + func_22179_a(var7); + var6.delete(); + ++var2; + int var8 = (int)Math.round(100.0D * (double)var2 / (double)var3); + var4.setLoadingProgress(var8); + } + + } +} diff --git a/src/net/minecraft/src/SaveFormatComparator.java b/src/net/minecraft/src/SaveFormatComparator.java new file mode 100644 index 0000000..6794648 --- /dev/null +++ b/src/net/minecraft/src/SaveFormatComparator.java @@ -0,0 +1,45 @@ +package net.minecraft.src; + +public class SaveFormatComparator implements Comparable { + private final String fileName; + private final String displayName; + private final long field_22169_c; + private final long field_22168_d; + private final boolean field_22167_e; + + public SaveFormatComparator(String var1, String var2, long var3, long var5, boolean var7) { + this.fileName = var1; + this.displayName = var2; + this.field_22169_c = var3; + this.field_22168_d = var5; + this.field_22167_e = var7; + } + + public String getFileName() { + return this.fileName; + } + + public String getDisplayName() { + return this.displayName; + } + + public long func_22159_c() { + return this.field_22168_d; + } + + public boolean func_22161_d() { + return this.field_22167_e; + } + + public long func_22163_e() { + return this.field_22169_c; + } + + public int func_22160_a(SaveFormatComparator var1) { + return this.field_22169_c < var1.field_22169_c ? 1 : (this.field_22169_c > var1.field_22169_c ? -1 : this.fileName.compareTo(var1.fileName)); + } + + public int compareTo(Object var1) { + return this.func_22160_a((SaveFormatComparator)var1); + } +} diff --git a/src/net/minecraft/src/SaveFormatOld.java b/src/net/minecraft/src/SaveFormatOld.java new file mode 100644 index 0000000..7808c5c --- /dev/null +++ b/src/net/minecraft/src/SaveFormatOld.java @@ -0,0 +1,122 @@ +package net.minecraft.src; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.util.ArrayList; +import java.util.List; + +public class SaveFormatOld implements ISaveFormat { + protected final File field_22180_a; + + public SaveFormatOld(File var1) { + if(!var1.exists()) { + var1.mkdirs(); + } + + this.field_22180_a = var1; + } + + public String func_22178_a() { + return "Old Format"; + } + + public List func_22176_b() { + ArrayList var1 = new ArrayList(); + + for(int var2 = 0; var2 < 5; ++var2) { + String var3 = "World" + (var2 + 1); + WorldInfo var4 = this.func_22173_b(var3); + if(var4 != null) { + var1.add(new SaveFormatComparator(var3, "", var4.getLastTimePlayed(), var4.getSizeOnDisk(), false)); + } + } + + return var1; + } + + public void flushCache() { + } + + public WorldInfo func_22173_b(String var1) { + File var2 = new File(this.field_22180_a, var1); + if(!var2.exists()) { + return null; + } else { + File var3 = new File(var2, "level.dat"); + NBTTagCompound var4; + NBTTagCompound var5; + if(var3.exists()) { + try { + var4 = CompressedStreamTools.func_1138_a(new FileInputStream(var3)); + var5 = var4.getCompoundTag("Data"); + return new WorldInfo(var5); + } catch (Exception var7) { + var7.printStackTrace(); + } + } + + var3 = new File(var2, "level.dat_old"); + if(var3.exists()) { + try { + var4 = CompressedStreamTools.func_1138_a(new FileInputStream(var3)); + var5 = var4.getCompoundTag("Data"); + return new WorldInfo(var5); + } catch (Exception var6) { + var6.printStackTrace(); + } + } + + return null; + } + } + + public void func_22170_a(String var1, String var2) { + File var3 = new File(this.field_22180_a, var1); + if(var3.exists()) { + File var4 = new File(var3, "level.dat"); + if(var4.exists()) { + try { + NBTTagCompound var5 = CompressedStreamTools.func_1138_a(new FileInputStream(var4)); + NBTTagCompound var6 = var5.getCompoundTag("Data"); + var6.setString("LevelName", var2); + CompressedStreamTools.writeGzippedCompoundToOutputStream(var5, new FileOutputStream(var4)); + } catch (Exception var7) { + var7.printStackTrace(); + } + } + + } + } + + public void func_22172_c(String var1) { + File var2 = new File(this.field_22180_a, var1); + if(var2.exists()) { + func_22179_a(var2.listFiles()); + var2.delete(); + } + } + + protected static void func_22179_a(File[] var0) { + for(int var1 = 0; var1 < var0.length; ++var1) { + if(var0[var1].isDirectory()) { + func_22179_a(var0[var1].listFiles()); + } + + var0[var1].delete(); + } + + } + + public ISaveHandler getSaveLoader(String var1, boolean var2) { + return new SaveHandler(this.field_22180_a, var1, var2); + } + + public boolean isOldMapFormat(String var1) { + return false; + } + + public boolean convertMapFormat(String var1, IProgressUpdate var2) { + return false; + } +} diff --git a/src/net/minecraft/src/SaveHandler.java b/src/net/minecraft/src/SaveHandler.java new file mode 100644 index 0000000..c2ea9bc --- /dev/null +++ b/src/net/minecraft/src/SaveHandler.java @@ -0,0 +1,170 @@ +package net.minecraft.src; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.List; +import java.util.logging.Logger; + +public class SaveHandler implements ISaveHandler { + private static final Logger logger = Logger.getLogger("Minecraft"); + private final File saveDirectory; + private final File playersDirectory; + private final File field_28114_d; + private final long now = System.currentTimeMillis(); + + public SaveHandler(File var1, String var2, boolean var3) { + this.saveDirectory = new File(var1, var2); + this.saveDirectory.mkdirs(); + this.playersDirectory = new File(this.saveDirectory, "players"); + this.field_28114_d = new File(this.saveDirectory, "data"); + this.field_28114_d.mkdirs(); + if(var3) { + this.playersDirectory.mkdirs(); + } + + this.func_22154_d(); + } + + private void func_22154_d() { + try { + File var1 = new File(this.saveDirectory, "session.lock"); + DataOutputStream var2 = new DataOutputStream(new FileOutputStream(var1)); + + try { + var2.writeLong(this.now); + } finally { + var2.close(); + } + + } catch (IOException var7) { + var7.printStackTrace(); + throw new RuntimeException("Failed to check session lock, aborting"); + } + } + + protected File getSaveDirectory() { + return this.saveDirectory; + } + + public void func_22150_b() { + try { + File var1 = new File(this.saveDirectory, "session.lock"); + DataInputStream var2 = new DataInputStream(new FileInputStream(var1)); + + try { + if(var2.readLong() != this.now) { + throw new MinecraftException("The save is being accessed from another location, aborting"); + } + } finally { + var2.close(); + } + + } catch (IOException var7) { + throw new MinecraftException("Failed to check session lock, aborting"); + } + } + + public IChunkLoader getChunkLoader(WorldProvider var1) { + if(var1 instanceof WorldProviderHell) { + File var2 = new File(this.saveDirectory, "DIM-1"); + var2.mkdirs(); + return new ChunkLoader(var2, true); + } else { + return new ChunkLoader(this.saveDirectory, true); + } + } + + public WorldInfo loadWorldInfo() { + File var1 = new File(this.saveDirectory, "level.dat"); + NBTTagCompound var2; + NBTTagCompound var3; + if(var1.exists()) { + try { + var2 = CompressedStreamTools.func_1138_a(new FileInputStream(var1)); + var3 = var2.getCompoundTag("Data"); + return new WorldInfo(var3); + } catch (Exception var5) { + var5.printStackTrace(); + } + } + + var1 = new File(this.saveDirectory, "level.dat_old"); + if(var1.exists()) { + try { + var2 = CompressedStreamTools.func_1138_a(new FileInputStream(var1)); + var3 = var2.getCompoundTag("Data"); + return new WorldInfo(var3); + } catch (Exception var4) { + var4.printStackTrace(); + } + } + + return null; + } + + public void saveWorldInfoAndPlayer(WorldInfo var1, List var2) { + NBTTagCompound var3 = var1.getNBTTagCompoundWithPlayer(var2); + NBTTagCompound var4 = new NBTTagCompound(); + var4.setTag("Data", var3); + + try { + File var5 = new File(this.saveDirectory, "level.dat_new"); + File var6 = new File(this.saveDirectory, "level.dat_old"); + File var7 = new File(this.saveDirectory, "level.dat"); + CompressedStreamTools.writeGzippedCompoundToOutputStream(var4, new FileOutputStream(var5)); + if(var6.exists()) { + var6.delete(); + } + + var7.renameTo(var6); + if(var7.exists()) { + var7.delete(); + } + + var5.renameTo(var7); + if(var5.exists()) { + var5.delete(); + } + } catch (Exception var8) { + var8.printStackTrace(); + } + + } + + public void saveWorldInfo(WorldInfo var1) { + NBTTagCompound var2 = var1.getNBTTagCompound(); + NBTTagCompound var3 = new NBTTagCompound(); + var3.setTag("Data", var2); + + try { + File var4 = new File(this.saveDirectory, "level.dat_new"); + File var5 = new File(this.saveDirectory, "level.dat_old"); + File var6 = new File(this.saveDirectory, "level.dat"); + CompressedStreamTools.writeGzippedCompoundToOutputStream(var3, new FileOutputStream(var4)); + if(var5.exists()) { + var5.delete(); + } + + var6.renameTo(var5); + if(var6.exists()) { + var6.delete(); + } + + var4.renameTo(var6); + if(var4.exists()) { + var4.delete(); + } + } catch (Exception var7) { + var7.printStackTrace(); + } + + } + + public File func_28113_a(String var1) { + return new File(this.field_28114_d, var1 + ".dat"); + } +} diff --git a/src/net/minecraft/src/SaveHandlerMP.java b/src/net/minecraft/src/SaveHandlerMP.java new file mode 100644 index 0000000..a7f7325 --- /dev/null +++ b/src/net/minecraft/src/SaveHandlerMP.java @@ -0,0 +1,27 @@ +package net.minecraft.src; + +import java.io.File; +import java.util.List; + +public class SaveHandlerMP implements ISaveHandler { + public WorldInfo loadWorldInfo() { + return null; + } + + public void func_22150_b() { + } + + public IChunkLoader getChunkLoader(WorldProvider var1) { + return null; + } + + public void saveWorldInfoAndPlayer(WorldInfo var1, List var2) { + } + + public void saveWorldInfo(WorldInfo var1) { + } + + public File func_28113_a(String var1) { + return null; + } +} diff --git a/src/net/minecraft/src/SaveOldDir.java b/src/net/minecraft/src/SaveOldDir.java new file mode 100644 index 0000000..3c796f5 --- /dev/null +++ b/src/net/minecraft/src/SaveOldDir.java @@ -0,0 +1,26 @@ +package net.minecraft.src; + +import java.io.File; +import java.util.List; + +public class SaveOldDir extends SaveHandler { + public SaveOldDir(File var1, String var2, boolean var3) { + super(var1, var2, var3); + } + + public IChunkLoader getChunkLoader(WorldProvider var1) { + File var2 = this.getSaveDirectory(); + if(var1 instanceof WorldProviderHell) { + File var3 = new File(var2, "DIM-1"); + var3.mkdirs(); + return new McRegionChunkLoader(var3); + } else { + return new McRegionChunkLoader(var2); + } + } + + public void saveWorldInfoAndPlayer(WorldInfo var1, List var2) { + var1.setSaveVersion(19132); + super.saveWorldInfoAndPlayer(var1, var2); + } +} diff --git a/src/net/minecraft/src/ScaledResolution.java b/src/net/minecraft/src/ScaledResolution.java new file mode 100644 index 0000000..cd110a8 --- /dev/null +++ b/src/net/minecraft/src/ScaledResolution.java @@ -0,0 +1,36 @@ +package net.minecraft.src; + +public class ScaledResolution { + private int scaledWidth; + private int scaledHeight; + public double field_25121_a; + public double field_25120_b; + public int scaleFactor; + + public ScaledResolution(GameSettings var1, int var2, int var3) { + this.scaledWidth = var2; + this.scaledHeight = var3; + this.scaleFactor = 1; + int var4 = var1.guiScale; + if(var4 == 0) { + var4 = 1000; + } + + while(this.scaleFactor < var4 && this.scaledWidth / (this.scaleFactor + 1) >= 320 && this.scaledHeight / (this.scaleFactor + 1) >= 240) { + ++this.scaleFactor; + } + + this.field_25121_a = (double)this.scaledWidth / (double)this.scaleFactor; + this.field_25120_b = (double)this.scaledHeight / (double)this.scaleFactor; + this.scaledWidth = (int)Math.ceil(this.field_25121_a); + this.scaledHeight = (int)Math.ceil(this.field_25120_b); + } + + public int getScaledWidth() { + return this.scaledWidth; + } + + public int getScaledHeight() { + return this.scaledHeight; + } +} diff --git a/src/net/minecraft/src/ScreenShotHelper.java b/src/net/minecraft/src/ScreenShotHelper.java new file mode 100644 index 0000000..c6313a9 --- /dev/null +++ b/src/net/minecraft/src/ScreenShotHelper.java @@ -0,0 +1,69 @@ +package net.minecraft.src; + +import java.awt.image.BufferedImage; +import java.io.File; +import java.nio.ByteBuffer; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.Date; +import javax.imageio.ImageIO; +import org.lwjgl.BufferUtils; +import org.lwjgl.opengl.GL11; + +public class ScreenShotHelper { + private static DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd_HH.mm.ss"); + private static ByteBuffer buffer; + private static byte[] pixelData; + private static int[] imageData; + + public static String saveScreenshot(File var0, int var1, int var2) { + try { + File var3 = new File(var0, "screenshots"); + var3.mkdir(); + if(buffer == null || buffer.capacity() < var1 * var2) { + buffer = BufferUtils.createByteBuffer(var1 * var2 * 3); + } + + if(imageData == null || imageData.length < var1 * var2 * 3) { + pixelData = new byte[var1 * var2 * 3]; + imageData = new int[var1 * var2]; + } + + GL11.glPixelStorei(GL11.GL_PACK_ALIGNMENT, 1); + GL11.glPixelStorei(GL11.GL_UNPACK_ALIGNMENT, 1); + buffer.clear(); + GL11.glReadPixels(0, 0, var1, var2, GL11.GL_RGB, GL11.GL_UNSIGNED_BYTE, (ByteBuffer)buffer); + buffer.clear(); + String var4 = "" + dateFormat.format(new Date()); + int var6 = 1; + + while(true) { + File var5 = new File(var3, var4 + (var6 == 1 ? "" : "_" + var6) + ".png"); + if(!var5.exists()) { + buffer.get(pixelData); + + for(int var7 = 0; var7 < var1; ++var7) { + for(int var8 = 0; var8 < var2; ++var8) { + int var9 = var7 + (var2 - var8 - 1) * var1; + int var10 = pixelData[var9 * 3 + 0] & 255; + int var11 = pixelData[var9 * 3 + 1] & 255; + int var12 = pixelData[var9 * 3 + 2] & 255; + int var13 = -16777216 | var10 << 16 | var11 << 8 | var12; + imageData[var7 + var8 * var1] = var13; + } + } + + BufferedImage var15 = new BufferedImage(var1, var2, 1); + var15.setRGB(0, 0, var1, var2, imageData, 0, var1); + ImageIO.write(var15, "png", var5); + return "Saved screenshot as " + var5.getName(); + } + + ++var6; + } + } catch (Exception var14) { + var14.printStackTrace(); + return "Failed to save: " + var14; + } + } +} diff --git a/src/net/minecraft/src/Session.java b/src/net/minecraft/src/Session.java new file mode 100644 index 0000000..4efcbae --- /dev/null +++ b/src/net/minecraft/src/Session.java @@ -0,0 +1,47 @@ +package net.minecraft.src; + +import java.util.ArrayList; +import java.util.List; + +public class Session { + public static List registeredBlocksList = new ArrayList(); + public String username; + public String sessionId; + public String mpPassParameter; + + public Session(String var1, String var2) { + this.username = var1; + this.sessionId = var2; + } + + static { + registeredBlocksList.add(Block.stone); + registeredBlocksList.add(Block.cobblestone); + registeredBlocksList.add(Block.brick); + registeredBlocksList.add(Block.dirt); + registeredBlocksList.add(Block.planks); + registeredBlocksList.add(Block.wood); + registeredBlocksList.add(Block.leaves); + registeredBlocksList.add(Block.torchWood); + registeredBlocksList.add(Block.stairSingle); + registeredBlocksList.add(Block.glass); + registeredBlocksList.add(Block.cobblestoneMossy); + registeredBlocksList.add(Block.sapling); + registeredBlocksList.add(Block.plantYellow); + registeredBlocksList.add(Block.plantRed); + registeredBlocksList.add(Block.mushroomBrown); + registeredBlocksList.add(Block.mushroomRed); + registeredBlocksList.add(Block.sand); + registeredBlocksList.add(Block.gravel); + registeredBlocksList.add(Block.sponge); + registeredBlocksList.add(Block.cloth); + registeredBlocksList.add(Block.oreCoal); + registeredBlocksList.add(Block.oreIron); + registeredBlocksList.add(Block.oreGold); + registeredBlocksList.add(Block.blockSteel); + registeredBlocksList.add(Block.blockGold); + registeredBlocksList.add(Block.bookShelf); + registeredBlocksList.add(Block.tnt); + registeredBlocksList.add(Block.obsidian); + } +} diff --git a/src/net/minecraft/src/ShapedRecipes.java b/src/net/minecraft/src/ShapedRecipes.java new file mode 100644 index 0000000..d5e0e41 --- /dev/null +++ b/src/net/minecraft/src/ShapedRecipes.java @@ -0,0 +1,79 @@ +package net.minecraft.src; + +public class ShapedRecipes implements IRecipe { + private int recipeWidth; + private int recipeHeight; + private ItemStack[] recipeItems; + private ItemStack recipeOutput; + public final int recipeOutputItemID; + + public ShapedRecipes(int var1, int var2, ItemStack[] var3, ItemStack var4) { + this.recipeOutputItemID = var4.itemID; + this.recipeWidth = var1; + this.recipeHeight = var2; + this.recipeItems = var3; + this.recipeOutput = var4; + } + + public ItemStack getRecipeOutput() { + return this.recipeOutput; + } + + public boolean matches(InventoryCrafting var1) { + for(int var2 = 0; var2 <= 3 - this.recipeWidth; ++var2) { + for(int var3 = 0; var3 <= 3 - this.recipeHeight; ++var3) { + if(this.func_21137_a(var1, var2, var3, true)) { + return true; + } + + if(this.func_21137_a(var1, var2, var3, false)) { + return true; + } + } + } + + return false; + } + + private boolean func_21137_a(InventoryCrafting var1, int var2, int var3, boolean var4) { + for(int var5 = 0; var5 < 3; ++var5) { + for(int var6 = 0; var6 < 3; ++var6) { + int var7 = var5 - var2; + int var8 = var6 - var3; + ItemStack var9 = null; + if(var7 >= 0 && var8 >= 0 && var7 < this.recipeWidth && var8 < this.recipeHeight) { + if(var4) { + var9 = this.recipeItems[this.recipeWidth - var7 - 1 + var8 * this.recipeWidth]; + } else { + var9 = this.recipeItems[var7 + var8 * this.recipeWidth]; + } + } + + ItemStack var10 = var1.func_21103_b(var5, var6); + if(var10 != null || var9 != null) { + if(var10 == null && var9 != null || var10 != null && var9 == null) { + return false; + } + + if(var9.itemID != var10.itemID) { + return false; + } + + if(var9.getItemDamage() != -1 && var9.getItemDamage() != var10.getItemDamage()) { + return false; + } + } + } + } + + return true; + } + + public ItemStack getCraftingResult(InventoryCrafting var1) { + return new ItemStack(this.recipeOutput.itemID, this.recipeOutput.stackSize, this.recipeOutput.getItemDamage()); + } + + public int getRecipeSize() { + return this.recipeWidth * this.recipeHeight; + } +} diff --git a/src/net/minecraft/src/ShapelessRecipes.java b/src/net/minecraft/src/ShapelessRecipes.java new file mode 100644 index 0000000..b887a5f --- /dev/null +++ b/src/net/minecraft/src/ShapelessRecipes.java @@ -0,0 +1,56 @@ +package net.minecraft.src; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +public class ShapelessRecipes implements IRecipe { + private final ItemStack recipeOutput; + private final List recipeItems; + + public ShapelessRecipes(ItemStack var1, List var2) { + this.recipeOutput = var1; + this.recipeItems = var2; + } + + public ItemStack getRecipeOutput() { + return this.recipeOutput; + } + + public boolean matches(InventoryCrafting var1) { + ArrayList var2 = new ArrayList(this.recipeItems); + + for(int var3 = 0; var3 < 3; ++var3) { + for(int var4 = 0; var4 < 3; ++var4) { + ItemStack var5 = var1.func_21103_b(var4, var3); + if(var5 != null) { + boolean var6 = false; + Iterator var7 = var2.iterator(); + + while(var7.hasNext()) { + ItemStack var8 = (ItemStack)var7.next(); + if(var5.itemID == var8.itemID && (var8.getItemDamage() == -1 || var5.getItemDamage() == var8.getItemDamage())) { + var6 = true; + var2.remove(var8); + break; + } + } + + if(!var6) { + return false; + } + } + } + } + + return var2.isEmpty(); + } + + public ItemStack getCraftingResult(InventoryCrafting var1) { + return this.recipeOutput.copy(); + } + + public int getRecipeSize() { + return this.recipeItems.size(); + } +} diff --git a/src/net/minecraft/src/SignModel.java b/src/net/minecraft/src/SignModel.java new file mode 100644 index 0000000..516eaab --- /dev/null +++ b/src/net/minecraft/src/SignModel.java @@ -0,0 +1,17 @@ +package net.minecraft.src; + +public class SignModel { + public ModelRenderer signBoard = new ModelRenderer(0, 0); + public ModelRenderer signStick; + + public SignModel() { + this.signBoard.addBox(-12.0F, -14.0F, -1.0F, 24, 12, 2, 0.0F); + this.signStick = new ModelRenderer(0, 14); + this.signStick.addBox(-1.0F, -2.0F, -1.0F, 2, 14, 2, 0.0F); + } + + public void func_887_a() { + this.signBoard.render(1.0F / 16.0F); + this.signStick.render(1.0F / 16.0F); + } +} diff --git a/src/net/minecraft/src/Slot.java b/src/net/minecraft/src/Slot.java new file mode 100644 index 0000000..4f119d8 --- /dev/null +++ b/src/net/minecraft/src/Slot.java @@ -0,0 +1,53 @@ +package net.minecraft.src; + +public class Slot { + private final int slotIndex; + private final IInventory inventory; + public int slotNumber; + public int xDisplayPosition; + public int yDisplayPosition; + + public Slot(IInventory var1, int var2, int var3, int var4) { + this.inventory = var1; + this.slotIndex = var2; + this.xDisplayPosition = var3; + this.yDisplayPosition = var4; + } + + public void onPickupFromSlot(ItemStack var1) { + this.onSlotChanged(); + } + + public boolean isItemValid(ItemStack var1) { + return true; + } + + public ItemStack getStack() { + return this.inventory.getStackInSlot(this.slotIndex); + } + + public boolean getHasStack() { + return this.getStack() != null; + } + + public void putStack(ItemStack var1) { + this.inventory.setInventorySlotContents(this.slotIndex, var1); + this.onSlotChanged(); + } + + public void onSlotChanged() { + this.inventory.onInventoryChanged(); + } + + public int getSlotStackLimit() { + return this.inventory.getInventoryStackLimit(); + } + + public int getBackgroundIconIndex() { + return -1; + } + + public ItemStack decrStackSize(int var1) { + return this.inventory.decrStackSize(this.slotIndex, var1); + } +} diff --git a/src/net/minecraft/src/SlotArmor.java b/src/net/minecraft/src/SlotArmor.java new file mode 100644 index 0000000..4aa7bec --- /dev/null +++ b/src/net/minecraft/src/SlotArmor.java @@ -0,0 +1,20 @@ +package net.minecraft.src; + +class SlotArmor extends Slot { + final int armorType; + final ContainerPlayer inventory; + + SlotArmor(ContainerPlayer var1, IInventory var2, int var3, int var4, int var5, int var6) { + super(var2, var3, var4, var5); + this.inventory = var1; + this.armorType = var6; + } + + public int getSlotStackLimit() { + return 1; + } + + public boolean isItemValid(ItemStack var1) { + return var1.getItem() instanceof ItemArmor ? ((ItemArmor)var1.getItem()).armorType == this.armorType : (var1.getItem().shiftedIndex == Block.pumpkin.blockID ? this.armorType == 0 : false); + } +} diff --git a/src/net/minecraft/src/SlotCrafting.java b/src/net/minecraft/src/SlotCrafting.java new file mode 100644 index 0000000..659d584 --- /dev/null +++ b/src/net/minecraft/src/SlotCrafting.java @@ -0,0 +1,48 @@ +package net.minecraft.src; + +public class SlotCrafting extends Slot { + private final IInventory craftMatrix; + private EntityPlayer thePlayer; + + public SlotCrafting(EntityPlayer var1, IInventory var2, IInventory var3, int var4, int var5, int var6) { + super(var3, var4, var5, var6); + this.thePlayer = var1; + this.craftMatrix = var2; + } + + public boolean isItemValid(ItemStack var1) { + return false; + } + + public void onPickupFromSlot(ItemStack var1) { + var1.onCrafting(this.thePlayer.worldObj, this.thePlayer); + if(var1.itemID == Block.workbench.blockID) { + this.thePlayer.addStat(AchievementList.buildWorkBench, 1); + } else if(var1.itemID == Item.pickaxeWood.shiftedIndex) { + this.thePlayer.addStat(AchievementList.buildPickaxe, 1); + } else if(var1.itemID == Block.stoneOvenIdle.blockID) { + this.thePlayer.addStat(AchievementList.buildFurnace, 1); + } else if(var1.itemID == Item.hoeWood.shiftedIndex) { + this.thePlayer.addStat(AchievementList.buildHoe, 1); + } else if(var1.itemID == Item.bread.shiftedIndex) { + this.thePlayer.addStat(AchievementList.makeBread, 1); + } else if(var1.itemID == Item.cake.shiftedIndex) { + this.thePlayer.addStat(AchievementList.bakeCake, 1); + } else if(var1.itemID == Item.pickaxeStone.shiftedIndex) { + this.thePlayer.addStat(AchievementList.buildBetterPickaxe, 1); + } else if(var1.itemID == Item.swordWood.shiftedIndex) { + this.thePlayer.addStat(AchievementList.buildSword, 1); + } + + for(int var2 = 0; var2 < this.craftMatrix.getSizeInventory(); ++var2) { + ItemStack var3 = this.craftMatrix.getStackInSlot(var2); + if(var3 != null) { + this.craftMatrix.decrStackSize(var2, 1); + if(var3.getItem().hasContainerItem()) { + this.craftMatrix.setInventorySlotContents(var2, new ItemStack(var3.getItem().getContainerItem())); + } + } + } + + } +} diff --git a/src/net/minecraft/src/SlotFurnace.java b/src/net/minecraft/src/SlotFurnace.java new file mode 100644 index 0000000..2ab62c5 --- /dev/null +++ b/src/net/minecraft/src/SlotFurnace.java @@ -0,0 +1,27 @@ +package net.minecraft.src; + +public class SlotFurnace extends Slot { + private EntityPlayer thePlayer; + + public SlotFurnace(EntityPlayer var1, IInventory var2, int var3, int var4, int var5) { + super(var2, var3, var4, var5); + this.thePlayer = var1; + } + + public boolean isItemValid(ItemStack var1) { + return false; + } + + public void onPickupFromSlot(ItemStack var1) { + var1.onCrafting(this.thePlayer.worldObj, this.thePlayer); + if(var1.itemID == Item.ingotIron.shiftedIndex) { + this.thePlayer.addStat(AchievementList.acquireIron, 1); + } + + if(var1.itemID == Item.fishCooked.shiftedIndex) { + this.thePlayer.addStat(AchievementList.cookFish, 1); + } + + super.onPickupFromSlot(var1); + } +} diff --git a/src/net/minecraft/src/SorterStatsBlock.java b/src/net/minecraft/src/SorterStatsBlock.java new file mode 100644 index 0000000..7d05408 --- /dev/null +++ b/src/net/minecraft/src/SorterStatsBlock.java @@ -0,0 +1,52 @@ +package net.minecraft.src; + +import java.util.Comparator; + +class SorterStatsBlock implements Comparator { + final GuiStats field_27299_a; + final GuiSlotStatsBlock field_27298_b; + + SorterStatsBlock(GuiSlotStatsBlock var1, GuiStats var2) { + this.field_27298_b = var1; + this.field_27299_a = var2; + } + + public int func_27297_a(StatCrafting var1, StatCrafting var2) { + int var3 = var1.func_25072_b(); + int var4 = var2.func_25072_b(); + StatBase var5 = null; + StatBase var6 = null; + if(this.field_27298_b.field_27271_e == 2) { + var5 = StatList.mineBlockStatArray[var3]; + var6 = StatList.mineBlockStatArray[var4]; + } else if(this.field_27298_b.field_27271_e == 0) { + var5 = StatList.field_25158_z[var3]; + var6 = StatList.field_25158_z[var4]; + } else if(this.field_27298_b.field_27271_e == 1) { + var5 = StatList.field_25172_A[var3]; + var6 = StatList.field_25172_A[var4]; + } + + if(var5 != null || var6 != null) { + if(var5 == null) { + return 1; + } + + if(var6 == null) { + return -1; + } + + int var7 = GuiStats.func_27142_c(this.field_27298_b.field_27274_a).writeStat(var5); + int var8 = GuiStats.func_27142_c(this.field_27298_b.field_27274_a).writeStat(var6); + if(var7 != var8) { + return (var7 - var8) * this.field_27298_b.field_27270_f; + } + } + + return var3 - var4; + } + + public int compare(Object var1, Object var2) { + return this.func_27297_a((StatCrafting)var1, (StatCrafting)var2); + } +} diff --git a/src/net/minecraft/src/SorterStatsItem.java b/src/net/minecraft/src/SorterStatsItem.java new file mode 100644 index 0000000..0e7ad49 --- /dev/null +++ b/src/net/minecraft/src/SorterStatsItem.java @@ -0,0 +1,52 @@ +package net.minecraft.src; + +import java.util.Comparator; + +class SorterStatsItem implements Comparator { + final GuiStats field_27373_a; + final GuiSlotStatsItem field_27372_b; + + SorterStatsItem(GuiSlotStatsItem var1, GuiStats var2) { + this.field_27372_b = var1; + this.field_27373_a = var2; + } + + public int func_27371_a(StatCrafting var1, StatCrafting var2) { + int var3 = var1.func_25072_b(); + int var4 = var2.func_25072_b(); + StatBase var5 = null; + StatBase var6 = null; + if(this.field_27372_b.field_27271_e == 0) { + var5 = StatList.field_25170_B[var3]; + var6 = StatList.field_25170_B[var4]; + } else if(this.field_27372_b.field_27271_e == 1) { + var5 = StatList.field_25158_z[var3]; + var6 = StatList.field_25158_z[var4]; + } else if(this.field_27372_b.field_27271_e == 2) { + var5 = StatList.field_25172_A[var3]; + var6 = StatList.field_25172_A[var4]; + } + + if(var5 != null || var6 != null) { + if(var5 == null) { + return 1; + } + + if(var6 == null) { + return -1; + } + + int var7 = GuiStats.func_27142_c(this.field_27372_b.field_27275_a).writeStat(var5); + int var8 = GuiStats.func_27142_c(this.field_27372_b.field_27275_a).writeStat(var6); + if(var7 != var8) { + return (var7 - var8) * this.field_27372_b.field_27270_f; + } + } + + return var3 - var4; + } + + public int compare(Object var1, Object var2) { + return this.func_27371_a((StatCrafting)var1, (StatCrafting)var2); + } +} diff --git a/src/net/minecraft/src/SoundManager.java b/src/net/minecraft/src/SoundManager.java new file mode 100644 index 0000000..59152d2 --- /dev/null +++ b/src/net/minecraft/src/SoundManager.java @@ -0,0 +1,196 @@ +package net.minecraft.src; + +import java.io.File; +import java.util.Random; +import paulscode.sound.SoundSystem; +import paulscode.sound.SoundSystemConfig; +import paulscode.sound.codecs.CodecJOrbis; +import paulscode.sound.codecs.CodecWav; +import paulscode.sound.libraries.LibraryLWJGLOpenAL; + +public class SoundManager { + private static SoundSystem sndSystem; + private SoundPool soundPoolSounds = new SoundPool(); + private SoundPool soundPoolStreaming = new SoundPool(); + private SoundPool soundPoolMusic = new SoundPool(); + private int field_587_e = 0; + private GameSettings options; + private static boolean loaded = false; + private Random rand = new Random(); + private int ticksBeforeMusic = this.rand.nextInt(12000); + + public void loadSoundSettings(GameSettings var1) { + this.soundPoolStreaming.field_1657_b = false; + this.options = var1; + if(!loaded && (var1 == null || var1.soundVolume != 0.0F || var1.musicVolume != 0.0F)) { + this.tryToSetLibraryAndCodecs(); + } + + } + + private void tryToSetLibraryAndCodecs() { + try { + float var1 = this.options.soundVolume; + float var2 = this.options.musicVolume; + this.options.soundVolume = 0.0F; + this.options.musicVolume = 0.0F; + this.options.saveOptions(); + SoundSystemConfig.addLibrary(LibraryLWJGLOpenAL.class); + SoundSystemConfig.setCodec("ogg", CodecJOrbis.class); + SoundSystemConfig.setCodec("mus", CodecMus.class); + SoundSystemConfig.setCodec("wav", CodecWav.class); + sndSystem = new SoundSystem(); + this.options.soundVolume = var1; + this.options.musicVolume = var2; + this.options.saveOptions(); + } catch (Throwable var3) { + var3.printStackTrace(); + System.err.println("error linking with the LibraryJavaSound plug-in"); + } + + loaded = true; + } + + public void onSoundOptionsChanged() { + if(!loaded && (this.options.soundVolume != 0.0F || this.options.musicVolume != 0.0F)) { + this.tryToSetLibraryAndCodecs(); + } + + if(loaded) { + if(this.options.musicVolume == 0.0F) { + sndSystem.stop("BgMusic"); + } else { + sndSystem.setVolume("BgMusic", this.options.musicVolume); + } + } + + } + + public void closeMinecraft() { + if(loaded) { + sndSystem.cleanup(); + } + + } + + public void addSound(String var1, File var2) { + this.soundPoolSounds.addSound(var1, var2); + } + + public void addStreaming(String var1, File var2) { + this.soundPoolStreaming.addSound(var1, var2); + } + + public void addMusic(String var1, File var2) { + this.soundPoolMusic.addSound(var1, var2); + } + + public void playRandomMusicIfReady() { + if(loaded && this.options.musicVolume != 0.0F) { + if(!sndSystem.playing("BgMusic") && !sndSystem.playing("streaming")) { + if(this.ticksBeforeMusic > 0) { + --this.ticksBeforeMusic; + return; + } + + SoundPoolEntry var1 = this.soundPoolMusic.getRandomSound(); + if(var1 != null) { + this.ticksBeforeMusic = this.rand.nextInt(12000) + 12000; + sndSystem.backgroundMusic("BgMusic", var1.soundUrl, var1.soundName, false); + sndSystem.setVolume("BgMusic", this.options.musicVolume); + sndSystem.play("BgMusic"); + } + } + + } + } + + public void func_338_a(EntityLiving var1, float var2) { + if(loaded && this.options.soundVolume != 0.0F) { + if(var1 != null) { + float var3 = var1.prevRotationYaw + (var1.rotationYaw - var1.prevRotationYaw) * var2; + double var4 = var1.prevPosX + (var1.posX - var1.prevPosX) * (double)var2; + double var6 = var1.prevPosY + (var1.posY - var1.prevPosY) * (double)var2; + double var8 = var1.prevPosZ + (var1.posZ - var1.prevPosZ) * (double)var2; + float var10 = MathHelper.cos(-var3 * ((float)Math.PI / 180.0F) - (float)Math.PI); + float var11 = MathHelper.sin(-var3 * ((float)Math.PI / 180.0F) - (float)Math.PI); + float var12 = -var11; + float var13 = 0.0F; + float var14 = -var10; + float var15 = 0.0F; + float var16 = 1.0F; + float var17 = 0.0F; + sndSystem.setListenerPosition((float)var4, (float)var6, (float)var8); + sndSystem.setListenerOrientation(var12, var13, var14, var15, var16, var17); + } + } + } + + public void playStreaming(String var1, float var2, float var3, float var4, float var5, float var6) { + if(loaded && this.options.soundVolume != 0.0F) { + String var7 = "streaming"; + if(sndSystem.playing("streaming")) { + sndSystem.stop("streaming"); + } + + if(var1 != null) { + SoundPoolEntry var8 = this.soundPoolStreaming.getRandomSoundFromSoundPool(var1); + if(var8 != null && var5 > 0.0F) { + if(sndSystem.playing("BgMusic")) { + sndSystem.stop("BgMusic"); + } + + float var9 = 16.0F; + sndSystem.newStreamingSource(true, var7, var8.soundUrl, var8.soundName, false, var2, var3, var4, 2, var9 * 4.0F); + sndSystem.setVolume(var7, 0.5F * this.options.soundVolume); + sndSystem.play(var7); + } + + } + } + } + + public void playSound(String var1, float var2, float var3, float var4, float var5, float var6) { + if(loaded && this.options.soundVolume != 0.0F) { + SoundPoolEntry var7 = this.soundPoolSounds.getRandomSoundFromSoundPool(var1); + if(var7 != null && var5 > 0.0F) { + this.field_587_e = (this.field_587_e + 1) % 256; + String var8 = "sound_" + this.field_587_e; + float var9 = 16.0F; + if(var5 > 1.0F) { + var9 *= var5; + } + + sndSystem.newSource(var5 > 1.0F, var8, var7.soundUrl, var7.soundName, false, var2, var3, var4, 2, var9); + sndSystem.setPitch(var8, var6); + if(var5 > 1.0F) { + var5 = 1.0F; + } + + sndSystem.setVolume(var8, var5 * this.options.soundVolume); + sndSystem.play(var8); + } + + } + } + + public void playSoundFX(String var1, float var2, float var3) { + if(loaded && this.options.soundVolume != 0.0F) { + SoundPoolEntry var4 = this.soundPoolSounds.getRandomSoundFromSoundPool(var1); + if(var4 != null) { + this.field_587_e = (this.field_587_e + 1) % 256; + String var5 = "sound_" + this.field_587_e; + sndSystem.newSource(false, var5, var4.soundUrl, var4.soundName, false, 0.0F, 0.0F, 0.0F, 0, 0.0F); + if(var2 > 1.0F) { + var2 = 1.0F; + } + + var2 *= 0.25F; + sndSystem.setPitch(var5, var3); + sndSystem.setVolume(var5, var2 * this.options.soundVolume); + sndSystem.play(var5); + } + + } + } +} diff --git a/src/net/minecraft/src/SoundPool.java b/src/net/minecraft/src/SoundPool.java new file mode 100644 index 0000000..11b30dd --- /dev/null +++ b/src/net/minecraft/src/SoundPool.java @@ -0,0 +1,52 @@ +package net.minecraft.src; + +import java.io.File; +import java.net.MalformedURLException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Random; + +public class SoundPool { + private Random rand = new Random(); + private Map nameToSoundPoolEntriesMapping = new HashMap(); + private List allSoundPoolEntries = new ArrayList(); + public int numberOfSoundPoolEntries = 0; + public boolean field_1657_b = true; + + public SoundPoolEntry addSound(String var1, File var2) { + try { + String var3 = var1; + var1 = var1.substring(0, var1.indexOf(".")); + if(this.field_1657_b) { + while(Character.isDigit(var1.charAt(var1.length() - 1))) { + var1 = var1.substring(0, var1.length() - 1); + } + } + + var1 = var1.replaceAll("/", "."); + if(!this.nameToSoundPoolEntriesMapping.containsKey(var1)) { + this.nameToSoundPoolEntriesMapping.put(var1, new ArrayList()); + } + + SoundPoolEntry var4 = new SoundPoolEntry(var3, var2.toURI().toURL()); + ((List)this.nameToSoundPoolEntriesMapping.get(var1)).add(var4); + this.allSoundPoolEntries.add(var4); + ++this.numberOfSoundPoolEntries; + return var4; + } catch (MalformedURLException var5) { + var5.printStackTrace(); + throw new RuntimeException(var5); + } + } + + public SoundPoolEntry getRandomSoundFromSoundPool(String var1) { + List var2 = (List)this.nameToSoundPoolEntriesMapping.get(var1); + return var2 == null ? null : (SoundPoolEntry)var2.get(this.rand.nextInt(var2.size())); + } + + public SoundPoolEntry getRandomSound() { + return this.allSoundPoolEntries.size() == 0 ? null : (SoundPoolEntry)this.allSoundPoolEntries.get(this.rand.nextInt(this.allSoundPoolEntries.size())); + } +} diff --git a/src/net/minecraft/src/SoundPoolEntry.java b/src/net/minecraft/src/SoundPoolEntry.java new file mode 100644 index 0000000..5ef583c --- /dev/null +++ b/src/net/minecraft/src/SoundPoolEntry.java @@ -0,0 +1,13 @@ +package net.minecraft.src; + +import java.net.URL; + +public class SoundPoolEntry { + public String soundName; + public URL soundUrl; + + public SoundPoolEntry(String var1, URL var2) { + this.soundName = var1; + this.soundUrl = var2; + } +} diff --git a/src/net/minecraft/src/SpawnListEntry.java b/src/net/minecraft/src/SpawnListEntry.java new file mode 100644 index 0000000..dcff03e --- /dev/null +++ b/src/net/minecraft/src/SpawnListEntry.java @@ -0,0 +1,11 @@ +package net.minecraft.src; + +public class SpawnListEntry { + public Class entityClass; + public int spawnRarityRate; + + public SpawnListEntry(Class var1, int var2) { + this.entityClass = var1; + this.spawnRarityRate = var2; + } +} diff --git a/src/net/minecraft/src/SpawnerAnimals.java b/src/net/minecraft/src/SpawnerAnimals.java new file mode 100644 index 0000000..7b2bfcd --- /dev/null +++ b/src/net/minecraft/src/SpawnerAnimals.java @@ -0,0 +1,248 @@ +package net.minecraft.src; + +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Set; + +public final class SpawnerAnimals { + private static Set eligibleChunksForSpawning = new HashSet(); + protected static final Class[] nightSpawnEntities = new Class[]{EntitySpider.class, EntityZombie.class, EntitySkeleton.class}; + + protected static ChunkPosition getRandomSpawningPointInChunk(World var0, int var1, int var2) { + int var3 = var1 + var0.rand.nextInt(16); + int var4 = var0.rand.nextInt(128); + int var5 = var2 + var0.rand.nextInt(16); + return new ChunkPosition(var3, var4, var5); + } + + public static final int performSpawning(World var0, boolean var1, boolean var2) { + if(!var1 && !var2) { + return 0; + } else { + eligibleChunksForSpawning.clear(); + + int var3; + int var6; + for(var3 = 0; var3 < var0.playerEntities.size(); ++var3) { + EntityPlayer var4 = (EntityPlayer)var0.playerEntities.get(var3); + int var5 = MathHelper.floor_double(var4.posX / 16.0D); + var6 = MathHelper.floor_double(var4.posZ / 16.0D); + byte var7 = 8; + + for(int var8 = -var7; var8 <= var7; ++var8) { + for(int var9 = -var7; var9 <= var7; ++var9) { + eligibleChunksForSpawning.add(new ChunkCoordIntPair(var8 + var5, var9 + var6)); + } + } + } + + var3 = 0; + ChunkCoordinates var35 = var0.getSpawnPoint(); + EnumCreatureType[] var36 = EnumCreatureType.values(); + var6 = var36.length; + + label133: + for(int var37 = 0; var37 < var6; ++var37) { + EnumCreatureType var38 = var36[var37]; + if((!var38.getPeacefulCreature() || var2) && (var38.getPeacefulCreature() || var1) && var0.countEntities(var38.getCreatureClass()) <= var38.getMaxNumberOfCreature() * eligibleChunksForSpawning.size() / 256) { + Iterator var39 = eligibleChunksForSpawning.iterator(); + + label130: + while(true) { + SpawnListEntry var15; + int var18; + int var19; + int var42; + do { + do { + ChunkCoordIntPair var10; + List var12; + do { + do { + if(!var39.hasNext()) { + continue label133; + } + + var10 = (ChunkCoordIntPair)var39.next(); + BiomeGenBase var11 = var0.getWorldChunkManager().getBiomeGenAtChunkCoord(var10); + var12 = var11.getSpawnableList(var38); + } while(var12 == null); + } while(var12.isEmpty()); + + int var13 = 0; + + for(Iterator var14 = var12.iterator(); var14.hasNext(); var13 += var15.spawnRarityRate) { + var15 = (SpawnListEntry)var14.next(); + } + + int var40 = var0.rand.nextInt(var13); + var15 = (SpawnListEntry)var12.get(0); + Iterator var16 = var12.iterator(); + + while(var16.hasNext()) { + SpawnListEntry var17 = (SpawnListEntry)var16.next(); + var40 -= var17.spawnRarityRate; + if(var40 < 0) { + var15 = var17; + break; + } + } + + ChunkPosition var41 = getRandomSpawningPointInChunk(var0, var10.chunkXPos * 16, var10.chunkZPos * 16); + var42 = var41.x; + var18 = var41.y; + var19 = var41.z; + } while(var0.isBlockNormalCube(var42, var18, var19)); + } while(var0.getBlockMaterial(var42, var18, var19) != var38.getCreatureMaterial()); + + int var20 = 0; + + for(int var21 = 0; var21 < 3; ++var21) { + int var22 = var42; + int var23 = var18; + int var24 = var19; + byte var25 = 6; + + for(int var26 = 0; var26 < 4; ++var26) { + var22 += var0.rand.nextInt(var25) - var0.rand.nextInt(var25); + var23 += var0.rand.nextInt(1) - var0.rand.nextInt(1); + var24 += var0.rand.nextInt(var25) - var0.rand.nextInt(var25); + if(canCreatureTypeSpawnAtLocation(var38, var0, var22, var23, var24)) { + float var27 = (float)var22 + 0.5F; + float var28 = (float)var23; + float var29 = (float)var24 + 0.5F; + if(var0.getClosestPlayer((double)var27, (double)var28, (double)var29, 24.0D) == null) { + float var30 = var27 - (float)var35.x; + float var31 = var28 - (float)var35.y; + float var32 = var29 - (float)var35.z; + float var33 = var30 * var30 + var31 * var31 + var32 * var32; + if(var33 >= 576.0F) { + EntityLiving var43; + try { + var43 = (EntityLiving)var15.entityClass.getConstructor(new Class[]{World.class}).newInstance(new Object[]{var0}); + } catch (Exception var34) { + var34.printStackTrace(); + return var3; + } + + var43.setLocationAndAngles((double)var27, (double)var28, (double)var29, var0.rand.nextFloat() * 360.0F, 0.0F); + if(var43.getCanSpawnHere()) { + ++var20; + var0.entityJoinedWorld(var43); + creatureSpecificInit(var43, var0, var27, var28, var29); + if(var20 >= var43.getMaxSpawnedInChunk()) { + continue label130; + } + } + + var3 += var20; + } + } + } + } + } + } + } + } + + return var3; + } + } + + private static boolean canCreatureTypeSpawnAtLocation(EnumCreatureType var0, World var1, int var2, int var3, int var4) { + return var0.getCreatureMaterial() == Material.water ? var1.getBlockMaterial(var2, var3, var4).getIsLiquid() && !var1.isBlockNormalCube(var2, var3 + 1, var4) : var1.isBlockNormalCube(var2, var3 - 1, var4) && !var1.isBlockNormalCube(var2, var3, var4) && !var1.getBlockMaterial(var2, var3, var4).getIsLiquid() && !var1.isBlockNormalCube(var2, var3 + 1, var4); + } + + private static void creatureSpecificInit(EntityLiving var0, World var1, float var2, float var3, float var4) { + if(var0 instanceof EntitySpider && var1.rand.nextInt(100) == 0) { + EntitySkeleton var5 = new EntitySkeleton(var1); + var5.setLocationAndAngles((double)var2, (double)var3, (double)var4, var0.rotationYaw, 0.0F); + var1.entityJoinedWorld(var5); + var5.mountEntity(var0); + } else if(var0 instanceof EntitySheep) { + ((EntitySheep)var0).setFleeceColor(EntitySheep.getRandomFleeceColor(var1.rand)); + } + + } + + public static boolean performSleepSpawning(World var0, List var1) { + boolean var2 = false; + Pathfinder var3 = new Pathfinder(var0); + Iterator var4 = var1.iterator(); + + while(true) { + EntityPlayer var5; + Class[] var6; + do { + do { + if(!var4.hasNext()) { + return var2; + } + + var5 = (EntityPlayer)var4.next(); + var6 = nightSpawnEntities; + } while(var6 == null); + } while(var6.length == 0); + + boolean var7 = false; + + for(int var8 = 0; var8 < 20 && !var7; ++var8) { + int var9 = MathHelper.floor_double(var5.posX) + var0.rand.nextInt(32) - var0.rand.nextInt(32); + int var10 = MathHelper.floor_double(var5.posZ) + var0.rand.nextInt(32) - var0.rand.nextInt(32); + int var11 = MathHelper.floor_double(var5.posY) + var0.rand.nextInt(16) - var0.rand.nextInt(16); + if(var11 < 1) { + var11 = 1; + } else if(var11 > 128) { + var11 = 128; + } + + int var12 = var0.rand.nextInt(var6.length); + + int var13; + for(var13 = var11; var13 > 2 && !var0.isBlockNormalCube(var9, var13 - 1, var10); --var13) { + } + + while(!canCreatureTypeSpawnAtLocation(EnumCreatureType.monster, var0, var9, var13, var10) && var13 < var11 + 16 && var13 < 128) { + ++var13; + } + + if(var13 < var11 + 16 && var13 < 128) { + float var14 = (float)var9 + 0.5F; + float var15 = (float)var13; + float var16 = (float)var10 + 0.5F; + + EntityLiving var17; + try { + var17 = (EntityLiving)var6[var12].getConstructor(new Class[]{World.class}).newInstance(new Object[]{var0}); + } catch (Exception var21) { + var21.printStackTrace(); + return var2; + } + + var17.setLocationAndAngles((double)var14, (double)var15, (double)var16, var0.rand.nextFloat() * 360.0F, 0.0F); + if(var17.getCanSpawnHere()) { + PathEntity var18 = var3.createEntityPathTo(var17, var5, 32.0F); + if(var18 != null && var18.pathLength > 1) { + PathPoint var19 = var18.func_22328_c(); + if(Math.abs((double)var19.xCoord - var5.posX) < 1.5D && Math.abs((double)var19.zCoord - var5.posZ) < 1.5D && Math.abs((double)var19.yCoord - var5.posY) < 1.5D) { + ChunkCoordinates var20 = BlockBed.getNearestEmptyChunkCoordinates(var0, MathHelper.floor_double(var5.posX), MathHelper.floor_double(var5.posY), MathHelper.floor_double(var5.posZ), 1); + if(var20 == null) { + var20 = new ChunkCoordinates(var9, var13 + 1, var10); + } + + var17.setLocationAndAngles((double)((float)var20.x + 0.5F), (double)var20.y, (double)((float)var20.z + 0.5F), 0.0F, 0.0F); + var0.entityJoinedWorld(var17); + creatureSpecificInit(var17, var0, (float)var20.x + 0.5F, (float)var20.y, (float)var20.z + 0.5F); + var5.wakeUpPlayer(true, false, false); + var17.playLivingSound(); + var2 = true; + var7 = true; + } + } + } + } + } + } + } +} diff --git a/src/net/minecraft/src/StatBase.java b/src/net/minecraft/src/StatBase.java new file mode 100644 index 0000000..ce13d49 --- /dev/null +++ b/src/net/minecraft/src/StatBase.java @@ -0,0 +1,65 @@ +package net.minecraft.src; + +import java.text.DecimalFormat; +import java.text.NumberFormat; +import java.util.Locale; + +public class StatBase { + public final int statId; + public final String statName; + public boolean field_27088_g; + public String statGuid; + private final IStatType field_26902_a; + private static NumberFormat field_26903_b = NumberFormat.getIntegerInstance(Locale.US); + public static IStatType field_27087_i = new StatTypeSimple(); + private static DecimalFormat field_26904_c = new DecimalFormat("########0.00"); + public static IStatType field_27086_j = new StatTypeTime(); + public static IStatType field_27085_k = new StatTypeDistance(); + + public StatBase(int var1, String var2, IStatType var3) { + this.field_27088_g = false; + this.statId = var1; + this.statName = var2; + this.field_26902_a = var3; + } + + public StatBase(int var1, String var2) { + this(var1, var2, field_27087_i); + } + + public StatBase func_27082_h() { + this.field_27088_g = true; + return this; + } + + public StatBase registerStat() { + if(StatList.field_25169_C.containsKey(Integer.valueOf(this.statId))) { + throw new RuntimeException("Duplicate stat id: \"" + ((StatBase)StatList.field_25169_C.get(Integer.valueOf(this.statId))).statName + "\" and \"" + this.statName + "\" at id " + this.statId); + } else { + StatList.field_25188_a.add(this); + StatList.field_25169_C.put(Integer.valueOf(this.statId), this); + this.statGuid = AchievementMap.getGuid(this.statId); + return this; + } + } + + public boolean func_25067_a() { + return false; + } + + public String func_27084_a(int var1) { + return this.field_26902_a.func_27192_a(var1); + } + + public String toString() { + return this.statName; + } + + static NumberFormat func_27083_i() { + return field_26903_b; + } + + static DecimalFormat func_27081_j() { + return field_26904_c; + } +} diff --git a/src/net/minecraft/src/StatBasic.java b/src/net/minecraft/src/StatBasic.java new file mode 100644 index 0000000..c7a2d6c --- /dev/null +++ b/src/net/minecraft/src/StatBasic.java @@ -0,0 +1,17 @@ +package net.minecraft.src; + +public class StatBasic extends StatBase { + public StatBasic(int var1, String var2, IStatType var3) { + super(var1, var2, var3); + } + + public StatBasic(int var1, String var2) { + super(var1, var2); + } + + public StatBase registerStat() { + super.registerStat(); + StatList.field_25187_b.add(this); + return this; + } +} diff --git a/src/net/minecraft/src/StatCollector.java b/src/net/minecraft/src/StatCollector.java new file mode 100644 index 0000000..a65c0ec --- /dev/null +++ b/src/net/minecraft/src/StatCollector.java @@ -0,0 +1,13 @@ +package net.minecraft.src; + +public class StatCollector { + private static StringTranslate localizedName = StringTranslate.getInstance(); + + public static String translateToLocal(String var0) { + return localizedName.translateKey(var0); + } + + public static String translateToLocalFormatted(String var0, Object... var1) { + return localizedName.translateKeyFormat(var0, var1); + } +} diff --git a/src/net/minecraft/src/StatCrafting.java b/src/net/minecraft/src/StatCrafting.java new file mode 100644 index 0000000..987ad8f --- /dev/null +++ b/src/net/minecraft/src/StatCrafting.java @@ -0,0 +1,14 @@ +package net.minecraft.src; + +public class StatCrafting extends StatBase { + private final int field_25073_a; + + public StatCrafting(int var1, String var2, int var3) { + super(var1, var2); + this.field_25073_a = var3; + } + + public int func_25072_b() { + return this.field_25073_a; + } +} diff --git a/src/net/minecraft/src/StatFileWriter.java b/src/net/minecraft/src/StatFileWriter.java new file mode 100644 index 0000000..946f276 --- /dev/null +++ b/src/net/minecraft/src/StatFileWriter.java @@ -0,0 +1,201 @@ +package net.minecraft.src; + +import java.io.File; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +public class StatFileWriter { + private Map field_25102_a = new HashMap(); + private Map field_25101_b = new HashMap(); + private boolean field_27189_c = false; + private StatsSyncher statsSyncher; + + public StatFileWriter(Session var1, File var2) { + File var3 = new File(var2, "stats"); + if(!var3.exists()) { + var3.mkdir(); + } + + File[] var4 = var2.listFiles(); + int var5 = var4.length; + + for(int var6 = 0; var6 < var5; ++var6) { + File var7 = var4[var6]; + if(var7.getName().startsWith("stats_") && var7.getName().endsWith(".dat")) { + File var8 = new File(var3, var7.getName()); + if(!var8.exists()) { + System.out.println("Relocating " + var7.getName()); + var7.renameTo(var8); + } + } + } + + this.statsSyncher = new StatsSyncher(var1, this, var3); + } + + public void readStat(StatBase var1, int var2) { + this.writeStatToMap(this.field_25101_b, var1, var2); + this.writeStatToMap(this.field_25102_a, var1, var2); + this.field_27189_c = true; + } + + private void writeStatToMap(Map var1, StatBase var2, int var3) { + Integer var4 = (Integer)var1.get(var2); + int var5 = var4 == null ? 0 : var4.intValue(); + var1.put(var2, Integer.valueOf(var5 + var3)); + } + + public Map func_27176_a() { + return new HashMap(this.field_25101_b); + } + + public void func_27179_a(Map var1) { + if(var1 != null) { + this.field_27189_c = true; + Iterator var2 = var1.keySet().iterator(); + + while(var2.hasNext()) { + StatBase var3 = (StatBase)var2.next(); + this.writeStatToMap(this.field_25101_b, var3, ((Integer)var1.get(var3)).intValue()); + this.writeStatToMap(this.field_25102_a, var3, ((Integer)var1.get(var3)).intValue()); + } + + } + } + + public void func_27180_b(Map var1) { + if(var1 != null) { + Iterator var2 = var1.keySet().iterator(); + + while(var2.hasNext()) { + StatBase var3 = (StatBase)var2.next(); + Integer var4 = (Integer)this.field_25101_b.get(var3); + int var5 = var4 == null ? 0 : var4.intValue(); + this.field_25102_a.put(var3, Integer.valueOf(((Integer)var1.get(var3)).intValue() + var5)); + } + + } + } + + public void func_27187_c(Map var1) { + if(var1 != null) { + this.field_27189_c = true; + Iterator var2 = var1.keySet().iterator(); + + while(var2.hasNext()) { + StatBase var3 = (StatBase)var2.next(); + this.writeStatToMap(this.field_25101_b, var3, ((Integer)var1.get(var3)).intValue()); + } + + } + } + + public static Map func_27177_a(String var0) { + HashMap var1 = new HashMap(); + + try { + String var2 = "local"; + StringBuilder var3 = new StringBuilder(); + J_JsonRootNode var4 = (new J_JdomParser()).func_27367_a(var0); + List var5 = var4.func_27217_b(new Object[]{"stats-change"}); + Iterator var6 = var5.iterator(); + + while(var6.hasNext()) { + J_JsonNode var7 = (J_JsonNode)var6.next(); + Map var8 = var7.func_27214_c(); + Entry var9 = (Entry)var8.entrySet().iterator().next(); + int var10 = Integer.parseInt(((J_JsonStringNode)var9.getKey()).func_27216_b()); + int var11 = Integer.parseInt(((J_JsonNode)var9.getValue()).func_27216_b()); + StatBase var12 = StatList.func_27361_a(var10); + if(var12 == null) { + System.out.println(var10 + " is not a valid stat"); + } else { + var3.append(StatList.func_27361_a(var10).statGuid).append(","); + var3.append(var11).append(","); + var1.put(var12, Integer.valueOf(var11)); + } + } + + MD5String var14 = new MD5String(var2); + String var15 = var14.func_27369_a(var3.toString()); + if(!var15.equals(var4.func_27213_a(new Object[]{"checksum"}))) { + System.out.println("CHECKSUM MISMATCH"); + return null; + } + } catch (J_InvalidSyntaxException var13) { + var13.printStackTrace(); + } + + return var1; + } + + public static String func_27185_a(String var0, String var1, Map var2) { + StringBuilder var3 = new StringBuilder(); + StringBuilder var4 = new StringBuilder(); + boolean var5 = true; + var3.append("{\r\n"); + if(var0 != null && var1 != null) { + var3.append(" \"user\":{\r\n"); + var3.append(" \"name\":\"").append(var0).append("\",\r\n"); + var3.append(" \"sessionid\":\"").append(var1).append("\"\r\n"); + var3.append(" },\r\n"); + } + + var3.append(" \"stats-change\":["); + Iterator var6 = var2.keySet().iterator(); + + while(var6.hasNext()) { + StatBase var7 = (StatBase)var6.next(); + if(!var5) { + var3.append("},"); + } else { + var5 = false; + } + + var3.append("\r\n {\"").append(var7.statId).append("\":").append(var2.get(var7)); + var4.append(var7.statGuid).append(","); + var4.append(var2.get(var7)).append(","); + } + + if(!var5) { + var3.append("}"); + } + + MD5String var8 = new MD5String(var1); + var3.append("\r\n ],\r\n"); + var3.append(" \"checksum\":\"").append(var8.func_27369_a(var4.toString())).append("\"\r\n"); + var3.append("}"); + return var3.toString(); + } + + public boolean hasAchievementUnlocked(Achievement var1) { + return this.field_25102_a.containsKey(var1); + } + + public boolean func_27181_b(Achievement var1) { + return var1.parentAchievement == null || this.hasAchievementUnlocked(var1.parentAchievement); + } + + public int writeStat(StatBase var1) { + Integer var2 = (Integer)this.field_25102_a.get(var1); + return var2 == null ? 0 : var2.intValue(); + } + + public void func_27175_b() { + } + + public void syncStats() { + this.statsSyncher.syncStatsFileWithMap(this.func_27176_a()); + } + + public void func_27178_d() { + if(this.field_27189_c && this.statsSyncher.func_27420_b()) { + this.statsSyncher.func_27424_a(this.func_27176_a()); + } + + this.statsSyncher.func_27425_c(); + } +} diff --git a/src/net/minecraft/src/StatList.java b/src/net/minecraft/src/StatList.java new file mode 100644 index 0000000..a1b8d16 --- /dev/null +++ b/src/net/minecraft/src/StatList.java @@ -0,0 +1,179 @@ +package net.minecraft.src; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +public class StatList { + protected static Map field_25169_C = new HashMap(); + public static List field_25188_a = new ArrayList(); + public static List field_25187_b = new ArrayList(); + public static List field_25186_c = new ArrayList(); + public static List field_25185_d = new ArrayList(); + public static StatBase startGameStat = (new StatBasic(1000, StatCollector.translateToLocal("stat.startGame"))).func_27082_h().registerStat(); + public static StatBase createWorldStat = (new StatBasic(1001, StatCollector.translateToLocal("stat.createWorld"))).func_27082_h().registerStat(); + public static StatBase loadWorldStat = (new StatBasic(1002, StatCollector.translateToLocal("stat.loadWorld"))).func_27082_h().registerStat(); + public static StatBase joinMultiplayerStat = (new StatBasic(1003, StatCollector.translateToLocal("stat.joinMultiplayer"))).func_27082_h().registerStat(); + public static StatBase leaveGameStat = (new StatBasic(1004, StatCollector.translateToLocal("stat.leaveGame"))).func_27082_h().registerStat(); + public static StatBase minutesPlayedStat = (new StatBasic(1100, StatCollector.translateToLocal("stat.playOneMinute"), StatBase.field_27086_j)).func_27082_h().registerStat(); + public static StatBase distanceWalkedStat = (new StatBasic(2000, StatCollector.translateToLocal("stat.walkOneCm"), StatBase.field_27085_k)).func_27082_h().registerStat(); + public static StatBase distanceSwumStat = (new StatBasic(2001, StatCollector.translateToLocal("stat.swimOneCm"), StatBase.field_27085_k)).func_27082_h().registerStat(); + public static StatBase distanceFallenStat = (new StatBasic(2002, StatCollector.translateToLocal("stat.fallOneCm"), StatBase.field_27085_k)).func_27082_h().registerStat(); + public static StatBase distanceClimbedStat = (new StatBasic(2003, StatCollector.translateToLocal("stat.climbOneCm"), StatBase.field_27085_k)).func_27082_h().registerStat(); + public static StatBase distanceFlownStat = (new StatBasic(2004, StatCollector.translateToLocal("stat.flyOneCm"), StatBase.field_27085_k)).func_27082_h().registerStat(); + public static StatBase distanceDoveStat = (new StatBasic(2005, StatCollector.translateToLocal("stat.diveOneCm"), StatBase.field_27085_k)).func_27082_h().registerStat(); + public static StatBase distanceByMinecartStat = (new StatBasic(2006, StatCollector.translateToLocal("stat.minecartOneCm"), StatBase.field_27085_k)).func_27082_h().registerStat(); + public static StatBase distanceByBoatStat = (new StatBasic(2007, StatCollector.translateToLocal("stat.boatOneCm"), StatBase.field_27085_k)).func_27082_h().registerStat(); + public static StatBase distanceByPigStat = (new StatBasic(2008, StatCollector.translateToLocal("stat.pigOneCm"), StatBase.field_27085_k)).func_27082_h().registerStat(); + public static StatBase jumpStat = (new StatBasic(2010, StatCollector.translateToLocal("stat.jump"))).func_27082_h().registerStat(); + public static StatBase dropStat = (new StatBasic(2011, StatCollector.translateToLocal("stat.drop"))).func_27082_h().registerStat(); + public static StatBase damageDealtStat = (new StatBasic(2020, StatCollector.translateToLocal("stat.damageDealt"))).registerStat(); + public static StatBase damageTakenStat = (new StatBasic(2021, StatCollector.translateToLocal("stat.damageTaken"))).registerStat(); + public static StatBase deathsStat = (new StatBasic(2022, StatCollector.translateToLocal("stat.deaths"))).registerStat(); + public static StatBase mobKillsStat = (new StatBasic(2023, StatCollector.translateToLocal("stat.mobKills"))).registerStat(); + public static StatBase playerKillsStat = (new StatBasic(2024, StatCollector.translateToLocal("stat.playerKills"))).registerStat(); + public static StatBase fishCaughtStat = (new StatBasic(2025, StatCollector.translateToLocal("stat.fishCaught"))).registerStat(); + public static StatBase[] mineBlockStatArray = func_25153_a("stat.mineBlock", 16777216); + public static StatBase[] field_25158_z; + public static StatBase[] field_25172_A; + public static StatBase[] field_25170_B; + private static boolean field_25166_D; + private static boolean field_25164_E; + + public static void func_27360_a() { + } + + public static void func_25154_a() { + field_25172_A = func_25155_a(field_25172_A, "stat.useItem", 16908288, 0, Block.blocksList.length); + field_25170_B = func_25149_b(field_25170_B, "stat.breakItem", 16973824, 0, Block.blocksList.length); + field_25166_D = true; + func_25157_c(); + } + + public static void func_25151_b() { + field_25172_A = func_25155_a(field_25172_A, "stat.useItem", 16908288, Block.blocksList.length, 32000); + field_25170_B = func_25149_b(field_25170_B, "stat.breakItem", 16973824, Block.blocksList.length, 32000); + field_25164_E = true; + func_25157_c(); + } + + public static void func_25157_c() { + if(field_25166_D && field_25164_E) { + HashSet var0 = new HashSet(); + Iterator var1 = CraftingManager.getInstance().getRecipeList().iterator(); + + while(var1.hasNext()) { + IRecipe var2 = (IRecipe)var1.next(); + var0.add(Integer.valueOf(var2.getRecipeOutput().itemID)); + } + + var1 = FurnaceRecipes.smelting().getSmeltingList().values().iterator(); + + while(var1.hasNext()) { + ItemStack var4 = (ItemStack)var1.next(); + var0.add(Integer.valueOf(var4.itemID)); + } + + field_25158_z = new StatBase[32000]; + var1 = var0.iterator(); + + while(var1.hasNext()) { + Integer var5 = (Integer)var1.next(); + if(Item.itemsList[var5.intValue()] != null) { + String var3 = StatCollector.translateToLocalFormatted("stat.craftItem", new Object[]{Item.itemsList[var5.intValue()].getStatName()}); + field_25158_z[var5.intValue()] = (new StatCrafting(16842752 + var5.intValue(), var3, var5.intValue())).registerStat(); + } + } + + replaceAllSimilarBlocks(field_25158_z); + } + } + + private static StatBase[] func_25153_a(String var0, int var1) { + StatBase[] var2 = new StatBase[256]; + + for(int var3 = 0; var3 < 256; ++var3) { + if(Block.blocksList[var3] != null && Block.blocksList[var3].getEnableStats()) { + String var4 = StatCollector.translateToLocalFormatted(var0, new Object[]{Block.blocksList[var3].translateBlockName()}); + var2[var3] = (new StatCrafting(var1 + var3, var4, var3)).registerStat(); + field_25185_d.add((StatCrafting)var2[var3]); + } + } + + replaceAllSimilarBlocks(var2); + return var2; + } + + private static StatBase[] func_25155_a(StatBase[] var0, String var1, int var2, int var3, int var4) { + if(var0 == null) { + var0 = new StatBase[32000]; + } + + for(int var5 = var3; var5 < var4; ++var5) { + if(Item.itemsList[var5] != null) { + String var6 = StatCollector.translateToLocalFormatted(var1, new Object[]{Item.itemsList[var5].getStatName()}); + var0[var5] = (new StatCrafting(var2 + var5, var6, var5)).registerStat(); + if(var5 >= Block.blocksList.length) { + field_25186_c.add((StatCrafting)var0[var5]); + } + } + } + + replaceAllSimilarBlocks(var0); + return var0; + } + + private static StatBase[] func_25149_b(StatBase[] var0, String var1, int var2, int var3, int var4) { + if(var0 == null) { + var0 = new StatBase[32000]; + } + + for(int var5 = var3; var5 < var4; ++var5) { + if(Item.itemsList[var5] != null && Item.itemsList[var5].isDamagable()) { + String var6 = StatCollector.translateToLocalFormatted(var1, new Object[]{Item.itemsList[var5].getStatName()}); + var0[var5] = (new StatCrafting(var2 + var5, var6, var5)).registerStat(); + } + } + + replaceAllSimilarBlocks(var0); + return var0; + } + + private static void replaceAllSimilarBlocks(StatBase[] var0) { + replaceSimilarBlocks(var0, Block.waterStill.blockID, Block.waterMoving.blockID); + replaceSimilarBlocks(var0, Block.lavaStill.blockID, Block.lavaStill.blockID); + replaceSimilarBlocks(var0, Block.pumpkinLantern.blockID, Block.pumpkin.blockID); + replaceSimilarBlocks(var0, Block.stoneOvenActive.blockID, Block.stoneOvenIdle.blockID); + replaceSimilarBlocks(var0, Block.oreRedstoneGlowing.blockID, Block.oreRedstone.blockID); + replaceSimilarBlocks(var0, Block.redstoneRepeaterActive.blockID, Block.redstoneRepeaterIdle.blockID); + replaceSimilarBlocks(var0, Block.torchRedstoneActive.blockID, Block.torchRedstoneIdle.blockID); + replaceSimilarBlocks(var0, Block.mushroomRed.blockID, Block.mushroomBrown.blockID); + replaceSimilarBlocks(var0, Block.stairDouble.blockID, Block.stairSingle.blockID); + replaceSimilarBlocks(var0, Block.grass.blockID, Block.dirt.blockID); + replaceSimilarBlocks(var0, Block.tilledField.blockID, Block.dirt.blockID); + } + + private static void replaceSimilarBlocks(StatBase[] var0, int var1, int var2) { + if(var0[var1] != null && var0[var2] == null) { + var0[var2] = var0[var1]; + } else { + field_25188_a.remove(var0[var1]); + field_25185_d.remove(var0[var1]); + field_25187_b.remove(var0[var1]); + var0[var1] = var0[var2]; + } + } + + public static StatBase func_27361_a(int var0) { + return (StatBase)field_25169_C.get(Integer.valueOf(var0)); + } + + static { + AchievementList.func_27374_a(); + field_25166_D = false; + field_25164_E = false; + } +} diff --git a/src/net/minecraft/src/StatStringFormatKeyInv.java b/src/net/minecraft/src/StatStringFormatKeyInv.java new file mode 100644 index 0000000..4236762 --- /dev/null +++ b/src/net/minecraft/src/StatStringFormatKeyInv.java @@ -0,0 +1,16 @@ +package net.minecraft.src; + +import net.minecraft.client.Minecraft; +import org.lwjgl.input.Keyboard; + +public class StatStringFormatKeyInv implements IStatStringFormat { + final Minecraft mc; + + public StatStringFormatKeyInv(Minecraft var1) { + this.mc = var1; + } + + public String formatString(String var1) { + return String.format(var1, new Object[]{Keyboard.getKeyName(this.mc.gameSettings.keyBindInventory.keyCode)}); + } +} diff --git a/src/net/minecraft/src/StatTypeDistance.java b/src/net/minecraft/src/StatTypeDistance.java new file mode 100644 index 0000000..9e21ff8 --- /dev/null +++ b/src/net/minecraft/src/StatTypeDistance.java @@ -0,0 +1,9 @@ +package net.minecraft.src; + +final class StatTypeDistance implements IStatType { + public String func_27192_a(int var1) { + double var3 = (double)var1 / 100.0D; + double var5 = var3 / 1000.0D; + return var5 > 0.5D ? StatBase.func_27081_j().format(var5) + " km" : (var3 > 0.5D ? StatBase.func_27081_j().format(var3) + " m" : var1 + " cm"); + } +} diff --git a/src/net/minecraft/src/StatTypeSimple.java b/src/net/minecraft/src/StatTypeSimple.java new file mode 100644 index 0000000..2c6d3ae --- /dev/null +++ b/src/net/minecraft/src/StatTypeSimple.java @@ -0,0 +1,7 @@ +package net.minecraft.src; + +final class StatTypeSimple implements IStatType { + public String func_27192_a(int var1) { + return StatBase.func_27083_i().format((long)var1); + } +} diff --git a/src/net/minecraft/src/StatTypeTime.java b/src/net/minecraft/src/StatTypeTime.java new file mode 100644 index 0000000..897ab1f --- /dev/null +++ b/src/net/minecraft/src/StatTypeTime.java @@ -0,0 +1,12 @@ +package net.minecraft.src; + +final class StatTypeTime implements IStatType { + public String func_27192_a(int var1) { + double var2 = (double)var1 / 20.0D; + double var4 = var2 / 60.0D; + double var6 = var4 / 60.0D; + double var8 = var6 / 24.0D; + double var10 = var8 / 365.0D; + return var10 > 0.5D ? StatBase.func_27081_j().format(var10) + " y" : (var8 > 0.5D ? StatBase.func_27081_j().format(var8) + " d" : (var6 > 0.5D ? StatBase.func_27081_j().format(var6) + " h" : (var4 > 0.5D ? StatBase.func_27081_j().format(var4) + " m" : var2 + " s"))); + } +} diff --git a/src/net/minecraft/src/StatsSyncher.java b/src/net/minecraft/src/StatsSyncher.java new file mode 100644 index 0000000..0f73fee --- /dev/null +++ b/src/net/minecraft/src/StatsSyncher.java @@ -0,0 +1,232 @@ +package net.minecraft.src; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.io.PrintWriter; +import java.util.Map; + +public class StatsSyncher { + private volatile boolean field_27438_a = false; + private volatile Map field_27437_b = null; + private volatile Map field_27436_c = null; + private StatFileWriter field_27435_d; + private File field_27434_e; + private File field_27433_f; + private File field_27432_g; + private File field_27431_h; + private File field_27430_i; + private File field_27429_j; + private Session field_27428_k; + private int field_27427_l = 0; + private int field_27426_m = 0; + + public StatsSyncher(Session var1, StatFileWriter var2, File var3) { + this.field_27434_e = new File(var3, "stats_" + var1.username.toLowerCase() + "_unsent.dat"); + this.field_27433_f = new File(var3, "stats_" + var1.username.toLowerCase() + ".dat"); + this.field_27430_i = new File(var3, "stats_" + var1.username.toLowerCase() + "_unsent.old"); + this.field_27429_j = new File(var3, "stats_" + var1.username.toLowerCase() + ".old"); + this.field_27432_g = new File(var3, "stats_" + var1.username.toLowerCase() + "_unsent.tmp"); + this.field_27431_h = new File(var3, "stats_" + var1.username.toLowerCase() + ".tmp"); + if(!var1.username.toLowerCase().equals(var1.username)) { + this.func_28214_a(var3, "stats_" + var1.username + "_unsent.dat", this.field_27434_e); + this.func_28214_a(var3, "stats_" + var1.username + ".dat", this.field_27433_f); + this.func_28214_a(var3, "stats_" + var1.username + "_unsent.old", this.field_27430_i); + this.func_28214_a(var3, "stats_" + var1.username + ".old", this.field_27429_j); + this.func_28214_a(var3, "stats_" + var1.username + "_unsent.tmp", this.field_27432_g); + this.func_28214_a(var3, "stats_" + var1.username + ".tmp", this.field_27431_h); + } + + this.field_27435_d = var2; + this.field_27428_k = var1; + if(this.field_27434_e.exists()) { + var2.func_27179_a(this.func_27415_a(this.field_27434_e, this.field_27432_g, this.field_27430_i)); + } + + this.func_27418_a(); + } + + private void func_28214_a(File var1, String var2, File var3) { + File var4 = new File(var1, var2); + if(var4.exists() && !var4.isDirectory() && !var3.exists()) { + var4.renameTo(var3); + } + + } + + private Map func_27415_a(File var1, File var2, File var3) { + return var1.exists() ? this.func_27408_a(var1) : (var3.exists() ? this.func_27408_a(var3) : (var2.exists() ? this.func_27408_a(var2) : null)); + } + + private Map func_27408_a(File var1) { + BufferedReader var2 = null; + + try { + var2 = new BufferedReader(new FileReader(var1)); + String var3 = ""; + StringBuilder var4 = new StringBuilder(); + + while(true) { + var3 = var2.readLine(); + if(var3 == null) { + Map var5 = StatFileWriter.func_27177_a(var4.toString()); + return var5; + } + + var4.append(var3); + } + } catch (Exception var15) { + var15.printStackTrace(); + } finally { + if(var2 != null) { + try { + var2.close(); + } catch (Exception var14) { + var14.printStackTrace(); + } + } + + } + + return null; + } + + private void func_27410_a(Map var1, File var2, File var3, File var4) throws IOException { + PrintWriter var5 = new PrintWriter(new FileWriter(var3, false)); + + try { + var5.print(StatFileWriter.func_27185_a(this.field_27428_k.username, "local", var1)); + } finally { + var5.close(); + } + + if(var4.exists()) { + var4.delete(); + } + + if(var2.exists()) { + var2.renameTo(var4); + } + + var3.renameTo(var2); + } + + public void func_27418_a() { + if(this.field_27438_a) { + throw new IllegalStateException("Can\'t get stats from server while StatsSyncher is busy!"); + } else { + this.field_27427_l = 100; + this.field_27438_a = true; + (new ThreadStatSyncherReceive(this)).start(); + } + } + + public void func_27424_a(Map var1) { + if(this.field_27438_a) { + throw new IllegalStateException("Can\'t save stats while StatsSyncher is busy!"); + } else { + this.field_27427_l = 100; + this.field_27438_a = true; + (new ThreadStatSyncherSend(this, var1)).start(); + } + } + + public void syncStatsFileWithMap(Map var1) { + int var2 = 30; + + while(this.field_27438_a) { + --var2; + if(var2 <= 0) { + break; + } + + try { + Thread.sleep(100L); + } catch (InterruptedException var10) { + var10.printStackTrace(); + } + } + + this.field_27438_a = true; + + try { + this.func_27410_a(var1, this.field_27434_e, this.field_27432_g, this.field_27430_i); + } catch (Exception var8) { + var8.printStackTrace(); + } finally { + this.field_27438_a = false; + } + + } + + public boolean func_27420_b() { + return this.field_27427_l <= 0 && !this.field_27438_a && this.field_27436_c == null; + } + + public void func_27425_c() { + if(this.field_27427_l > 0) { + --this.field_27427_l; + } + + if(this.field_27426_m > 0) { + --this.field_27426_m; + } + + if(this.field_27436_c != null) { + this.field_27435_d.func_27187_c(this.field_27436_c); + this.field_27436_c = null; + } + + if(this.field_27437_b != null) { + this.field_27435_d.func_27180_b(this.field_27437_b); + this.field_27437_b = null; + } + + } + + static Map func_27422_a(StatsSyncher var0) { + return var0.field_27437_b; + } + + static File func_27423_b(StatsSyncher var0) { + return var0.field_27433_f; + } + + static File func_27411_c(StatsSyncher var0) { + return var0.field_27431_h; + } + + static File func_27413_d(StatsSyncher var0) { + return var0.field_27429_j; + } + + static void func_27412_a(StatsSyncher var0, Map var1, File var2, File var3, File var4) throws IOException { + var0.func_27410_a(var1, var2, var3, var4); + } + + static Map func_27421_a(StatsSyncher var0, Map var1) { + return var0.field_27437_b = var1; + } + + static Map func_27409_a(StatsSyncher var0, File var1, File var2, File var3) { + return var0.func_27415_a(var1, var2, var3); + } + + static boolean func_27416_a(StatsSyncher var0, boolean var1) { + return var0.field_27438_a = var1; + } + + static File func_27414_e(StatsSyncher var0) { + return var0.field_27434_e; + } + + static File func_27417_f(StatsSyncher var0) { + return var0.field_27432_g; + } + + static File func_27419_g(StatsSyncher var0) { + return var0.field_27430_i; + } +} diff --git a/src/net/minecraft/src/StepSound.java b/src/net/minecraft/src/StepSound.java new file mode 100644 index 0000000..47b5f70 --- /dev/null +++ b/src/net/minecraft/src/StepSound.java @@ -0,0 +1,29 @@ +package net.minecraft.src; + +public class StepSound { + public final String field_1678_a; + public final float field_1677_b; + public final float field_1679_c; + + public StepSound(String var1, float var2, float var3) { + this.field_1678_a = var1; + this.field_1677_b = var2; + this.field_1679_c = var3; + } + + public float getVolume() { + return this.field_1677_b; + } + + public float getPitch() { + return this.field_1679_c; + } + + public String stepSoundDir() { + return "step." + this.field_1678_a; + } + + public String func_1145_d() { + return "step." + this.field_1678_a; + } +} diff --git a/src/net/minecraft/src/StepSoundSand.java b/src/net/minecraft/src/StepSoundSand.java new file mode 100644 index 0000000..df4b03f --- /dev/null +++ b/src/net/minecraft/src/StepSoundSand.java @@ -0,0 +1,11 @@ +package net.minecraft.src; + +final class StepSoundSand extends StepSound { + StepSoundSand(String var1, float var2, float var3) { + super(var1, var2, var3); + } + + public String stepSoundDir() { + return "step.gravel"; + } +} diff --git a/src/net/minecraft/src/StepSoundStone.java b/src/net/minecraft/src/StepSoundStone.java new file mode 100644 index 0000000..eacd1cf --- /dev/null +++ b/src/net/minecraft/src/StepSoundStone.java @@ -0,0 +1,11 @@ +package net.minecraft.src; + +final class StepSoundStone extends StepSound { + StepSoundStone(String var1, float var2, float var3) { + super(var1, var2, var3); + } + + public String stepSoundDir() { + return "random.glass"; + } +} diff --git a/src/net/minecraft/src/StringTranslate.java b/src/net/minecraft/src/StringTranslate.java new file mode 100644 index 0000000..68d8b22 --- /dev/null +++ b/src/net/minecraft/src/StringTranslate.java @@ -0,0 +1,36 @@ +package net.minecraft.src; + +import java.io.IOException; +import java.util.Properties; + +public class StringTranslate { + private static StringTranslate instance = new StringTranslate(); + private Properties translateTable = new Properties(); + + private StringTranslate() { + try { + this.translateTable.load(StringTranslate.class.getResourceAsStream("/lang/en_US.lang")); + this.translateTable.load(StringTranslate.class.getResourceAsStream("/lang/stats_US.lang")); + } catch (IOException var2) { + var2.printStackTrace(); + } + + } + + public static StringTranslate getInstance() { + return instance; + } + + public String translateKey(String var1) { + return this.translateTable.getProperty(var1, var1); + } + + public String translateKeyFormat(String var1, Object... var2) { + String var3 = this.translateTable.getProperty(var1, var1); + return String.format(var3, var2); + } + + public String translateNamedKey(String var1) { + return this.translateTable.getProperty(var1 + ".name", ""); + } +} diff --git a/src/net/minecraft/src/Teleporter.java b/src/net/minecraft/src/Teleporter.java new file mode 100644 index 0000000..22a2deb --- /dev/null +++ b/src/net/minecraft/src/Teleporter.java @@ -0,0 +1,261 @@ +package net.minecraft.src; + +import java.util.Random; + +public class Teleporter { + private Random field_4232_a = new Random(); + + public void func_4107_a(World var1, Entity var2) { + if(!this.func_4106_b(var1, var2)) { + this.func_4108_c(var1, var2); + this.func_4106_b(var1, var2); + } + } + + public boolean func_4106_b(World var1, Entity var2) { + short var3 = 128; + double var4 = -1.0D; + int var6 = 0; + int var7 = 0; + int var8 = 0; + int var9 = MathHelper.floor_double(var2.posX); + int var10 = MathHelper.floor_double(var2.posZ); + + double var18; + for(int var11 = var9 - var3; var11 <= var9 + var3; ++var11) { + double var12 = (double)var11 + 0.5D - var2.posX; + + for(int var14 = var10 - var3; var14 <= var10 + var3; ++var14) { + double var15 = (double)var14 + 0.5D - var2.posZ; + + for(int var17 = 127; var17 >= 0; --var17) { + if(var1.getBlockId(var11, var17, var14) == Block.portal.blockID) { + while(var1.getBlockId(var11, var17 - 1, var14) == Block.portal.blockID) { + --var17; + } + + var18 = (double)var17 + 0.5D - var2.posY; + double var20 = var12 * var12 + var18 * var18 + var15 * var15; + if(var4 < 0.0D || var20 < var4) { + var4 = var20; + var6 = var11; + var7 = var17; + var8 = var14; + } + } + } + } + } + + if(var4 >= 0.0D) { + double var22 = (double)var6 + 0.5D; + double var16 = (double)var7 + 0.5D; + var18 = (double)var8 + 0.5D; + if(var1.getBlockId(var6 - 1, var7, var8) == Block.portal.blockID) { + var22 -= 0.5D; + } + + if(var1.getBlockId(var6 + 1, var7, var8) == Block.portal.blockID) { + var22 += 0.5D; + } + + if(var1.getBlockId(var6, var7, var8 - 1) == Block.portal.blockID) { + var18 -= 0.5D; + } + + if(var1.getBlockId(var6, var7, var8 + 1) == Block.portal.blockID) { + var18 += 0.5D; + } + + var2.setLocationAndAngles(var22, var16, var18, var2.rotationYaw, 0.0F); + var2.motionX = var2.motionY = var2.motionZ = 0.0D; + return true; + } else { + return false; + } + } + + public boolean func_4108_c(World var1, Entity var2) { + byte var3 = 16; + double var4 = -1.0D; + int var6 = MathHelper.floor_double(var2.posX); + int var7 = MathHelper.floor_double(var2.posY); + int var8 = MathHelper.floor_double(var2.posZ); + int var9 = var6; + int var10 = var7; + int var11 = var8; + int var12 = 0; + int var13 = this.field_4232_a.nextInt(4); + + int var14; + double var15; + int var17; + double var18; + int var20; + int var21; + int var22; + int var23; + int var24; + int var25; + int var26; + int var27; + int var28; + double var32; + double var33; + for(var14 = var6 - var3; var14 <= var6 + var3; ++var14) { + var15 = (double)var14 + 0.5D - var2.posX; + + for(var17 = var8 - var3; var17 <= var8 + var3; ++var17) { + var18 = (double)var17 + 0.5D - var2.posZ; + + label293: + for(var20 = 127; var20 >= 0; --var20) { + if(var1.isAirBlock(var14, var20, var17)) { + while(var20 > 0 && var1.isAirBlock(var14, var20 - 1, var17)) { + --var20; + } + + for(var21 = var13; var21 < var13 + 4; ++var21) { + var22 = var21 % 2; + var23 = 1 - var22; + if(var21 % 4 >= 2) { + var22 = -var22; + var23 = -var23; + } + + for(var24 = 0; var24 < 3; ++var24) { + for(var25 = 0; var25 < 4; ++var25) { + for(var26 = -1; var26 < 4; ++var26) { + var27 = var14 + (var25 - 1) * var22 + var24 * var23; + var28 = var20 + var26; + int var29 = var17 + (var25 - 1) * var23 - var24 * var22; + if(var26 < 0 && !var1.getBlockMaterial(var27, var28, var29).isSolid() || var26 >= 0 && !var1.isAirBlock(var27, var28, var29)) { + continue label293; + } + } + } + } + + var32 = (double)var20 + 0.5D - var2.posY; + var33 = var15 * var15 + var32 * var32 + var18 * var18; + if(var4 < 0.0D || var33 < var4) { + var4 = var33; + var9 = var14; + var10 = var20; + var11 = var17; + var12 = var21 % 4; + } + } + } + } + } + } + + if(var4 < 0.0D) { + for(var14 = var6 - var3; var14 <= var6 + var3; ++var14) { + var15 = (double)var14 + 0.5D - var2.posX; + + for(var17 = var8 - var3; var17 <= var8 + var3; ++var17) { + var18 = (double)var17 + 0.5D - var2.posZ; + + label231: + for(var20 = 127; var20 >= 0; --var20) { + if(var1.isAirBlock(var14, var20, var17)) { + while(var1.isAirBlock(var14, var20 - 1, var17)) { + --var20; + } + + for(var21 = var13; var21 < var13 + 2; ++var21) { + var22 = var21 % 2; + var23 = 1 - var22; + + for(var24 = 0; var24 < 4; ++var24) { + for(var25 = -1; var25 < 4; ++var25) { + var26 = var14 + (var24 - 1) * var22; + var27 = var20 + var25; + var28 = var17 + (var24 - 1) * var23; + if(var25 < 0 && !var1.getBlockMaterial(var26, var27, var28).isSolid() || var25 >= 0 && !var1.isAirBlock(var26, var27, var28)) { + continue label231; + } + } + } + + var32 = (double)var20 + 0.5D - var2.posY; + var33 = var15 * var15 + var32 * var32 + var18 * var18; + if(var4 < 0.0D || var33 < var4) { + var4 = var33; + var9 = var14; + var10 = var20; + var11 = var17; + var12 = var21 % 2; + } + } + } + } + } + } + } + + int var30 = var9; + int var16 = var10; + var17 = var11; + int var31 = var12 % 2; + int var19 = 1 - var31; + if(var12 % 4 >= 2) { + var31 = -var31; + var19 = -var19; + } + + boolean var34; + if(var4 < 0.0D) { + if(var10 < 70) { + var10 = 70; + } + + if(var10 > 118) { + var10 = 118; + } + + var16 = var10; + + for(var20 = -1; var20 <= 1; ++var20) { + for(var21 = 1; var21 < 3; ++var21) { + for(var22 = -1; var22 < 3; ++var22) { + var23 = var30 + (var21 - 1) * var31 + var20 * var19; + var24 = var16 + var22; + var25 = var17 + (var21 - 1) * var19 - var20 * var31; + var34 = var22 < 0; + var1.setBlockWithNotify(var23, var24, var25, var34 ? Block.obsidian.blockID : 0); + } + } + } + } + + for(var20 = 0; var20 < 4; ++var20) { + var1.editingBlocks = true; + + for(var21 = 0; var21 < 4; ++var21) { + for(var22 = -1; var22 < 4; ++var22) { + var23 = var30 + (var21 - 1) * var31; + var24 = var16 + var22; + var25 = var17 + (var21 - 1) * var19; + var34 = var21 == 0 || var21 == 3 || var22 == -1 || var22 == 3; + var1.setBlockWithNotify(var23, var24, var25, var34 ? Block.obsidian.blockID : Block.portal.blockID); + } + } + + var1.editingBlocks = false; + + for(var21 = 0; var21 < 4; ++var21) { + for(var22 = -1; var22 < 4; ++var22) { + var23 = var30 + (var21 - 1) * var31; + var24 = var16 + var22; + var25 = var17 + (var21 - 1) * var19; + var1.notifyBlocksOfNeighborChange(var23, var24, var25, var1.getBlockId(var23, var24, var25)); + } + } + } + + return true; + } +} diff --git a/src/net/minecraft/src/TerrainTextureManager.java b/src/net/minecraft/src/TerrainTextureManager.java new file mode 100644 index 0000000..4680296 --- /dev/null +++ b/src/net/minecraft/src/TerrainTextureManager.java @@ -0,0 +1,214 @@ +package net.minecraft.src; + +import java.awt.image.BufferedImage; +import java.io.IOException; +import java.util.Arrays; +import javax.imageio.ImageIO; + +public class TerrainTextureManager { + private float[] field_1181_a = new float[768]; + private int[] field_1180_b = new int[5120]; + private int[] field_1186_c = new int[5120]; + private int[] field_1185_d = new int[5120]; + private int[] field_1184_e = new int[5120]; + private int[] field_1183_f = new int[34]; + private int[] field_1182_g = new int[768]; + + public TerrainTextureManager() { + try { + BufferedImage var1 = ImageIO.read(TerrainTextureManager.class.getResource("/terrain.png")); + int[] var2 = new int[65536]; + var1.getRGB(0, 0, 256, 256, var2, 0, 256); + + for(int var3 = 0; var3 < 256; ++var3) { + int var4 = 0; + int var5 = 0; + int var6 = 0; + int var7 = var3 % 16 * 16; + int var8 = var3 / 16 * 16; + int var9 = 0; + + for(int var10 = 0; var10 < 16; ++var10) { + for(int var11 = 0; var11 < 16; ++var11) { + int var12 = var2[var11 + var7 + (var10 + var8) * 256]; + int var13 = var12 >> 24 & 255; + if(var13 > 128) { + var4 += var12 >> 16 & 255; + var5 += var12 >> 8 & 255; + var6 += var12 & 255; + ++var9; + } + } + + if(var9 == 0) { + ++var9; + } + + this.field_1181_a[var3 * 3 + 0] = (float)(var4 / var9); + this.field_1181_a[var3 * 3 + 1] = (float)(var5 / var9); + this.field_1181_a[var3 * 3 + 2] = (float)(var6 / var9); + } + } + } catch (IOException var14) { + var14.printStackTrace(); + } + + for(int var15 = 0; var15 < 256; ++var15) { + if(Block.blocksList[var15] != null) { + this.field_1182_g[var15 * 3 + 0] = Block.blocksList[var15].getBlockTextureFromSide(1); + this.field_1182_g[var15 * 3 + 1] = Block.blocksList[var15].getBlockTextureFromSide(2); + this.field_1182_g[var15 * 3 + 2] = Block.blocksList[var15].getBlockTextureFromSide(3); + } + } + + } + + public void func_799_a(IsoImageBuffer var1) { + World var2 = var1.worldObj; + if(var2 == null) { + var1.field_1351_f = true; + var1.field_1352_e = true; + } else { + int var3 = var1.field_1354_c * 16; + int var4 = var1.field_1353_d * 16; + int var5 = var3 + 16; + int var6 = var4 + 16; + Chunk var7 = var2.getChunkFromChunkCoords(var1.field_1354_c, var1.field_1353_d); + if(var7.func_21167_h()) { + var1.field_1351_f = true; + var1.field_1352_e = true; + } else { + var1.field_1351_f = false; + Arrays.fill(this.field_1186_c, 0); + Arrays.fill(this.field_1185_d, 0); + Arrays.fill(this.field_1183_f, 160); + + for(int var8 = var6 - 1; var8 >= var4; --var8) { + for(int var9 = var5 - 1; var9 >= var3; --var9) { + int var10 = var9 - var3; + int var11 = var8 - var4; + int var12 = var10 + var11; + boolean var13 = true; + + for(int var14 = 0; var14 < 128; ++var14) { + int var15 = var11 - var10 - var14 + 160 - 16; + if(var15 < this.field_1183_f[var12] || var15 < this.field_1183_f[var12 + 1]) { + Block var16 = Block.blocksList[var2.getBlockId(var9, var14, var8)]; + if(var16 == null) { + var13 = false; + } else if(var16.blockMaterial == Material.water) { + int var24 = var2.getBlockId(var9, var14 + 1, var8); + if(var24 == 0 || Block.blocksList[var24].blockMaterial != Material.water) { + float var25 = (float)var14 / 127.0F * 0.6F + 0.4F; + float var26 = var2.getLightBrightness(var9, var14 + 1, var8) * var25; + if(var15 >= 0 && var15 < 160) { + int var27 = var12 + var15 * 32; + if(var12 >= 0 && var12 <= 32 && this.field_1185_d[var27] <= var14) { + this.field_1185_d[var27] = var14; + this.field_1184_e[var27] = (int)(var26 * 127.0F); + } + + if(var12 >= -1 && var12 <= 31 && this.field_1185_d[var27 + 1] <= var14) { + this.field_1185_d[var27 + 1] = var14; + this.field_1184_e[var27 + 1] = (int)(var26 * 127.0F); + } + + var13 = false; + } + } + } else { + if(var13) { + if(var15 < this.field_1183_f[var12]) { + this.field_1183_f[var12] = var15; + } + + if(var15 < this.field_1183_f[var12 + 1]) { + this.field_1183_f[var12 + 1] = var15; + } + } + + float var17 = (float)var14 / 127.0F * 0.6F + 0.4F; + int var18; + int var19; + float var20; + float var22; + if(var15 >= 0 && var15 < 160) { + var18 = var12 + var15 * 32; + var19 = this.field_1182_g[var16.blockID * 3 + 0]; + var20 = (var2.getLightBrightness(var9, var14 + 1, var8) * 0.8F + 0.2F) * var17; + if(var12 >= 0 && this.field_1186_c[var18] <= var14) { + this.field_1186_c[var18] = var14; + this.field_1180_b[var18] = -16777216 | (int)(this.field_1181_a[var19 * 3 + 0] * var20) << 16 | (int)(this.field_1181_a[var19 * 3 + 1] * var20) << 8 | (int)(this.field_1181_a[var19 * 3 + 2] * var20); + } + + if(var12 < 31) { + var22 = var20 * 0.9F; + if(this.field_1186_c[var18 + 1] <= var14) { + this.field_1186_c[var18 + 1] = var14; + this.field_1180_b[var18 + 1] = -16777216 | (int)(this.field_1181_a[var19 * 3 + 0] * var22) << 16 | (int)(this.field_1181_a[var19 * 3 + 1] * var22) << 8 | (int)(this.field_1181_a[var19 * 3 + 2] * var22); + } + } + } + + if(var15 >= -1 && var15 < 159) { + var18 = var12 + (var15 + 1) * 32; + var19 = this.field_1182_g[var16.blockID * 3 + 1]; + var20 = var2.getLightBrightness(var9 - 1, var14, var8) * 0.8F + 0.2F; + int var21 = this.field_1182_g[var16.blockID * 3 + 2]; + var22 = var2.getLightBrightness(var9, var14, var8 + 1) * 0.8F + 0.2F; + float var23; + if(var12 >= 0) { + var23 = var20 * var17 * 0.6F; + if(this.field_1186_c[var18] <= var14 - 1) { + this.field_1186_c[var18] = var14 - 1; + this.field_1180_b[var18] = -16777216 | (int)(this.field_1181_a[var19 * 3 + 0] * var23) << 16 | (int)(this.field_1181_a[var19 * 3 + 1] * var23) << 8 | (int)(this.field_1181_a[var19 * 3 + 2] * var23); + } + } + + if(var12 < 31) { + var23 = var22 * 0.9F * var17 * 0.4F; + if(this.field_1186_c[var18 + 1] <= var14 - 1) { + this.field_1186_c[var18 + 1] = var14 - 1; + this.field_1180_b[var18 + 1] = -16777216 | (int)(this.field_1181_a[var21 * 3 + 0] * var23) << 16 | (int)(this.field_1181_a[var21 * 3 + 1] * var23) << 8 | (int)(this.field_1181_a[var21 * 3 + 2] * var23); + } + } + } + } + } + } + } + } + + this.func_800_a(); + if(var1.field_1348_a == null) { + var1.field_1348_a = new BufferedImage(32, 160, 2); + } + + var1.field_1348_a.setRGB(0, 0, 32, 160, this.field_1180_b, 0, 32); + var1.field_1352_e = true; + } + } + } + + private void func_800_a() { + for(int var1 = 0; var1 < 32; ++var1) { + for(int var2 = 0; var2 < 160; ++var2) { + int var3 = var1 + var2 * 32; + if(this.field_1186_c[var3] == 0) { + this.field_1180_b[var3] = 0; + } + + if(this.field_1185_d[var3] > this.field_1186_c[var3]) { + int var4 = this.field_1180_b[var3] >> 24 & 255; + this.field_1180_b[var3] = ((this.field_1180_b[var3] & 16711422) >> 1) + this.field_1184_e[var3]; + if(var4 < 128) { + this.field_1180_b[var3] = Integer.MIN_VALUE + this.field_1184_e[var3] * 2; + } else { + this.field_1180_b[var3] |= -16777216; + } + } + } + } + + } +} diff --git a/src/net/minecraft/src/Tessellator.java b/src/net/minecraft/src/Tessellator.java new file mode 100644 index 0000000..cbba553 --- /dev/null +++ b/src/net/minecraft/src/Tessellator.java @@ -0,0 +1,317 @@ +package net.minecraft.src; + +import java.nio.ByteBuffer; +import java.nio.ByteOrder; +import java.nio.FloatBuffer; +import java.nio.IntBuffer; +import org.lwjgl.opengl.ARBVertexBufferObject; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL15; +import org.lwjgl.opengl.GLContext; + +public class Tessellator { + private static boolean convertQuadsToTriangles = true; + private static boolean tryVBO = false; + private ByteBuffer byteBuffer; + private IntBuffer intBuffer; + private FloatBuffer floatBuffer; + private int[] rawBuffer; + private int vertexCount = 0; + private double textureU; + private double textureV; + private int color; + private boolean hasColor = false; + private boolean hasTexture = false; + private boolean hasNormals = false; + private int rawBufferIndex = 0; + private int addedVertices = 0; + private boolean isColorDisabled = false; + private int drawMode; + private double xOffset; + private double yOffset; + private double zOffset; + private int normal; + public static final Tessellator instance = new Tessellator(2097152); + private boolean isDrawing = false; + private boolean useVBO = false; + private IntBuffer vertexBuffers; + private int vboIndex = 0; + private int vboCount = 10; + private int bufferSize; + + private Tessellator(int var1) { + this.bufferSize = var1; + this.byteBuffer = GLAllocation.createDirectByteBuffer(var1 * 4); + this.intBuffer = this.byteBuffer.asIntBuffer(); + this.floatBuffer = this.byteBuffer.asFloatBuffer(); + this.rawBuffer = new int[var1]; + this.useVBO = tryVBO && GLContext.getCapabilities().GL_ARB_vertex_buffer_object; + if(this.useVBO) { + this.vertexBuffers = GLAllocation.createDirectIntBuffer(this.vboCount); + ARBVertexBufferObject.glGenBuffersARB(this.vertexBuffers); + } + + } + + public void draw() { + if(!this.isDrawing) { + throw new IllegalStateException("Not tesselating!"); + } else { + this.isDrawing = false; + if(this.vertexCount > 0) { + this.intBuffer.clear(); + this.intBuffer.put(this.rawBuffer, 0, this.rawBufferIndex); + this.byteBuffer.position(0); + this.byteBuffer.limit(this.rawBufferIndex * 4); + if(this.useVBO) { + this.vboIndex = (this.vboIndex + 1) % this.vboCount; + ARBVertexBufferObject.glBindBufferARB(GL15.GL_ARRAY_BUFFER, this.vertexBuffers.get(this.vboIndex)); + ARBVertexBufferObject.glBufferDataARB(GL15.GL_ARRAY_BUFFER, this.byteBuffer, GL15.GL_STREAM_DRAW); + } + + if(this.hasTexture) { + if(this.useVBO) { + GL11.glTexCoordPointer(2, GL11.GL_FLOAT, 32, 12L); + } else { + this.floatBuffer.position(3); + GL11.glTexCoordPointer(2, 32, (FloatBuffer)this.floatBuffer); + } + + GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY); + } + + if(this.hasColor) { + if(this.useVBO) { + GL11.glColorPointer(4, GL11.GL_UNSIGNED_BYTE, 32, 20L); + } else { + this.byteBuffer.position(20); + GL11.glColorPointer(4, true, 32, this.byteBuffer); + } + + GL11.glEnableClientState(GL11.GL_COLOR_ARRAY); + } + + if(this.hasNormals) { + if(this.useVBO) { + GL11.glNormalPointer(GL11.GL_BYTE, 32, 24L); + } else { + this.byteBuffer.position(24); + GL11.glNormalPointer(32, (ByteBuffer)this.byteBuffer); + } + + GL11.glEnableClientState(GL11.GL_NORMAL_ARRAY); + } + + if(this.useVBO) { + GL11.glVertexPointer(3, GL11.GL_FLOAT, 32, 0L); + } else { + this.floatBuffer.position(0); + GL11.glVertexPointer(3, 32, (FloatBuffer)this.floatBuffer); + } + + GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY); + if(this.drawMode == 7 && convertQuadsToTriangles) { + GL11.glDrawArrays(GL11.GL_TRIANGLES, GL11.GL_POINTS, this.vertexCount); + } else { + GL11.glDrawArrays(this.drawMode, GL11.GL_POINTS, this.vertexCount); + } + + GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY); + if(this.hasTexture) { + GL11.glDisableClientState(GL11.GL_TEXTURE_COORD_ARRAY); + } + + if(this.hasColor) { + GL11.glDisableClientState(GL11.GL_COLOR_ARRAY); + } + + if(this.hasNormals) { + GL11.glDisableClientState(GL11.GL_NORMAL_ARRAY); + } + } + + this.reset(); + } + } + + private void reset() { + this.vertexCount = 0; + this.byteBuffer.clear(); + this.rawBufferIndex = 0; + this.addedVertices = 0; + } + + public void startDrawingQuads() { + this.startDrawing(7); + } + + public void startDrawing(int var1) { + if(this.isDrawing) { + throw new IllegalStateException("Already tesselating!"); + } else { + this.isDrawing = true; + this.reset(); + this.drawMode = var1; + this.hasNormals = false; + this.hasColor = false; + this.hasTexture = false; + this.isColorDisabled = false; + } + } + + public void setTextureUV(double var1, double var3) { + this.hasTexture = true; + this.textureU = var1; + this.textureV = var3; + } + + public void setColorOpaque_F(float var1, float var2, float var3) { + this.setColorOpaque((int)(var1 * 255.0F), (int)(var2 * 255.0F), (int)(var3 * 255.0F)); + } + + public void setColorRGBA_F(float var1, float var2, float var3, float var4) { + this.setColorRGBA((int)(var1 * 255.0F), (int)(var2 * 255.0F), (int)(var3 * 255.0F), (int)(var4 * 255.0F)); + } + + public void setColorOpaque(int var1, int var2, int var3) { + this.setColorRGBA(var1, var2, var3, 255); + } + + public void setColorRGBA(int var1, int var2, int var3, int var4) { + if(!this.isColorDisabled) { + if(var1 > 255) { + var1 = 255; + } + + if(var2 > 255) { + var2 = 255; + } + + if(var3 > 255) { + var3 = 255; + } + + if(var4 > 255) { + var4 = 255; + } + + if(var1 < 0) { + var1 = 0; + } + + if(var2 < 0) { + var2 = 0; + } + + if(var3 < 0) { + var3 = 0; + } + + if(var4 < 0) { + var4 = 0; + } + + this.hasColor = true; + if(ByteOrder.nativeOrder() == ByteOrder.LITTLE_ENDIAN) { + this.color = var4 << 24 | var3 << 16 | var2 << 8 | var1; + } else { + this.color = var1 << 24 | var2 << 16 | var3 << 8 | var4; + } + + } + } + + public void addVertexWithUV(double var1, double var3, double var5, double var7, double var9) { + this.setTextureUV(var7, var9); + this.addVertex(var1, var3, var5); + } + + public void addVertex(double var1, double var3, double var5) { + ++this.addedVertices; + if(this.drawMode == 7 && convertQuadsToTriangles && this.addedVertices % 4 == 0) { + for(int var7 = 0; var7 < 2; ++var7) { + int var8 = 8 * (3 - var7); + if(this.hasTexture) { + this.rawBuffer[this.rawBufferIndex + 3] = this.rawBuffer[this.rawBufferIndex - var8 + 3]; + this.rawBuffer[this.rawBufferIndex + 4] = this.rawBuffer[this.rawBufferIndex - var8 + 4]; + } + + if(this.hasColor) { + this.rawBuffer[this.rawBufferIndex + 5] = this.rawBuffer[this.rawBufferIndex - var8 + 5]; + } + + this.rawBuffer[this.rawBufferIndex + 0] = this.rawBuffer[this.rawBufferIndex - var8 + 0]; + this.rawBuffer[this.rawBufferIndex + 1] = this.rawBuffer[this.rawBufferIndex - var8 + 1]; + this.rawBuffer[this.rawBufferIndex + 2] = this.rawBuffer[this.rawBufferIndex - var8 + 2]; + ++this.vertexCount; + this.rawBufferIndex += 8; + } + } + + if(this.hasTexture) { + this.rawBuffer[this.rawBufferIndex + 3] = Float.floatToRawIntBits((float)this.textureU); + this.rawBuffer[this.rawBufferIndex + 4] = Float.floatToRawIntBits((float)this.textureV); + } + + if(this.hasColor) { + this.rawBuffer[this.rawBufferIndex + 5] = this.color; + } + + if(this.hasNormals) { + this.rawBuffer[this.rawBufferIndex + 6] = this.normal; + } + + this.rawBuffer[this.rawBufferIndex + 0] = Float.floatToRawIntBits((float)(var1 + this.xOffset)); + this.rawBuffer[this.rawBufferIndex + 1] = Float.floatToRawIntBits((float)(var3 + this.yOffset)); + this.rawBuffer[this.rawBufferIndex + 2] = Float.floatToRawIntBits((float)(var5 + this.zOffset)); + this.rawBufferIndex += 8; + ++this.vertexCount; + if(this.vertexCount % 4 == 0 && this.rawBufferIndex >= this.bufferSize - 32) { + this.draw(); + this.isDrawing = true; + } + + } + + public void setColorOpaque_I(int var1) { + int var2 = var1 >> 16 & 255; + int var3 = var1 >> 8 & 255; + int var4 = var1 & 255; + this.setColorOpaque(var2, var3, var4); + } + + public void setColorRGBA_I(int var1, int var2) { + int var3 = var1 >> 16 & 255; + int var4 = var1 >> 8 & 255; + int var5 = var1 & 255; + this.setColorRGBA(var3, var4, var5, var2); + } + + public void disableColor() { + this.isColorDisabled = true; + } + + public void setNormal(float var1, float var2, float var3) { + if(!this.isDrawing) { + System.out.println("But.."); + } + + this.hasNormals = true; + byte var4 = (byte)((int)(var1 * 128.0F)); + byte var5 = (byte)((int)(var2 * 127.0F)); + byte var6 = (byte)((int)(var3 * 127.0F)); + this.normal = var4 | var5 << 8 | var6 << 16; + } + + public void setTranslationD(double var1, double var3, double var5) { + this.xOffset = var1; + this.yOffset = var3; + this.zOffset = var5; + } + + public void setTranslationF(float var1, float var2, float var3) { + this.xOffset += (double)var1; + this.yOffset += (double)var2; + this.zOffset += (double)var3; + } +} diff --git a/src/net/minecraft/src/TextureCompassFX.java b/src/net/minecraft/src/TextureCompassFX.java new file mode 100644 index 0000000..27d5d71 --- /dev/null +++ b/src/net/minecraft/src/TextureCompassFX.java @@ -0,0 +1,142 @@ +package net.minecraft.src; + +import java.awt.image.BufferedImage; +import java.io.IOException; +import javax.imageio.ImageIO; +import net.minecraft.client.Minecraft; + +public class TextureCompassFX extends TextureFX { + private Minecraft mc; + private int[] compassIconImageData = new int[256]; + private double field_4229_i; + private double field_4228_j; + + public TextureCompassFX(Minecraft var1) { + super(Item.compass.getIconFromDamage(0)); + this.mc = var1; + this.tileImage = 1; + + try { + BufferedImage var2 = ImageIO.read(Minecraft.class.getResource("/gui/items.png")); + int var3 = this.iconIndex % 16 * 16; + int var4 = this.iconIndex / 16 * 16; + var2.getRGB(var3, var4, 16, 16, this.compassIconImageData, 0, 16); + } catch (IOException var5) { + var5.printStackTrace(); + } + + } + + public void onTick() { + for(int var1 = 0; var1 < 256; ++var1) { + int var2 = this.compassIconImageData[var1] >> 24 & 255; + int var3 = this.compassIconImageData[var1] >> 16 & 255; + int var4 = this.compassIconImageData[var1] >> 8 & 255; + int var5 = this.compassIconImageData[var1] >> 0 & 255; + if(this.anaglyphEnabled) { + int var6 = (var3 * 30 + var4 * 59 + var5 * 11) / 100; + int var7 = (var3 * 30 + var4 * 70) / 100; + int var8 = (var3 * 30 + var5 * 70) / 100; + var3 = var6; + var4 = var7; + var5 = var8; + } + + this.imageData[var1 * 4 + 0] = (byte)var3; + this.imageData[var1 * 4 + 1] = (byte)var4; + this.imageData[var1 * 4 + 2] = (byte)var5; + this.imageData[var1 * 4 + 3] = (byte)var2; + } + + double var20 = 0.0D; + if(this.mc.theWorld != null && this.mc.thePlayer != null) { + ChunkCoordinates var21 = this.mc.theWorld.getSpawnPoint(); + double var23 = (double)var21.x - this.mc.thePlayer.posX; + double var25 = (double)var21.z - this.mc.thePlayer.posZ; + var20 = (double)(this.mc.thePlayer.rotationYaw - 90.0F) * Math.PI / 180.0D - Math.atan2(var25, var23); + if(this.mc.theWorld.worldProvider.isNether) { + var20 = Math.random() * (double)((float)Math.PI) * 2.0D; + } + } + + double var22; + for(var22 = var20 - this.field_4229_i; var22 < -Math.PI; var22 += Math.PI * 2.0D) { + } + + while(var22 >= Math.PI) { + var22 -= Math.PI * 2.0D; + } + + if(var22 < -1.0D) { + var22 = -1.0D; + } + + if(var22 > 1.0D) { + var22 = 1.0D; + } + + this.field_4228_j += var22 * 0.1D; + this.field_4228_j *= 0.8D; + this.field_4229_i += this.field_4228_j; + double var24 = Math.sin(this.field_4229_i); + double var26 = Math.cos(this.field_4229_i); + + int var9; + int var10; + int var11; + int var12; + int var13; + int var14; + int var15; + short var16; + int var17; + int var18; + int var19; + for(var9 = -4; var9 <= 4; ++var9) { + var10 = (int)(8.5D + var26 * (double)var9 * 0.3D); + var11 = (int)(7.5D - var24 * (double)var9 * 0.3D * 0.5D); + var12 = var11 * 16 + var10; + var13 = 100; + var14 = 100; + var15 = 100; + var16 = 255; + if(this.anaglyphEnabled) { + var17 = (var13 * 30 + var14 * 59 + var15 * 11) / 100; + var18 = (var13 * 30 + var14 * 70) / 100; + var19 = (var13 * 30 + var15 * 70) / 100; + var13 = var17; + var14 = var18; + var15 = var19; + } + + this.imageData[var12 * 4 + 0] = (byte)var13; + this.imageData[var12 * 4 + 1] = (byte)var14; + this.imageData[var12 * 4 + 2] = (byte)var15; + this.imageData[var12 * 4 + 3] = (byte)var16; + } + + for(var9 = -8; var9 <= 16; ++var9) { + var10 = (int)(8.5D + var24 * (double)var9 * 0.3D); + var11 = (int)(7.5D + var26 * (double)var9 * 0.3D * 0.5D); + var12 = var11 * 16 + var10; + var13 = var9 >= 0 ? 255 : 100; + var14 = var9 >= 0 ? 20 : 100; + var15 = var9 >= 0 ? 20 : 100; + var16 = 255; + if(this.anaglyphEnabled) { + var17 = (var13 * 30 + var14 * 59 + var15 * 11) / 100; + var18 = (var13 * 30 + var14 * 70) / 100; + var19 = (var13 * 30 + var15 * 70) / 100; + var13 = var17; + var14 = var18; + var15 = var19; + } + + this.imageData[var12 * 4 + 0] = (byte)var13; + this.imageData[var12 * 4 + 1] = (byte)var14; + this.imageData[var12 * 4 + 2] = (byte)var15; + this.imageData[var12 * 4 + 3] = (byte)var16; + } + + } +} diff --git a/src/net/minecraft/src/TextureFX.java b/src/net/minecraft/src/TextureFX.java new file mode 100644 index 0000000..e7de6e9 --- /dev/null +++ b/src/net/minecraft/src/TextureFX.java @@ -0,0 +1,28 @@ +package net.minecraft.src; + +import org.lwjgl.opengl.GL11; + +public class TextureFX { + public byte[] imageData = new byte[1024]; + public int iconIndex; + public boolean anaglyphEnabled = false; + public int textureId = 0; + public int tileSize = 1; + public int tileImage = 0; + + public TextureFX(int var1) { + this.iconIndex = var1; + } + + public void onTick() { + } + + public void bindImage(RenderEngine var1) { + if(this.tileImage == 0) { + GL11.glBindTexture(GL11.GL_TEXTURE_2D, var1.getTexture("/terrain.png")); + } else if(this.tileImage == 1) { + GL11.glBindTexture(GL11.GL_TEXTURE_2D, var1.getTexture("/gui/items.png")); + } + + } +} diff --git a/src/net/minecraft/src/TextureFlamesFX.java b/src/net/minecraft/src/TextureFlamesFX.java new file mode 100644 index 0000000..0f68081 --- /dev/null +++ b/src/net/minecraft/src/TextureFlamesFX.java @@ -0,0 +1,77 @@ +package net.minecraft.src; + +public class TextureFlamesFX extends TextureFX { + protected float[] field_1133_g = new float[320]; + protected float[] field_1132_h = new float[320]; + + public TextureFlamesFX(int var1) { + super(Block.fire.blockIndexInTexture + var1 * 16); + } + + public void onTick() { + int var2; + float var4; + int var5; + int var6; + for(int var1 = 0; var1 < 16; ++var1) { + for(var2 = 0; var2 < 20; ++var2) { + int var3 = 18; + var4 = this.field_1133_g[var1 + (var2 + 1) % 20 * 16] * (float)var3; + + for(var5 = var1 - 1; var5 <= var1 + 1; ++var5) { + for(var6 = var2; var6 <= var2 + 1; ++var6) { + if(var5 >= 0 && var6 >= 0 && var5 < 16 && var6 < 20) { + var4 += this.field_1133_g[var5 + var6 * 16]; + } + + ++var3; + } + } + + this.field_1132_h[var1 + var2 * 16] = var4 / ((float)var3 * 1.06F); + if(var2 >= 19) { + this.field_1132_h[var1 + var2 * 16] = (float)(Math.random() * Math.random() * Math.random() * 4.0D + Math.random() * (double)0.1F + (double)0.2F); + } + } + } + + float[] var12 = this.field_1132_h; + this.field_1132_h = this.field_1133_g; + this.field_1133_g = var12; + + for(var2 = 0; var2 < 256; ++var2) { + float var13 = this.field_1133_g[var2] * 1.8F; + if(var13 > 1.0F) { + var13 = 1.0F; + } + + if(var13 < 0.0F) { + var13 = 0.0F; + } + + var5 = (int)(var13 * 155.0F + 100.0F); + var6 = (int)(var13 * var13 * 255.0F); + int var7 = (int)(var13 * var13 * var13 * var13 * var13 * var13 * var13 * var13 * var13 * var13 * 255.0F); + short var8 = 255; + if(var13 < 0.5F) { + var8 = 0; + } + + var4 = (var13 - 0.5F) * 2.0F; + if(this.anaglyphEnabled) { + int var9 = (var5 * 30 + var6 * 59 + var7 * 11) / 100; + int var10 = (var5 * 30 + var6 * 70) / 100; + int var11 = (var5 * 30 + var7 * 70) / 100; + var5 = var9; + var6 = var10; + var7 = var11; + } + + this.imageData[var2 * 4 + 0] = (byte)var5; + this.imageData[var2 * 4 + 1] = (byte)var6; + this.imageData[var2 * 4 + 2] = (byte)var7; + this.imageData[var2 * 4 + 3] = (byte)var8; + } + + } +} diff --git a/src/net/minecraft/src/TextureLavaFX.java b/src/net/minecraft/src/TextureLavaFX.java new file mode 100644 index 0000000..001d971 --- /dev/null +++ b/src/net/minecraft/src/TextureLavaFX.java @@ -0,0 +1,81 @@ +package net.minecraft.src; + +public class TextureLavaFX extends TextureFX { + protected float[] field_1147_g = new float[256]; + protected float[] field_1146_h = new float[256]; + protected float[] field_1145_i = new float[256]; + protected float[] field_1144_j = new float[256]; + + public TextureLavaFX() { + super(Block.lavaMoving.blockIndexInTexture); + } + + public void onTick() { + int var2; + float var3; + int var5; + int var6; + int var7; + int var8; + int var9; + for(int var1 = 0; var1 < 16; ++var1) { + for(var2 = 0; var2 < 16; ++var2) { + var3 = 0.0F; + int var4 = (int)(MathHelper.sin((float)var2 * (float)Math.PI * 2.0F / 16.0F) * 1.2F); + var5 = (int)(MathHelper.sin((float)var1 * (float)Math.PI * 2.0F / 16.0F) * 1.2F); + + for(var6 = var1 - 1; var6 <= var1 + 1; ++var6) { + for(var7 = var2 - 1; var7 <= var2 + 1; ++var7) { + var8 = var6 + var4 & 15; + var9 = var7 + var5 & 15; + var3 += this.field_1147_g[var8 + var9 * 16]; + } + } + + this.field_1146_h[var1 + var2 * 16] = var3 / 10.0F + (this.field_1145_i[(var1 + 0 & 15) + (var2 + 0 & 15) * 16] + this.field_1145_i[(var1 + 1 & 15) + (var2 + 0 & 15) * 16] + this.field_1145_i[(var1 + 1 & 15) + (var2 + 1 & 15) * 16] + this.field_1145_i[(var1 + 0 & 15) + (var2 + 1 & 15) * 16]) / 4.0F * 0.8F; + this.field_1145_i[var1 + var2 * 16] += this.field_1144_j[var1 + var2 * 16] * 0.01F; + if(this.field_1145_i[var1 + var2 * 16] < 0.0F) { + this.field_1145_i[var1 + var2 * 16] = 0.0F; + } + + this.field_1144_j[var1 + var2 * 16] -= 0.06F; + if(Math.random() < 0.005D) { + this.field_1144_j[var1 + var2 * 16] = 1.5F; + } + } + } + + float[] var11 = this.field_1146_h; + this.field_1146_h = this.field_1147_g; + this.field_1147_g = var11; + + for(var2 = 0; var2 < 256; ++var2) { + var3 = this.field_1147_g[var2] * 2.0F; + if(var3 > 1.0F) { + var3 = 1.0F; + } + + if(var3 < 0.0F) { + var3 = 0.0F; + } + + var5 = (int)(var3 * 100.0F + 155.0F); + var6 = (int)(var3 * var3 * 255.0F); + var7 = (int)(var3 * var3 * var3 * var3 * 128.0F); + if(this.anaglyphEnabled) { + var8 = (var5 * 30 + var6 * 59 + var7 * 11) / 100; + var9 = (var5 * 30 + var6 * 70) / 100; + int var10 = (var5 * 30 + var7 * 70) / 100; + var5 = var8; + var6 = var9; + var7 = var10; + } + + this.imageData[var2 * 4 + 0] = (byte)var5; + this.imageData[var2 * 4 + 1] = (byte)var6; + this.imageData[var2 * 4 + 2] = (byte)var7; + this.imageData[var2 * 4 + 3] = -1; + } + + } +} diff --git a/src/net/minecraft/src/TextureLavaFlowFX.java b/src/net/minecraft/src/TextureLavaFlowFX.java new file mode 100644 index 0000000..a678260 --- /dev/null +++ b/src/net/minecraft/src/TextureLavaFlowFX.java @@ -0,0 +1,85 @@ +package net.minecraft.src; + +public class TextureLavaFlowFX extends TextureFX { + protected float[] field_1143_g = new float[256]; + protected float[] field_1142_h = new float[256]; + protected float[] field_1141_i = new float[256]; + protected float[] field_1140_j = new float[256]; + int field_1139_k = 0; + + public TextureLavaFlowFX() { + super(Block.lavaMoving.blockIndexInTexture + 1); + this.tileSize = 2; + } + + public void onTick() { + ++this.field_1139_k; + + int var2; + float var3; + int var5; + int var6; + int var7; + int var8; + int var9; + for(int var1 = 0; var1 < 16; ++var1) { + for(var2 = 0; var2 < 16; ++var2) { + var3 = 0.0F; + int var4 = (int)(MathHelper.sin((float)var2 * (float)Math.PI * 2.0F / 16.0F) * 1.2F); + var5 = (int)(MathHelper.sin((float)var1 * (float)Math.PI * 2.0F / 16.0F) * 1.2F); + + for(var6 = var1 - 1; var6 <= var1 + 1; ++var6) { + for(var7 = var2 - 1; var7 <= var2 + 1; ++var7) { + var8 = var6 + var4 & 15; + var9 = var7 + var5 & 15; + var3 += this.field_1143_g[var8 + var9 * 16]; + } + } + + this.field_1142_h[var1 + var2 * 16] = var3 / 10.0F + (this.field_1141_i[(var1 + 0 & 15) + (var2 + 0 & 15) * 16] + this.field_1141_i[(var1 + 1 & 15) + (var2 + 0 & 15) * 16] + this.field_1141_i[(var1 + 1 & 15) + (var2 + 1 & 15) * 16] + this.field_1141_i[(var1 + 0 & 15) + (var2 + 1 & 15) * 16]) / 4.0F * 0.8F; + this.field_1141_i[var1 + var2 * 16] += this.field_1140_j[var1 + var2 * 16] * 0.01F; + if(this.field_1141_i[var1 + var2 * 16] < 0.0F) { + this.field_1141_i[var1 + var2 * 16] = 0.0F; + } + + this.field_1140_j[var1 + var2 * 16] -= 0.06F; + if(Math.random() < 0.005D) { + this.field_1140_j[var1 + var2 * 16] = 1.5F; + } + } + } + + float[] var11 = this.field_1142_h; + this.field_1142_h = this.field_1143_g; + this.field_1143_g = var11; + + for(var2 = 0; var2 < 256; ++var2) { + var3 = this.field_1143_g[var2 - this.field_1139_k / 3 * 16 & 255] * 2.0F; + if(var3 > 1.0F) { + var3 = 1.0F; + } + + if(var3 < 0.0F) { + var3 = 0.0F; + } + + var5 = (int)(var3 * 100.0F + 155.0F); + var6 = (int)(var3 * var3 * 255.0F); + var7 = (int)(var3 * var3 * var3 * var3 * 128.0F); + if(this.anaglyphEnabled) { + var8 = (var5 * 30 + var6 * 59 + var7 * 11) / 100; + var9 = (var5 * 30 + var6 * 70) / 100; + int var10 = (var5 * 30 + var7 * 70) / 100; + var5 = var8; + var6 = var9; + var7 = var10; + } + + this.imageData[var2 * 4 + 0] = (byte)var5; + this.imageData[var2 * 4 + 1] = (byte)var6; + this.imageData[var2 * 4 + 2] = (byte)var7; + this.imageData[var2 * 4 + 3] = -1; + } + + } +} diff --git a/src/net/minecraft/src/TexturePackBase.java b/src/net/minecraft/src/TexturePackBase.java new file mode 100644 index 0000000..ec87991 --- /dev/null +++ b/src/net/minecraft/src/TexturePackBase.java @@ -0,0 +1,31 @@ +package net.minecraft.src; + +import java.io.IOException; +import java.io.InputStream; +import net.minecraft.client.Minecraft; + +public abstract class TexturePackBase { + public String texturePackFileName; + public String firstDescriptionLine; + public String secondDescriptionLine; + public String field_6488_d; + + public void func_6482_a() { + } + + public void closeTexturePackFile() { + } + + public void func_6485_a(Minecraft var1) throws IOException { + } + + public void func_6484_b(Minecraft var1) { + } + + public void bindThumbnailTexture(Minecraft var1) { + } + + public InputStream getResourceAsStream(String var1) { + return TexturePackBase.class.getResourceAsStream(var1); + } +} diff --git a/src/net/minecraft/src/TexturePackCustom.java b/src/net/minecraft/src/TexturePackCustom.java new file mode 100644 index 0000000..8bfeccd --- /dev/null +++ b/src/net/minecraft/src/TexturePackCustom.java @@ -0,0 +1,125 @@ +package net.minecraft.src; + +import java.awt.image.BufferedImage; +import java.io.BufferedReader; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.util.zip.ZipEntry; +import java.util.zip.ZipFile; +import javax.imageio.ImageIO; +import net.minecraft.client.Minecraft; +import org.lwjgl.opengl.GL11; + +public class TexturePackCustom extends TexturePackBase { + private ZipFile texturePackZipFile; + private int texturePackName = -1; + private BufferedImage texturePackThumbnail; + private File texturePackFile; + + public TexturePackCustom(File var1) { + this.texturePackFileName = var1.getName(); + this.texturePackFile = var1; + } + + private String truncateString(String var1) { + if(var1 != null && var1.length() > 34) { + var1 = var1.substring(0, 34); + } + + return var1; + } + + public void func_6485_a(Minecraft var1) throws IOException { + ZipFile var2 = null; + InputStream var3 = null; + + try { + var2 = new ZipFile(this.texturePackFile); + + try { + var3 = var2.getInputStream(var2.getEntry("pack.txt")); + BufferedReader var4 = new BufferedReader(new InputStreamReader(var3)); + this.firstDescriptionLine = this.truncateString(var4.readLine()); + this.secondDescriptionLine = this.truncateString(var4.readLine()); + var4.close(); + var3.close(); + } catch (Exception var20) { + } + + try { + var3 = var2.getInputStream(var2.getEntry("pack.png")); + this.texturePackThumbnail = ImageIO.read(var3); + var3.close(); + } catch (Exception var19) { + } + + var2.close(); + } catch (Exception var21) { + var21.printStackTrace(); + } finally { + try { + var3.close(); + } catch (Exception var18) { + } + + try { + var2.close(); + } catch (Exception var17) { + } + + } + + } + + public void func_6484_b(Minecraft var1) { + if(this.texturePackThumbnail != null) { + var1.renderEngine.deleteTexture(this.texturePackName); + } + + this.closeTexturePackFile(); + } + + public void bindThumbnailTexture(Minecraft var1) { + if(this.texturePackThumbnail != null && this.texturePackName < 0) { + this.texturePackName = var1.renderEngine.allocateAndSetupTexture(this.texturePackThumbnail); + } + + if(this.texturePackThumbnail != null) { + var1.renderEngine.bindTexture(this.texturePackName); + } else { + GL11.glBindTexture(GL11.GL_TEXTURE_2D, var1.renderEngine.getTexture("/gui/unknown_pack.png")); + } + + } + + public void func_6482_a() { + try { + this.texturePackZipFile = new ZipFile(this.texturePackFile); + } catch (Exception var2) { + } + + } + + public void closeTexturePackFile() { + try { + this.texturePackZipFile.close(); + } catch (Exception var2) { + } + + this.texturePackZipFile = null; + } + + public InputStream getResourceAsStream(String var1) { + try { + ZipEntry var2 = this.texturePackZipFile.getEntry(var1.substring(1)); + if(var2 != null) { + return this.texturePackZipFile.getInputStream(var2); + } + } catch (Exception var3) { + } + + return TexturePackBase.class.getResourceAsStream(var1); + } +} diff --git a/src/net/minecraft/src/TexturePackDefault.java b/src/net/minecraft/src/TexturePackDefault.java new file mode 100644 index 0000000..f0f004a --- /dev/null +++ b/src/net/minecraft/src/TexturePackDefault.java @@ -0,0 +1,44 @@ +package net.minecraft.src; + +import java.awt.image.BufferedImage; +import java.io.IOException; +import javax.imageio.ImageIO; +import net.minecraft.client.Minecraft; +import org.lwjgl.opengl.GL11; + +public class TexturePackDefault extends TexturePackBase { + private int texturePackName = -1; + private BufferedImage texturePackThumbnail; + + public TexturePackDefault() { + this.texturePackFileName = "Default"; + this.firstDescriptionLine = "The default look of Minecraft"; + + try { + this.texturePackThumbnail = ImageIO.read(TexturePackDefault.class.getResource("/pack.png")); + } catch (IOException var2) { + var2.printStackTrace(); + } + + } + + public void func_6484_b(Minecraft var1) { + if(this.texturePackThumbnail != null) { + var1.renderEngine.deleteTexture(this.texturePackName); + } + + } + + public void bindThumbnailTexture(Minecraft var1) { + if(this.texturePackThumbnail != null && this.texturePackName < 0) { + this.texturePackName = var1.renderEngine.allocateAndSetupTexture(this.texturePackThumbnail); + } + + if(this.texturePackThumbnail != null) { + var1.renderEngine.bindTexture(this.texturePackName); + } else { + GL11.glBindTexture(GL11.GL_TEXTURE_2D, var1.renderEngine.getTexture("/gui/unknown_pack.png")); + } + + } +} diff --git a/src/net/minecraft/src/TexturePackList.java b/src/net/minecraft/src/TexturePackList.java new file mode 100644 index 0000000..c51efc9 --- /dev/null +++ b/src/net/minecraft/src/TexturePackList.java @@ -0,0 +1,101 @@ +package net.minecraft.src; + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import net.minecraft.client.Minecraft; + +public class TexturePackList { + private List availableTexturePacks = new ArrayList(); + private TexturePackBase defaultTexturePack = new TexturePackDefault(); + public TexturePackBase selectedTexturePack; + private Map field_6538_d = new HashMap(); + private Minecraft mc; + private File texturePackDir; + private String currentTexturePack; + + public TexturePackList(Minecraft var1, File var2) { + this.mc = var1; + this.texturePackDir = new File(var2, "texturepacks"); + if(!this.texturePackDir.exists()) { + this.texturePackDir.mkdirs(); + } + + this.currentTexturePack = var1.gameSettings.skin; + this.updateAvaliableTexturePacks(); + this.selectedTexturePack.func_6482_a(); + } + + public boolean setTexturePack(TexturePackBase var1) { + if(var1 == this.selectedTexturePack) { + return false; + } else { + this.selectedTexturePack.closeTexturePackFile(); + this.currentTexturePack = var1.texturePackFileName; + this.selectedTexturePack = var1; + this.mc.gameSettings.skin = this.currentTexturePack; + this.mc.gameSettings.saveOptions(); + this.selectedTexturePack.func_6482_a(); + return true; + } + } + + public void updateAvaliableTexturePacks() { + ArrayList var1 = new ArrayList(); + this.selectedTexturePack = null; + var1.add(this.defaultTexturePack); + if(this.texturePackDir.exists() && this.texturePackDir.isDirectory()) { + File[] var2 = this.texturePackDir.listFiles(); + File[] var3 = var2; + int var4 = var2.length; + + for(int var5 = 0; var5 < var4; ++var5) { + File var6 = var3[var5]; + if(var6.isFile() && var6.getName().toLowerCase().endsWith(".zip")) { + String var7 = var6.getName() + ":" + var6.length() + ":" + var6.lastModified(); + + try { + if(!this.field_6538_d.containsKey(var7)) { + TexturePackCustom var8 = new TexturePackCustom(var6); + var8.field_6488_d = var7; + this.field_6538_d.put(var7, var8); + var8.func_6485_a(this.mc); + } + + TexturePackBase var12 = (TexturePackBase)this.field_6538_d.get(var7); + if(var12.texturePackFileName.equals(this.currentTexturePack)) { + this.selectedTexturePack = var12; + } + + var1.add(var12); + } catch (IOException var9) { + var9.printStackTrace(); + } + } + } + } + + if(this.selectedTexturePack == null) { + this.selectedTexturePack = this.defaultTexturePack; + } + + this.availableTexturePacks.removeAll(var1); + Iterator var10 = this.availableTexturePacks.iterator(); + + while(var10.hasNext()) { + TexturePackBase var11 = (TexturePackBase)var10.next(); + var11.func_6484_b(this.mc); + this.field_6538_d.remove(var11.field_6488_d); + } + + this.availableTexturePacks = var1; + } + + public List availableTexturePacks() { + return new ArrayList(this.availableTexturePacks); + } +} diff --git a/src/net/minecraft/src/TexturePortalFX.java b/src/net/minecraft/src/TexturePortalFX.java new file mode 100644 index 0000000..91c326b --- /dev/null +++ b/src/net/minecraft/src/TexturePortalFX.java @@ -0,0 +1,88 @@ +package net.minecraft.src; + +import java.util.Random; + +public class TexturePortalFX extends TextureFX { + private int portalTickCounter = 0; + private byte[][] portalTextureData = new byte[32][1024]; + + public TexturePortalFX() { + super(Block.portal.blockIndexInTexture); + Random var1 = new Random(100L); + + for(int var2 = 0; var2 < 32; ++var2) { + for(int var3 = 0; var3 < 16; ++var3) { + for(int var4 = 0; var4 < 16; ++var4) { + float var5 = 0.0F; + + int var6; + for(var6 = 0; var6 < 2; ++var6) { + float var7 = (float)(var6 * 8); + float var8 = (float)(var6 * 8); + float var9 = ((float)var3 - var7) / 16.0F * 2.0F; + float var10 = ((float)var4 - var8) / 16.0F * 2.0F; + if(var9 < -1.0F) { + var9 += 2.0F; + } + + if(var9 >= 1.0F) { + var9 -= 2.0F; + } + + if(var10 < -1.0F) { + var10 += 2.0F; + } + + if(var10 >= 1.0F) { + var10 -= 2.0F; + } + + float var11 = var9 * var9 + var10 * var10; + float var12 = (float)Math.atan2((double)var10, (double)var9) + ((float)var2 / 32.0F * (float)Math.PI * 2.0F - var11 * 10.0F + (float)(var6 * 2)) * (float)(var6 * 2 - 1); + var12 = (MathHelper.sin(var12) + 1.0F) / 2.0F; + var12 /= var11 + 1.0F; + var5 += var12 * 0.5F; + } + + var5 += var1.nextFloat() * 0.1F; + var6 = (int)(var5 * 100.0F + 155.0F); + int var13 = (int)(var5 * var5 * 200.0F + 55.0F); + int var14 = (int)(var5 * var5 * var5 * var5 * 255.0F); + int var15 = (int)(var5 * 100.0F + 155.0F); + int var16 = var4 * 16 + var3; + this.portalTextureData[var2][var16 * 4 + 0] = (byte)var13; + this.portalTextureData[var2][var16 * 4 + 1] = (byte)var14; + this.portalTextureData[var2][var16 * 4 + 2] = (byte)var6; + this.portalTextureData[var2][var16 * 4 + 3] = (byte)var15; + } + } + } + + } + + public void onTick() { + ++this.portalTickCounter; + byte[] var1 = this.portalTextureData[this.portalTickCounter & 31]; + + for(int var2 = 0; var2 < 256; ++var2) { + int var3 = var1[var2 * 4 + 0] & 255; + int var4 = var1[var2 * 4 + 1] & 255; + int var5 = var1[var2 * 4 + 2] & 255; + int var6 = var1[var2 * 4 + 3] & 255; + if(this.anaglyphEnabled) { + int var7 = (var3 * 30 + var4 * 59 + var5 * 11) / 100; + int var8 = (var3 * 30 + var4 * 70) / 100; + int var9 = (var3 * 30 + var5 * 70) / 100; + var3 = var7; + var4 = var8; + var5 = var9; + } + + this.imageData[var2 * 4 + 0] = (byte)var3; + this.imageData[var2 * 4 + 1] = (byte)var4; + this.imageData[var2 * 4 + 2] = (byte)var5; + this.imageData[var2 * 4 + 3] = (byte)var6; + } + + } +} diff --git a/src/net/minecraft/src/TextureWatchFX.java b/src/net/minecraft/src/TextureWatchFX.java new file mode 100644 index 0000000..080fac2 --- /dev/null +++ b/src/net/minecraft/src/TextureWatchFX.java @@ -0,0 +1,99 @@ +package net.minecraft.src; + +import java.awt.image.BufferedImage; +import java.io.IOException; +import javax.imageio.ImageIO; +import net.minecraft.client.Minecraft; + +public class TextureWatchFX extends TextureFX { + private Minecraft mc; + private int[] watchIconImageData = new int[256]; + private int[] dialImageData = new int[256]; + private double field_4222_j; + private double field_4221_k; + + public TextureWatchFX(Minecraft var1) { + super(Item.pocketSundial.getIconFromDamage(0)); + this.mc = var1; + this.tileImage = 1; + + try { + BufferedImage var2 = ImageIO.read(Minecraft.class.getResource("/gui/items.png")); + int var3 = this.iconIndex % 16 * 16; + int var4 = this.iconIndex / 16 * 16; + var2.getRGB(var3, var4, 16, 16, this.watchIconImageData, 0, 16); + var2 = ImageIO.read(Minecraft.class.getResource("/misc/dial.png")); + var2.getRGB(0, 0, 16, 16, this.dialImageData, 0, 16); + } catch (IOException var5) { + var5.printStackTrace(); + } + + } + + public void onTick() { + double var1 = 0.0D; + if(this.mc.theWorld != null && this.mc.thePlayer != null) { + float var3 = this.mc.theWorld.getCelestialAngle(1.0F); + var1 = (double)(-var3 * (float)Math.PI * 2.0F); + if(this.mc.theWorld.worldProvider.isNether) { + var1 = Math.random() * (double)((float)Math.PI) * 2.0D; + } + } + + double var22; + for(var22 = var1 - this.field_4222_j; var22 < -Math.PI; var22 += Math.PI * 2.0D) { + } + + while(var22 >= Math.PI) { + var22 -= Math.PI * 2.0D; + } + + if(var22 < -1.0D) { + var22 = -1.0D; + } + + if(var22 > 1.0D) { + var22 = 1.0D; + } + + this.field_4221_k += var22 * 0.1D; + this.field_4221_k *= 0.8D; + this.field_4222_j += this.field_4221_k; + double var5 = Math.sin(this.field_4222_j); + double var7 = Math.cos(this.field_4222_j); + + for(int var9 = 0; var9 < 256; ++var9) { + int var10 = this.watchIconImageData[var9] >> 24 & 255; + int var11 = this.watchIconImageData[var9] >> 16 & 255; + int var12 = this.watchIconImageData[var9] >> 8 & 255; + int var13 = this.watchIconImageData[var9] >> 0 & 255; + if(var11 == var13 && var12 == 0 && var13 > 0) { + double var14 = -((double)(var9 % 16) / 15.0D - 0.5D); + double var16 = (double)(var9 / 16) / 15.0D - 0.5D; + int var18 = var11; + int var19 = (int)((var14 * var7 + var16 * var5 + 0.5D) * 16.0D); + int var20 = (int)((var16 * var7 - var14 * var5 + 0.5D) * 16.0D); + int var21 = (var19 & 15) + (var20 & 15) * 16; + var10 = this.dialImageData[var21] >> 24 & 255; + var11 = (this.dialImageData[var21] >> 16 & 255) * var11 / 255; + var12 = (this.dialImageData[var21] >> 8 & 255) * var18 / 255; + var13 = (this.dialImageData[var21] >> 0 & 255) * var18 / 255; + } + + if(this.anaglyphEnabled) { + int var23 = (var11 * 30 + var12 * 59 + var13 * 11) / 100; + int var15 = (var11 * 30 + var12 * 70) / 100; + int var24 = (var11 * 30 + var13 * 70) / 100; + var11 = var23; + var12 = var15; + var13 = var24; + } + + this.imageData[var9 * 4 + 0] = (byte)var11; + this.imageData[var9 * 4 + 1] = (byte)var12; + this.imageData[var9 * 4 + 2] = (byte)var13; + this.imageData[var9 * 4 + 3] = (byte)var10; + } + + } +} diff --git a/src/net/minecraft/src/TextureWaterFX.java b/src/net/minecraft/src/TextureWaterFX.java new file mode 100644 index 0000000..5548bf0 --- /dev/null +++ b/src/net/minecraft/src/TextureWaterFX.java @@ -0,0 +1,85 @@ +package net.minecraft.src; + +public class TextureWaterFX extends TextureFX { + protected float[] field_1158_g = new float[256]; + protected float[] field_1157_h = new float[256]; + protected float[] field_1156_i = new float[256]; + protected float[] field_1155_j = new float[256]; + private int tickCounter = 0; + + public TextureWaterFX() { + super(Block.waterMoving.blockIndexInTexture); + } + + public void onTick() { + ++this.tickCounter; + + int var1; + int var2; + float var3; + int var5; + int var6; + for(var1 = 0; var1 < 16; ++var1) { + for(var2 = 0; var2 < 16; ++var2) { + var3 = 0.0F; + + for(int var4 = var1 - 1; var4 <= var1 + 1; ++var4) { + var5 = var4 & 15; + var6 = var2 & 15; + var3 += this.field_1158_g[var5 + var6 * 16]; + } + + this.field_1157_h[var1 + var2 * 16] = var3 / 3.3F + this.field_1156_i[var1 + var2 * 16] * 0.8F; + } + } + + for(var1 = 0; var1 < 16; ++var1) { + for(var2 = 0; var2 < 16; ++var2) { + this.field_1156_i[var1 + var2 * 16] += this.field_1155_j[var1 + var2 * 16] * 0.05F; + if(this.field_1156_i[var1 + var2 * 16] < 0.0F) { + this.field_1156_i[var1 + var2 * 16] = 0.0F; + } + + this.field_1155_j[var1 + var2 * 16] -= 0.1F; + if(Math.random() < 0.05D) { + this.field_1155_j[var1 + var2 * 16] = 0.5F; + } + } + } + + float[] var12 = this.field_1157_h; + this.field_1157_h = this.field_1158_g; + this.field_1158_g = var12; + + for(var2 = 0; var2 < 256; ++var2) { + var3 = this.field_1158_g[var2]; + if(var3 > 1.0F) { + var3 = 1.0F; + } + + if(var3 < 0.0F) { + var3 = 0.0F; + } + + float var13 = var3 * var3; + var5 = (int)(32.0F + var13 * 32.0F); + var6 = (int)(50.0F + var13 * 64.0F); + int var7 = 255; + int var8 = (int)(146.0F + var13 * 50.0F); + if(this.anaglyphEnabled) { + int var9 = (var5 * 30 + var6 * 59 + var7 * 11) / 100; + int var10 = (var5 * 30 + var6 * 70) / 100; + int var11 = (var5 * 30 + var7 * 70) / 100; + var5 = var9; + var6 = var10; + var7 = var11; + } + + this.imageData[var2 * 4 + 0] = (byte)var5; + this.imageData[var2 * 4 + 1] = (byte)var6; + this.imageData[var2 * 4 + 2] = (byte)var7; + this.imageData[var2 * 4 + 3] = (byte)var8; + } + + } +} diff --git a/src/net/minecraft/src/TextureWaterFlowFX.java b/src/net/minecraft/src/TextureWaterFlowFX.java new file mode 100644 index 0000000..88b8d16 --- /dev/null +++ b/src/net/minecraft/src/TextureWaterFlowFX.java @@ -0,0 +1,86 @@ +package net.minecraft.src; + +public class TextureWaterFlowFX extends TextureFX { + protected float[] field_1138_g = new float[256]; + protected float[] field_1137_h = new float[256]; + protected float[] field_1136_i = new float[256]; + protected float[] field_1135_j = new float[256]; + private int field_1134_k = 0; + + public TextureWaterFlowFX() { + super(Block.waterMoving.blockIndexInTexture + 1); + this.tileSize = 2; + } + + public void onTick() { + ++this.field_1134_k; + + int var1; + int var2; + float var3; + int var5; + int var6; + for(var1 = 0; var1 < 16; ++var1) { + for(var2 = 0; var2 < 16; ++var2) { + var3 = 0.0F; + + for(int var4 = var2 - 2; var4 <= var2; ++var4) { + var5 = var1 & 15; + var6 = var4 & 15; + var3 += this.field_1138_g[var5 + var6 * 16]; + } + + this.field_1137_h[var1 + var2 * 16] = var3 / 3.2F + this.field_1136_i[var1 + var2 * 16] * 0.8F; + } + } + + for(var1 = 0; var1 < 16; ++var1) { + for(var2 = 0; var2 < 16; ++var2) { + this.field_1136_i[var1 + var2 * 16] += this.field_1135_j[var1 + var2 * 16] * 0.05F; + if(this.field_1136_i[var1 + var2 * 16] < 0.0F) { + this.field_1136_i[var1 + var2 * 16] = 0.0F; + } + + this.field_1135_j[var1 + var2 * 16] -= 0.3F; + if(Math.random() < 0.2D) { + this.field_1135_j[var1 + var2 * 16] = 0.5F; + } + } + } + + float[] var12 = this.field_1137_h; + this.field_1137_h = this.field_1138_g; + this.field_1138_g = var12; + + for(var2 = 0; var2 < 256; ++var2) { + var3 = this.field_1138_g[var2 - this.field_1134_k * 16 & 255]; + if(var3 > 1.0F) { + var3 = 1.0F; + } + + if(var3 < 0.0F) { + var3 = 0.0F; + } + + float var13 = var3 * var3; + var5 = (int)(32.0F + var13 * 32.0F); + var6 = (int)(50.0F + var13 * 64.0F); + int var7 = 255; + int var8 = (int)(146.0F + var13 * 50.0F); + if(this.anaglyphEnabled) { + int var9 = (var5 * 30 + var6 * 59 + var7 * 11) / 100; + int var10 = (var5 * 30 + var6 * 70) / 100; + int var11 = (var5 * 30 + var7 * 70) / 100; + var5 = var9; + var6 = var10; + var7 = var11; + } + + this.imageData[var2 * 4 + 0] = (byte)var5; + this.imageData[var2 * 4 + 1] = (byte)var6; + this.imageData[var2 * 4 + 2] = (byte)var7; + this.imageData[var2 * 4 + 3] = (byte)var8; + } + + } +} diff --git a/src/net/minecraft/src/TexturedQuad.java b/src/net/minecraft/src/TexturedQuad.java new file mode 100644 index 0000000..9bddea8 --- /dev/null +++ b/src/net/minecraft/src/TexturedQuad.java @@ -0,0 +1,53 @@ +package net.minecraft.src; + +public class TexturedQuad { + public PositionTextureVertex[] vertexPositions; + public int nVertices; + private boolean invertNormal; + + public TexturedQuad(PositionTextureVertex[] var1) { + this.nVertices = 0; + this.invertNormal = false; + this.vertexPositions = var1; + this.nVertices = var1.length; + } + + public TexturedQuad(PositionTextureVertex[] var1, int var2, int var3, int var4, int var5) { + this(var1); + float var6 = 0.0015625F; + float var7 = 0.003125F; + var1[0] = var1[0].setTexturePosition((float)var4 / 64.0F - var6, (float)var3 / 32.0F + var7); + var1[1] = var1[1].setTexturePosition((float)var2 / 64.0F + var6, (float)var3 / 32.0F + var7); + var1[2] = var1[2].setTexturePosition((float)var2 / 64.0F + var6, (float)var5 / 32.0F - var7); + var1[3] = var1[3].setTexturePosition((float)var4 / 64.0F - var6, (float)var5 / 32.0F - var7); + } + + public void flipFace() { + PositionTextureVertex[] var1 = new PositionTextureVertex[this.vertexPositions.length]; + + for(int var2 = 0; var2 < this.vertexPositions.length; ++var2) { + var1[var2] = this.vertexPositions[this.vertexPositions.length - var2 - 1]; + } + + this.vertexPositions = var1; + } + + public void draw(Tessellator var1, float var2) { + Vec3D var3 = this.vertexPositions[1].vector3D.subtract(this.vertexPositions[0].vector3D); + Vec3D var4 = this.vertexPositions[1].vector3D.subtract(this.vertexPositions[2].vector3D); + Vec3D var5 = var4.crossProduct(var3).normalize(); + var1.startDrawingQuads(); + if(this.invertNormal) { + var1.setNormal(-((float)var5.xCoord), -((float)var5.yCoord), -((float)var5.zCoord)); + } else { + var1.setNormal((float)var5.xCoord, (float)var5.yCoord, (float)var5.zCoord); + } + + for(int var6 = 0; var6 < 4; ++var6) { + PositionTextureVertex var7 = this.vertexPositions[var6]; + var1.addVertexWithUV((double)((float)var7.vector3D.xCoord * var2), (double)((float)var7.vector3D.yCoord * var2), (double)((float)var7.vector3D.zCoord * var2), (double)var7.texturePositionX, (double)var7.texturePositionY); + } + + var1.draw(); + } +} diff --git a/src/net/minecraft/src/ThreadCheckHasPaid.java b/src/net/minecraft/src/ThreadCheckHasPaid.java new file mode 100644 index 0000000..2aa3842 --- /dev/null +++ b/src/net/minecraft/src/ThreadCheckHasPaid.java @@ -0,0 +1,28 @@ +package net.minecraft.src; + +import java.net.HttpURLConnection; +import java.net.URL; +import net.minecraft.client.Minecraft; + +public class ThreadCheckHasPaid extends Thread { + final Minecraft field_28146_a; + + public ThreadCheckHasPaid(Minecraft var1) { + this.field_28146_a = var1; + } + + public void run() { + try { + HttpURLConnection var1 = (HttpURLConnection)(new URL("https://login.minecraft.net/session?name=" + this.field_28146_a.session.username + "&session=" + this.field_28146_a.session.sessionId)).openConnection(); + var1.connect(); + if(var1.getResponseCode() == 400) { + Minecraft.hasPaidCheckTime = System.currentTimeMillis(); + } + + var1.disconnect(); + } catch (Exception var2) { + var2.printStackTrace(); + } + + } +} diff --git a/src/net/minecraft/src/ThreadCloseConnection.java b/src/net/minecraft/src/ThreadCloseConnection.java new file mode 100644 index 0000000..ed4c960 --- /dev/null +++ b/src/net/minecraft/src/ThreadCloseConnection.java @@ -0,0 +1,22 @@ +package net.minecraft.src; + +class ThreadCloseConnection extends Thread { + final NetworkManager field_28109_a; + + ThreadCloseConnection(NetworkManager var1) { + this.field_28109_a = var1; + } + + public void run() { + try { + Thread.sleep(2000L); + if(NetworkManager.isRunning(this.field_28109_a)) { + NetworkManager.getWriteThread(this.field_28109_a).interrupt(); + this.field_28109_a.networkShutdown("disconnect.closed", new Object[0]); + } + } catch (Exception var2) { + var2.printStackTrace(); + } + + } +} diff --git a/src/net/minecraft/src/ThreadConnectToServer.java b/src/net/minecraft/src/ThreadConnectToServer.java new file mode 100644 index 0000000..b890842 --- /dev/null +++ b/src/net/minecraft/src/ThreadConnectToServer.java @@ -0,0 +1,50 @@ +package net.minecraft.src; + +import java.net.ConnectException; +import java.net.UnknownHostException; +import net.minecraft.client.Minecraft; + +class ThreadConnectToServer extends Thread { + final Minecraft mc; + final String hostName; + final int port; + final GuiConnecting connectingGui; + + ThreadConnectToServer(GuiConnecting var1, Minecraft var2, String var3, int var4) { + this.connectingGui = var1; + this.mc = var2; + this.hostName = var3; + this.port = var4; + } + + public void run() { + try { + GuiConnecting.setNetClientHandler(this.connectingGui, new NetClientHandler(this.mc, this.hostName, this.port)); + if(GuiConnecting.isCancelled(this.connectingGui)) { + return; + } + + GuiConnecting.getNetClientHandler(this.connectingGui).addToSendQueue(new Packet2Handshake(this.mc.session.username)); + } catch (UnknownHostException var2) { + if(GuiConnecting.isCancelled(this.connectingGui)) { + return; + } + + this.mc.displayGuiScreen(new GuiConnectFailed("connect.failed", "disconnect.genericReason", new Object[]{"Unknown host \'" + this.hostName + "\'"})); + } catch (ConnectException var3) { + if(GuiConnecting.isCancelled(this.connectingGui)) { + return; + } + + this.mc.displayGuiScreen(new GuiConnectFailed("connect.failed", "disconnect.genericReason", new Object[]{var3.getMessage()})); + } catch (Exception var4) { + if(GuiConnecting.isCancelled(this.connectingGui)) { + return; + } + + var4.printStackTrace(); + this.mc.displayGuiScreen(new GuiConnectFailed("connect.failed", "disconnect.genericReason", new Object[]{var4.toString()})); + } + + } +} diff --git a/src/net/minecraft/src/ThreadDownloadImage.java b/src/net/minecraft/src/ThreadDownloadImage.java new file mode 100644 index 0000000..58118f3 --- /dev/null +++ b/src/net/minecraft/src/ThreadDownloadImage.java @@ -0,0 +1,44 @@ +package net.minecraft.src; + +import java.net.HttpURLConnection; +import java.net.URL; +import javax.imageio.ImageIO; + +class ThreadDownloadImage extends Thread { + final String location; + final ImageBuffer buffer; + final ThreadDownloadImageData imageData; + + ThreadDownloadImage(ThreadDownloadImageData var1, String var2, ImageBuffer var3) { + this.imageData = var1; + this.location = var2; + this.buffer = var3; + } + + public void run() { + HttpURLConnection var1 = null; + + try { + URL var2 = new URL(this.location); + var1 = (HttpURLConnection)var2.openConnection(); + var1.setDoInput(true); + var1.setDoOutput(false); + var1.connect(); + if(var1.getResponseCode() / 100 != 4) { + if(this.buffer == null) { + this.imageData.image = ImageIO.read(var1.getInputStream()); + } else { + this.imageData.image = this.buffer.parseUserSkin(ImageIO.read(var1.getInputStream())); + } + + return; + } + } catch (Exception var6) { + var6.printStackTrace(); + return; + } finally { + var1.disconnect(); + } + + } +} diff --git a/src/net/minecraft/src/ThreadDownloadImageData.java b/src/net/minecraft/src/ThreadDownloadImageData.java new file mode 100644 index 0000000..822a232 --- /dev/null +++ b/src/net/minecraft/src/ThreadDownloadImageData.java @@ -0,0 +1,14 @@ +package net.minecraft.src; + +import java.awt.image.BufferedImage; + +public class ThreadDownloadImageData { + public BufferedImage image; + public int referenceCount = 1; + public int textureName = -1; + public boolean textureSetupComplete = false; + + public ThreadDownloadImageData(String var1, ImageBuffer var2) { + (new ThreadDownloadImage(this, var1, var2)).start(); + } +} diff --git a/src/net/minecraft/src/ThreadDownloadResources.java b/src/net/minecraft/src/ThreadDownloadResources.java new file mode 100644 index 0000000..972fd6c --- /dev/null +++ b/src/net/minecraft/src/ThreadDownloadResources.java @@ -0,0 +1,135 @@ +package net.minecraft.src; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.net.URL; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import net.minecraft.client.Minecraft; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + +public class ThreadDownloadResources extends Thread { + public File resourcesFolder; + private Minecraft mc; + private boolean closing = false; + + public ThreadDownloadResources(File var1, Minecraft var2) { + this.mc = var2; + this.setName("Resource download thread"); + this.setDaemon(true); + this.resourcesFolder = new File(var1, "resources/"); + if(!this.resourcesFolder.exists() && !this.resourcesFolder.mkdirs()) { + throw new RuntimeException("The working directory could not be created: " + this.resourcesFolder); + } + } + + public void run() { + try { + URL var1 = new URL("http://s3.amazonaws.com/MinecraftResources/"); + DocumentBuilderFactory var2 = DocumentBuilderFactory.newInstance(); + DocumentBuilder var3 = var2.newDocumentBuilder(); + Document var4 = var3.parse(var1.openStream()); + NodeList var5 = var4.getElementsByTagName("Contents"); + + for(int var6 = 0; var6 < 2; ++var6) { + for(int var7 = 0; var7 < var5.getLength(); ++var7) { + Node var8 = var5.item(var7); + if(var8.getNodeType() == 1) { + Element var9 = (Element)var8; + String var10 = ((Element)var9.getElementsByTagName("Key").item(0)).getChildNodes().item(0).getNodeValue(); + long var11 = Long.parseLong(((Element)var9.getElementsByTagName("Size").item(0)).getChildNodes().item(0).getNodeValue()); + if(var11 > 0L) { + this.downloadAndInstallResource(var1, var10, var11, var6); + if(this.closing) { + return; + } + } + } + } + } + } catch (Exception var13) { + this.loadResource(this.resourcesFolder, ""); + var13.printStackTrace(); + } + + } + + public void reloadResources() { + this.loadResource(this.resourcesFolder, ""); + } + + private void loadResource(File var1, String var2) { + File[] var3 = var1.listFiles(); + + for(int var4 = 0; var4 < var3.length; ++var4) { + if(var3[var4].isDirectory()) { + this.loadResource(var3[var4], var2 + var3[var4].getName() + "/"); + } else { + try { + this.mc.installResource(var2 + var3[var4].getName(), var3[var4]); + } catch (Exception var6) { + System.out.println("Failed to add " + var2 + var3[var4].getName()); + } + } + } + + } + + private void downloadAndInstallResource(URL var1, String var2, long var3, int var5) { + try { + int var6 = var2.indexOf("/"); + String var7 = var2.substring(0, var6); + if(!var7.equals("sound") && !var7.equals("newsound")) { + if(var5 != 1) { + return; + } + } else if(var5 != 0) { + return; + } + + File var8 = new File(this.resourcesFolder, var2); + if(!var8.exists() || var8.length() != var3) { + var8.getParentFile().mkdirs(); + String var9 = var2.replaceAll(" ", "%20"); + this.downloadResource(new URL(var1, var9), var8, var3); + if(this.closing) { + return; + } + } + + this.mc.installResource(var2, var8); + } catch (Exception var10) { + var10.printStackTrace(); + } + + } + + private void downloadResource(URL var1, File var2, long var3) throws IOException { + byte[] var5 = new byte[4096]; + DataInputStream var6 = new DataInputStream(var1.openStream()); + DataOutputStream var7 = new DataOutputStream(new FileOutputStream(var2)); + boolean var8 = false; + + do { + int var9 = var6.read(var5); + if(var9 < 0) { + var6.close(); + var7.close(); + return; + } + + var7.write(var5, 0, var9); + } while(!this.closing); + + } + + public void closeMinecraft() { + this.closing = true; + } +} diff --git a/src/net/minecraft/src/ThreadRunIsoClient.java b/src/net/minecraft/src/ThreadRunIsoClient.java new file mode 100644 index 0000000..ee481bb --- /dev/null +++ b/src/net/minecraft/src/ThreadRunIsoClient.java @@ -0,0 +1,21 @@ +package net.minecraft.src; + +class ThreadRunIsoClient extends Thread { + final CanvasIsomPreview isoCanvas; + + ThreadRunIsoClient(CanvasIsomPreview var1) { + this.isoCanvas = var1; + } + + public void run() { + while(CanvasIsomPreview.isRunning(this.isoCanvas)) { + this.isoCanvas.showNextBuffer(); + + try { + Thread.sleep(1L); + } catch (Exception var2) { + } + } + + } +} diff --git a/src/net/minecraft/src/ThreadSleepForever.java b/src/net/minecraft/src/ThreadSleepForever.java new file mode 100644 index 0000000..8da7b6f --- /dev/null +++ b/src/net/minecraft/src/ThreadSleepForever.java @@ -0,0 +1,24 @@ +package net.minecraft.src; + +import net.minecraft.client.Minecraft; + +public class ThreadSleepForever extends Thread { + final Minecraft mc; + + public ThreadSleepForever(Minecraft var1, String var2) { + super(var2); + this.mc = var1; + this.setDaemon(true); + this.start(); + } + + public void run() { + while(this.mc.running) { + try { + Thread.sleep(2147483647L); + } catch (InterruptedException var2) { + } + } + + } +} diff --git a/src/net/minecraft/src/ThreadStatSyncherReceive.java b/src/net/minecraft/src/ThreadStatSyncherReceive.java new file mode 100644 index 0000000..5ed76db --- /dev/null +++ b/src/net/minecraft/src/ThreadStatSyncherReceive.java @@ -0,0 +1,24 @@ +package net.minecraft.src; + +class ThreadStatSyncherReceive extends Thread { + final StatsSyncher field_27231_a; + + ThreadStatSyncherReceive(StatsSyncher var1) { + this.field_27231_a = var1; + } + + public void run() { + try { + if(StatsSyncher.func_27422_a(this.field_27231_a) != null) { + StatsSyncher.func_27412_a(this.field_27231_a, StatsSyncher.func_27422_a(this.field_27231_a), StatsSyncher.func_27423_b(this.field_27231_a), StatsSyncher.func_27411_c(this.field_27231_a), StatsSyncher.func_27413_d(this.field_27231_a)); + } else if(StatsSyncher.func_27423_b(this.field_27231_a).exists()) { + StatsSyncher.func_27421_a(this.field_27231_a, StatsSyncher.func_27409_a(this.field_27231_a, StatsSyncher.func_27423_b(this.field_27231_a), StatsSyncher.func_27411_c(this.field_27231_a), StatsSyncher.func_27413_d(this.field_27231_a))); + } + } catch (Exception var5) { + var5.printStackTrace(); + } finally { + StatsSyncher.func_27416_a(this.field_27231_a, false); + } + + } +} diff --git a/src/net/minecraft/src/ThreadStatSyncherSend.java b/src/net/minecraft/src/ThreadStatSyncherSend.java new file mode 100644 index 0000000..636f8ac --- /dev/null +++ b/src/net/minecraft/src/ThreadStatSyncherSend.java @@ -0,0 +1,24 @@ +package net.minecraft.src; + +import java.util.Map; + +class ThreadStatSyncherSend extends Thread { + final Map field_27233_a; + final StatsSyncher field_27232_b; + + ThreadStatSyncherSend(StatsSyncher var1, Map var2) { + this.field_27232_b = var1; + this.field_27233_a = var2; + } + + public void run() { + try { + StatsSyncher.func_27412_a(this.field_27232_b, this.field_27233_a, StatsSyncher.func_27414_e(this.field_27232_b), StatsSyncher.func_27417_f(this.field_27232_b), StatsSyncher.func_27419_g(this.field_27232_b)); + } catch (Exception var5) { + var5.printStackTrace(); + } finally { + StatsSyncher.func_27416_a(this.field_27232_b, false); + } + + } +} diff --git a/src/net/minecraft/src/TileEntity.java b/src/net/minecraft/src/TileEntity.java new file mode 100644 index 0000000..fb4a95c --- /dev/null +++ b/src/net/minecraft/src/TileEntity.java @@ -0,0 +1,110 @@ +package net.minecraft.src; + +import java.util.HashMap; +import java.util.Map; + +public class TileEntity { + private static Map nameToClassMap = new HashMap(); + private static Map classToNameMap = new HashMap(); + public World worldObj; + public int xCoord; + public int yCoord; + public int zCoord; + protected boolean field_31007_h; + + private static void addMapping(Class var0, String var1) { + if(classToNameMap.containsKey(var1)) { + throw new IllegalArgumentException("Duplicate id: " + var1); + } else { + nameToClassMap.put(var1, var0); + classToNameMap.put(var0, var1); + } + } + + public void readFromNBT(NBTTagCompound var1) { + this.xCoord = var1.getInteger("x"); + this.yCoord = var1.getInteger("y"); + this.zCoord = var1.getInteger("z"); + } + + public void writeToNBT(NBTTagCompound var1) { + String var2 = (String)classToNameMap.get(this.getClass()); + if(var2 == null) { + throw new RuntimeException(this.getClass() + " is missing a mapping! This is a bug!"); + } else { + var1.setString("id", var2); + var1.setInteger("x", this.xCoord); + var1.setInteger("y", this.yCoord); + var1.setInteger("z", this.zCoord); + } + } + + public void updateEntity() { + } + + public static TileEntity createAndLoadEntity(NBTTagCompound var0) { + TileEntity var1 = null; + + try { + Class var2 = (Class)nameToClassMap.get(var0.getString("id")); + if(var2 != null) { + var1 = (TileEntity)var2.newInstance(); + } + } catch (Exception var3) { + var3.printStackTrace(); + } + + if(var1 != null) { + var1.readFromNBT(var0); + } else { + System.out.println("Skipping TileEntity with id " + var0.getString("id")); + } + + return var1; + } + + public int getBlockMetadata() { + return this.worldObj.getBlockMetadata(this.xCoord, this.yCoord, this.zCoord); + } + + public void onInventoryChanged() { + if(this.worldObj != null) { + this.worldObj.func_698_b(this.xCoord, this.yCoord, this.zCoord, this); + } + + } + + public double getDistanceFrom(double var1, double var3, double var5) { + double var7 = (double)this.xCoord + 0.5D - var1; + double var9 = (double)this.yCoord + 0.5D - var3; + double var11 = (double)this.zCoord + 0.5D - var5; + return var7 * var7 + var9 * var9 + var11 * var11; + } + + public Block getBlockType() { + return Block.blocksList[this.worldObj.getBlockId(this.xCoord, this.yCoord, this.zCoord)]; + } + + public boolean func_31006_g() { + return this.field_31007_h; + } + + public void func_31005_i() { + this.field_31007_h = true; + } + + public void func_31004_j() { + this.field_31007_h = false; + } + + static { + addMapping(TileEntityFurnace.class, "Furnace"); + addMapping(TileEntityChest.class, "Chest"); + addMapping(TileEntityRecordPlayer.class, "RecordPlayer"); + addMapping(TileEntityDispenser.class, "Trap"); + addMapping(TileEntitySign.class, "Sign"); + addMapping(TileEntityMobSpawner.class, "MobSpawner"); + addMapping(TileEntityNote.class, "Music"); + addMapping(TileEntityPiston.class, "Piston"); + } +} diff --git a/src/net/minecraft/src/TileEntityChest.java b/src/net/minecraft/src/TileEntityChest.java new file mode 100644 index 0000000..5725b53 --- /dev/null +++ b/src/net/minecraft/src/TileEntityChest.java @@ -0,0 +1,87 @@ +package net.minecraft.src; + +public class TileEntityChest extends TileEntity implements IInventory { + private ItemStack[] chestContents = new ItemStack[36]; + + public int getSizeInventory() { + return 27; + } + + public ItemStack getStackInSlot(int var1) { + return this.chestContents[var1]; + } + + public ItemStack decrStackSize(int var1, int var2) { + if(this.chestContents[var1] != null) { + ItemStack var3; + if(this.chestContents[var1].stackSize <= var2) { + var3 = this.chestContents[var1]; + this.chestContents[var1] = null; + this.onInventoryChanged(); + return var3; + } else { + var3 = this.chestContents[var1].splitStack(var2); + if(this.chestContents[var1].stackSize == 0) { + this.chestContents[var1] = null; + } + + this.onInventoryChanged(); + return var3; + } + } else { + return null; + } + } + + public void setInventorySlotContents(int var1, ItemStack var2) { + this.chestContents[var1] = var2; + if(var2 != null && var2.stackSize > this.getInventoryStackLimit()) { + var2.stackSize = this.getInventoryStackLimit(); + } + + this.onInventoryChanged(); + } + + public String getInvName() { + return "Chest"; + } + + public void readFromNBT(NBTTagCompound var1) { + super.readFromNBT(var1); + NBTTagList var2 = var1.getTagList("Items"); + this.chestContents = new ItemStack[this.getSizeInventory()]; + + for(int var3 = 0; var3 < var2.tagCount(); ++var3) { + NBTTagCompound var4 = (NBTTagCompound)var2.tagAt(var3); + int var5 = var4.getByte("Slot") & 255; + if(var5 >= 0 && var5 < this.chestContents.length) { + this.chestContents[var5] = new ItemStack(var4); + } + } + + } + + public void writeToNBT(NBTTagCompound var1) { + super.writeToNBT(var1); + NBTTagList var2 = new NBTTagList(); + + for(int var3 = 0; var3 < this.chestContents.length; ++var3) { + if(this.chestContents[var3] != null) { + NBTTagCompound var4 = new NBTTagCompound(); + var4.setByte("Slot", (byte)var3); + this.chestContents[var3].writeToNBT(var4); + var2.setTag(var4); + } + } + + var1.setTag("Items", var2); + } + + public int getInventoryStackLimit() { + return 64; + } + + public boolean canInteractWith(EntityPlayer var1) { + return this.worldObj.getBlockTileEntity(this.xCoord, this.yCoord, this.zCoord) != this ? false : var1.getDistanceSq((double)this.xCoord + 0.5D, (double)this.yCoord + 0.5D, (double)this.zCoord + 0.5D) <= 64.0D; + } +} diff --git a/src/net/minecraft/src/TileEntityDispenser.java b/src/net/minecraft/src/TileEntityDispenser.java new file mode 100644 index 0000000..afaad6d --- /dev/null +++ b/src/net/minecraft/src/TileEntityDispenser.java @@ -0,0 +1,107 @@ +package net.minecraft.src; + +import java.util.Random; + +public class TileEntityDispenser extends TileEntity implements IInventory { + private ItemStack[] dispenserContents = new ItemStack[9]; + private Random dispenserRandom = new Random(); + + public int getSizeInventory() { + return 9; + } + + public ItemStack getStackInSlot(int var1) { + return this.dispenserContents[var1]; + } + + public ItemStack decrStackSize(int var1, int var2) { + if(this.dispenserContents[var1] != null) { + ItemStack var3; + if(this.dispenserContents[var1].stackSize <= var2) { + var3 = this.dispenserContents[var1]; + this.dispenserContents[var1] = null; + this.onInventoryChanged(); + return var3; + } else { + var3 = this.dispenserContents[var1].splitStack(var2); + if(this.dispenserContents[var1].stackSize == 0) { + this.dispenserContents[var1] = null; + } + + this.onInventoryChanged(); + return var3; + } + } else { + return null; + } + } + + public ItemStack getRandomStackFromInventory() { + int var1 = -1; + int var2 = 1; + + for(int var3 = 0; var3 < this.dispenserContents.length; ++var3) { + if(this.dispenserContents[var3] != null && this.dispenserRandom.nextInt(var2++) == 0) { + var1 = var3; + } + } + + if(var1 >= 0) { + return this.decrStackSize(var1, 1); + } else { + return null; + } + } + + public void setInventorySlotContents(int var1, ItemStack var2) { + this.dispenserContents[var1] = var2; + if(var2 != null && var2.stackSize > this.getInventoryStackLimit()) { + var2.stackSize = this.getInventoryStackLimit(); + } + + this.onInventoryChanged(); + } + + public String getInvName() { + return "Trap"; + } + + public void readFromNBT(NBTTagCompound var1) { + super.readFromNBT(var1); + NBTTagList var2 = var1.getTagList("Items"); + this.dispenserContents = new ItemStack[this.getSizeInventory()]; + + for(int var3 = 0; var3 < var2.tagCount(); ++var3) { + NBTTagCompound var4 = (NBTTagCompound)var2.tagAt(var3); + int var5 = var4.getByte("Slot") & 255; + if(var5 >= 0 && var5 < this.dispenserContents.length) { + this.dispenserContents[var5] = new ItemStack(var4); + } + } + + } + + public void writeToNBT(NBTTagCompound var1) { + super.writeToNBT(var1); + NBTTagList var2 = new NBTTagList(); + + for(int var3 = 0; var3 < this.dispenserContents.length; ++var3) { + if(this.dispenserContents[var3] != null) { + NBTTagCompound var4 = new NBTTagCompound(); + var4.setByte("Slot", (byte)var3); + this.dispenserContents[var3].writeToNBT(var4); + var2.setTag(var4); + } + } + + var1.setTag("Items", var2); + } + + public int getInventoryStackLimit() { + return 64; + } + + public boolean canInteractWith(EntityPlayer var1) { + return this.worldObj.getBlockTileEntity(this.xCoord, this.yCoord, this.zCoord) != this ? false : var1.getDistanceSq((double)this.xCoord + 0.5D, (double)this.yCoord + 0.5D, (double)this.zCoord + 0.5D) <= 64.0D; + } +} diff --git a/src/net/minecraft/src/TileEntityFurnace.java b/src/net/minecraft/src/TileEntityFurnace.java new file mode 100644 index 0000000..432b873 --- /dev/null +++ b/src/net/minecraft/src/TileEntityFurnace.java @@ -0,0 +1,187 @@ +package net.minecraft.src; + +public class TileEntityFurnace extends TileEntity implements IInventory { + private ItemStack[] furnaceItemStacks = new ItemStack[3]; + public int furnaceBurnTime = 0; + public int currentItemBurnTime = 0; + public int furnaceCookTime = 0; + + public int getSizeInventory() { + return this.furnaceItemStacks.length; + } + + public ItemStack getStackInSlot(int var1) { + return this.furnaceItemStacks[var1]; + } + + public ItemStack decrStackSize(int var1, int var2) { + if(this.furnaceItemStacks[var1] != null) { + ItemStack var3; + if(this.furnaceItemStacks[var1].stackSize <= var2) { + var3 = this.furnaceItemStacks[var1]; + this.furnaceItemStacks[var1] = null; + return var3; + } else { + var3 = this.furnaceItemStacks[var1].splitStack(var2); + if(this.furnaceItemStacks[var1].stackSize == 0) { + this.furnaceItemStacks[var1] = null; + } + + return var3; + } + } else { + return null; + } + } + + public void setInventorySlotContents(int var1, ItemStack var2) { + this.furnaceItemStacks[var1] = var2; + if(var2 != null && var2.stackSize > this.getInventoryStackLimit()) { + var2.stackSize = this.getInventoryStackLimit(); + } + + } + + public String getInvName() { + return "Furnace"; + } + + public void readFromNBT(NBTTagCompound var1) { + super.readFromNBT(var1); + NBTTagList var2 = var1.getTagList("Items"); + this.furnaceItemStacks = new ItemStack[this.getSizeInventory()]; + + for(int var3 = 0; var3 < var2.tagCount(); ++var3) { + NBTTagCompound var4 = (NBTTagCompound)var2.tagAt(var3); + byte var5 = var4.getByte("Slot"); + if(var5 >= 0 && var5 < this.furnaceItemStacks.length) { + this.furnaceItemStacks[var5] = new ItemStack(var4); + } + } + + this.furnaceBurnTime = var1.getShort("BurnTime"); + this.furnaceCookTime = var1.getShort("CookTime"); + this.currentItemBurnTime = this.getItemBurnTime(this.furnaceItemStacks[1]); + } + + public void writeToNBT(NBTTagCompound var1) { + super.writeToNBT(var1); + var1.setShort("BurnTime", (short)this.furnaceBurnTime); + var1.setShort("CookTime", (short)this.furnaceCookTime); + NBTTagList var2 = new NBTTagList(); + + for(int var3 = 0; var3 < this.furnaceItemStacks.length; ++var3) { + if(this.furnaceItemStacks[var3] != null) { + NBTTagCompound var4 = new NBTTagCompound(); + var4.setByte("Slot", (byte)var3); + this.furnaceItemStacks[var3].writeToNBT(var4); + var2.setTag(var4); + } + } + + var1.setTag("Items", var2); + } + + public int getInventoryStackLimit() { + return 64; + } + + public int getCookProgressScaled(int var1) { + return this.furnaceCookTime * var1 / 200; + } + + public int getBurnTimeRemainingScaled(int var1) { + if(this.currentItemBurnTime == 0) { + this.currentItemBurnTime = 200; + } + + return this.furnaceBurnTime * var1 / this.currentItemBurnTime; + } + + public boolean isBurning() { + return this.furnaceBurnTime > 0; + } + + public void updateEntity() { + boolean var1 = this.furnaceBurnTime > 0; + boolean var2 = false; + if(this.furnaceBurnTime > 0) { + --this.furnaceBurnTime; + } + + if(!this.worldObj.multiplayerWorld) { + if(this.furnaceBurnTime == 0 && this.canSmelt()) { + this.currentItemBurnTime = this.furnaceBurnTime = this.getItemBurnTime(this.furnaceItemStacks[1]); + if(this.furnaceBurnTime > 0) { + var2 = true; + if(this.furnaceItemStacks[1] != null) { + --this.furnaceItemStacks[1].stackSize; + if(this.furnaceItemStacks[1].stackSize == 0) { + this.furnaceItemStacks[1] = null; + } + } + } + } + + if(this.isBurning() && this.canSmelt()) { + ++this.furnaceCookTime; + if(this.furnaceCookTime == 200) { + this.furnaceCookTime = 0; + this.smeltItem(); + var2 = true; + } + } else { + this.furnaceCookTime = 0; + } + + if(var1 != this.furnaceBurnTime > 0) { + var2 = true; + BlockFurnace.updateFurnaceBlockState(this.furnaceBurnTime > 0, this.worldObj, this.xCoord, this.yCoord, this.zCoord); + } + } + + if(var2) { + this.onInventoryChanged(); + } + + } + + private boolean canSmelt() { + if(this.furnaceItemStacks[0] == null) { + return false; + } else { + ItemStack var1 = FurnaceRecipes.smelting().getSmeltingResult(this.furnaceItemStacks[0].getItem().shiftedIndex); + return var1 == null ? false : (this.furnaceItemStacks[2] == null ? true : (!this.furnaceItemStacks[2].isItemEqual(var1) ? false : (this.furnaceItemStacks[2].stackSize < this.getInventoryStackLimit() && this.furnaceItemStacks[2].stackSize < this.furnaceItemStacks[2].getMaxStackSize() ? true : this.furnaceItemStacks[2].stackSize < var1.getMaxStackSize()))); + } + } + + public void smeltItem() { + if(this.canSmelt()) { + ItemStack var1 = FurnaceRecipes.smelting().getSmeltingResult(this.furnaceItemStacks[0].getItem().shiftedIndex); + if(this.furnaceItemStacks[2] == null) { + this.furnaceItemStacks[2] = var1.copy(); + } else if(this.furnaceItemStacks[2].itemID == var1.itemID) { + ++this.furnaceItemStacks[2].stackSize; + } + + --this.furnaceItemStacks[0].stackSize; + if(this.furnaceItemStacks[0].stackSize <= 0) { + this.furnaceItemStacks[0] = null; + } + + } + } + + private int getItemBurnTime(ItemStack var1) { + if(var1 == null) { + return 0; + } else { + int var2 = var1.getItem().shiftedIndex; + return var2 < 256 && Block.blocksList[var2].blockMaterial == Material.wood ? 300 : (var2 == Item.stick.shiftedIndex ? 100 : (var2 == Item.coal.shiftedIndex ? 1600 : (var2 == Item.bucketLava.shiftedIndex ? 20000 : (var2 == Block.sapling.blockID ? 100 : 0)))); + } + } + + public boolean canInteractWith(EntityPlayer var1) { + return this.worldObj.getBlockTileEntity(this.xCoord, this.yCoord, this.zCoord) != this ? false : var1.getDistanceSq((double)this.xCoord + 0.5D, (double)this.yCoord + 0.5D, (double)this.zCoord + 0.5D) <= 64.0D; + } +} diff --git a/src/net/minecraft/src/TileEntityMobSpawner.java b/src/net/minecraft/src/TileEntityMobSpawner.java new file mode 100644 index 0000000..89c2d97 --- /dev/null +++ b/src/net/minecraft/src/TileEntityMobSpawner.java @@ -0,0 +1,104 @@ +package net.minecraft.src; + +public class TileEntityMobSpawner extends TileEntity { + public int delay = -1; + private String mobID = "Pig"; + public double yaw; + public double yaw2 = 0.0D; + + public TileEntityMobSpawner() { + this.delay = 20; + } + + public String getMobID() { + return this.mobID; + } + + public void setMobID(String var1) { + this.mobID = var1; + } + + public boolean anyPlayerInRange() { + return this.worldObj.getClosestPlayer((double)this.xCoord + 0.5D, (double)this.yCoord + 0.5D, (double)this.zCoord + 0.5D, 16.0D) != null; + } + + public void updateEntity() { + this.yaw2 = this.yaw; + if(this.anyPlayerInRange()) { + double var1 = (double)((float)this.xCoord + this.worldObj.rand.nextFloat()); + double var3 = (double)((float)this.yCoord + this.worldObj.rand.nextFloat()); + double var5 = (double)((float)this.zCoord + this.worldObj.rand.nextFloat()); + this.worldObj.spawnParticle("smoke", var1, var3, var5, 0.0D, 0.0D, 0.0D); + this.worldObj.spawnParticle("flame", var1, var3, var5, 0.0D, 0.0D, 0.0D); + + for(this.yaw += (double)(1000.0F / ((float)this.delay + 200.0F)); this.yaw > 360.0D; this.yaw2 -= 360.0D) { + this.yaw -= 360.0D; + } + + if(!this.worldObj.multiplayerWorld) { + if(this.delay == -1) { + this.updateDelay(); + } + + if(this.delay > 0) { + --this.delay; + return; + } + + byte var7 = 4; + + for(int var8 = 0; var8 < var7; ++var8) { + EntityLiving var9 = (EntityLiving)((EntityLiving)EntityList.createEntityInWorld(this.mobID, this.worldObj)); + if(var9 == null) { + return; + } + + int var10 = this.worldObj.getEntitiesWithinAABB(var9.getClass(), AxisAlignedBB.getBoundingBoxFromPool((double)this.xCoord, (double)this.yCoord, (double)this.zCoord, (double)(this.xCoord + 1), (double)(this.yCoord + 1), (double)(this.zCoord + 1)).expand(8.0D, 4.0D, 8.0D)).size(); + if(var10 >= 6) { + this.updateDelay(); + return; + } + + if(var9 != null) { + double var11 = (double)this.xCoord + (this.worldObj.rand.nextDouble() - this.worldObj.rand.nextDouble()) * 4.0D; + double var13 = (double)(this.yCoord + this.worldObj.rand.nextInt(3) - 1); + double var15 = (double)this.zCoord + (this.worldObj.rand.nextDouble() - this.worldObj.rand.nextDouble()) * 4.0D; + var9.setLocationAndAngles(var11, var13, var15, this.worldObj.rand.nextFloat() * 360.0F, 0.0F); + if(var9.getCanSpawnHere()) { + this.worldObj.entityJoinedWorld(var9); + + for(int var17 = 0; var17 < 20; ++var17) { + var1 = (double)this.xCoord + 0.5D + ((double)this.worldObj.rand.nextFloat() - 0.5D) * 2.0D; + var3 = (double)this.yCoord + 0.5D + ((double)this.worldObj.rand.nextFloat() - 0.5D) * 2.0D; + var5 = (double)this.zCoord + 0.5D + ((double)this.worldObj.rand.nextFloat() - 0.5D) * 2.0D; + this.worldObj.spawnParticle("smoke", var1, var3, var5, 0.0D, 0.0D, 0.0D); + this.worldObj.spawnParticle("flame", var1, var3, var5, 0.0D, 0.0D, 0.0D); + } + + var9.spawnExplosionParticle(); + this.updateDelay(); + } + } + } + } + + super.updateEntity(); + } + } + + private void updateDelay() { + this.delay = 200 + this.worldObj.rand.nextInt(600); + } + + public void readFromNBT(NBTTagCompound var1) { + super.readFromNBT(var1); + this.mobID = var1.getString("EntityId"); + this.delay = var1.getShort("Delay"); + } + + public void writeToNBT(NBTTagCompound var1) { + super.writeToNBT(var1); + var1.setString("EntityId", this.mobID); + var1.setShort("Delay", (short)this.delay); + } +} diff --git a/src/net/minecraft/src/TileEntityMobSpawnerRenderer.java b/src/net/minecraft/src/TileEntityMobSpawnerRenderer.java new file mode 100644 index 0000000..a9bca8b --- /dev/null +++ b/src/net/minecraft/src/TileEntityMobSpawnerRenderer.java @@ -0,0 +1,37 @@ +package net.minecraft.src; + +import java.util.HashMap; +import java.util.Map; +import org.lwjgl.opengl.GL11; + +public class TileEntityMobSpawnerRenderer extends TileEntitySpecialRenderer { + private Map entityHashMap = new HashMap(); + + public void renderTileEntityMobSpawner(TileEntityMobSpawner var1, double var2, double var4, double var6, float var8) { + GL11.glPushMatrix(); + GL11.glTranslatef((float)var2 + 0.5F, (float)var4, (float)var6 + 0.5F); + Entity var9 = (Entity)this.entityHashMap.get(var1.getMobID()); + if(var9 == null) { + var9 = EntityList.createEntityInWorld(var1.getMobID(), (World)null); + this.entityHashMap.put(var1.getMobID(), var9); + } + + if(var9 != null) { + var9.setWorld(var1.worldObj); + float var10 = 7.0F / 16.0F; + GL11.glTranslatef(0.0F, 0.4F, 0.0F); + GL11.glRotatef((float)(var1.yaw2 + (var1.yaw - var1.yaw2) * (double)var8) * 10.0F, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(-30.0F, 1.0F, 0.0F, 0.0F); + GL11.glTranslatef(0.0F, -0.4F, 0.0F); + GL11.glScalef(var10, var10, var10); + var9.setLocationAndAngles(var2, var4, var6, 0.0F, 0.0F); + RenderManager.instance.renderEntityWithPosYaw(var9, 0.0D, 0.0D, 0.0D, 0.0F, var8); + } + + GL11.glPopMatrix(); + } + + public void renderTileEntityAt(TileEntity var1, double var2, double var4, double var6, float var8) { + this.renderTileEntityMobSpawner((TileEntityMobSpawner)var1, var2, var4, var6, var8); + } +} diff --git a/src/net/minecraft/src/TileEntityNote.java b/src/net/minecraft/src/TileEntityNote.java new file mode 100644 index 0000000..03a675e --- /dev/null +++ b/src/net/minecraft/src/TileEntityNote.java @@ -0,0 +1,53 @@ +package net.minecraft.src; + +public class TileEntityNote extends TileEntity { + public byte note = 0; + public boolean previousRedstoneState = false; + + public void writeToNBT(NBTTagCompound var1) { + super.writeToNBT(var1); + var1.setByte("note", this.note); + } + + public void readFromNBT(NBTTagCompound var1) { + super.readFromNBT(var1); + this.note = var1.getByte("note"); + if(this.note < 0) { + this.note = 0; + } + + if(this.note > 24) { + this.note = 24; + } + + } + + public void changePitch() { + this.note = (byte)((this.note + 1) % 25); + this.onInventoryChanged(); + } + + public void triggerNote(World var1, int var2, int var3, int var4) { + if(var1.getBlockMaterial(var2, var3 + 1, var4) == Material.air) { + Material var5 = var1.getBlockMaterial(var2, var3 - 1, var4); + byte var6 = 0; + if(var5 == Material.rock) { + var6 = 1; + } + + if(var5 == Material.sand) { + var6 = 2; + } + + if(var5 == Material.glass) { + var6 = 3; + } + + if(var5 == Material.wood) { + var6 = 4; + } + + var1.playNoteAt(var2, var3, var4, var6, this.note); + } + } +} diff --git a/src/net/minecraft/src/TileEntityPiston.java b/src/net/minecraft/src/TileEntityPiston.java new file mode 100644 index 0000000..7c13fa5 --- /dev/null +++ b/src/net/minecraft/src/TileEntityPiston.java @@ -0,0 +1,145 @@ +package net.minecraft.src; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +public class TileEntityPiston extends TileEntity { + private int storedBlockID; + private int storedMetadata; + private int field_31025_c; + private boolean field_31024_i; + private boolean field_31023_j; + private float field_31022_k; + private float field_31020_l; + private static List field_31018_m = new ArrayList(); + + public TileEntityPiston() { + } + + public TileEntityPiston(int var1, int var2, int var3, boolean var4, boolean var5) { + this.storedBlockID = var1; + this.storedMetadata = var2; + this.field_31025_c = var3; + this.field_31024_i = var4; + this.field_31023_j = var5; + } + + public int getStoredBlockID() { + return this.storedBlockID; + } + + public int getBlockMetadata() { + return this.storedMetadata; + } + + public boolean func_31015_b() { + return this.field_31024_i; + } + + public int func_31009_d() { + return this.field_31025_c; + } + + public boolean func_31012_k() { + return this.field_31023_j; + } + + public float func_31008_a(float var1) { + if(var1 > 1.0F) { + var1 = 1.0F; + } + + return this.field_31020_l + (this.field_31022_k - this.field_31020_l) * var1; + } + + public float func_31017_b(float var1) { + return this.field_31024_i ? (this.func_31008_a(var1) - 1.0F) * (float)PistonBlockTextures.field_31056_b[this.field_31025_c] : (1.0F - this.func_31008_a(var1)) * (float)PistonBlockTextures.field_31056_b[this.field_31025_c]; + } + + public float func_31014_c(float var1) { + return this.field_31024_i ? (this.func_31008_a(var1) - 1.0F) * (float)PistonBlockTextures.field_31059_c[this.field_31025_c] : (1.0F - this.func_31008_a(var1)) * (float)PistonBlockTextures.field_31059_c[this.field_31025_c]; + } + + public float func_31013_d(float var1) { + return this.field_31024_i ? (this.func_31008_a(var1) - 1.0F) * (float)PistonBlockTextures.field_31058_d[this.field_31025_c] : (1.0F - this.func_31008_a(var1)) * (float)PistonBlockTextures.field_31058_d[this.field_31025_c]; + } + + private void func_31010_a(float var1, float var2) { + if(!this.field_31024_i) { + --var1; + } else { + var1 = 1.0F - var1; + } + + AxisAlignedBB var3 = Block.pistonMoving.func_31035_a(this.worldObj, this.xCoord, this.yCoord, this.zCoord, this.storedBlockID, var1, this.field_31025_c); + if(var3 != null) { + List var4 = this.worldObj.getEntitiesWithinAABBExcludingEntity((Entity)null, var3); + if(!var4.isEmpty()) { + field_31018_m.addAll(var4); + Iterator var5 = field_31018_m.iterator(); + + while(var5.hasNext()) { + Entity var6 = (Entity)var5.next(); + var6.moveEntity((double)(var2 * (float)PistonBlockTextures.field_31056_b[this.field_31025_c]), (double)(var2 * (float)PistonBlockTextures.field_31059_c[this.field_31025_c]), (double)(var2 * (float)PistonBlockTextures.field_31058_d[this.field_31025_c])); + } + + field_31018_m.clear(); + } + } + + } + + public void func_31011_l() { + if(this.field_31020_l < 1.0F) { + this.field_31020_l = this.field_31022_k = 1.0F; + this.worldObj.removeBlockTileEntity(this.xCoord, this.yCoord, this.zCoord); + this.func_31005_i(); + if(this.worldObj.getBlockId(this.xCoord, this.yCoord, this.zCoord) == Block.pistonMoving.blockID) { + this.worldObj.setBlockAndMetadataWithNotify(this.xCoord, this.yCoord, this.zCoord, this.storedBlockID, this.storedMetadata); + } + } + + } + + public void updateEntity() { + this.field_31020_l = this.field_31022_k; + if(this.field_31020_l >= 1.0F) { + this.func_31010_a(1.0F, 0.25F); + this.worldObj.removeBlockTileEntity(this.xCoord, this.yCoord, this.zCoord); + this.func_31005_i(); + if(this.worldObj.getBlockId(this.xCoord, this.yCoord, this.zCoord) == Block.pistonMoving.blockID) { + this.worldObj.setBlockAndMetadataWithNotify(this.xCoord, this.yCoord, this.zCoord, this.storedBlockID, this.storedMetadata); + } + + } else { + this.field_31022_k += 0.5F; + if(this.field_31022_k >= 1.0F) { + this.field_31022_k = 1.0F; + } + + if(this.field_31024_i) { + this.func_31010_a(this.field_31022_k, this.field_31022_k - this.field_31020_l + 1.0F / 16.0F); + } + + } + } + + public void readFromNBT(NBTTagCompound var1) { + super.readFromNBT(var1); + this.storedBlockID = var1.getInteger("blockId"); + this.storedMetadata = var1.getInteger("blockData"); + this.field_31025_c = var1.getInteger("facing"); + this.field_31020_l = this.field_31022_k = var1.getFloat("progress"); + this.field_31024_i = var1.getBoolean("extending"); + } + + public void writeToNBT(NBTTagCompound var1) { + super.writeToNBT(var1); + var1.setInteger("blockId", this.storedBlockID); + var1.setInteger("blockData", this.storedMetadata); + var1.setInteger("facing", this.field_31025_c); + var1.setFloat("progress", this.field_31020_l); + var1.setBoolean("extending", this.field_31024_i); + } +} diff --git a/src/net/minecraft/src/TileEntityRecordPlayer.java b/src/net/minecraft/src/TileEntityRecordPlayer.java new file mode 100644 index 0000000..6c834e1 --- /dev/null +++ b/src/net/minecraft/src/TileEntityRecordPlayer.java @@ -0,0 +1,18 @@ +package net.minecraft.src; + +public class TileEntityRecordPlayer extends TileEntity { + public int record; + + public void readFromNBT(NBTTagCompound var1) { + super.readFromNBT(var1); + this.record = var1.getInteger("Record"); + } + + public void writeToNBT(NBTTagCompound var1) { + super.writeToNBT(var1); + if(this.record > 0) { + var1.setInteger("Record", this.record); + } + + } +} diff --git a/src/net/minecraft/src/TileEntityRenderer.java b/src/net/minecraft/src/TileEntityRenderer.java new file mode 100644 index 0000000..03d50a4 --- /dev/null +++ b/src/net/minecraft/src/TileEntityRenderer.java @@ -0,0 +1,103 @@ +package net.minecraft.src; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import org.lwjgl.opengl.GL11; + +public class TileEntityRenderer { + private Map specialRendererMap = new HashMap(); + public static TileEntityRenderer instance = new TileEntityRenderer(); + private FontRenderer fontRenderer; + public static double staticPlayerX; + public static double staticPlayerY; + public static double staticPlayerZ; + public RenderEngine renderEngine; + public World worldObj; + public EntityLiving entityLivingPlayer; + public float playerYaw; + public float playerPitch; + public double playerX; + public double playerY; + public double playerZ; + + private TileEntityRenderer() { + this.specialRendererMap.put(TileEntitySign.class, new TileEntitySignRenderer()); + this.specialRendererMap.put(TileEntityMobSpawner.class, new TileEntityMobSpawnerRenderer()); + this.specialRendererMap.put(TileEntityPiston.class, new TileEntityRendererPiston()); + Iterator var1 = this.specialRendererMap.values().iterator(); + + while(var1.hasNext()) { + TileEntitySpecialRenderer var2 = (TileEntitySpecialRenderer)var1.next(); + var2.setTileEntityRenderer(this); + } + + } + + public TileEntitySpecialRenderer getSpecialRendererForClass(Class var1) { + TileEntitySpecialRenderer var2 = (TileEntitySpecialRenderer)this.specialRendererMap.get(var1); + if(var2 == null && var1 != TileEntity.class) { + var2 = this.getSpecialRendererForClass(var1.getSuperclass()); + this.specialRendererMap.put(var1, var2); + } + + return var2; + } + + public boolean hasSpecialRenderer(TileEntity var1) { + return this.getSpecialRendererForEntity(var1) != null; + } + + public TileEntitySpecialRenderer getSpecialRendererForEntity(TileEntity var1) { + return var1 == null ? null : this.getSpecialRendererForClass(var1.getClass()); + } + + public void cacheActiveRenderInfo(World var1, RenderEngine var2, FontRenderer var3, EntityLiving var4, float var5) { + if(this.worldObj != var1) { + this.func_31072_a(var1); + } + + this.renderEngine = var2; + this.entityLivingPlayer = var4; + this.fontRenderer = var3; + this.playerYaw = var4.prevRotationYaw + (var4.rotationYaw - var4.prevRotationYaw) * var5; + this.playerPitch = var4.prevRotationPitch + (var4.rotationPitch - var4.prevRotationPitch) * var5; + this.playerX = var4.lastTickPosX + (var4.posX - var4.lastTickPosX) * (double)var5; + this.playerY = var4.lastTickPosY + (var4.posY - var4.lastTickPosY) * (double)var5; + this.playerZ = var4.lastTickPosZ + (var4.posZ - var4.lastTickPosZ) * (double)var5; + } + + public void renderTileEntity(TileEntity var1, float var2) { + if(var1.getDistanceFrom(this.playerX, this.playerY, this.playerZ) < 4096.0D) { + float var3 = this.worldObj.getLightBrightness(var1.xCoord, var1.yCoord, var1.zCoord); + GL11.glColor3f(var3, var3, var3); + this.renderTileEntityAt(var1, (double)var1.xCoord - staticPlayerX, (double)var1.yCoord - staticPlayerY, (double)var1.zCoord - staticPlayerZ, var2); + } + + } + + public void renderTileEntityAt(TileEntity var1, double var2, double var4, double var6, float var8) { + TileEntitySpecialRenderer var9 = this.getSpecialRendererForEntity(var1); + if(var9 != null) { + var9.renderTileEntityAt(var1, var2, var4, var6, var8); + } + + } + + public void func_31072_a(World var1) { + this.worldObj = var1; + Iterator var2 = this.specialRendererMap.values().iterator(); + + while(var2.hasNext()) { + TileEntitySpecialRenderer var3 = (TileEntitySpecialRenderer)var2.next(); + if(var3 != null) { + var3.func_31069_a(var1); + } + } + + } + + public FontRenderer getFontRenderer() { + return this.fontRenderer; + } +} diff --git a/src/net/minecraft/src/TileEntityRendererPiston.java b/src/net/minecraft/src/TileEntityRendererPiston.java new file mode 100644 index 0000000..316b383 --- /dev/null +++ b/src/net/minecraft/src/TileEntityRendererPiston.java @@ -0,0 +1,53 @@ +package net.minecraft.src; + +import net.minecraft.client.Minecraft; +import org.lwjgl.opengl.GL11; + +public class TileEntityRendererPiston extends TileEntitySpecialRenderer { + private RenderBlocks field_31071_b; + + public void func_31070_a(TileEntityPiston var1, double var2, double var4, double var6, float var8) { + Block var9 = Block.blocksList[var1.getStoredBlockID()]; + if(var9 != null && var1.func_31008_a(var8) < 1.0F) { + Tessellator var10 = Tessellator.instance; + this.bindTextureByName("/terrain.png"); + RenderHelper.disableStandardItemLighting(); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + GL11.glEnable(GL11.GL_BLEND); + GL11.glDisable(GL11.GL_CULL_FACE); + if(Minecraft.isAmbientOcclusionEnabled()) { + GL11.glShadeModel(GL11.GL_SMOOTH); + } else { + GL11.glShadeModel(GL11.GL_FLAT); + } + + var10.startDrawingQuads(); + var10.setTranslationD((double)((float)var2 - (float)var1.xCoord + var1.func_31017_b(var8)), (double)((float)var4 - (float)var1.yCoord + var1.func_31014_c(var8)), (double)((float)var6 - (float)var1.zCoord + var1.func_31013_d(var8))); + var10.setColorOpaque(1, 1, 1); + if(var9 == Block.pistonExtension && var1.func_31008_a(var8) < 0.5F) { + this.field_31071_b.func_31079_a(var9, var1.xCoord, var1.yCoord, var1.zCoord, false); + } else if(var1.func_31012_k() && !var1.func_31015_b()) { + Block.pistonExtension.func_31052_a_(((BlockPistonBase)var9).func_31040_i()); + this.field_31071_b.func_31079_a(Block.pistonExtension, var1.xCoord, var1.yCoord, var1.zCoord, var1.func_31008_a(var8) < 0.5F); + Block.pistonExtension.func_31051_a(); + var10.setTranslationD((double)((float)var2 - (float)var1.xCoord), (double)((float)var4 - (float)var1.yCoord), (double)((float)var6 - (float)var1.zCoord)); + this.field_31071_b.func_31078_d(var9, var1.xCoord, var1.yCoord, var1.zCoord); + } else { + this.field_31071_b.func_31075_a(var9, var1.xCoord, var1.yCoord, var1.zCoord); + } + + var10.setTranslationD(0.0D, 0.0D, 0.0D); + var10.draw(); + RenderHelper.enableStandardItemLighting(); + } + + } + + public void func_31069_a(World var1) { + this.field_31071_b = new RenderBlocks(var1); + } + + public void renderTileEntityAt(TileEntity var1, double var2, double var4, double var6, float var8) { + this.func_31070_a((TileEntityPiston)var1, var2, var4, var6, var8); + } +} diff --git a/src/net/minecraft/src/TileEntitySign.java b/src/net/minecraft/src/TileEntitySign.java new file mode 100644 index 0000000..52c7a55 --- /dev/null +++ b/src/net/minecraft/src/TileEntitySign.java @@ -0,0 +1,28 @@ +package net.minecraft.src; + +public class TileEntitySign extends TileEntity { + public String[] signText = new String[]{"", "", "", ""}; + public int lineBeingEdited = -1; + private boolean field_25062_c = true; + + public void writeToNBT(NBTTagCompound var1) { + super.writeToNBT(var1); + var1.setString("Text1", this.signText[0]); + var1.setString("Text2", this.signText[1]); + var1.setString("Text3", this.signText[2]); + var1.setString("Text4", this.signText[3]); + } + + public void readFromNBT(NBTTagCompound var1) { + this.field_25062_c = false; + super.readFromNBT(var1); + + for(int var2 = 0; var2 < 4; ++var2) { + this.signText[var2] = var1.getString("Text" + (var2 + 1)); + if(this.signText[var2].length() > 15) { + this.signText[var2] = this.signText[var2].substring(0, 15); + } + } + + } +} diff --git a/src/net/minecraft/src/TileEntitySignRenderer.java b/src/net/minecraft/src/TileEntitySignRenderer.java new file mode 100644 index 0000000..c7b2a9d --- /dev/null +++ b/src/net/minecraft/src/TileEntitySignRenderer.java @@ -0,0 +1,70 @@ +package net.minecraft.src; + +import org.lwjgl.opengl.GL11; + +public class TileEntitySignRenderer extends TileEntitySpecialRenderer { + private SignModel signModel = new SignModel(); + + public void renderTileEntitySignAt(TileEntitySign var1, double var2, double var4, double var6, float var8) { + Block var9 = var1.getBlockType(); + GL11.glPushMatrix(); + float var10 = 2.0F / 3.0F; + float var12; + if(var9 == Block.signPost) { + GL11.glTranslatef((float)var2 + 0.5F, (float)var4 + 12.0F / 16.0F * var10, (float)var6 + 0.5F); + float var11 = (float)(var1.getBlockMetadata() * 360) / 16.0F; + GL11.glRotatef(-var11, 0.0F, 1.0F, 0.0F); + this.signModel.signStick.showModel = true; + } else { + int var16 = var1.getBlockMetadata(); + var12 = 0.0F; + if(var16 == 2) { + var12 = 180.0F; + } + + if(var16 == 4) { + var12 = 90.0F; + } + + if(var16 == 5) { + var12 = -90.0F; + } + + GL11.glTranslatef((float)var2 + 0.5F, (float)var4 + 12.0F / 16.0F * var10, (float)var6 + 0.5F); + GL11.glRotatef(-var12, 0.0F, 1.0F, 0.0F); + GL11.glTranslatef(0.0F, -(5.0F / 16.0F), -(7.0F / 16.0F)); + this.signModel.signStick.showModel = false; + } + + this.bindTextureByName("/item/sign.png"); + GL11.glPushMatrix(); + GL11.glScalef(var10, -var10, -var10); + this.signModel.func_887_a(); + GL11.glPopMatrix(); + FontRenderer var17 = this.getFontRenderer(); + var12 = (float)(1.0D / 60.0D) * var10; + GL11.glTranslatef(0.0F, 0.5F * var10, 0.07F * var10); + GL11.glScalef(var12, -var12, var12); + GL11.glNormal3f(0.0F, 0.0F, -1.0F * var12); + GL11.glDepthMask(false); + byte var13 = 0; + + for(int var14 = 0; var14 < var1.signText.length; ++var14) { + String var15 = var1.signText[var14]; + if(var14 == var1.lineBeingEdited) { + var15 = "> " + var15 + " <"; + var17.drawString(var15, -var17.getStringWidth(var15) / 2, var14 * 10 - var1.signText.length * 5, var13); + } else { + var17.drawString(var15, -var17.getStringWidth(var15) / 2, var14 * 10 - var1.signText.length * 5, var13); + } + } + + GL11.glDepthMask(true); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glPopMatrix(); + } + + public void renderTileEntityAt(TileEntity var1, double var2, double var4, double var6, float var8) { + this.renderTileEntitySignAt((TileEntitySign)var1, var2, var4, var6, var8); + } +} diff --git a/src/net/minecraft/src/TileEntitySpecialRenderer.java b/src/net/minecraft/src/TileEntitySpecialRenderer.java new file mode 100644 index 0000000..893041c --- /dev/null +++ b/src/net/minecraft/src/TileEntitySpecialRenderer.java @@ -0,0 +1,23 @@ +package net.minecraft.src; + +public abstract class TileEntitySpecialRenderer { + protected TileEntityRenderer tileEntityRenderer; + + public abstract void renderTileEntityAt(TileEntity var1, double var2, double var4, double var6, float var8); + + protected void bindTextureByName(String var1) { + RenderEngine var2 = this.tileEntityRenderer.renderEngine; + var2.bindTexture(var2.getTexture(var1)); + } + + public void setTileEntityRenderer(TileEntityRenderer var1) { + this.tileEntityRenderer = var1; + } + + public void func_31069_a(World var1) { + } + + public FontRenderer getFontRenderer() { + return this.tileEntityRenderer.getFontRenderer(); + } +} diff --git a/src/net/minecraft/src/Timer.java b/src/net/minecraft/src/Timer.java new file mode 100644 index 0000000..d4cdd57 --- /dev/null +++ b/src/net/minecraft/src/Timer.java @@ -0,0 +1,65 @@ +package net.minecraft.src; + +public class Timer { + public float ticksPerSecond; + private double lastHRTime; + public int elapsedTicks; + public float renderPartialTicks; + public float timerSpeed = 1.0F; + public float elapsedPartialTicks = 0.0F; + private long lastSyncSysClock; + private long lastSyncHRClock; + private long field_28132_i; + private double timeSyncAdjustment = 1.0D; + + public Timer(float var1) { + this.ticksPerSecond = var1; + this.lastSyncSysClock = System.currentTimeMillis(); + this.lastSyncHRClock = System.nanoTime() / 1000000L; + } + + public void updateTimer() { + long var1 = System.currentTimeMillis(); + long var3 = var1 - this.lastSyncSysClock; + long var5 = System.nanoTime() / 1000000L; + double var7 = (double)var5 / 1000.0D; + if(var3 > 1000L) { + this.lastHRTime = var7; + } else if(var3 < 0L) { + this.lastHRTime = var7; + } else { + this.field_28132_i += var3; + if(this.field_28132_i > 1000L) { + long var9 = var5 - this.lastSyncHRClock; + double var11 = (double)this.field_28132_i / (double)var9; + this.timeSyncAdjustment += (var11 - this.timeSyncAdjustment) * (double)0.2F; + this.lastSyncHRClock = var5; + this.field_28132_i = 0L; + } + + if(this.field_28132_i < 0L) { + this.lastSyncHRClock = var5; + } + } + + this.lastSyncSysClock = var1; + double var13 = (var7 - this.lastHRTime) * this.timeSyncAdjustment; + this.lastHRTime = var7; + if(var13 < 0.0D) { + var13 = 0.0D; + } + + if(var13 > 1.0D) { + var13 = 1.0D; + } + + this.elapsedPartialTicks = (float)((double)this.elapsedPartialTicks + var13 * (double)this.timerSpeed * (double)this.ticksPerSecond); + this.elapsedTicks = (int)this.elapsedPartialTicks; + this.elapsedPartialTicks -= (float)this.elapsedTicks; + if(this.elapsedTicks > 10) { + this.elapsedTicks = 10; + } + + this.renderPartialTicks = this.elapsedPartialTicks; + } +} diff --git a/src/net/minecraft/src/UnexpectedThrowable.java b/src/net/minecraft/src/UnexpectedThrowable.java new file mode 100644 index 0000000..cac90e7 --- /dev/null +++ b/src/net/minecraft/src/UnexpectedThrowable.java @@ -0,0 +1,11 @@ +package net.minecraft.src; + +public class UnexpectedThrowable { + public final String description; + public final Throwable exception; + + public UnexpectedThrowable(String var1, Throwable var2) { + this.description = var1; + this.exception = var2; + } +} diff --git a/src/net/minecraft/src/Vec3D.java b/src/net/minecraft/src/Vec3D.java new file mode 100644 index 0000000..f6d8fa5 --- /dev/null +++ b/src/net/minecraft/src/Vec3D.java @@ -0,0 +1,162 @@ +package net.minecraft.src; + +import java.util.ArrayList; +import java.util.List; + +public class Vec3D { + private static List vectorList = new ArrayList(); + private static int nextVector = 0; + public double xCoord; + public double yCoord; + public double zCoord; + + public static Vec3D createVectorHelper(double var0, double var2, double var4) { + return new Vec3D(var0, var2, var4); + } + + public static void func_28215_a() { + vectorList.clear(); + nextVector = 0; + } + + public static void initialize() { + nextVector = 0; + } + + public static Vec3D createVector(double var0, double var2, double var4) { + if(nextVector >= vectorList.size()) { + vectorList.add(createVectorHelper(0.0D, 0.0D, 0.0D)); + } + + return ((Vec3D)vectorList.get(nextVector++)).setComponents(var0, var2, var4); + } + + private Vec3D(double var1, double var3, double var5) { + if(var1 == -0.0D) { + var1 = 0.0D; + } + + if(var3 == -0.0D) { + var3 = 0.0D; + } + + if(var5 == -0.0D) { + var5 = 0.0D; + } + + this.xCoord = var1; + this.yCoord = var3; + this.zCoord = var5; + } + + private Vec3D setComponents(double var1, double var3, double var5) { + this.xCoord = var1; + this.yCoord = var3; + this.zCoord = var5; + return this; + } + + public Vec3D subtract(Vec3D var1) { + return createVector(var1.xCoord - this.xCoord, var1.yCoord - this.yCoord, var1.zCoord - this.zCoord); + } + + public Vec3D normalize() { + double var1 = (double)MathHelper.sqrt_double(this.xCoord * this.xCoord + this.yCoord * this.yCoord + this.zCoord * this.zCoord); + return var1 < 1.0E-4D ? createVector(0.0D, 0.0D, 0.0D) : createVector(this.xCoord / var1, this.yCoord / var1, this.zCoord / var1); + } + + public Vec3D crossProduct(Vec3D var1) { + return createVector(this.yCoord * var1.zCoord - this.zCoord * var1.yCoord, this.zCoord * var1.xCoord - this.xCoord * var1.zCoord, this.xCoord * var1.yCoord - this.yCoord * var1.xCoord); + } + + public Vec3D addVector(double var1, double var3, double var5) { + return createVector(this.xCoord + var1, this.yCoord + var3, this.zCoord + var5); + } + + public double distanceTo(Vec3D var1) { + double var2 = var1.xCoord - this.xCoord; + double var4 = var1.yCoord - this.yCoord; + double var6 = var1.zCoord - this.zCoord; + return (double)MathHelper.sqrt_double(var2 * var2 + var4 * var4 + var6 * var6); + } + + public double squareDistanceTo(Vec3D var1) { + double var2 = var1.xCoord - this.xCoord; + double var4 = var1.yCoord - this.yCoord; + double var6 = var1.zCoord - this.zCoord; + return var2 * var2 + var4 * var4 + var6 * var6; + } + + public double squareDistanceTo(double var1, double var3, double var5) { + double var7 = var1 - this.xCoord; + double var9 = var3 - this.yCoord; + double var11 = var5 - this.zCoord; + return var7 * var7 + var9 * var9 + var11 * var11; + } + + public double lengthVector() { + return (double)MathHelper.sqrt_double(this.xCoord * this.xCoord + this.yCoord * this.yCoord + this.zCoord * this.zCoord); + } + + public Vec3D getIntermediateWithXValue(Vec3D var1, double var2) { + double var4 = var1.xCoord - this.xCoord; + double var6 = var1.yCoord - this.yCoord; + double var8 = var1.zCoord - this.zCoord; + if(var4 * var4 < (double)1.0E-7F) { + return null; + } else { + double var10 = (var2 - this.xCoord) / var4; + return var10 >= 0.0D && var10 <= 1.0D ? createVector(this.xCoord + var4 * var10, this.yCoord + var6 * var10, this.zCoord + var8 * var10) : null; + } + } + + public Vec3D getIntermediateWithYValue(Vec3D var1, double var2) { + double var4 = var1.xCoord - this.xCoord; + double var6 = var1.yCoord - this.yCoord; + double var8 = var1.zCoord - this.zCoord; + if(var6 * var6 < (double)1.0E-7F) { + return null; + } else { + double var10 = (var2 - this.yCoord) / var6; + return var10 >= 0.0D && var10 <= 1.0D ? createVector(this.xCoord + var4 * var10, this.yCoord + var6 * var10, this.zCoord + var8 * var10) : null; + } + } + + public Vec3D getIntermediateWithZValue(Vec3D var1, double var2) { + double var4 = var1.xCoord - this.xCoord; + double var6 = var1.yCoord - this.yCoord; + double var8 = var1.zCoord - this.zCoord; + if(var8 * var8 < (double)1.0E-7F) { + return null; + } else { + double var10 = (var2 - this.zCoord) / var8; + return var10 >= 0.0D && var10 <= 1.0D ? createVector(this.xCoord + var4 * var10, this.yCoord + var6 * var10, this.zCoord + var8 * var10) : null; + } + } + + public String toString() { + return "(" + this.xCoord + ", " + this.yCoord + ", " + this.zCoord + ")"; + } + + public void rotateAroundX(float var1) { + float var2 = MathHelper.cos(var1); + float var3 = MathHelper.sin(var1); + double var4 = this.xCoord; + double var6 = this.yCoord * (double)var2 + this.zCoord * (double)var3; + double var8 = this.zCoord * (double)var2 - this.yCoord * (double)var3; + this.xCoord = var4; + this.yCoord = var6; + this.zCoord = var8; + } + + public void rotateAroundY(float var1) { + float var2 = MathHelper.cos(var1); + float var3 = MathHelper.sin(var1); + double var4 = this.xCoord * (double)var2 + this.zCoord * (double)var3; + double var6 = this.yCoord; + double var8 = this.zCoord * (double)var2 - this.xCoord * (double)var3; + this.xCoord = var4; + this.yCoord = var6; + this.zCoord = var8; + } +} diff --git a/src/net/minecraft/src/WatchableObject.java b/src/net/minecraft/src/WatchableObject.java new file mode 100644 index 0000000..366e463 --- /dev/null +++ b/src/net/minecraft/src/WatchableObject.java @@ -0,0 +1,35 @@ +package net.minecraft.src; + +public class WatchableObject { + private final int objectType; + private final int dataValueId; + private Object watchedObject; + private boolean isWatching; + + public WatchableObject(int var1, int var2, Object var3) { + this.dataValueId = var2; + this.watchedObject = var3; + this.objectType = var1; + this.isWatching = true; + } + + public int getDataValueId() { + return this.dataValueId; + } + + public void setObject(Object var1) { + this.watchedObject = var1; + } + + public Object getObject() { + return this.watchedObject; + } + + public int getObjectType() { + return this.objectType; + } + + public void setWatching(boolean var1) { + this.isWatching = var1; + } +} diff --git a/src/net/minecraft/src/World.java b/src/net/minecraft/src/World.java new file mode 100644 index 0000000..5354ef5 --- /dev/null +++ b/src/net/minecraft/src/World.java @@ -0,0 +1,2453 @@ +package net.minecraft.src; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Random; +import java.util.Set; +import java.util.TreeSet; + +public class World implements IBlockAccess { + public boolean scheduledUpdatesAreImmediate; + private List lightingToUpdate; + public List loadedEntityList; + private List unloadedEntityList; + private TreeSet scheduledTickTreeSet; + private Set scheduledTickSet; + public List loadedTileEntityList; + private List field_30900_E; + public List playerEntities; + public List weatherEffects; + private long field_1019_F; + public int skylightSubtracted; + protected int field_9437_g; + protected final int field_9436_h; + protected float prevRainingStrength; + protected float rainingStrength; + protected float prevThunderingStrength; + protected float thunderingStrength; + protected int field_27168_F; + public int field_27172_i; + public boolean editingBlocks; + private long lockTimestamp; + protected int autosavePeriod; + public int difficultySetting; + public Random rand; + public boolean isNewWorld; + public final WorldProvider worldProvider; + protected List worldAccesses; + protected IChunkProvider chunkProvider; + protected final ISaveHandler saveHandler; + protected WorldInfo worldInfo; + public boolean findingSpawnPoint; + private boolean allPlayersSleeping; + public MapStorage field_28108_z; + private ArrayList collidingBoundingBoxes; + private boolean field_31055_L; + private int lightingUpdatesCounter; + private boolean spawnHostileMobs; + private boolean spawnPeacefulMobs; + static int lightingUpdatesScheduled = 0; + private Set positionsToUpdate; + private int soundCounter; + private List field_1012_M; + public boolean multiplayerWorld; + + public WorldChunkManager getWorldChunkManager() { + return this.worldProvider.worldChunkMgr; + } + + public World(ISaveHandler var1, String var2, WorldProvider var3, long var4) { + this.scheduledUpdatesAreImmediate = false; + this.lightingToUpdate = new ArrayList(); + this.loadedEntityList = new ArrayList(); + this.unloadedEntityList = new ArrayList(); + this.scheduledTickTreeSet = new TreeSet(); + this.scheduledTickSet = new HashSet(); + this.loadedTileEntityList = new ArrayList(); + this.field_30900_E = new ArrayList(); + this.playerEntities = new ArrayList(); + this.weatherEffects = new ArrayList(); + this.field_1019_F = 16777215L; + this.skylightSubtracted = 0; + this.field_9437_g = (new Random()).nextInt(); + this.field_9436_h = 1013904223; + this.field_27168_F = 0; + this.field_27172_i = 0; + this.editingBlocks = false; + this.lockTimestamp = System.currentTimeMillis(); + this.autosavePeriod = 40; + this.rand = new Random(); + this.isNewWorld = false; + this.worldAccesses = new ArrayList(); + this.collidingBoundingBoxes = new ArrayList(); + this.lightingUpdatesCounter = 0; + this.spawnHostileMobs = true; + this.spawnPeacefulMobs = true; + this.positionsToUpdate = new HashSet(); + this.soundCounter = this.rand.nextInt(12000); + this.field_1012_M = new ArrayList(); + this.multiplayerWorld = false; + this.saveHandler = var1; + this.worldInfo = new WorldInfo(var4, var2); + this.worldProvider = var3; + this.field_28108_z = new MapStorage(var1); + var3.registerWorld(this); + this.chunkProvider = this.getChunkProvider(); + this.calculateInitialSkylight(); + this.func_27163_E(); + } + + public World(World var1, WorldProvider var2) { + this.scheduledUpdatesAreImmediate = false; + this.lightingToUpdate = new ArrayList(); + this.loadedEntityList = new ArrayList(); + this.unloadedEntityList = new ArrayList(); + this.scheduledTickTreeSet = new TreeSet(); + this.scheduledTickSet = new HashSet(); + this.loadedTileEntityList = new ArrayList(); + this.field_30900_E = new ArrayList(); + this.playerEntities = new ArrayList(); + this.weatherEffects = new ArrayList(); + this.field_1019_F = 16777215L; + this.skylightSubtracted = 0; + this.field_9437_g = (new Random()).nextInt(); + this.field_9436_h = 1013904223; + this.field_27168_F = 0; + this.field_27172_i = 0; + this.editingBlocks = false; + this.lockTimestamp = System.currentTimeMillis(); + this.autosavePeriod = 40; + this.rand = new Random(); + this.isNewWorld = false; + this.worldAccesses = new ArrayList(); + this.collidingBoundingBoxes = new ArrayList(); + this.lightingUpdatesCounter = 0; + this.spawnHostileMobs = true; + this.spawnPeacefulMobs = true; + this.positionsToUpdate = new HashSet(); + this.soundCounter = this.rand.nextInt(12000); + this.field_1012_M = new ArrayList(); + this.multiplayerWorld = false; + this.lockTimestamp = var1.lockTimestamp; + this.saveHandler = var1.saveHandler; + this.worldInfo = new WorldInfo(var1.worldInfo); + this.field_28108_z = new MapStorage(this.saveHandler); + this.worldProvider = var2; + var2.registerWorld(this); + this.chunkProvider = this.getChunkProvider(); + this.calculateInitialSkylight(); + this.func_27163_E(); + } + + public World(ISaveHandler var1, String var2, long var3) { + this(var1, var2, var3, (WorldProvider)null); + } + + public World(ISaveHandler var1, String var2, long var3, WorldProvider var5) { + this.scheduledUpdatesAreImmediate = false; + this.lightingToUpdate = new ArrayList(); + this.loadedEntityList = new ArrayList(); + this.unloadedEntityList = new ArrayList(); + this.scheduledTickTreeSet = new TreeSet(); + this.scheduledTickSet = new HashSet(); + this.loadedTileEntityList = new ArrayList(); + this.field_30900_E = new ArrayList(); + this.playerEntities = new ArrayList(); + this.weatherEffects = new ArrayList(); + this.field_1019_F = 16777215L; + this.skylightSubtracted = 0; + this.field_9437_g = (new Random()).nextInt(); + this.field_9436_h = 1013904223; + this.field_27168_F = 0; + this.field_27172_i = 0; + this.editingBlocks = false; + this.lockTimestamp = System.currentTimeMillis(); + this.autosavePeriod = 40; + this.rand = new Random(); + this.isNewWorld = false; + this.worldAccesses = new ArrayList(); + this.collidingBoundingBoxes = new ArrayList(); + this.lightingUpdatesCounter = 0; + this.spawnHostileMobs = true; + this.spawnPeacefulMobs = true; + this.positionsToUpdate = new HashSet(); + this.soundCounter = this.rand.nextInt(12000); + this.field_1012_M = new ArrayList(); + this.multiplayerWorld = false; + this.saveHandler = var1; + this.field_28108_z = new MapStorage(var1); + this.worldInfo = var1.loadWorldInfo(); + this.isNewWorld = this.worldInfo == null; + if(var5 != null) { + this.worldProvider = var5; + } else if(this.worldInfo != null && this.worldInfo.getDimension() == -1) { + this.worldProvider = WorldProvider.getProviderForDimension(-1); + } else { + this.worldProvider = WorldProvider.getProviderForDimension(0); + } + + boolean var6 = false; + if(this.worldInfo == null) { + this.worldInfo = new WorldInfo(var3, var2); + var6 = true; + } else { + this.worldInfo.setWorldName(var2); + } + + this.worldProvider.registerWorld(this); + this.chunkProvider = this.getChunkProvider(); + if(var6) { + this.getInitialSpawnLocation(); + } + + this.calculateInitialSkylight(); + this.func_27163_E(); + } + + protected IChunkProvider getChunkProvider() { + IChunkLoader var1 = this.saveHandler.getChunkLoader(this.worldProvider); + return new ChunkProvider(this, var1, this.worldProvider.getChunkProvider()); + } + + protected void getInitialSpawnLocation() { + this.findingSpawnPoint = true; + int var1 = 0; + byte var2 = 64; + + int var3; + for(var3 = 0; !this.worldProvider.canCoordinateBeSpawn(var1, var3); var3 += this.rand.nextInt(64) - this.rand.nextInt(64)) { + var1 += this.rand.nextInt(64) - this.rand.nextInt(64); + } + + this.worldInfo.setSpawn(var1, var2, var3); + this.findingSpawnPoint = false; + } + + public void setSpawnLocation() { + if(this.worldInfo.getSpawnY() <= 0) { + this.worldInfo.setSpawnY(64); + } + + int var1 = this.worldInfo.getSpawnX(); + + int var2; + for(var2 = this.worldInfo.getSpawnZ(); this.getFirstUncoveredBlock(var1, var2) == 0; var2 += this.rand.nextInt(8) - this.rand.nextInt(8)) { + var1 += this.rand.nextInt(8) - this.rand.nextInt(8); + } + + this.worldInfo.setSpawnX(var1); + this.worldInfo.setSpawnZ(var2); + } + + public int getFirstUncoveredBlock(int var1, int var2) { + int var3; + for(var3 = 63; !this.isAirBlock(var1, var3 + 1, var2); ++var3) { + } + + return this.getBlockId(var1, var3, var2); + } + + public void emptyMethod1() { + } + + public void spawnPlayerWithLoadedChunks(EntityPlayer var1) { + try { + NBTTagCompound var2 = this.worldInfo.getPlayerNBTTagCompound(); + if(var2 != null) { + var1.readFromNBT(var2); + this.worldInfo.setPlayerNBTTagCompound((NBTTagCompound)null); + } + + if(this.chunkProvider instanceof ChunkProviderLoadOrGenerate) { + ChunkProviderLoadOrGenerate var3 = (ChunkProviderLoadOrGenerate)this.chunkProvider; + int var4 = MathHelper.floor_float((float)((int)var1.posX)) >> 4; + int var5 = MathHelper.floor_float((float)((int)var1.posZ)) >> 4; + var3.setCurrentChunkOver(var4, var5); + } + + this.entityJoinedWorld(var1); + } catch (Exception var6) { + var6.printStackTrace(); + } + + } + + public void saveWorld(boolean var1, IProgressUpdate var2) { + if(this.chunkProvider.canSave()) { + if(var2 != null) { + var2.func_594_b("Saving level"); + } + + this.saveLevel(); + if(var2 != null) { + var2.displayLoadingString("Saving chunks"); + } + + this.chunkProvider.saveChunks(var1, var2); + } + } + + private void saveLevel() { + this.checkSessionLock(); + this.saveHandler.saveWorldInfoAndPlayer(this.worldInfo, this.playerEntities); + this.field_28108_z.saveAllData(); + } + + public boolean func_650_a(int var1) { + if(!this.chunkProvider.canSave()) { + return true; + } else { + if(var1 == 0) { + this.saveLevel(); + } + + return this.chunkProvider.saveChunks(false, (IProgressUpdate)null); + } + } + + public int getBlockId(int var1, int var2, int var3) { + return var1 >= -32000000 && var3 >= -32000000 && var1 < 32000000 && var3 <= 32000000 ? (var2 < 0 ? 0 : (var2 >= 128 ? 0 : this.getChunkFromChunkCoords(var1 >> 4, var3 >> 4).getBlockID(var1 & 15, var2, var3 & 15))) : 0; + } + + public boolean isAirBlock(int var1, int var2, int var3) { + return this.getBlockId(var1, var2, var3) == 0; + } + + public boolean blockExists(int var1, int var2, int var3) { + return var2 >= 0 && var2 < 128 ? this.chunkExists(var1 >> 4, var3 >> 4) : false; + } + + public boolean doChunksNearChunkExist(int var1, int var2, int var3, int var4) { + return this.checkChunksExist(var1 - var4, var2 - var4, var3 - var4, var1 + var4, var2 + var4, var3 + var4); + } + + public boolean checkChunksExist(int var1, int var2, int var3, int var4, int var5, int var6) { + if(var5 >= 0 && var2 < 128) { + var1 >>= 4; + var2 >>= 4; + var3 >>= 4; + var4 >>= 4; + var5 >>= 4; + var6 >>= 4; + + for(int var7 = var1; var7 <= var4; ++var7) { + for(int var8 = var3; var8 <= var6; ++var8) { + if(!this.chunkExists(var7, var8)) { + return false; + } + } + } + + return true; + } else { + return false; + } + } + + private boolean chunkExists(int var1, int var2) { + return this.chunkProvider.chunkExists(var1, var2); + } + + public Chunk getChunkFromBlockCoords(int var1, int var2) { + return this.getChunkFromChunkCoords(var1 >> 4, var2 >> 4); + } + + public Chunk getChunkFromChunkCoords(int var1, int var2) { + return this.chunkProvider.provideChunk(var1, var2); + } + + public boolean setBlockAndMetadata(int var1, int var2, int var3, int var4, int var5) { + if(var1 >= -32000000 && var3 >= -32000000 && var1 < 32000000 && var3 <= 32000000) { + if(var2 < 0) { + return false; + } else if(var2 >= 128) { + return false; + } else { + Chunk var6 = this.getChunkFromChunkCoords(var1 >> 4, var3 >> 4); + return var6.setBlockIDWithMetadata(var1 & 15, var2, var3 & 15, var4, var5); + } + } else { + return false; + } + } + + public boolean setBlock(int var1, int var2, int var3, int var4) { + if(var1 >= -32000000 && var3 >= -32000000 && var1 < 32000000 && var3 <= 32000000) { + if(var2 < 0) { + return false; + } else if(var2 >= 128) { + return false; + } else { + Chunk var5 = this.getChunkFromChunkCoords(var1 >> 4, var3 >> 4); + return var5.setBlockID(var1 & 15, var2, var3 & 15, var4); + } + } else { + return false; + } + } + + public Material getBlockMaterial(int var1, int var2, int var3) { + int var4 = this.getBlockId(var1, var2, var3); + return var4 == 0 ? Material.air : Block.blocksList[var4].blockMaterial; + } + + public int getBlockMetadata(int var1, int var2, int var3) { + if(var1 >= -32000000 && var3 >= -32000000 && var1 < 32000000 && var3 <= 32000000) { + if(var2 < 0) { + return 0; + } else if(var2 >= 128) { + return 0; + } else { + Chunk var4 = this.getChunkFromChunkCoords(var1 >> 4, var3 >> 4); + var1 &= 15; + var3 &= 15; + return var4.getBlockMetadata(var1, var2, var3); + } + } else { + return 0; + } + } + + public void setBlockMetadataWithNotify(int var1, int var2, int var3, int var4) { + if(this.setBlockMetadata(var1, var2, var3, var4)) { + int var5 = this.getBlockId(var1, var2, var3); + if(Block.field_28032_t[var5 & 255]) { + this.notifyBlockChange(var1, var2, var3, var5); + } else { + this.notifyBlocksOfNeighborChange(var1, var2, var3, var5); + } + } + + } + + public boolean setBlockMetadata(int var1, int var2, int var3, int var4) { + if(var1 >= -32000000 && var3 >= -32000000 && var1 < 32000000 && var3 <= 32000000) { + if(var2 < 0) { + return false; + } else if(var2 >= 128) { + return false; + } else { + Chunk var5 = this.getChunkFromChunkCoords(var1 >> 4, var3 >> 4); + var1 &= 15; + var3 &= 15; + var5.setBlockMetadata(var1, var2, var3, var4); + return true; + } + } else { + return false; + } + } + + public boolean setBlockWithNotify(int var1, int var2, int var3, int var4) { + if(this.setBlock(var1, var2, var3, var4)) { + this.notifyBlockChange(var1, var2, var3, var4); + return true; + } else { + return false; + } + } + + public boolean setBlockAndMetadataWithNotify(int var1, int var2, int var3, int var4, int var5) { + if(this.setBlockAndMetadata(var1, var2, var3, var4, var5)) { + this.notifyBlockChange(var1, var2, var3, var4); + return true; + } else { + return false; + } + } + + public void markBlockNeedsUpdate(int var1, int var2, int var3) { + for(int var4 = 0; var4 < this.worldAccesses.size(); ++var4) { + ((IWorldAccess)this.worldAccesses.get(var4)).markBlockAndNeighborsNeedsUpdate(var1, var2, var3); + } + + } + + protected void notifyBlockChange(int var1, int var2, int var3, int var4) { + this.markBlockNeedsUpdate(var1, var2, var3); + this.notifyBlocksOfNeighborChange(var1, var2, var3, var4); + } + + public void markBlocksDirtyVertical(int var1, int var2, int var3, int var4) { + if(var3 > var4) { + int var5 = var4; + var4 = var3; + var3 = var5; + } + + this.markBlocksDirty(var1, var3, var2, var1, var4, var2); + } + + public void markBlockAsNeedsUpdate(int var1, int var2, int var3) { + for(int var4 = 0; var4 < this.worldAccesses.size(); ++var4) { + ((IWorldAccess)this.worldAccesses.get(var4)).markBlockRangeNeedsUpdate(var1, var2, var3, var1, var2, var3); + } + + } + + public void markBlocksDirty(int var1, int var2, int var3, int var4, int var5, int var6) { + for(int var7 = 0; var7 < this.worldAccesses.size(); ++var7) { + ((IWorldAccess)this.worldAccesses.get(var7)).markBlockRangeNeedsUpdate(var1, var2, var3, var4, var5, var6); + } + + } + + public void notifyBlocksOfNeighborChange(int var1, int var2, int var3, int var4) { + this.notifyBlockOfNeighborChange(var1 - 1, var2, var3, var4); + this.notifyBlockOfNeighborChange(var1 + 1, var2, var3, var4); + this.notifyBlockOfNeighborChange(var1, var2 - 1, var3, var4); + this.notifyBlockOfNeighborChange(var1, var2 + 1, var3, var4); + this.notifyBlockOfNeighborChange(var1, var2, var3 - 1, var4); + this.notifyBlockOfNeighborChange(var1, var2, var3 + 1, var4); + } + + private void notifyBlockOfNeighborChange(int var1, int var2, int var3, int var4) { + if(!this.editingBlocks && !this.multiplayerWorld) { + Block var5 = Block.blocksList[this.getBlockId(var1, var2, var3)]; + if(var5 != null) { + var5.onNeighborBlockChange(this, var1, var2, var3, var4); + } + + } + } + + public boolean canBlockSeeTheSky(int var1, int var2, int var3) { + return this.getChunkFromChunkCoords(var1 >> 4, var3 >> 4).canBlockSeeTheSky(var1 & 15, var2, var3 & 15); + } + + public int getFullBlockLightValue(int var1, int var2, int var3) { + if(var2 < 0) { + return 0; + } else { + if(var2 >= 128) { + var2 = 127; + } + + return this.getChunkFromChunkCoords(var1 >> 4, var3 >> 4).getBlockLightValue(var1 & 15, var2, var3 & 15, 0); + } + } + + public int getBlockLightValue(int var1, int var2, int var3) { + return this.getBlockLightValue_do(var1, var2, var3, true); + } + + public int getBlockLightValue_do(int var1, int var2, int var3, boolean var4) { + if(var1 >= -32000000 && var3 >= -32000000 && var1 < 32000000 && var3 <= 32000000) { + if(var4) { + int var5 = this.getBlockId(var1, var2, var3); + if(var5 == Block.stairSingle.blockID || var5 == Block.tilledField.blockID || var5 == Block.stairCompactCobblestone.blockID || var5 == Block.stairCompactPlanks.blockID) { + int var6 = this.getBlockLightValue_do(var1, var2 + 1, var3, false); + int var7 = this.getBlockLightValue_do(var1 + 1, var2, var3, false); + int var8 = this.getBlockLightValue_do(var1 - 1, var2, var3, false); + int var9 = this.getBlockLightValue_do(var1, var2, var3 + 1, false); + int var10 = this.getBlockLightValue_do(var1, var2, var3 - 1, false); + if(var7 > var6) { + var6 = var7; + } + + if(var8 > var6) { + var6 = var8; + } + + if(var9 > var6) { + var6 = var9; + } + + if(var10 > var6) { + var6 = var10; + } + + return var6; + } + } + + if(var2 < 0) { + return 0; + } else { + if(var2 >= 128) { + var2 = 127; + } + + Chunk var11 = this.getChunkFromChunkCoords(var1 >> 4, var3 >> 4); + var1 &= 15; + var3 &= 15; + return var11.getBlockLightValue(var1, var2, var3, this.skylightSubtracted); + } + } else { + return 15; + } + } + + public boolean canExistingBlockSeeTheSky(int var1, int var2, int var3) { + if(var1 >= -32000000 && var3 >= -32000000 && var1 < 32000000 && var3 <= 32000000) { + if(var2 < 0) { + return false; + } else if(var2 >= 128) { + return true; + } else if(!this.chunkExists(var1 >> 4, var3 >> 4)) { + return false; + } else { + Chunk var4 = this.getChunkFromChunkCoords(var1 >> 4, var3 >> 4); + var1 &= 15; + var3 &= 15; + return var4.canBlockSeeTheSky(var1, var2, var3); + } + } else { + return false; + } + } + + public int getHeightValue(int var1, int var2) { + if(var1 >= -32000000 && var2 >= -32000000 && var1 < 32000000 && var2 <= 32000000) { + if(!this.chunkExists(var1 >> 4, var2 >> 4)) { + return 0; + } else { + Chunk var3 = this.getChunkFromChunkCoords(var1 >> 4, var2 >> 4); + return var3.getHeightValue(var1 & 15, var2 & 15); + } + } else { + return 0; + } + } + + public void neighborLightPropagationChanged(EnumSkyBlock var1, int var2, int var3, int var4, int var5) { + if(!this.worldProvider.hasNoSky || var1 != EnumSkyBlock.Sky) { + if(this.blockExists(var2, var3, var4)) { + if(var1 == EnumSkyBlock.Sky) { + if(this.canExistingBlockSeeTheSky(var2, var3, var4)) { + var5 = 15; + } + } else if(var1 == EnumSkyBlock.Block) { + int var6 = this.getBlockId(var2, var3, var4); + if(Block.lightValue[var6] > var5) { + var5 = Block.lightValue[var6]; + } + } + + if(this.getSavedLightValue(var1, var2, var3, var4) != var5) { + this.scheduleLightingUpdate(var1, var2, var3, var4, var2, var3, var4); + } + + } + } + } + + public int getSavedLightValue(EnumSkyBlock var1, int var2, int var3, int var4) { + if(var3 < 0) { + var3 = 0; + } + + if(var3 >= 128) { + var3 = 127; + } + + if(var3 >= 0 && var3 < 128 && var2 >= -32000000 && var4 >= -32000000 && var2 < 32000000 && var4 <= 32000000) { + int var5 = var2 >> 4; + int var6 = var4 >> 4; + if(!this.chunkExists(var5, var6)) { + return 0; + } else { + Chunk var7 = this.getChunkFromChunkCoords(var5, var6); + return var7.getSavedLightValue(var1, var2 & 15, var3, var4 & 15); + } + } else { + return var1.field_1722_c; + } + } + + public void setLightValue(EnumSkyBlock var1, int var2, int var3, int var4, int var5) { + if(var2 >= -32000000 && var4 >= -32000000 && var2 < 32000000 && var4 <= 32000000) { + if(var3 >= 0) { + if(var3 < 128) { + if(this.chunkExists(var2 >> 4, var4 >> 4)) { + Chunk var6 = this.getChunkFromChunkCoords(var2 >> 4, var4 >> 4); + var6.setLightValue(var1, var2 & 15, var3, var4 & 15, var5); + + for(int var7 = 0; var7 < this.worldAccesses.size(); ++var7) { + ((IWorldAccess)this.worldAccesses.get(var7)).markBlockAndNeighborsNeedsUpdate(var2, var3, var4); + } + + } + } + } + } + } + + public float getBrightness(int var1, int var2, int var3, int var4) { + int var5 = this.getBlockLightValue(var1, var2, var3); + if(var5 < var4) { + var5 = var4; + } + + return this.worldProvider.lightBrightnessTable[var5]; + } + + public float getLightBrightness(int var1, int var2, int var3) { + return this.worldProvider.lightBrightnessTable[this.getBlockLightValue(var1, var2, var3)]; + } + + public boolean isDaytime() { + return this.skylightSubtracted < 4; + } + + public MovingObjectPosition rayTraceBlocks(Vec3D var1, Vec3D var2) { + return this.func_28105_a(var1, var2, false, false); + } + + public MovingObjectPosition rayTraceBlocks_do(Vec3D var1, Vec3D var2, boolean var3) { + return this.func_28105_a(var1, var2, var3, false); + } + + public MovingObjectPosition func_28105_a(Vec3D var1, Vec3D var2, boolean var3, boolean var4) { + if(!Double.isNaN(var1.xCoord) && !Double.isNaN(var1.yCoord) && !Double.isNaN(var1.zCoord)) { + if(!Double.isNaN(var2.xCoord) && !Double.isNaN(var2.yCoord) && !Double.isNaN(var2.zCoord)) { + int var5 = MathHelper.floor_double(var2.xCoord); + int var6 = MathHelper.floor_double(var2.yCoord); + int var7 = MathHelper.floor_double(var2.zCoord); + int var8 = MathHelper.floor_double(var1.xCoord); + int var9 = MathHelper.floor_double(var1.yCoord); + int var10 = MathHelper.floor_double(var1.zCoord); + int var11 = this.getBlockId(var8, var9, var10); + int var12 = this.getBlockMetadata(var8, var9, var10); + Block var13 = Block.blocksList[var11]; + if((!var4 || var13 == null || var13.getCollisionBoundingBoxFromPool(this, var8, var9, var10) != null) && var11 > 0 && var13.canCollideCheck(var12, var3)) { + MovingObjectPosition var14 = var13.collisionRayTrace(this, var8, var9, var10, var1, var2); + if(var14 != null) { + return var14; + } + } + + var11 = 200; + + while(var11-- >= 0) { + if(Double.isNaN(var1.xCoord) || Double.isNaN(var1.yCoord) || Double.isNaN(var1.zCoord)) { + return null; + } + + if(var8 == var5 && var9 == var6 && var10 == var7) { + return null; + } + + boolean var39 = true; + boolean var40 = true; + boolean var41 = true; + double var15 = 999.0D; + double var17 = 999.0D; + double var19 = 999.0D; + if(var5 > var8) { + var15 = (double)var8 + 1.0D; + } else if(var5 < var8) { + var15 = (double)var8 + 0.0D; + } else { + var39 = false; + } + + if(var6 > var9) { + var17 = (double)var9 + 1.0D; + } else if(var6 < var9) { + var17 = (double)var9 + 0.0D; + } else { + var40 = false; + } + + if(var7 > var10) { + var19 = (double)var10 + 1.0D; + } else if(var7 < var10) { + var19 = (double)var10 + 0.0D; + } else { + var41 = false; + } + + double var21 = 999.0D; + double var23 = 999.0D; + double var25 = 999.0D; + double var27 = var2.xCoord - var1.xCoord; + double var29 = var2.yCoord - var1.yCoord; + double var31 = var2.zCoord - var1.zCoord; + if(var39) { + var21 = (var15 - var1.xCoord) / var27; + } + + if(var40) { + var23 = (var17 - var1.yCoord) / var29; + } + + if(var41) { + var25 = (var19 - var1.zCoord) / var31; + } + + boolean var33 = false; + byte var42; + if(var21 < var23 && var21 < var25) { + if(var5 > var8) { + var42 = 4; + } else { + var42 = 5; + } + + var1.xCoord = var15; + var1.yCoord += var29 * var21; + var1.zCoord += var31 * var21; + } else if(var23 < var25) { + if(var6 > var9) { + var42 = 0; + } else { + var42 = 1; + } + + var1.xCoord += var27 * var23; + var1.yCoord = var17; + var1.zCoord += var31 * var23; + } else { + if(var7 > var10) { + var42 = 2; + } else { + var42 = 3; + } + + var1.xCoord += var27 * var25; + var1.yCoord += var29 * var25; + var1.zCoord = var19; + } + + Vec3D var34 = Vec3D.createVector(var1.xCoord, var1.yCoord, var1.zCoord); + var8 = (int)(var34.xCoord = (double)MathHelper.floor_double(var1.xCoord)); + if(var42 == 5) { + --var8; + ++var34.xCoord; + } + + var9 = (int)(var34.yCoord = (double)MathHelper.floor_double(var1.yCoord)); + if(var42 == 1) { + --var9; + ++var34.yCoord; + } + + var10 = (int)(var34.zCoord = (double)MathHelper.floor_double(var1.zCoord)); + if(var42 == 3) { + --var10; + ++var34.zCoord; + } + + int var35 = this.getBlockId(var8, var9, var10); + int var36 = this.getBlockMetadata(var8, var9, var10); + Block var37 = Block.blocksList[var35]; + if((!var4 || var37 == null || var37.getCollisionBoundingBoxFromPool(this, var8, var9, var10) != null) && var35 > 0 && var37.canCollideCheck(var36, var3)) { + MovingObjectPosition var38 = var37.collisionRayTrace(this, var8, var9, var10, var1, var2); + if(var38 != null) { + return var38; + } + } + } + + return null; + } else { + return null; + } + } else { + return null; + } + } + + public void playSoundAtEntity(Entity var1, String var2, float var3, float var4) { + for(int var5 = 0; var5 < this.worldAccesses.size(); ++var5) { + ((IWorldAccess)this.worldAccesses.get(var5)).playSound(var2, var1.posX, var1.posY - (double)var1.yOffset, var1.posZ, var3, var4); + } + + } + + public void playSoundEffect(double var1, double var3, double var5, String var7, float var8, float var9) { + for(int var10 = 0; var10 < this.worldAccesses.size(); ++var10) { + ((IWorldAccess)this.worldAccesses.get(var10)).playSound(var7, var1, var3, var5, var8, var9); + } + + } + + public void playRecord(String var1, int var2, int var3, int var4) { + for(int var5 = 0; var5 < this.worldAccesses.size(); ++var5) { + ((IWorldAccess)this.worldAccesses.get(var5)).playRecord(var1, var2, var3, var4); + } + + } + + public void spawnParticle(String var1, double var2, double var4, double var6, double var8, double var10, double var12) { + for(int var14 = 0; var14 < this.worldAccesses.size(); ++var14) { + ((IWorldAccess)this.worldAccesses.get(var14)).spawnParticle(var1, var2, var4, var6, var8, var10, var12); + } + + } + + public boolean addWeatherEffect(Entity var1) { + this.weatherEffects.add(var1); + return true; + } + + public boolean entityJoinedWorld(Entity var1) { + int var2 = MathHelper.floor_double(var1.posX / 16.0D); + int var3 = MathHelper.floor_double(var1.posZ / 16.0D); + boolean var4 = false; + if(var1 instanceof EntityPlayer) { + var4 = true; + } + + if(!var4 && !this.chunkExists(var2, var3)) { + return false; + } else { + if(var1 instanceof EntityPlayer) { + EntityPlayer var5 = (EntityPlayer)var1; + this.playerEntities.add(var5); + this.updateAllPlayersSleepingFlag(); + } + + this.getChunkFromChunkCoords(var2, var3).addEntity(var1); + this.loadedEntityList.add(var1); + this.obtainEntitySkin(var1); + return true; + } + } + + protected void obtainEntitySkin(Entity var1) { + for(int var2 = 0; var2 < this.worldAccesses.size(); ++var2) { + ((IWorldAccess)this.worldAccesses.get(var2)).obtainEntitySkin(var1); + } + + } + + protected void releaseEntitySkin(Entity var1) { + for(int var2 = 0; var2 < this.worldAccesses.size(); ++var2) { + ((IWorldAccess)this.worldAccesses.get(var2)).releaseEntitySkin(var1); + } + + } + + public void setEntityDead(Entity var1) { + if(var1.riddenByEntity != null) { + var1.riddenByEntity.mountEntity((Entity)null); + } + + if(var1.ridingEntity != null) { + var1.mountEntity((Entity)null); + } + + var1.setEntityDead(); + if(var1 instanceof EntityPlayer) { + this.playerEntities.remove((EntityPlayer)var1); + this.updateAllPlayersSleepingFlag(); + } + + } + + public void addWorldAccess(IWorldAccess var1) { + this.worldAccesses.add(var1); + } + + public void removeWorldAccess(IWorldAccess var1) { + this.worldAccesses.remove(var1); + } + + public List getCollidingBoundingBoxes(Entity var1, AxisAlignedBB var2) { + this.collidingBoundingBoxes.clear(); + int var3 = MathHelper.floor_double(var2.minX); + int var4 = MathHelper.floor_double(var2.maxX + 1.0D); + int var5 = MathHelper.floor_double(var2.minY); + int var6 = MathHelper.floor_double(var2.maxY + 1.0D); + int var7 = MathHelper.floor_double(var2.minZ); + int var8 = MathHelper.floor_double(var2.maxZ + 1.0D); + + for(int var9 = var3; var9 < var4; ++var9) { + for(int var10 = var7; var10 < var8; ++var10) { + if(this.blockExists(var9, 64, var10)) { + for(int var11 = var5 - 1; var11 < var6; ++var11) { + Block var12 = Block.blocksList[this.getBlockId(var9, var11, var10)]; + if(var12 != null) { + var12.getCollidingBoundingBoxes(this, var9, var11, var10, var2, this.collidingBoundingBoxes); + } + } + } + } + } + + double var14 = 0.25D; + List var15 = this.getEntitiesWithinAABBExcludingEntity(var1, var2.expand(var14, var14, var14)); + + for(int var16 = 0; var16 < var15.size(); ++var16) { + AxisAlignedBB var13 = ((Entity)var15.get(var16)).getBoundingBox(); + if(var13 != null && var13.intersectsWith(var2)) { + this.collidingBoundingBoxes.add(var13); + } + + var13 = var1.getCollisionBox((Entity)var15.get(var16)); + if(var13 != null && var13.intersectsWith(var2)) { + this.collidingBoundingBoxes.add(var13); + } + } + + return this.collidingBoundingBoxes; + } + + public int calculateSkylightSubtracted(float var1) { + float var2 = this.getCelestialAngle(var1); + float var3 = 1.0F - (MathHelper.cos(var2 * (float)Math.PI * 2.0F) * 2.0F + 0.5F); + if(var3 < 0.0F) { + var3 = 0.0F; + } + + if(var3 > 1.0F) { + var3 = 1.0F; + } + + var3 = 1.0F - var3; + var3 = (float)((double)var3 * (1.0D - (double)(this.func_27162_g(var1) * 5.0F) / 16.0D)); + var3 = (float)((double)var3 * (1.0D - (double)(this.func_27166_f(var1) * 5.0F) / 16.0D)); + var3 = 1.0F - var3; + return (int)(var3 * 11.0F); + } + + public Vec3D func_4079_a(Entity var1, float var2) { + float var3 = this.getCelestialAngle(var2); + float var4 = MathHelper.cos(var3 * (float)Math.PI * 2.0F) * 2.0F + 0.5F; + if(var4 < 0.0F) { + var4 = 0.0F; + } + + if(var4 > 1.0F) { + var4 = 1.0F; + } + + int var5 = MathHelper.floor_double(var1.posX); + int var6 = MathHelper.floor_double(var1.posZ); + float var7 = (float)this.getWorldChunkManager().getTemperature(var5, var6); + int var8 = this.getWorldChunkManager().getBiomeGenAt(var5, var6).getSkyColorByTemp(var7); + float var9 = (float)(var8 >> 16 & 255) / 255.0F; + float var10 = (float)(var8 >> 8 & 255) / 255.0F; + float var11 = (float)(var8 & 255) / 255.0F; + var9 *= var4; + var10 *= var4; + var11 *= var4; + float var12 = this.func_27162_g(var2); + float var13; + float var14; + if(var12 > 0.0F) { + var13 = (var9 * 0.3F + var10 * 0.59F + var11 * 0.11F) * 0.6F; + var14 = 1.0F - var12 * (12.0F / 16.0F); + var9 = var9 * var14 + var13 * (1.0F - var14); + var10 = var10 * var14 + var13 * (1.0F - var14); + var11 = var11 * var14 + var13 * (1.0F - var14); + } + + var13 = this.func_27166_f(var2); + if(var13 > 0.0F) { + var14 = (var9 * 0.3F + var10 * 0.59F + var11 * 0.11F) * 0.2F; + float var15 = 1.0F - var13 * (12.0F / 16.0F); + var9 = var9 * var15 + var14 * (1.0F - var15); + var10 = var10 * var15 + var14 * (1.0F - var15); + var11 = var11 * var15 + var14 * (1.0F - var15); + } + + if(this.field_27172_i > 0) { + var14 = (float)this.field_27172_i - var2; + if(var14 > 1.0F) { + var14 = 1.0F; + } + + var14 *= 0.45F; + var9 = var9 * (1.0F - var14) + 0.8F * var14; + var10 = var10 * (1.0F - var14) + 0.8F * var14; + var11 = var11 * (1.0F - var14) + 1.0F * var14; + } + + return Vec3D.createVector((double)var9, (double)var10, (double)var11); + } + + public float getCelestialAngle(float var1) { + return this.worldProvider.calculateCelestialAngle(this.worldInfo.getWorldTime(), var1); + } + + public Vec3D func_628_d(float var1) { + float var2 = this.getCelestialAngle(var1); + float var3 = MathHelper.cos(var2 * (float)Math.PI * 2.0F) * 2.0F + 0.5F; + if(var3 < 0.0F) { + var3 = 0.0F; + } + + if(var3 > 1.0F) { + var3 = 1.0F; + } + + float var4 = (float)(this.field_1019_F >> 16 & 255L) / 255.0F; + float var5 = (float)(this.field_1019_F >> 8 & 255L) / 255.0F; + float var6 = (float)(this.field_1019_F & 255L) / 255.0F; + float var7 = this.func_27162_g(var1); + float var8; + float var9; + if(var7 > 0.0F) { + var8 = (var4 * 0.3F + var5 * 0.59F + var6 * 0.11F) * 0.6F; + var9 = 1.0F - var7 * 0.95F; + var4 = var4 * var9 + var8 * (1.0F - var9); + var5 = var5 * var9 + var8 * (1.0F - var9); + var6 = var6 * var9 + var8 * (1.0F - var9); + } + + var4 *= var3 * 0.9F + 0.1F; + var5 *= var3 * 0.9F + 0.1F; + var6 *= var3 * 0.85F + 0.15F; + var8 = this.func_27166_f(var1); + if(var8 > 0.0F) { + var9 = (var4 * 0.3F + var5 * 0.59F + var6 * 0.11F) * 0.2F; + float var10 = 1.0F - var8 * 0.95F; + var4 = var4 * var10 + var9 * (1.0F - var10); + var5 = var5 * var10 + var9 * (1.0F - var10); + var6 = var6 * var10 + var9 * (1.0F - var10); + } + + return Vec3D.createVector((double)var4, (double)var5, (double)var6); + } + + public Vec3D getFogColor(float var1) { + float var2 = this.getCelestialAngle(var1); + return this.worldProvider.func_4096_a(var2, var1); + } + + public int findTopSolidBlock(int var1, int var2) { + Chunk var3 = this.getChunkFromBlockCoords(var1, var2); + int var4 = 127; + var1 &= 15; + + for(var2 &= 15; var4 > 0; --var4) { + int var5 = var3.getBlockID(var1, var4, var2); + Material var6 = var5 == 0 ? Material.air : Block.blocksList[var5].blockMaterial; + if(var6.getIsSolid() || var6.getIsLiquid()) { + return var4 + 1; + } + } + + return -1; + } + + public float getStarBrightness(float var1) { + float var2 = this.getCelestialAngle(var1); + float var3 = 1.0F - (MathHelper.cos(var2 * (float)Math.PI * 2.0F) * 2.0F + 12.0F / 16.0F); + if(var3 < 0.0F) { + var3 = 0.0F; + } + + if(var3 > 1.0F) { + var3 = 1.0F; + } + + return var3 * var3 * 0.5F; + } + + public void scheduleBlockUpdate(int var1, int var2, int var3, int var4, int var5) { + NextTickListEntry var6 = new NextTickListEntry(var1, var2, var3, var4); + byte var7 = 8; + if(this.scheduledUpdatesAreImmediate) { + if(this.checkChunksExist(var6.xCoord - var7, var6.yCoord - var7, var6.zCoord - var7, var6.xCoord + var7, var6.yCoord + var7, var6.zCoord + var7)) { + int var8 = this.getBlockId(var6.xCoord, var6.yCoord, var6.zCoord); + if(var8 == var6.blockID && var8 > 0) { + Block.blocksList[var8].updateTick(this, var6.xCoord, var6.yCoord, var6.zCoord, this.rand); + } + } + + } else { + if(this.checkChunksExist(var1 - var7, var2 - var7, var3 - var7, var1 + var7, var2 + var7, var3 + var7)) { + if(var4 > 0) { + var6.setScheduledTime((long)var5 + this.worldInfo.getWorldTime()); + } + + if(!this.scheduledTickSet.contains(var6)) { + this.scheduledTickSet.add(var6); + this.scheduledTickTreeSet.add(var6); + } + } + + } + } + + public void updateEntities() { + int var1; + Entity var2; + for(var1 = 0; var1 < this.weatherEffects.size(); ++var1) { + var2 = (Entity)this.weatherEffects.get(var1); + var2.onUpdate(); + if(var2.isDead) { + this.weatherEffects.remove(var1--); + } + } + + this.loadedEntityList.removeAll(this.unloadedEntityList); + + int var3; + int var4; + for(var1 = 0; var1 < this.unloadedEntityList.size(); ++var1) { + var2 = (Entity)this.unloadedEntityList.get(var1); + var3 = var2.chunkCoordX; + var4 = var2.chunkCoordZ; + if(var2.addedToChunk && this.chunkExists(var3, var4)) { + this.getChunkFromChunkCoords(var3, var4).removeEntity(var2); + } + } + + for(var1 = 0; var1 < this.unloadedEntityList.size(); ++var1) { + this.releaseEntitySkin((Entity)this.unloadedEntityList.get(var1)); + } + + this.unloadedEntityList.clear(); + + for(var1 = 0; var1 < this.loadedEntityList.size(); ++var1) { + var2 = (Entity)this.loadedEntityList.get(var1); + if(var2.ridingEntity != null) { + if(!var2.ridingEntity.isDead && var2.ridingEntity.riddenByEntity == var2) { + continue; + } + + var2.ridingEntity.riddenByEntity = null; + var2.ridingEntity = null; + } + + if(!var2.isDead) { + this.updateEntity(var2); + } + + if(var2.isDead) { + var3 = var2.chunkCoordX; + var4 = var2.chunkCoordZ; + if(var2.addedToChunk && this.chunkExists(var3, var4)) { + this.getChunkFromChunkCoords(var3, var4).removeEntity(var2); + } + + this.loadedEntityList.remove(var1--); + this.releaseEntitySkin(var2); + } + } + + this.field_31055_L = true; + Iterator var10 = this.loadedTileEntityList.iterator(); + + while(var10.hasNext()) { + TileEntity var5 = (TileEntity)var10.next(); + if(!var5.func_31006_g()) { + var5.updateEntity(); + } + + if(var5.func_31006_g()) { + var10.remove(); + Chunk var7 = this.getChunkFromChunkCoords(var5.xCoord >> 4, var5.zCoord >> 4); + if(var7 != null) { + var7.removeChunkBlockTileEntity(var5.xCoord & 15, var5.yCoord, var5.zCoord & 15); + } + } + } + + this.field_31055_L = false; + if(!this.field_30900_E.isEmpty()) { + Iterator var6 = this.field_30900_E.iterator(); + + while(var6.hasNext()) { + TileEntity var8 = (TileEntity)var6.next(); + if(!var8.func_31006_g()) { + if(!this.loadedTileEntityList.contains(var8)) { + this.loadedTileEntityList.add(var8); + } + + Chunk var9 = this.getChunkFromChunkCoords(var8.xCoord >> 4, var8.zCoord >> 4); + if(var9 != null) { + var9.setChunkBlockTileEntity(var8.xCoord & 15, var8.yCoord, var8.zCoord & 15, var8); + } + + this.markBlockNeedsUpdate(var8.xCoord, var8.yCoord, var8.zCoord); + } + } + + this.field_30900_E.clear(); + } + + } + + public void func_31054_a(Collection var1) { + if(this.field_31055_L) { + this.field_30900_E.addAll(var1); + } else { + this.loadedTileEntityList.addAll(var1); + } + + } + + public void updateEntity(Entity var1) { + this.updateEntityWithOptionalForce(var1, true); + } + + public void updateEntityWithOptionalForce(Entity var1, boolean var2) { + int var3 = MathHelper.floor_double(var1.posX); + int var4 = MathHelper.floor_double(var1.posZ); + byte var5 = 32; + if(!var2 || this.checkChunksExist(var3 - var5, 0, var4 - var5, var3 + var5, 128, var4 + var5)) { + var1.lastTickPosX = var1.posX; + var1.lastTickPosY = var1.posY; + var1.lastTickPosZ = var1.posZ; + var1.prevRotationYaw = var1.rotationYaw; + var1.prevRotationPitch = var1.rotationPitch; + if(var2 && var1.addedToChunk) { + if(var1.ridingEntity != null) { + var1.updateRidden(); + } else { + var1.onUpdate(); + } + } + + if(Double.isNaN(var1.posX) || Double.isInfinite(var1.posX)) { + var1.posX = var1.lastTickPosX; + } + + if(Double.isNaN(var1.posY) || Double.isInfinite(var1.posY)) { + var1.posY = var1.lastTickPosY; + } + + if(Double.isNaN(var1.posZ) || Double.isInfinite(var1.posZ)) { + var1.posZ = var1.lastTickPosZ; + } + + if(Double.isNaN((double)var1.rotationPitch) || Double.isInfinite((double)var1.rotationPitch)) { + var1.rotationPitch = var1.prevRotationPitch; + } + + if(Double.isNaN((double)var1.rotationYaw) || Double.isInfinite((double)var1.rotationYaw)) { + var1.rotationYaw = var1.prevRotationYaw; + } + + int var6 = MathHelper.floor_double(var1.posX / 16.0D); + int var7 = MathHelper.floor_double(var1.posY / 16.0D); + int var8 = MathHelper.floor_double(var1.posZ / 16.0D); + if(!var1.addedToChunk || var1.chunkCoordX != var6 || var1.chunkCoordY != var7 || var1.chunkCoordZ != var8) { + if(var1.addedToChunk && this.chunkExists(var1.chunkCoordX, var1.chunkCoordZ)) { + this.getChunkFromChunkCoords(var1.chunkCoordX, var1.chunkCoordZ).removeEntityAtIndex(var1, var1.chunkCoordY); + } + + if(this.chunkExists(var6, var8)) { + var1.addedToChunk = true; + this.getChunkFromChunkCoords(var6, var8).addEntity(var1); + } else { + var1.addedToChunk = false; + } + } + + if(var2 && var1.addedToChunk && var1.riddenByEntity != null) { + if(!var1.riddenByEntity.isDead && var1.riddenByEntity.ridingEntity == var1) { + this.updateEntity(var1.riddenByEntity); + } else { + var1.riddenByEntity.ridingEntity = null; + var1.riddenByEntity = null; + } + } + + } + } + + public boolean checkIfAABBIsClear(AxisAlignedBB var1) { + List var2 = this.getEntitiesWithinAABBExcludingEntity((Entity)null, var1); + + for(int var3 = 0; var3 < var2.size(); ++var3) { + Entity var4 = (Entity)var2.get(var3); + if(!var4.isDead && var4.preventEntitySpawning) { + return false; + } + } + + return true; + } + + public boolean getIsAnyLiquid(AxisAlignedBB var1) { + int var2 = MathHelper.floor_double(var1.minX); + int var3 = MathHelper.floor_double(var1.maxX + 1.0D); + int var4 = MathHelper.floor_double(var1.minY); + int var5 = MathHelper.floor_double(var1.maxY + 1.0D); + int var6 = MathHelper.floor_double(var1.minZ); + int var7 = MathHelper.floor_double(var1.maxZ + 1.0D); + if(var1.minX < 0.0D) { + --var2; + } + + if(var1.minY < 0.0D) { + --var4; + } + + if(var1.minZ < 0.0D) { + --var6; + } + + for(int var8 = var2; var8 < var3; ++var8) { + for(int var9 = var4; var9 < var5; ++var9) { + for(int var10 = var6; var10 < var7; ++var10) { + Block var11 = Block.blocksList[this.getBlockId(var8, var9, var10)]; + if(var11 != null && var11.blockMaterial.getIsLiquid()) { + return true; + } + } + } + } + + return false; + } + + public boolean isBoundingBoxBurning(AxisAlignedBB var1) { + int var2 = MathHelper.floor_double(var1.minX); + int var3 = MathHelper.floor_double(var1.maxX + 1.0D); + int var4 = MathHelper.floor_double(var1.minY); + int var5 = MathHelper.floor_double(var1.maxY + 1.0D); + int var6 = MathHelper.floor_double(var1.minZ); + int var7 = MathHelper.floor_double(var1.maxZ + 1.0D); + if(this.checkChunksExist(var2, var4, var6, var3, var5, var7)) { + for(int var8 = var2; var8 < var3; ++var8) { + for(int var9 = var4; var9 < var5; ++var9) { + for(int var10 = var6; var10 < var7; ++var10) { + int var11 = this.getBlockId(var8, var9, var10); + if(var11 == Block.fire.blockID || var11 == Block.lavaMoving.blockID || var11 == Block.lavaStill.blockID) { + return true; + } + } + } + } + } + + return false; + } + + public boolean handleMaterialAcceleration(AxisAlignedBB var1, Material var2, Entity var3) { + int var4 = MathHelper.floor_double(var1.minX); + int var5 = MathHelper.floor_double(var1.maxX + 1.0D); + int var6 = MathHelper.floor_double(var1.minY); + int var7 = MathHelper.floor_double(var1.maxY + 1.0D); + int var8 = MathHelper.floor_double(var1.minZ); + int var9 = MathHelper.floor_double(var1.maxZ + 1.0D); + if(!this.checkChunksExist(var4, var6, var8, var5, var7, var9)) { + return false; + } else { + boolean var10 = false; + Vec3D var11 = Vec3D.createVector(0.0D, 0.0D, 0.0D); + + for(int var12 = var4; var12 < var5; ++var12) { + for(int var13 = var6; var13 < var7; ++var13) { + for(int var14 = var8; var14 < var9; ++var14) { + Block var15 = Block.blocksList[this.getBlockId(var12, var13, var14)]; + if(var15 != null && var15.blockMaterial == var2) { + double var16 = (double)((float)(var13 + 1) - BlockFluid.getPercentAir(this.getBlockMetadata(var12, var13, var14))); + if((double)var7 >= var16) { + var10 = true; + var15.velocityToAddToEntity(this, var12, var13, var14, var3, var11); + } + } + } + } + } + + if(var11.lengthVector() > 0.0D) { + var11 = var11.normalize(); + double var18 = 0.014D; + var3.motionX += var11.xCoord * var18; + var3.motionY += var11.yCoord * var18; + var3.motionZ += var11.zCoord * var18; + } + + return var10; + } + } + + public boolean isMaterialInBB(AxisAlignedBB var1, Material var2) { + int var3 = MathHelper.floor_double(var1.minX); + int var4 = MathHelper.floor_double(var1.maxX + 1.0D); + int var5 = MathHelper.floor_double(var1.minY); + int var6 = MathHelper.floor_double(var1.maxY + 1.0D); + int var7 = MathHelper.floor_double(var1.minZ); + int var8 = MathHelper.floor_double(var1.maxZ + 1.0D); + + for(int var9 = var3; var9 < var4; ++var9) { + for(int var10 = var5; var10 < var6; ++var10) { + for(int var11 = var7; var11 < var8; ++var11) { + Block var12 = Block.blocksList[this.getBlockId(var9, var10, var11)]; + if(var12 != null && var12.blockMaterial == var2) { + return true; + } + } + } + } + + return false; + } + + public boolean isAABBInMaterial(AxisAlignedBB var1, Material var2) { + int var3 = MathHelper.floor_double(var1.minX); + int var4 = MathHelper.floor_double(var1.maxX + 1.0D); + int var5 = MathHelper.floor_double(var1.minY); + int var6 = MathHelper.floor_double(var1.maxY + 1.0D); + int var7 = MathHelper.floor_double(var1.minZ); + int var8 = MathHelper.floor_double(var1.maxZ + 1.0D); + + for(int var9 = var3; var9 < var4; ++var9) { + for(int var10 = var5; var10 < var6; ++var10) { + for(int var11 = var7; var11 < var8; ++var11) { + Block var12 = Block.blocksList[this.getBlockId(var9, var10, var11)]; + if(var12 != null && var12.blockMaterial == var2) { + int var13 = this.getBlockMetadata(var9, var10, var11); + double var14 = (double)(var10 + 1); + if(var13 < 8) { + var14 = (double)(var10 + 1) - (double)var13 / 8.0D; + } + + if(var14 >= var1.minY) { + return true; + } + } + } + } + } + + return false; + } + + public Explosion createExplosion(Entity var1, double var2, double var4, double var6, float var8) { + return this.newExplosion(var1, var2, var4, var6, var8, false); + } + + public Explosion newExplosion(Entity var1, double var2, double var4, double var6, float var8, boolean var9) { + Explosion var10 = new Explosion(this, var1, var2, var4, var6, var8); + var10.isFlaming = var9; + var10.doExplosionA(); + var10.doExplosionB(true); + return var10; + } + + public float func_675_a(Vec3D var1, AxisAlignedBB var2) { + double var3 = 1.0D / ((var2.maxX - var2.minX) * 2.0D + 1.0D); + double var5 = 1.0D / ((var2.maxY - var2.minY) * 2.0D + 1.0D); + double var7 = 1.0D / ((var2.maxZ - var2.minZ) * 2.0D + 1.0D); + int var9 = 0; + int var10 = 0; + + for(float var11 = 0.0F; var11 <= 1.0F; var11 = (float)((double)var11 + var3)) { + for(float var12 = 0.0F; var12 <= 1.0F; var12 = (float)((double)var12 + var5)) { + for(float var13 = 0.0F; var13 <= 1.0F; var13 = (float)((double)var13 + var7)) { + double var14 = var2.minX + (var2.maxX - var2.minX) * (double)var11; + double var16 = var2.minY + (var2.maxY - var2.minY) * (double)var12; + double var18 = var2.minZ + (var2.maxZ - var2.minZ) * (double)var13; + if(this.rayTraceBlocks(Vec3D.createVector(var14, var16, var18), var1) == null) { + ++var9; + } + + ++var10; + } + } + } + + return (float)var9 / (float)var10; + } + + public void onBlockHit(EntityPlayer var1, int var2, int var3, int var4, int var5) { + if(var5 == 0) { + --var3; + } + + if(var5 == 1) { + ++var3; + } + + if(var5 == 2) { + --var4; + } + + if(var5 == 3) { + ++var4; + } + + if(var5 == 4) { + --var2; + } + + if(var5 == 5) { + ++var2; + } + + if(this.getBlockId(var2, var3, var4) == Block.fire.blockID) { + this.func_28107_a(var1, 1004, var2, var3, var4, 0); + this.setBlockWithNotify(var2, var3, var4, 0); + } + + } + + public Entity func_4085_a(Class var1) { + return null; + } + + public String func_687_d() { + return "All: " + this.loadedEntityList.size(); + } + + public String func_21119_g() { + return this.chunkProvider.makeString(); + } + + public TileEntity getBlockTileEntity(int var1, int var2, int var3) { + Chunk var4 = this.getChunkFromChunkCoords(var1 >> 4, var3 >> 4); + return var4 != null ? var4.getChunkBlockTileEntity(var1 & 15, var2, var3 & 15) : null; + } + + public void setBlockTileEntity(int var1, int var2, int var3, TileEntity var4) { + if(!var4.func_31006_g()) { + if(this.field_31055_L) { + var4.xCoord = var1; + var4.yCoord = var2; + var4.zCoord = var3; + this.field_30900_E.add(var4); + } else { + this.loadedTileEntityList.add(var4); + Chunk var5 = this.getChunkFromChunkCoords(var1 >> 4, var3 >> 4); + if(var5 != null) { + var5.setChunkBlockTileEntity(var1 & 15, var2, var3 & 15, var4); + } + } + } + + } + + public void removeBlockTileEntity(int var1, int var2, int var3) { + TileEntity var4 = this.getBlockTileEntity(var1, var2, var3); + if(var4 != null && this.field_31055_L) { + var4.func_31005_i(); + } else { + if(var4 != null) { + this.loadedTileEntityList.remove(var4); + } + + Chunk var5 = this.getChunkFromChunkCoords(var1 >> 4, var3 >> 4); + if(var5 != null) { + var5.removeChunkBlockTileEntity(var1 & 15, var2, var3 & 15); + } + } + + } + + public boolean isBlockOpaqueCube(int var1, int var2, int var3) { + Block var4 = Block.blocksList[this.getBlockId(var1, var2, var3)]; + return var4 == null ? false : var4.isOpaqueCube(); + } + + public boolean isBlockNormalCube(int var1, int var2, int var3) { + Block var4 = Block.blocksList[this.getBlockId(var1, var2, var3)]; + return var4 == null ? false : var4.blockMaterial.getIsTranslucent() && var4.renderAsNormalBlock(); + } + + public void saveWorldIndirectly(IProgressUpdate var1) { + this.saveWorld(true, var1); + } + + public boolean updatingLighting() { + if(this.lightingUpdatesCounter >= 50) { + return false; + } else { + ++this.lightingUpdatesCounter; + + try { + int var1 = 500; + + boolean var2; + while(this.lightingToUpdate.size() > 0) { + --var1; + if(var1 <= 0) { + var2 = true; + return var2; + } + + ((MetadataChunkBlock)this.lightingToUpdate.remove(this.lightingToUpdate.size() - 1)).func_4127_a(this); + } + + var2 = false; + return var2; + } finally { + --this.lightingUpdatesCounter; + } + } + } + + public void scheduleLightingUpdate(EnumSkyBlock var1, int var2, int var3, int var4, int var5, int var6, int var7) { + this.scheduleLightingUpdate_do(var1, var2, var3, var4, var5, var6, var7, true); + } + + public void scheduleLightingUpdate_do(EnumSkyBlock var1, int var2, int var3, int var4, int var5, int var6, int var7, boolean var8) { + if(!this.worldProvider.hasNoSky || var1 != EnumSkyBlock.Sky) { + ++lightingUpdatesScheduled; + + try { + if(lightingUpdatesScheduled == 50) { + return; + } + + int var9 = (var5 + var2) / 2; + int var10 = (var7 + var4) / 2; + if(this.blockExists(var9, 64, var10)) { + if(this.getChunkFromBlockCoords(var9, var10).func_21167_h()) { + return; + } + + int var11 = this.lightingToUpdate.size(); + int var12; + if(var8) { + var12 = 5; + if(var12 > var11) { + var12 = var11; + } + + for(int var13 = 0; var13 < var12; ++var13) { + MetadataChunkBlock var14 = (MetadataChunkBlock)this.lightingToUpdate.get(this.lightingToUpdate.size() - var13 - 1); + if(var14.field_1299_a == var1 && var14.func_866_a(var2, var3, var4, var5, var6, var7)) { + return; + } + } + } + + this.lightingToUpdate.add(new MetadataChunkBlock(var1, var2, var3, var4, var5, var6, var7)); + var12 = 1000000; + if(this.lightingToUpdate.size() > 1000000) { + System.out.println("More than " + var12 + " updates, aborting lighting updates"); + this.lightingToUpdate.clear(); + } + + return; + } + } finally { + --lightingUpdatesScheduled; + } + + } + } + + public void calculateInitialSkylight() { + int var1 = this.calculateSkylightSubtracted(1.0F); + if(var1 != this.skylightSubtracted) { + this.skylightSubtracted = var1; + } + + } + + public void setAllowedMobSpawns(boolean var1, boolean var2) { + this.spawnHostileMobs = var1; + this.spawnPeacefulMobs = var2; + } + + public void tick() { + this.updateWeather(); + long var2; + if(this.isAllPlayersFullyAsleep()) { + boolean var1 = false; + if(this.spawnHostileMobs && this.difficultySetting >= 1) { + var1 = SpawnerAnimals.performSleepSpawning(this, this.playerEntities); + } + + if(!var1) { + var2 = this.worldInfo.getWorldTime() + 24000L; + this.worldInfo.setWorldTime(var2 - var2 % 24000L); + this.wakeUpAllPlayers(); + } + } + + SpawnerAnimals.performSpawning(this, this.spawnHostileMobs, this.spawnPeacefulMobs); + this.chunkProvider.unload100OldestChunks(); + int var4 = this.calculateSkylightSubtracted(1.0F); + if(var4 != this.skylightSubtracted) { + this.skylightSubtracted = var4; + + for(int var5 = 0; var5 < this.worldAccesses.size(); ++var5) { + ((IWorldAccess)this.worldAccesses.get(var5)).updateAllRenderers(); + } + } + + var2 = this.worldInfo.getWorldTime() + 1L; + if(var2 % (long)this.autosavePeriod == 0L) { + this.saveWorld(false, (IProgressUpdate)null); + } + + this.worldInfo.setWorldTime(var2); + this.TickUpdates(false); + this.updateBlocksAndPlayCaveSounds(); + } + + private void func_27163_E() { + if(this.worldInfo.getRaining()) { + this.rainingStrength = 1.0F; + if(this.worldInfo.getThundering()) { + this.thunderingStrength = 1.0F; + } + } + + } + + protected void updateWeather() { + if(!this.worldProvider.hasNoSky) { + if(this.field_27168_F > 0) { + --this.field_27168_F; + } + + int var1 = this.worldInfo.getThunderTime(); + if(var1 <= 0) { + if(this.worldInfo.getThundering()) { + this.worldInfo.setThunderTime(this.rand.nextInt(12000) + 3600); + } else { + this.worldInfo.setThunderTime(this.rand.nextInt(168000) + 12000); + } + } else { + --var1; + this.worldInfo.setThunderTime(var1); + if(var1 <= 0) { + this.worldInfo.setThundering(!this.worldInfo.getThundering()); + } + } + + int var2 = this.worldInfo.getRainTime(); + if(var2 <= 0) { + if(this.worldInfo.getRaining()) { + this.worldInfo.setRainTime(this.rand.nextInt(12000) + 12000); + } else { + this.worldInfo.setRainTime(this.rand.nextInt(168000) + 12000); + } + } else { + --var2; + this.worldInfo.setRainTime(var2); + if(var2 <= 0) { + this.worldInfo.setRaining(!this.worldInfo.getRaining()); + } + } + + this.prevRainingStrength = this.rainingStrength; + if(this.worldInfo.getRaining()) { + this.rainingStrength = (float)((double)this.rainingStrength + 0.01D); + } else { + this.rainingStrength = (float)((double)this.rainingStrength - 0.01D); + } + + if(this.rainingStrength < 0.0F) { + this.rainingStrength = 0.0F; + } + + if(this.rainingStrength > 1.0F) { + this.rainingStrength = 1.0F; + } + + this.prevThunderingStrength = this.thunderingStrength; + if(this.worldInfo.getThundering()) { + this.thunderingStrength = (float)((double)this.thunderingStrength + 0.01D); + } else { + this.thunderingStrength = (float)((double)this.thunderingStrength - 0.01D); + } + + if(this.thunderingStrength < 0.0F) { + this.thunderingStrength = 0.0F; + } + + if(this.thunderingStrength > 1.0F) { + this.thunderingStrength = 1.0F; + } + + } + } + + private void stopPrecipitation() { + this.worldInfo.setRainTime(0); + this.worldInfo.setRaining(false); + this.worldInfo.setThunderTime(0); + this.worldInfo.setThundering(false); + } + + protected void updateBlocksAndPlayCaveSounds() { + this.positionsToUpdate.clear(); + + int var3; + int var4; + int var6; + int var7; + for(int var1 = 0; var1 < this.playerEntities.size(); ++var1) { + EntityPlayer var2 = (EntityPlayer)this.playerEntities.get(var1); + var3 = MathHelper.floor_double(var2.posX / 16.0D); + var4 = MathHelper.floor_double(var2.posZ / 16.0D); + byte var5 = 9; + + for(var6 = -var5; var6 <= var5; ++var6) { + for(var7 = -var5; var7 <= var5; ++var7) { + this.positionsToUpdate.add(new ChunkCoordIntPair(var6 + var3, var7 + var4)); + } + } + } + + if(this.soundCounter > 0) { + --this.soundCounter; + } + + Iterator var12 = this.positionsToUpdate.iterator(); + + while(var12.hasNext()) { + ChunkCoordIntPair var13 = (ChunkCoordIntPair)var12.next(); + var3 = var13.chunkXPos * 16; + var4 = var13.chunkZPos * 16; + Chunk var14 = this.getChunkFromChunkCoords(var13.chunkXPos, var13.chunkZPos); + int var8; + int var9; + int var10; + if(this.soundCounter == 0) { + this.field_9437_g = this.field_9437_g * 3 + 1013904223; + var6 = this.field_9437_g >> 2; + var7 = var6 & 15; + var8 = var6 >> 8 & 15; + var9 = var6 >> 16 & 127; + var10 = var14.getBlockID(var7, var9, var8); + var7 += var3; + var8 += var4; + if(var10 == 0 && this.getFullBlockLightValue(var7, var9, var8) <= this.rand.nextInt(8) && this.getSavedLightValue(EnumSkyBlock.Sky, var7, var9, var8) <= 0) { + EntityPlayer var11 = this.getClosestPlayer((double)var7 + 0.5D, (double)var9 + 0.5D, (double)var8 + 0.5D, 8.0D); + if(var11 != null && var11.getDistanceSq((double)var7 + 0.5D, (double)var9 + 0.5D, (double)var8 + 0.5D) > 4.0D) { + this.playSoundEffect((double)var7 + 0.5D, (double)var9 + 0.5D, (double)var8 + 0.5D, "ambient.cave.cave", 0.7F, 0.8F + this.rand.nextFloat() * 0.2F); + this.soundCounter = this.rand.nextInt(12000) + 6000; + } + } + } + + if(this.rand.nextInt(100000) == 0 && this.func_27161_C() && this.func_27160_B()) { + this.field_9437_g = this.field_9437_g * 3 + 1013904223; + var6 = this.field_9437_g >> 2; + var7 = var3 + (var6 & 15); + var8 = var4 + (var6 >> 8 & 15); + var9 = this.findTopSolidBlock(var7, var8); + if(this.canBlockBeRainedOn(var7, var9, var8)) { + this.addWeatherEffect(new EntityLightningBolt(this, (double)var7, (double)var9, (double)var8)); + this.field_27168_F = 2; + } + } + + int var15; + if(this.rand.nextInt(16) == 0) { + this.field_9437_g = this.field_9437_g * 3 + 1013904223; + var6 = this.field_9437_g >> 2; + var7 = var6 & 15; + var8 = var6 >> 8 & 15; + var9 = this.findTopSolidBlock(var7 + var3, var8 + var4); + if(this.getWorldChunkManager().getBiomeGenAt(var7 + var3, var8 + var4).getEnableSnow() && var9 >= 0 && var9 < 128 && var14.getSavedLightValue(EnumSkyBlock.Block, var7, var9, var8) < 10) { + var10 = var14.getBlockID(var7, var9 - 1, var8); + var15 = var14.getBlockID(var7, var9, var8); + if(this.func_27161_C() && var15 == 0 && Block.snow.canPlaceBlockAt(this, var7 + var3, var9, var8 + var4) && var10 != 0 && var10 != Block.ice.blockID && Block.blocksList[var10].blockMaterial.getIsSolid()) { + this.setBlockWithNotify(var7 + var3, var9, var8 + var4, Block.snow.blockID); + } + + if(var10 == Block.waterStill.blockID && var14.getBlockMetadata(var7, var9 - 1, var8) == 0) { + this.setBlockWithNotify(var7 + var3, var9 - 1, var8 + var4, Block.ice.blockID); + } + } + } + + for(var6 = 0; var6 < 80; ++var6) { + this.field_9437_g = this.field_9437_g * 3 + 1013904223; + var7 = this.field_9437_g >> 2; + var8 = var7 & 15; + var9 = var7 >> 8 & 15; + var10 = var7 >> 16 & 127; + var15 = var14.blocks[var8 << 11 | var9 << 7 | var10] & 255; + if(Block.tickOnLoad[var15]) { + Block.blocksList[var15].updateTick(this, var8 + var3, var10, var9 + var4, this.rand); + } + } + } + + } + + public boolean TickUpdates(boolean var1) { + int var2 = this.scheduledTickTreeSet.size(); + if(var2 != this.scheduledTickSet.size()) { + throw new IllegalStateException("TickNextTick list out of synch"); + } else { + if(var2 > 1000) { + var2 = 1000; + } + + for(int var3 = 0; var3 < var2; ++var3) { + NextTickListEntry var4 = (NextTickListEntry)this.scheduledTickTreeSet.first(); + if(!var1 && var4.scheduledTime > this.worldInfo.getWorldTime()) { + break; + } + + this.scheduledTickTreeSet.remove(var4); + this.scheduledTickSet.remove(var4); + byte var5 = 8; + if(this.checkChunksExist(var4.xCoord - var5, var4.yCoord - var5, var4.zCoord - var5, var4.xCoord + var5, var4.yCoord + var5, var4.zCoord + var5)) { + int var6 = this.getBlockId(var4.xCoord, var4.yCoord, var4.zCoord); + if(var6 == var4.blockID && var6 > 0) { + Block.blocksList[var6].updateTick(this, var4.xCoord, var4.yCoord, var4.zCoord, this.rand); + } + } + } + + return this.scheduledTickTreeSet.size() != 0; + } + } + + public void randomDisplayUpdates(int var1, int var2, int var3) { + byte var4 = 16; + Random var5 = new Random(); + + for(int var6 = 0; var6 < 1000; ++var6) { + int var7 = var1 + this.rand.nextInt(var4) - this.rand.nextInt(var4); + int var8 = var2 + this.rand.nextInt(var4) - this.rand.nextInt(var4); + int var9 = var3 + this.rand.nextInt(var4) - this.rand.nextInt(var4); + int var10 = this.getBlockId(var7, var8, var9); + if(var10 > 0) { + Block.blocksList[var10].randomDisplayTick(this, var7, var8, var9, var5); + } + } + + } + + public List getEntitiesWithinAABBExcludingEntity(Entity var1, AxisAlignedBB var2) { + this.field_1012_M.clear(); + int var3 = MathHelper.floor_double((var2.minX - 2.0D) / 16.0D); + int var4 = MathHelper.floor_double((var2.maxX + 2.0D) / 16.0D); + int var5 = MathHelper.floor_double((var2.minZ - 2.0D) / 16.0D); + int var6 = MathHelper.floor_double((var2.maxZ + 2.0D) / 16.0D); + + for(int var7 = var3; var7 <= var4; ++var7) { + for(int var8 = var5; var8 <= var6; ++var8) { + if(this.chunkExists(var7, var8)) { + this.getChunkFromChunkCoords(var7, var8).getEntitiesWithinAABBForEntity(var1, var2, this.field_1012_M); + } + } + } + + return this.field_1012_M; + } + + public List getEntitiesWithinAABB(Class var1, AxisAlignedBB var2) { + int var3 = MathHelper.floor_double((var2.minX - 2.0D) / 16.0D); + int var4 = MathHelper.floor_double((var2.maxX + 2.0D) / 16.0D); + int var5 = MathHelper.floor_double((var2.minZ - 2.0D) / 16.0D); + int var6 = MathHelper.floor_double((var2.maxZ + 2.0D) / 16.0D); + ArrayList var7 = new ArrayList(); + + for(int var8 = var3; var8 <= var4; ++var8) { + for(int var9 = var5; var9 <= var6; ++var9) { + if(this.chunkExists(var8, var9)) { + this.getChunkFromChunkCoords(var8, var9).getEntitiesOfTypeWithinAAAB(var1, var2, var7); + } + } + } + + return var7; + } + + public List getLoadedEntityList() { + return this.loadedEntityList; + } + + public void func_698_b(int var1, int var2, int var3, TileEntity var4) { + if(this.blockExists(var1, var2, var3)) { + this.getChunkFromBlockCoords(var1, var3).setChunkModified(); + } + + for(int var5 = 0; var5 < this.worldAccesses.size(); ++var5) { + ((IWorldAccess)this.worldAccesses.get(var5)).doNothingWithTileEntity(var1, var2, var3, var4); + } + + } + + public int countEntities(Class var1) { + int var2 = 0; + + for(int var3 = 0; var3 < this.loadedEntityList.size(); ++var3) { + Entity var4 = (Entity)this.loadedEntityList.get(var3); + if(var1.isAssignableFrom(var4.getClass())) { + ++var2; + } + } + + return var2; + } + + public void func_636_a(List var1) { + this.loadedEntityList.addAll(var1); + + for(int var2 = 0; var2 < var1.size(); ++var2) { + this.obtainEntitySkin((Entity)var1.get(var2)); + } + + } + + public void func_632_b(List var1) { + this.unloadedEntityList.addAll(var1); + } + + public void func_656_j() { + while(this.chunkProvider.unload100OldestChunks()) { + } + + } + + public boolean canBlockBePlacedAt(int var1, int var2, int var3, int var4, boolean var5, int var6) { + int var7 = this.getBlockId(var2, var3, var4); + Block var8 = Block.blocksList[var7]; + Block var9 = Block.blocksList[var1]; + AxisAlignedBB var10 = var9.getCollisionBoundingBoxFromPool(this, var2, var3, var4); + if(var5) { + var10 = null; + } + + if(var10 != null && !this.checkIfAABBIsClear(var10)) { + return false; + } else { + if(var8 == Block.waterMoving || var8 == Block.waterStill || var8 == Block.lavaMoving || var8 == Block.lavaStill || var8 == Block.fire || var8 == Block.snow) { + var8 = null; + } + + return var1 > 0 && var8 == null && var9.canPlaceBlockOnSide(this, var2, var3, var4, var6); + } + } + + public PathEntity getPathToEntity(Entity var1, Entity var2, float var3) { + int var4 = MathHelper.floor_double(var1.posX); + int var5 = MathHelper.floor_double(var1.posY); + int var6 = MathHelper.floor_double(var1.posZ); + int var7 = (int)(var3 + 16.0F); + int var8 = var4 - var7; + int var9 = var5 - var7; + int var10 = var6 - var7; + int var11 = var4 + var7; + int var12 = var5 + var7; + int var13 = var6 + var7; + ChunkCache var14 = new ChunkCache(this, var8, var9, var10, var11, var12, var13); + return (new Pathfinder(var14)).createEntityPathTo(var1, var2, var3); + } + + public PathEntity getEntityPathToXYZ(Entity var1, int var2, int var3, int var4, float var5) { + int var6 = MathHelper.floor_double(var1.posX); + int var7 = MathHelper.floor_double(var1.posY); + int var8 = MathHelper.floor_double(var1.posZ); + int var9 = (int)(var5 + 8.0F); + int var10 = var6 - var9; + int var11 = var7 - var9; + int var12 = var8 - var9; + int var13 = var6 + var9; + int var14 = var7 + var9; + int var15 = var8 + var9; + ChunkCache var16 = new ChunkCache(this, var10, var11, var12, var13, var14, var15); + return (new Pathfinder(var16)).createEntityPathTo(var1, var2, var3, var4, var5); + } + + public boolean isBlockProvidingPowerTo(int var1, int var2, int var3, int var4) { + int var5 = this.getBlockId(var1, var2, var3); + return var5 == 0 ? false : Block.blocksList[var5].isIndirectlyPoweringTo(this, var1, var2, var3, var4); + } + + public boolean isBlockGettingPowered(int var1, int var2, int var3) { + return this.isBlockProvidingPowerTo(var1, var2 - 1, var3, 0) ? true : (this.isBlockProvidingPowerTo(var1, var2 + 1, var3, 1) ? true : (this.isBlockProvidingPowerTo(var1, var2, var3 - 1, 2) ? true : (this.isBlockProvidingPowerTo(var1, var2, var3 + 1, 3) ? true : (this.isBlockProvidingPowerTo(var1 - 1, var2, var3, 4) ? true : this.isBlockProvidingPowerTo(var1 + 1, var2, var3, 5))))); + } + + public boolean isBlockIndirectlyProvidingPowerTo(int var1, int var2, int var3, int var4) { + if(this.isBlockNormalCube(var1, var2, var3)) { + return this.isBlockGettingPowered(var1, var2, var3); + } else { + int var5 = this.getBlockId(var1, var2, var3); + return var5 == 0 ? false : Block.blocksList[var5].isPoweringTo(this, var1, var2, var3, var4); + } + } + + public boolean isBlockIndirectlyGettingPowered(int var1, int var2, int var3) { + return this.isBlockIndirectlyProvidingPowerTo(var1, var2 - 1, var3, 0) ? true : (this.isBlockIndirectlyProvidingPowerTo(var1, var2 + 1, var3, 1) ? true : (this.isBlockIndirectlyProvidingPowerTo(var1, var2, var3 - 1, 2) ? true : (this.isBlockIndirectlyProvidingPowerTo(var1, var2, var3 + 1, 3) ? true : (this.isBlockIndirectlyProvidingPowerTo(var1 - 1, var2, var3, 4) ? true : this.isBlockIndirectlyProvidingPowerTo(var1 + 1, var2, var3, 5))))); + } + + public EntityPlayer getClosestPlayerToEntity(Entity var1, double var2) { + return this.getClosestPlayer(var1.posX, var1.posY, var1.posZ, var2); + } + + public EntityPlayer getClosestPlayer(double var1, double var3, double var5, double var7) { + double var9 = -1.0D; + EntityPlayer var11 = null; + + for(int var12 = 0; var12 < this.playerEntities.size(); ++var12) { + EntityPlayer var13 = (EntityPlayer)this.playerEntities.get(var12); + double var14 = var13.getDistanceSq(var1, var3, var5); + if((var7 < 0.0D || var14 < var7 * var7) && (var9 == -1.0D || var14 < var9)) { + var9 = var14; + var11 = var13; + } + } + + return var11; + } + + public EntityPlayer getPlayerEntityByName(String var1) { + for(int var2 = 0; var2 < this.playerEntities.size(); ++var2) { + if(var1.equals(((EntityPlayer)this.playerEntities.get(var2)).username)) { + return (EntityPlayer)this.playerEntities.get(var2); + } + } + + return null; + } + + public void setChunkData(int var1, int var2, int var3, int var4, int var5, int var6, byte[] var7) { + int var8 = var1 >> 4; + int var9 = var3 >> 4; + int var10 = var1 + var4 - 1 >> 4; + int var11 = var3 + var6 - 1 >> 4; + int var12 = 0; + int var13 = var2; + int var14 = var2 + var5; + if(var2 < 0) { + var13 = 0; + } + + if(var14 > 128) { + var14 = 128; + } + + for(int var15 = var8; var15 <= var10; ++var15) { + int var16 = var1 - var15 * 16; + int var17 = var1 + var4 - var15 * 16; + if(var16 < 0) { + var16 = 0; + } + + if(var17 > 16) { + var17 = 16; + } + + for(int var18 = var9; var18 <= var11; ++var18) { + int var19 = var3 - var18 * 16; + int var20 = var3 + var6 - var18 * 16; + if(var19 < 0) { + var19 = 0; + } + + if(var20 > 16) { + var20 = 16; + } + + var12 = this.getChunkFromChunkCoords(var15, var18).setChunkData(var7, var16, var13, var19, var17, var14, var20, var12); + this.markBlocksDirty(var15 * 16 + var16, var13, var18 * 16 + var19, var15 * 16 + var17, var14, var18 * 16 + var20); + } + } + + } + + public void sendQuittingDisconnectingPacket() { + } + + public void checkSessionLock() { + this.saveHandler.func_22150_b(); + } + + public void setWorldTime(long var1) { + this.worldInfo.setWorldTime(var1); + } + + public long getRandomSeed() { + return this.worldInfo.getRandomSeed(); + } + + public long getWorldTime() { + return this.worldInfo.getWorldTime(); + } + + public ChunkCoordinates getSpawnPoint() { + return new ChunkCoordinates(this.worldInfo.getSpawnX(), this.worldInfo.getSpawnY(), this.worldInfo.getSpawnZ()); + } + + public void setSpawnPoint(ChunkCoordinates var1) { + this.worldInfo.setSpawn(var1.x, var1.y, var1.z); + } + + public void joinEntityInSurroundings(Entity var1) { + int var2 = MathHelper.floor_double(var1.posX / 16.0D); + int var3 = MathHelper.floor_double(var1.posZ / 16.0D); + byte var4 = 2; + + for(int var5 = var2 - var4; var5 <= var2 + var4; ++var5) { + for(int var6 = var3 - var4; var6 <= var3 + var4; ++var6) { + this.getChunkFromChunkCoords(var5, var6); + } + } + + if(!this.loadedEntityList.contains(var1)) { + this.loadedEntityList.add(var1); + } + + } + + public boolean func_6466_a(EntityPlayer var1, int var2, int var3, int var4) { + return true; + } + + public void func_9425_a(Entity var1, byte var2) { + } + + public void updateEntityList() { + this.loadedEntityList.removeAll(this.unloadedEntityList); + + int var1; + Entity var2; + int var3; + int var4; + for(var1 = 0; var1 < this.unloadedEntityList.size(); ++var1) { + var2 = (Entity)this.unloadedEntityList.get(var1); + var3 = var2.chunkCoordX; + var4 = var2.chunkCoordZ; + if(var2.addedToChunk && this.chunkExists(var3, var4)) { + this.getChunkFromChunkCoords(var3, var4).removeEntity(var2); + } + } + + for(var1 = 0; var1 < this.unloadedEntityList.size(); ++var1) { + this.releaseEntitySkin((Entity)this.unloadedEntityList.get(var1)); + } + + this.unloadedEntityList.clear(); + + for(var1 = 0; var1 < this.loadedEntityList.size(); ++var1) { + var2 = (Entity)this.loadedEntityList.get(var1); + if(var2.ridingEntity != null) { + if(!var2.ridingEntity.isDead && var2.ridingEntity.riddenByEntity == var2) { + continue; + } + + var2.ridingEntity.riddenByEntity = null; + var2.ridingEntity = null; + } + + if(var2.isDead) { + var3 = var2.chunkCoordX; + var4 = var2.chunkCoordZ; + if(var2.addedToChunk && this.chunkExists(var3, var4)) { + this.getChunkFromChunkCoords(var3, var4).removeEntity(var2); + } + + this.loadedEntityList.remove(var1--); + this.releaseEntitySkin(var2); + } + } + + } + + public IChunkProvider getIChunkProvider() { + return this.chunkProvider; + } + + public void playNoteAt(int var1, int var2, int var3, int var4, int var5) { + int var6 = this.getBlockId(var1, var2, var3); + if(var6 > 0) { + Block.blocksList[var6].playBlock(this, var1, var2, var3, var4, var5); + } + + } + + public WorldInfo getWorldInfo() { + return this.worldInfo; + } + + public void updateAllPlayersSleepingFlag() { + this.allPlayersSleeping = !this.playerEntities.isEmpty(); + Iterator var1 = this.playerEntities.iterator(); + + while(var1.hasNext()) { + EntityPlayer var2 = (EntityPlayer)var1.next(); + if(!var2.isPlayerSleeping()) { + this.allPlayersSleeping = false; + break; + } + } + + } + + protected void wakeUpAllPlayers() { + this.allPlayersSleeping = false; + Iterator var1 = this.playerEntities.iterator(); + + while(var1.hasNext()) { + EntityPlayer var2 = (EntityPlayer)var1.next(); + if(var2.isPlayerSleeping()) { + var2.wakeUpPlayer(false, false, true); + } + } + + this.stopPrecipitation(); + } + + public boolean isAllPlayersFullyAsleep() { + if(this.allPlayersSleeping && !this.multiplayerWorld) { + Iterator var1 = this.playerEntities.iterator(); + + EntityPlayer var2; + do { + if(!var1.hasNext()) { + return true; + } + + var2 = (EntityPlayer)var1.next(); + } while(var2.isPlayerFullyAsleep()); + + return false; + } else { + return false; + } + } + + public float func_27166_f(float var1) { + return (this.prevThunderingStrength + (this.thunderingStrength - this.prevThunderingStrength) * var1) * this.func_27162_g(var1); + } + + public float func_27162_g(float var1) { + return this.prevRainingStrength + (this.rainingStrength - this.prevRainingStrength) * var1; + } + + public void func_27158_h(float var1) { + this.prevRainingStrength = var1; + this.rainingStrength = var1; + } + + public boolean func_27160_B() { + return (double)this.func_27166_f(1.0F) > 0.9D; + } + + public boolean func_27161_C() { + return (double)this.func_27162_g(1.0F) > 0.2D; + } + + public boolean canBlockBeRainedOn(int var1, int var2, int var3) { + if(!this.func_27161_C()) { + return false; + } else if(!this.canBlockSeeTheSky(var1, var2, var3)) { + return false; + } else if(this.findTopSolidBlock(var1, var3) > var2) { + return false; + } else { + BiomeGenBase var4 = this.getWorldChunkManager().getBiomeGenAt(var1, var3); + return var4.getEnableSnow() ? false : var4.canSpawnLightningBolt(); + } + } + + public void setItemData(String var1, MapDataBase var2) { + this.field_28108_z.setData(var1, var2); + } + + public MapDataBase loadItemData(Class var1, String var2) { + return this.field_28108_z.loadData(var1, var2); + } + + public int getUniqueDataId(String var1) { + return this.field_28108_z.getUniqueDataId(var1); + } + + public void func_28106_e(int var1, int var2, int var3, int var4, int var5) { + this.func_28107_a((EntityPlayer)null, var1, var2, var3, var4, var5); + } + + public void func_28107_a(EntityPlayer var1, int var2, int var3, int var4, int var5, int var6) { + for(int var7 = 0; var7 < this.worldAccesses.size(); ++var7) { + ((IWorldAccess)this.worldAccesses.get(var7)).func_28136_a(var1, var2, var3, var4, var5, var6); + } + + } +} diff --git a/src/net/minecraft/src/WorldBlockPositionType.java b/src/net/minecraft/src/WorldBlockPositionType.java new file mode 100644 index 0000000..8248d94 --- /dev/null +++ b/src/net/minecraft/src/WorldBlockPositionType.java @@ -0,0 +1,21 @@ +package net.minecraft.src; + +class WorldBlockPositionType { + int field_1202_a; + int field_1201_b; + int field_1207_c; + int field_1206_d; + int field_1205_e; + int field_1204_f; + final WorldClient field_1203_g; + + public WorldBlockPositionType(WorldClient var1, int var2, int var3, int var4, int var5, int var6) { + this.field_1203_g = var1; + this.field_1202_a = var2; + this.field_1201_b = var3; + this.field_1207_c = var4; + this.field_1206_d = 80; + this.field_1205_e = var5; + this.field_1204_f = var6; + } +} diff --git a/src/net/minecraft/src/WorldChunkManager.java b/src/net/minecraft/src/WorldChunkManager.java new file mode 100644 index 0000000..035793a --- /dev/null +++ b/src/net/minecraft/src/WorldChunkManager.java @@ -0,0 +1,117 @@ +package net.minecraft.src; + +import java.util.Random; + +public class WorldChunkManager { + private NoiseGeneratorOctaves2 field_4194_e; + private NoiseGeneratorOctaves2 field_4193_f; + private NoiseGeneratorOctaves2 field_4192_g; + public double[] temperature; + public double[] humidity; + public double[] field_4196_c; + public BiomeGenBase[] field_4195_d; + + protected WorldChunkManager() { + } + + public WorldChunkManager(World var1) { + this.field_4194_e = new NoiseGeneratorOctaves2(new Random(var1.getRandomSeed() * 9871L), 4); + this.field_4193_f = new NoiseGeneratorOctaves2(new Random(var1.getRandomSeed() * 39811L), 4); + this.field_4192_g = new NoiseGeneratorOctaves2(new Random(var1.getRandomSeed() * 543321L), 2); + } + + public BiomeGenBase getBiomeGenAtChunkCoord(ChunkCoordIntPair var1) { + return this.getBiomeGenAt(var1.chunkXPos << 4, var1.chunkZPos << 4); + } + + public BiomeGenBase getBiomeGenAt(int var1, int var2) { + return this.func_4069_a(var1, var2, 1, 1)[0]; + } + + public double getTemperature(int var1, int var2) { + this.temperature = this.field_4194_e.func_4112_a(this.temperature, (double)var1, (double)var2, 1, 1, (double)0.025F, (double)0.025F, 0.5D); + return this.temperature[0]; + } + + public BiomeGenBase[] func_4069_a(int var1, int var2, int var3, int var4) { + this.field_4195_d = this.loadBlockGeneratorData(this.field_4195_d, var1, var2, var3, var4); + return this.field_4195_d; + } + + public double[] getTemperatures(double[] var1, int var2, int var3, int var4, int var5) { + if(var1 == null || var1.length < var4 * var5) { + var1 = new double[var4 * var5]; + } + + var1 = this.field_4194_e.func_4112_a(var1, (double)var2, (double)var3, var4, var5, (double)0.025F, (double)0.025F, 0.25D); + this.field_4196_c = this.field_4192_g.func_4112_a(this.field_4196_c, (double)var2, (double)var3, var4, var5, 0.25D, 0.25D, 0.5882352941176471D); + int var6 = 0; + + for(int var7 = 0; var7 < var4; ++var7) { + for(int var8 = 0; var8 < var5; ++var8) { + double var9 = this.field_4196_c[var6] * 1.1D + 0.5D; + double var11 = 0.01D; + double var13 = 1.0D - var11; + double var15 = (var1[var6] * 0.15D + 0.7D) * var13 + var9 * var11; + var15 = 1.0D - (1.0D - var15) * (1.0D - var15); + if(var15 < 0.0D) { + var15 = 0.0D; + } + + if(var15 > 1.0D) { + var15 = 1.0D; + } + + var1[var6] = var15; + ++var6; + } + } + + return var1; + } + + public BiomeGenBase[] loadBlockGeneratorData(BiomeGenBase[] var1, int var2, int var3, int var4, int var5) { + if(var1 == null || var1.length < var4 * var5) { + var1 = new BiomeGenBase[var4 * var5]; + } + + this.temperature = this.field_4194_e.func_4112_a(this.temperature, (double)var2, (double)var3, var4, var4, (double)0.025F, (double)0.025F, 0.25D); + this.humidity = this.field_4193_f.func_4112_a(this.humidity, (double)var2, (double)var3, var4, var4, (double)0.05F, (double)0.05F, 1.0D / 3.0D); + this.field_4196_c = this.field_4192_g.func_4112_a(this.field_4196_c, (double)var2, (double)var3, var4, var4, 0.25D, 0.25D, 0.5882352941176471D); + int var6 = 0; + + for(int var7 = 0; var7 < var4; ++var7) { + for(int var8 = 0; var8 < var5; ++var8) { + double var9 = this.field_4196_c[var6] * 1.1D + 0.5D; + double var11 = 0.01D; + double var13 = 1.0D - var11; + double var15 = (this.temperature[var6] * 0.15D + 0.7D) * var13 + var9 * var11; + var11 = 0.002D; + var13 = 1.0D - var11; + double var17 = (this.humidity[var6] * 0.15D + 0.5D) * var13 + var9 * var11; + var15 = 1.0D - (1.0D - var15) * (1.0D - var15); + if(var15 < 0.0D) { + var15 = 0.0D; + } + + if(var17 < 0.0D) { + var17 = 0.0D; + } + + if(var15 > 1.0D) { + var15 = 1.0D; + } + + if(var17 > 1.0D) { + var17 = 1.0D; + } + + this.temperature[var6] = var15; + this.humidity[var6] = var17; + var1[var6++] = BiomeGenBase.getBiomeFromLookup(var15, var17); + } + } + + return var1; + } +} diff --git a/src/net/minecraft/src/WorldChunkManagerHell.java b/src/net/minecraft/src/WorldChunkManagerHell.java new file mode 100644 index 0000000..f8953ca --- /dev/null +++ b/src/net/minecraft/src/WorldChunkManagerHell.java @@ -0,0 +1,57 @@ +package net.minecraft.src; + +import java.util.Arrays; + +public class WorldChunkManagerHell extends WorldChunkManager { + private BiomeGenBase field_4201_e; + private double field_4200_f; + private double field_4199_g; + + public WorldChunkManagerHell(BiomeGenBase var1, double var2, double var4) { + this.field_4201_e = var1; + this.field_4200_f = var2; + this.field_4199_g = var4; + } + + public BiomeGenBase getBiomeGenAtChunkCoord(ChunkCoordIntPair var1) { + return this.field_4201_e; + } + + public BiomeGenBase getBiomeGenAt(int var1, int var2) { + return this.field_4201_e; + } + + public double getTemperature(int var1, int var2) { + return this.field_4200_f; + } + + public BiomeGenBase[] func_4069_a(int var1, int var2, int var3, int var4) { + this.field_4195_d = this.loadBlockGeneratorData(this.field_4195_d, var1, var2, var3, var4); + return this.field_4195_d; + } + + public double[] getTemperatures(double[] var1, int var2, int var3, int var4, int var5) { + if(var1 == null || var1.length < var4 * var5) { + var1 = new double[var4 * var5]; + } + + Arrays.fill(var1, 0, var4 * var5, this.field_4200_f); + return var1; + } + + public BiomeGenBase[] loadBlockGeneratorData(BiomeGenBase[] var1, int var2, int var3, int var4, int var5) { + if(var1 == null || var1.length < var4 * var5) { + var1 = new BiomeGenBase[var4 * var5]; + } + + if(this.temperature == null || this.temperature.length < var4 * var5) { + this.temperature = new double[var4 * var5]; + this.humidity = new double[var4 * var5]; + } + + Arrays.fill(var1, 0, var4 * var5, this.field_4201_e); + Arrays.fill(this.humidity, 0, var4 * var5, this.field_4199_g); + Arrays.fill(this.temperature, 0, var4 * var5, this.field_4200_f); + return var1; + } +} diff --git a/src/net/minecraft/src/WorldClient.java b/src/net/minecraft/src/WorldClient.java new file mode 100644 index 0000000..1f7d8a4 --- /dev/null +++ b/src/net/minecraft/src/WorldClient.java @@ -0,0 +1,241 @@ +package net.minecraft.src; + +import java.util.HashSet; +import java.util.LinkedList; +import java.util.Set; + +public class WorldClient extends World { + private LinkedList field_1057_z = new LinkedList(); + private NetClientHandler sendQueue; + private ChunkProviderClient field_20915_C; + private MCHash field_1055_D = new MCHash(); + private Set field_20914_E = new HashSet(); + private Set field_1053_F = new HashSet(); + + public WorldClient(NetClientHandler var1, long var2, int var4) { + super(new SaveHandlerMP(), "MpServer", WorldProvider.getProviderForDimension(var4), var2); + this.sendQueue = var1; + this.setSpawnPoint(new ChunkCoordinates(8, 64, 8)); + this.field_28108_z = var1.field_28118_b; + } + + public void tick() { + this.setWorldTime(this.getWorldTime() + 1L); + int var1 = this.calculateSkylightSubtracted(1.0F); + int var2; + if(var1 != this.skylightSubtracted) { + this.skylightSubtracted = var1; + + for(var2 = 0; var2 < this.worldAccesses.size(); ++var2) { + ((IWorldAccess)this.worldAccesses.get(var2)).updateAllRenderers(); + } + } + + for(var2 = 0; var2 < 10 && !this.field_1053_F.isEmpty(); ++var2) { + Entity var3 = (Entity)this.field_1053_F.iterator().next(); + if(!this.loadedEntityList.contains(var3)) { + this.entityJoinedWorld(var3); + } + } + + this.sendQueue.processReadPackets(); + + for(var2 = 0; var2 < this.field_1057_z.size(); ++var2) { + WorldBlockPositionType var4 = (WorldBlockPositionType)this.field_1057_z.get(var2); + if(--var4.field_1206_d == 0) { + super.setBlockAndMetadata(var4.field_1202_a, var4.field_1201_b, var4.field_1207_c, var4.field_1205_e, var4.field_1204_f); + super.markBlockNeedsUpdate(var4.field_1202_a, var4.field_1201_b, var4.field_1207_c); + this.field_1057_z.remove(var2--); + } + } + + } + + public void func_711_c(int var1, int var2, int var3, int var4, int var5, int var6) { + for(int var7 = 0; var7 < this.field_1057_z.size(); ++var7) { + WorldBlockPositionType var8 = (WorldBlockPositionType)this.field_1057_z.get(var7); + if(var8.field_1202_a >= var1 && var8.field_1201_b >= var2 && var8.field_1207_c >= var3 && var8.field_1202_a <= var4 && var8.field_1201_b <= var5 && var8.field_1207_c <= var6) { + this.field_1057_z.remove(var7--); + } + } + + } + + protected IChunkProvider getChunkProvider() { + this.field_20915_C = new ChunkProviderClient(this); + return this.field_20915_C; + } + + public void setSpawnLocation() { + this.setSpawnPoint(new ChunkCoordinates(8, 64, 8)); + } + + protected void updateBlocksAndPlayCaveSounds() { + } + + public void scheduleBlockUpdate(int var1, int var2, int var3, int var4, int var5) { + } + + public boolean TickUpdates(boolean var1) { + return false; + } + + public void doPreChunk(int var1, int var2, boolean var3) { + if(var3) { + this.field_20915_C.prepareChunk(var1, var2); + } else { + this.field_20915_C.func_539_c(var1, var2); + } + + if(!var3) { + this.markBlocksDirty(var1 * 16, 0, var2 * 16, var1 * 16 + 15, 128, var2 * 16 + 15); + } + + } + + public boolean entityJoinedWorld(Entity var1) { + boolean var2 = super.entityJoinedWorld(var1); + this.field_20914_E.add(var1); + if(!var2) { + this.field_1053_F.add(var1); + } + + return var2; + } + + public void setEntityDead(Entity var1) { + super.setEntityDead(var1); + this.field_20914_E.remove(var1); + } + + protected void obtainEntitySkin(Entity var1) { + super.obtainEntitySkin(var1); + if(this.field_1053_F.contains(var1)) { + this.field_1053_F.remove(var1); + } + + } + + protected void releaseEntitySkin(Entity var1) { + super.releaseEntitySkin(var1); + if(this.field_20914_E.contains(var1)) { + this.field_1053_F.add(var1); + } + + } + + public void func_712_a(int var1, Entity var2) { + Entity var3 = this.func_709_b(var1); + if(var3 != null) { + this.setEntityDead(var3); + } + + this.field_20914_E.add(var2); + var2.entityId = var1; + if(!this.entityJoinedWorld(var2)) { + this.field_1053_F.add(var2); + } + + this.field_1055_D.addKey(var1, var2); + } + + public Entity func_709_b(int var1) { + return (Entity)this.field_1055_D.lookup(var1); + } + + public Entity removeEntityFromWorld(int var1) { + Entity var2 = (Entity)this.field_1055_D.removeObject(var1); + if(var2 != null) { + this.field_20914_E.remove(var2); + this.setEntityDead(var2); + } + + return var2; + } + + public boolean setBlockMetadata(int var1, int var2, int var3, int var4) { + int var5 = this.getBlockId(var1, var2, var3); + int var6 = this.getBlockMetadata(var1, var2, var3); + if(super.setBlockMetadata(var1, var2, var3, var4)) { + this.field_1057_z.add(new WorldBlockPositionType(this, var1, var2, var3, var5, var6)); + return true; + } else { + return false; + } + } + + public boolean setBlockAndMetadata(int var1, int var2, int var3, int var4, int var5) { + int var6 = this.getBlockId(var1, var2, var3); + int var7 = this.getBlockMetadata(var1, var2, var3); + if(super.setBlockAndMetadata(var1, var2, var3, var4, var5)) { + this.field_1057_z.add(new WorldBlockPositionType(this, var1, var2, var3, var6, var7)); + return true; + } else { + return false; + } + } + + public boolean setBlock(int var1, int var2, int var3, int var4) { + int var5 = this.getBlockId(var1, var2, var3); + int var6 = this.getBlockMetadata(var1, var2, var3); + if(super.setBlock(var1, var2, var3, var4)) { + this.field_1057_z.add(new WorldBlockPositionType(this, var1, var2, var3, var5, var6)); + return true; + } else { + return false; + } + } + + public boolean func_714_c(int var1, int var2, int var3, int var4, int var5) { + this.func_711_c(var1, var2, var3, var1, var2, var3); + if(super.setBlockAndMetadata(var1, var2, var3, var4, var5)) { + this.notifyBlockChange(var1, var2, var3, var4); + return true; + } else { + return false; + } + } + + public void sendQuittingDisconnectingPacket() { + this.sendQueue.func_28117_a(new Packet255KickDisconnect("Quitting")); + } + + protected void updateWeather() { + if(!this.worldProvider.hasNoSky) { + if(this.field_27168_F > 0) { + --this.field_27168_F; + } + + this.prevRainingStrength = this.rainingStrength; + if(this.worldInfo.getRaining()) { + this.rainingStrength = (float)((double)this.rainingStrength + 0.01D); + } else { + this.rainingStrength = (float)((double)this.rainingStrength - 0.01D); + } + + if(this.rainingStrength < 0.0F) { + this.rainingStrength = 0.0F; + } + + if(this.rainingStrength > 1.0F) { + this.rainingStrength = 1.0F; + } + + this.prevThunderingStrength = this.thunderingStrength; + if(this.worldInfo.getThundering()) { + this.thunderingStrength = (float)((double)this.thunderingStrength + 0.01D); + } else { + this.thunderingStrength = (float)((double)this.thunderingStrength - 0.01D); + } + + if(this.thunderingStrength < 0.0F) { + this.thunderingStrength = 0.0F; + } + + if(this.thunderingStrength > 1.0F) { + this.thunderingStrength = 1.0F; + } + + } + } +} diff --git a/src/net/minecraft/src/WorldGenBigTree.java b/src/net/minecraft/src/WorldGenBigTree.java new file mode 100644 index 0000000..6b76ffb --- /dev/null +++ b/src/net/minecraft/src/WorldGenBigTree.java @@ -0,0 +1,348 @@ +package net.minecraft.src; + +import java.util.Random; + +public class WorldGenBigTree extends WorldGenerator { + static final byte[] field_882_a = new byte[]{(byte)2, (byte)0, (byte)0, (byte)1, (byte)2, (byte)1}; + Random field_881_b = new Random(); + World worldObj; + int[] basePos = new int[]{0, 0, 0}; + int field_878_e = 0; + int height; + double field_876_g = 0.618D; + double field_875_h = 1.0D; + double field_874_i = 0.381D; + double field_873_j = 1.0D; + double field_872_k = 1.0D; + int field_871_l = 1; + int field_870_m = 12; + int field_869_n = 4; + int[][] field_868_o; + + void func_521_a() { + this.height = (int)((double)this.field_878_e * this.field_876_g); + if(this.height >= this.field_878_e) { + this.height = this.field_878_e - 1; + } + + int var1 = (int)(1.382D + Math.pow(this.field_872_k * (double)this.field_878_e / 13.0D, 2.0D)); + if(var1 < 1) { + var1 = 1; + } + + int[][] var2 = new int[var1 * this.field_878_e][4]; + int var3 = this.basePos[1] + this.field_878_e - this.field_869_n; + int var4 = 1; + int var5 = this.basePos[1] + this.height; + int var6 = var3 - this.basePos[1]; + var2[0][0] = this.basePos[0]; + var2[0][1] = var3; + var2[0][2] = this.basePos[2]; + var2[0][3] = var5; + --var3; + + while(true) { + while(var6 >= 0) { + int var7 = 0; + float var8 = this.func_528_a(var6); + if(var8 < 0.0F) { + --var3; + --var6; + } else { + for(double var9 = 0.5D; var7 < var1; ++var7) { + double var11 = this.field_873_j * (double)var8 * ((double)this.field_881_b.nextFloat() + 0.328D); + double var13 = (double)this.field_881_b.nextFloat() * 2.0D * 3.14159D; + int var15 = MathHelper.floor_double(var11 * Math.sin(var13) + (double)this.basePos[0] + var9); + int var16 = MathHelper.floor_double(var11 * Math.cos(var13) + (double)this.basePos[2] + var9); + int[] var17 = new int[]{var15, var3, var16}; + int[] var18 = new int[]{var15, var3 + this.field_869_n, var16}; + if(this.func_524_a(var17, var18) == -1) { + int[] var19 = new int[]{this.basePos[0], this.basePos[1], this.basePos[2]}; + double var20 = Math.sqrt(Math.pow((double)Math.abs(this.basePos[0] - var17[0]), 2.0D) + Math.pow((double)Math.abs(this.basePos[2] - var17[2]), 2.0D)); + double var22 = var20 * this.field_874_i; + if((double)var17[1] - var22 > (double)var5) { + var19[1] = var5; + } else { + var19[1] = (int)((double)var17[1] - var22); + } + + if(this.func_524_a(var19, var17) == -1) { + var2[var4][0] = var15; + var2[var4][1] = var3; + var2[var4][2] = var16; + var2[var4][3] = var19[1]; + ++var4; + } + } + } + + --var3; + --var6; + } + } + + this.field_868_o = new int[var4][4]; + System.arraycopy(var2, 0, this.field_868_o, 0, var4); + return; + } + } + + void func_523_a(int var1, int var2, int var3, float var4, byte var5, int var6) { + int var7 = (int)((double)var4 + 0.618D); + byte var8 = field_882_a[var5]; + byte var9 = field_882_a[var5 + 3]; + int[] var10 = new int[]{var1, var2, var3}; + int[] var11 = new int[]{0, 0, 0}; + int var12 = -var7; + int var13 = -var7; + + label32: + for(var11[var5] = var10[var5]; var12 <= var7; ++var12) { + var11[var8] = var10[var8] + var12; + var13 = -var7; + + while(true) { + while(true) { + if(var13 > var7) { + continue label32; + } + + double var15 = Math.sqrt(Math.pow((double)Math.abs(var12) + 0.5D, 2.0D) + Math.pow((double)Math.abs(var13) + 0.5D, 2.0D)); + if(var15 > (double)var4) { + ++var13; + } else { + var11[var9] = var10[var9] + var13; + int var14 = this.worldObj.getBlockId(var11[0], var11[1], var11[2]); + if(var14 != 0 && var14 != 18) { + ++var13; + } else { + this.worldObj.setBlock(var11[0], var11[1], var11[2], var6); + ++var13; + } + } + } + } + } + + } + + float func_528_a(int var1) { + if((double)var1 < (double)((float)this.field_878_e) * 0.3D) { + return -1.618F; + } else { + float var2 = (float)this.field_878_e / 2.0F; + float var3 = (float)this.field_878_e / 2.0F - (float)var1; + float var4; + if(var3 == 0.0F) { + var4 = var2; + } else if(Math.abs(var3) >= var2) { + var4 = 0.0F; + } else { + var4 = (float)Math.sqrt(Math.pow((double)Math.abs(var2), 2.0D) - Math.pow((double)Math.abs(var3), 2.0D)); + } + + var4 *= 0.5F; + return var4; + } + } + + float func_526_b(int var1) { + return var1 >= 0 && var1 < this.field_869_n ? (var1 != 0 && var1 != this.field_869_n - 1 ? 3.0F : 2.0F) : -1.0F; + } + + void func_520_a(int var1, int var2, int var3) { + int var4 = var2; + + for(int var5 = var2 + this.field_869_n; var4 < var5; ++var4) { + float var6 = this.func_526_b(var4 - var2); + this.func_523_a(var1, var4, var3, var6, (byte)1, 18); + } + + } + + void func_522_a(int[] var1, int[] var2, int var3) { + int[] var4 = new int[]{0, 0, 0}; + byte var5 = 0; + + byte var6; + for(var6 = 0; var5 < 3; ++var5) { + var4[var5] = var2[var5] - var1[var5]; + if(Math.abs(var4[var5]) > Math.abs(var4[var6])) { + var6 = var5; + } + } + + if(var4[var6] != 0) { + byte var7 = field_882_a[var6]; + byte var8 = field_882_a[var6 + 3]; + byte var9; + if(var4[var6] > 0) { + var9 = 1; + } else { + var9 = -1; + } + + double var10 = (double)var4[var7] / (double)var4[var6]; + double var12 = (double)var4[var8] / (double)var4[var6]; + int[] var14 = new int[]{0, 0, 0}; + int var15 = 0; + + for(int var16 = var4[var6] + var9; var15 != var16; var15 += var9) { + var14[var6] = MathHelper.floor_double((double)(var1[var6] + var15) + 0.5D); + var14[var7] = MathHelper.floor_double((double)var1[var7] + (double)var15 * var10 + 0.5D); + var14[var8] = MathHelper.floor_double((double)var1[var8] + (double)var15 * var12 + 0.5D); + this.worldObj.setBlock(var14[0], var14[1], var14[2], var3); + } + + } + } + + void func_518_b() { + int var1 = 0; + + for(int var2 = this.field_868_o.length; var1 < var2; ++var1) { + int var3 = this.field_868_o[var1][0]; + int var4 = this.field_868_o[var1][1]; + int var5 = this.field_868_o[var1][2]; + this.func_520_a(var3, var4, var5); + } + + } + + boolean func_527_c(int var1) { + return (double)var1 >= (double)this.field_878_e * 0.2D; + } + + void func_529_c() { + int var1 = this.basePos[0]; + int var2 = this.basePos[1]; + int var3 = this.basePos[1] + this.height; + int var4 = this.basePos[2]; + int[] var5 = new int[]{var1, var2, var4}; + int[] var6 = new int[]{var1, var3, var4}; + this.func_522_a(var5, var6, 17); + if(this.field_871_l == 2) { + ++var5[0]; + ++var6[0]; + this.func_522_a(var5, var6, 17); + ++var5[2]; + ++var6[2]; + this.func_522_a(var5, var6, 17); + var5[0] += -1; + var6[0] += -1; + this.func_522_a(var5, var6, 17); + } + + } + + void func_525_d() { + int var1 = 0; + int var2 = this.field_868_o.length; + + for(int[] var3 = new int[]{this.basePos[0], this.basePos[1], this.basePos[2]}; var1 < var2; ++var1) { + int[] var4 = this.field_868_o[var1]; + int[] var5 = new int[]{var4[0], var4[1], var4[2]}; + var3[1] = var4[3]; + int var6 = var3[1] - this.basePos[1]; + if(this.func_527_c(var6)) { + this.func_522_a(var3, var5, 17); + } + } + + } + + int func_524_a(int[] var1, int[] var2) { + int[] var3 = new int[]{0, 0, 0}; + byte var4 = 0; + + byte var5; + for(var5 = 0; var4 < 3; ++var4) { + var3[var4] = var2[var4] - var1[var4]; + if(Math.abs(var3[var4]) > Math.abs(var3[var5])) { + var5 = var4; + } + } + + if(var3[var5] == 0) { + return -1; + } else { + byte var6 = field_882_a[var5]; + byte var7 = field_882_a[var5 + 3]; + byte var8; + if(var3[var5] > 0) { + var8 = 1; + } else { + var8 = -1; + } + + double var9 = (double)var3[var6] / (double)var3[var5]; + double var11 = (double)var3[var7] / (double)var3[var5]; + int[] var13 = new int[]{0, 0, 0}; + int var14 = 0; + + int var15; + for(var15 = var3[var5] + var8; var14 != var15; var14 += var8) { + var13[var5] = var1[var5] + var14; + var13[var6] = MathHelper.floor_double((double)var1[var6] + (double)var14 * var9); + var13[var7] = MathHelper.floor_double((double)var1[var7] + (double)var14 * var11); + int var16 = this.worldObj.getBlockId(var13[0], var13[1], var13[2]); + if(var16 != 0 && var16 != 18) { + break; + } + } + + return var14 == var15 ? -1 : Math.abs(var14); + } + } + + boolean func_519_e() { + int[] var1 = new int[]{this.basePos[0], this.basePos[1], this.basePos[2]}; + int[] var2 = new int[]{this.basePos[0], this.basePos[1] + this.field_878_e - 1, this.basePos[2]}; + int var3 = this.worldObj.getBlockId(this.basePos[0], this.basePos[1] - 1, this.basePos[2]); + if(var3 != 2 && var3 != 3) { + return false; + } else { + int var4 = this.func_524_a(var1, var2); + if(var4 == -1) { + return true; + } else if(var4 < 6) { + return false; + } else { + this.field_878_e = var4; + return true; + } + } + } + + public void func_517_a(double var1, double var3, double var5) { + this.field_870_m = (int)(var1 * 12.0D); + if(var1 > 0.5D) { + this.field_869_n = 5; + } + + this.field_873_j = var3; + this.field_872_k = var5; + } + + public boolean generate(World var1, Random var2, int var3, int var4, int var5) { + this.worldObj = var1; + long var6 = var2.nextLong(); + this.field_881_b.setSeed(var6); + this.basePos[0] = var3; + this.basePos[1] = var4; + this.basePos[2] = var5; + if(this.field_878_e == 0) { + this.field_878_e = 5 + this.field_881_b.nextInt(this.field_870_m); + } + + if(!this.func_519_e()) { + return false; + } else { + this.func_521_a(); + this.func_518_b(); + this.func_529_c(); + this.func_525_d(); + return true; + } + } +} diff --git a/src/net/minecraft/src/WorldGenCactus.java b/src/net/minecraft/src/WorldGenCactus.java new file mode 100644 index 0000000..f2b51f3 --- /dev/null +++ b/src/net/minecraft/src/WorldGenCactus.java @@ -0,0 +1,24 @@ +package net.minecraft.src; + +import java.util.Random; + +public class WorldGenCactus extends WorldGenerator { + public boolean generate(World var1, Random var2, int var3, int var4, int var5) { + for(int var6 = 0; var6 < 10; ++var6) { + int var7 = var3 + var2.nextInt(8) - var2.nextInt(8); + int var8 = var4 + var2.nextInt(4) - var2.nextInt(4); + int var9 = var5 + var2.nextInt(8) - var2.nextInt(8); + if(var1.isAirBlock(var7, var8, var9)) { + int var10 = 1 + var2.nextInt(var2.nextInt(3) + 1); + + for(int var11 = 0; var11 < var10; ++var11) { + if(Block.cactus.canBlockStay(var1, var7, var8 + var11, var9)) { + var1.setBlock(var7, var8 + var11, var9, Block.cactus.blockID); + } + } + } + } + + return true; + } +} diff --git a/src/net/minecraft/src/WorldGenClay.java b/src/net/minecraft/src/WorldGenClay.java new file mode 100644 index 0000000..eb76ece --- /dev/null +++ b/src/net/minecraft/src/WorldGenClay.java @@ -0,0 +1,59 @@ +package net.minecraft.src; + +import java.util.Random; + +public class WorldGenClay extends WorldGenerator { + private int clayBlockId = Block.blockClay.blockID; + private int numberOfBlocks; + + public WorldGenClay(int var1) { + this.numberOfBlocks = var1; + } + + public boolean generate(World var1, Random var2, int var3, int var4, int var5) { + if(var1.getBlockMaterial(var3, var4, var5) != Material.water) { + return false; + } else { + float var6 = var2.nextFloat() * (float)Math.PI; + double var7 = (double)((float)(var3 + 8) + MathHelper.sin(var6) * (float)this.numberOfBlocks / 8.0F); + double var9 = (double)((float)(var3 + 8) - MathHelper.sin(var6) * (float)this.numberOfBlocks / 8.0F); + double var11 = (double)((float)(var5 + 8) + MathHelper.cos(var6) * (float)this.numberOfBlocks / 8.0F); + double var13 = (double)((float)(var5 + 8) - MathHelper.cos(var6) * (float)this.numberOfBlocks / 8.0F); + double var15 = (double)(var4 + var2.nextInt(3) + 2); + double var17 = (double)(var4 + var2.nextInt(3) + 2); + + for(int var19 = 0; var19 <= this.numberOfBlocks; ++var19) { + double var20 = var7 + (var9 - var7) * (double)var19 / (double)this.numberOfBlocks; + double var22 = var15 + (var17 - var15) * (double)var19 / (double)this.numberOfBlocks; + double var24 = var11 + (var13 - var11) * (double)var19 / (double)this.numberOfBlocks; + double var26 = var2.nextDouble() * (double)this.numberOfBlocks / 16.0D; + double var28 = (double)(MathHelper.sin((float)var19 * (float)Math.PI / (float)this.numberOfBlocks) + 1.0F) * var26 + 1.0D; + double var30 = (double)(MathHelper.sin((float)var19 * (float)Math.PI / (float)this.numberOfBlocks) + 1.0F) * var26 + 1.0D; + int var32 = MathHelper.floor_double(var20 - var28 / 2.0D); + int var33 = MathHelper.floor_double(var20 + var28 / 2.0D); + int var34 = MathHelper.floor_double(var22 - var30 / 2.0D); + int var35 = MathHelper.floor_double(var22 + var30 / 2.0D); + int var36 = MathHelper.floor_double(var24 - var28 / 2.0D); + int var37 = MathHelper.floor_double(var24 + var28 / 2.0D); + + for(int var38 = var32; var38 <= var33; ++var38) { + for(int var39 = var34; var39 <= var35; ++var39) { + for(int var40 = var36; var40 <= var37; ++var40) { + double var41 = ((double)var38 + 0.5D - var20) / (var28 / 2.0D); + double var43 = ((double)var39 + 0.5D - var22) / (var30 / 2.0D); + double var45 = ((double)var40 + 0.5D - var24) / (var28 / 2.0D); + if(var41 * var41 + var43 * var43 + var45 * var45 < 1.0D) { + int var47 = var1.getBlockId(var38, var39, var40); + if(var47 == Block.sand.blockID) { + var1.setBlock(var38, var39, var40, this.clayBlockId); + } + } + } + } + } + } + + return true; + } + } +} diff --git a/src/net/minecraft/src/WorldGenDeadBush.java b/src/net/minecraft/src/WorldGenDeadBush.java new file mode 100644 index 0000000..ceb98fb --- /dev/null +++ b/src/net/minecraft/src/WorldGenDeadBush.java @@ -0,0 +1,33 @@ +package net.minecraft.src; + +import java.util.Random; + +public class WorldGenDeadBush extends WorldGenerator { + private int field_28058_a; + + public WorldGenDeadBush(int var1) { + this.field_28058_a = var1; + } + + public boolean generate(World var1, Random var2, int var3, int var4, int var5) { + boolean var6 = false; + + while(true) { + int var11 = var1.getBlockId(var3, var4, var5); + if(var11 != 0 && var11 != Block.leaves.blockID || var4 <= 0) { + for(int var7 = 0; var7 < 4; ++var7) { + int var8 = var3 + var2.nextInt(8) - var2.nextInt(8); + int var9 = var4 + var2.nextInt(4) - var2.nextInt(4); + int var10 = var5 + var2.nextInt(8) - var2.nextInt(8); + if(var1.isAirBlock(var8, var9, var10) && ((BlockFlower)Block.blocksList[this.field_28058_a]).canBlockStay(var1, var8, var9, var10)) { + var1.setBlock(var8, var9, var10, this.field_28058_a); + } + } + + return true; + } + + --var4; + } + } +} diff --git a/src/net/minecraft/src/WorldGenDungeons.java b/src/net/minecraft/src/WorldGenDungeons.java new file mode 100644 index 0000000..b577821 --- /dev/null +++ b/src/net/minecraft/src/WorldGenDungeons.java @@ -0,0 +1,116 @@ +package net.minecraft.src; + +import java.util.Random; + +public class WorldGenDungeons extends WorldGenerator { + public boolean generate(World var1, Random var2, int var3, int var4, int var5) { + byte var6 = 3; + int var7 = var2.nextInt(2) + 2; + int var8 = var2.nextInt(2) + 2; + int var9 = 0; + + int var10; + int var11; + int var12; + for(var10 = var3 - var7 - 1; var10 <= var3 + var7 + 1; ++var10) { + for(var11 = var4 - 1; var11 <= var4 + var6 + 1; ++var11) { + for(var12 = var5 - var8 - 1; var12 <= var5 + var8 + 1; ++var12) { + Material var13 = var1.getBlockMaterial(var10, var11, var12); + if(var11 == var4 - 1 && !var13.isSolid()) { + return false; + } + + if(var11 == var4 + var6 + 1 && !var13.isSolid()) { + return false; + } + + if((var10 == var3 - var7 - 1 || var10 == var3 + var7 + 1 || var12 == var5 - var8 - 1 || var12 == var5 + var8 + 1) && var11 == var4 && var1.isAirBlock(var10, var11, var12) && var1.isAirBlock(var10, var11 + 1, var12)) { + ++var9; + } + } + } + } + + if(var9 >= 1 && var9 <= 5) { + for(var10 = var3 - var7 - 1; var10 <= var3 + var7 + 1; ++var10) { + for(var11 = var4 + var6; var11 >= var4 - 1; --var11) { + for(var12 = var5 - var8 - 1; var12 <= var5 + var8 + 1; ++var12) { + if(var10 != var3 - var7 - 1 && var11 != var4 - 1 && var12 != var5 - var8 - 1 && var10 != var3 + var7 + 1 && var11 != var4 + var6 + 1 && var12 != var5 + var8 + 1) { + var1.setBlockWithNotify(var10, var11, var12, 0); + } else if(var11 >= 0 && !var1.getBlockMaterial(var10, var11 - 1, var12).isSolid()) { + var1.setBlockWithNotify(var10, var11, var12, 0); + } else if(var1.getBlockMaterial(var10, var11, var12).isSolid()) { + if(var11 == var4 - 1 && var2.nextInt(4) != 0) { + var1.setBlockWithNotify(var10, var11, var12, Block.cobblestoneMossy.blockID); + } else { + var1.setBlockWithNotify(var10, var11, var12, Block.cobblestone.blockID); + } + } + } + } + } + + label110: + for(var10 = 0; var10 < 2; ++var10) { + for(var11 = 0; var11 < 3; ++var11) { + var12 = var3 + var2.nextInt(var7 * 2 + 1) - var7; + int var14 = var5 + var2.nextInt(var8 * 2 + 1) - var8; + if(var1.isAirBlock(var12, var4, var14)) { + int var15 = 0; + if(var1.getBlockMaterial(var12 - 1, var4, var14).isSolid()) { + ++var15; + } + + if(var1.getBlockMaterial(var12 + 1, var4, var14).isSolid()) { + ++var15; + } + + if(var1.getBlockMaterial(var12, var4, var14 - 1).isSolid()) { + ++var15; + } + + if(var1.getBlockMaterial(var12, var4, var14 + 1).isSolid()) { + ++var15; + } + + if(var15 == 1) { + var1.setBlockWithNotify(var12, var4, var14, Block.chest.blockID); + TileEntityChest var16 = (TileEntityChest)var1.getBlockTileEntity(var12, var4, var14); + int var17 = 0; + + while(true) { + if(var17 >= 8) { + continue label110; + } + + ItemStack var18 = this.pickCheckLootItem(var2); + if(var18 != null) { + var16.setInventorySlotContents(var2.nextInt(var16.getSizeInventory()), var18); + } + + ++var17; + } + } + } + } + } + + var1.setBlockWithNotify(var3, var4, var5, Block.mobSpawner.blockID); + TileEntityMobSpawner var19 = (TileEntityMobSpawner)var1.getBlockTileEntity(var3, var4, var5); + var19.setMobID(this.pickMobSpawner(var2)); + return true; + } else { + return false; + } + } + + private ItemStack pickCheckLootItem(Random var1) { + int var2 = var1.nextInt(11); + return var2 == 0 ? new ItemStack(Item.saddle) : (var2 == 1 ? new ItemStack(Item.ingotIron, var1.nextInt(4) + 1) : (var2 == 2 ? new ItemStack(Item.bread) : (var2 == 3 ? new ItemStack(Item.wheat, var1.nextInt(4) + 1) : (var2 == 4 ? new ItemStack(Item.gunpowder, var1.nextInt(4) + 1) : (var2 == 5 ? new ItemStack(Item.silk, var1.nextInt(4) + 1) : (var2 == 6 ? new ItemStack(Item.bucketEmpty) : (var2 == 7 && var1.nextInt(100) == 0 ? new ItemStack(Item.appleGold) : (var2 == 8 && var1.nextInt(2) == 0 ? new ItemStack(Item.redstone, var1.nextInt(4) + 1) : (var2 == 9 && var1.nextInt(10) == 0 ? new ItemStack(Item.itemsList[Item.record13.shiftedIndex + var1.nextInt(2)]) : (var2 == 10 ? new ItemStack(Item.dyePowder, 1, 3) : null)))))))))); + } + + private String pickMobSpawner(Random var1) { + int var2 = var1.nextInt(4); + return var2 == 0 ? "Skeleton" : (var2 == 1 ? "Zombie" : (var2 == 2 ? "Zombie" : (var2 == 3 ? "Spider" : ""))); + } +} diff --git a/src/net/minecraft/src/WorldGenFire.java b/src/net/minecraft/src/WorldGenFire.java new file mode 100644 index 0000000..7e57117 --- /dev/null +++ b/src/net/minecraft/src/WorldGenFire.java @@ -0,0 +1,18 @@ +package net.minecraft.src; + +import java.util.Random; + +public class WorldGenFire extends WorldGenerator { + public boolean generate(World var1, Random var2, int var3, int var4, int var5) { + for(int var6 = 0; var6 < 64; ++var6) { + int var7 = var3 + var2.nextInt(8) - var2.nextInt(8); + int var8 = var4 + var2.nextInt(4) - var2.nextInt(4); + int var9 = var5 + var2.nextInt(8) - var2.nextInt(8); + if(var1.isAirBlock(var7, var8, var9) && var1.getBlockId(var7, var8 - 1, var9) == Block.netherrack.blockID) { + var1.setBlockWithNotify(var7, var8, var9, Block.fire.blockID); + } + } + + return true; + } +} diff --git a/src/net/minecraft/src/WorldGenFlowers.java b/src/net/minecraft/src/WorldGenFlowers.java new file mode 100644 index 0000000..fdcd22b --- /dev/null +++ b/src/net/minecraft/src/WorldGenFlowers.java @@ -0,0 +1,24 @@ +package net.minecraft.src; + +import java.util.Random; + +public class WorldGenFlowers extends WorldGenerator { + private int plantBlockId; + + public WorldGenFlowers(int var1) { + this.plantBlockId = var1; + } + + public boolean generate(World var1, Random var2, int var3, int var4, int var5) { + for(int var6 = 0; var6 < 64; ++var6) { + int var7 = var3 + var2.nextInt(8) - var2.nextInt(8); + int var8 = var4 + var2.nextInt(4) - var2.nextInt(4); + int var9 = var5 + var2.nextInt(8) - var2.nextInt(8); + if(var1.isAirBlock(var7, var8, var9) && ((BlockFlower)Block.blocksList[this.plantBlockId]).canBlockStay(var1, var7, var8, var9)) { + var1.setBlock(var7, var8, var9, this.plantBlockId); + } + } + + return true; + } +} diff --git a/src/net/minecraft/src/WorldGenForest.java b/src/net/minecraft/src/WorldGenForest.java new file mode 100644 index 0000000..37a176a --- /dev/null +++ b/src/net/minecraft/src/WorldGenForest.java @@ -0,0 +1,78 @@ +package net.minecraft.src; + +import java.util.Random; + +public class WorldGenForest extends WorldGenerator { + public boolean generate(World var1, Random var2, int var3, int var4, int var5) { + int var6 = var2.nextInt(3) + 5; + boolean var7 = true; + if(var4 >= 1 && var4 + var6 + 1 <= 128) { + int var8; + int var10; + int var11; + int var12; + for(var8 = var4; var8 <= var4 + 1 + var6; ++var8) { + byte var9 = 1; + if(var8 == var4) { + var9 = 0; + } + + if(var8 >= var4 + 1 + var6 - 2) { + var9 = 2; + } + + for(var10 = var3 - var9; var10 <= var3 + var9 && var7; ++var10) { + for(var11 = var5 - var9; var11 <= var5 + var9 && var7; ++var11) { + if(var8 >= 0 && var8 < 128) { + var12 = var1.getBlockId(var10, var8, var11); + if(var12 != 0 && var12 != Block.leaves.blockID) { + var7 = false; + } + } else { + var7 = false; + } + } + } + } + + if(!var7) { + return false; + } else { + var8 = var1.getBlockId(var3, var4 - 1, var5); + if((var8 == Block.grass.blockID || var8 == Block.dirt.blockID) && var4 < 128 - var6 - 1) { + var1.setBlock(var3, var4 - 1, var5, Block.dirt.blockID); + + int var16; + for(var16 = var4 - 3 + var6; var16 <= var4 + var6; ++var16) { + var10 = var16 - (var4 + var6); + var11 = 1 - var10 / 2; + + for(var12 = var3 - var11; var12 <= var3 + var11; ++var12) { + int var13 = var12 - var3; + + for(int var14 = var5 - var11; var14 <= var5 + var11; ++var14) { + int var15 = var14 - var5; + if((Math.abs(var13) != var11 || Math.abs(var15) != var11 || var2.nextInt(2) != 0 && var10 != 0) && !Block.opaqueCubeLookup[var1.getBlockId(var12, var16, var14)]) { + var1.setBlockAndMetadata(var12, var16, var14, Block.leaves.blockID, 2); + } + } + } + } + + for(var16 = 0; var16 < var6; ++var16) { + var10 = var1.getBlockId(var3, var4 + var16, var5); + if(var10 == 0 || var10 == Block.leaves.blockID) { + var1.setBlockAndMetadata(var3, var4 + var16, var5, Block.wood.blockID, 2); + } + } + + return true; + } else { + return false; + } + } + } else { + return false; + } + } +} diff --git a/src/net/minecraft/src/WorldGenGlowStone1.java b/src/net/minecraft/src/WorldGenGlowStone1.java new file mode 100644 index 0000000..88eb6b9 --- /dev/null +++ b/src/net/minecraft/src/WorldGenGlowStone1.java @@ -0,0 +1,61 @@ +package net.minecraft.src; + +import java.util.Random; + +public class WorldGenGlowStone1 extends WorldGenerator { + public boolean generate(World var1, Random var2, int var3, int var4, int var5) { + if(!var1.isAirBlock(var3, var4, var5)) { + return false; + } else if(var1.getBlockId(var3, var4 + 1, var5) != Block.netherrack.blockID) { + return false; + } else { + var1.setBlockWithNotify(var3, var4, var5, Block.glowStone.blockID); + + for(int var6 = 0; var6 < 1500; ++var6) { + int var7 = var3 + var2.nextInt(8) - var2.nextInt(8); + int var8 = var4 - var2.nextInt(12); + int var9 = var5 + var2.nextInt(8) - var2.nextInt(8); + if(var1.getBlockId(var7, var8, var9) == 0) { + int var10 = 0; + + for(int var11 = 0; var11 < 6; ++var11) { + int var12 = 0; + if(var11 == 0) { + var12 = var1.getBlockId(var7 - 1, var8, var9); + } + + if(var11 == 1) { + var12 = var1.getBlockId(var7 + 1, var8, var9); + } + + if(var11 == 2) { + var12 = var1.getBlockId(var7, var8 - 1, var9); + } + + if(var11 == 3) { + var12 = var1.getBlockId(var7, var8 + 1, var9); + } + + if(var11 == 4) { + var12 = var1.getBlockId(var7, var8, var9 - 1); + } + + if(var11 == 5) { + var12 = var1.getBlockId(var7, var8, var9 + 1); + } + + if(var12 == Block.glowStone.blockID) { + ++var10; + } + } + + if(var10 == 1) { + var1.setBlockWithNotify(var7, var8, var9, Block.glowStone.blockID); + } + } + } + + return true; + } + } +} diff --git a/src/net/minecraft/src/WorldGenGlowStone2.java b/src/net/minecraft/src/WorldGenGlowStone2.java new file mode 100644 index 0000000..84f7c19 --- /dev/null +++ b/src/net/minecraft/src/WorldGenGlowStone2.java @@ -0,0 +1,61 @@ +package net.minecraft.src; + +import java.util.Random; + +public class WorldGenGlowStone2 extends WorldGenerator { + public boolean generate(World var1, Random var2, int var3, int var4, int var5) { + if(!var1.isAirBlock(var3, var4, var5)) { + return false; + } else if(var1.getBlockId(var3, var4 + 1, var5) != Block.netherrack.blockID) { + return false; + } else { + var1.setBlockWithNotify(var3, var4, var5, Block.glowStone.blockID); + + for(int var6 = 0; var6 < 1500; ++var6) { + int var7 = var3 + var2.nextInt(8) - var2.nextInt(8); + int var8 = var4 - var2.nextInt(12); + int var9 = var5 + var2.nextInt(8) - var2.nextInt(8); + if(var1.getBlockId(var7, var8, var9) == 0) { + int var10 = 0; + + for(int var11 = 0; var11 < 6; ++var11) { + int var12 = 0; + if(var11 == 0) { + var12 = var1.getBlockId(var7 - 1, var8, var9); + } + + if(var11 == 1) { + var12 = var1.getBlockId(var7 + 1, var8, var9); + } + + if(var11 == 2) { + var12 = var1.getBlockId(var7, var8 - 1, var9); + } + + if(var11 == 3) { + var12 = var1.getBlockId(var7, var8 + 1, var9); + } + + if(var11 == 4) { + var12 = var1.getBlockId(var7, var8, var9 - 1); + } + + if(var11 == 5) { + var12 = var1.getBlockId(var7, var8, var9 + 1); + } + + if(var12 == Block.glowStone.blockID) { + ++var10; + } + } + + if(var10 == 1) { + var1.setBlockWithNotify(var7, var8, var9, Block.glowStone.blockID); + } + } + } + + return true; + } + } +} diff --git a/src/net/minecraft/src/WorldGenHellLava.java b/src/net/minecraft/src/WorldGenHellLava.java new file mode 100644 index 0000000..b7d1573 --- /dev/null +++ b/src/net/minecraft/src/WorldGenHellLava.java @@ -0,0 +1,70 @@ +package net.minecraft.src; + +import java.util.Random; + +public class WorldGenHellLava extends WorldGenerator { + private int field_4158_a; + + public WorldGenHellLava(int var1) { + this.field_4158_a = var1; + } + + public boolean generate(World var1, Random var2, int var3, int var4, int var5) { + if(var1.getBlockId(var3, var4 + 1, var5) != Block.netherrack.blockID) { + return false; + } else if(var1.getBlockId(var3, var4, var5) != 0 && var1.getBlockId(var3, var4, var5) != Block.netherrack.blockID) { + return false; + } else { + int var6 = 0; + if(var1.getBlockId(var3 - 1, var4, var5) == Block.netherrack.blockID) { + ++var6; + } + + if(var1.getBlockId(var3 + 1, var4, var5) == Block.netherrack.blockID) { + ++var6; + } + + if(var1.getBlockId(var3, var4, var5 - 1) == Block.netherrack.blockID) { + ++var6; + } + + if(var1.getBlockId(var3, var4, var5 + 1) == Block.netherrack.blockID) { + ++var6; + } + + if(var1.getBlockId(var3, var4 - 1, var5) == Block.netherrack.blockID) { + ++var6; + } + + int var7 = 0; + if(var1.isAirBlock(var3 - 1, var4, var5)) { + ++var7; + } + + if(var1.isAirBlock(var3 + 1, var4, var5)) { + ++var7; + } + + if(var1.isAirBlock(var3, var4, var5 - 1)) { + ++var7; + } + + if(var1.isAirBlock(var3, var4, var5 + 1)) { + ++var7; + } + + if(var1.isAirBlock(var3, var4 - 1, var5)) { + ++var7; + } + + if(var6 == 4 && var7 == 1) { + var1.setBlockWithNotify(var3, var4, var5, this.field_4158_a); + var1.scheduledUpdatesAreImmediate = true; + Block.blocksList[this.field_4158_a].updateTick(var1, var3, var4, var5, var2); + var1.scheduledUpdatesAreImmediate = false; + } + + return true; + } + } +} diff --git a/src/net/minecraft/src/WorldGenLakes.java b/src/net/minecraft/src/WorldGenLakes.java new file mode 100644 index 0000000..303da07 --- /dev/null +++ b/src/net/minecraft/src/WorldGenLakes.java @@ -0,0 +1,102 @@ +package net.minecraft.src; + +import java.util.Random; + +public class WorldGenLakes extends WorldGenerator { + private int field_15235_a; + + public WorldGenLakes(int var1) { + this.field_15235_a = var1; + } + + public boolean generate(World var1, Random var2, int var3, int var4, int var5) { + var3 -= 8; + + for(var5 -= 8; var4 > 0 && var1.isAirBlock(var3, var4, var5); --var4) { + } + + var4 -= 4; + boolean[] var6 = new boolean[2048]; + int var7 = var2.nextInt(4) + 4; + + int var8; + for(var8 = 0; var8 < var7; ++var8) { + double var9 = var2.nextDouble() * 6.0D + 3.0D; + double var11 = var2.nextDouble() * 4.0D + 2.0D; + double var13 = var2.nextDouble() * 6.0D + 3.0D; + double var15 = var2.nextDouble() * (16.0D - var9 - 2.0D) + 1.0D + var9 / 2.0D; + double var17 = var2.nextDouble() * (8.0D - var11 - 4.0D) + 2.0D + var11 / 2.0D; + double var19 = var2.nextDouble() * (16.0D - var13 - 2.0D) + 1.0D + var13 / 2.0D; + + for(int var21 = 1; var21 < 15; ++var21) { + for(int var22 = 1; var22 < 15; ++var22) { + for(int var23 = 1; var23 < 7; ++var23) { + double var24 = ((double)var21 - var15) / (var9 / 2.0D); + double var26 = ((double)var23 - var17) / (var11 / 2.0D); + double var28 = ((double)var22 - var19) / (var13 / 2.0D); + double var30 = var24 * var24 + var26 * var26 + var28 * var28; + if(var30 < 1.0D) { + var6[(var21 * 16 + var22) * 8 + var23] = true; + } + } + } + } + } + + int var10; + int var32; + boolean var33; + for(var8 = 0; var8 < 16; ++var8) { + for(var32 = 0; var32 < 16; ++var32) { + for(var10 = 0; var10 < 8; ++var10) { + var33 = !var6[(var8 * 16 + var32) * 8 + var10] && (var8 < 15 && var6[((var8 + 1) * 16 + var32) * 8 + var10] || var8 > 0 && var6[((var8 - 1) * 16 + var32) * 8 + var10] || var32 < 15 && var6[(var8 * 16 + var32 + 1) * 8 + var10] || var32 > 0 && var6[(var8 * 16 + (var32 - 1)) * 8 + var10] || var10 < 7 && var6[(var8 * 16 + var32) * 8 + var10 + 1] || var10 > 0 && var6[(var8 * 16 + var32) * 8 + (var10 - 1)]); + if(var33) { + Material var12 = var1.getBlockMaterial(var3 + var8, var4 + var10, var5 + var32); + if(var10 >= 4 && var12.getIsLiquid()) { + return false; + } + + if(var10 < 4 && !var12.isSolid() && var1.getBlockId(var3 + var8, var4 + var10, var5 + var32) != this.field_15235_a) { + return false; + } + } + } + } + } + + for(var8 = 0; var8 < 16; ++var8) { + for(var32 = 0; var32 < 16; ++var32) { + for(var10 = 0; var10 < 8; ++var10) { + if(var6[(var8 * 16 + var32) * 8 + var10]) { + var1.setBlock(var3 + var8, var4 + var10, var5 + var32, var10 >= 4 ? 0 : this.field_15235_a); + } + } + } + } + + for(var8 = 0; var8 < 16; ++var8) { + for(var32 = 0; var32 < 16; ++var32) { + for(var10 = 4; var10 < 8; ++var10) { + if(var6[(var8 * 16 + var32) * 8 + var10] && var1.getBlockId(var3 + var8, var4 + var10 - 1, var5 + var32) == Block.dirt.blockID && var1.getSavedLightValue(EnumSkyBlock.Sky, var3 + var8, var4 + var10, var5 + var32) > 0) { + var1.setBlock(var3 + var8, var4 + var10 - 1, var5 + var32, Block.grass.blockID); + } + } + } + } + + if(Block.blocksList[this.field_15235_a].blockMaterial == Material.lava) { + for(var8 = 0; var8 < 16; ++var8) { + for(var32 = 0; var32 < 16; ++var32) { + for(var10 = 0; var10 < 8; ++var10) { + var33 = !var6[(var8 * 16 + var32) * 8 + var10] && (var8 < 15 && var6[((var8 + 1) * 16 + var32) * 8 + var10] || var8 > 0 && var6[((var8 - 1) * 16 + var32) * 8 + var10] || var32 < 15 && var6[(var8 * 16 + var32 + 1) * 8 + var10] || var32 > 0 && var6[(var8 * 16 + (var32 - 1)) * 8 + var10] || var10 < 7 && var6[(var8 * 16 + var32) * 8 + var10 + 1] || var10 > 0 && var6[(var8 * 16 + var32) * 8 + (var10 - 1)]); + if(var33 && (var10 < 4 || var2.nextInt(2) != 0) && var1.getBlockMaterial(var3 + var8, var4 + var10, var5 + var32).isSolid()) { + var1.setBlock(var3 + var8, var4 + var10, var5 + var32, Block.stone.blockID); + } + } + } + } + } + + return true; + } +} diff --git a/src/net/minecraft/src/WorldGenLiquids.java b/src/net/minecraft/src/WorldGenLiquids.java new file mode 100644 index 0000000..f02e8ce --- /dev/null +++ b/src/net/minecraft/src/WorldGenLiquids.java @@ -0,0 +1,64 @@ +package net.minecraft.src; + +import java.util.Random; + +public class WorldGenLiquids extends WorldGenerator { + private int liquidBlockId; + + public WorldGenLiquids(int var1) { + this.liquidBlockId = var1; + } + + public boolean generate(World var1, Random var2, int var3, int var4, int var5) { + if(var1.getBlockId(var3, var4 + 1, var5) != Block.stone.blockID) { + return false; + } else if(var1.getBlockId(var3, var4 - 1, var5) != Block.stone.blockID) { + return false; + } else if(var1.getBlockId(var3, var4, var5) != 0 && var1.getBlockId(var3, var4, var5) != Block.stone.blockID) { + return false; + } else { + int var6 = 0; + if(var1.getBlockId(var3 - 1, var4, var5) == Block.stone.blockID) { + ++var6; + } + + if(var1.getBlockId(var3 + 1, var4, var5) == Block.stone.blockID) { + ++var6; + } + + if(var1.getBlockId(var3, var4, var5 - 1) == Block.stone.blockID) { + ++var6; + } + + if(var1.getBlockId(var3, var4, var5 + 1) == Block.stone.blockID) { + ++var6; + } + + int var7 = 0; + if(var1.isAirBlock(var3 - 1, var4, var5)) { + ++var7; + } + + if(var1.isAirBlock(var3 + 1, var4, var5)) { + ++var7; + } + + if(var1.isAirBlock(var3, var4, var5 - 1)) { + ++var7; + } + + if(var1.isAirBlock(var3, var4, var5 + 1)) { + ++var7; + } + + if(var6 == 3 && var7 == 1) { + var1.setBlockWithNotify(var3, var4, var5, this.liquidBlockId); + var1.scheduledUpdatesAreImmediate = true; + Block.blocksList[this.liquidBlockId].updateTick(var1, var3, var4, var5, var2); + var1.scheduledUpdatesAreImmediate = false; + } + + return true; + } + } +} diff --git a/src/net/minecraft/src/WorldGenMinable.java b/src/net/minecraft/src/WorldGenMinable.java new file mode 100644 index 0000000..d62e945 --- /dev/null +++ b/src/net/minecraft/src/WorldGenMinable.java @@ -0,0 +1,57 @@ +package net.minecraft.src; + +import java.util.Random; + +public class WorldGenMinable extends WorldGenerator { + private int minableBlockId; + private int numberOfBlocks; + + public WorldGenMinable(int var1, int var2) { + this.minableBlockId = var1; + this.numberOfBlocks = var2; + } + + public boolean generate(World var1, Random var2, int var3, int var4, int var5) { + float var6 = var2.nextFloat() * (float)Math.PI; + double var7 = (double)((float)(var3 + 8) + MathHelper.sin(var6) * (float)this.numberOfBlocks / 8.0F); + double var9 = (double)((float)(var3 + 8) - MathHelper.sin(var6) * (float)this.numberOfBlocks / 8.0F); + double var11 = (double)((float)(var5 + 8) + MathHelper.cos(var6) * (float)this.numberOfBlocks / 8.0F); + double var13 = (double)((float)(var5 + 8) - MathHelper.cos(var6) * (float)this.numberOfBlocks / 8.0F); + double var15 = (double)(var4 + var2.nextInt(3) + 2); + double var17 = (double)(var4 + var2.nextInt(3) + 2); + + for(int var19 = 0; var19 <= this.numberOfBlocks; ++var19) { + double var20 = var7 + (var9 - var7) * (double)var19 / (double)this.numberOfBlocks; + double var22 = var15 + (var17 - var15) * (double)var19 / (double)this.numberOfBlocks; + double var24 = var11 + (var13 - var11) * (double)var19 / (double)this.numberOfBlocks; + double var26 = var2.nextDouble() * (double)this.numberOfBlocks / 16.0D; + double var28 = (double)(MathHelper.sin((float)var19 * (float)Math.PI / (float)this.numberOfBlocks) + 1.0F) * var26 + 1.0D; + double var30 = (double)(MathHelper.sin((float)var19 * (float)Math.PI / (float)this.numberOfBlocks) + 1.0F) * var26 + 1.0D; + int var32 = MathHelper.floor_double(var20 - var28 / 2.0D); + int var33 = MathHelper.floor_double(var22 - var30 / 2.0D); + int var34 = MathHelper.floor_double(var24 - var28 / 2.0D); + int var35 = MathHelper.floor_double(var20 + var28 / 2.0D); + int var36 = MathHelper.floor_double(var22 + var30 / 2.0D); + int var37 = MathHelper.floor_double(var24 + var28 / 2.0D); + + for(int var38 = var32; var38 <= var35; ++var38) { + double var39 = ((double)var38 + 0.5D - var20) / (var28 / 2.0D); + if(var39 * var39 < 1.0D) { + for(int var41 = var33; var41 <= var36; ++var41) { + double var42 = ((double)var41 + 0.5D - var22) / (var30 / 2.0D); + if(var39 * var39 + var42 * var42 < 1.0D) { + for(int var44 = var34; var44 <= var37; ++var44) { + double var45 = ((double)var44 + 0.5D - var24) / (var28 / 2.0D); + if(var39 * var39 + var42 * var42 + var45 * var45 < 1.0D && var1.getBlockId(var38, var41, var44) == Block.stone.blockID) { + var1.setBlock(var38, var41, var44, this.minableBlockId); + } + } + } + } + } + } + } + + return true; + } +} diff --git a/src/net/minecraft/src/WorldGenPumpkin.java b/src/net/minecraft/src/WorldGenPumpkin.java new file mode 100644 index 0000000..e309d6f --- /dev/null +++ b/src/net/minecraft/src/WorldGenPumpkin.java @@ -0,0 +1,18 @@ +package net.minecraft.src; + +import java.util.Random; + +public class WorldGenPumpkin extends WorldGenerator { + public boolean generate(World var1, Random var2, int var3, int var4, int var5) { + for(int var6 = 0; var6 < 64; ++var6) { + int var7 = var3 + var2.nextInt(8) - var2.nextInt(8); + int var8 = var4 + var2.nextInt(4) - var2.nextInt(4); + int var9 = var5 + var2.nextInt(8) - var2.nextInt(8); + if(var1.isAirBlock(var7, var8, var9) && var1.getBlockId(var7, var8 - 1, var9) == Block.grass.blockID && Block.pumpkin.canPlaceBlockAt(var1, var7, var8, var9)) { + var1.setBlockAndMetadata(var7, var8, var9, Block.pumpkin.blockID, var2.nextInt(4)); + } + } + + return true; + } +} diff --git a/src/net/minecraft/src/WorldGenReed.java b/src/net/minecraft/src/WorldGenReed.java new file mode 100644 index 0000000..cc89ad2 --- /dev/null +++ b/src/net/minecraft/src/WorldGenReed.java @@ -0,0 +1,24 @@ +package net.minecraft.src; + +import java.util.Random; + +public class WorldGenReed extends WorldGenerator { + public boolean generate(World var1, Random var2, int var3, int var4, int var5) { + for(int var6 = 0; var6 < 20; ++var6) { + int var7 = var3 + var2.nextInt(4) - var2.nextInt(4); + int var8 = var4; + int var9 = var5 + var2.nextInt(4) - var2.nextInt(4); + if(var1.isAirBlock(var7, var4, var9) && (var1.getBlockMaterial(var7 - 1, var4 - 1, var9) == Material.water || var1.getBlockMaterial(var7 + 1, var4 - 1, var9) == Material.water || var1.getBlockMaterial(var7, var4 - 1, var9 - 1) == Material.water || var1.getBlockMaterial(var7, var4 - 1, var9 + 1) == Material.water)) { + int var10 = 2 + var2.nextInt(var2.nextInt(3) + 1); + + for(int var11 = 0; var11 < var10; ++var11) { + if(Block.reed.canBlockStay(var1, var7, var8 + var11, var9)) { + var1.setBlock(var7, var8 + var11, var9, Block.reed.blockID); + } + } + } + } + + return true; + } +} diff --git a/src/net/minecraft/src/WorldGenTaiga1.java b/src/net/minecraft/src/WorldGenTaiga1.java new file mode 100644 index 0000000..d4213b8 --- /dev/null +++ b/src/net/minecraft/src/WorldGenTaiga1.java @@ -0,0 +1,83 @@ +package net.minecraft.src; + +import java.util.Random; + +public class WorldGenTaiga1 extends WorldGenerator { + public boolean generate(World var1, Random var2, int var3, int var4, int var5) { + int var6 = var2.nextInt(5) + 7; + int var7 = var6 - var2.nextInt(2) - 3; + int var8 = var6 - var7; + int var9 = 1 + var2.nextInt(var8 + 1); + boolean var10 = true; + if(var4 >= 1 && var4 + var6 + 1 <= 128) { + int var11; + int var13; + int var14; + int var15; + int var18; + for(var11 = var4; var11 <= var4 + 1 + var6 && var10; ++var11) { + boolean var12 = true; + if(var11 - var4 < var7) { + var18 = 0; + } else { + var18 = var9; + } + + for(var13 = var3 - var18; var13 <= var3 + var18 && var10; ++var13) { + for(var14 = var5 - var18; var14 <= var5 + var18 && var10; ++var14) { + if(var11 >= 0 && var11 < 128) { + var15 = var1.getBlockId(var13, var11, var14); + if(var15 != 0 && var15 != Block.leaves.blockID) { + var10 = false; + } + } else { + var10 = false; + } + } + } + } + + if(!var10) { + return false; + } else { + var11 = var1.getBlockId(var3, var4 - 1, var5); + if((var11 == Block.grass.blockID || var11 == Block.dirt.blockID) && var4 < 128 - var6 - 1) { + var1.setBlock(var3, var4 - 1, var5, Block.dirt.blockID); + var18 = 0; + + for(var13 = var4 + var6; var13 >= var4 + var7; --var13) { + for(var14 = var3 - var18; var14 <= var3 + var18; ++var14) { + var15 = var14 - var3; + + for(int var16 = var5 - var18; var16 <= var5 + var18; ++var16) { + int var17 = var16 - var5; + if((Math.abs(var15) != var18 || Math.abs(var17) != var18 || var18 <= 0) && !Block.opaqueCubeLookup[var1.getBlockId(var14, var13, var16)]) { + var1.setBlockAndMetadata(var14, var13, var16, Block.leaves.blockID, 1); + } + } + } + + if(var18 >= 1 && var13 == var4 + var7 + 1) { + --var18; + } else if(var18 < var9) { + ++var18; + } + } + + for(var13 = 0; var13 < var6 - 1; ++var13) { + var14 = var1.getBlockId(var3, var4 + var13, var5); + if(var14 == 0 || var14 == Block.leaves.blockID) { + var1.setBlockAndMetadata(var3, var4 + var13, var5, Block.wood.blockID, 1); + } + } + + return true; + } else { + return false; + } + } + } else { + return false; + } + } +} diff --git a/src/net/minecraft/src/WorldGenTaiga2.java b/src/net/minecraft/src/WorldGenTaiga2.java new file mode 100644 index 0000000..4ead9bf --- /dev/null +++ b/src/net/minecraft/src/WorldGenTaiga2.java @@ -0,0 +1,95 @@ +package net.minecraft.src; + +import java.util.Random; + +public class WorldGenTaiga2 extends WorldGenerator { + public boolean generate(World var1, Random var2, int var3, int var4, int var5) { + int var6 = var2.nextInt(4) + 6; + int var7 = 1 + var2.nextInt(2); + int var8 = var6 - var7; + int var9 = 2 + var2.nextInt(2); + boolean var10 = true; + if(var4 >= 1 && var4 + var6 + 1 <= 128) { + int var11; + int var13; + int var15; + int var21; + for(var11 = var4; var11 <= var4 + 1 + var6 && var10; ++var11) { + boolean var12 = true; + if(var11 - var4 < var7) { + var21 = 0; + } else { + var21 = var9; + } + + for(var13 = var3 - var21; var13 <= var3 + var21 && var10; ++var13) { + for(int var14 = var5 - var21; var14 <= var5 + var21 && var10; ++var14) { + if(var11 >= 0 && var11 < 128) { + var15 = var1.getBlockId(var13, var11, var14); + if(var15 != 0 && var15 != Block.leaves.blockID) { + var10 = false; + } + } else { + var10 = false; + } + } + } + } + + if(!var10) { + return false; + } else { + var11 = var1.getBlockId(var3, var4 - 1, var5); + if((var11 == Block.grass.blockID || var11 == Block.dirt.blockID) && var4 < 128 - var6 - 1) { + var1.setBlock(var3, var4 - 1, var5, Block.dirt.blockID); + var21 = var2.nextInt(2); + var13 = 1; + byte var22 = 0; + + int var16; + int var17; + for(var15 = 0; var15 <= var8; ++var15) { + var16 = var4 + var6 - var15; + + for(var17 = var3 - var21; var17 <= var3 + var21; ++var17) { + int var18 = var17 - var3; + + for(int var19 = var5 - var21; var19 <= var5 + var21; ++var19) { + int var20 = var19 - var5; + if((Math.abs(var18) != var21 || Math.abs(var20) != var21 || var21 <= 0) && !Block.opaqueCubeLookup[var1.getBlockId(var17, var16, var19)]) { + var1.setBlockAndMetadata(var17, var16, var19, Block.leaves.blockID, 1); + } + } + } + + if(var21 >= var13) { + var21 = var22; + var22 = 1; + ++var13; + if(var13 > var9) { + var13 = var9; + } + } else { + ++var21; + } + } + + var15 = var2.nextInt(3); + + for(var16 = 0; var16 < var6 - var15; ++var16) { + var17 = var1.getBlockId(var3, var4 + var16, var5); + if(var17 == 0 || var17 == Block.leaves.blockID) { + var1.setBlockAndMetadata(var3, var4 + var16, var5, Block.wood.blockID, 1); + } + } + + return true; + } else { + return false; + } + } + } else { + return false; + } + } +} diff --git a/src/net/minecraft/src/WorldGenTallGrass.java b/src/net/minecraft/src/WorldGenTallGrass.java new file mode 100644 index 0000000..a182f56 --- /dev/null +++ b/src/net/minecraft/src/WorldGenTallGrass.java @@ -0,0 +1,35 @@ +package net.minecraft.src; + +import java.util.Random; + +public class WorldGenTallGrass extends WorldGenerator { + private int field_28060_a; + private int field_28059_b; + + public WorldGenTallGrass(int var1, int var2) { + this.field_28060_a = var1; + this.field_28059_b = var2; + } + + public boolean generate(World var1, Random var2, int var3, int var4, int var5) { + boolean var6 = false; + + while(true) { + int var11 = var1.getBlockId(var3, var4, var5); + if(var11 != 0 && var11 != Block.leaves.blockID || var4 <= 0) { + for(int var7 = 0; var7 < 128; ++var7) { + int var8 = var3 + var2.nextInt(8) - var2.nextInt(8); + int var9 = var4 + var2.nextInt(4) - var2.nextInt(4); + int var10 = var5 + var2.nextInt(8) - var2.nextInt(8); + if(var1.isAirBlock(var8, var9, var10) && ((BlockFlower)Block.blocksList[this.field_28060_a]).canBlockStay(var1, var8, var9, var10)) { + var1.setBlockAndMetadata(var8, var9, var10, this.field_28060_a, this.field_28059_b); + } + } + + return true; + } + + --var4; + } + } +} diff --git a/src/net/minecraft/src/WorldGenTrees.java b/src/net/minecraft/src/WorldGenTrees.java new file mode 100644 index 0000000..a80f3ab --- /dev/null +++ b/src/net/minecraft/src/WorldGenTrees.java @@ -0,0 +1,78 @@ +package net.minecraft.src; + +import java.util.Random; + +public class WorldGenTrees extends WorldGenerator { + public boolean generate(World var1, Random var2, int var3, int var4, int var5) { + int var6 = var2.nextInt(3) + 4; + boolean var7 = true; + if(var4 >= 1 && var4 + var6 + 1 <= 128) { + int var8; + int var10; + int var11; + int var12; + for(var8 = var4; var8 <= var4 + 1 + var6; ++var8) { + byte var9 = 1; + if(var8 == var4) { + var9 = 0; + } + + if(var8 >= var4 + 1 + var6 - 2) { + var9 = 2; + } + + for(var10 = var3 - var9; var10 <= var3 + var9 && var7; ++var10) { + for(var11 = var5 - var9; var11 <= var5 + var9 && var7; ++var11) { + if(var8 >= 0 && var8 < 128) { + var12 = var1.getBlockId(var10, var8, var11); + if(var12 != 0 && var12 != Block.leaves.blockID) { + var7 = false; + } + } else { + var7 = false; + } + } + } + } + + if(!var7) { + return false; + } else { + var8 = var1.getBlockId(var3, var4 - 1, var5); + if((var8 == Block.grass.blockID || var8 == Block.dirt.blockID) && var4 < 128 - var6 - 1) { + var1.setBlock(var3, var4 - 1, var5, Block.dirt.blockID); + + int var16; + for(var16 = var4 - 3 + var6; var16 <= var4 + var6; ++var16) { + var10 = var16 - (var4 + var6); + var11 = 1 - var10 / 2; + + for(var12 = var3 - var11; var12 <= var3 + var11; ++var12) { + int var13 = var12 - var3; + + for(int var14 = var5 - var11; var14 <= var5 + var11; ++var14) { + int var15 = var14 - var5; + if((Math.abs(var13) != var11 || Math.abs(var15) != var11 || var2.nextInt(2) != 0 && var10 != 0) && !Block.opaqueCubeLookup[var1.getBlockId(var12, var16, var14)]) { + var1.setBlock(var12, var16, var14, Block.leaves.blockID); + } + } + } + } + + for(var16 = 0; var16 < var6; ++var16) { + var10 = var1.getBlockId(var3, var4 + var16, var5); + if(var10 == 0 || var10 == Block.leaves.blockID) { + var1.setBlock(var3, var4 + var16, var5, Block.wood.blockID); + } + } + + return true; + } else { + return false; + } + } + } else { + return false; + } + } +} diff --git a/src/net/minecraft/src/WorldGenerator.java b/src/net/minecraft/src/WorldGenerator.java new file mode 100644 index 0000000..1be2eaa --- /dev/null +++ b/src/net/minecraft/src/WorldGenerator.java @@ -0,0 +1,10 @@ +package net.minecraft.src; + +import java.util.Random; + +public abstract class WorldGenerator { + public abstract boolean generate(World var1, Random var2, int var3, int var4, int var5); + + public void func_517_a(double var1, double var3, double var5) { + } +} diff --git a/src/net/minecraft/src/WorldInfo.java b/src/net/minecraft/src/WorldInfo.java new file mode 100644 index 0000000..37d7f0b --- /dev/null +++ b/src/net/minecraft/src/WorldInfo.java @@ -0,0 +1,222 @@ +package net.minecraft.src; + +import java.util.List; + +public class WorldInfo { + private long randomSeed; + private int spawnX; + private int spawnY; + private int spawnZ; + private long worldTime; + private long lastTimePlayed; + private long sizeOnDisk; + private NBTTagCompound playerTag; + private int dimension; + private String levelName; + private int saveVersion; + private boolean raining; + private int rainTime; + private boolean thundering; + private int thunderTime; + + public WorldInfo(NBTTagCompound var1) { + this.randomSeed = var1.getLong("RandomSeed"); + this.spawnX = var1.getInteger("SpawnX"); + this.spawnY = var1.getInteger("SpawnY"); + this.spawnZ = var1.getInteger("SpawnZ"); + this.worldTime = var1.getLong("Time"); + this.lastTimePlayed = var1.getLong("LastPlayed"); + this.sizeOnDisk = var1.getLong("SizeOnDisk"); + this.levelName = var1.getString("LevelName"); + this.saveVersion = var1.getInteger("version"); + this.rainTime = var1.getInteger("rainTime"); + this.raining = var1.getBoolean("raining"); + this.thunderTime = var1.getInteger("thunderTime"); + this.thundering = var1.getBoolean("thundering"); + if(var1.hasKey("Player")) { + this.playerTag = var1.getCompoundTag("Player"); + this.dimension = this.playerTag.getInteger("Dimension"); + } + + } + + public WorldInfo(long var1, String var3) { + this.randomSeed = var1; + this.levelName = var3; + } + + public WorldInfo(WorldInfo var1) { + this.randomSeed = var1.randomSeed; + this.spawnX = var1.spawnX; + this.spawnY = var1.spawnY; + this.spawnZ = var1.spawnZ; + this.worldTime = var1.worldTime; + this.lastTimePlayed = var1.lastTimePlayed; + this.sizeOnDisk = var1.sizeOnDisk; + this.playerTag = var1.playerTag; + this.dimension = var1.dimension; + this.levelName = var1.levelName; + this.saveVersion = var1.saveVersion; + this.rainTime = var1.rainTime; + this.raining = var1.raining; + this.thunderTime = var1.thunderTime; + this.thundering = var1.thundering; + } + + public NBTTagCompound getNBTTagCompound() { + NBTTagCompound var1 = new NBTTagCompound(); + this.updateTagCompound(var1, this.playerTag); + return var1; + } + + public NBTTagCompound getNBTTagCompoundWithPlayer(List var1) { + NBTTagCompound var2 = new NBTTagCompound(); + EntityPlayer var3 = null; + NBTTagCompound var4 = null; + if(var1.size() > 0) { + var3 = (EntityPlayer)var1.get(0); + } + + if(var3 != null) { + var4 = new NBTTagCompound(); + var3.writeToNBT(var4); + } + + this.updateTagCompound(var2, var4); + return var2; + } + + private void updateTagCompound(NBTTagCompound var1, NBTTagCompound var2) { + var1.setLong("RandomSeed", this.randomSeed); + var1.setInteger("SpawnX", this.spawnX); + var1.setInteger("SpawnY", this.spawnY); + var1.setInteger("SpawnZ", this.spawnZ); + var1.setLong("Time", this.worldTime); + var1.setLong("SizeOnDisk", this.sizeOnDisk); + var1.setLong("LastPlayed", System.currentTimeMillis()); + var1.setString("LevelName", this.levelName); + var1.setInteger("version", this.saveVersion); + var1.setInteger("rainTime", this.rainTime); + var1.setBoolean("raining", this.raining); + var1.setInteger("thunderTime", this.thunderTime); + var1.setBoolean("thundering", this.thundering); + if(var2 != null) { + var1.setCompoundTag("Player", var2); + } + + } + + public long getRandomSeed() { + return this.randomSeed; + } + + public int getSpawnX() { + return this.spawnX; + } + + public int getSpawnY() { + return this.spawnY; + } + + public int getSpawnZ() { + return this.spawnZ; + } + + public long getWorldTime() { + return this.worldTime; + } + + public long getSizeOnDisk() { + return this.sizeOnDisk; + } + + public NBTTagCompound getPlayerNBTTagCompound() { + return this.playerTag; + } + + public int getDimension() { + return this.dimension; + } + + public void setSpawnX(int var1) { + this.spawnX = var1; + } + + public void setSpawnY(int var1) { + this.spawnY = var1; + } + + public void setSpawnZ(int var1) { + this.spawnZ = var1; + } + + public void setWorldTime(long var1) { + this.worldTime = var1; + } + + public void setSizeOnDisk(long var1) { + this.sizeOnDisk = var1; + } + + public void setPlayerNBTTagCompound(NBTTagCompound var1) { + this.playerTag = var1; + } + + public void setSpawn(int var1, int var2, int var3) { + this.spawnX = var1; + this.spawnY = var2; + this.spawnZ = var3; + } + + public String getWorldName() { + return this.levelName; + } + + public void setWorldName(String var1) { + this.levelName = var1; + } + + public int getSaveVersion() { + return this.saveVersion; + } + + public void setSaveVersion(int var1) { + this.saveVersion = var1; + } + + public long getLastTimePlayed() { + return this.lastTimePlayed; + } + + public boolean getThundering() { + return this.thundering; + } + + public void setThundering(boolean var1) { + this.thundering = var1; + } + + public int getThunderTime() { + return this.thunderTime; + } + + public void setThunderTime(int var1) { + this.thunderTime = var1; + } + + public boolean getRaining() { + return this.raining; + } + + public void setRaining(boolean var1) { + this.raining = var1; + } + + public int getRainTime() { + return this.rainTime; + } + + public void setRainTime(int var1) { + this.rainTime = var1; + } +} diff --git a/src/net/minecraft/src/WorldProvider.java b/src/net/minecraft/src/WorldProvider.java new file mode 100644 index 0000000..1501cbf --- /dev/null +++ b/src/net/minecraft/src/WorldProvider.java @@ -0,0 +1,111 @@ +package net.minecraft.src; + +public abstract class WorldProvider { + public World worldObj; + public WorldChunkManager worldChunkMgr; + public boolean isNether = false; + public boolean isHellWorld = false; + public boolean hasNoSky = false; + public float[] lightBrightnessTable = new float[16]; + public int worldType = 0; + private float[] colorsSunriseSunset = new float[4]; + + public final void registerWorld(World var1) { + this.worldObj = var1; + this.registerWorldChunkManager(); + this.generateLightBrightnessTable(); + } + + protected void generateLightBrightnessTable() { + float var1 = 0.05F; + + for(int var2 = 0; var2 <= 15; ++var2) { + float var3 = 1.0F - (float)var2 / 15.0F; + this.lightBrightnessTable[var2] = (1.0F - var3) / (var3 * 3.0F + 1.0F) * (1.0F - var1) + var1; + } + + } + + protected void registerWorldChunkManager() { + this.worldChunkMgr = new WorldChunkManager(this.worldObj); + } + + public IChunkProvider getChunkProvider() { + return new ChunkProviderGenerate(this.worldObj, this.worldObj.getRandomSeed()); + } + + public boolean canCoordinateBeSpawn(int var1, int var2) { + int var3 = this.worldObj.getFirstUncoveredBlock(var1, var2); + return var3 == Block.sand.blockID; + } + + public float calculateCelestialAngle(long var1, float var3) { + int var4 = (int)(var1 % 24000L); + float var5 = ((float)var4 + var3) / 24000.0F - 0.25F; + if(var5 < 0.0F) { + ++var5; + } + + if(var5 > 1.0F) { + --var5; + } + + float var6 = var5; + var5 = 1.0F - (float)((Math.cos((double)var5 * Math.PI) + 1.0D) / 2.0D); + var5 = var6 + (var5 - var6) / 3.0F; + return var5; + } + + public float[] calcSunriseSunsetColors(float var1, float var2) { + float var3 = 0.4F; + float var4 = MathHelper.cos(var1 * (float)Math.PI * 2.0F) - 0.0F; + float var5 = -0.0F; + if(var4 >= var5 - var3 && var4 <= var5 + var3) { + float var6 = (var4 - var5) / var3 * 0.5F + 0.5F; + float var7 = 1.0F - (1.0F - MathHelper.sin(var6 * (float)Math.PI)) * 0.99F; + var7 *= var7; + this.colorsSunriseSunset[0] = var6 * 0.3F + 0.7F; + this.colorsSunriseSunset[1] = var6 * var6 * 0.7F + 0.2F; + this.colorsSunriseSunset[2] = var6 * var6 * 0.0F + 0.2F; + this.colorsSunriseSunset[3] = var7; + return this.colorsSunriseSunset; + } else { + return null; + } + } + + public Vec3D func_4096_a(float var1, float var2) { + float var3 = MathHelper.cos(var1 * (float)Math.PI * 2.0F) * 2.0F + 0.5F; + if(var3 < 0.0F) { + var3 = 0.0F; + } + + if(var3 > 1.0F) { + var3 = 1.0F; + } + + float var4 = 192.0F / 255.0F; + float var5 = 216.0F / 255.0F; + float var6 = 1.0F; + var4 *= var3 * 0.94F + 0.06F; + var5 *= var3 * 0.94F + 0.06F; + var6 *= var3 * 0.91F + 0.09F; + return Vec3D.createVector((double)var4, (double)var5, (double)var6); + } + + public boolean canRespawnHere() { + return true; + } + + public static WorldProvider getProviderForDimension(int var0) { + return (WorldProvider)(var0 == -1 ? new WorldProviderHell() : (var0 == 0 ? new WorldProviderSurface() : (var0 == 1 ? new WorldProviderSky() : null))); + } + + public float getCloudHeight() { + return 108.0F; + } + + public boolean func_28112_c() { + return true; + } +} diff --git a/src/net/minecraft/src/WorldProviderHell.java b/src/net/minecraft/src/WorldProviderHell.java new file mode 100644 index 0000000..7c64a60 --- /dev/null +++ b/src/net/minecraft/src/WorldProviderHell.java @@ -0,0 +1,42 @@ +package net.minecraft.src; + +public class WorldProviderHell extends WorldProvider { + public void registerWorldChunkManager() { + this.worldChunkMgr = new WorldChunkManagerHell(BiomeGenBase.hell, 1.0D, 0.0D); + this.isNether = true; + this.isHellWorld = true; + this.hasNoSky = true; + this.worldType = -1; + } + + public Vec3D func_4096_a(float var1, float var2) { + return Vec3D.createVector((double)0.2F, (double)0.03F, (double)0.03F); + } + + protected void generateLightBrightnessTable() { + float var1 = 0.1F; + + for(int var2 = 0; var2 <= 15; ++var2) { + float var3 = 1.0F - (float)var2 / 15.0F; + this.lightBrightnessTable[var2] = (1.0F - var3) / (var3 * 3.0F + 1.0F) * (1.0F - var1) + var1; + } + + } + + public IChunkProvider getChunkProvider() { + return new ChunkProviderHell(this.worldObj, this.worldObj.getRandomSeed()); + } + + public boolean canCoordinateBeSpawn(int var1, int var2) { + int var3 = this.worldObj.getFirstUncoveredBlock(var1, var2); + return var3 == Block.bedrock.blockID ? false : (var3 == 0 ? false : Block.opaqueCubeLookup[var3]); + } + + public float calculateCelestialAngle(long var1, float var3) { + return 0.5F; + } + + public boolean canRespawnHere() { + return false; + } +} diff --git a/src/net/minecraft/src/WorldProviderSky.java b/src/net/minecraft/src/WorldProviderSky.java new file mode 100644 index 0000000..9b00ba4 --- /dev/null +++ b/src/net/minecraft/src/WorldProviderSky.java @@ -0,0 +1,53 @@ +package net.minecraft.src; + +public class WorldProviderSky extends WorldProvider { + public void registerWorldChunkManager() { + this.worldChunkMgr = new WorldChunkManagerHell(BiomeGenBase.sky, 0.5D, 0.0D); + this.worldType = 1; + } + + public IChunkProvider getChunkProvider() { + return new ChunkProviderSky(this.worldObj, this.worldObj.getRandomSeed()); + } + + public float calculateCelestialAngle(long var1, float var3) { + return 0.0F; + } + + public float[] calcSunriseSunsetColors(float var1, float var2) { + return null; + } + + public Vec3D func_4096_a(float var1, float var2) { + int var3 = 8421536; + float var4 = MathHelper.cos(var1 * (float)Math.PI * 2.0F) * 2.0F + 0.5F; + if(var4 < 0.0F) { + var4 = 0.0F; + } + + if(var4 > 1.0F) { + var4 = 1.0F; + } + + float var5 = (float)(var3 >> 16 & 255) / 255.0F; + float var6 = (float)(var3 >> 8 & 255) / 255.0F; + float var7 = (float)(var3 & 255) / 255.0F; + var5 *= var4 * 0.94F + 0.06F; + var6 *= var4 * 0.94F + 0.06F; + var7 *= var4 * 0.91F + 0.09F; + return Vec3D.createVector((double)var5, (double)var6, (double)var7); + } + + public boolean func_28112_c() { + return false; + } + + public float getCloudHeight() { + return 8.0F; + } + + public boolean canCoordinateBeSpawn(int var1, int var2) { + int var3 = this.worldObj.getFirstUncoveredBlock(var1, var2); + return var3 == 0 ? false : Block.blocksList[var3].blockMaterial.getIsSolid(); + } +} diff --git a/src/net/minecraft/src/WorldProviderSurface.java b/src/net/minecraft/src/WorldProviderSurface.java new file mode 100644 index 0000000..cbd8883 --- /dev/null +++ b/src/net/minecraft/src/WorldProviderSurface.java @@ -0,0 +1,4 @@ +package net.minecraft.src; + +public class WorldProviderSurface extends WorldProvider { +} diff --git a/src/net/minecraft/src/WorldRenderer.java b/src/net/minecraft/src/WorldRenderer.java new file mode 100644 index 0000000..5a7059f --- /dev/null +++ b/src/net/minecraft/src/WorldRenderer.java @@ -0,0 +1,214 @@ +package net.minecraft.src; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import org.lwjgl.opengl.GL11; + +public class WorldRenderer { + public World worldObj; + private int glRenderList = -1; + private static Tessellator tessellator = Tessellator.instance; + public static int chunksUpdated = 0; + public int posX; + public int posY; + public int posZ; + public int sizeWidth; + public int sizeHeight; + public int sizeDepth; + public int posXMinus; + public int posYMinus; + public int posZMinus; + public int posXClip; + public int posYClip; + public int posZClip; + public boolean isInFrustum = false; + public boolean[] skipRenderPass = new boolean[2]; + public int posXPlus; + public int posYPlus; + public int posZPlus; + public float rendererRadius; + public boolean needsUpdate; + public AxisAlignedBB rendererBoundingBox; + public int chunkIndex; + public boolean isVisible = true; + public boolean isWaitingOnOcclusionQuery; + public int glOcclusionQuery; + public boolean isChunkLit; + private boolean isInitialized = false; + public List tileEntityRenderers = new ArrayList(); + private List tileEntities; + + public WorldRenderer(World var1, List var2, int var3, int var4, int var5, int var6, int var7) { + this.worldObj = var1; + this.tileEntities = var2; + this.sizeWidth = this.sizeHeight = this.sizeDepth = var6; + this.rendererRadius = MathHelper.sqrt_float((float)(this.sizeWidth * this.sizeWidth + this.sizeHeight * this.sizeHeight + this.sizeDepth * this.sizeDepth)) / 2.0F; + this.glRenderList = var7; + this.posX = -999; + this.setPosition(var3, var4, var5); + this.needsUpdate = false; + } + + public void setPosition(int var1, int var2, int var3) { + if(var1 != this.posX || var2 != this.posY || var3 != this.posZ) { + this.setDontDraw(); + this.posX = var1; + this.posY = var2; + this.posZ = var3; + this.posXPlus = var1 + this.sizeWidth / 2; + this.posYPlus = var2 + this.sizeHeight / 2; + this.posZPlus = var3 + this.sizeDepth / 2; + this.posXClip = var1 & 1023; + this.posYClip = var2; + this.posZClip = var3 & 1023; + this.posXMinus = var1 - this.posXClip; + this.posYMinus = var2 - this.posYClip; + this.posZMinus = var3 - this.posZClip; + float var4 = 6.0F; + this.rendererBoundingBox = AxisAlignedBB.getBoundingBox((double)((float)var1 - var4), (double)((float)var2 - var4), (double)((float)var3 - var4), (double)((float)(var1 + this.sizeWidth) + var4), (double)((float)(var2 + this.sizeHeight) + var4), (double)((float)(var3 + this.sizeDepth) + var4)); + GL11.glNewList(this.glRenderList + 2, GL11.GL_COMPILE); + RenderItem.renderAABB(AxisAlignedBB.getBoundingBoxFromPool((double)((float)this.posXClip - var4), (double)((float)this.posYClip - var4), (double)((float)this.posZClip - var4), (double)((float)(this.posXClip + this.sizeWidth) + var4), (double)((float)(this.posYClip + this.sizeHeight) + var4), (double)((float)(this.posZClip + this.sizeDepth) + var4))); + GL11.glEndList(); + this.markDirty(); + } + } + + private void setupGLTranslation() { + GL11.glTranslatef((float)this.posXClip, (float)this.posYClip, (float)this.posZClip); + } + + public void updateRenderer() { + if(this.needsUpdate) { + ++chunksUpdated; + int var1 = this.posX; + int var2 = this.posY; + int var3 = this.posZ; + int var4 = this.posX + this.sizeWidth; + int var5 = this.posY + this.sizeHeight; + int var6 = this.posZ + this.sizeDepth; + + for(int var7 = 0; var7 < 2; ++var7) { + this.skipRenderPass[var7] = true; + } + + Chunk.isLit = false; + HashSet var21 = new HashSet(); + var21.addAll(this.tileEntityRenderers); + this.tileEntityRenderers.clear(); + byte var8 = 1; + ChunkCache var9 = new ChunkCache(this.worldObj, var1 - var8, var2 - var8, var3 - var8, var4 + var8, var5 + var8, var6 + var8); + RenderBlocks var10 = new RenderBlocks(var9); + + for(int var11 = 0; var11 < 2; ++var11) { + boolean var12 = false; + boolean var13 = false; + boolean var14 = false; + + for(int var15 = var2; var15 < var5; ++var15) { + for(int var16 = var3; var16 < var6; ++var16) { + for(int var17 = var1; var17 < var4; ++var17) { + int var18 = var9.getBlockId(var17, var15, var16); + if(var18 > 0) { + if(!var14) { + var14 = true; + GL11.glNewList(this.glRenderList + var11, GL11.GL_COMPILE); + GL11.glPushMatrix(); + this.setupGLTranslation(); + float var19 = 1.000001F; + GL11.glTranslatef((float)(-this.sizeDepth) / 2.0F, (float)(-this.sizeHeight) / 2.0F, (float)(-this.sizeDepth) / 2.0F); + GL11.glScalef(var19, var19, var19); + GL11.glTranslatef((float)this.sizeDepth / 2.0F, (float)this.sizeHeight / 2.0F, (float)this.sizeDepth / 2.0F); + tessellator.startDrawingQuads(); + tessellator.setTranslationD((double)(-this.posX), (double)(-this.posY), (double)(-this.posZ)); + } + + if(var11 == 0 && Block.isBlockContainer[var18]) { + TileEntity var23 = var9.getBlockTileEntity(var17, var15, var16); + if(TileEntityRenderer.instance.hasSpecialRenderer(var23)) { + this.tileEntityRenderers.add(var23); + } + } + + Block var24 = Block.blocksList[var18]; + int var20 = var24.getRenderBlockPass(); + if(var20 != var11) { + var12 = true; + } else if(var20 == var11) { + var13 |= var10.renderBlockByRenderType(var24, var17, var15, var16); + } + } + } + } + } + + if(var14) { + tessellator.draw(); + GL11.glPopMatrix(); + GL11.glEndList(); + tessellator.setTranslationD(0.0D, 0.0D, 0.0D); + } else { + var13 = false; + } + + if(var13) { + this.skipRenderPass[var11] = false; + } + + if(!var12) { + break; + } + } + + HashSet var22 = new HashSet(); + var22.addAll(this.tileEntityRenderers); + var22.removeAll(var21); + this.tileEntities.addAll(var22); + var21.removeAll(this.tileEntityRenderers); + this.tileEntities.removeAll(var21); + this.isChunkLit = Chunk.isLit; + this.isInitialized = true; + } + } + + public float distanceToEntitySquared(Entity var1) { + float var2 = (float)(var1.posX - (double)this.posXPlus); + float var3 = (float)(var1.posY - (double)this.posYPlus); + float var4 = (float)(var1.posZ - (double)this.posZPlus); + return var2 * var2 + var3 * var3 + var4 * var4; + } + + public void setDontDraw() { + for(int var1 = 0; var1 < 2; ++var1) { + this.skipRenderPass[var1] = true; + } + + this.isInFrustum = false; + this.isInitialized = false; + } + + public void func_1204_c() { + this.setDontDraw(); + this.worldObj = null; + } + + public int getGLCallListForPass(int var1) { + return !this.isInFrustum ? -1 : (!this.skipRenderPass[var1] ? this.glRenderList + var1 : -1); + } + + public void updateInFrustrum(ICamera var1) { + this.isInFrustum = var1.isBoundingBoxInFrustum(this.rendererBoundingBox); + } + + public void callOcclusionQueryList() { + GL11.glCallList(this.glRenderList + 2); + } + + public boolean skipAllRenderPasses() { + return !this.isInitialized ? false : this.skipRenderPass[0] && this.skipRenderPass[1]; + } + + public void markDirty() { + this.needsUpdate = true; + } +}