├── src └── main │ ├── resources │ ├── null │ ├── bg.png │ ├── 2char.png │ ├── char.png │ ├── clouds.png │ ├── dirt.png │ ├── grass.png │ ├── rain.png │ ├── rock.png │ ├── snow.png │ ├── water.png │ ├── default.gif │ ├── default.png │ ├── gui │ │ ├── gui.png │ │ └── icons.png │ ├── mob │ │ ├── croc.png │ │ ├── pig.png │ │ ├── chicken.png │ │ ├── creeper.png │ │ ├── printer.png │ │ ├── sheep.png │ │ ├── spider.png │ │ ├── zombie.png │ │ ├── sheep_fur.png │ │ └── skeleton.png │ ├── terrain.png │ ├── armor │ │ ├── chain.png │ │ └── plate.png │ ├── item │ │ ├── arrows.png │ │ └── sign.png │ └── particles.png │ └── java │ ├── bg.jpg │ ├── bg.png │ ├── 2char.png │ ├── META-INF │ └── MANIFEST.MF │ ├── char.png │ ├── clouds.png │ ├── dirt.png │ ├── grass.png │ ├── rain.png │ ├── rock.png │ ├── rsbg.jpg │ ├── snow.png │ ├── water.png │ ├── default.gif │ ├── default.png │ ├── gui │ ├── gui.png │ └── icons.png │ ├── mob │ ├── croc.png │ ├── pig.png │ ├── chicken.png │ ├── creeper.png │ ├── printer.png │ ├── sheep.png │ ├── spider.png │ ├── zombie.png │ ├── sheep_fur.png │ └── skeleton.png │ ├── terrain.png │ ├── armor │ ├── chain.png │ └── plate.png │ ├── item │ ├── arrows.png │ └── sign.png │ ├── particles.png │ ├── com │ ├── mojang │ │ ├── minecraft │ │ │ ├── sound │ │ │ │ ├── SoundPos.java │ │ │ │ ├── Audio.java │ │ │ │ ├── AudioInfo.java │ │ │ │ ├── SoundData.java │ │ │ │ ├── StepSoundSand.java │ │ │ │ ├── StepSoundStone.java │ │ │ │ ├── EntitySoundPos.java │ │ │ │ ├── LevelSoundPos.java │ │ │ │ ├── StepSound.java │ │ │ │ ├── SoundInfo.java │ │ │ │ ├── BaseSoundPos.java │ │ │ │ ├── Sound.java │ │ │ │ └── MusicPlayThread.java │ │ │ ├── StopGameException.java │ │ │ ├── level │ │ │ │ ├── generator │ │ │ │ │ └── noise │ │ │ │ │ │ ├── Noise.java │ │ │ │ │ │ ├── CombinedNoise.java │ │ │ │ │ │ ├── OctaveNoise.java │ │ │ │ │ │ └── PerlinNoise.java │ │ │ │ ├── tile │ │ │ │ │ ├── DirtBlock.java │ │ │ │ │ ├── StoneBlock.java │ │ │ │ │ ├── CobblestoneBlock.java │ │ │ │ │ ├── MetalBlock.java │ │ │ │ │ ├── SandStoneBlock.java │ │ │ │ │ ├── TextureSide.java │ │ │ │ │ ├── BookshelfBlock.java │ │ │ │ │ ├── LeavesBlock.java │ │ │ │ │ ├── MagmaBlock.java │ │ │ │ │ ├── OreBlock.java │ │ │ │ │ ├── WoodBlock.java │ │ │ │ │ ├── MushroomBlock.java │ │ │ │ │ ├── GlassBlock.java │ │ │ │ │ ├── LeavesBaseBlock.java │ │ │ │ │ ├── SaplingBlock.java │ │ │ │ │ ├── RopeBlock.java │ │ │ │ │ ├── SpongeBlock.java │ │ │ │ │ ├── GrassBlock.java │ │ │ │ │ ├── SnowBlock.java │ │ │ │ │ ├── TNTBlock.java │ │ │ │ │ ├── StillLiquidBlock.java │ │ │ │ │ ├── BlockID.java │ │ │ │ │ ├── SandBlock.java │ │ │ │ │ ├── SlabBlock.java │ │ │ │ │ ├── CobblestoneSlabBlock.java │ │ │ │ │ └── IceBlock.java │ │ │ │ ├── NextTickListEntry.java │ │ │ │ ├── liquid │ │ │ │ │ └── LiquidType.java │ │ │ │ ├── LevelObjectInputStream.java │ │ │ │ ├── BlockMapSlot.java │ │ │ │ └── LevelLoader.java │ │ │ ├── model │ │ │ │ ├── PigModel.java │ │ │ │ ├── BlockModel.java │ │ │ │ ├── SheepModel.java │ │ │ │ ├── Model.java │ │ │ │ ├── SkeletonModel.java │ │ │ │ ├── SheepFurModel.java │ │ │ │ ├── TexturedQuad.java │ │ │ │ ├── ZombieModel.java │ │ │ │ ├── AnimalModel.java │ │ │ │ └── CreeperModel.java │ │ │ ├── gui │ │ │ │ ├── OptionButton.java │ │ │ │ ├── TexturePackData.java │ │ │ │ ├── ChatScreenData.java │ │ │ │ ├── Button.java │ │ │ │ ├── inputscreens │ │ │ │ │ ├── CloudColorInputScreen.java │ │ │ │ │ ├── CloudLevelInputScreen.java │ │ │ │ │ ├── FogColorInputScreen.java │ │ │ │ │ ├── WaterLevelInputScreen.java │ │ │ │ │ ├── LightColorInputScreen.java │ │ │ │ │ ├── ShadowColorInputScreen.java │ │ │ │ │ └── SkyColorInputScreen.java │ │ │ │ ├── GenerateLevelScreen.java │ │ │ │ ├── GameOverScreen.java │ │ │ │ ├── LevelDialog.java │ │ │ │ ├── ScaledResolution.java │ │ │ │ ├── SaveLevelScreen.java │ │ │ │ ├── MoreControlsScreen.java │ │ │ │ ├── ControlsScreen.java │ │ │ │ └── ErrorScreen.java │ │ │ ├── PlayerListComparator.java │ │ │ ├── Setting.java │ │ │ ├── render │ │ │ │ ├── texture │ │ │ │ │ ├── TextureFX.java │ │ │ │ │ ├── Textures.java │ │ │ │ │ ├── TextureFireFX.java │ │ │ │ │ └── TextureWaterFX.java │ │ │ │ ├── HeldBlock.java │ │ │ │ ├── BlockData.java │ │ │ │ ├── ChunkDistanceComparator.java │ │ │ │ ├── BlockDistanceComparator.java │ │ │ │ ├── ChunkDirtyDistanceComparator.java │ │ │ │ ├── Frustum.java │ │ │ │ └── GLAllocation.java │ │ │ ├── mob │ │ │ │ ├── QuadrupedMob.java │ │ │ │ ├── ai │ │ │ │ │ ├── AI.java │ │ │ │ │ └── JumpAttackAI.java │ │ │ │ ├── Creeper.java │ │ │ │ ├── Zombie.java │ │ │ │ ├── Spider.java │ │ │ │ ├── Skeleton$1.java │ │ │ │ ├── Pig.java │ │ │ │ ├── Skeleton.java │ │ │ │ ├── Sheep$1.java │ │ │ │ └── Creeper$1.java │ │ │ ├── KeyBinding.java │ │ │ ├── ThirdPersonMode.java │ │ │ ├── HackState.java │ │ │ ├── HotKeyData.java │ │ │ ├── PlayerListNameData.java │ │ │ ├── player │ │ │ │ ├── PlayerAI.java │ │ │ │ └── InputHandler.java │ │ │ ├── physics │ │ │ │ └── CustomAABB.java │ │ │ ├── MovingObjectPosition.java │ │ │ ├── SelectionBoxDistanceComparator.java │ │ │ ├── net │ │ │ │ ├── PositionUpdate.java │ │ │ │ └── ServerConnectThread.java │ │ │ ├── particle │ │ │ │ ├── SmokeParticle.java │ │ │ │ ├── WaterDropParticle.java │ │ │ │ ├── ParticleManager.java │ │ │ │ └── TerrainParticle.java │ │ │ ├── SelectionBoxData.java │ │ │ ├── item │ │ │ │ ├── TakeEntityAnim.java │ │ │ │ └── ItemModel.java │ │ │ ├── OperatingSystem.java │ │ │ ├── SessionData.java │ │ │ ├── ChatLine.java │ │ │ ├── gamemode │ │ │ │ ├── CreativeGameMode.java │ │ │ │ └── GameMode.java │ │ │ └── ChatClickData.java │ │ ├── util │ │ │ ├── Timer.java │ │ │ ├── MathHelper.java │ │ │ ├── ColorCache.java │ │ │ ├── Vertex.java │ │ │ ├── StreamingUtil.java │ │ │ ├── IntersectionHelper.java │ │ │ └── Vec3D.java │ │ └── nbt │ │ │ ├── NBTTagEnd.java │ │ │ ├── NBTTagInt.java │ │ │ ├── NBTTagByte.java │ │ │ ├── NBTTagShort.java │ │ │ ├── NBTTagLong.java │ │ │ ├── NBTTagFloat.java │ │ │ ├── NBTTagDouble.java │ │ │ ├── NBTTagString.java │ │ │ ├── NBTTagByteArray.java │ │ │ └── NBTTagIntArray.java │ └── oyasunadev │ │ └── mcraft │ │ └── client │ │ ├── util │ │ └── Constants.java │ │ └── core │ │ └── MCraftApplet.java │ └── de │ └── jarnbjo │ ├── ogg │ ├── EndOfOggStreamException.java │ └── OggFormatException.java │ ├── vorbis │ ├── VorbisFormatException.java │ ├── Residue0.java │ ├── Residue1.java │ ├── Mapping.java │ ├── Floor0.java │ └── Mode.java │ └── util │ └── audio │ └── FadeableAudioInputStream.java └── .travis.yml /src/main/resources/null: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: java -------------------------------------------------------------------------------- /src/main/java/bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewphorn/ClassiCube-Client/HEAD/src/main/java/bg.jpg -------------------------------------------------------------------------------- /src/main/java/bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewphorn/ClassiCube-Client/HEAD/src/main/java/bg.png -------------------------------------------------------------------------------- /src/main/java/2char.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewphorn/ClassiCube-Client/HEAD/src/main/java/2char.png -------------------------------------------------------------------------------- /src/main/java/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Main-Class: com.oyasunadev.mcraft.client.core.MinecraftStandalone 2 | 3 | -------------------------------------------------------------------------------- /src/main/java/char.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewphorn/ClassiCube-Client/HEAD/src/main/java/char.png -------------------------------------------------------------------------------- /src/main/java/clouds.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewphorn/ClassiCube-Client/HEAD/src/main/java/clouds.png -------------------------------------------------------------------------------- /src/main/java/dirt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewphorn/ClassiCube-Client/HEAD/src/main/java/dirt.png -------------------------------------------------------------------------------- /src/main/java/grass.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewphorn/ClassiCube-Client/HEAD/src/main/java/grass.png -------------------------------------------------------------------------------- /src/main/java/rain.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewphorn/ClassiCube-Client/HEAD/src/main/java/rain.png -------------------------------------------------------------------------------- /src/main/java/rock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewphorn/ClassiCube-Client/HEAD/src/main/java/rock.png -------------------------------------------------------------------------------- /src/main/java/rsbg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewphorn/ClassiCube-Client/HEAD/src/main/java/rsbg.jpg -------------------------------------------------------------------------------- /src/main/java/snow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewphorn/ClassiCube-Client/HEAD/src/main/java/snow.png -------------------------------------------------------------------------------- /src/main/java/water.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewphorn/ClassiCube-Client/HEAD/src/main/java/water.png -------------------------------------------------------------------------------- /src/main/java/default.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewphorn/ClassiCube-Client/HEAD/src/main/java/default.gif -------------------------------------------------------------------------------- /src/main/java/default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewphorn/ClassiCube-Client/HEAD/src/main/java/default.png -------------------------------------------------------------------------------- /src/main/java/gui/gui.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewphorn/ClassiCube-Client/HEAD/src/main/java/gui/gui.png -------------------------------------------------------------------------------- /src/main/java/mob/croc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewphorn/ClassiCube-Client/HEAD/src/main/java/mob/croc.png -------------------------------------------------------------------------------- /src/main/java/mob/pig.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewphorn/ClassiCube-Client/HEAD/src/main/java/mob/pig.png -------------------------------------------------------------------------------- /src/main/java/terrain.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewphorn/ClassiCube-Client/HEAD/src/main/java/terrain.png -------------------------------------------------------------------------------- /src/main/resources/bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewphorn/ClassiCube-Client/HEAD/src/main/resources/bg.png -------------------------------------------------------------------------------- /src/main/java/armor/chain.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewphorn/ClassiCube-Client/HEAD/src/main/java/armor/chain.png -------------------------------------------------------------------------------- /src/main/java/armor/plate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewphorn/ClassiCube-Client/HEAD/src/main/java/armor/plate.png -------------------------------------------------------------------------------- /src/main/java/gui/icons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewphorn/ClassiCube-Client/HEAD/src/main/java/gui/icons.png -------------------------------------------------------------------------------- /src/main/java/item/arrows.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewphorn/ClassiCube-Client/HEAD/src/main/java/item/arrows.png -------------------------------------------------------------------------------- /src/main/java/item/sign.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewphorn/ClassiCube-Client/HEAD/src/main/java/item/sign.png -------------------------------------------------------------------------------- /src/main/java/mob/chicken.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewphorn/ClassiCube-Client/HEAD/src/main/java/mob/chicken.png -------------------------------------------------------------------------------- /src/main/java/mob/creeper.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewphorn/ClassiCube-Client/HEAD/src/main/java/mob/creeper.png -------------------------------------------------------------------------------- /src/main/java/mob/printer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewphorn/ClassiCube-Client/HEAD/src/main/java/mob/printer.png -------------------------------------------------------------------------------- /src/main/java/mob/sheep.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewphorn/ClassiCube-Client/HEAD/src/main/java/mob/sheep.png -------------------------------------------------------------------------------- /src/main/java/mob/spider.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewphorn/ClassiCube-Client/HEAD/src/main/java/mob/spider.png -------------------------------------------------------------------------------- /src/main/java/mob/zombie.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewphorn/ClassiCube-Client/HEAD/src/main/java/mob/zombie.png -------------------------------------------------------------------------------- /src/main/java/particles.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewphorn/ClassiCube-Client/HEAD/src/main/java/particles.png -------------------------------------------------------------------------------- /src/main/resources/2char.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewphorn/ClassiCube-Client/HEAD/src/main/resources/2char.png -------------------------------------------------------------------------------- /src/main/resources/char.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewphorn/ClassiCube-Client/HEAD/src/main/resources/char.png -------------------------------------------------------------------------------- /src/main/resources/clouds.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewphorn/ClassiCube-Client/HEAD/src/main/resources/clouds.png -------------------------------------------------------------------------------- /src/main/resources/dirt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewphorn/ClassiCube-Client/HEAD/src/main/resources/dirt.png -------------------------------------------------------------------------------- /src/main/resources/grass.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewphorn/ClassiCube-Client/HEAD/src/main/resources/grass.png -------------------------------------------------------------------------------- /src/main/resources/rain.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewphorn/ClassiCube-Client/HEAD/src/main/resources/rain.png -------------------------------------------------------------------------------- /src/main/resources/rock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewphorn/ClassiCube-Client/HEAD/src/main/resources/rock.png -------------------------------------------------------------------------------- /src/main/resources/snow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewphorn/ClassiCube-Client/HEAD/src/main/resources/snow.png -------------------------------------------------------------------------------- /src/main/resources/water.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewphorn/ClassiCube-Client/HEAD/src/main/resources/water.png -------------------------------------------------------------------------------- /src/main/java/mob/sheep_fur.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewphorn/ClassiCube-Client/HEAD/src/main/java/mob/sheep_fur.png -------------------------------------------------------------------------------- /src/main/java/mob/skeleton.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewphorn/ClassiCube-Client/HEAD/src/main/java/mob/skeleton.png -------------------------------------------------------------------------------- /src/main/resources/default.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewphorn/ClassiCube-Client/HEAD/src/main/resources/default.gif -------------------------------------------------------------------------------- /src/main/resources/default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewphorn/ClassiCube-Client/HEAD/src/main/resources/default.png -------------------------------------------------------------------------------- /src/main/resources/gui/gui.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewphorn/ClassiCube-Client/HEAD/src/main/resources/gui/gui.png -------------------------------------------------------------------------------- /src/main/resources/mob/croc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewphorn/ClassiCube-Client/HEAD/src/main/resources/mob/croc.png -------------------------------------------------------------------------------- /src/main/resources/mob/pig.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewphorn/ClassiCube-Client/HEAD/src/main/resources/mob/pig.png -------------------------------------------------------------------------------- /src/main/resources/terrain.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewphorn/ClassiCube-Client/HEAD/src/main/resources/terrain.png -------------------------------------------------------------------------------- /src/main/resources/armor/chain.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewphorn/ClassiCube-Client/HEAD/src/main/resources/armor/chain.png -------------------------------------------------------------------------------- /src/main/resources/armor/plate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewphorn/ClassiCube-Client/HEAD/src/main/resources/armor/plate.png -------------------------------------------------------------------------------- /src/main/resources/gui/icons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewphorn/ClassiCube-Client/HEAD/src/main/resources/gui/icons.png -------------------------------------------------------------------------------- /src/main/resources/item/arrows.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewphorn/ClassiCube-Client/HEAD/src/main/resources/item/arrows.png -------------------------------------------------------------------------------- /src/main/resources/item/sign.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewphorn/ClassiCube-Client/HEAD/src/main/resources/item/sign.png -------------------------------------------------------------------------------- /src/main/resources/mob/chicken.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewphorn/ClassiCube-Client/HEAD/src/main/resources/mob/chicken.png -------------------------------------------------------------------------------- /src/main/resources/mob/creeper.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewphorn/ClassiCube-Client/HEAD/src/main/resources/mob/creeper.png -------------------------------------------------------------------------------- /src/main/resources/mob/printer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewphorn/ClassiCube-Client/HEAD/src/main/resources/mob/printer.png -------------------------------------------------------------------------------- /src/main/resources/mob/sheep.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewphorn/ClassiCube-Client/HEAD/src/main/resources/mob/sheep.png -------------------------------------------------------------------------------- /src/main/resources/mob/spider.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewphorn/ClassiCube-Client/HEAD/src/main/resources/mob/spider.png -------------------------------------------------------------------------------- /src/main/resources/mob/zombie.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewphorn/ClassiCube-Client/HEAD/src/main/resources/mob/zombie.png -------------------------------------------------------------------------------- /src/main/resources/particles.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewphorn/ClassiCube-Client/HEAD/src/main/resources/particles.png -------------------------------------------------------------------------------- /src/main/resources/mob/sheep_fur.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewphorn/ClassiCube-Client/HEAD/src/main/resources/mob/sheep_fur.png -------------------------------------------------------------------------------- /src/main/resources/mob/skeleton.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewphorn/ClassiCube-Client/HEAD/src/main/resources/mob/skeleton.png -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/sound/SoundPos.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.sound; 2 | 3 | public interface SoundPos { 4 | float getDistanceSq(); 5 | 6 | float getRotationDiff(); 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/StopGameException.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft; 2 | 3 | public class StopGameException extends Error { 4 | private static final long serialVersionUID = 1L; 5 | } 6 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/level/generator/noise/Noise.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.level.generator.noise; 2 | 3 | public abstract class Noise { 4 | public abstract double compute(double x, double z); 5 | } 6 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/level/tile/DirtBlock.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.level.tile; 2 | 3 | public final class DirtBlock extends Block { 4 | 5 | protected DirtBlock(int id) { 6 | super(id); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/sound/Audio.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.sound; 2 | 3 | public interface Audio { 4 | public boolean isFootStep(boolean really); 5 | 6 | boolean play(int[] var1, int[] var2, int var3); 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/model/PigModel.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.model; 2 | 3 | public final class PigModel extends AnimalModel { 4 | 5 | public PigModel() { 6 | super(6); 7 | headOffset = 1.125F; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/gui/OptionButton.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.gui; 2 | 3 | public final class OptionButton extends Button { 4 | 5 | public OptionButton(int id, int x, int y, String text) { 6 | super(id, x, y, 150, text); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/sound/AudioInfo.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.sound; 2 | 3 | public class AudioInfo { 4 | public float volume = 1F; 5 | public boolean isFootstep = false; 6 | 7 | public int update(short[] var1, int var2) { 8 | return 0; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/sound/SoundData.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.sound; 2 | 3 | public class SoundData { 4 | public short[] data; 5 | 6 | public float length; 7 | 8 | public SoundData(short[] data, float length) { 9 | this.data = data; 10 | this.length = length; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/level/tile/StoneBlock.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.level.tile; 2 | 3 | public final class StoneBlock extends Block { 4 | 5 | public StoneBlock(int id) { 6 | super(id); 7 | } 8 | 9 | @Override 10 | public final int getDrop() { 11 | return COBLESTONE.id; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/gui/TexturePackData.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.gui; 2 | 3 | public class TexturePackData { 4 | String location; 5 | String name; 6 | 7 | public TexturePackData(String fileLocation, String texturePackName) { 8 | name = texturePackName; 9 | location = fileLocation; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/level/tile/CobblestoneBlock.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.level.tile; 2 | 3 | public final class CobblestoneBlock extends Block { 4 | 5 | public CobblestoneBlock(int id) { 6 | super(id); 7 | } 8 | 9 | @Override 10 | public final int getDrop() { 11 | return COBLESTONE.id; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/model/BlockModel.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.model; 2 | 3 | public class BlockModel extends Model { 4 | public BlockModel() { 5 | headOffset = 1F; 6 | } 7 | 8 | @Override 9 | public void render(float f, float f1, float f2, 10 | float yawDegrees, float pitchDegrees, float scale) { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/PlayerListComparator.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft; 2 | 3 | import java.util.Comparator; 4 | 5 | public class PlayerListComparator implements Comparator { 6 | 7 | @Override 8 | public int compare(PlayerListNameData o1, PlayerListNameData o2) { 9 | return o1.groupName.compareToIgnoreCase(o2.groupName); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/Setting.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft; 2 | 3 | public enum Setting { 4 | MUSIC, SOUND, 5 | INVERT_MOUSE, SHOW_DEBUG, 6 | VIEW_DISTANCE, VIEW_BOBBING, 7 | FRAMERATE_LIMIT, SMOOTHING, 8 | ANISOTROPIC, ALLOW_SERVER_TEXTURES, 9 | SPEEDHACK_TYPE, FONT_SCALE, 10 | ENABLE_HACKS, SHOW_NAMES 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/render/texture/TextureFX.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.render.texture; 2 | 3 | public class TextureFX { 4 | public byte[] textureData = new byte[1024]; 5 | 6 | public int textureId; 7 | public int scaling = 1; 8 | 9 | public TextureFX(int textureID) { 10 | textureId = textureID; 11 | } 12 | 13 | public void animate() { 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/sound/StepSoundSand.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.sound; 2 | 3 | public final class StepSoundSand extends StepSound { 4 | public StepSoundSand(String soundName, float soundVolume, float soundPitch) { 5 | super(soundName, soundVolume, soundPitch); 6 | } 7 | 8 | @Override 9 | public String getBreakSound() { 10 | return "dig.wood"; 11 | } 12 | } -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/level/tile/MetalBlock.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.level.tile; 2 | 3 | public final class MetalBlock extends Block { 4 | 5 | public MetalBlock(int id) { 6 | super(id); 7 | } 8 | 9 | @Override 10 | public final int getTextureId(int texture) { 11 | return texture == 1 ? textureId - 16 : texture == 0 ? textureId + 16 : textureId; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/mob/QuadrupedMob.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.mob; 2 | 3 | import com.mojang.minecraft.level.Level; 4 | 5 | public class QuadrupedMob extends Mob { 6 | 7 | protected QuadrupedMob(Level level, String modelName, float posX, float posY, float posZ) { 8 | super(level, modelName); 9 | setSize(1.4F, 1.2F); 10 | this.setPos(posX, posY, posZ); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/level/tile/SandStoneBlock.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.level.tile; 2 | 3 | public final class SandStoneBlock extends Block { 4 | 5 | public SandStoneBlock(int id) { 6 | super(id); 7 | } 8 | 9 | @Override 10 | public final int getTextureId(int texture) { 11 | return texture == 1 ? textureId - 16 : texture == 0 ? textureId + 16 : textureId; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/KeyBinding.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | * Holds information about a keybinding 7 | */ 8 | public class KeyBinding implements Serializable { 9 | 10 | public String name; 11 | 12 | public int key; 13 | 14 | public KeyBinding(String name, int key) { 15 | this.name = name; 16 | this.key = key; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/level/NextTickListEntry.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.level; 2 | 3 | public final class NextTickListEntry { 4 | 5 | public int x; 6 | public int y; 7 | public int z; 8 | public int block; 9 | public int ticks; 10 | 11 | public NextTickListEntry(int x, int y, int z, int block) { 12 | this.x = x; 13 | this.y = y; 14 | this.z = z; 15 | this.block = block; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/level/tile/TextureSide.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.level.tile; 2 | 3 | public enum TextureSide { 4 | Bottom(0), Top(1), 5 | 6 | /* 7 | * Not very sure about these values. 8 | */ 9 | Front(2), Back(3), Left(4), Right(5); 10 | 11 | private int id; 12 | 13 | private TextureSide(int id) { 14 | this.id = id; 15 | } 16 | 17 | public int getID() { 18 | return id; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/level/tile/BookshelfBlock.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.level.tile; 2 | 3 | public final class BookshelfBlock extends Block { 4 | 5 | public BookshelfBlock(int id) { 6 | super(id); 7 | } 8 | 9 | @Override 10 | public final int getDropCount() { 11 | return 0; 12 | } 13 | 14 | @Override 15 | public final int getTextureId(int texture) { 16 | return texture <= 1 ? 4 : textureId; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/level/tile/LeavesBlock.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.level.tile; 2 | 3 | public final class LeavesBlock extends LeavesBaseBlock { 4 | 5 | protected LeavesBlock(int id) { 6 | super(id); 7 | } 8 | 9 | @Override 10 | public final int getDrop() { 11 | return Block.SAPLING.id; 12 | } 13 | 14 | @Override 15 | public final int getDropCount() { 16 | return random.nextInt(10) == 0 ? 1 : 0; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/level/tile/MagmaBlock.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.level.tile; 2 | 3 | import com.mojang.util.ColorCache; 4 | import com.mojang.minecraft.level.Level; 5 | 6 | public final class MagmaBlock extends Block { 7 | 8 | protected MagmaBlock(int id) { 9 | super(id); 10 | } 11 | 12 | @Override 13 | protected final ColorCache getBrightness(Level level, int x, int y, int z) { 14 | return new ColorCache(255F / 255F, 255F / 255F, 255F / 255F); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/sound/StepSoundStone.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.sound; 2 | 3 | public final class StepSoundStone extends StepSound { 4 | public StepSoundStone(String soundName, float soundVolume, float soundPitch) { 5 | super(soundName, soundVolume, soundPitch); 6 | } 7 | 8 | @Override 9 | public String getBreakSound() { 10 | return "random.glass"; 11 | } 12 | 13 | @Override 14 | public String getPlaceSound() { 15 | return "step.stone"; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/ThirdPersonMode.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft; 2 | 3 | public enum ThirdPersonMode { 4 | NONE, 5 | BACK_FACING, 6 | FRONT_FACING { 7 | @Override 8 | public ThirdPersonMode next() { 9 | return values()[0]; // rollover to the first element 10 | }; 11 | }; 12 | 13 | public ThirdPersonMode next() { 14 | // No bounds checking required here, because the last instance overrides 15 | return values()[ordinal() + 1]; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/model/SheepModel.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.model; 2 | 3 | public final class SheepModel extends AnimalModel { 4 | 5 | public SheepModel() { 6 | super(12); 7 | headOffset = 0.375F; 8 | head = new ModelPart(0, 0); 9 | head.setBounds(-3F, -4F, -6F, 6, 6, 8, 0F); 10 | head.setPosition(0F, 6F, -8F); 11 | body = new ModelPart(28, 8); 12 | body.setBounds(-4F, -10F, -7F, 8, 16, 6, 0F); 13 | body.setPosition(0F, 5F, 2F); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/level/generator/noise/CombinedNoise.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.level.generator.noise; 2 | 3 | public final class CombinedNoise extends Noise { 4 | private Noise noise1; 5 | 6 | private Noise noise2; 7 | 8 | public CombinedNoise(Noise noise1, Noise noise2) { 9 | this.noise1 = noise1; 10 | this.noise2 = noise2; 11 | } 12 | 13 | @Override 14 | public double compute(double x, double z) { 15 | return noise1.compute(x + noise2.compute(x, z), z); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/mob/ai/AI.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.mob.ai; 2 | 3 | import java.io.Serializable; 4 | 5 | import com.mojang.minecraft.Entity; 6 | import com.mojang.minecraft.level.Level; 7 | import com.mojang.minecraft.mob.Mob; 8 | 9 | public abstract class AI implements Serializable { 10 | 11 | public int defaultLookAngle = 0; 12 | 13 | public void beforeRemove() { 14 | } 15 | 16 | public void hurt(Entity other, int amount) { 17 | } 18 | 19 | public void tick(Level level, Mob mob) { 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/HackState.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft; 2 | 3 | public class HackState { 4 | public static boolean noclip, speed, fly, respawn, opHacks = true; 5 | 6 | public static void setAllDisabled() { 7 | noclip = false; 8 | speed = false; 9 | fly = false; 10 | opHacks = false; 11 | } 12 | 13 | public static void setAllEnabled() { 14 | noclip = true; 15 | speed = true; 16 | fly = true; 17 | respawn = true; 18 | opHacks = true; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/level/tile/OreBlock.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.level.tile; 2 | 3 | public final class OreBlock extends Block { 4 | 5 | public OreBlock(int id) { 6 | super(id); 7 | } 8 | 9 | @Override 10 | public final int getDrop() { 11 | return this == COAL_ORE ? SLAB.id : this == GOLD_ORE ? GOLD_BLOCK.id 12 | : this == IRON_ORE ? IRON_BLOCK.id : id; 13 | } 14 | 15 | @Override 16 | public final int getDropCount() { 17 | return random.nextInt(3) + 1; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/render/HeldBlock.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.render; 2 | 3 | import com.mojang.minecraft.Minecraft; 4 | import com.mojang.minecraft.level.tile.Block; 5 | 6 | public class HeldBlock { 7 | public Minecraft minecraft; 8 | 9 | public Block block = null; 10 | 11 | public float pos = 0F; 12 | 13 | public float lastPos = 0F; 14 | public int offset = 0; 15 | 16 | public boolean moving = false; 17 | 18 | public HeldBlock(Minecraft minecraft) { 19 | this.minecraft = minecraft; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/mob/ai/JumpAttackAI.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.mob.ai; 2 | 3 | public class JumpAttackAI extends BasicAttackAI { 4 | 5 | public JumpAttackAI() { 6 | // this.runSpeed *= 0.8F; 7 | } 8 | 9 | @Override 10 | protected void jumpFromGround() { 11 | if (attackTarget == null) { 12 | super.jumpFromGround(); 13 | } else { 14 | mob.xd = 0F; 15 | mob.zd = 0F; 16 | mob.moveRelative(0F, 1F, 0.6F); 17 | mob.yd = 0.5F; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/HotKeyData.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft; 2 | 3 | /** 4 | * Class used to store data for the Hotkey CPE extension 5 | * 6 | * @author Jon 7 | */ 8 | public class HotKeyData { 9 | public String label; 10 | public String action; 11 | public int keyCode; 12 | public byte keyMods; 13 | 14 | public HotKeyData(String label, String action, int keyCode, byte keyMods) { 15 | this.label = label; 16 | this.action = action; 17 | this.keyCode = keyCode; 18 | this.keyMods = keyMods; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/level/liquid/LiquidType.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.level.liquid; 2 | 3 | public class LiquidType { 4 | public static final LiquidType notLiquid = new LiquidType(0); 5 | public static final LiquidType water = new LiquidType(1); 6 | public static final LiquidType lava = new LiquidType(2); 7 | public static final LiquidType snow = new LiquidType(3); 8 | private LiquidType[] values; 9 | 10 | private LiquidType(int type) { 11 | values = new LiquidType[5]; 12 | 13 | values[type] = this; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/util/Timer.java: -------------------------------------------------------------------------------- 1 | package com.mojang.util; 2 | 3 | public class Timer { 4 | public static final double NANOSEC_PER_SEC = 1000000000D; 5 | public float tps; 6 | 7 | public double firstHR; 8 | public double lastHR; 9 | public int elapsedTicks; 10 | public float delta; 11 | public float speed = 1F; 12 | public float elapsedDelta = 0F; 13 | 14 | public double lastFrameDuration; 15 | 16 | public Timer(float tps) { 17 | this.tps = tps; 18 | this.firstHR = System.nanoTime()/NANOSEC_PER_SEC; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/PlayerListNameData.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft; 2 | 3 | public class PlayerListNameData { 4 | public short nameID; 5 | public String playerName; 6 | public String listName; 7 | public String groupName; 8 | public Byte groupRank; 9 | 10 | public PlayerListNameData(short NameID, String PlayerName, String ListName, String GroupName, 11 | Byte GroupRank) { 12 | nameID = NameID; 13 | playerName = PlayerName; 14 | listName = ListName; 15 | groupName = GroupName; 16 | groupRank = GroupRank; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/level/tile/WoodBlock.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.level.tile; 2 | 3 | public final class WoodBlock extends Block { 4 | 5 | protected WoodBlock(int id) { 6 | super(id); 7 | textureId = 20; 8 | } 9 | 10 | @Override 11 | public final int getDrop() { 12 | return WOOD.id; 13 | } 14 | 15 | @Override 16 | public final int getDropCount() { 17 | return random.nextInt(3) + 3; 18 | } 19 | 20 | @Override 21 | public final int getTextureId(int texture) { 22 | return texture == 1 ? 21 : texture == 0 ? 21 : 20; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/mob/Creeper.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.mob; 2 | 3 | import com.mojang.minecraft.level.Level; 4 | 5 | public class Creeper extends Mob { 6 | 7 | public Creeper(Level level, float posX, float posY, float posZ) { 8 | super(level, "creeper"); 9 | heightOffset = 1.62F; 10 | textureName = "/mob/creeper.png"; 11 | ai = new Creeper$1(this); 12 | ai.defaultLookAngle = 45; 13 | deathScore = 200; 14 | this.setPos(posX, posY, posZ); 15 | } 16 | 17 | @Override 18 | public float getBrightness() { 19 | return 80; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/mob/Zombie.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.mob; 2 | 3 | import com.mojang.minecraft.level.Level; 4 | import com.mojang.minecraft.mob.ai.BasicAttackAI; 5 | import com.mojang.minecraft.render.texture.Textures; 6 | 7 | public class Zombie extends HumanoidMob { 8 | 9 | public Zombie(Level level, float posX, float posY, float posZ) { 10 | super(level, "zombie", posX, posY, posZ); 11 | textureName = Textures.MOB_ZOMBIE; 12 | heightOffset = 1.62F; 13 | ai = new BasicAttackAI(); 14 | deathScore = 80; 15 | ai.defaultLookAngle = 30; 16 | // ai.runSpeed = 1F; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/sound/EntitySoundPos.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.sound; 2 | 3 | import com.mojang.minecraft.Entity; 4 | 5 | public class EntitySoundPos extends BaseSoundPos { 6 | private Entity source; 7 | 8 | public EntitySoundPos(Entity source, Entity listener) { 9 | super(listener); 10 | 11 | this.source = source; 12 | } 13 | 14 | @Override 15 | public float getDistanceSq() { 16 | return super.getDistanceSq(source.x, source.y, source.z); 17 | } 18 | 19 | @Override 20 | public float getRotationDiff() { 21 | return super.getRotationDiff(source.x, source.z); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/gui/ChatScreenData.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.gui; 2 | 3 | import com.mojang.minecraft.physics.AABB; 4 | 5 | public class ChatScreenData { 6 | 7 | public float width; 8 | public float height; 9 | public float x; 10 | public float y; 11 | public String string; 12 | public AABB bounds; 13 | 14 | public ChatScreenData(float width, float height, float x, float y, String message) { 15 | this.width = width; 16 | this.height = height; 17 | this.x = x; 18 | this.y = y; 19 | string = message; 20 | bounds = new AABB(x, y, 0, width, y + height, 0); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/mob/Spider.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.mob; 2 | 3 | import com.mojang.minecraft.level.Level; 4 | import com.mojang.minecraft.mob.ai.JumpAttackAI; 5 | import com.mojang.minecraft.render.texture.Textures; 6 | 7 | public class Spider extends QuadrupedMob { 8 | 9 | public Spider(Level level, float posX, float posY, float posZ) { 10 | super(level, "spider", posX, posY, posZ); 11 | heightOffset = 0.72F; 12 | textureName = Textures.MOB_SPIDER; 13 | setSize(1.4F, 0.9F); 14 | this.setPos(posX, posY, posZ); 15 | deathScore = 105; 16 | bobStrength = 0F; 17 | ai = new JumpAttackAI(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/player/PlayerAI.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.player; 2 | 3 | import com.mojang.minecraft.mob.ai.BasicAI; 4 | 5 | // PlayerAI 6 | public class PlayerAI extends BasicAI { 7 | private final Player player; 8 | 9 | public PlayerAI(Player player) { 10 | this.player = player; 11 | } 12 | 13 | @Override 14 | protected void update() { 15 | jumping = player.input.jumping; 16 | running = player.input.running; 17 | flying = player.input.flying; 18 | flyingUp = player.input.flyingUp; 19 | flyingDown = player.input.flyingDown; 20 | xxa = player.input.xxa; 21 | yya = player.input.yya; 22 | } 23 | } -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/model/Model.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.model; 2 | 3 | public abstract class Model { 4 | public static final String HUMANOID = "humanoid"; 5 | 6 | public float attackOffset; 7 | public float headOffset; 8 | 9 | /** 10 | * Sets the model's various rotation angles. For bipeds, var1 and var2 are 11 | * used for animating the movement of arms and legs, where var1 represents 12 | * the time(so that arms and legs swing back and forth) and var2 represents 13 | * how "far" arms and legs can swing at most. 14 | */ 15 | public void render(float var1, float var2, float var3, 16 | float yawDegrees, float pitchDegrees, float scale) { 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/sound/LevelSoundPos.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.sound; 2 | 3 | import com.mojang.minecraft.Entity; 4 | 5 | public final class LevelSoundPos extends BaseSoundPos { 6 | private float x; 7 | 8 | private float y; 9 | 10 | private float z; 11 | 12 | public LevelSoundPos(float x, float y, float z, Entity listener) { 13 | super(listener); 14 | 15 | this.x = x; 16 | this.y = y; 17 | this.z = z; 18 | } 19 | 20 | @Override 21 | public float getDistanceSq() { 22 | return super.getDistanceSq(x, y, z); 23 | } 24 | 25 | @Override 26 | public float getRotationDiff() { 27 | return super.getRotationDiff(x, z); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/render/BlockData.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.render; 2 | 3 | import com.mojang.minecraft.level.tile.Block; 4 | import com.mojang.minecraft.player.Player; 5 | 6 | public final class BlockData { 7 | 8 | public int x; 9 | public int y; 10 | public int z; 11 | public Block block; 12 | 13 | public BlockData(int x, int y, int z, Block block) { 14 | this.x = x; 15 | this.y = y; 16 | this.z = z; 17 | this.block = block; 18 | } 19 | 20 | public final float distanceSquared(Player var1) { 21 | float var2 = var1.x - x; 22 | float var3 = var1.y - y; 23 | float var4 = var1.z - z; 24 | return var2 * var2 + var3 * var3 + var4 * var4; 25 | } 26 | } -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/physics/CustomAABB.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.physics; 2 | 3 | /** 4 | * A custom implementation of AABB designed to stop the graphical glitches in 5 | * SelectionBoxes 6 | * 7 | * @author Jon 8 | */ 9 | public class CustomAABB { 10 | 11 | public float maxX; 12 | public float maxY; 13 | public float maxZ; 14 | public float minX; 15 | public float minY; 16 | public float minZ; 17 | 18 | public CustomAABB(float maxX, float maxY, float maxZ, float minX, float minY, float minZ) { 19 | this.maxX = maxX - 0.02F; 20 | this.maxY = maxY - 0.02F; 21 | this.maxZ = maxZ - 0.02F; 22 | this.minX = minX + 0.02F; 23 | this.minY = minY + 0.02F; 24 | this.minZ = minZ + 0.02F; 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/level/tile/MushroomBlock.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.level.tile; 2 | 3 | import java.util.Random; 4 | 5 | import com.mojang.minecraft.level.Level; 6 | 7 | public final class MushroomBlock extends FlowerBlock { 8 | 9 | protected MushroomBlock(int id) { 10 | super(id); 11 | float offset = 0.2F; 12 | setBounds(0.5F - offset, 0F, 0.5F - offset, offset + 0.5F, offset * 2F, offset + 0.5F); 13 | } 14 | 15 | @Override 16 | public final void update(Level level, int x, int y, int z, Random rand) { 17 | int var6 = level.getTile(x, y - 1, z); 18 | if (level.isLit(x, y, z) || var6 != STONE.id && var6 != GRAVEL.id && var6 != COBLESTONE.id) { 19 | level.setTile(x, y, z, 0); 20 | } 21 | 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/mob/Skeleton$1.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.mob; 2 | 3 | import com.mojang.minecraft.level.Level; 4 | import com.mojang.minecraft.mob.ai.BasicAttackAI; 5 | 6 | final class Skeleton$1 extends BasicAttackAI { 7 | 8 | // $FF: synthetic field 9 | final Skeleton parent; 10 | 11 | Skeleton$1(Skeleton skeleton) { 12 | parent = skeleton; 13 | } 14 | 15 | @Override 16 | public final void beforeRemove() { 17 | Skeleton.shootRandomArrow(parent); 18 | } 19 | 20 | @Override 21 | public final void tick(Level level, Mob mob) { 22 | super.tick(level, mob); 23 | if (mob.health > 0 && random.nextInt(30) == 0 && attackTarget != null) { 24 | parent.shootArrow(level); 25 | } 26 | 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/MovingObjectPosition.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft; 2 | 3 | import com.mojang.util.Vec3D; 4 | 5 | public class MovingObjectPosition { 6 | public boolean hasEntity; 7 | 8 | public int x; 9 | public int y; 10 | public int z; 11 | public int face; 12 | public Vec3D vec; 13 | 14 | public Entity entity; 15 | 16 | public MovingObjectPosition(Entity entity) { 17 | hasEntity = true; 18 | this.entity = entity; 19 | } 20 | 21 | public MovingObjectPosition(int x, int y, int z, int side, Vec3D blockPos) { 22 | hasEntity = false; 23 | 24 | this.x = x; 25 | this.y = y; 26 | this.z = z; 27 | 28 | face = side; 29 | 30 | vec = new Vec3D(blockPos.x, blockPos.y, blockPos.z); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/level/tile/GlassBlock.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.level.tile; 2 | 3 | import com.mojang.minecraft.level.Level; 4 | 5 | public class GlassBlock extends Block { 6 | 7 | private boolean showNeighborSides = false; 8 | 9 | protected GlassBlock(int id) { 10 | super(id); 11 | } 12 | 13 | @Override 14 | public final boolean canRenderSide(Level level, int x, int y, int z, int side) { 15 | int var6 = level.getTile(x, y, z); 16 | return !(!showNeighborSides && var6 == id) && super.canRenderSide(level, x, y, z, side); 17 | } 18 | 19 | @Override 20 | public final boolean isOpaque() { 21 | return false; 22 | } 23 | 24 | @Override 25 | public final boolean isSolid() { 26 | return false; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/level/tile/LeavesBaseBlock.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.level.tile; 2 | 3 | import com.mojang.minecraft.level.Level; 4 | 5 | public class LeavesBaseBlock extends Block { 6 | 7 | private boolean showNeighborSides = true; 8 | 9 | protected LeavesBaseBlock(int id) { 10 | super(id); 11 | } 12 | 13 | @Override 14 | public final boolean canRenderSide(Level level, int x, int y, int z, int side) { 15 | int var6 = level.getTile(x, y, z); 16 | return !(!showNeighborSides && var6 == id) && super.canRenderSide(level, x, y, z, side); 17 | } 18 | 19 | @Override 20 | public final boolean isOpaque() { 21 | return false; 22 | } 23 | 24 | @Override 25 | public final boolean isSolid() { 26 | return false; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/gui/Button.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.gui; 2 | 3 | public class Button extends Screen { 4 | 5 | public int x; 6 | public int y; 7 | public String text; 8 | public int id; 9 | public boolean active; 10 | public boolean visible; 11 | int width; 12 | int height; 13 | 14 | public Button(int buttonID, int buttonX, int buttonY, int buttonWidth, String buttonText) { 15 | width = 200; 16 | height = 20; 17 | active = true; 18 | visible = true; 19 | id = buttonID; 20 | x = buttonX; 21 | y = buttonY; 22 | width = buttonWidth; 23 | height = 20; 24 | text = buttonText; 25 | } 26 | 27 | public Button(int id, int x, int y, String text) { 28 | this(id, x, y, 200, text); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/render/ChunkDistanceComparator.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.render; 2 | 3 | import java.util.Comparator; 4 | 5 | import com.mojang.minecraft.player.Player; 6 | 7 | public class ChunkDistanceComparator implements Comparator { 8 | private final Player player; 9 | 10 | public ChunkDistanceComparator(Player player) { 11 | this.player = player; 12 | } 13 | 14 | @Override 15 | public int compare(Chunk chunk, Chunk other) { 16 | 17 | float sqDist = chunk.distanceSquared(player); 18 | float otherSqDist = other.distanceSquared(player); 19 | 20 | if (sqDist == otherSqDist) { 21 | return 0; 22 | } else if (sqDist > otherSqDist) { 23 | return -1; 24 | } else { 25 | return 1; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/render/BlockDistanceComparator.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.render; 2 | 3 | import java.util.Comparator; 4 | 5 | import com.mojang.minecraft.player.Player; 6 | 7 | public class BlockDistanceComparator implements Comparator { 8 | private Player player; 9 | 10 | public BlockDistanceComparator(Player player) { 11 | this.player = player; 12 | } 13 | 14 | @Override 15 | public int compare(BlockData block, BlockData other) { 16 | 17 | float sqDist = block.distanceSquared(player); 18 | float otherSqDist = other.distanceSquared(player); 19 | 20 | if (sqDist == otherSqDist) { 21 | return 0; 22 | } else if (sqDist > otherSqDist) { 23 | return -1; 24 | } else { 25 | return 1; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/SelectionBoxDistanceComparator.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft; 2 | 3 | import java.util.Comparator; 4 | 5 | import com.mojang.minecraft.player.Player; 6 | 7 | public class SelectionBoxDistanceComparator implements Comparator { 8 | 9 | private Player player; 10 | 11 | public SelectionBoxDistanceComparator(Player player) { 12 | this.player = player; 13 | } 14 | 15 | @Override 16 | public int compare(SelectionBoxData o1, SelectionBoxData o2) { 17 | float sqDist0 = o1.distanceSquared0(player); 18 | float otherSqDist0 = o2.distanceSquared0(player); 19 | float sqDist1 = o1.distanceSquared1(player); 20 | float otherSqDist1 = o2.distanceSquared1(player); 21 | 22 | return (int) (Math.max(otherSqDist0, otherSqDist1) - Math.max(sqDist0, sqDist1)); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/util/MathHelper.java: -------------------------------------------------------------------------------- 1 | package com.mojang.util; 2 | 3 | public final class MathHelper { 4 | 5 | private static final float[] SIN_TABLE = new float[65536]; 6 | 7 | static { 8 | for (int i = 0; i < 65536; ++i) { 9 | SIN_TABLE[i] = (float) Math.sin(((double) i) * Math.PI * 2D / 65536D); 10 | } 11 | } 12 | 13 | public static int clamp(int value, int min, int max) { 14 | return Math.max(min, Math.min(max, value)); 15 | } 16 | 17 | public static float cos(float theta) { 18 | return SIN_TABLE[(int) (theta * (float) (32768D / Math.PI) + 16384F) & '\uffff']; 19 | } 20 | 21 | public static float sin(float theta) { 22 | return SIN_TABLE[(int) (theta * (float) (32768D / Math.PI)) & '\uffff']; 23 | } 24 | 25 | public static float sqrt(float num) { 26 | return (float) Math.sqrt(num); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/sound/StepSound.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.sound; 2 | 3 | public class StepSound { 4 | public final String stepSoundName; 5 | public final float stepSoundVolume; 6 | public final float stepSoundPitch; 7 | 8 | public StepSound(String soundName, float soundVolume, float soundPitch) { 9 | stepSoundName = soundName; 10 | stepSoundVolume = soundVolume; 11 | stepSoundPitch = soundPitch; 12 | } 13 | 14 | public String getBreakSound() { 15 | return "dig." + stepSoundName; 16 | } 17 | 18 | public float getPitch() { 19 | return stepSoundPitch; 20 | } 21 | 22 | public String getPlaceSound() { 23 | return getBreakSound(); 24 | } 25 | 26 | public String getStepSound() { 27 | return "step." + stepSoundName; 28 | } 29 | 30 | public float getVolume() { 31 | return stepSoundVolume; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/level/generator/noise/OctaveNoise.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.level.generator.noise; 2 | 3 | import java.util.Random; 4 | 5 | public class OctaveNoise extends Noise { 6 | private PerlinNoise[] perlin; 7 | 8 | private int octaves; 9 | 10 | public OctaveNoise(Random random, int octaves) { 11 | this.octaves = octaves; 12 | perlin = new PerlinNoise[octaves]; 13 | 14 | for (int count = 0; count < octaves; count++) { 15 | perlin[count] = new PerlinNoise(random); 16 | } 17 | 18 | } 19 | 20 | @Override 21 | public double compute(double x, double z) { 22 | double result = 0D; 23 | double noiseLevel = 1D; 24 | 25 | for (int count = 0; count < octaves; count++) { 26 | result += perlin[count].compute(x / noiseLevel, z / noiseLevel) * noiseLevel; 27 | noiseLevel *= 2D; 28 | } 29 | 30 | return result; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/model/SkeletonModel.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.model; 2 | 3 | public final class SkeletonModel extends ZombieModel { 4 | 5 | public SkeletonModel() { 6 | headOffset = 0F; 7 | rightArm = new ModelPart(40, 16); 8 | rightArm.setBounds(-1F, -2F, -1F, 2, 12, 2, 0F); 9 | rightArm.setPosition(-5F, 2F, 0F); 10 | leftArm = new ModelPart(40, 16); 11 | leftArm.mirror = true; 12 | leftArm.setBounds(-1F, -2F, -1F, 2, 12, 2, 0F); 13 | leftArm.setPosition(5F, 2F, 0F); 14 | rightLeg = new ModelPart(0, 16); 15 | rightLeg.setBounds(-1F, 0F, -1F, 2, 12, 2, 0F); 16 | rightLeg.setPosition(-2F, 12F, 0F); 17 | leftLeg = new ModelPart(0, 16); 18 | leftLeg.mirror = true; 19 | leftLeg.setBounds(-1F, 0F, -1F, 2, 12, 2, 0F); 20 | leftLeg.setPosition(2F, 12F, 0F); 21 | head.allowTransparency = true; 22 | body.allowTransparency = true; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/mob/Pig.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.mob; 2 | 3 | import com.mojang.minecraft.Entity; 4 | import com.mojang.minecraft.item.Item; 5 | import com.mojang.minecraft.level.Level; 6 | import com.mojang.minecraft.level.tile.Block; 7 | import com.mojang.minecraft.render.texture.Textures; 8 | 9 | public class Pig extends QuadrupedMob { 10 | 11 | public Pig(Level level, float posX, float posY, float posZ) { 12 | super(level, "pig", posX, posY, posZ); 13 | heightOffset = 1.72F; 14 | textureName = Textures.MOB_PIG; 15 | } 16 | 17 | @Override 18 | public void die(Entity killedBy) { 19 | if (killedBy != null) { 20 | killedBy.awardKillScore(this, 10); 21 | } 22 | 23 | int var2 = (int) (Math.random() + Math.random() + 1D); 24 | 25 | for (int var3 = 0; var3 < var2; ++var3) { 26 | level.addEntity(new Item(level, x, y, z, Block.BROWN_MUSHROOM.id)); 27 | } 28 | 29 | super.die(killedBy); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/de/jarnbjo/ogg/EndOfOggStreamException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * $ProjectName$ 3 | * $ProjectRevision$ 4 | * ----------------------------------------------------------- 5 | * $Id: EndOfOggStreamException.java,v 1.1 2003/03/03 21:02:20 jarnbjo Exp $ 6 | * ----------------------------------------------------------- 7 | * 8 | * $Author: jarnbjo $ 9 | * 10 | * Description: 11 | * 12 | * Copyright 2002-2003 Tor-Einar Jarnbjo 13 | * ----------------------------------------------------------- 14 | * 15 | * Change History 16 | * ----------------------------------------------------------- 17 | * $Log: EndOfOggStreamException.java,v $ 18 | * Revision 1.1 2003/03/03 21:02:20 jarnbjo 19 | * no message 20 | * 21 | */ 22 | 23 | package de.jarnbjo.ogg; 24 | 25 | import java.io.IOException; 26 | 27 | /** 28 | * Exception thrown when reaching the end of an Ogg stream 29 | */ 30 | 31 | public class EndOfOggStreamException extends IOException { 32 | private static final long serialVersionUID = 1L; 33 | 34 | public EndOfOggStreamException() { 35 | } 36 | } -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/net/PositionUpdate.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.net; 2 | 3 | public class PositionUpdate { 4 | public float x; 5 | 6 | public float y; 7 | 8 | public float z; 9 | 10 | public float yaw; 11 | public float pitch; 12 | public boolean rotation = false; 13 | 14 | public boolean position = false; 15 | 16 | public PositionUpdate(float yaw, float pitch) { 17 | this.yaw = yaw; 18 | this.pitch = pitch; 19 | 20 | rotation = true; 21 | position = false; 22 | } 23 | 24 | public PositionUpdate(float x, float y, float z) { 25 | this.x = x; 26 | this.y = y; 27 | this.z = z; 28 | 29 | position = true; 30 | rotation = false; 31 | } 32 | 33 | public PositionUpdate(float x, float y, float z, float yaw, float pitch) { 34 | this.x = x; 35 | this.y = y; 36 | this.z = z; 37 | this.yaw = yaw; 38 | this.pitch = pitch; 39 | 40 | rotation = true; 41 | position = true; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/particle/SmokeParticle.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.particle; 2 | 3 | import com.mojang.minecraft.level.Level; 4 | 5 | public class SmokeParticle extends Particle { 6 | 7 | public SmokeParticle(Level level, float x, float y, float z) { 8 | super(level, x, y, z, 0F, 0F, 0F); 9 | xd *= 0.1F; 10 | yd *= 0.1F; 11 | zd *= 0.1F; 12 | rCol = gCol = bCol = (float) (Math.random() * 0.30000001192092896D); 13 | lifetime = (int) (8D / (Math.random() * 0.8D + 0.2D)); 14 | noPhysics = true; 15 | } 16 | 17 | @Override 18 | public void tick() { 19 | xo = x; 20 | yo = y; 21 | zo = z; 22 | if (age++ >= lifetime) { 23 | remove(); 24 | } 25 | 26 | tex = 7 - (age << 3) / lifetime; 27 | yd = (float) (yd + 0.004D); 28 | move(xd, yd, zd); 29 | xd *= 0.96F; 30 | yd *= 0.96F; 31 | zd *= 0.96F; 32 | if (onGround) { 33 | xd *= 0.7F; 34 | zd *= 0.7F; 35 | } 36 | 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/model/SheepFurModel.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.model; 2 | 3 | public final class SheepFurModel extends AnimalModel { 4 | 5 | public SheepFurModel() { 6 | super(12); 7 | head = new ModelPart(0, 0); 8 | head.setBounds(-3F, -4F, -4F, 6, 6, 6, 0.6F); 9 | head.setPosition(0F, 6F, -8F); 10 | body = new ModelPart(28, 8); 11 | body.setBounds(-4F, -10F, -7F, 8, 16, 6, 1.75F); 12 | body.setPosition(0F, 5F, 2F); 13 | float var1 = 0.5F; 14 | leg1 = new ModelPart(0, 16); 15 | leg1.setBounds(-2F, 0F, -2F, 4, 6, 4, var1); 16 | leg1.setPosition(-3F, 12F, 7F); 17 | leg2 = new ModelPart(0, 16); 18 | leg2.setBounds(-2F, 0F, -2F, 4, 6, 4, var1); 19 | leg2.setPosition(3F, 12F, 7F); 20 | leg3 = new ModelPart(0, 16); 21 | leg3.setBounds(-2F, 0F, -2F, 4, 6, 4, var1); 22 | leg3.setPosition(-3F, 12F, -5F); 23 | leg4 = new ModelPart(0, 16); 24 | leg4.setBounds(-2F, 0F, -2F, 4, 6, 4, var1); 25 | leg4.setPosition(3F, 12F, -5F); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/level/tile/SaplingBlock.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.level.tile; 2 | 3 | import java.util.Random; 4 | 5 | import com.mojang.minecraft.level.Level; 6 | 7 | public final class SaplingBlock extends FlowerBlock { 8 | 9 | protected SaplingBlock(int id) { 10 | super(id); 11 | float var3 = 0.4F; 12 | setBounds(0.5F - var3, 0F, 0.5F - var3, var3 + 0.5F, var3 * 2F, var3 + 0.5F); 13 | } 14 | 15 | @Override 16 | public final void update(Level level, int x, int y, int z, Random rand) { 17 | if (id != ROPE.id) { 18 | int var6 = level.getTile(x, y - 1, z); 19 | if (level.isLit(x, y, z) && (var6 == DIRT.id || var6 == GRASS.id)) { 20 | if (rand.nextInt(5) == 0) { 21 | level.setTileNoUpdate(x, y, z, 0); 22 | if (!level.maybeGrowTree(x, y, z)) { 23 | level.setTileNoUpdate(x, y, z, id); 24 | } 25 | } 26 | 27 | } else { 28 | level.setTile(x, y, z, 0); 29 | } 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/level/tile/RopeBlock.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.level.tile; 2 | 3 | import java.util.Random; 4 | 5 | import com.mojang.minecraft.level.Level; 6 | 7 | public final class RopeBlock extends FlowerBlock { 8 | 9 | protected RopeBlock(int id) { 10 | super(id); 11 | float offset = 0.3F; 12 | setBounds(0.5F - offset, 0F, 0.5F - offset, offset + 0.5F, offset * 3F, offset + 0.5F); 13 | } 14 | 15 | @Override 16 | public final void update(Level level, int x, int y, int z, Random rand) { 17 | if (id != ROPE.id) { 18 | int var6 = level.getTile(x, y - 1, z); 19 | if (level.isLit(x, y, z) && (var6 == DIRT.id || var6 == GRASS.id)) { 20 | if (rand.nextInt(5) == 0) { 21 | level.setTileNoUpdate(x, y, z, 0); 22 | if (!level.maybeGrowTree(x, y, z)) { 23 | level.setTileNoUpdate(x, y, z, id); 24 | } 25 | } 26 | 27 | } else { 28 | level.setTile(x, y, z, 0); 29 | } 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/render/ChunkDirtyDistanceComparator.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.render; 2 | 3 | import java.util.Comparator; 4 | 5 | import com.mojang.minecraft.player.Player; 6 | 7 | public class ChunkDirtyDistanceComparator implements Comparator { 8 | private final Player player; 9 | 10 | public ChunkDirtyDistanceComparator(Player player) { 11 | this.player = player; 12 | } 13 | 14 | @Override 15 | public int compare(Chunk chunk, Chunk other) { 16 | if (chunk.visible || !other.visible) { 17 | if (other.visible) { 18 | float sqDist = chunk.distanceSquared(player); 19 | float otherSqDist = other.distanceSquared(player); 20 | 21 | if (sqDist == otherSqDist) { 22 | return 0; 23 | } else if (sqDist > otherSqDist) { 24 | return -1; 25 | } else { 26 | return 1; 27 | } 28 | } else { 29 | return 1; 30 | } 31 | } else { 32 | return -1; 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/SelectionBoxData.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft; 2 | 3 | import com.mojang.minecraft.physics.CustomAABB; 4 | import com.mojang.minecraft.player.Player; 5 | import com.mojang.util.ColorCache; 6 | 7 | public class SelectionBoxData { 8 | public byte id; 9 | public String name; 10 | public ColorCache color; 11 | public CustomAABB bounds; 12 | 13 | public SelectionBoxData(byte ID, String Name, ColorCache Color, CustomAABB Bounds) { 14 | this.id = ID; 15 | this.name = Name; 16 | this.bounds = Bounds; 17 | this.color = Color; 18 | } 19 | 20 | public final float distanceSquared0(Player player) { 21 | float dx = player.x - bounds.maxX; 22 | float dy = player.y - bounds.maxY; 23 | float dz = player.z - bounds.maxZ; 24 | return dx * dx + dy * dy + dz * dz; 25 | } 26 | 27 | public final float distanceSquared1(Player player) { 28 | float dx = player.x - bounds.minX; 29 | float dy = player.y - bounds.minY; 30 | float dz = player.z - bounds.minZ; 31 | return dx * dx + dy * dy + dz * dz; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/player/InputHandler.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.player; 2 | 3 | public class InputHandler { 4 | 5 | public float xxa = 0F; 6 | public float yya = 0F; 7 | public boolean jumping = false; 8 | 9 | public boolean running = false; 10 | 11 | public boolean flyingUp = false; 12 | public boolean flyingDown = false; 13 | public boolean flying = false; 14 | public float move = 0F; 15 | public float strafe = 0F; 16 | public float elevate = 0F; 17 | public float mult = 1F; 18 | public boolean fall = false; 19 | public boolean jump = false; 20 | public boolean cliplock = false; 21 | public int HacksMode = 0; // java doesn't have package aliasing 22 | boolean canMove = true; 23 | 24 | // eg import x as y 25 | // so this has to be unique from the module name 26 | // so that I can import that module to check status of 27 | // noclip, fly, and speed. 28 | 29 | public void resetKeys() { 30 | } 31 | 32 | public void setKeyState(int key, boolean state) { 33 | } 34 | 35 | public void updateMovement(int HackMode) { 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/sound/SoundInfo.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.sound; 2 | 3 | // TODO. 4 | public final class SoundInfo extends AudioInfo { 5 | 6 | private SoundData data; 7 | private float seek = 0F; 8 | private float pitch; 9 | 10 | public SoundInfo(SoundData var1, float var2, float var3) { 11 | data = var1; 12 | pitch = var2 * 44100F / var1.length; 13 | volume = var3; 14 | } 15 | 16 | @Override 17 | public final int update(short[] var1, int var2) { 18 | if (seek >= data.data.length) { 19 | return 0; 20 | } else { 21 | for (int var3 = 0; var3 < var2; ++var3) { 22 | int var4 = (int) seek; 23 | short var5 = data.data[var4]; 24 | short var6 = var4 < data.data.length - 1 ? data.data[var4 + 1] : 0; 25 | var1[var3] = (short) (int) (var5 + (var6 - var5) * (seek - var4)); 26 | seek += pitch; 27 | if (seek >= data.data.length) { 28 | return var3; 29 | } 30 | } 31 | 32 | return var2; 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/de/jarnbjo/ogg/OggFormatException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * $ProjectName$ 3 | * $ProjectRevision$ 4 | * ----------------------------------------------------------- 5 | * $Id: OggFormatException.java,v 1.1 2003/03/03 21:02:20 jarnbjo Exp $ 6 | * ----------------------------------------------------------- 7 | * 8 | * $Author: jarnbjo $ 9 | * 10 | * Description: 11 | * 12 | * Copyright 2002-2003 Tor-Einar Jarnbjo 13 | * ----------------------------------------------------------- 14 | * 15 | * Change History 16 | * ----------------------------------------------------------- 17 | * $Log: OggFormatException.java,v $ 18 | * Revision 1.1 2003/03/03 21:02:20 jarnbjo 19 | * no message 20 | * 21 | */ 22 | 23 | package de.jarnbjo.ogg; 24 | 25 | import java.io.IOException; 26 | 27 | /** 28 | * Exception thrown when trying to read a corrupted Ogg stream. 29 | */ 30 | 31 | public class OggFormatException extends IOException { 32 | 33 | private static final long serialVersionUID = 1L; 34 | 35 | public OggFormatException() { 36 | super(); 37 | } 38 | 39 | public OggFormatException(String message) { 40 | super(message); 41 | } 42 | } -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/level/tile/SpongeBlock.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.level.tile; 2 | 3 | import com.mojang.minecraft.level.Level; 4 | 5 | public final class SpongeBlock extends Block { 6 | 7 | protected SpongeBlock(int id) { 8 | super(id); 9 | } 10 | 11 | @Override 12 | public final void onAdded(Level level, int x, int y, int z) { 13 | for (int i = x - 2; i <= x + 2; ++i) { 14 | for (int j = y - 2; j <= y + 2; ++j) { 15 | for (int k = z - 2; k <= z + 2; ++k) { 16 | if (level.isWater(i, j, k)) { 17 | level.setTileNoNeighborChange(i, j, k, 0); 18 | } 19 | } 20 | } 21 | } 22 | 23 | } 24 | 25 | @Override 26 | public final void onRemoved(Level level, int x, int y, int z) { 27 | for (int i = x - 2; i <= x + 2; ++i) { 28 | for (int j = y - 2; j <= y + 2; ++j) { 29 | for (int k = z - 2; k <= z + 2; ++k) { 30 | level.updateNeighborsAt(i, j, k, level.getTile(i, j, k)); 31 | } 32 | } 33 | } 34 | 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/particle/WaterDropParticle.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.particle; 2 | 3 | import com.mojang.minecraft.level.Level; 4 | 5 | public class WaterDropParticle extends Particle { 6 | 7 | public WaterDropParticle(Level level, float x, float y, float z) { 8 | super(level, x, y, z, 0F, 0F, 0F); 9 | xd *= 0.3F; 10 | yd = (float) Math.random() * 0.2F + 0.1F; 11 | zd *= 0.3F; 12 | rCol = 1F; 13 | gCol = 1F; 14 | bCol = 1F; 15 | tex = 16; 16 | setSize(0.01F, 0.01F); 17 | lifetime = (int) (8D / (Math.random() * 0.8D + 0.2D)); 18 | } 19 | 20 | @Override 21 | public void tick() { 22 | xo = x; 23 | yo = y; 24 | zo = z; 25 | yd = (float) (yd - 0.06D); 26 | move(xd, yd, zd); 27 | xd *= 0.98F; 28 | yd *= 0.98F; 29 | zd *= 0.98F; 30 | if (lifetime-- <= 0) { 31 | remove(); 32 | } 33 | 34 | if (onGround) { 35 | if (Math.random() < 0.5D) { 36 | remove(); 37 | } 38 | 39 | xd *= 0.7F; 40 | zd *= 0.7F; 41 | } 42 | 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/de/jarnbjo/vorbis/VorbisFormatException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * $ProjectName$ 3 | * $ProjectRevision$ 4 | * ----------------------------------------------------------- 5 | * $Id: VorbisFormatException.java,v 1.2 2003/03/16 01:11:12 jarnbjo Exp $ 6 | * ----------------------------------------------------------- 7 | * 8 | * $Author: jarnbjo $ 9 | * 10 | * Description: 11 | * 12 | * Copyright 2002-2003 Tor-Einar Jarnbjo 13 | * ----------------------------------------------------------- 14 | * 15 | * Change History 16 | * ----------------------------------------------------------- 17 | * $Log: VorbisFormatException.java,v $ 18 | * Revision 1.2 2003/03/16 01:11:12 jarnbjo 19 | * no message 20 | * 21 | * 22 | */ 23 | 24 | package de.jarnbjo.vorbis; 25 | 26 | import java.io.IOException; 27 | 28 | /** 29 | * Exception thrown when trying to read a corrupted Vorbis stream. 30 | */ 31 | 32 | public class VorbisFormatException extends IOException { 33 | 34 | private static final long serialVersionUID = 1L; 35 | 36 | public VorbisFormatException() { 37 | super(); 38 | } 39 | 40 | public VorbisFormatException(String message) { 41 | super(message); 42 | } 43 | } -------------------------------------------------------------------------------- /src/main/java/com/oyasunadev/mcraft/client/util/Constants.java: -------------------------------------------------------------------------------- 1 | package com.oyasunadev.mcraft.client.util; 2 | 3 | /** 4 | * Created with IntelliJ IDEA. User: Oliver Yasuna Date: 9/30/12 Time: 7:57 PM 5 | */ 6 | public class Constants { 7 | /** 8 | * Just a reference to the Minecraft version if needed. 9 | */ 10 | public static final String MINECRAFT_VERSION = "0.30"; 11 | 12 | /** 13 | * ClassiCube Version. 14 | */ 15 | public static final String CLASSICUBE_VERSION = "0.14"; 16 | 17 | /** 18 | * The Minecraft Classic protocol version. Default is 0x07. 19 | */ 20 | public static final byte PROTOCOL_VERSION = 0x07; 21 | /** 22 | * The client type sent to the server to identify what client is being used. 23 | * Default is 0x00. 24 | */ 25 | public static final byte CLIENT_TYPE = 0x42; 26 | 27 | public static final String CLIENT_NAME = "ClassiCube Client"; 28 | 29 | // TODO Add system information 30 | public static final String USER_AGENT = "ClassiCube " + CLASSICUBE_VERSION + "(Minecraft " 31 | + MINECRAFT_VERSION + "; Protocol " + PROTOCOL_VERSION + ")"; 32 | 33 | public static final byte CUSTOM_BLOCK_SUPPORT_LEVEL = 1; 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/net/ServerConnectThread.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.net; 2 | 3 | import com.mojang.minecraft.Minecraft; 4 | import com.mojang.minecraft.gui.ErrorScreen; 5 | import com.mojang.util.LogUtil; 6 | 7 | public class ServerConnectThread extends Thread { 8 | 9 | private final String server; 10 | private final int port; 11 | private final Minecraft minecraft; 12 | private final NetworkManager netManager; 13 | 14 | public ServerConnectThread(NetworkManager networkManager, String server, int port, Minecraft minecraft) { 15 | this.netManager = networkManager; 16 | this.server = server; 17 | this.port = port; 18 | this.minecraft = minecraft; 19 | } 20 | 21 | @Override 22 | public void run() { 23 | try { 24 | netManager.connect(server, port); 25 | } catch (Exception ex) { 26 | LogUtil.logError("Failed to connect", ex); 27 | minecraft.setCurrentScreen(new ErrorScreen("Failed to connect", 28 | "You failed to connect to the server. It\'s probably down!")); 29 | minecraft.isConnecting = false; 30 | minecraft.networkManager = null; 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/level/LevelObjectInputStream.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.level; 2 | 3 | import java.io.IOException; 4 | import java.io.InputStream; 5 | import java.io.ObjectInputStream; 6 | import java.io.ObjectStreamClass; 7 | import java.util.HashSet; 8 | import java.util.Set; 9 | 10 | import com.mojang.util.LogUtil; 11 | 12 | public final class LevelObjectInputStream extends ObjectInputStream { 13 | 14 | private final Set classes = new HashSet<>(); 15 | 16 | public LevelObjectInputStream(InputStream inputStream) throws IOException { 17 | super(inputStream); 18 | classes.add("Player$1"); 19 | classes.add("Creeper$1"); 20 | classes.add("Skeleton$1"); 21 | } 22 | 23 | @Override 24 | protected final ObjectStreamClass readClassDescriptor() { 25 | try { 26 | ObjectStreamClass var1 = super.readClassDescriptor(); 27 | return classes.contains(var1.getName()) ? ObjectStreamClass.lookup(Class.forName(var1 28 | .getName())) : var1; 29 | } catch (Exception ex) { 30 | LogUtil.logError("Error reading class descriptor from LevelObjectInputStream", ex); 31 | return null; 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/model/TexturedQuad.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.model; 2 | 3 | import com.mojang.util.Vertex; 4 | 5 | public final class TexturedQuad { 6 | 7 | public Vertex[] vertices; 8 | 9 | private TexturedQuad(Vertex[] vertices) { 10 | this.vertices = vertices; 11 | } 12 | 13 | public TexturedQuad(Vertex[] vertices, float var2, float var3, float var4, float var5) { 14 | this(vertices); 15 | vertices[0] = vertices[0].create(var4, var3); 16 | vertices[1] = vertices[1].create(var2, var3); 17 | vertices[2] = vertices[2].create(var2, var5); 18 | vertices[3] = vertices[3].create(var4, var5); 19 | } 20 | 21 | public TexturedQuad(Vertex[] vertices, int var2, int var3, int var4, int var5) { 22 | this(vertices); 23 | float var7 = 0.0015625F; // 1 / 640 24 | float var6 = 0.003125F; // 1 / 320 25 | vertices[0] = vertices[0].create(var4 / 64F - var7, var3 / 32F + var6); 26 | vertices[1] = vertices[1].create(var2 / 64F + var7, var3 / 32F + var6); 27 | vertices[2] = vertices[2].create(var2 / 64F + var7, var5 / 32F - var6); 28 | vertices[3] = vertices[3].create(var4 / 64F - var7, var5 / 32F - var6); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/model/ZombieModel.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.model; 2 | 3 | import com.mojang.util.MathHelper; 4 | 5 | public class ZombieModel extends HumanoidModel { 6 | 7 | @Override 8 | public final void setRotationAngles(float var1, float var2, float var3, float var4, float var5, 9 | float var6) { 10 | super.setRotationAngles(var1, var2, var3, var4, var5, var6); 11 | var1 = MathHelper.sin(attackOffset * (float) Math.PI); 12 | var2 = MathHelper.sin((1F - (1F - attackOffset) * (1F - attackOffset)) * (float) Math.PI); 13 | rightArm.roll = 0F; 14 | leftArm.roll = 0F; 15 | rightArm.yaw = -(0.1F - var1 * 0.6F); 16 | leftArm.yaw = 0.1F - var1 * 0.6F; 17 | rightArm.pitch = -(float) (Math.PI / 2D); 18 | leftArm.pitch = -(float) (Math.PI / 2D); 19 | rightArm.pitch -= var1 * 1.2F - var2 * 0.4F; 20 | leftArm.pitch -= var1 * 1.2F - var2 * 0.4F; 21 | rightArm.roll += MathHelper.cos(var3 * 0.09F) * 0.05F + 0.05F; 22 | leftArm.roll -= MathHelper.cos(var3 * 0.09F) * 0.05F + 0.05F; 23 | rightArm.pitch += MathHelper.sin(var3 * 0.067F) * 0.05F; 24 | leftArm.pitch -= MathHelper.sin(var3 * 0.067F) * 0.05F; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/nbt/NBTTagEnd.java: -------------------------------------------------------------------------------- 1 | package com.mojang.nbt; 2 | 3 | import java.io.DataInput; 4 | import java.io.DataOutput; 5 | import java.io.IOException; 6 | 7 | public class NBTTagEnd extends NBTBase { 8 | public NBTTagEnd() { 9 | super(null); 10 | } 11 | 12 | /** 13 | * Read the actual data contents of the tag, implemented in NBT extension classes. 14 | * 15 | * @param input The input stream to read from. 16 | */ 17 | @Override 18 | void load(DataInput input) throws IOException { 19 | } 20 | 21 | /** 22 | * Write the actual data contents of the tag, implemented in NBT extension classes. 23 | * 24 | * @param output The output stream to write to. 25 | */ 26 | @Override 27 | void write(DataOutput output) throws IOException { 28 | } 29 | 30 | /** 31 | * Gets the type byte for the tag. 32 | * 33 | * @return byte 34 | */ 35 | @Override 36 | public byte getId() { 37 | return (byte) 0; 38 | } 39 | 40 | @Override 41 | public String toString() { 42 | return "END"; 43 | } 44 | 45 | /** 46 | * Creates a clone of the tag. 47 | */ 48 | @Override 49 | public NBTBase copy() { 50 | return new NBTTagEnd(); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/render/texture/Textures.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.render.texture; 2 | 3 | public final class Textures { 4 | 5 | public static final String PARTICLES = "/particles.png", 6 | TERRAIN = "/terrain.png", 7 | LOADING_BACKGROUND = "/dirt.png", 8 | MAP_SIDE = "/rock.png", 9 | MAP_EDGE = "/water.png", 10 | FONT = "/default.png", 11 | GUI = "/gui/gui.png", 12 | ICONS = "/gui/icons.png", 13 | ARROWS = "/item/arrows.png", 14 | ARMOR_PLATE = "/armor/plate.png", 15 | SHEEP_FUR = "/mob/sheep_fur.png", 16 | CLOUDS = "/clouds.png", 17 | RAIN = "/rain.png", 18 | SNOW = "/snow.png", 19 | MOB_HUMANOID = "/char.png", 20 | MOB_CHICKEN = "/mob/chicken.png", 21 | MOB_CREEPER = "/mob/creeper.png", 22 | MOB_CROC = "/mob/croc.png", 23 | MOB_PIG = "/mob/pig.png", 24 | MOB_PRINTER = "/mob/printer.png", 25 | MOB_SHEEP = "/mob/sheep.png", 26 | MOB_SKELETON = "/mob/skeleton.png", 27 | MOB_SPIDER = "/mob/spider.png", 28 | MOB_ZOMBIE = "/mob/zombie.png"; 29 | 30 | public static String forModel(String modelName) { 31 | return "/mob/" + modelName + ".png"; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/sound/BaseSoundPos.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.sound; 2 | 3 | import com.mojang.minecraft.Entity; 4 | import com.mojang.util.MathHelper; 5 | 6 | public abstract class BaseSoundPos implements SoundPos { 7 | private Entity listener; 8 | 9 | public BaseSoundPos(Entity listener) { 10 | this.listener = listener; 11 | } 12 | 13 | public float getDistanceSq(float x, float y, float z) { 14 | x -= listener.x; 15 | y -= listener.y; 16 | float var4 = z - listener.z; 17 | 18 | var4 = MathHelper.sqrt(x * x + y * y + var4 * var4); 19 | 20 | if ((var4 = 1F - var4 / 32F) < 0F) { 21 | var4 = 0F; 22 | } 23 | 24 | return var4; 25 | } 26 | 27 | public float getRotationDiff(float x, float y) { 28 | x -= listener.x; 29 | y -= listener.z; 30 | 31 | float var3 = MathHelper.sqrt(x * x + y * y); 32 | 33 | x /= var3; 34 | y /= var3; 35 | 36 | if ((var3 /= 2F) > 1F) { 37 | var3 = 1F; 38 | } 39 | 40 | float var4 = MathHelper.cos(-listener.yRot * (float) (Math.PI / 180D) + (float) Math.PI); 41 | 42 | return (MathHelper.sin(-listener.yRot * (float) (Math.PI / 180D) + (float) Math.PI) * y - var4 43 | * x) 44 | * var3; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/util/ColorCache.java: -------------------------------------------------------------------------------- 1 | package com.mojang.util; 2 | 3 | import java.awt.Color; 4 | import java.io.Serializable; 5 | 6 | /** 7 | * Custom class used to store data compatible with GL11.Color3f Each color (R G 8 | * B A) is fixed to become a maximum of 1f 9 | * 10 | * @author Jon 11 | */ 12 | public class ColorCache implements Serializable { 13 | 14 | public float R; 15 | public float G; 16 | public float B; 17 | public float A; 18 | 19 | public ColorCache(float r, float g, float b) { 20 | R = FixColor(r); 21 | G = FixColor(g); 22 | B = FixColor(b); 23 | A = 1F; 24 | } 25 | 26 | public ColorCache(float r, float g, float b, float a) { 27 | R = FixColor(r); 28 | G = FixColor(g); 29 | B = FixColor(b); 30 | A = a; 31 | } 32 | 33 | public static ColorCache parseHex(String hex) { 34 | Color col = Color.decode("#" + hex); 35 | float r = col.getRed() / 255f; 36 | float g = col.getGreen() / 255f; 37 | float b = col.getBlue() / 255f; 38 | return new ColorCache(r, g, b); 39 | } 40 | 41 | private float FixColor(float color) { 42 | if (color > 1f) { 43 | return 1f; 44 | } 45 | if (color < 0f) { 46 | return 0f; 47 | } 48 | return color; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/gui/inputscreens/CloudColorInputScreen.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.gui.inputscreens; 2 | 3 | import com.mojang.minecraft.gui.Button; 4 | import com.mojang.minecraft.gui.CloudOptionsScreen; 5 | import com.mojang.minecraft.gui.GuiScreen; 6 | 7 | public class CloudColorInputScreen extends InputValueScreen { 8 | 9 | String defaultHex = "ffffff"; 10 | 11 | public CloudColorInputScreen(GuiScreen var1, String var2, int var3, String Title) { 12 | super(var1, var2, var3, Title); 13 | } 14 | 15 | @Override 16 | protected final void onButtonClick(Button button) { 17 | if (button.active) { 18 | if (button.id == 0 && name.length() > 0) { 19 | String color = name; 20 | minecraft.level.cloudColor = Integer.parseInt(color, 16); 21 | minecraft.setCurrentScreen(new CloudOptionsScreen(parent, minecraft.settings)); 22 | } 23 | 24 | if (button.id == 1) { 25 | minecraft.setCurrentScreen(new CloudOptionsScreen(parent, minecraft.settings)); 26 | } 27 | if (button.id == 800) { 28 | minecraft.level.cloudColor = Integer.parseInt(defaultHex, 16); 29 | minecraft.setCurrentScreen(new CloudOptionsScreen(parent, minecraft.settings)); 30 | } 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/gui/inputscreens/CloudLevelInputScreen.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.gui.inputscreens; 2 | 3 | import com.mojang.minecraft.gui.Button; 4 | import com.mojang.minecraft.gui.CloudOptionsScreen; 5 | import com.mojang.minecraft.gui.GuiScreen; 6 | 7 | public class CloudLevelInputScreen extends InputValueScreen { 8 | 9 | public CloudLevelInputScreen(GuiScreen var1, String var2, int var3, String Title) { 10 | super(var1, var2, var3, Title); 11 | // TODO Auto-generated constructor stub 12 | } 13 | 14 | @Override 15 | protected final void onButtonClick(Button button) { 16 | if (button.active) { 17 | if (button.id == 0 && name.length() > 0) { 18 | String var2 = name; 19 | minecraft.level.cloudLevel = Integer.parseInt(var2); 20 | minecraft.setCurrentScreen(new CloudOptionsScreen(parent, minecraft.settings)); 21 | } 22 | 23 | if (button.id == 1) { 24 | minecraft.setCurrentScreen(new CloudOptionsScreen(parent, minecraft.settings)); 25 | } 26 | if (button.id == 800) { 27 | minecraft.level.cloudLevel = minecraft.level.height + 2; 28 | minecraft.setCurrentScreen(new CloudOptionsScreen(parent, minecraft.settings)); 29 | } 30 | 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/gui/inputscreens/FogColorInputScreen.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.gui.inputscreens; 2 | 3 | import com.mojang.minecraft.gui.AdvancedOptionsScreen; 4 | import com.mojang.minecraft.gui.Button; 5 | import com.mojang.minecraft.gui.GuiScreen; 6 | 7 | public class FogColorInputScreen extends InputValueScreen { 8 | 9 | String defaultHex = "ffffff"; 10 | 11 | public FogColorInputScreen(GuiScreen var1, String var2, int var3, String Title) { 12 | super(var1, var2, var3, Title); 13 | } 14 | 15 | @Override 16 | protected final void onButtonClick(Button button) { 17 | if (button.active) { 18 | if (button.id == 0 && name.length() > 0) { 19 | String color = name; 20 | minecraft.level.fogColor = Integer.parseInt(color, 16); 21 | minecraft.setCurrentScreen(new AdvancedOptionsScreen(parent, minecraft.settings)); 22 | } 23 | 24 | if (button.id == 1) { 25 | minecraft.setCurrentScreen(new AdvancedOptionsScreen(parent, minecraft.settings)); 26 | } 27 | if (button.id == 800) { 28 | minecraft.level.fogColor = Integer.parseInt(defaultHex, 16); 29 | minecraft.setCurrentScreen(new AdvancedOptionsScreen(parent, minecraft.settings)); 30 | } 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/gui/GenerateLevelScreen.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.gui; 2 | 3 | public final class GenerateLevelScreen extends GuiScreen { 4 | 5 | private GuiScreen parent; 6 | 7 | public GenerateLevelScreen(GuiScreen parent) { 8 | this.parent = parent; 9 | } 10 | 11 | @Override 12 | protected final void onButtonClick(Button button) { 13 | if (button.id == 3) { 14 | minecraft.setCurrentScreen(parent); 15 | } else { 16 | minecraft.generateLevel(button.id); 17 | minecraft.setCurrentScreen(null); 18 | minecraft.grabMouse(); 19 | } 20 | } 21 | 22 | @Override 23 | public final void onOpen() { 24 | buttons.clear(); 25 | buttons.add(new Button(0, width / 2 - 100, height / 4, "Small")); 26 | buttons.add(new Button(1, width / 2 - 100, height / 4 + 24, "Normal")); 27 | buttons.add(new Button(2, width / 2 - 100, height / 4 + 48, "Huge")); 28 | buttons.add(new Button(3, width / 2 - 100, height / 4 + 120, "Cancel")); 29 | } 30 | 31 | @Override 32 | public final void render(int var1, int var2) { 33 | drawFadingBox(0, 0, width, height, 1610941696, -1607454624); 34 | drawCenteredString(fontRenderer, "Generate new level", width / 2, 40, 16777215); 35 | super.render(var1, var2); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/mob/Skeleton.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.mob; 2 | 3 | import com.mojang.minecraft.item.Arrow; 4 | import com.mojang.minecraft.level.Level; 5 | 6 | public class Skeleton extends Zombie { 7 | 8 | public Skeleton(Level level, float posX, float posY, float posZ) { 9 | super(level, posX, posY, posZ); 10 | modelName = "skeleton"; 11 | textureName = "/mob/skeleton.png"; 12 | Skeleton$1 skeletonAI = new Skeleton$1(this); 13 | deathScore = 120; 14 | skeletonAI.runSpeed = 0.3F; 15 | skeletonAI.damage = 8; 16 | ai = skeletonAI; 17 | } 18 | 19 | // $FF: synthetic method 20 | static void shootRandomArrow(Skeleton skeleton) { 21 | for (int i = 0; i < (int) ((Math.random() + Math.random()) * 3D + 4D); ++i) { 22 | skeleton.level.addEntity(new Arrow(skeleton.level, skeleton.level.getPlayer(), skeleton.x, 23 | skeleton.y - 0.2F, skeleton.z, (float) Math.random() * 360F, 24 | -((float) Math.random()) * 60F, 0.4F)); 25 | } 26 | 27 | } 28 | 29 | public void shootArrow(Level level) { 30 | level.addEntity(new Arrow(level, this, x, y, z, yRot + 180F 31 | + (float) (Math.random() * 45D - 22.5D), 32 | xRot - (float) (Math.random() * 45D - 10D), 1F 33 | )); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/level/tile/GrassBlock.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.level.tile; 2 | 3 | import java.util.Random; 4 | 5 | import com.mojang.minecraft.level.Level; 6 | 7 | public final class GrassBlock extends Block { 8 | 9 | protected GrassBlock(int id) { 10 | super(id); 11 | textureId = 3; 12 | setPhysics(true); 13 | } 14 | 15 | @Override 16 | public final int getDrop() { 17 | return DIRT.getDrop(); 18 | } 19 | 20 | @Override 21 | public final int getTextureId(int side) { 22 | return side == 1 ? 0 : side == 0 ? 2 : 3; 23 | } 24 | 25 | @Override 26 | public final void update(Level level, int x, int y, int z, Random rand) { 27 | if (rand.nextInt(4) == 0) { 28 | if (!level.isLit(x, y, z)) { 29 | level.setTile(x, y, z, DIRT.id); 30 | } else { 31 | for (int var9 = 0; var9 < 4; ++var9) { 32 | int var6 = x + rand.nextInt(3) - 1; 33 | int var7 = y + rand.nextInt(5) - 3; 34 | int var8 = z + rand.nextInt(3) - 1; 35 | if (level.getTile(var6, var7, var8) == DIRT.id && level.isLit(var6, var7, var8)) { 36 | level.setTile(var6, var7, var8, DIRT.id); 37 | } 38 | } 39 | 40 | } 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/de/jarnbjo/vorbis/Residue0.java: -------------------------------------------------------------------------------- 1 | /* 2 | * $ProjectName$ 3 | * $ProjectRevision$ 4 | * ----------------------------------------------------------- 5 | * $Id: Residue0.java,v 1.2 2003/03/16 01:11:12 jarnbjo Exp $ 6 | * ----------------------------------------------------------- 7 | * 8 | * $Author: jarnbjo $ 9 | * 10 | * Description: 11 | * 12 | * Copyright 2002-2003 Tor-Einar Jarnbjo 13 | * ----------------------------------------------------------- 14 | * 15 | * Change History 16 | * ----------------------------------------------------------- 17 | * $Log: Residue0.java,v $ 18 | * Revision 1.2 2003/03/16 01:11:12 jarnbjo 19 | * no message 20 | * 21 | * 22 | */ 23 | 24 | package de.jarnbjo.vorbis; 25 | 26 | import java.io.IOException; 27 | 28 | import de.jarnbjo.util.io.BitInputStream; 29 | 30 | class Residue0 extends Residue { 31 | 32 | protected Residue0(BitInputStream source, SetupHeader header) throws VorbisFormatException, 33 | IOException { 34 | super(source, header); 35 | } 36 | 37 | protected void decodeResidue(VorbisStream vorbis, BitInputStream source, Mode mode, int ch, 38 | boolean[] doNotDecodeFlags, float[][] vectors) throws VorbisFormatException, 39 | IOException { 40 | /** @todo implement */ 41 | throw new UnsupportedOperationException(); 42 | } 43 | 44 | protected int getType() { 45 | return 0; 46 | } 47 | } -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/level/tile/SnowBlock.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.level.tile; 2 | 3 | import com.mojang.minecraft.level.Level; 4 | import com.mojang.minecraft.physics.AABB; 5 | 6 | public final class SnowBlock extends Block { 7 | 8 | int id; 9 | 10 | public SnowBlock(int id) { 11 | super(id); 12 | this.id = id; 13 | setBounds(0F, 0F, 0F, 1F, 0.20F, 1F); 14 | } 15 | 16 | @Override 17 | public final boolean canRenderSide(Level level, int x, int y, int z, int side) { 18 | if (this != SNOW) { 19 | super.canRenderSide(level, x, y, z, side); 20 | } 21 | 22 | return side == 1 || (super.canRenderSide(level, x, y, z, side) 23 | && (side == 0 || level.getTile(x, y, z) != id)); 24 | } 25 | 26 | @Override 27 | public AABB getCollisionBox(int x, int y, int z) { 28 | return null; 29 | } 30 | 31 | @Override 32 | public final int getDrop() { 33 | return SNOW.id; 34 | } 35 | 36 | @Override 37 | public final int getTextureId(int texture) { 38 | return textureId; 39 | } 40 | 41 | @Override 42 | public final boolean isCube() { 43 | return false; 44 | } 45 | 46 | @Override 47 | public final boolean isOpaque() { 48 | return true; 49 | } 50 | 51 | @Override 52 | public final boolean isSolid() { 53 | return false; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/de/jarnbjo/vorbis/Residue1.java: -------------------------------------------------------------------------------- 1 | /* 2 | * $ProjectName$ 3 | * $ProjectRevision$ 4 | * ----------------------------------------------------------- 5 | * $Id: Residue1.java,v 1.2 2003/03/16 01:11:12 jarnbjo Exp $ 6 | * ----------------------------------------------------------- 7 | * 8 | * $Author: jarnbjo $ 9 | * 10 | * Description: 11 | * 12 | * Copyright 2002-2003 Tor-Einar Jarnbjo 13 | * ----------------------------------------------------------- 14 | * 15 | * Change History 16 | * ----------------------------------------------------------- 17 | * $Log: Residue1.java,v $ 18 | * Revision 1.2 2003/03/16 01:11:12 jarnbjo 19 | * no message 20 | * 21 | * 22 | */ 23 | 24 | package de.jarnbjo.vorbis; 25 | 26 | import java.io.IOException; 27 | 28 | import de.jarnbjo.util.io.BitInputStream; 29 | 30 | class Residue1 extends Residue { 31 | 32 | protected Residue1(BitInputStream source, SetupHeader header) throws VorbisFormatException, 33 | IOException { 34 | super(source, header); 35 | } 36 | 37 | protected void decodeResidue(VorbisStream vorbis, BitInputStream source, Mode mode, int ch, 38 | boolean[] doNotDecodeFlags, float[][] vectors) throws VorbisFormatException, 39 | IOException { 40 | /** @todo implement */ 41 | throw new UnsupportedOperationException(); 42 | } 43 | 44 | protected int getType() { 45 | return 1; 46 | } 47 | 48 | } -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/level/tile/TNTBlock.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.level.tile; 2 | 3 | import com.mojang.minecraft.item.PrimedTnt; 4 | import com.mojang.minecraft.level.Level; 5 | import com.mojang.minecraft.particle.ParticleManager; 6 | 7 | public final class TNTBlock extends Block { 8 | 9 | public TNTBlock(int id) { 10 | super(id); 11 | } 12 | 13 | @Override 14 | public final void explode(Level var1, int x, int y, int z) { 15 | if (!var1.creativeMode) { 16 | PrimedTnt primedTnt = new PrimedTnt(var1, x + 0.5F, y + 0.5F, z + 0.5F); 17 | primedTnt.life = random.nextInt(primedTnt.life / 4) + primedTnt.life / 8; 18 | var1.addEntity(primedTnt); 19 | } 20 | 21 | } 22 | 23 | @Override 24 | public final int getDropCount() { 25 | return 0; 26 | } 27 | 28 | @Override 29 | public final int getTextureId(int texture) { 30 | return texture == 0 ? textureId + 2 : texture == 1 ? textureId + 1 : textureId; 31 | } 32 | 33 | @Override 34 | public final void spawnBreakParticles(Level level, int x, int y, int z, 35 | ParticleManager particleManager) { 36 | if (!level.creativeMode) { 37 | level.addEntity(new PrimedTnt(level, x + 0.5F, y + 0.5F, z + 0.5F)); 38 | } else { 39 | super.spawnBreakParticles(level, x, y, z, particleManager); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/util/Vertex.java: -------------------------------------------------------------------------------- 1 | package com.mojang.util; 2 | 3 | public final class Vertex { 4 | 5 | public Vec3D vector; 6 | public float u; 7 | public float v; 8 | 9 | /** 10 | * Build a Vertex object with the vector coordinates and UV. 11 | * 12 | * @param x 13 | * @param y 14 | * @param z 15 | * @param u 16 | * @param v 17 | */ 18 | public Vertex(float x, float y, float z, float u, float v) { 19 | this(new Vec3D(x, y, z), u, v); 20 | } 21 | 22 | /** 23 | * Build a Vertex object with a prebuilt Vector3D object and UV. 24 | * 25 | * @param vector 26 | * @param u 27 | * @param v 28 | */ 29 | private Vertex(Vec3D vector, float u, float v) { 30 | this.vector = vector; 31 | this.u = u; 32 | this.v = v; 33 | } 34 | 35 | /** 36 | * Build a Vertex object with another Vertex object and UV. 37 | * 38 | * @param vertex 39 | * @param u 40 | * @param v 41 | */ 42 | private Vertex(Vertex vertex, float u, float v) { 43 | vector = vertex.vector; 44 | this.u = u; 45 | this.v = v; 46 | } 47 | 48 | /** 49 | * Build a Vertex object without specifying a coordinate set. 50 | * 51 | * @param u 52 | * @param v 53 | * @return Vertex 54 | */ 55 | public final Vertex create(float u, float v) { 56 | return new Vertex(this, u, v); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/gui/inputscreens/WaterLevelInputScreen.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.gui.inputscreens; 2 | 3 | import com.mojang.minecraft.gui.AdvancedOptionsScreen; 4 | import com.mojang.minecraft.gui.Button; 5 | import com.mojang.minecraft.gui.GuiScreen; 6 | 7 | public class WaterLevelInputScreen extends InputValueScreen { 8 | 9 | public WaterLevelInputScreen(GuiScreen var1, String var2, int var3, String Title) { 10 | super(var1, var2, var3, Title); 11 | // TODO Auto-generated constructor stub 12 | } 13 | 14 | @Override 15 | protected final void onButtonClick(Button button) { 16 | if (button.active) { 17 | if (button.id == 0 && name.length() > 0) { 18 | minecraft.level.waterLevel = Integer.parseInt(name); 19 | minecraft.levelRenderer.refreshEnvironment(); 20 | minecraft.setCurrentScreen(new AdvancedOptionsScreen(parent, minecraft.settings)); 21 | } 22 | 23 | if (button.id == 1) { 24 | minecraft.setCurrentScreen(new AdvancedOptionsScreen(parent, minecraft.settings)); 25 | } 26 | if (button.id == 800) { 27 | minecraft.level.waterLevel = minecraft.level.height / 2; 28 | minecraft.levelRenderer.refreshEnvironment(); 29 | minecraft.setCurrentScreen(new AdvancedOptionsScreen(parent, minecraft.settings)); 30 | } 31 | 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/particle/ParticleManager.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.particle; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import com.mojang.minecraft.Entity; 7 | 8 | public final class ParticleManager { 9 | 10 | public List particles0 = new ArrayList<>(); 11 | public List particles1 = new ArrayList<>(); 12 | 13 | /** 14 | * Spawn a particle. 15 | * 16 | * @param entity The entity spawning the particle. 17 | */ 18 | public final void spawnParticle(Entity entity) { 19 | Particle particle = (Particle) entity; 20 | int textureID = particle.getParticleTexture(); 21 | if (textureID == 0) { 22 | particles0.add(particle); 23 | } else { 24 | particles1.add(particle); 25 | } 26 | } 27 | 28 | /** 29 | * A tick. Calls tick() for all particles I control. 30 | */ 31 | public final void tick() { 32 | tick(particles0); 33 | tick(particles1); 34 | } 35 | 36 | private static void tick(List particles) { 37 | for (int j = 0; j < particles.size(); ++j) { 38 | Particle particle = particles.get(j); 39 | particle.tick(); 40 | if (particle.removed) { 41 | particles.remove(j--); 42 | } 43 | } 44 | } 45 | 46 | public void clear() { 47 | particles0.clear(); 48 | particles1.clear(); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/util/StreamingUtil.java: -------------------------------------------------------------------------------- 1 | package com.mojang.util; 2 | 3 | import java.io.File; 4 | import java.io.FileOutputStream; 5 | import java.io.IOException; 6 | import java.io.InputStream; 7 | import java.nio.channels.Channels; 8 | import java.nio.channels.FileChannel; 9 | import java.nio.channels.ReadableByteChannel; 10 | 11 | /** 12 | * Utility class to deal with streams more efficiently. 13 | */ 14 | 15 | public class StreamingUtil { 16 | private static final int BUFFER_SIZE = 64 * 1024; // 64 KB 17 | 18 | /** 19 | * Reads given stream to the end, and writes its contents to a file 20 | * 21 | * @param inStream The input buffer stream. 22 | * @param file The file to write to. 23 | * @throws IOException 24 | */ 25 | public static void copyStreamToFile(InputStream inStream, File file) throws IOException { 26 | try (ReadableByteChannel in = Channels.newChannel(inStream)) { 27 | if (!file.exists()) { 28 | file.getParentFile().mkdirs(); 29 | file.createNewFile(); 30 | } 31 | try (FileOutputStream outStream = new FileOutputStream(file)) { 32 | FileChannel out = outStream.getChannel(); 33 | long offset = 0; 34 | long count; 35 | while ((count = out.transferFrom(in, offset, BUFFER_SIZE)) > 0) { 36 | offset += count; 37 | } 38 | } 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/level/tile/StillLiquidBlock.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.level.tile; 2 | 3 | import java.util.Random; 4 | 5 | import com.mojang.minecraft.level.Level; 6 | import com.mojang.minecraft.level.liquid.LiquidType; 7 | 8 | public final class StillLiquidBlock extends LiquidBlock { 9 | 10 | protected StillLiquidBlock(int id, LiquidType liquidType) { 11 | super(id, liquidType); 12 | movingId = id - 1; 13 | stillId = id; 14 | setPhysics(false); 15 | } 16 | 17 | @Override 18 | public final void onNeighborChange(Level level, int x, int y, int z, int side) { 19 | if (side != 0) { 20 | LiquidType var7 = Block.blocks[side].getLiquidType(); 21 | if (type == LiquidType.water && var7 == LiquidType.lava || var7 == LiquidType.water 22 | && type == LiquidType.lava) { 23 | level.setTile(x, y, z, Block.STONE.id); 24 | return; 25 | } 26 | } 27 | 28 | if ((level.getTile(x - 1, y, z) == 0 || level.getTile(x + 1, y, z) == 0 29 | || level.getTile(x, y, z - 1) == 0 || level.getTile(x, y, z + 1) == 0 30 | || level.getTile(x, y - 1, z) == 0)) { 31 | level.setTileNoUpdate(x, y, z, movingId); 32 | level.addToTickNextTick(x, y, z, movingId); 33 | } 34 | 35 | } 36 | 37 | @Override 38 | public final void update(Level level, int x, int y, int z, Random rand) { 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/gui/inputscreens/LightColorInputScreen.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.gui.inputscreens; 2 | 3 | import com.mojang.util.ColorCache; 4 | import com.mojang.minecraft.gui.AdvancedOptionsScreen; 5 | import com.mojang.minecraft.gui.Button; 6 | import com.mojang.minecraft.gui.GuiScreen; 7 | 8 | public class LightColorInputScreen extends InputValueScreen { 9 | 10 | public LightColorInputScreen(GuiScreen var1, String var2, int var3, String Title) { 11 | super(var1, var2, var3, Title); 12 | // TODO Auto-generated constructor stub 13 | } 14 | 15 | @Override 16 | protected final void onButtonClick(Button button) { 17 | if (button.active) { 18 | if (button.id == 0 && name.length() > 0) { 19 | minecraft.level.customLightColor = ColorCache.parseHex(name); 20 | minecraft.levelRenderer.refresh(); 21 | minecraft.setCurrentScreen(new AdvancedOptionsScreen(parent, minecraft.settings)); 22 | } 23 | 24 | if (button.id == 1) { 25 | minecraft.setCurrentScreen(new AdvancedOptionsScreen(parent, minecraft.settings)); 26 | } 27 | if (button.id == 800) { 28 | minecraft.level.customLightColor = new ColorCache(0.99f, 0.99f, 0.99f); 29 | minecraft.levelRenderer.refresh(); 30 | minecraft.setCurrentScreen(new AdvancedOptionsScreen(parent, minecraft.settings)); 31 | } 32 | 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/gui/inputscreens/ShadowColorInputScreen.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.gui.inputscreens; 2 | 3 | import com.mojang.util.ColorCache; 4 | import com.mojang.minecraft.gui.AdvancedOptionsScreen; 5 | import com.mojang.minecraft.gui.Button; 6 | import com.mojang.minecraft.gui.GuiScreen; 7 | 8 | public class ShadowColorInputScreen extends InputValueScreen { 9 | 10 | public ShadowColorInputScreen(GuiScreen var1, String var2, int var3, String Title) { 11 | super(var1, var2, var3, Title); 12 | // TODO Auto-generated constructor stub 13 | } 14 | 15 | @Override 16 | protected final void onButtonClick(Button button) { 17 | if (button.active) { 18 | if (button.id == 0 && name.length() > 0) { 19 | minecraft.level.customShadowColor = ColorCache.parseHex(name); 20 | minecraft.levelRenderer.refresh(); 21 | minecraft.setCurrentScreen(new AdvancedOptionsScreen(parent, minecraft.settings)); 22 | } 23 | 24 | if (button.id == 1) { 25 | minecraft.setCurrentScreen(new AdvancedOptionsScreen(parent, minecraft.settings)); 26 | } 27 | if (button.id == 800) { 28 | minecraft.level.customShadowColor = new ColorCache(0.6f, 0.6f, 0.6f); 29 | minecraft.levelRenderer.refresh(); 30 | minecraft.setCurrentScreen(new AdvancedOptionsScreen(parent, minecraft.settings)); 31 | } 32 | 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/gui/inputscreens/SkyColorInputScreen.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.gui.inputscreens; 2 | 3 | import com.mojang.minecraft.Minecraft; 4 | import com.mojang.minecraft.gui.AdvancedOptionsScreen; 5 | import com.mojang.minecraft.gui.Button; 6 | import com.mojang.minecraft.gui.GuiScreen; 7 | 8 | public class SkyColorInputScreen extends InputValueScreen { 9 | 10 | public SkyColorInputScreen(GuiScreen var1, String var2, int var3, String Title) { 11 | super(var1, var2, var3, Title); 12 | // TODO Auto-generated constructor stub 13 | } 14 | 15 | @Override 16 | protected final void onButtonClick(Button button) { 17 | if (button.active) { 18 | if (button.id == 0 && name.length() > 0) { 19 | Minecraft var10000 = minecraft; 20 | String var2 = name; 21 | Minecraft var4 = var10000; 22 | var4.level.skyColor = Integer.parseInt(var2, 16); 23 | minecraft.setCurrentScreen(new AdvancedOptionsScreen(parent, minecraft.settings)); 24 | } 25 | 26 | if (button.id == 1) { 27 | minecraft.setCurrentScreen(new AdvancedOptionsScreen(parent, minecraft.settings)); 28 | } 29 | if (button.id == 800) { 30 | minecraft.level.skyColor = Integer.parseInt("99ccff", 16); 31 | minecraft.setCurrentScreen(new AdvancedOptionsScreen(parent, minecraft.settings)); 32 | } 33 | 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/util/IntersectionHelper.java: -------------------------------------------------------------------------------- 1 | package com.mojang.util; 2 | 3 | /** 4 | * Helper class for determining intersections. 5 | * 6 | * @author tyteen4a03 7 | */ 8 | 9 | public class IntersectionHelper { 10 | /** 11 | * Returns whether the given YZ plane intersects the vector. 12 | * 13 | * @param vec 14 | * @param y0 15 | * @param z0 16 | * @param y1 17 | * @param z1 18 | * @return 19 | */ 20 | public static boolean xIntersects(Vec3D vec, float y0, float z0, float y1, float z1) { 21 | return vec != null && vec.y >= y0 && vec.y <= y1 && vec.z >= z0 && vec.z <= z1; 22 | } 23 | 24 | /** 25 | * Returns whether the given XZ plane intersects the vector. 26 | * 27 | * @param vec 28 | * @param x0 29 | * @param z0 30 | * @param x1 31 | * @param z1 32 | * @return 33 | */ 34 | public static boolean yIntersects(Vec3D vec, float x0, float z0, float x1, float z1) { 35 | return vec != null && vec.x >= x0 && vec.x <= x1 && vec.z >= z0 && vec.z <= z1; 36 | } 37 | 38 | /** 39 | * Returns whether the given XZ plane intersects the vector. 40 | * 41 | * @param vec 42 | * @param x0 43 | * @param y0 44 | * @param x1 45 | * @param y1 46 | * @return 47 | */ 48 | public static boolean zIntersects(Vec3D vec, float x0, float y0, float x1, float y1) { 49 | return vec != null && vec.x >= x0 && vec.x <= x1 && vec.y >= y0 && vec.y <= y1; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/item/TakeEntityAnim.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.item; 2 | 3 | import com.mojang.minecraft.Entity; 4 | import com.mojang.minecraft.level.Level; 5 | import com.mojang.minecraft.render.TextureManager; 6 | 7 | public class TakeEntityAnim extends Entity { 8 | private int time = 0; 9 | 10 | private final Entity item; 11 | 12 | private final Entity player; 13 | 14 | private final float xorg, yorg, zorg; 15 | 16 | public TakeEntityAnim(Level level, Entity item, Entity player) { 17 | super(level); 18 | 19 | this.item = item; 20 | this.player = player; 21 | 22 | setSize(1F, 1F); 23 | 24 | xorg = item.x; 25 | yorg = item.y; 26 | zorg = item.z; 27 | } 28 | 29 | @Override 30 | public void render(TextureManager textureManager, float delta) { 31 | item.render(textureManager, delta); 32 | } 33 | 34 | @Override 35 | public void tick() { 36 | time++; 37 | 38 | if (time >= 3) { 39 | remove(); 40 | } 41 | 42 | // TODO: Is this right? 43 | float distance = (distance = time / 3F) * distance; 44 | 45 | xo = item.xo = item.x; 46 | yo = item.yo = item.y; 47 | zo = item.zo = item.z; 48 | 49 | x = item.x = xorg + (player.x - xorg) * distance; 50 | y = item.y = yorg + (player.y - 1F - yorg) * distance; 51 | z = item.z = zorg + (player.z - zorg) * distance; 52 | 53 | setPos(x, y, z); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/level/tile/BlockID.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.level.tile; 2 | 3 | public enum BlockID { 4 | 5 | // TODO Separate CPE blocks from standard ones 6 | 7 | Undefined(255), // for error checking 8 | 9 | Air(0), Stone(1), Grass(2), Dirt(3), Cobblestone(4), Wood(5), Plant(6), Admincrete(7), 10 | Water(8), StillWater(9), Lava(10), StillLava(11), Sand(12), Gravel(13), GoldOre(14), 11 | IronOre(15), Coal(16), Log(17), Leaves(18), Sponge(19), Glass(20), 12 | Red(21), Orange(22), Yellow(23), Lime(24), Green(25), Teal(26), Aqua(27), Cyan(28), 13 | Blue(29), Indigo(30), Violet(31), Magenta(32), Pink(33), Black(34), Gray(35), White(36), 14 | YellowFlower(37), RedFlower(38), BrownMushroom(39), RedMushroom(40), 15 | Gold(41), Iron(42), DoubleStair(43), Stair(44), Brick(45), TNT(46), Books(47), 16 | MossyRocks(48), Obsidian(49), CobblestoneSlab(50), Rope(51), Sandstone(52), Snow(53), 17 | Fire(54), LightPink(55), ForestGreen(56), Brown(57), DeepBlue(58), Turquoise(59), Ice(60), 18 | CeramicTile(61), Magma(62), Pillar(63), Crate(64), StoneBrick(65); 19 | 20 | private final int number; 21 | 22 | private BlockID(int number) { 23 | this.number = number; 24 | } 25 | 26 | public int getNumber() { 27 | return number; 28 | } 29 | 30 | public static String findName(int id) { 31 | BlockID bid = BlockID.values()[id + 1]; 32 | if (bid == null) { 33 | return null; 34 | } else { 35 | return bid.name(); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/mob/Sheep$1.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.mob; 2 | 3 | import com.mojang.minecraft.level.tile.Block; 4 | import com.mojang.minecraft.mob.ai.BasicAI; 5 | import com.mojang.util.MathHelper; 6 | 7 | final class Sheep$1 extends BasicAI { 8 | 9 | // $FF: synthetic field 10 | final Sheep sheep; 11 | 12 | Sheep$1(Sheep sheep) { 13 | this.sheep = sheep; 14 | } 15 | 16 | @Override 17 | protected final void update() { 18 | float rotation = sheep.yRot * (float) Math.PI / 180F; 19 | // Calculate which tile the sheep is on 20 | int x = (int) (mob.x + -0.7F * MathHelper.sin(rotation)); 21 | int y = (int) (mob.y - 2F); 22 | int z = (int) (mob.z + 0.7F * MathHelper.cos(rotation)); 23 | if (sheep.grazing) { 24 | if (level.getTile(x, y, z) != Block.GRASS.id) { 25 | sheep.grazing = false; 26 | } else { 27 | if (++sheep.grazingTime == 60) { 28 | level.setTile(x, y, z, Block.DIRT.id); 29 | if (random.nextInt(5) == 0) { 30 | sheep.hasFur = true; 31 | } 32 | } 33 | 34 | xxa = 0F; 35 | yya = 0F; 36 | mob.xRot = 40 + sheep.grazingTime / 2 % 2 * 10; 37 | } 38 | } else { 39 | if (level.getTile(x, y, z) == Block.GRASS.id) { 40 | sheep.grazing = true; 41 | sheep.grazingTime = 0; 42 | } 43 | 44 | super.update(); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/gui/GameOverScreen.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.gui; 2 | 3 | import org.lwjgl.opengl.GL11; 4 | 5 | public final class GameOverScreen extends GuiScreen { 6 | 7 | @Override 8 | protected final void onButtonClick(Button button) { 9 | if (button.id == 0) { 10 | minecraft.setCurrentScreen(new OptionsScreen(minecraft.settings)); 11 | } 12 | 13 | if (button.id == 1) { 14 | minecraft.setCurrentScreen(new GenerateLevelScreen(this)); 15 | } 16 | 17 | if (minecraft.session != null && button.id == 2) { 18 | minecraft.setCurrentScreen(new LoadLevelScreen(this)); 19 | } 20 | 21 | } 22 | 23 | @Override 24 | public final void onOpen() { 25 | buttons.clear(); 26 | buttons.add(new Button(1, width / 2 - 100, height / 4 + 72, "Generate new level...")); 27 | buttons.add(new Button(2, width / 2 - 100, height / 4 + 96, "Load level..")); 28 | if (minecraft.session == null) { 29 | buttons.get(1).active = false; 30 | } 31 | 32 | } 33 | 34 | @Override 35 | public final void render(int var1, int var2) { 36 | drawFadingBox(0, 0, width, height, 1615855616, -1602211792); 37 | GL11.glPushMatrix(); 38 | GL11.glScalef(2F, 2F, 2F); 39 | drawCenteredString(fontRenderer, "Game over!", width / 2 / 2, 30, 16777215); 40 | GL11.glPopMatrix(); 41 | drawCenteredString(fontRenderer, "Score: &e" + minecraft.player.getScore(), width / 2, 100, 42 | 16777215); 43 | super.render(var1, var2); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/gui/LevelDialog.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.gui; 2 | 3 | import java.io.File; 4 | 5 | import javax.swing.JFileChooser; 6 | import javax.swing.filechooser.FileNameExtensionFilter; 7 | 8 | final class LevelDialog extends Thread { 9 | 10 | // $FF: synthetic field 11 | private LoadLevelScreen screen; 12 | 13 | LevelDialog(LoadLevelScreen screen) { 14 | super(); 15 | this.screen = screen; 16 | } 17 | 18 | @Override 19 | public final void run() { 20 | JFileChooser fileChooser; 21 | try { 22 | LoadLevelScreen llScreen = screen; 23 | fileChooser = new JFileChooser(); 24 | llScreen.chooser = fileChooser; 25 | FileNameExtensionFilter filter = new FileNameExtensionFilter("ClassicWorld format (.cw)", 26 | "cw"); 27 | screen.chooser.setFileFilter(filter); 28 | screen.chooser.setMultiSelectionEnabled(false); 29 | int chosenID; 30 | if (screen.saving) { 31 | chosenID = screen.chooser.showSaveDialog(screen.minecraft.canvas); 32 | } else { 33 | chosenID = screen.chooser.showOpenDialog(screen.minecraft.canvas); 34 | } 35 | 36 | if (chosenID == 0) { 37 | screen.selectedFile = screen.chooser.getSelectedFile(); 38 | screen.selectedFile = new File(screen.selectedFile + ""); 39 | } 40 | } finally { 41 | screen.frozen = false; 42 | fileChooser = null; 43 | screen.chooser = fileChooser; 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/render/Frustum.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.render; 2 | 3 | public class Frustum { 4 | 5 | public float frustum[][]; 6 | 7 | public float projectionMatrix[]; 8 | 9 | public float modelViewMatrix[]; 10 | public float clippingMatrix[]; 11 | 12 | public Frustum() { 13 | frustum = new float[16][16]; 14 | projectionMatrix = new float[16]; 15 | modelViewMatrix = new float[16]; 16 | clippingMatrix = new float[16]; 17 | } 18 | 19 | /** 20 | * Returns true if the box is inside all 6 clipping planes, otherwise returns false. 21 | */ 22 | public boolean isBoxInFrustum(float F0, float F1, float F2, float F3, float F4, float F5) { 23 | final float frustum00F0 = frustum[0][0] * F0; 24 | final float frustum01F1 = frustum[0][1] * F1; 25 | final float frustum02F2 = frustum[0][2] * F2; 26 | return !(frustum00F0 + frustum01F1 + frustum02F2 + frustum[0][3] <= 0 27 | && frustum[0][0] * F3 + frustum01F1 + frustum02F2 + frustum[0][3] <= 0 28 | && frustum00F0 + frustum[0][1] * F4 + frustum02F2 + frustum[0][3] <= 0 29 | && frustum[0][0] * F3 + frustum[0][1] * F4 + frustum02F2 + frustum[0][3] <= 0 30 | && frustum00F0 + frustum01F1 + frustum[0][2] * F5 + frustum[0][3] <= 0 31 | && frustum[0][0] * F3 + frustum01F1 + frustum[0][2] * F5 + frustum[0][3] <= 0 32 | && frustum00F0 + frustum[0][1] * F4 + frustum[0][2] * F5 + frustum[0][3] <= 0 33 | && frustum[0][0] * F3 + frustum[0][1] * F4 + frustum[0][2] * F5 + frustum[0][3] <= 0); 34 | } 35 | } -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/mob/Creeper$1.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.mob; 2 | 3 | import com.mojang.minecraft.Entity; 4 | import com.mojang.minecraft.level.tile.Block; 5 | import com.mojang.minecraft.mob.ai.BasicAttackAI; 6 | import com.mojang.minecraft.particle.TerrainParticle; 7 | import com.mojang.util.MathHelper; 8 | 9 | final class Creeper$1 extends BasicAttackAI { 10 | 11 | // $FF: synthetic field 12 | final Creeper creeper; 13 | 14 | Creeper$1(Creeper creeper) { 15 | this.creeper = creeper; 16 | } 17 | 18 | @Override 19 | public final boolean attack(Entity other) { 20 | if (!super.attack(other)) { 21 | return false; 22 | } else { 23 | mob.hurt(other, 6); 24 | return true; 25 | } 26 | } 27 | 28 | @Override 29 | public final void beforeRemove() { 30 | float radius = 4F; 31 | level.explode(mob, mob.x, mob.y, mob.z, radius); 32 | 33 | for (int i = 0; i < 500; ++i) { 34 | float var3 = (float) random.nextGaussian() * radius / 4F; 35 | float var4 = (float) random.nextGaussian() * radius / 4F; 36 | float var5 = (float) random.nextGaussian() * radius / 4F; 37 | float var6 = MathHelper.sqrt(var3 * var3 + var4 * var4 + var5 * var5); 38 | float var7 = var3 / var6 / var6; 39 | float var8 = var4 / var6 / var6; 40 | var6 = var5 / var6 / var6; 41 | level.particleEngine.spawnParticle(new TerrainParticle(level, mob.x + var3, mob.y 42 | + var4, mob.z + var5, var7, var8, var6, Block.LEAVES)); 43 | } 44 | 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/com/oyasunadev/mcraft/client/core/MCraftApplet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package com.oyasunadev.mcraft.client.core; 7 | 8 | import com.mojang.minecraft.MinecraftApplet; 9 | import com.mojang.util.LogUtil; 10 | import java.net.MalformedURLException; 11 | import java.net.URL; 12 | import java.util.HashMap; 13 | import java.util.Map; 14 | 15 | /** 16 | * Override the MinecraftApplet class because we need to fake the Document Base 17 | * and Code Base. 18 | */ 19 | public class MCraftApplet extends MinecraftApplet { 20 | 21 | private static final String CODE_BASE_URL = "http://minecraft.net:80/", 22 | DOCUMENT_BASE_URL = "http://minecraft.net:80/play.jsp"; 23 | 24 | private final Map parameters = new HashMap<>(); 25 | 26 | @Override 27 | public URL getCodeBase() { 28 | try { 29 | return new URL(CODE_BASE_URL); 30 | } catch (MalformedURLException ex) { 31 | LogUtil.logError("Error getting applet code base.", ex); 32 | return null; 33 | } 34 | } 35 | 36 | @Override 37 | public URL getDocumentBase() { 38 | try { 39 | return new URL(DOCUMENT_BASE_URL); 40 | } catch (MalformedURLException ex) { 41 | LogUtil.logError("Error getting applet document base.", ex); 42 | return null; 43 | } 44 | } 45 | 46 | @Override 47 | public String getParameter(String name) { 48 | return parameters.get(name); 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/level/tile/SandBlock.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.level.tile; 2 | 3 | import com.mojang.minecraft.Minecraft; 4 | import com.mojang.minecraft.level.Level; 5 | import com.mojang.minecraft.level.liquid.LiquidType; 6 | 7 | public final class SandBlock extends Block { 8 | 9 | public SandBlock(int id) { 10 | super(id); 11 | } 12 | 13 | private void fall(Level level, int x, int y, int z) { 14 | if (!Minecraft.isSinglePlayer) { 15 | return; 16 | } 17 | int yOffset = y; 18 | 19 | while (true) { 20 | int yCheckPos = yOffset - 1; 21 | int nextTile; 22 | LiquidType liquidType; 23 | if (!((nextTile = level.getTile(x, yCheckPos, z)) == 0 ? true : (liquidType = blocks[nextTile] 24 | .getLiquidType()) == LiquidType.water ? true : liquidType == LiquidType.lava) 25 | || yOffset <= 0) { 26 | if (yOffset != y) { 27 | if ((nextTile = level.getTile(x, yOffset, z)) > 0 28 | && blocks[nextTile].getLiquidType() != LiquidType.notLiquid) { 29 | level.setTileNoUpdate(x, yOffset, z, 0); 30 | } 31 | 32 | level.swap(x, y, z, x, yOffset, z); 33 | } 34 | 35 | return; 36 | } 37 | 38 | --yOffset; 39 | } 40 | } 41 | 42 | @Override 43 | public final void onNeighborChange(Level level, int x, int y, int z, int unused) { 44 | fall(level, x, y, z); 45 | } 46 | 47 | @Override 48 | public final void onPlace(Level level, int x, int y, int z) { 49 | fall(level, x, y, z); 50 | } 51 | } -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/gui/ScaledResolution.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.gui; 2 | 3 | import com.mojang.minecraft.GameSettings; 4 | 5 | public class ScaledResolution { 6 | private int scaledWidth; 7 | private int scaledHeight; 8 | private double scaledWidthD; 9 | private double scaledHeightD; 10 | private int scaleFactor; 11 | 12 | public ScaledResolution(GameSettings par1GameSettings, int par2, int par3) { 13 | scaledWidth = par2; 14 | scaledHeight = par3; 15 | scaleFactor = 1; 16 | int var4 = 1000; // scale 17 | 18 | if (var4 == 0) { 19 | var4 = 1000; 20 | } 21 | 22 | while (scaleFactor < var4 && scaledWidth / (scaleFactor + 1) >= 320 23 | && scaledHeight / (scaleFactor + 1) >= 240) { 24 | ++scaleFactor; 25 | } 26 | 27 | scaledWidthD = (double) scaledWidth / (double) scaleFactor; 28 | scaledHeightD = (double) scaledHeight / (double) scaleFactor; 29 | scaledWidth = ceiling_double_int(scaledWidthD); 30 | scaledHeight = ceiling_double_int(scaledHeightD); 31 | } 32 | 33 | public static int ceiling_double_int(double par0) { 34 | int var2 = (int) par0; 35 | return par0 > var2 ? var2 + 1 : var2; 36 | } 37 | 38 | public int getScaledHeight() { 39 | return scaledHeight; 40 | } 41 | 42 | public double getScaledHeight_double() { 43 | return scaledHeightD; 44 | } 45 | 46 | public int getScaledWidth() { 47 | return scaledWidth; 48 | } 49 | 50 | public double getScaledWidth_double() { 51 | return scaledWidthD; 52 | } 53 | 54 | public int getScaleFactor() { 55 | return scaleFactor; 56 | } 57 | } -------------------------------------------------------------------------------- /src/main/java/de/jarnbjo/vorbis/Mapping.java: -------------------------------------------------------------------------------- 1 | /* 2 | * $ProjectName$ 3 | * $ProjectRevision$ 4 | * ----------------------------------------------------------- 5 | * $Id: Mapping.java,v 1.2 2003/03/16 01:11:12 jarnbjo Exp $ 6 | * ----------------------------------------------------------- 7 | * 8 | * $Author: jarnbjo $ 9 | * 10 | * Description: 11 | * 12 | * Copyright 2002-2003 Tor-Einar Jarnbjo 13 | * ----------------------------------------------------------- 14 | * 15 | * Change History 16 | * ----------------------------------------------------------- 17 | * $Log: Mapping.java,v $ 18 | * Revision 1.2 2003/03/16 01:11:12 jarnbjo 19 | * no message 20 | * 21 | * 22 | */ 23 | 24 | package de.jarnbjo.vorbis; 25 | 26 | import java.io.IOException; 27 | 28 | import de.jarnbjo.util.io.BitInputStream; 29 | 30 | abstract class Mapping { 31 | 32 | protected static Mapping createInstance(VorbisStream vorbis, BitInputStream source, 33 | SetupHeader header) throws VorbisFormatException, IOException { 34 | 35 | int type = source.getInt(16); 36 | switch (type) { 37 | case 0: 38 | // System.out.println("mapping type 0"); 39 | return new Mapping0(vorbis, source, header); 40 | default: 41 | throw new VorbisFormatException("Mapping type " + type + " is not supported."); 42 | } 43 | } 44 | 45 | protected abstract int[] getAngles(); 46 | 47 | protected abstract int getCouplingSteps(); 48 | 49 | protected abstract int[] getMagnitudes(); 50 | 51 | protected abstract int[] getMux(); 52 | 53 | protected abstract int[] getSubmapFloors(); 54 | 55 | protected abstract int[] getSubmapResidues(); 56 | 57 | protected abstract int getSubmaps(); 58 | 59 | protected abstract int getType(); 60 | 61 | } -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/level/tile/SlabBlock.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.level.tile; 2 | 3 | import com.mojang.minecraft.level.Level; 4 | 5 | public final class SlabBlock extends Block { 6 | 7 | private boolean doubleSlab; 8 | 9 | public SlabBlock(int var1, boolean var2) { 10 | super(var1, 6); 11 | doubleSlab = var2; 12 | if (!var2) { 13 | setBounds(0F, 0F, 0F, 1F, 0.5F, 1F); 14 | } 15 | 16 | } 17 | 18 | @Override 19 | public final boolean canRenderSide(Level level, int x, int y, int z, int side) { 20 | if (this != SLAB) { 21 | super.canRenderSide(level, x, y, z, side); 22 | } 23 | 24 | return side == 1 || (super.canRenderSide(level, x, y, z, side) && 25 | (side == 0 || level.getTile(x, y, z) != id)); 26 | } 27 | 28 | @Override 29 | public final int getDrop() { 30 | return SLAB.id; 31 | } 32 | 33 | @Override 34 | public final int getTextureId(int texture) { 35 | return texture <= 1 ? 6 : 5; 36 | } 37 | 38 | @Override 39 | public final boolean isCube() { 40 | return doubleSlab; 41 | } 42 | 43 | @Override 44 | public final boolean isSolid() { 45 | return doubleSlab; 46 | } 47 | 48 | @Override 49 | public final void onAdded(Level level, int x, int y, int z) { 50 | if (this != SLAB) { 51 | super.onAdded(level, x, y, z); 52 | } 53 | 54 | if (level.getTile(x, y - 1, z) == SLAB.id) { 55 | level.setTile(x, y, z, 0); 56 | level.setTile(x, y - 1, z, DOUBLE_SLAB.id); 57 | } 58 | 59 | } 60 | 61 | // TODO 62 | @Override 63 | public final void onNeighborChange(Level level, int x, int y, int z, int side) { 64 | if (this == SLAB) { 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /src/main/java/de/jarnbjo/util/audio/FadeableAudioInputStream.java: -------------------------------------------------------------------------------- 1 | package de.jarnbjo.util.audio; 2 | 3 | import java.io.IOException; 4 | 5 | import javax.sound.sampled.AudioInputStream; 6 | 7 | public class FadeableAudioInputStream extends AudioInputStream { 8 | 9 | private boolean fading = false; 10 | private double phi = 0.0; 11 | 12 | public FadeableAudioInputStream(AudioInputStream stream) throws IOException { 13 | super(stream, stream.getFormat(), -1L); 14 | } 15 | 16 | public void fadeOut() { 17 | fading = true; 18 | phi = 0.0; 19 | } 20 | 21 | public int read(byte[] b) throws IOException { 22 | return read(b, 0, b.length); 23 | } 24 | 25 | public int read(byte[] b, int offset, int length) throws IOException { 26 | int read = super.read(b, offset, length); 27 | 28 | // System.out.println("read "+read); 29 | 30 | if (fading) { 31 | int j = 0, l = 0, r = 0; 32 | double gain = 0.0; 33 | 34 | for (int i = offset; i < offset + read; i += 4) { 35 | j = i; 36 | l = ((int) b[j++]) & 0xff; 37 | l |= ((int) b[j++]) << 8; 38 | r = ((int) b[j++]) & 0xff; 39 | r |= ((int) b[j]) << 8; 40 | 41 | if (phi < Math.PI / 2) { 42 | phi += 0.000015; 43 | } 44 | 45 | gain = Math.cos(phi); 46 | // System.out.println("gain "+gain); 47 | 48 | l = (int) (l * gain); 49 | r = (int) (r * gain); 50 | 51 | j = i; 52 | b[j++] = (byte) (l & 0xff); 53 | b[j++] = (byte) ((l >> 8) & 0xff); 54 | b[j++] = (byte) (r & 0xff); 55 | b[j++] = (byte) ((r >> 8) & 0xff); 56 | } 57 | } 58 | 59 | return read; 60 | } 61 | 62 | } -------------------------------------------------------------------------------- /src/main/java/de/jarnbjo/vorbis/Floor0.java: -------------------------------------------------------------------------------- 1 | /* 2 | * $ProjectName$ 3 | * $ProjectRevision$ 4 | * ----------------------------------------------------------- 5 | * $Id: Floor0.java,v 1.2 2003/03/16 01:11:12 jarnbjo Exp $ 6 | * ----------------------------------------------------------- 7 | * 8 | * $Author: jarnbjo $ 9 | * 10 | * Description: 11 | * 12 | * Copyright 2002-2003 Tor-Einar Jarnbjo 13 | * ----------------------------------------------------------- 14 | * 15 | * Change History 16 | * ----------------------------------------------------------- 17 | * $Log: Floor0.java,v $ 18 | * Revision 1.2 2003/03/16 01:11:12 jarnbjo 19 | * no message 20 | * 21 | * 22 | */ 23 | 24 | package de.jarnbjo.vorbis; 25 | 26 | import java.io.IOException; 27 | 28 | import de.jarnbjo.util.io.BitInputStream; 29 | 30 | class Floor0 extends Floor { 31 | 32 | private int bookList[]; 33 | 34 | protected Floor0(BitInputStream source, SetupHeader header) throws VorbisFormatException, 35 | IOException { 36 | 37 | int bookCount = source.getInt(4) + 1; 38 | bookList = new int[bookCount]; 39 | 40 | for (int i = 0; i < bookList.length; i++) { 41 | bookList[i] = source.getInt(8); 42 | if (bookList[i] > header.getCodeBooks().length) { 43 | throw new VorbisFormatException( 44 | "A floor0_book_list entry is higher than the code book count."); 45 | } 46 | } 47 | } 48 | 49 | protected void computeFloor(float[] vector) { 50 | /** @todo implement */ 51 | throw new UnsupportedOperationException(); 52 | } 53 | 54 | protected Floor decodeFloor(VorbisStream vorbis, BitInputStream source) 55 | throws VorbisFormatException, IOException { 56 | /** @todo implement */ 57 | throw new UnsupportedOperationException(); 58 | } 59 | 60 | protected int getType() { 61 | return 0; 62 | } 63 | 64 | } -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/OperatingSystem.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft; 2 | 3 | import java.io.File; 4 | 5 | public enum OperatingSystem { 6 | LINUX("linux", 0), SOLARIS("solaris", 1), WINDOWS("windows", 2) { 7 | public File getMinecraftFolder(String home, String folder) { 8 | String appData = System.getenv("APPDATA"); 9 | 10 | if (appData != null) { 11 | return new File(appData, folder + '/'); 12 | } else { 13 | return new File(home, folder + '/'); 14 | } 15 | } 16 | }, MAC_OS_X("macos", 3) { 17 | public File getMinecraftFolder(String home, String folder) { 18 | return new File(home, "Library/Application Support/" + folder); 19 | } 20 | }, UNKNOWN("unknown", 4); 21 | 22 | public static final OperatingSystem[] values = new OperatingSystem[]{LINUX, SOLARIS, WINDOWS, 23 | MAC_OS_X, UNKNOWN}; 24 | public final String folderName; 25 | public final int id; 26 | 27 | private OperatingSystem(String folderName, int id) { 28 | this.folderName = folderName; 29 | this.id = id; 30 | } 31 | 32 | /* Windows and OSX override this */ 33 | public File getMinecraftFolder(String home, String folder) { 34 | return new File(home, folder + '/'); 35 | } 36 | 37 | public static OperatingSystem detect() { 38 | String s = System.getProperty("os.name").toLowerCase(); 39 | if (s.contains("win")) { 40 | return OperatingSystem.WINDOWS; 41 | } 42 | if (s.contains("mac")) { 43 | return OperatingSystem.MAC_OS_X; 44 | } 45 | if (s.contains("solaris") || s.contains("sunos")) { 46 | return OperatingSystem.SOLARIS; 47 | } 48 | if (s.contains("linux") || s.contains("unix")) { 49 | return OperatingSystem.LINUX; 50 | } 51 | return OperatingSystem.UNKNOWN; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/level/tile/CobblestoneSlabBlock.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.level.tile; 2 | 3 | import com.mojang.minecraft.level.Level; 4 | 5 | public final class CobblestoneSlabBlock extends Block { 6 | 7 | private boolean doubleSlab; 8 | 9 | public CobblestoneSlabBlock(int id, boolean isDoubleSlab) { 10 | super(id); 11 | doubleSlab = isDoubleSlab; 12 | if (!isDoubleSlab) { 13 | setBounds(0F, 0F, 0F, 1F, 0.5F, 1F); 14 | } 15 | 16 | } 17 | 18 | @Override 19 | public final boolean canRenderSide(Level level, int x, int y, int z, int side) { 20 | if (this != COBBLESTONE_SLAB) { 21 | super.canRenderSide(level, x, y, z, side); 22 | } 23 | 24 | return side == 1 25 | || (super.canRenderSide(level, x, y, z, side) 26 | && (side == 0 || level.getTile(x, y, z) != id)); 27 | } 28 | 29 | @Override 30 | public final int getDrop() { 31 | return COBBLESTONE_SLAB.id; 32 | } 33 | 34 | @Override 35 | public final int getTextureId(int texture) { 36 | return 16; 37 | } 38 | 39 | @Override 40 | public final boolean isCube() { 41 | return doubleSlab; 42 | } 43 | 44 | @Override 45 | public final boolean isSolid() { 46 | return doubleSlab; 47 | } 48 | 49 | @Override 50 | public final void onAdded(Level level, int x, int y, int z) { 51 | if (this != COBBLESTONE_SLAB) { 52 | super.onAdded(level, x, y, z); 53 | } 54 | 55 | if (level.getTile(x, y - 1, z) == COBBLESTONE_SLAB.id) { 56 | level.setTile(x, y, z, 0); 57 | level.setTile(x, y - 1, z, COBBLESTONE_SLAB.id); 58 | } 59 | 60 | } 61 | 62 | // TODO 63 | @Override 64 | public final void onNeighborChange(Level level, int x, int y, int z, int side) { 65 | if (this == COBBLESTONE_SLAB) { 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/gui/SaveLevelScreen.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.gui; 2 | 3 | import java.io.File; 4 | 5 | import com.mojang.util.LogUtil; 6 | import com.mojang.minecraft.Minecraft; 7 | import com.mojang.minecraft.gui.inputscreens.InputValueScreen; 8 | import com.mojang.minecraft.level.LevelSerializer; 9 | 10 | public final class SaveLevelScreen extends LoadLevelScreen { 11 | 12 | public SaveLevelScreen(GuiScreen screen) { 13 | super(screen); 14 | title = "Save level"; 15 | saving = true; 16 | } 17 | 18 | @Override 19 | public final void onOpen() { 20 | super.onOpen(); 21 | buttons.get(5).text = "Done"; 22 | } 23 | 24 | @Override 25 | protected final void openLevel(File file) { 26 | if (!file.getName().endsWith(".cw")) { 27 | file = new File(file.getParentFile(), file.getName() + ".cw"); 28 | } 29 | Minecraft var3 = minecraft; 30 | try { 31 | new LevelSerializer(var3.level).saveMap(file); 32 | } catch (Exception ex) { 33 | // TODO: report error to user 34 | LogUtil.logError("Error saving a map to " + file, ex); 35 | } 36 | // this.minecraft.levelIo.save(var3.level, var2); 37 | minecraft.setCurrentScreen(parent); 38 | } 39 | 40 | @Override 41 | protected final void openLevel(int var1) { 42 | minecraft.setCurrentScreen(new InputValueScreen(this, buttons.get(var1).text, var1, 43 | "Enter level name...")); 44 | } 45 | 46 | @Override 47 | public final void render(int var1, int var2) { 48 | super.render(var1, var2); 49 | } 50 | 51 | @Override 52 | protected final void setLevels(String[] var1) { 53 | for (int var2 = 0; var2 < 5; ++var2) { 54 | buttons.get(var2).text = var1[var2]; 55 | buttons.get(var2).visible = true; 56 | buttons.get(var2).active = true; 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/SessionData.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft; 2 | 3 | import java.util.ArrayList; 4 | import java.util.Arrays; 5 | import java.util.List; 6 | 7 | import com.mojang.minecraft.level.tile.Block; 8 | import com.oyasunadev.mcraft.client.util.Constants; 9 | 10 | public final class SessionData { 11 | 12 | public static List allowedBlocks; 13 | public String username; 14 | public String sessionId; 15 | public String mppass; 16 | public boolean haspaid; 17 | static { 18 | addStandardMinecraftBlocks(); // init 19 | } 20 | 21 | public SessionData(String username, String sessionID) { 22 | this.username = username; 23 | sessionId = sessionID; 24 | } 25 | 26 | public static void addStandardMinecraftBlocks() { 27 | ArrayList ab = new ArrayList<>(); 28 | ab.addAll(Arrays.asList(Block.blocks).subList(1, 50)); 29 | if (Minecraft.isSinglePlayer) { 30 | ab.remove(Block.BEDROCK); // players can't delete this 31 | } 32 | allowedBlocks = ab; 33 | } 34 | 35 | public static void setAllowedBlocks(byte supportLevel) { 36 | // latest 37 | if (supportLevel == Constants.CUSTOM_BLOCK_SUPPORT_LEVEL) { 38 | ArrayList ab = new ArrayList<>(); 39 | ab.addAll(Arrays.asList(Block.blocks).subList(1, Block.blocks.length)); 40 | if (Minecraft.isSinglePlayer) { 41 | ab.remove(Block.BEDROCK); 42 | } 43 | allowedBlocks = ab; 44 | } else if (supportLevel == 1) { // level 1 45 | ArrayList ab = new ArrayList<>(); 46 | ab.addAll(Arrays.asList(Block.blocks).subList(1, 65)); 47 | if (Minecraft.isSinglePlayer) { 48 | ab.remove(Block.BEDROCK); 49 | } 50 | allowedBlocks = ab; 51 | } else if (supportLevel <= 0) { // minecraft 52 | addStandardMinecraftBlocks(); 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/render/GLAllocation.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.render; 2 | 3 | import java.nio.ByteBuffer; 4 | import java.nio.ByteOrder; 5 | import java.nio.FloatBuffer; 6 | import java.nio.IntBuffer; 7 | import java.util.ArrayList; 8 | import java.util.HashMap; 9 | import java.util.List; 10 | import java.util.Map; 11 | import java.util.Map.Entry; 12 | 13 | import org.lwjgl.opengl.GL11; 14 | 15 | public class GLAllocation { 16 | private static final Map displayLists = new HashMap<>(); 17 | private static final List textures = new ArrayList<>(); 18 | 19 | public static synchronized ByteBuffer createDirectByteBuffer(int size) { 20 | return ByteBuffer.allocateDirect(size).order(ByteOrder.nativeOrder()); 21 | } 22 | 23 | public static FloatBuffer createDirectFloatBuffer(int size) { 24 | return createDirectByteBuffer(size << 2).asFloatBuffer(); 25 | } 26 | 27 | public static IntBuffer createDirectIntBuffer(int size) { 28 | return createDirectByteBuffer(size << 2).asIntBuffer(); 29 | } 30 | 31 | public static synchronized void deleteDisplayLists(int listID) { 32 | GL11.glDeleteLists(listID, displayLists.remove(listID)); 33 | } 34 | 35 | public static synchronized void deleteTextures() { 36 | for (int i : textures) { 37 | GL11.glDeleteTextures(i); 38 | } 39 | 40 | textures.clear(); 41 | } 42 | 43 | public static synchronized void deleteTexturesAndDisplayLists() { 44 | for (Entry i : displayLists.entrySet()) { 45 | Entry entity = i; 46 | GL11.glDeleteLists(entity.getKey(), entity.getValue()); 47 | } 48 | 49 | displayLists.clear(); 50 | deleteTextures(); 51 | } 52 | 53 | public static synchronized int generateDisplayLists(int listID) { 54 | int listKey = GL11.glGenLists(listID); 55 | displayLists.put(listKey, listID); 56 | return listKey; 57 | } 58 | } -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/gui/MoreControlsScreen.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.gui; 2 | 3 | import com.mojang.minecraft.GameSettings; 4 | 5 | public final class MoreControlsScreen extends GuiScreen { 6 | 7 | private String title = "Controls cont..."; 8 | private GameSettings settings; 9 | private int selected = -1; 10 | 11 | public MoreControlsScreen(GameSettings gameSettings) { 12 | settings = gameSettings; 13 | } 14 | 15 | @Override 16 | protected final void onButtonClick(Button button) { 17 | for (int i = 0; i < settings.bindingsmore.length; ++i) { 18 | buttons.get(i).text = settings.getBindingMore(i); 19 | } 20 | 21 | if (button.id == 200) { 22 | minecraft.setCurrentScreen(new ControlsScreen(minecraft.settings)); 23 | } else { 24 | selected = button.id; 25 | button.text = "> " + settings.getBindingMore(button.id) + " <"; 26 | } 27 | } 28 | 29 | @Override 30 | protected final void onKeyPress(char var1, int var2) { 31 | if (selected >= 0) { 32 | settings.setBindingMore(selected, var2); 33 | buttons.get(selected).text = settings.getBindingMore(selected); 34 | selected = -1; 35 | } else { 36 | super.onKeyPress(var1, var2); 37 | } 38 | } 39 | 40 | @Override 41 | public final void onOpen() { 42 | for (int i = 0; i < settings.bindingsmore.length; ++i) { 43 | buttons.add(new OptionButton(i, width / 2 - 155 + i % 2 * 160, height / 6 + 24 44 | * (i >> 1), settings.getBindingMore(i))); 45 | } 46 | 47 | buttons.add(new Button(200, width / 2 - 100, height / 6 + 168, "Done")); 48 | } 49 | 50 | @Override 51 | public final void render(int var1, int var2) { 52 | drawFadingBox(0, 0, width, height, 1610941696, -1607454624); 53 | drawCenteredString(fontRenderer, title, width / 2, 20, 16777215); 54 | super.render(var1, var2); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/nbt/NBTTagInt.java: -------------------------------------------------------------------------------- 1 | package com.mojang.nbt; 2 | 3 | import java.io.DataInput; 4 | import java.io.DataOutput; 5 | import java.io.IOException; 6 | 7 | public class NBTTagInt extends NBTBase { 8 | /** 9 | * The integer value for the tag. 10 | */ 11 | public int data; 12 | 13 | public NBTTagInt(String name) { 14 | super(name); 15 | } 16 | 17 | public NBTTagInt(String name, int data) { 18 | super(name); 19 | this.data = data; 20 | } 21 | 22 | /** 23 | * Write the actual data contents of the tag, implemented in NBT extension classes. 24 | * 25 | * @param output The output stream to write to. 26 | */ 27 | @Override 28 | void write(DataOutput output) throws IOException { 29 | output.writeInt(this.data); 30 | } 31 | 32 | /** 33 | * Read the actual data contents of the tag, implemented in NBT extension classes. 34 | * 35 | * @param input The input stream to read from. 36 | */ 37 | @Override 38 | void load(DataInput input) throws IOException { 39 | this.data = input.readInt(); 40 | } 41 | 42 | /** 43 | * Gets the type byte for the tag. 44 | * 45 | * @return byte 46 | */ 47 | @Override 48 | public byte getId() { 49 | return (byte) 3; 50 | } 51 | 52 | @Override 53 | public String toString() { 54 | return "" + this.data; 55 | } 56 | 57 | /** 58 | * Creates a clone of the tag. 59 | */ 60 | @Override 61 | public NBTBase copy() { 62 | return new NBTTagInt(this.getName(), this.data); 63 | } 64 | 65 | @Override 66 | public boolean equals(Object other) { 67 | if (super.equals(other)) { 68 | NBTTagInt tempOther = (NBTTagInt) other; 69 | return this.data == tempOther.data; 70 | } else { 71 | return false; 72 | } 73 | } 74 | 75 | @Override 76 | public int hashCode() { 77 | return super.hashCode() ^ this.data; 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/nbt/NBTTagByte.java: -------------------------------------------------------------------------------- 1 | package com.mojang.nbt; 2 | 3 | import java.io.DataInput; 4 | import java.io.DataOutput; 5 | import java.io.IOException; 6 | 7 | public class NBTTagByte extends NBTBase { 8 | /** 9 | * The byte value for the tag. 10 | */ 11 | public byte data; 12 | 13 | public NBTTagByte(String name) { 14 | super(name); 15 | } 16 | 17 | public NBTTagByte(String name, byte data) { 18 | super(name); 19 | this.data = data; 20 | } 21 | 22 | /** 23 | * Write the actual data contents of the tag, implemented in NBT extension classes. 24 | * 25 | * @param output The output stream to write to. 26 | */ 27 | @Override 28 | void write(DataOutput output) throws IOException { 29 | output.writeByte(this.data); 30 | } 31 | 32 | /** 33 | * Read the actual data contents of the tag, implemented in NBT extension classes. 34 | * 35 | * @param input The input stream to read from. 36 | */ 37 | @Override 38 | void load(DataInput input) throws IOException { 39 | this.data = input.readByte(); 40 | } 41 | 42 | /** 43 | * Gets the type byte for the tag. 44 | * 45 | * @return byte 46 | */ 47 | @Override 48 | public byte getId() { 49 | return (byte) 1; 50 | } 51 | 52 | @Override 53 | public String toString() { 54 | return "" + this.data; 55 | } 56 | 57 | /** 58 | * Creates a clone of the tag. 59 | */ 60 | @Override 61 | public NBTBase copy() { 62 | return new NBTTagByte(this.getName(), this.data); 63 | } 64 | 65 | @Override 66 | public boolean equals(Object other) { 67 | if (super.equals(other)) { 68 | NBTTagByte tempOther = (NBTTagByte) other; 69 | return this.data == tempOther.data; 70 | } else { 71 | return false; 72 | } 73 | } 74 | 75 | @Override 76 | public int hashCode() { 77 | return super.hashCode() ^ this.data; 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/nbt/NBTTagShort.java: -------------------------------------------------------------------------------- 1 | package com.mojang.nbt; 2 | 3 | import java.io.DataInput; 4 | import java.io.DataOutput; 5 | import java.io.IOException; 6 | 7 | public class NBTTagShort extends NBTBase { 8 | /** 9 | * The short value for the tag. 10 | */ 11 | public short data; 12 | 13 | public NBTTagShort(String name) { 14 | super(name); 15 | } 16 | 17 | public NBTTagShort(String name, short par2) { 18 | super(name); 19 | this.data = par2; 20 | } 21 | 22 | /** 23 | * Write the actual data contents of the tag, implemented in NBT extension classes. 24 | * 25 | * @param output The output stream to write to. 26 | */ 27 | @Override 28 | void write(DataOutput output) throws IOException { 29 | output.writeShort(this.data); 30 | } 31 | 32 | /** 33 | * Read the actual data contents of the tag, implemented in NBT extension classes. 34 | * 35 | * @param input The input stream to read from. 36 | */ 37 | @Override 38 | void load(DataInput input) throws IOException { 39 | this.data = input.readShort(); 40 | } 41 | 42 | /** 43 | * Gets the type byte for the tag. 44 | * 45 | * @return byte 46 | */ 47 | @Override 48 | public byte getId() { 49 | return (byte) 2; 50 | } 51 | 52 | @Override 53 | public String toString() { 54 | return "" + this.data; 55 | } 56 | 57 | /** 58 | * Creates a clone of the tag. 59 | */ 60 | @Override 61 | public NBTBase copy() { 62 | return new NBTTagShort(this.getName(), this.data); 63 | } 64 | 65 | @Override 66 | public boolean equals(Object other) { 67 | if (super.equals(other)) { 68 | NBTTagShort tempOther = (NBTTagShort) other; 69 | return this.data == tempOther.data; 70 | } else { 71 | return false; 72 | } 73 | } 74 | 75 | @Override 76 | public int hashCode() { 77 | return super.hashCode() ^ this.data; 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/nbt/NBTTagLong.java: -------------------------------------------------------------------------------- 1 | package com.mojang.nbt; 2 | 3 | import java.io.DataInput; 4 | import java.io.DataOutput; 5 | import java.io.IOException; 6 | 7 | public class NBTTagLong extends NBTBase { 8 | /** 9 | * The long value for the tag. 10 | */ 11 | public long data; 12 | 13 | public NBTTagLong(String name) { 14 | super(name); 15 | } 16 | 17 | public NBTTagLong(String name, long data) { 18 | super(name); 19 | this.data = data; 20 | } 21 | 22 | /** 23 | * Write the actual data contents of the tag, implemented in NBT extension classes. 24 | * 25 | * @param output The output stream to write to. 26 | */ 27 | @Override 28 | void write(DataOutput output) throws IOException { 29 | output.writeLong(this.data); 30 | } 31 | 32 | /** 33 | * Read the actual data contents of the tag, implemented in NBT extension classes. 34 | * 35 | * @param input The input stream to read from. 36 | */ 37 | @Override 38 | void load(DataInput input) throws IOException { 39 | this.data = input.readLong(); 40 | } 41 | 42 | /** 43 | * Gets the type byte for the tag. 44 | * 45 | * @return byte 46 | */ 47 | @Override 48 | public byte getId() { 49 | return (byte) 4; 50 | } 51 | 52 | @Override 53 | public String toString() { 54 | return "" + this.data; 55 | } 56 | 57 | /** 58 | * Creates a clone of the tag. 59 | */ 60 | @Override 61 | public NBTBase copy() { 62 | return new NBTTagLong(this.getName(), this.data); 63 | } 64 | 65 | @Override 66 | public boolean equals(Object other) { 67 | if (super.equals(other)) { 68 | NBTTagLong tempOther = (NBTTagLong) other; 69 | return this.data == tempOther.data; 70 | } else { 71 | return false; 72 | } 73 | } 74 | 75 | @Override 76 | public int hashCode() { 77 | return super.hashCode() ^ (int) (this.data ^ this.data >>> 32); 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/nbt/NBTTagFloat.java: -------------------------------------------------------------------------------- 1 | package com.mojang.nbt; 2 | 3 | import java.io.DataInput; 4 | import java.io.DataOutput; 5 | import java.io.IOException; 6 | 7 | public class NBTTagFloat extends NBTBase { 8 | /** 9 | * The float value for the tag. 10 | */ 11 | public float data; 12 | 13 | public NBTTagFloat(String name) { 14 | super(name); 15 | } 16 | 17 | public NBTTagFloat(String name, float data) { 18 | super(name); 19 | this.data = data; 20 | } 21 | 22 | /** 23 | * Write the actual data contents of the tag, implemented in NBT extension classes. 24 | * 25 | * @param output The output stream to write to. 26 | */ 27 | @Override 28 | void write(DataOutput output) throws IOException { 29 | output.writeFloat(this.data); 30 | } 31 | 32 | /** 33 | * Read the actual data contents of the tag, implemented in NBT extension classes. 34 | * 35 | * @param input The input stream to read from. 36 | */ 37 | @Override 38 | void load(DataInput input) throws IOException { 39 | this.data = input.readFloat(); 40 | } 41 | 42 | /** 43 | * Gets the type byte for the tag. 44 | * 45 | * @return byte 46 | */ 47 | @Override 48 | public byte getId() { 49 | return (byte) 5; 50 | } 51 | 52 | @Override 53 | public String toString() { 54 | return "" + this.data; 55 | } 56 | 57 | /** 58 | * Creates a clone of the tag. 59 | */ 60 | @Override 61 | public NBTBase copy() { 62 | return new NBTTagFloat(this.getName(), this.data); 63 | } 64 | 65 | @Override 66 | public boolean equals(Object other) { 67 | if (super.equals(other)) { 68 | NBTTagFloat tempOther = (NBTTagFloat) other; 69 | return this.data == tempOther.data; 70 | } else { 71 | return false; 72 | } 73 | } 74 | 75 | @Override 76 | public int hashCode() { 77 | return super.hashCode() ^ Float.floatToIntBits(this.data); 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /src/main/java/de/jarnbjo/vorbis/Mode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * $ProjectName$ 3 | * $ProjectRevision$ 4 | * ----------------------------------------------------------- 5 | * $Id: Mode.java,v 1.2 2003/03/16 01:11:12 jarnbjo Exp $ 6 | * ----------------------------------------------------------- 7 | * 8 | * $Author: jarnbjo $ 9 | * 10 | * Description: 11 | * 12 | * Copyright 2002-2003 Tor-Einar Jarnbjo 13 | * ----------------------------------------------------------- 14 | * 15 | * Change History 16 | * ----------------------------------------------------------- 17 | * $Log: Mode.java,v $ 18 | * Revision 1.2 2003/03/16 01:11:12 jarnbjo 19 | * no message 20 | * 21 | * 22 | */ 23 | 24 | package de.jarnbjo.vorbis; 25 | 26 | import java.io.IOException; 27 | 28 | import de.jarnbjo.util.io.BitInputStream; 29 | 30 | class Mode { 31 | 32 | private boolean blockFlag; 33 | private int windowType, transformType, mapping; 34 | 35 | protected Mode(BitInputStream source, SetupHeader header) throws VorbisFormatException, 36 | IOException { 37 | blockFlag = source.getBit(); 38 | windowType = source.getInt(16); 39 | transformType = source.getInt(16); 40 | mapping = source.getInt(8); 41 | 42 | if (windowType != 0) { 43 | throw new VorbisFormatException("Window type = " + windowType + ", != 0"); 44 | } 45 | 46 | if (transformType != 0) { 47 | throw new VorbisFormatException("Transform type = " + transformType + ", != 0"); 48 | } 49 | 50 | if (mapping > header.getMappings().length) { 51 | throw new VorbisFormatException( 52 | "Mode mapping number is higher than total number of mappings."); 53 | } 54 | } 55 | 56 | protected boolean getBlockFlag() { 57 | return blockFlag; 58 | } 59 | 60 | protected int getMapping() { 61 | return mapping; 62 | } 63 | 64 | protected int getTransformType() { 65 | return transformType; 66 | } 67 | 68 | protected int getWindowType() { 69 | return windowType; 70 | } 71 | } -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/particle/TerrainParticle.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.particle; 2 | 3 | import com.mojang.util.ColorCache; 4 | import com.mojang.minecraft.level.Level; 5 | import com.mojang.minecraft.level.tile.Block; 6 | import com.mojang.minecraft.render.ShapeRenderer; 7 | 8 | public class TerrainParticle extends Particle { 9 | 10 | public TerrainParticle(Level level, float x, float y, float z, float destX, float destY, 11 | float destZ, Block block) { 12 | super(level, x, y, z, destX, destY, destZ); 13 | tex = block.textureId; 14 | gravity = block.particleGravity; 15 | rCol = gCol = bCol = 0.6F; 16 | } 17 | 18 | @Override 19 | public int getParticleTexture() { 20 | return 1; 21 | } 22 | 23 | @Override 24 | public void render(ShapeRenderer shapeRenderer, float x, float y, float z, float var5, 25 | float var6, float var7) { 26 | float var8; 27 | float var9 = (var8 = (tex % 16 + uo / 4F) / 16F) + 0.015609375F; 28 | float var10; 29 | float var11 = (var10 = (tex / 16 + vo / 4F) / 16F) + 0.015609375F; 30 | float var12 = 0.1F * size; 31 | float var13 = xo + (this.x - xo) * x; 32 | float var14 = yo + (this.y - yo) * x; 33 | float var15 = zo + (this.z - zo) * x; 34 | ColorCache var21 = getBrightnessColor(); 35 | shapeRenderer.color(var21.R * rCol, var21.G * gCol, var21.B * bCol); 36 | shapeRenderer.vertexUV(var13 - y * var12 - var6 * var12, var14 - z * var12, 37 | var15 - var5 * var12 - var7 * var12, var8, var11); 38 | shapeRenderer.vertexUV(var13 - y * var12 + var6 * var12, var14 + z * var12, 39 | var15 - var5 * var12 + var7 * var12, var8, var10); 40 | shapeRenderer.vertexUV(var13 + y * var12 + var6 * var12, var14 + z * var12, 41 | var15 + var5 * var12 + var7 * var12, var9, var10); 42 | shapeRenderer.vertexUV(var13 + y * var12 - var6 * var12, var14 - z * var12, 43 | var15 + var5 * var12 - var7 * var12, var9, var11); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/level/generator/noise/PerlinNoise.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.level.generator.noise; 2 | 3 | import java.util.Random; 4 | 5 | public class PerlinNoise extends Noise { 6 | 7 | private int[] noise; 8 | 9 | public PerlinNoise() { 10 | this(new Random()); 11 | } 12 | 13 | public PerlinNoise(Random random) { 14 | noise = new int[512]; 15 | 16 | int count = 0; 17 | while (count < 256) { 18 | noise[count] = count++; 19 | } 20 | 21 | for (count = 0; count < 256; count++) { 22 | int unknown0 = random.nextInt(256 - count) + count; 23 | int unknown1 = noise[count]; 24 | 25 | noise[count] = noise[unknown0]; 26 | noise[unknown0] = unknown1; 27 | noise[count + 256] = noise[count]; 28 | } 29 | 30 | } 31 | 32 | private static double fade(double a) { 33 | return a * a * a * (a * (a * 6D - 15D) + 10D); 34 | } 35 | 36 | private static double grad(int hash, double x, double y) { 37 | hash &= 15; 38 | double u = hash < 8 ? x : y; 39 | double v = hash < 4 ? y : (hash != 12 && hash != 14 ? 0 : x); 40 | 41 | return ((hash & 1) == 0 ? u : -u) + ((hash & 2) == 0 ? v : -v); 42 | } 43 | 44 | private static double lerp(double t, double a, double b) { 45 | return a + t * (b - a); 46 | } 47 | 48 | @Override 49 | public double compute(double x, double z) { 50 | int X = (int) Math.floor(x) & 255; 51 | int Z = (int) Math.floor(z) & 255; 52 | 53 | x -= Math.floor(x); 54 | z -= Math.floor(z); 55 | 56 | double u = fade(x); 57 | double v = fade(z); 58 | 59 | int a = noise[X] + Z; 60 | int aa = noise[a]; 61 | int ab = noise[a + 1]; 62 | 63 | int b = noise[X + 1] + Z; 64 | int ba = noise[b]; 65 | int bb = noise[b + 1]; 66 | 67 | return lerp(v, lerp(u, grad(noise[aa], x, z), grad(noise[ba], x - 1, z)), 68 | lerp(u, grad(noise[ab], x, z - 1), grad(noise[bb], x - 1, z - 1))); 69 | 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/nbt/NBTTagDouble.java: -------------------------------------------------------------------------------- 1 | package com.mojang.nbt; 2 | 3 | import java.io.DataInput; 4 | import java.io.DataOutput; 5 | import java.io.IOException; 6 | 7 | public class NBTTagDouble extends NBTBase { 8 | /** 9 | * The double value for the tag. 10 | */ 11 | public double data; 12 | 13 | public NBTTagDouble(String name) { 14 | super(name); 15 | } 16 | 17 | public NBTTagDouble(String name, double data) { 18 | super(name); 19 | this.data = data; 20 | } 21 | 22 | /** 23 | * Write the actual data contents of the tag, implemented in NBT extension classes. 24 | * 25 | * @param output The output stream to write to. 26 | */ 27 | @Override 28 | void write(DataOutput output) throws IOException { 29 | output.writeDouble(this.data); 30 | } 31 | 32 | /** 33 | * Read the actual data contents of the tag, implemented in NBT extension classes. 34 | * 35 | * @param input The input stream to read from. 36 | */ 37 | @Override 38 | void load(DataInput input) throws IOException { 39 | this.data = input.readDouble(); 40 | } 41 | 42 | /** 43 | * Gets the type byte for the tag. 44 | * 45 | * @return byte 46 | */ 47 | @Override 48 | public byte getId() { 49 | return (byte) 6; 50 | } 51 | 52 | @Override 53 | public String toString() { 54 | return "" + this.data; 55 | } 56 | 57 | /** 58 | * Creates a clone of the tag. 59 | */ 60 | @Override 61 | public NBTBase copy() { 62 | return new NBTTagDouble(this.getName(), this.data); 63 | } 64 | 65 | @Override 66 | public boolean equals(Object other) { 67 | if (super.equals(other)) { 68 | NBTTagDouble tempOther = (NBTTagDouble) other; 69 | return this.data == tempOther.data; 70 | } else { 71 | return false; 72 | } 73 | } 74 | 75 | @Override 76 | public int hashCode() { 77 | long i = Double.doubleToLongBits(this.data); 78 | return super.hashCode() ^ (int) (i ^ i >>> 32); 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/model/AnimalModel.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.model; 2 | 3 | import com.mojang.util.MathHelper; 4 | 5 | public class AnimalModel extends Model { 6 | 7 | public ModelPart head = new ModelPart(0, 0); 8 | public ModelPart body; 9 | public ModelPart leg1; 10 | public ModelPart leg2; 11 | public ModelPart leg3; 12 | public ModelPart leg4; 13 | 14 | public AnimalModel(int var1) { 15 | head.setBounds(-4F, -4F, -8F, 8, 8, 8, 0F); 16 | head.setPosition(0F, 18 - var1, -6F); 17 | body = new ModelPart(28, 8); 18 | body.setBounds(-5F, -10F, -7F, 10, 16, 8, 0F); 19 | body.setPosition(0F, 17 - var1, 2F); 20 | leg1 = new ModelPart(0, 16); 21 | leg1.setBounds(-2F, 0F, -2F, 4, var1, 4, 0F); 22 | leg1.setPosition(-3F, 24 - var1, 7F); 23 | leg2 = new ModelPart(0, 16); 24 | leg2.setBounds(-2F, 0F, -2F, 4, var1, 4, 0F); 25 | leg2.setPosition(3F, 24 - var1, 7F); 26 | leg3 = new ModelPart(0, 16); 27 | leg3.setBounds(-2F, 0F, -2F, 4, var1, 4, 0F); 28 | leg3.setPosition(-3F, 24 - var1, -5F); 29 | leg4 = new ModelPart(0, 16); 30 | leg4.setBounds(-2F, 0F, -2F, 4, var1, 4, 0F); 31 | leg4.setPosition(3F, 24 - var1, -5F); 32 | } 33 | 34 | @Override 35 | public final void render(float var1, float var2, float var3, 36 | float yawDegrees, float pitchDegrees, float scale) { 37 | head.yaw = yawDegrees / (float) (180D / Math.PI); 38 | head.pitch = pitchDegrees / (float) (180D / Math.PI); 39 | body.pitch = (float) (Math.PI / 2D); 40 | leg1.pitch = MathHelper.cos(var1 * 0.6662F) * 1.4F * var2; 41 | leg2.pitch = MathHelper.cos(var1 * 0.6662F + (float) Math.PI) * 1.4F * var2; 42 | leg3.pitch = MathHelper.cos(var1 * 0.6662F + (float) Math.PI) * 1.4F * var2; 43 | leg4.pitch = MathHelper.cos(var1 * 0.6662F) * 1.4F * var2; 44 | head.render(scale); 45 | body.render(scale); 46 | leg1.render(scale); 47 | leg2.render(scale); 48 | leg3.render(scale); 49 | leg4.render(scale); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/level/BlockMapSlot.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.level; 2 | 3 | import com.mojang.minecraft.Entity; 4 | import java.io.Serializable; 5 | 6 | class BlockMapSlot implements Serializable { 7 | 8 | final BlockMap blockMap; 9 | private int xSlot; 10 | private int ySlot; 11 | private int zSlot; 12 | 13 | public BlockMapSlot(BlockMap blockMap) { 14 | this.blockMap = blockMap; 15 | } 16 | 17 | static int getXSlot(BlockMapSlot slot) { 18 | return slot.xSlot; 19 | } 20 | 21 | static int getYSlot(BlockMapSlot slot) { 22 | return slot.ySlot; 23 | } 24 | 25 | static int getZSlot(BlockMapSlot slot) { 26 | return slot.zSlot; 27 | } 28 | 29 | public BlockMapSlot init(float x, float y, float z) { 30 | xSlot = (int) (x / 16F); 31 | ySlot = (int) (y / 16F); 32 | zSlot = (int) (z / 16F); 33 | if (xSlot < 0) { 34 | xSlot = 0; 35 | } 36 | 37 | if (ySlot < 0) { 38 | ySlot = 0; 39 | } 40 | 41 | if (zSlot < 0) { 42 | zSlot = 0; 43 | } 44 | 45 | if (xSlot >= BlockMap.getWidth(blockMap)) { 46 | xSlot = BlockMap.getWidth(blockMap) - 1; 47 | } 48 | 49 | if (ySlot >= BlockMap.getDepth(blockMap)) { 50 | ySlot = BlockMap.getDepth(blockMap) - 1; 51 | } 52 | 53 | if (zSlot >= BlockMap.getHeight(blockMap)) { 54 | zSlot = BlockMap.getHeight(blockMap) - 1; 55 | } 56 | 57 | return this; 58 | } 59 | 60 | public void add(Entity entity) { 61 | if (xSlot >= 0 && ySlot >= 0 && zSlot >= 0) { 62 | blockMap.entityGrid[(zSlot * BlockMap.getDepth(blockMap) + ySlot) 63 | * BlockMap.getWidth(blockMap) + xSlot].add(entity); 64 | } 65 | } 66 | 67 | public void remove(Entity entity) { 68 | if (xSlot >= 0 && ySlot >= 0 && zSlot >= 0) { 69 | blockMap.entityGrid[(zSlot * BlockMap.getDepth(blockMap) + ySlot) 70 | * BlockMap.getWidth(blockMap) + xSlot].remove(entity); 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/ChatLine.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft; 2 | 3 | import java.io.File; 4 | import java.io.FileWriter; 5 | import java.io.IOException; 6 | import java.text.SimpleDateFormat; 7 | import java.util.Calendar; 8 | 9 | import com.mojang.minecraft.gui.FontRenderer; 10 | import com.mojang.util.LogUtil; 11 | 12 | public class ChatLine { 13 | 14 | public static String eol = System.getProperty("line.separator"); 15 | public String message; 16 | public int time; 17 | 18 | /** 19 | * Constructs a new chatline, logs to the userdata as well 20 | * 21 | * @param message The chatline 22 | */ 23 | public ChatLine(String message) { 24 | this.message = message; 25 | time = 0; 26 | Calendar cal = Calendar.getInstance(); 27 | String month = new SimpleDateFormat("MMM").format(cal.getTime()); 28 | String serverName = ProgressBarDisplay.title.toLowerCase().contains("connecting..") ? "" 29 | : ProgressBarDisplay.title; 30 | if ("".equals(serverName) || Minecraft.isSinglePlayer) { 31 | return; 32 | } 33 | serverName = FontRenderer.stripColor(serverName); 34 | serverName = serverName.replaceAll("[^A-Za-z0-9\\._-]+", "_"); 35 | File logDir = new File(Minecraft.getMinecraftDirectory(), "/logs/"); 36 | File serverDir = new File(logDir, serverName); 37 | File monthDir = new File(serverDir, "/" + month + "/"); 38 | monthDir.mkdirs(); 39 | String dateStamp = new SimpleDateFormat("MM-dd-yyyy").format(Calendar.getInstance() 40 | .getTime()); 41 | String timeStamp = new SimpleDateFormat("HH:mm:ss") 42 | .format(Calendar.getInstance().getTime()); 43 | File logFile = new File(monthDir, dateStamp + ".log"); 44 | try { 45 | String str = FontRenderer.stripColor(this.message); 46 | try (FileWriter fileWriter = new FileWriter(logFile, true)) { 47 | fileWriter.write("[" + timeStamp + "] " + str + eol); 48 | } 49 | } catch (IOException ex) { 50 | LogUtil.logError("Error logging a chat message to " + logFile, ex); 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/gamemode/CreativeGameMode.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.gamemode; 2 | 3 | import com.mojang.minecraft.GameSettings; 4 | import com.mojang.minecraft.Minecraft; 5 | import com.mojang.minecraft.SessionData; 6 | import com.mojang.minecraft.gui.BlockSelectScreen; 7 | import com.mojang.minecraft.level.Level; 8 | import com.mojang.minecraft.level.tile.Block; 9 | import com.mojang.minecraft.player.Player; 10 | 11 | public class CreativeGameMode extends GameMode { 12 | public CreativeGameMode(Minecraft minecraft) { 13 | super(minecraft); 14 | 15 | instantBreak = true; 16 | } 17 | 18 | @Override 19 | public void apply(Level level) { 20 | super.apply(level); 21 | 22 | level.removeAllNonCreativeModeEntities(); 23 | 24 | level.creativeMode = true; 25 | level.growTrees = false; 26 | } 27 | 28 | @Override 29 | public void apply(Player player) { 30 | // default starting blocks 31 | Block[] blocks = new Block[]{Block.STONE, Block.COBLESTONE, Block.BRICK, Block.DIRT, 32 | Block.WOOD, Block.LOG, Block.LEAVES, Block.GRASS, Block.SLAB}; 33 | 34 | boolean CanProceed = true; 35 | for (Block block : blocks) { 36 | if (!SessionData.allowedBlocks.contains(block)) { 37 | CanProceed = false; 38 | } 39 | } 40 | 41 | // if one of them is banned, instead pick 9 blocks from allowed blocks 42 | if (!CanProceed) { 43 | blocks = new Block[]{}; 44 | for (int i = 0; i < blocks.length; i++) { 45 | blocks[i] = SessionData.allowedBlocks.get(i); 46 | } 47 | } 48 | 49 | // set them 50 | for (int i = 0; i < blocks.length; i++) { 51 | player.inventory.slots[i] = blocks[i].id; 52 | } 53 | } 54 | 55 | @Override 56 | public boolean isSurvival() { 57 | return false; 58 | } 59 | 60 | @Override 61 | public void openInventory() { 62 | BlockSelectScreen blockSelectScreen = new BlockSelectScreen(); 63 | 64 | if (GameSettings.CanReplaceSlot) { 65 | minecraft.setCurrentScreen(blockSelectScreen); 66 | } 67 | } 68 | } -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/model/CreeperModel.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.model; 2 | 3 | import com.mojang.util.MathHelper; 4 | 5 | public final class CreeperModel extends Model { 6 | 7 | private ModelPart head = new ModelPart(0, 0); 8 | private ModelPart unused; 9 | private ModelPart body; 10 | private ModelPart leg1; 11 | private ModelPart leg2; 12 | private ModelPart leg3; 13 | private ModelPart leg4; 14 | 15 | public CreeperModel() { 16 | headOffset = 0.25F; 17 | head.setBounds(-4F, -8F, -4F, 8, 8, 8, 0F); 18 | head.setPosition(0F, 4F, 0F); 19 | unused = new ModelPart(32, 0); 20 | unused.setBounds(-4F, -8F, -4F, 8, 8, 8, 0F + 0.5F); 21 | body = new ModelPart(16, 16); 22 | body.setBounds(-4F, 0F, -2F, 8, 12, 4, 0F); 23 | body.setPosition(0F, 4F, 0F); 24 | leg1 = new ModelPart(0, 16); 25 | leg1.setBounds(-2F, 0F, -2F, 4, 6, 4, 0F); 26 | leg1.setPosition(-2F, 16F, 4F); 27 | leg2 = new ModelPart(0, 16); 28 | leg2.setBounds(-2F, 0F, -2F, 4, 6, 4, 0F); 29 | leg2.setPosition(2F, 16F, 4F); 30 | leg3 = new ModelPart(0, 16); 31 | leg3.setBounds(-2F, 0F, -2F, 4, 6, 4, 0F); 32 | leg3.setPosition(-2F, 16F, -4F); 33 | leg4 = new ModelPart(0, 16); 34 | leg4.setBounds(-2F, 0F, -2F, 4, 6, 4, 0F); 35 | leg4.setPosition(2F, 16F, -4F); 36 | } 37 | 38 | @Override 39 | public final void render(float var1, float var2, float var3, 40 | float yawDegrees, float pitchDegrees, float scale) { 41 | head.yaw = yawDegrees / (float) (180D / Math.PI); 42 | head.pitch = pitchDegrees / (float) (180D / Math.PI); 43 | leg1.pitch = MathHelper.cos(var1 * 0.6662F) * 1.4F * var2; 44 | leg2.pitch = MathHelper.cos(var1 * 0.6662F + (float) Math.PI) * 1.4F * var2; 45 | leg3.pitch = MathHelper.cos(var1 * 0.6662F + (float) Math.PI) * 1.4F * var2; 46 | leg4.pitch = MathHelper.cos(var1 * 0.6662F) * 1.4F * var2; 47 | head.render(scale); 48 | body.render(scale); 49 | leg1.render(scale); 50 | leg2.render(scale); 51 | leg3.render(scale); 52 | leg4.render(scale); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/gui/ControlsScreen.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.gui; 2 | 3 | import com.mojang.minecraft.GameSettings; 4 | 5 | public final class ControlsScreen extends GuiScreen { 6 | 7 | private String title = "Controls"; 8 | private GameSettings settings; 9 | private int selected = -1; 10 | 11 | public ControlsScreen(GameSettings gameSettings) { 12 | settings = gameSettings; 13 | } 14 | 15 | @Override 16 | protected final void onButtonClick(Button button) { 17 | for (int i = 0; i < settings.bindings.length; ++i) { 18 | buttons.get(i).text = settings.getBinding(i); 19 | } 20 | 21 | if (button.id == 100) { 22 | minecraft.setCurrentScreen(new MoreControlsScreen(minecraft.settings)); 23 | } else if (button.id == 200) { 24 | minecraft.setCurrentScreen(new OptionsScreen(minecraft.settings)); 25 | } else { 26 | selected = button.id; 27 | button.text = "> " + settings.getBinding(button.id) + " <"; 28 | } 29 | } 30 | 31 | @Override 32 | protected final void onKeyPress(char var1, int var2) { 33 | if (selected >= 0) { 34 | settings.setBinding(selected, var2); 35 | buttons.get(selected).text = settings.getBinding(selected); 36 | selected = -1; 37 | } else { 38 | super.onKeyPress(var1, var2); 39 | } 40 | } 41 | 42 | @Override 43 | public final void onOpen() { 44 | for (int i = 0; i < settings.bindings.length; ++i) { 45 | buttons.add(new OptionButton(i, width / 2 - 155 + i % 2 * 160, height / 6 + 24 46 | * (i >> 1), settings.getBinding(i))); 47 | } 48 | buttons.add(new OptionButton(100, width / 2 - 77 + 10 % 2 * 160, height / 6 + 24 49 | * (10 >> 1), "More...")); 50 | 51 | buttons.add(new Button(200, width / 2 - 100, height / 6 + 168, "Done")); 52 | } 53 | 54 | @Override 55 | public final void render(int var1, int var2) { 56 | drawFadingBox(0, 0, width, height, 1610941696, -1607454624); 57 | drawCenteredString(fontRenderer, title, width / 2, 20, 16777215); 58 | super.render(var1, var2); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/level/tile/IceBlock.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.level.tile; 2 | 3 | import org.lwjgl.opengl.GL11; 4 | 5 | import com.mojang.minecraft.level.Level; 6 | import com.mojang.minecraft.render.ShapeRenderer; 7 | 8 | public final class IceBlock extends Block { 9 | 10 | boolean showNeighborSides = false; 11 | 12 | protected IceBlock(int id) { 13 | super(id); 14 | Block.liquid[id] = true; 15 | } 16 | 17 | @Override 18 | public final boolean canRenderSide(Level level, int x, int y, int z, int side) { 19 | int tile = level.getTile(x, y, z); 20 | return !(!showNeighborSides && tile == id) && super.canRenderSide(level, x, y, z, side); 21 | } 22 | 23 | @Override 24 | public final int getRenderPass() { 25 | return 1; 26 | } 27 | 28 | @Override 29 | public final boolean isOpaque() { 30 | return true; 31 | } 32 | 33 | @Override 34 | public final boolean isSolid() { 35 | return false; 36 | } 37 | 38 | @Override 39 | public void renderInside(ShapeRenderer shapeRenderer, int x, int y, int z, int side) { 40 | int textureID1 = getTextureId(side); 41 | 42 | renderSide(shapeRenderer, x, y, z, side, textureID1); 43 | } 44 | 45 | @Override 46 | public void renderPreview(ShapeRenderer shapeRenderer) { 47 | shapeRenderer.begin(); 48 | GL11.glEnable(GL11.GL_BLEND); 49 | GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); 50 | for (int face = 0; face < 6; ++face) { 51 | /* 52 | * if (face == 0) { shapeRenderer.useNormal(0F, 1F, 0F); } 53 | * 54 | * if (face == 1) { shapeRenderer.useNormal(0F, -1F, 0F); } 55 | * 56 | * if (face == 2) { shapeRenderer.useNormal(0F, 0F, 1F); } 57 | * 58 | * if (face == 3) { shapeRenderer.useNormal(0F, 0F, -1F); } 59 | * 60 | * if (face == 4) { shapeRenderer.useNormal(1F, 0F, 0F); } 61 | * 62 | * if (face == 5) { shapeRenderer.useNormal(-1F, 0F, 0F); } 63 | */ 64 | 65 | renderInside(shapeRenderer, 0, 0, 0, face); 66 | } 67 | GL11.glDisable(GL11.GL_BLEND); 68 | shapeRenderer.end(); 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/nbt/NBTTagString.java: -------------------------------------------------------------------------------- 1 | package com.mojang.nbt; 2 | 3 | import java.io.DataInput; 4 | import java.io.DataOutput; 5 | import java.io.IOException; 6 | 7 | public class NBTTagString extends NBTBase { 8 | /** 9 | * The string value for the tag (cannot be empty). 10 | */ 11 | public String data; 12 | 13 | public NBTTagString(String name) { 14 | super(name); 15 | } 16 | 17 | public NBTTagString(String name, String data) { 18 | super(name); 19 | if (data == null) { 20 | throw new IllegalArgumentException("Empty string not allowed"); 21 | } 22 | 23 | this.data = data; 24 | } 25 | 26 | /** 27 | * Write the actual data contents of the tag, implemented in NBT extension classes. 28 | * 29 | * @param output The output stream to write to. 30 | */ 31 | @Override 32 | void write(DataOutput output) throws IOException { 33 | output.writeUTF(this.data); 34 | } 35 | 36 | /** 37 | * Read the actual data contents of the tag, implemented in NBT extension classes. 38 | * 39 | * @param input The input stream to read from. 40 | */ 41 | @Override 42 | void load(DataInput input) throws IOException { 43 | this.data = input.readUTF(); 44 | } 45 | 46 | /** 47 | * Gets the type byte for the tag. 48 | * 49 | * @return byte 50 | */ 51 | @Override 52 | public byte getId() { 53 | return (byte) 8; 54 | } 55 | 56 | @Override 57 | public String toString() { 58 | return "" + this.data; 59 | } 60 | 61 | /** 62 | * Creates a clone of the tag. 63 | */ 64 | @Override 65 | public NBTBase copy() { 66 | return new NBTTagString(this.getName(), this.data); 67 | } 68 | 69 | @Override 70 | public boolean equals(Object other) { 71 | if (!super.equals(other)) { 72 | return false; 73 | } else { 74 | NBTTagString tempOther = (NBTTagString) other; 75 | return this.data == null && tempOther.data == null || this.data != null 76 | && this.data.equals(tempOther.data); 77 | } 78 | } 79 | 80 | @Override 81 | public int hashCode() { 82 | return super.hashCode() ^ this.data.hashCode(); 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/render/texture/TextureFireFX.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.render.texture; 2 | 3 | import com.mojang.minecraft.level.tile.Block; 4 | 5 | public class TextureFireFX extends TextureFX { 6 | protected float a[]; 7 | protected float b[]; 8 | 9 | public TextureFireFX() { 10 | super(Block.FIRE.textureId); 11 | a = new float[320]; 12 | b = new float[320]; 13 | } 14 | 15 | @Override 16 | public void animate() { 17 | for (int i = 0; i < 16; i++) { 18 | for (int j = 0; j < 20; j++) { 19 | int k = 18; 20 | float f = a[i + (j + 1) % 20 * 16] * k; 21 | for (int i1 = i - 1; i1 <= i + 1; i1++) { 22 | for (int j1 = j; j1 <= j + 1; j1++) { 23 | int l1 = i1; 24 | int j2 = j1; 25 | if (l1 >= 0 && j2 >= 0 && l1 < 16 && j2 < 20) { 26 | f += a[l1 + j2 * 16]; 27 | } 28 | k++; 29 | } 30 | } 31 | 32 | b[i + j * 16] = f / (k * 1.06F); 33 | if (j >= 19) { 34 | b[i + j * 16] = (float) (Math.random() * Math.random() * Math.random() * 4D 35 | + Math.random() * 0.1 + 0.2); 36 | } 37 | } 38 | } 39 | 40 | float af[] = b; 41 | b = a; 42 | a = af; 43 | for (int l = 0; l < 256; l++) { 44 | float f1 = a[l] * 1.8F; 45 | if (f1 > 1F) { 46 | f1 = 1F; 47 | } 48 | if (f1 < 0F) { 49 | f1 = 0F; 50 | } 51 | float f2 = f1; 52 | int k1 = (int) (f2 * 155F + 100F); 53 | int i2 = (int) (f2 * f2 * 255F); 54 | int k2 = (int) (f2 * f2 * f2 * f2 * f2 * f2 * f2 * f2 * f2 * f2 * 255F); 55 | char c = '\377'; 56 | if (f2 < 0.5F) { 57 | c = '\0'; 58 | } 59 | f2 = (f2 - 0.5F) * 2F; 60 | textureData[l * 4 + 0] = (byte) k1; 61 | textureData[l * 4 + 1] = (byte) i2; 62 | textureData[l * 4 + 2] = (byte) k2; 63 | textureData[l * 4 + 3] = (byte) c; 64 | } 65 | } 66 | } -------------------------------------------------------------------------------- /src/main/java/com/mojang/nbt/NBTTagByteArray.java: -------------------------------------------------------------------------------- 1 | package com.mojang.nbt; 2 | 3 | import java.io.DataInput; 4 | import java.io.DataOutput; 5 | import java.io.IOException; 6 | import java.util.Arrays; 7 | 8 | public class NBTTagByteArray extends NBTBase { 9 | /** 10 | * The byte array stored in the tag. 11 | */ 12 | public byte[] byteArray; 13 | 14 | public NBTTagByteArray(String name) { 15 | super(name); 16 | } 17 | 18 | public NBTTagByteArray(String name, byte[] byteArrayInput) { 19 | super(name); 20 | this.byteArray = byteArrayInput; 21 | } 22 | 23 | /** 24 | * Write the actual data contents of the tag, implemented in NBT extension classes. 25 | * 26 | * @param output The output stream to write to. 27 | */ 28 | @Override 29 | void write(DataOutput output) throws IOException { 30 | output.writeInt(this.byteArray.length); 31 | output.write(this.byteArray); 32 | } 33 | 34 | /** 35 | * Read the actual data contents of the tag, implemented in NBT extension classes. 36 | * 37 | * @param input The input stream to read from. 38 | */ 39 | @Override 40 | void load(DataInput input) throws IOException { 41 | int i = input.readInt(); 42 | this.byteArray = new byte[i]; 43 | input.readFully(this.byteArray); 44 | } 45 | 46 | /** 47 | * Gets the type byte for the tag. 48 | * 49 | * @return byte 50 | */ 51 | @Override 52 | public byte getId() { 53 | return (byte) 7; 54 | } 55 | 56 | @Override 57 | public String toString() { 58 | return "[" + this.byteArray.length + " bytes]"; 59 | } 60 | 61 | /** 62 | * Creates a clone of the tag. 63 | */ 64 | @Override 65 | public NBTBase copy() { 66 | byte[] abyte = new byte[this.byteArray.length]; 67 | System.arraycopy(this.byteArray, 0, abyte, 0, this.byteArray.length); 68 | return new NBTTagByteArray(this.getName(), abyte); 69 | } 70 | 71 | @Override 72 | public boolean equals(Object other) { 73 | return super.equals(other) && Arrays.equals(this.byteArray, 74 | ((NBTTagByteArray) other).byteArray); 75 | } 76 | 77 | @Override 78 | public int hashCode() { 79 | return super.hashCode() ^ Arrays.hashCode(this.byteArray); 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/sound/Sound.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.sound; 2 | 3 | // TODO. 4 | public final class Sound implements Audio { 5 | 6 | private AudioInfo info; 7 | private SoundPos pos; 8 | private float pitch = 0F; 9 | private float volume = 1F; 10 | private short[] data = new short[1]; 11 | 12 | public Sound(AudioInfo var1, SoundPos var2) { 13 | info = var1; 14 | pos = var2; 15 | pitch = var2.getRotationDiff(); 16 | volume = var2.getDistanceSq() * var1.volume; 17 | } 18 | 19 | @Override 20 | public boolean isFootStep(boolean really) { 21 | // TODO Auto-generated method stub 22 | return really; 23 | } 24 | 25 | @Override 26 | public final boolean play(int[] var1, int[] var2, int var3) { 27 | if (data.length < var3) { 28 | data = new short[var3]; 29 | } 30 | 31 | int var4; 32 | boolean var5 = (var4 = info.update(data, var3)) > 0; 33 | float var6 = pos.getRotationDiff(); 34 | float var7 = pos.getDistanceSq() * info.volume; 35 | int var8 = (int) ((pitch > 0F ? 1F - pitch : 1F) * volume * 65536F); 36 | int var9 = (int) ((pitch < 0F ? 1F + pitch : 1F) * volume * 65536F); 37 | int var10 = (int) ((var6 > 0F ? 1F - var6 : 1F) * var7 * 65536F); 38 | int var11 = (int) ((var6 < 0F ? var6 + 1F : 1F) * var7 * 65536F); 39 | var10 -= var8; 40 | var11 -= var9; 41 | int var12; 42 | int var13; 43 | int var14; 44 | if (var10 == 0 && var11 == 0) { 45 | if (var8 >= 0 || var9 != 0) { 46 | var12 = var8; 47 | var13 = var9; 48 | 49 | for (var14 = 0; var14 < var4; ++var14) { 50 | var1[var14] += data[var14] * var12 >> 16; 51 | var2[var14] += data[var14] * var13 >> 16; 52 | } 53 | } 54 | } else { 55 | for (var12 = 0; var12 < var4; ++var12) { 56 | var13 = var8 + var10 * var12 / var3; 57 | var14 = var9 + var11 * var12 / var3; 58 | var1[var12] += data[var12] * var13 >> 16; 59 | var2[var12] += data[var12] * var14 >> 16; 60 | } 61 | } 62 | 63 | pitch = var6; 64 | volume = var7; 65 | return var5; 66 | } 67 | 68 | } 69 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/sound/MusicPlayThread.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.sound; 2 | 3 | import java.nio.ByteBuffer; 4 | 5 | import com.mojang.util.LogUtil; 6 | 7 | // TODO. 8 | final class MusicPlayThread extends Thread { 9 | private final Music music; 10 | 11 | public MusicPlayThread(Music var1) { 12 | super(); 13 | music = var1; 14 | setPriority(10); 15 | setDaemon(true); 16 | } 17 | 18 | @Override 19 | public final void run() { 20 | try { 21 | do { 22 | if (music != null && music.stopped) { 23 | break; 24 | } 25 | 26 | ByteBuffer var2; 27 | if (music.playing == null && music.current != null) { 28 | var2 = music.current; 29 | music.playing = var2; 30 | var2 = null; 31 | music.current = null; 32 | music.playing.clear(); 33 | } 34 | 35 | if (music.playing != null && music.playing.remaining() != 0) { 36 | while (true) { 37 | if (music.playing.remaining() == 0) { 38 | break; 39 | } 40 | 41 | var2 = music.playing; 42 | int var10 = music.stream.readPcm(var2.array(), var2.position(), 43 | var2.remaining()); 44 | var2.position(var2.position() + var10); 45 | if (var10 <= 0) { 46 | music.finished = true; 47 | music.stopped = true; 48 | break; 49 | } 50 | } 51 | } 52 | 53 | if (music.playing != null && music.previous == null) { 54 | music.playing.flip(); 55 | var2 = music.playing; 56 | music.previous = var2; 57 | var2 = null; 58 | music.playing = var2; 59 | } 60 | 61 | Thread.sleep(10L); 62 | } while (music.player.running); 63 | 64 | } catch (Exception ex) { 65 | LogUtil.logError("Error while playing music.", ex); 66 | 67 | } finally { 68 | music.finished = true; 69 | } 70 | 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/render/texture/TextureWaterFX.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.render.texture; 2 | 3 | import com.mojang.minecraft.level.tile.Block; 4 | 5 | public final class TextureWaterFX extends TextureFX { 6 | 7 | private float[] red = new float[256]; 8 | private float[] blue = new float[256]; 9 | private float[] green = new float[256]; 10 | private float[] alpha = new float[256]; 11 | 12 | public TextureWaterFX() { 13 | super(Block.WATER.textureId); 14 | } 15 | 16 | @Override 17 | public final void animate() { 18 | int var1; 19 | int var2; 20 | float var3; 21 | int var4; 22 | int var5; 23 | int var6; 24 | for (var1 = 0; var1 < 16; ++var1) { 25 | for (var2 = 0; var2 < 16; ++var2) { 26 | var3 = 0F; 27 | 28 | for (var4 = var1 - 1; var4 <= var1 + 1; ++var4) { 29 | var5 = var4 & 15; 30 | var6 = var2 & 15; 31 | var3 += red[var5 + (var6 << 4)]; 32 | } 33 | 34 | blue[var1 + (var2 << 4)] = var3 / 3.3F + green[var1 + (var2 << 4)] * 0.8F; 35 | } 36 | } 37 | 38 | for (var1 = 0; var1 < 16; ++var1) { 39 | for (var2 = 0; var2 < 16; ++var2) { 40 | green[var1 + (var2 << 4)] += alpha[var1 + (var2 << 4)] * 0.05F; 41 | if (green[var1 + (var2 << 4)] < 0F) { 42 | green[var1 + (var2 << 4)] = 0F; 43 | } 44 | 45 | alpha[var1 + (var2 << 4)] -= 0.1F; 46 | if (Math.random() < 0.05D) { 47 | alpha[var1 + (var2 << 4)] = 0.5F; 48 | } 49 | } 50 | } 51 | 52 | float[] var8 = blue; 53 | blue = red; 54 | red = var8; 55 | 56 | for (var2 = 0; var2 < 256; ++var2) { 57 | if ((var3 = red[var2]) > 1F) { 58 | var3 = 1F; 59 | } 60 | 61 | if (var3 < 0F) { 62 | var3 = 0F; 63 | } 64 | 65 | float var9 = var3 * var3; 66 | var5 = (int) (32F + var9 * 32F); 67 | var6 = (int) (50F + var9 * 64F); 68 | var1 = 255; 69 | int var10 = (int) (146F + var9 * 50F); 70 | textureData[var2 << 2] = (byte) var5; 71 | textureData[(var2 << 2) + 1] = (byte) var6; 72 | textureData[(var2 << 2) + 2] = (byte) var1; 73 | textureData[(var2 << 2) + 3] = (byte) var10; 74 | } 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/level/LevelLoader.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.level; 2 | 3 | import java.io.DataInputStream; 4 | import java.io.File; 5 | import java.io.FileInputStream; 6 | import java.io.FileNotFoundException; 7 | import java.io.IOException; 8 | import java.io.InputStream; 9 | import java.util.zip.GZIPInputStream; 10 | 11 | import com.mojang.util.LogUtil; 12 | import com.mojang.nbt.CompressedStreamTools; 13 | import com.mojang.nbt.NBTTagCompound; 14 | import com.mojang.minecraft.player.Player; 15 | 16 | public class LevelLoader { 17 | 18 | // Used for received map streams from servers 19 | public static byte[] decompress(InputStream input) throws IOException { 20 | try (DataInputStream stream = new DataInputStream(new GZIPInputStream(input))) { 21 | byte[] blockArray = new byte[stream.readInt()]; 22 | stream.readFully(blockArray); 23 | return blockArray; 24 | } 25 | } 26 | 27 | public Level load(File fullFilePath, Player player) throws FileNotFoundException, IOException { 28 | LogUtil.logInfo("Loading level " + fullFilePath.getAbsolutePath()); 29 | NBTTagCompound tc = CompressedStreamTools.readCompressed(new FileInputStream(fullFilePath)); 30 | 31 | Level newLevel = new Level(); 32 | byte FormatVersion = tc.getByte("FormatVersion"); 33 | 34 | String Name = tc.getString("Name"); 35 | byte[] UUID = tc.getByteArray("UUID"); 36 | short X = tc.getShort("X"); 37 | short Y = tc.getShort("Y"); 38 | short Z = tc.getShort("Z"); 39 | 40 | byte[] blocks = tc.getByteArray("BlockArray"); 41 | 42 | newLevel.width = X; 43 | newLevel.length = Z; 44 | newLevel.height = Y; 45 | newLevel.blocks = blocks; 46 | 47 | NBTTagCompound spawn = tc.getCompoundTag("Spawn"); 48 | 49 | short x = spawn.getShort("X"); 50 | short y = spawn.getShort("Y"); 51 | short z = spawn.getShort("Z"); 52 | short r = spawn.getByte("H"); 53 | short l = spawn.getByte("P"); 54 | newLevel.desiredSpawn = new short[]{x, y, z, r, l}; 55 | 56 | boolean debug = false; 57 | if (debug) { 58 | LogUtil.logInfo("FormatVersion=" + FormatVersion); 59 | LogUtil.logInfo("Name=" + Name); 60 | LogUtil.logInfo("UUID=byte[" + UUID.length + "]"); 61 | LogUtil.logInfo("X=" + X); 62 | LogUtil.logInfo("Y=" + Y); 63 | LogUtil.logInfo("Z=" + Z); 64 | LogUtil.logInfo("blocks=byte[" + blocks.length + "]"); 65 | } 66 | return newLevel; 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/item/ItemModel.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.item; 2 | 3 | import com.mojang.minecraft.model.ModelPart; 4 | import com.mojang.minecraft.model.TexturedQuad; 5 | import com.mojang.util.Vertex; 6 | 7 | public class ItemModel { 8 | private ModelPart model = new ModelPart(0, 0); 9 | 10 | public ItemModel(int tex) { 11 | float var3 = -2F; 12 | float var4 = -2F; 13 | float var15 = -2F; 14 | 15 | model.vertices = new Vertex[8]; 16 | model.quads = new TexturedQuad[6]; 17 | 18 | Vertex vertex1 = new Vertex(var15, var4, var3, 0F, 0F); 19 | Vertex vertex2 = new Vertex(2F, var4, var3, 0F, 8F); 20 | Vertex vertex3 = new Vertex(2F, 2F, var3, 8F, 8F); 21 | Vertex vertex4 = new Vertex(var15, 2F, var3, 8F, 0F); 22 | Vertex vertex5 = new Vertex(var15, var4, 2F, 0F, 0F); 23 | Vertex vertex6 = new Vertex(2F, var4, 2F, 0F, 8F); 24 | Vertex vertex7 = new Vertex(2F, 2F, 2F, 8F, 8F); 25 | Vertex vertex8 = new Vertex(var15, 2F, 2F, 8F, 0F); 26 | 27 | model.vertices[0] = vertex1; 28 | model.vertices[1] = vertex2; 29 | model.vertices[2] = vertex3; 30 | model.vertices[3] = vertex4; 31 | model.vertices[4] = vertex5; 32 | model.vertices[5] = vertex6; 33 | model.vertices[6] = vertex7; 34 | model.vertices[7] = vertex8; 35 | 36 | float u1 = (tex % 16 + (1F - 0.25F)) / 16F; 37 | float v1 = (tex / 16 + (1F - 0.25F)) / 16F; 38 | float u2 = (tex % 16 + 0.25F) / 16F; 39 | float v2 = (tex / 16 + 0.25F) / 16F; 40 | 41 | Vertex[] vertexes1 = new Vertex[]{vertex6, vertex2, vertex3, vertex7}; 42 | Vertex[] vertexes2 = new Vertex[]{vertex1, vertex5, vertex8, vertex4}; 43 | Vertex[] vertexes3 = new Vertex[]{vertex6, vertex5, vertex1, vertex2}; 44 | Vertex[] vertexes4 = new Vertex[]{vertex3, vertex4, vertex8, vertex7}; 45 | Vertex[] vertexes5 = new Vertex[]{vertex2, vertex1, vertex4, vertex3}; 46 | Vertex[] vertexes6 = new Vertex[]{vertex5, vertex6, vertex7, vertex8}; 47 | 48 | model.quads[0] = new TexturedQuad(vertexes1, u1, v1, u2, v2); 49 | model.quads[1] = new TexturedQuad(vertexes2, u1, v1, u2, v2); 50 | model.quads[2] = new TexturedQuad(vertexes3, u1, v1, u2, v2); 51 | model.quads[3] = new TexturedQuad(vertexes4, u1, v1, u2, v2); 52 | model.quads[4] = new TexturedQuad(vertexes5, u1, v1, u2, v2); 53 | model.quads[5] = new TexturedQuad(vertexes6, u1, v1, u2, v2); 54 | } 55 | 56 | public void generateList() { 57 | model.render(0.0625F); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/nbt/NBTTagIntArray.java: -------------------------------------------------------------------------------- 1 | package com.mojang.nbt; 2 | 3 | import java.io.DataInput; 4 | import java.io.DataOutput; 5 | import java.io.IOException; 6 | import java.util.Arrays; 7 | 8 | public class NBTTagIntArray extends NBTBase { 9 | /** 10 | * The array of saved integers 11 | */ 12 | public int[] intArray; 13 | 14 | public NBTTagIntArray(String name) { 15 | super(name); 16 | } 17 | 18 | public NBTTagIntArray(String name, int[] intArrayInput) { 19 | super(name); 20 | this.intArray = intArrayInput; 21 | } 22 | 23 | /** 24 | * Write the actual data contents of the tag, implemented in NBT extension classes. 25 | * 26 | * @param output The output stream to write to. 27 | */ 28 | @Override 29 | void write(DataOutput output) throws IOException { 30 | output.writeInt(this.intArray.length); 31 | 32 | for (int anIntArray : this.intArray) { 33 | output.writeInt(anIntArray); 34 | } 35 | } 36 | 37 | /** 38 | * Read the actual data contents of the tag, implemented in NBT extension classes. 39 | * 40 | * @param input The input stream to read from. 41 | */ 42 | @Override 43 | void load(DataInput input) throws IOException { 44 | int i = input.readInt(); 45 | this.intArray = new int[i]; 46 | 47 | for (int j = 0; j < i; ++j) { 48 | this.intArray[j] = input.readInt(); 49 | } 50 | } 51 | 52 | /** 53 | * Gets the type byte for the tag. 54 | * 55 | * @return byte 56 | */ 57 | @Override 58 | public byte getId() { 59 | return (byte) 11; 60 | } 61 | 62 | @Override 63 | public String toString() { 64 | return "[" + this.intArray.length + " bytes]"; 65 | } 66 | 67 | /** 68 | * Creates a clone of the tag. 69 | */ 70 | @Override 71 | public NBTBase copy() { 72 | int[] aint = new int[this.intArray.length]; 73 | System.arraycopy(this.intArray, 0, aint, 0, this.intArray.length); 74 | return new NBTTagIntArray(this.getName(), aint); 75 | } 76 | 77 | @Override 78 | public boolean equals(Object other) { 79 | if (!super.equals(other)) { 80 | return false; 81 | } else { 82 | NBTTagIntArray tempOther = (NBTTagIntArray) other; 83 | return this.intArray == null && tempOther.intArray == null || this.intArray != null 84 | && Arrays.equals(this.intArray, tempOther.intArray); 85 | } 86 | } 87 | 88 | @Override 89 | public int hashCode() { 90 | return super.hashCode() ^ Arrays.hashCode(this.intArray); 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/util/Vec3D.java: -------------------------------------------------------------------------------- 1 | package com.mojang.util; 2 | 3 | public final class Vec3D { 4 | 5 | public float x; 6 | public float y; 7 | public float z; 8 | 9 | public Vec3D(float x, float y, float z) { 10 | this.x = x; 11 | this.y = y; 12 | this.z = z; 13 | } 14 | 15 | public final Vec3D add(float otherX, float otherY, float otherZ) { 16 | return new Vec3D(x + otherX, y + otherY, z + otherZ); 17 | } 18 | 19 | public final float distance(Vec3D other) { 20 | float xDiff = other.x - x; 21 | float yDiff = other.y - y; 22 | float zDiff = other.z - z; 23 | return MathHelper.sqrt(xDiff * xDiff + yDiff * yDiff + zDiff * zDiff); 24 | } 25 | 26 | public final float distanceSquared(Vec3D other) { 27 | float xDiff = other.x - x; 28 | float yDiff = other.y - y; 29 | float zDiff = other.z - z; 30 | return xDiff * xDiff + yDiff * yDiff + zDiff * zDiff; 31 | } 32 | 33 | public final Vec3D getXIntersection(Vec3D other, float xAxis) { 34 | float xDiff = other.x - x; 35 | float yDiff = other.y - y; 36 | float zDiff = other.z - z; 37 | return xDiff * xDiff < 1.0E-7F ? null 38 | : (xAxis = (xAxis - x) / xDiff) >= 0F && xAxis <= 1F ? new Vec3D(x + xDiff * xAxis, 39 | y + yDiff * xAxis, z + zDiff * xAxis) : null; 40 | } 41 | 42 | public final Vec3D getYIntersection(Vec3D other, float yAxis) { 43 | float xDiff = other.x - x; 44 | float yDiff = other.y - y; 45 | float zDiff = other.z - z; 46 | return yDiff * yDiff < 1.0E-7F ? null 47 | : (yAxis = (yAxis - y) / yDiff) >= 0F && yAxis <= 1F ? new Vec3D(x + xDiff * yAxis, 48 | y + yDiff * yAxis, z + zDiff * yAxis) : null; 49 | } 50 | 51 | public final Vec3D getZIntersection(Vec3D other, float zAxis) { 52 | float xDiff = other.x - x; 53 | float yDiff = other.y - y; 54 | float zDiff = other.z - z; 55 | return zDiff * zDiff < 1.0E-7F ? null 56 | : (zAxis = (zAxis - z) / zDiff) >= 0F && zAxis <= 1F ? new Vec3D(x + xDiff * zAxis, 57 | y + yDiff * zAxis, z + zDiff * zAxis) : null; 58 | } 59 | 60 | public final Vec3D normalize() { 61 | float dist = MathHelper.sqrt(x * x + y * y + z * z); 62 | return new Vec3D(x / dist, y / dist, z / dist); 63 | } 64 | 65 | public final Vec3D subtract(Vec3D other) { 66 | return new Vec3D(x - other.x, y - other.y, z - other.z); 67 | } 68 | 69 | @Override 70 | public final String toString() { 71 | return "(" + x + ", " + y + ", " + z + ")"; 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/ChatClickData.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft; 2 | 3 | import java.net.URI; 4 | import java.net.URISyntaxException; 5 | import java.util.ArrayList; 6 | import java.util.regex.Matcher; 7 | import java.util.regex.Pattern; 8 | 9 | import com.mojang.minecraft.gui.FontRenderer; 10 | 11 | /** 12 | * Class used to store data for clicking URLs in the chat screen 13 | * 14 | * @author Jon 15 | */ 16 | public class ChatClickData { 17 | 18 | public final String message; 19 | 20 | // Regex pattern courtesy of Matthew O'Riordan 21 | private final String urlPattern = "\\(?(?:(?:[a-z]{2,9}:(?:\\/\\/)?)(?:[\\-;:&=\\+\\$,\\w]+@)?[a-z0-9\\-]+(?:\\.[a-z0-9\\-]+)+|www\\.[a-z0-9\\-]+(?:\\.[a-z0-9\\-]+)+)(?::\\d{1,5})?(?:\\/[\\+~%\\/\\.\\w\\-\\(\\)]*)?(?:\\?[\\-\\+=&;%@\\.\\w]*)?(?:#\\S*)?"; 22 | private final Pattern compiledPattern = Pattern.compile(urlPattern, Pattern.CASE_INSENSITIVE); 23 | 24 | public ChatClickData(String message) { 25 | this.message = FontRenderer.stripColor(message); 26 | } 27 | 28 | public ArrayList getClickedUrls(FontRenderer fontRenderer) { 29 | return pullLinks(message, fontRenderer); 30 | } 31 | 32 | /** 33 | * Strips any URLs from the the line where the user clicked 34 | * 35 | * @param text The text in question 36 | * @param fr The font renderer instance 37 | * @return ArrayList of LinkData 38 | */ 39 | private ArrayList pullLinks(String text, FontRenderer fr) { 40 | ArrayList links = new ArrayList<>(); 41 | Matcher m = compiledPattern.matcher(text); 42 | while (m.find()) { 43 | int start = m.start(); 44 | int end = m.end(); 45 | String urlStr = m.group(); 46 | if (urlStr.charAt(0) == '(') { 47 | start++; 48 | if (urlStr.endsWith(")")) { 49 | end--; 50 | } 51 | urlStr = text.substring(start, end); 52 | } 53 | 54 | try { 55 | links.add(new LinkData(new URI(urlStr), 56 | fr.getWidth(text.substring(0, start)), 57 | fr.getWidth(text.substring(0, end)))); 58 | } catch (URISyntaxException ex) { 59 | // Suppress 60 | } 61 | } 62 | return links; 63 | } 64 | 65 | public class LinkData { 66 | 67 | public URI url; 68 | public int x0; 69 | public int x1; 70 | 71 | public LinkData(URI textualLink, int x0, int x1) { 72 | url = textualLink; 73 | this.x0 = x0; 74 | this.x1 = x1; 75 | } 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/gui/ErrorScreen.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.gui; 2 | 3 | import com.mojang.minecraft.Minecraft; 4 | import com.mojang.util.Timer; 5 | 6 | public final class ErrorScreen extends GuiScreen { 7 | 8 | private final String title; 9 | private final String text; 10 | private final double endTime; 11 | private static final int RECONNECT_DELAY = 3; // Wait 3 seconds before allowing reconnect 12 | 13 | public ErrorScreen(String title, String subtitle) { 14 | this.title = title; 15 | text = subtitle; 16 | isOpaque = true; 17 | endTime = System.nanoTime() / Timer.NANOSEC_PER_SEC + RECONNECT_DELAY; 18 | } 19 | 20 | @Override 21 | protected final void onButtonClick(Button button) { 22 | if (button.id == 0) { 23 | minecraft.setCurrentScreen(null); 24 | if (Minecraft.isSinglePlayer) { 25 | minecraft.restartSinglePlayer(); 26 | } else { 27 | minecraft.reconnect(); 28 | } 29 | } 30 | } 31 | 32 | @Override 33 | protected final void onKeyPress(char var1, int var2) { 34 | } 35 | 36 | @Override 37 | public final void onOpen() { 38 | buttons.clear(); 39 | this.buttons.add(new Button(0, this.width / 2 - 100, this.height / 4 + 96, 40 | !Minecraft.isSinglePlayer ? "Try to reconnect..." + secondsUntilReconnect() : "Restart ClassiCube")); 41 | if (minecraft.isFullScreen) { 42 | minecraft.toggleFullscreen(); 43 | } 44 | } 45 | 46 | int secondsUntilReconnect() { 47 | double now = System.nanoTime() / Timer.NANOSEC_PER_SEC; 48 | return (int) Math.max(0, Math.ceil(endTime - now)); 49 | } 50 | 51 | @Override 52 | public final void render(int mouseX, int mouseY) { 53 | drawFadingBox(0, 0, width, height, -12574688, -11530224); 54 | drawCenteredString(fontRenderer, title, width / 2, 90, 16777215); 55 | drawCenteredString(fontRenderer, text, width / 2, 110, 16777215); 56 | super.render(mouseX, mouseY); 57 | String buttonLabel; 58 | int secToReconnect = secondsUntilReconnect(); 59 | if (Minecraft.isSinglePlayer) { 60 | buttonLabel = "Restart ClassiCube"; 61 | } else { 62 | buttonLabel = "Try to reconnect"; 63 | if (secToReconnect > 0) { 64 | buttonLabel = buttonLabel + "..." + secondsUntilReconnect(); 65 | } 66 | } 67 | buttons.set(0, new Button(0, this.width / 2 - 100, this.height / 4 + 96, buttonLabel)); 68 | if (!Minecraft.isSinglePlayer && secToReconnect > 0) { 69 | buttons.get(0).active = false; 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /src/main/java/com/mojang/minecraft/gamemode/GameMode.java: -------------------------------------------------------------------------------- 1 | package com.mojang.minecraft.gamemode; 2 | 3 | import com.mojang.minecraft.Minecraft; 4 | import com.mojang.minecraft.level.Level; 5 | import com.mojang.minecraft.level.MobSpawner; 6 | import com.mojang.minecraft.level.tile.Block; 7 | import com.mojang.minecraft.player.Player; 8 | 9 | public class GameMode { 10 | public Minecraft minecraft; 11 | public boolean instantBreak; 12 | public float reachDistance = 5F; 13 | public MobSpawner spawner; 14 | 15 | public GameMode(Minecraft minecraft) { 16 | this.minecraft = minecraft; 17 | 18 | instantBreak = false; 19 | } 20 | 21 | public void apply(Level level) { 22 | level.creativeMode = false; 23 | level.growTrees = true; 24 | } 25 | 26 | public void openInventory() { 27 | } 28 | 29 | public void hitBlock(int x, int y, int z) { 30 | this.breakBlock(x, y, z); 31 | } 32 | 33 | public boolean canPlace(int block) { 34 | return true; 35 | } 36 | 37 | public void breakBlock(int x, int y, int z) { 38 | Level level = minecraft.level; 39 | Block block = Block.blocks[level.getTile(x, y, z)]; 40 | 41 | boolean success = level.netSetTile(x, y, z, 0); 42 | 43 | if (block != null && success) { 44 | if (minecraft.isOnline()) { 45 | minecraft.networkManager.sendBlockChange(x, y, z, 0, 46 | minecraft.player.inventory.getSelected()); 47 | } 48 | 49 | if (block.stepSound != Block.soundNone && block.stepSound != null) { 50 | level.playSound("step." + block.stepSound.stepSoundName, x, y, z, 51 | (block.stepSound.getVolume() + 1F) / 2F, block.stepSound.getPitch() * 0.8F); 52 | } 53 | 54 | block.spawnBreakParticles(level, x, y, z, minecraft.particleManager); 55 | } 56 | 57 | } 58 | 59 | public void hitBlock(int x, int y, int z, int side) { 60 | } 61 | 62 | public void resetHits() { 63 | } 64 | 65 | public void applyCracks(float time) { 66 | } 67 | 68 | public float getReachDistance() { 69 | return reachDistance; 70 | } 71 | 72 | public boolean useItem(Player player, int type) { 73 | return false; 74 | } 75 | 76 | public void preparePlayer(Player player) { 77 | } 78 | 79 | public void spawnMob() { 80 | } 81 | 82 | public void prepareLevel(Level level) { 83 | } 84 | 85 | public boolean isSurvival() { 86 | return true; 87 | } 88 | 89 | public void apply(Player player) { 90 | } 91 | 92 | public void stopSpawner(Level level) { 93 | // TODO Auto-generated method stub 94 | 95 | } 96 | } 97 | --------------------------------------------------------------------------------